From patchwork Mon Jan 8 02:56:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Liu X-Patchwork-Id: 7191 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.78.2 with SMTP id r2csp2147084jaa; Sun, 7 Jan 2018 18:56:31 -0800 (PST) X-Google-Smtp-Source: ACJfBosPJFzFKl/jOAlbgrptWGIZc8jDU8LnhHIPZFtEG8lUnem3OMIsUYh+igmJ8xSjW9WnweAo X-Received: by 10.223.177.143 with SMTP id q15mr7910395wra.228.1515380191583; Sun, 07 Jan 2018 18:56:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515380191; cv=none; d=google.com; s=arc-20160816; b=WB2+ao828zp9IQ5023AVJOhqrT3eGwE3XC0s+BypUUG2eR2PBIYOf5s5ryRFvj+zfZ wQ9oLXjim48iwV1EYOMi4VsW1W+9kZTFKaYM1rQAfM9FNdFhTLhS1PzN4VZ5bcHTsROv AU8qMPkTuqRm/ln/mCaGrhfMPnYvYrfZturFKfNPEcn2J0+Cd6XRhImeGaR9OYdyK4/u HAwWdF1zX61+FO2rpxmO0ttULqbcJQBRrezfxhXTRUIzrdSkCFxjh0cMf8RBO6fOtVMn oQaVqW8nqsj17WYUvZjfwPxP/rpIlnXU03G8wHFZvpbGor5VvKrGCq5EaONMWL6f3JMU tJgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:feedback-id:to:references:message-id :date:in-reply-to:from:mime-version:delivered-to :arc-authentication-results; bh=5+EGvLaXVIr9w18NHN32DuQtMa6+sDoLEufUYELStuc=; b=YGRTqe2tNBFYgEtfKv+yo1ZIgHzDa7qZQIzAR29TcxIaYg9vjBVFGcGMH1gXjJDQ3o h2TUBiYE4AvlJpXmUiA0Z+nIo+sg2CUjn5oPiFU4ktuMFirUIPhoLaSlMIiWb02VvaZQ 05K71BKH2fS9xtfczcgXBsduePQmgiN4jYBuWQ0b7Y/ETH3ePMJd9tHSHCk3x1LHz2e9 Z6/lPXeTTYsiMQD14JXsewtuMssF8WeF2PhSlB0USv0oVhSj/TmNMh5g0da36T8vhQI5 SfROl8zKyBhLb953temAVRM64k1GKz455rhcPjh8wob48V2E64zQuwxARdYoosjB1aKR zyZQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id v70si7159850wmd.97.2018.01.07.18.56.31; Sun, 07 Jan 2018 18:56:31 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 219A6689FD1; Mon, 8 Jan 2018 04:56:29 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from smtpbgsg2.qq.com (smtpbgsg2.qq.com [54.254.200.128]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A6620680612 for ; Mon, 8 Jan 2018 04:56:22 +0200 (EET) X-QQ-mid: bizesmtp16t1515380177ty9ai2u7 Received: from [192.168.3.21] (unknown [121.69.97.6]) by esmtp4.qq.com (ESMTP) with id ; Mon, 08 Jan 2018 10:56:15 +0800 (CST) X-QQ-SSF: 01100000004000F0FKF0000A0000000 X-QQ-FEAT: GSOvRtudih56WXtRuhbMRWi6Etsp3wm1q4sirPILe0A8nms8RnOT9DAWszYyd YRXDZSdWjc6TAoKz1zu3lNdF8mFqlZIw9EtyajfS74bBtXFlqi296Q8lIFOwJAY8uabvnQE ZzZ7cZJKJBJfCRzx9oUkGDBSG6s/kU0MnCVPNde99LTjKd8Dyd+n2OviLNxhB/THGZR0iLF Ucp0ThoK8hnG0LxFtRar/FwAHEqYbV7QlUEkQDAAB6S2lTw+Z8MeWI/pdyhQ44vn8dc56Xe gp4XSUddlrUlenOg7sV6tk+DMvF1NdNSJKCw== X-QQ-GoodBg: 0 Mime-Version: 1.0 (Mac OS X Mail 11.1 \(3445.4.7\)) From: =?utf-8?B?5YiY5q2n?= In-Reply-To: Date: Mon, 8 Jan 2018 10:56:14 +0800 Message-Id: <1195F494-6E42-4BFD-88D1-CF8BACBF5193@chinaffmpeg.org> References: To: FFmpeg development discussions and patches X-Mailer: Apple Mail (2.3445.4.7) X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:chinaffmpeg.org:qybgforeign:qybgforeign4 X-QQ-Bgrelay: 1 Subject: Re: [FFmpeg-devel] [PATCH 3/6] dashdec: Search for segment timeline inside AdaptionSets too 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: =?utf-8?B?5YiY5q2n?= Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" > On 8 Jan 2018, at 02:46, Stefan _ wrote: > > > <0003-dashdec-Search-for-segment-timeline-inside-AdaptionS.patch>_______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel >From c06d6cbcdc9092428d3764a969604d1f22725e56 Mon Sep 17 00:00:00 2001 From: sfan5 Date: Fri, 5 Jan 2018 00:19:53 +0100 Subject: [PATCH 3/6] dashdec: Search for segment timeline inside AdaptionSets too --- libavformat/dashdec.c | 40 +++++++++++++++++++++++++++------------- 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c index 676979638..ac0e6c6f9 100644 --- a/libavformat/dashdec.c +++ b/libavformat/dashdec.c @@ -648,7 +648,8 @@ static int parse_manifest_representation(AVFormatContext *s, const char *url, xmlNodePtr period_baseurl_node, xmlNodePtr fragment_template_node, xmlNodePtr content_component_node, - xmlNodePtr adaptionset_baseurl_node) + xmlNodePtr adaptionset_baseurl_node, + xmlNodePtr adaptionset_segmentlist_node) { int32_t ret = 0; int32_t audio_rep_idx = 0; @@ -659,8 +660,9 @@ static int parse_manifest_representation(AVFormatContext *s, const char *url, xmlNodePtr representation_segmenttemplate_node = NULL; xmlNodePtr representation_baseurl_node = NULL; xmlNodePtr representation_segmentlist_node = NULL; + xmlNodePtr segmentlists_tab[2]; xmlNodePtr fragment_timeline_node = NULL; - xmlNodePtr fragment_templates_tab[2]; + xmlNodePtr fragment_templates_tab[3]; char *duration_val = NULL; char *presentation_timeoffset_val = NULL; char *startnumber_val = NULL; @@ -703,14 +705,15 @@ static int parse_manifest_representation(AVFormatContext *s, const char *url, if (representation_segmenttemplate_node || fragment_template_node) { fragment_timeline_node = NULL; fragment_templates_tab[0] = representation_segmenttemplate_node; - fragment_templates_tab[1] = fragment_template_node; + fragment_templates_tab[1] = adaptionset_segmentlist_node; + fragment_templates_tab[2] = fragment_template_node; - presentation_timeoffset_val = get_val_from_nodes_tab(fragment_templates_tab, 2, "presentationTimeOffset"); - duration_val = get_val_from_nodes_tab(fragment_templates_tab, 2, "duration"); - startnumber_val = get_val_from_nodes_tab(fragment_templates_tab, 2, "startNumber"); - timescale_val = get_val_from_nodes_tab(fragment_templates_tab, 2, "timescale"); - initialization_val = get_val_from_nodes_tab(fragment_templates_tab, 2, "initialization"); - media_val = get_val_from_nodes_tab(fragment_templates_tab, 2, "media"); + presentation_timeoffset_val = get_val_from_nodes_tab(fragment_templates_tab, 3, "presentationTimeOffset"); + duration_val = get_val_from_nodes_tab(fragment_templates_tab, 3, "duration"); + startnumber_val = get_val_from_nodes_tab(fragment_templates_tab, 3, "startNumber"); + timescale_val = get_val_from_nodes_tab(fragment_templates_tab, 3, "timescale"); + initialization_val = get_val_from_nodes_tab(fragment_templates_tab, 3, "initialization"); + media_val = get_val_from_nodes_tab(fragment_templates_tab, 3, "media"); if (initialization_val) { rep->init_section = av_mallocz(sizeof(struct fragment)); @@ -756,6 +759,8 @@ static int parse_manifest_representation(AVFormatContext *s, const char *url, if (!fragment_timeline_node) fragment_timeline_node = find_child_node_by_name(fragment_template_node, "SegmentTimeline"); + if (!fragment_timeline_node) + fragment_timeline_node = find_child_node_by_name(adaptionset_segmentlist_node, "SegmentTimeline"); if (fragment_timeline_node) { fragment_timeline_node = xmlFirstElementChild(fragment_timeline_node); while (fragment_timeline_node) { @@ -784,8 +789,11 @@ static int parse_manifest_representation(AVFormatContext *s, const char *url, // TODO: https://www.brendanlong.com/the-structure-of-an-mpeg-dash-mpd.html // http://www-itec.uni-klu.ac.at/dash/ddash/mpdGenerator.php?fragmentlength=15&type=full xmlNodePtr fragmenturl_node = NULL; - duration_val = xmlGetProp(representation_segmentlist_node, "duration"); - timescale_val = xmlGetProp(representation_segmentlist_node, "timescale"); + segmentlists_tab[0] = representation_segmentlist_node; + segmentlists_tab[1] = adaptionset_segmentlist_node; + + duration_val = get_val_from_nodes_tab(segmentlists_tab, 2, "duration"); + timescale_val = get_val_from_nodes_tab(segmentlists_tab, 2, "timescale"); if (duration_val) { rep->fragment_duration = (int64_t) strtoll(duration_val, NULL, 10); xmlFree(duration_val); @@ -810,6 +818,8 @@ static int parse_manifest_representation(AVFormatContext *s, const char *url, if (!fragment_timeline_node) fragment_timeline_node = find_child_node_by_name(fragment_template_node, "SegmentTimeline"); + if (!fragment_timeline_node) + fragment_timeline_node = find_child_node_by_name(adaptionset_segmentlist_node, "SegmentTimeline"); if (fragment_timeline_node) { fragment_timeline_node = xmlFirstElementChild(fragment_timeline_node); while (fragment_timeline_node) { @@ -862,6 +872,7 @@ static int parse_manifest_adaptationset(AVFormatContext *s, const char *url, xmlNodePtr fragment_template_node = NULL; xmlNodePtr content_component_node = NULL; xmlNodePtr adaptionset_baseurl_node = NULL; + xmlNodePtr adaptionset_segmentlist_node = NULL; xmlNodePtr node = NULL; node = xmlFirstElementChild(adaptionset_node); @@ -872,6 +883,8 @@ static int parse_manifest_adaptationset(AVFormatContext *s, const char *url, content_component_node = node; } else if (!av_strcasecmp(node->name, (const char *)"BaseURL")) { adaptionset_baseurl_node = node; + } else if (!av_strcasecmp(node->name, (const char *)"SegmentList")) { + adaptionset_segmentlist_node = node; } else if (!av_strcasecmp(node->name, (const char *)"Representation")) { ret = parse_manifest_representation(s, url, node, adaptionset_node, @@ -879,7 +892,8 @@ static int parse_manifest_adaptationset(AVFormatContext *s, const char *url, period_baseurl_node, fragment_template_node, content_component_node, - adaptionset_baseurl_node); + adaptionset_baseurl_node, + adaptionset_segmentlist_node); if (ret < 0) { return ret; } @@ -1865,7 +1879,7 @@ set_seq_num: } else if (pls->fragment_duration > 0) { pls->cur_seq_no = pls->first_seq_no + ((seek_pos_msec * pls->fragment_timescale) / pls->fragment_duration) / 1000; } else { - av_log(pls->parent, AV_LOG_ERROR, "dash_seek missing fragment_duration\n"); + av_log(pls->parent, AV_LOG_ERROR, "dash_seek missing timeline or fragment_duration\n"); pls->cur_seq_no = pls->first_seq_no; } pls->cur_timestamp = 0;