From patchwork Tue Sep 10 02:31:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Steven X-Patchwork-Id: 14996 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 5D531449B7F for ; Tue, 10 Sep 2019 05:32:13 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 30BA06809BD; Tue, 10 Sep 2019 05:32:13 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from smtpbgeu2.qq.com (smtpbgeu2.qq.com [18.194.254.142]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 006C56808A2 for ; Tue, 10 Sep 2019 05:32:06 +0300 (EEST) X-QQ-mid: bizesmtp22t1568082697tjmvrlv6 Received: from localhost (unknown [49.7.58.242]) by esmtp6.qq.com (ESMTP) with id ; Tue, 10 Sep 2019 10:31:36 +0800 (CST) X-QQ-SSF: 01100000002000K0ZQF0B00A0000000 X-QQ-FEAT: RhqnQ7GE0dsBfLYuKSEF+sMkmSxIy9a2UB4mx984OKSEaFHbithq+9GMEZUdL XHRuzT9NIpBjASZzuDv/mlx21hzIIVTgH49VMUDjmpsNPBa1uJxJx8oxqOMn8/k793d+x0P c4oz1V54yyUaevgaPVqqmqv8wUjZYROVgIFWjpfICWfom+P5I0b3S/h3YWb87dcg0B1Fpv6 /ZCvADCr7ccV9NVvpsViOQhF+nAfJHGKaSXB5PFB2GBqAXHuMIJlh3Bl7npx2bEN1/d1mb2 Rtt3UCwZReFc/kuv4cT6Mjt6ofpRkRs7GyIHIbYCG5Ivb6PSAQKqCwQXI= X-QQ-GoodBg: 0 From: Steven Liu To: ffmpeg-devel@ffmpeg.org Date: Tue, 10 Sep 2019 10:31:32 +0800 Message-Id: <20190910023132.94619-1-lq@chinaffmpeg.org> X-Mailer: git-send-email 2.17.2 (Apple Git-113) X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:chinaffmpeg.org:qybgforeign:qybgforeign1 X-QQ-Bgrelay: 1 Subject: [FFmpeg-devel] [PATCH] avformat/dashdec: add startNumber parser for segmentlist X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Steven Liu MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" and get start_number for compute current segment number. fix ticket: 7976 Signed-off-by: Steven Liu --- libavformat/dashdec.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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,