From patchwork Mon Jan 8 02:58:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Steven X-Patchwork-Id: 7194 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.78.2 with SMTP id r2csp2148731jaa; Sun, 7 Jan 2018 18:59:15 -0800 (PST) X-Google-Smtp-Source: ACJfBotPj0vvWN4xg+dH1GDpu3F4kzeVRdzwkPH0FdKYSo1n4hOtqBPe6V0meataafo2TXoHZJDL X-Received: by 10.223.199.146 with SMTP id l18mr8761068wrg.166.1515380355477; Sun, 07 Jan 2018 18:59:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515380355; cv=none; d=google.com; s=arc-20160816; b=rc9dDYsf6JBGZILG6Lci0PTwdyJzwpIw2vLkuJNDqZwfljHQj2RxGYS9i7aX780Q6b fR98pFzol4+X2vrcUOwa+IcZHQEhM3BZO7N/IkSGTtPy80/B0LWYGrt9gfhuUlTekdOj SxLQp8J+vhvJ19HMNIPaojw28JRLXPEmkcFMwHt1Bi06C31dYrjRAeUu4pFxUhpSDRZ5 dNzN3+oJOCf5uifKwaiLdANwTutMtcKTKPsYtgXFjlqLkN1btz36fkXto6to28V5K51L OA4KN/TKny/uEFaQmPq9dlSw/orlkTZLZJkyp1NKruKwj+8kzhKzaZ8GkZNSsMOi7xZq BQyw== 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=igVurBXF4gkALeDrklIY7LbW/8slUzWRfkOU45nzzRc=; b=pCM42Cg61kXgZZnHCH4tVFmUQpsmcYbYriIz65HVH7RLtIWwVPhcn8o1mInG8B5Gsn rETKFVoks0TPDnOdYneCcbnluu75QC3NSWpHLO6t0aGNYex8Eddoz13x2EvyUOxOIx9z QxlqaE9ZEdqa+XySxZR66suhs6IaUknTSMJ0HkHB3VdL5DmccSmUTDI9PktXfBNUJI+V CXgLw9nfjo/S6le/eGBxRrkRwCciydAhbBQBhLYKvgrefMq7Yx2i+pTyEkeNWjM5S1Oa TUben3ChUfMGL1gfEGSLtD6gIM0o82aXQMdEHPztx3nKPJZQ9yyDc+x9iRMNUeZdWR9W E4Aw== 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 195si7296651wmp.215.2018.01.07.18.59.15; Sun, 07 Jan 2018 18:59:15 -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 A52E9689FF5; Mon, 8 Jan 2018 04:59:13 +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 DF3ED689FDB for ; Mon, 8 Jan 2018 04:59:06 +0200 (EET) X-QQ-mid: bizesmtp5t1515380341t0w623h95 Received: from [192.168.3.21] (unknown [121.69.97.6]) by esmtp4.qq.com (ESMTP) with id ; Mon, 08 Jan 2018 10:58:18 +0800 (CST) X-QQ-SSF: 01100000004000F0FKF0000A0000000 X-QQ-FEAT: 92FxZ2TPvnd08RNVRybwXZdVM1Hm/SYzjCDMgijnuRjwP0zaytztWnRmqKSGm xUFlCa0GJ2y+XL7rQRJWPIsCtGeVSrIx7c7/y1pVuSP4yp29uRWbFLtE9Ttg5psdjg/Meoc UuoU847F5dNXgAc+XonFvotz+V4njUTjiREq4a7yF110X4ySmOYzWtxWdAVEzhpL/NEA8U7 quL9CIp6YoPPdTtqC2kxLGCld4LIzOeXwv2FMRq9jK0QyWjN6OYRLrJsDfRavQ3FrorsjCT MDp9seUoxcME6+zT0YtTfwGBQ= 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:58:59 +0800 Message-Id: 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:qybgforeign1 X-QQ-Bgrelay: 1 Subject: Re: [FFmpeg-devel] [PATCH 6/6] dashdec: Support SegmentTemplate inside Period 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: > > <0006-dashdec-Support-SegmentTemplate-inside-Period.patch> >From 89b42dc60156f1e030a30e13636651db41e9f34b Mon Sep 17 00:00:00 2001 From: sfan5 Date: Fri, 5 Jan 2018 15:32:23 +0100 Subject: [PATCH 6/6] dashdec: Support SegmentTemplate inside Period --- libavformat/dashdec.c | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c index af8ab5f2f..ac1080b62 100644 --- a/libavformat/dashdec.c +++ b/libavformat/dashdec.c @@ -646,6 +646,7 @@ static int parse_manifest_representation(AVFormatContext *s, const char *url, xmlNodePtr adaptionset_node, xmlNodePtr mpd_baseurl_node, xmlNodePtr period_baseurl_node, + xmlNodePtr period_segmenttemplate_node, xmlNodePtr fragment_template_node, xmlNodePtr content_component_node, xmlNodePtr adaptionset_baseurl_node, @@ -662,7 +663,7 @@ static int parse_manifest_representation(AVFormatContext *s, const char *url, xmlNodePtr representation_segmentlist_node = NULL; xmlNodePtr segmentlists_tab[2]; xmlNodePtr fragment_timeline_node = NULL; - xmlNodePtr fragment_templates_tab[3]; + xmlNodePtr fragment_templates_tab[4]; char *duration_val = NULL; char *presentation_timeoffset_val = NULL; char *startnumber_val = NULL; @@ -702,18 +703,19 @@ static int parse_manifest_representation(AVFormatContext *s, const char *url, baseurl_nodes[2] = adaptionset_baseurl_node; baseurl_nodes[3] = representation_baseurl_node; - if (representation_segmenttemplate_node || fragment_template_node) { + if (representation_segmenttemplate_node || fragment_template_node || period_segmenttemplate_node) { fragment_timeline_node = NULL; fragment_templates_tab[0] = representation_segmenttemplate_node; fragment_templates_tab[1] = adaptionset_segmentlist_node; fragment_templates_tab[2] = fragment_template_node; + fragment_templates_tab[3] = period_segmenttemplate_node; - 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"); + presentation_timeoffset_val = get_val_from_nodes_tab(fragment_templates_tab, 4, "presentationTimeOffset"); + duration_val = get_val_from_nodes_tab(fragment_templates_tab, 4, "duration"); + startnumber_val = get_val_from_nodes_tab(fragment_templates_tab, 4, "startNumber"); + timescale_val = get_val_from_nodes_tab(fragment_templates_tab, 4, "timescale"); + initialization_val = get_val_from_nodes_tab(fragment_templates_tab, 4, "initialization"); + media_val = get_val_from_nodes_tab(fragment_templates_tab, 4, "media"); if (initialization_val) { rep->init_section = av_mallocz(sizeof(struct fragment)); @@ -866,7 +868,8 @@ end: static int parse_manifest_adaptationset(AVFormatContext *s, const char *url, xmlNodePtr adaptionset_node, xmlNodePtr mpd_baseurl_node, - xmlNodePtr period_baseurl_node) + xmlNodePtr period_baseurl_node, + xmlNodePtr period_segmenttemplate_node) { int ret = 0; xmlNodePtr fragment_template_node = NULL; @@ -890,6 +893,7 @@ static int parse_manifest_adaptationset(AVFormatContext *s, const char *url, adaptionset_node, mpd_baseurl_node, period_baseurl_node, + period_segmenttemplate_node, fragment_template_node, content_component_node, adaptionset_baseurl_node, @@ -918,6 +922,7 @@ static int parse_manifest(AVFormatContext *s, const char *url, AVIOContext *in) xmlNodePtr period_node = NULL; xmlNodePtr mpd_baseurl_node = NULL; xmlNodePtr period_baseurl_node = NULL; + xmlNodePtr period_segmenttemplate_node = NULL; xmlNodePtr adaptionset_node = NULL; xmlAttrPtr attr = NULL; char *val = NULL; @@ -1047,8 +1052,10 @@ static int parse_manifest(AVFormatContext *s, const char *url, AVIOContext *in) while (adaptionset_node) { if (!av_strcasecmp(adaptionset_node->name, (const char *)"BaseURL")) { period_baseurl_node = adaptionset_node; + } else if (!av_strcasecmp(adaptionset_node->name, (const char *)"SegmentTemplate")) { + period_segmenttemplate_node = adaptionset_node; } else if (!av_strcasecmp(adaptionset_node->name, (const char *)"AdaptationSet")) { - parse_manifest_adaptationset(s, url, adaptionset_node, mpd_baseurl_node, period_baseurl_node); + parse_manifest_adaptationset(s, url, adaptionset_node, mpd_baseurl_node, period_baseurl_node, period_segmenttemplate_node); } adaptionset_node = xmlNextElementSibling(adaptionset_node); }