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

Steven Liu lq at chinaffmpeg.org
Sun Aug 12 11:35:37 EEST 2018



> On Aug 11, 2018, at 08:20, sanil <raut.sanil at gmail.com> wrote:
> 
> 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 | 13 ++++++++++++-
> 1 file changed, 12 insertions(+), 1 deletion(-)
> 
> diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
> index 5730252..f851bbf 100644
> --- a/libavformat/dashdec.c
> +++ b/libavformat/dashdec.c
> @@ -259,6 +259,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)
> @@ -1322,7 +1328,12 @@ static int64_t calc_max_seg_no(struct representation *pls, DASHContext *c)
>         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;
> +            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;
> -- 
> Thanks,
> 
> 2.7.4
> 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


will apply


Thanks
Steven







More information about the ffmpeg-devel mailing list