diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 00000000..13566b81 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 00000000..6e5b384c --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/nginx-vod-module.iml b/.idea/nginx-vod-module.iml new file mode 100644 index 00000000..bc2cd874 --- /dev/null +++ b/.idea/nginx-vod-module.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 00000000..35eb1ddf --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/vod/hds/hds_amf0_encoder.c b/vod/hds/hds_amf0_encoder.c index d20b79d2..f587b1c4 100644 --- a/vod/hds/hds_amf0_encoder.c +++ b/vod/hds/hds_amf0_encoder.c @@ -127,7 +127,6 @@ hds_amf0_write_metadata(u_char* p, media_set_t* media_set, media_track_t** track uint64_t duration; uint32_t timescale; uint32_t count; - uint32_t bitrate = 0; uint8_t sound_format; count = AMF0_COMMON_FIELDS_COUNT; @@ -155,7 +154,6 @@ hds_amf0_write_metadata(u_char* p, media_set_t* media_set, media_track_t** track if (tracks[MEDIA_TYPE_VIDEO] != NULL) { media_info = &tracks[MEDIA_TYPE_VIDEO]->media_info; - bitrate += media_info->bitrate; p = hds_amf0_append_array_number_value(p, &amf0_width, media_info->u.video.width); p = hds_amf0_append_array_number_value(p, &amf0_height, media_info->u.video.height); p = hds_amf0_append_array_number_value(p, &amf0_videodatarate, (double)media_info->bitrate / 1000.0); @@ -166,7 +164,6 @@ hds_amf0_write_metadata(u_char* p, media_set_t* media_set, media_track_t** track if (tracks[MEDIA_TYPE_AUDIO] != NULL) { media_info = &tracks[MEDIA_TYPE_AUDIO]->media_info; - bitrate += media_info->bitrate; p = hds_amf0_append_array_number_value(p, &amf0_audiodatarate, (double)media_info->bitrate / 1000.0); p = hds_amf0_append_array_number_value(p, &amf0_audiosamplerate, media_info->u.audio.sample_rate); p = hds_amf0_append_array_number_value(p, &amf0_audiosamplesize, media_info->u.audio.bits_per_sample); diff --git a/vod/subtitle/webvtt_builder.c b/vod/subtitle/webvtt_builder.c index 73a266a2..4dfe65d4 100644 --- a/vod/subtitle/webvtt_builder.c +++ b/vod/subtitle/webvtt_builder.c @@ -31,6 +31,8 @@ webvtt_builder_build( input_frame_t* cur_frame; input_frame_t* last_frame; uint64_t start_time; + uint64_t segment_start_time = media_set->segment_start_time; + //uint64_t segment_end_time = media_set->segment_start_time + media_set->segment_duration; uint32_t id_size; size_t result_size; u_char* end; @@ -85,21 +87,25 @@ webvtt_builder_build( last_frame = part->last_frame; } - src = (u_char*)(uintptr_t)cur_frame->offset; + if (start_time >= segment_start_time) { + src = (u_char * )(uintptr_t) + cur_frame->offset; - // cue identifier - id_size = cur_frame->key_frame; - p = vod_copy(p, src, id_size); - src += id_size; + // cue identifier + id_size = cur_frame->key_frame; + p = vod_copy(p, src, id_size); + src += id_size; - // cue timings - p = webvtt_builder_write_timestamp(p, start_time); - p = vod_copy(p, WEBVTT_TIMESTAMP_DELIM, sizeof(WEBVTT_TIMESTAMP_DELIM) - 1); - p = webvtt_builder_write_timestamp(p, start_time + cur_frame->pts_delay); - start_time += cur_frame->duration; + // cue timings + p = webvtt_builder_write_timestamp(p, start_time); + p = vod_copy(p, WEBVTT_TIMESTAMP_DELIM, sizeof(WEBVTT_TIMESTAMP_DELIM) - 1); + p = webvtt_builder_write_timestamp(p, start_time + cur_frame->pts_delay); + + // cue settings list + cue payload + p = vod_copy(p, src, cur_frame->size - id_size); + } - // cue settings list + cue payload - p = vod_copy(p, src, cur_frame->size - id_size); + start_time += cur_frame->duration; } }