From 9953ff31ab1e86ba9421f7ace410dbda5ffa0fd2 Mon Sep 17 00:00:00 2001 From: David Winder Date: Tue, 3 Oct 2023 11:20:01 +0300 Subject: [PATCH] Change the field name to id --- README.md | 2 +- vod/hls/hls_muxer.c | 16 ++++++++-------- vod/media_clip.h | 2 +- vod/media_set_parser.c | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index fe9adf70..6d5bc9b7 100644 --- a/README.md +++ b/README.md @@ -571,6 +571,7 @@ Mandatory fields: an empty captions file (useful in case only some videos in a playlist have captions) Optional fields: +* `id` - a string that identifies the source clip * `sourceType` - sets the interface that should be used to read the MP4 file, allowed values are: `file` and `http`. By default, the module uses `http` if `vod_remote_upstream_location` is set, and `file` otherwise. @@ -584,7 +585,6 @@ Optional fields: to decrypt the file. * `encryptionScheme` - the encryption scheme that was used to encrypt the file. Currently, only two schemes are supported - `cenc` for MP4 files, `aes-cbc` for caption files. -* `id3TagLabel` - a string contain label to insert in the data stream. This will be done only when `vod_hls_mpegts_output_id3_timestamps` is ON and the root sequnce has ID #### Rate filter clip diff --git a/vod/hls/hls_muxer.c b/vod/hls/hls_muxer.c index 91bd6ed9..a7230ad8 100644 --- a/vod/hls/hls_muxer.c +++ b/vod/hls/hls_muxer.c @@ -11,10 +11,10 @@ #define ID3_TEXT_JSON_FORMAT "{\"timestamp\":%uL}%Z" #define ID3_TEXT_JSON_SEQUENCE_ID_PREFIX_FORMAT "{\"timestamp\":%uL,\"sequenceId\":\"" -#define ID3_TEXT_JSON_CLIP_LABEL_FORMAT "\",\"clipLabel\":\"" +#define ID3_TEXT_JSON_CLIP_ID_FORMAT "\",\"clipId\":\"" #define ID3_TEXT_JSON_SEQUENCE_ID_SUFFIX "\"}" -#define CLIP_LABEL_MAX_SIZE 32 +#define CLIP_ID_MAX_SIZE 32 // from ffmpeg mpegtsenc #define DEFAULT_PES_HEADER_FREQ 16 @@ -174,7 +174,7 @@ hls_muxer_init_id3_stream( size_t data_size; int64_t timestamp; void* frames_source_context; - vod_str_t clip_label; + vod_str_t clip_id; cur_stream = state->last_stream; @@ -202,7 +202,7 @@ hls_muxer_init_id3_stream( sequence_id_escape = vod_escape_json(NULL, sequence_id->data, sequence_id->len); data_size = sizeof(ID3_TEXT_JSON_SEQUENCE_ID_PREFIX_FORMAT) + VOD_INT64_LEN + sequence_id->len + sequence_id_escape + - sizeof(ID3_TEXT_JSON_CLIP_LABEL_FORMAT) + CLIP_LABEL_MAX_SIZE + + sizeof(ID3_TEXT_JSON_CLIP_ID_FORMAT) + CLIP_ID_MAX_SIZE + sizeof(ID3_TEXT_JSON_SEQUENCE_ID_SUFFIX); } else @@ -274,11 +274,11 @@ hls_muxer_init_id3_stream( p = vod_copy(p, sequence_id->data, sequence_id->len); } - clip_label = ref_track->file_info.source->id3_tag_label; - if (clip_label.len != 0) + clip_id = ref_track->file_info.source->id; + if (clip_id.len != 0) { - p = vod_copy(p, ID3_TEXT_JSON_CLIP_LABEL_FORMAT, sizeof(ID3_TEXT_JSON_CLIP_LABEL_FORMAT) - 1); - p = vod_copy(p, clip_label.data, vod_min(CLIP_LABEL_MAX_SIZE, clip_label.len)); + p = vod_copy(p, ID3_TEXT_JSON_CLIP_ID_FORMAT, sizeof(ID3_TEXT_JSON_CLIP_ID_FORMAT) - 1); + p = vod_copy(p, clip_id.data, vod_min(CLIP_ID_MAX_SIZE, clip_id.len)); } p = vod_copy(p, ID3_TEXT_JSON_SEQUENCE_ID_SUFFIX, sizeof(ID3_TEXT_JSON_SEQUENCE_ID_SUFFIX)); diff --git a/vod/media_clip.h b/vod/media_clip.h index 19c88090..c8ab87e2 100644 --- a/vod/media_clip.h +++ b/vod/media_clip.h @@ -65,6 +65,7 @@ typedef struct ngx_http_vod_reader_s ngx_http_vod_reader_t; struct media_clip_source_s { // base media_clip_t base; + vod_str_t id; int64_t clip_time; media_range_t* range; media_track_array_t track_array; @@ -94,7 +95,6 @@ struct media_clip_source_s { media_clip_source_t* next; uint64_t last_offset; - vod_str_t id3_tag_label; }; typedef struct { diff --git a/vod/media_set_parser.c b/vod/media_set_parser.c index 27c3e728..d01f3892 100644 --- a/vod/media_set_parser.c +++ b/vod/media_set_parser.c @@ -119,6 +119,7 @@ static json_parser_union_type_def_t media_clip_union_params[] = { }; static json_object_value_def_t media_clip_source_params[] = { + { vod_string("id"), VOD_JSON_STRING, offsetof(media_clip_source_t, id), media_set_parse_null_term_string }, { vod_string("path"), VOD_JSON_STRING, offsetof(media_clip_source_t, mapped_uri), media_set_parse_null_term_string }, { vod_string("tracks"), VOD_JSON_STRING, offsetof(media_clip_source_t, tracks_mask), media_set_parse_tracks_spec }, { vod_string("clipFrom"), VOD_JSON_INT, offsetof(media_clip_source_t, clip_from), media_set_parse_int64 }, @@ -126,7 +127,6 @@ static json_object_value_def_t media_clip_source_params[] = { { vod_string("encryptionKey"), VOD_JSON_STRING, offsetof(media_clip_source_t, encryption.key), media_set_parse_base64_string }, { vod_string("encryptionIv"), VOD_JSON_STRING, offsetof(media_clip_source_t, encryption.iv), media_set_parse_base64_string }, { vod_string("sourceType"), VOD_JSON_STRING, offsetof(media_clip_source_t, source_type), media_set_parse_source_type }, - { vod_string("id3TagLabel"), VOD_JSON_STRING, offsetof(media_clip_source_t, id3_tag_label), media_set_parse_null_term_string }, { vod_null_string, 0, 0, NULL } };