[FFmpeg-devel] [PATCH] libavformat/dashdec: Support negative value of the @r attrbute of S in SegmentTimeline element

Liu Steven lq at chinaffmpeg.org
Tue Aug 7 06:06:05 EEST 2018



> 在 2018年8月7日,上午10:50,sanil <raut.sanil at gmail.com> 写道:
> 
> Hi,
> The following patch supports parsing negative value of the @r attribute of S in SegmentTimeline element.
> 
> Example streams:
> 1. http://dash.edgesuite.net/dash264/TestCases/1c/qualcomm/1/MultiRate.mpd
> 2. http://dash.edgesuite.net/dash264/TestCases/1c/qualcomm/2/MultiRate.mpd
> 
> ---
> libavformat/dashdec.c | 18 +++++++++++++++---
> 1 file changed, 15 insertions(+), 3 deletions(-)
> 
> diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
> index 89f3ac2..ea960bc 100644
> --- a/libavformat/dashdec.c
> +++ b/libavformat/dashdec.c
> @@ -262,6 +262,12 @@ static int64_t get_segment_start_time_based_on_timeline(struct representation *p
>                 goto finish;
> 
>             start_time += pls->timelines[i]->duration;
> +    
> +            if (pls->timelines[i]->repeat == -1) {
> +                start_time = pls->timelines[i]->duration * cur_seq_no;
> +                goto finish;
> +            }
> +
>             for (j = 0; j < pls->timelines[i]->repeat; j++) {
>                 num++;
>                 if (num == cur_seq_no)
> @@ -1341,9 +1347,15 @@ static int64_t calc_max_seg_no(struct representation *pls, DASHContext *c)
>     } else if (pls->n_timelines) {
>         int i = 0;
>         num = pls->first_seq_no + pls->n_timelines - 1;
> -        for (i = 0; i < pls->n_timelines; i++) {
> -            num += pls->timelines[i]->repeat;
> +         for (i = 0; i < pls->n_timelines; i++) {
> +            if (pls->timelines[i]->repeat == -1) {
> +                int length_of_each_segment = pls->timelines[i]->duration/pls->fragment_timescale;
> +                num =  c->period_duration/length_of_each_segment;
> +            } else {
> +                num += pls->timelines[i]->repeat;
> +            }
>         }
> +
>     } else if (c->is_live && pls->fragment_duration) {
>         num = pls->first_seq_no + (((get_current_time_in_sec() - c->availability_start_time)) * pls->fragment_timescale)  / pls->fragment_duration;
>     } else if (pls->fragment_duration) {
> @@ -1952,7 +1964,7 @@ static int dash_read_header(AVFormatContext *s)
>         ++stream_index;
>     }
> 
> -  c->is_init_section_common_audio = is_common_init_section_exist(c->audios, c->n_audios);
> +    c->is_init_section_common_audio = is_common_init_section_exist(c->audios, c->n_audios);
> 
>     for (i = 0; i < c->n_audios; i++) {
>         struct representation *cur_audio = c->audios[i];
> -- 
> 
> Thanks,
> 2.7.4
> 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


LGTM


Thanks

Steven





More information about the ffmpeg-devel mailing list