diff options
author | Steven Liu <lq@chinaffmpeg.org> | 2019-09-10 10:31:32 +0800 |
---|---|---|
committer | Steven Liu <lq@chinaffmpeg.org> | 2019-09-12 10:41:06 +0800 |
commit | e55018ee110bf42e32739b1725411dde44e70291 (patch) | |
tree | 87f843f7a63645b9c8c9246c1fe333016d19a2a8 /libavformat/dashdec.c | |
parent | 9ff8fbda6598ec6ce231e81e756e2c68e9c8f59f (diff) |
avformat/dashdec: add startNumber parser for segmentlist
and get start_number for compute current segment number.
fix ticket: 7976
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
Diffstat (limited to 'libavformat/dashdec.c')
-rw-r--r-- | libavformat/dashdec.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c index a6f75514f6..4f725ba09a 100644 --- a/libavformat/dashdec.c +++ b/libavformat/dashdec.c @@ -886,6 +886,7 @@ static int parse_manifest_representation(AVFormatContext *s, const char *url, ret = AVERROR(ENOMEM); goto end; } + rep->parent = s; representation_segmenttemplate_node = find_child_node_by_name(representation_node, "SegmentTemplate"); representation_baseurl_node = find_child_node_by_name(representation_node, "BaseURL"); representation_segmentlist_node = find_child_node_by_name(representation_node, "SegmentList"); @@ -958,7 +959,7 @@ static int parse_manifest_representation(AVFormatContext *s, const char *url, xmlFree(timescale_val); } if (startnumber_val) { - rep->first_seq_no = (int64_t) strtoll(startnumber_val, NULL, 10); + rep->start_number = rep->first_seq_no = (int64_t) strtoll(startnumber_val, NULL, 10); av_log(s, AV_LOG_TRACE, "rep->first_seq_no = [%"PRId64"]\n", rep->first_seq_no); xmlFree(startnumber_val); } @@ -1016,6 +1017,7 @@ static int parse_manifest_representation(AVFormatContext *s, const char *url, duration_val = get_val_from_nodes_tab(segmentlists_tab, 3, "duration"); timescale_val = get_val_from_nodes_tab(segmentlists_tab, 3, "timescale"); + startnumber_val = get_val_from_nodes_tab(segmentlists_tab, 4, "startNumber"); if (duration_val) { rep->fragment_duration = (int64_t) strtoll(duration_val, NULL, 10); av_log(s, AV_LOG_TRACE, "rep->fragment_duration = [%"PRId64"]\n", rep->fragment_duration); @@ -1026,6 +1028,12 @@ static int parse_manifest_representation(AVFormatContext *s, const char *url, av_log(s, AV_LOG_TRACE, "rep->fragment_timescale = [%"PRId64"]\n", rep->fragment_timescale); xmlFree(timescale_val); } + if (startnumber_val) { + rep->start_number = rep->first_seq_no = (int64_t) strtoll(startnumber_val, NULL, 10); + av_log(s, AV_LOG_TRACE, "rep->first_seq_no = [%"PRId64"]\n", rep->first_seq_no); + xmlFree(startnumber_val); + } + fragmenturl_node = xmlFirstElementChild(representation_segmentlist_node); while (fragmenturl_node) { ret = parse_manifest_segmenturlnode(s, rep, fragmenturl_node, |