From patchwork Tue Feb 6 21:30:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: sfan5 X-Patchwork-Id: 7522 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.150.1 with SMTP id c1csp4600995jai; Tue, 6 Feb 2018 13:30:49 -0800 (PST) X-Google-Smtp-Source: AH8x226Mte6Bb7JhSTP8pMz5MO2ok0FGF/S74HaXgjSS/AMpGZMLQ1BeMvO+2sAVcFHxqkfMn795 X-Received: by 10.28.2.68 with SMTP id 65mr2811927wmc.60.1517952649540; Tue, 06 Feb 2018 13:30:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517952649; cv=none; d=google.com; s=arc-20160816; b=lRaeaA88m9pdEeQ5/oS29FvtMgBsqlJoVApmqNPkfkAUkFOlL5SFnBqCXlJfkL6Djn 4Y2L4rPGR2yPtb9ymC89lqvR+qAMFK2qwvJfE5B3hAfTrlspffI96x4EgUi0BYsOyvfv P5sVymCImTmzI5+N4HAf5BinCVk0bfJmKCAqjEayf5/3XlGl5V/Ohhct/YpxrUtnVuVz /nReCGZCXInubnNvGg4LKkqxc9iGSRjHD+Q3Z28UwDt7eGDV9V8ggPHfbJVT9YpOVcku romhO8GnVjkvNoF+skcFM1S2EZCVZKMLs2pKz17syD0qCOY9EhixqFhWfCMUPRjdCNNF 3shA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:spamdiagnosticmetadata:spamdiagnosticoutput :content-language:accept-language:message-id:date:thread-index :thread-topic:to:from:delivered-to:arc-authentication-results; bh=U894PsXfH5ulmcwcEHh6fxrBSJVz/tdXBfkwo0pItV0=; b=cjgFX4m913KTqllCmNMWTXiycss0sfY5raMO9kS5/noTmnOyOYD3BB2Ll2YdLkUYAI gs8ejHBCRQDynrzvxyRDYqG6RZ9t0lx45BknP+nDzH0Yv9suFSQ3nGIdaZ4AgDG1msS4 QGZRVZIPtAUqlzE+ojo4lZBR9sh7jIiWcvg0RG9ZoRBrB3GBIZXbEvaUFndjP7VMcZnj 08e7kTmB1VjAnZD+K304ZkyBREI45zJVs8sHfG43X0n5OeqlrgcVfKbfO5w6Ula4LU8i aRQd39mEwb+AtVJz1lEKga2cHNSOUmVjZ/rxuPJFtdTRl8WpthYRvo9lmvFNOIExoPA4 Yjzw== 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 124si242118wmm.6.2018.02.06.13.30.48; Tue, 06 Feb 2018 13:30:49 -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 BCCB2689A69; Tue, 6 Feb 2018 23:30:38 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-oln040092069081.outbound.protection.outlook.com [40.92.69.81]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 549A06882BB for ; Tue, 6 Feb 2018 23:30:32 +0200 (EET) Received: from AM5EUR02FT034.eop-EUR02.prod.protection.outlook.com (10.152.8.60) by AM5EUR02HT108.eop-EUR02.prod.protection.outlook.com (10.152.9.186) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.20.464.8; Tue, 6 Feb 2018 21:30:39 +0000 Received: from DB3PR0202MB3452.eurprd02.prod.outlook.com (10.152.8.52) by AM5EUR02FT034.mail.protection.outlook.com (10.152.8.118) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.20.464.8 via Frontend Transport; Tue, 6 Feb 2018 21:30:39 +0000 Received: from DB3PR0202MB3452.eurprd02.prod.outlook.com ([fe80::804:5e22:e8c0:162]) by DB3PR0202MB3452.eurprd02.prod.outlook.com ([fe80::804:5e22:e8c0:162%13]) with mapi id 15.20.0464.016; Tue, 6 Feb 2018 21:30:39 +0000 From: Stefan _ To: FFmpeg development discussions and patches Thread-Topic: [PATCH] dashdec: Support SegmentTimeline inside Period Thread-Index: AQHTn5G7w/PLe51yq0WAhbgEznTzjA== Date: Tue, 6 Feb 2018 21:30:39 +0000 Message-ID: Accept-Language: de-DE, en-US Content-Language: en-US X-MS-Has-Attach: yes X-MS-TNEF-Correlator: x-incomingtopheadermarker: OriginalChecksum:A2009EC88DD36B7EBC0E383053A7023B63779F8285171E72B3BAA37F93B3B689; UpperCasedChecksum:CB6F66118E70F17432B0B7CBDCC08C803032CDFE353354ACD95585A37E4C8D41; SizeAsReceived:6938; Count:44 x-ms-exchange-messagesentrepresentingtype: 1 x-tmn: [2ZgLdkgNjQCX6BUqcAjPI4+Sbk8XWiWj] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; AM5EUR02HT108; 6:SeQmb2/iCqIWPNhWTCDBWhzFhD3WolWUInM8rYl+tteKvCLzX7M9WSpdWYl3oyDE6jgbWkIVZC/6sSfEMjEOqxbKCYrUpuqcvqqQCh8ZZa5kt2j5dVDcqW1QiJKMTFCtq7Sx3DwBxidLP9u4yjYFhXQwW6mkdpvM0aLhOF/w8NGtqcKey8YrIraf89IAHs9lqe4omCwaz8ZnyVBmkOLJR3OALPyitXFlDVA374c35Lf8bhSR+ejQ4j+eCW7Jw+UWJY0igiSJwAWSrMZYezOqkXuPg6usaKu3/FyT8K5GSkeEih2+zFtCTqiBp0YY/17UiPR2XaCTv1egrCfmFQb5ZkGjUcJ8lo0Du7BZPxxXfDA=; 5:edK10DT1Fc2d/zJSxncwkm3EoAXNmxB8uymY0jfUNytWe9YivDxHCiy58rL6UJtMxgJrcGcF6jrVKiPNN/QzZTpPHg5xwupVQFZzwwZbfompkoINgbVHp3mmJ1BF1iEYokjLTeqJrq1Y2JsOpD1CpOIh07901mC2BLgIsyYFmyA=; 24:KHy2lCVh8Dh6pWIiKp9mxXF/9KGiN3JRZgTMcc5JXDyge8MbFbBlyd0Oc36c15LZ+joPGhJEFr4w0HliTb/ZF7QSjYPV2E1FeSKoKyklTE0=; 7:oeXgajXMWEhqF/KuwRiNcmeooA04rg4nRwNxnkIZ5gN2QLGJ7zjy3SdKXQHL+h1/YhvOtqABpErgGI/f2mYM3AxM/Dy9U0Rdc9ESatfsCePVdlOMYGKwYBWplfx7LdUNo49ZYS3u2h4fF4e0YLXXLIDQx8MSxSTaNt8irYSlhP1+xNnsGZk5G4sB1G5k3PrIdX8oytTRRjxbQs+u3UHgzIDmzBnrQXxcK9wNfBuyC3lwymkCdeTnBnyZJnsnHnhH x-incomingheadercount: 44 x-eopattributedmessage: 0 x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(201702061074)(5061506573)(5061507331)(1603103135)(2017031320274)(2017031324274)(2017031323274)(2017031322404)(1603101448)(1601125374)(1701031045); SRVR:AM5EUR02HT108; x-ms-traffictypediagnostic: AM5EUR02HT108: x-ms-office365-filtering-correlation-id: d253ef91-bf0f-4e05-27b9-08d56da8de27 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(444000031); SRVR:AM5EUR02HT108; BCL:0; PCL:0; RULEID:; SRVR:AM5EUR02HT108; x-forefront-prvs: 0575F81B58 x-forefront-antispam-report: SFV:NSPM; SFS:(7070007)(98901004); DIR:OUT; SFP:1901; SCL:1; SRVR:AM5EUR02HT108; H:DB3PR0202MB3452.eurprd02.prod.outlook.com; FPR:; SPF:None; LANG:; spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: d253ef91-bf0f-4e05-27b9-08d56da8de27 X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Feb 2018 21:30:39.7303 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5EUR02HT108 Subject: [FFmpeg-devel] [PATCH] dashdec: Support SegmentTimeline 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Hi, attached patch adds support for yet another small detail of the standard that YouTube happens to use for DVR functionality of livestreams. Ideally dashdec would be fully standards compliant implementation, but that doesn't look like it's planned or happening anytime soon. From 168a7dca7bef54927cf58b61d7140f1d2984693c Mon Sep 17 00:00:00 2001 From: sfan5 Date: Tue, 6 Feb 2018 22:23:41 +0100 Subject: [PATCH] dashdec: Support SegmentTimeline inside Period --- libavformat/dashdec.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c index f9dc03309..2b396a01b 100644 --- a/libavformat/dashdec.c +++ b/libavformat/dashdec.c @@ -801,6 +801,7 @@ static int parse_manifest_representation(AVFormatContext *s, const char *url, xmlNodePtr mpd_baseurl_node, xmlNodePtr period_baseurl_node, xmlNodePtr period_segmenttemplate_node, + xmlNodePtr period_segmentlist_node, xmlNodePtr fragment_template_node, xmlNodePtr content_component_node, xmlNodePtr adaptionset_baseurl_node, @@ -817,7 +818,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[4]; + xmlNodePtr fragment_templates_tab[5]; char *duration_val = NULL; char *presentation_timeoffset_val = NULL; char *startnumber_val = NULL; @@ -869,6 +870,7 @@ static int parse_manifest_representation(AVFormatContext *s, const char *url, fragment_templates_tab[1] = adaptionset_segmentlist_node; fragment_templates_tab[2] = fragment_template_node; fragment_templates_tab[3] = period_segmenttemplate_node; + fragment_templates_tab[4] = period_segmentlist_node; 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"); @@ -925,6 +927,8 @@ static int parse_manifest_representation(AVFormatContext *s, const char *url, 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 = find_child_node_by_name(period_segmentlist_node, "SegmentTimeline"); if (fragment_timeline_node) { fragment_timeline_node = xmlFirstElementChild(fragment_timeline_node); while (fragment_timeline_node) { @@ -984,6 +988,8 @@ static int parse_manifest_representation(AVFormatContext *s, const char *url, 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 = find_child_node_by_name(period_segmentlist_node, "SegmentTimeline"); if (fragment_timeline_node) { fragment_timeline_node = xmlFirstElementChild(fragment_timeline_node); while (fragment_timeline_node) { @@ -1040,7 +1046,8 @@ static int parse_manifest_adaptationset(AVFormatContext *s, const char *url, xmlNodePtr adaptionset_node, xmlNodePtr mpd_baseurl_node, xmlNodePtr period_baseurl_node, - xmlNodePtr period_segmenttemplate_node) + xmlNodePtr period_segmenttemplate_node, + xmlNodePtr period_segmentlist_node) { int ret = 0; xmlNodePtr fragment_template_node = NULL; @@ -1065,6 +1072,7 @@ static int parse_manifest_adaptationset(AVFormatContext *s, const char *url, mpd_baseurl_node, period_baseurl_node, period_segmenttemplate_node, + period_segmentlist_node, fragment_template_node, content_component_node, adaptionset_baseurl_node, @@ -1094,6 +1102,7 @@ static int parse_manifest(AVFormatContext *s, const char *url, AVIOContext *in) xmlNodePtr mpd_baseurl_node = NULL; xmlNodePtr period_baseurl_node = NULL; xmlNodePtr period_segmenttemplate_node = NULL; + xmlNodePtr period_segmentlist_node = NULL; xmlNodePtr adaptionset_node = NULL; xmlAttrPtr attr = NULL; char *val = NULL; @@ -1228,8 +1237,10 @@ static int parse_manifest(AVFormatContext *s, const char *url, AVIOContext *in) 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 *)"SegmentList")) { + period_segmentlist_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, period_segmenttemplate_node); + parse_manifest_adaptationset(s, url, adaptionset_node, mpd_baseurl_node, period_baseurl_node, period_segmenttemplate_node, period_segmentlist_node); } adaptionset_node = xmlNextElementSibling(adaptionset_node); } -- 2.16.1