From patchwork Sun Jan 7 18:46:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: sfan5 X-Patchwork-Id: 7184 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.78.2 with SMTP id r2csp1815698jaa; Sun, 7 Jan 2018 10:46:31 -0800 (PST) X-Google-Smtp-Source: ACJfBou+SJlPKDfVV7s3vBKvHSYt0zX5CCMBTQxbR7N9pCRGIvrx2VEUuhgSxFjucIhAQLmy4Oda X-Received: by 10.223.166.242 with SMTP id t105mr8209570wrc.106.1515350791823; Sun, 07 Jan 2018 10:46:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515350791; cv=none; d=google.com; s=arc-20160816; b=m7RyuEgT6zjByJUyNBeRMj6iZxnSQsbVFvjMiU1iDvu1ApcSc/TO5GyX2g00tC+sip wTyRDf9To7f7RUYgSxB4vWDlEBLD2CNPksS+givxGelnWExigwsNsFa87RyucsxETzaJ UZXb2h4bZBO//gXcRwtGCMQn/mBTN8ogIhLCCJIOCC3KF/mfopL5fMdJAPhoD/EVlcBl Se0VU5Iei5O85R0yMWEUtUHj7cCPggWdfq/8FNofBlE9UjcQK0svk92/R5XUj+Sqp7Sz gHYdWmGfuq0bLWNPdvBkCJbu3wO1+cVNdh+f4RKPyXdvE9Kyg+59b5iRmJlNrl8+x5Ce Q90g== 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=9nAjb7cG+RmzGdo0BzI8Ng1P3CDcFU3l+RbZDQQC3Lg=; b=ZMY/pb1o1UbEf2W9DZmmDu/8EzcKPdss6Qw2/4bkLZ7VilSnCLBYP2JtC+rMUhtPoG 9cOEg8Kj1o/cRpUkdyEm5rZ5A1Rfcuer6BUQUzd7h8sCLfLlg+PpWnUyQUzXbYJt9iZx 8FnkNUM7iWw4epjSE+9ncMdEZ1ofl+RkQWPsXcOE1hmHLGgQ1VRLkait0tWeHVoVP/So HozqN8spcs9urpWlHB/EXW7Px5JJ+ORJrsdHxcZyi5i8gvobwLo+ppyXnia3u6NNQYmd oxERAJnrsvlFYzOsr+elOBjHONqQHa9Ht20Ve2sgGfrgZAtg1tUlh2/CMbX7lu0b0hh9 tRWg== 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 p93si1323108wrb.67.2018.01.07.10.46.31; Sun, 07 Jan 2018 10:46: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 08DB6689E48; Sun, 7 Jan 2018 20:46:15 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR03-DB5-obe.outbound.protection.outlook.com (mail-oln040092071023.outbound.protection.outlook.com [40.92.71.23]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7B668689D83 for ; Sun, 7 Jan 2018 20:46:08 +0200 (EET) Received: from VE1EUR03FT036.eop-EUR03.prod.protection.outlook.com (10.152.18.55) by VE1EUR03HT073.eop-EUR03.prod.protection.outlook.com (10.152.19.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.20.345.12; Sun, 7 Jan 2018 18:46:08 +0000 Received: from DB3PR0202MB3452.eurprd02.prod.outlook.com (10.152.18.60) by VE1EUR03FT036.mail.protection.outlook.com (10.152.19.204) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.20.345.12 via Frontend Transport; Sun, 7 Jan 2018 18:46:08 +0000 Received: from DB3PR0202MB3452.eurprd02.prod.outlook.com ([fe80::f937:4ad2:ba75:414]) by DB3PR0202MB3452.eurprd02.prod.outlook.com ([fe80::f937:4ad2:ba75:414%13]) with mapi id 15.20.0386.008; Sun, 7 Jan 2018 18:46:08 +0000 From: Stefan _ To: FFmpeg development discussions and patches Thread-Topic: [PATCH 3/6] dashdec: Search for segment timeline inside AdaptionSets too Thread-Index: AQHTh+fHTb0Q72sy9kGrjjUgXxctSw== Date: Sun, 7 Jan 2018 18:46:08 +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:BBF4FE9CE58314F91798C45BE9B32A24FC10AB681EABF2E737541B6944395B1E; UpperCasedChecksum:106D116403EEDBC2B48AB2563D478FB95EDA7E697B49007D4083E660C6B3D6EE; SizeAsReceived:6978; Count:44 x-ms-exchange-messagesentrepresentingtype: 1 x-tmn: [MytpDauat1nc4QhG2CKFoDok0D60uYZE] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; VE1EUR03HT073; 7:fvduftASj4qkYEKPDx84UfsJn2O6qEVyHP1UcNAjzvPcy2hEW6sqPUctzTk0myVXOChjsDDsnWBdD6HGU0mTq7j0doHPpv/R5eRE4CaqGPqe58M0UD1br6C7poj9Ecw2CfR0w//3eCQKmdUmO9jN28wC/2SeNlLoEzwDIcF+TLJ2Kxcckp82QDnaZaq248BaZCD+1zfTrJJ+rXGZDesCcb5ydu9ILnVKCFoE6O6KSsatKW5CtBdRh6dG9LsotVQr x-incomingheadercount: 44 x-eopattributedmessage: 0 x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(201702061074)(5061506573)(5061507331)(1603103135)(2017031320274)(2017031324274)(2017031323274)(2017031322404)(1603101448)(1601125374)(1701031045); SRVR:VE1EUR03HT073; x-ms-traffictypediagnostic: VE1EUR03HT073: x-ms-office365-filtering-correlation-id: a4aea8ae-bb8b-4c84-faef-08d555fee9ef x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(444000031); SRVR:VE1EUR03HT073; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:VE1EUR03HT073; x-forefront-prvs: 0545EFAC9A x-forefront-antispam-report: SFV:NSPM; SFS:(7070007)(98901004); DIR:OUT; SFP:1901; SCL:1; SRVR:VE1EUR03HT073; 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: a4aea8ae-bb8b-4c84-faef-08d555fee9ef X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Jan 2018 18:46:08.1728 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1EUR03HT073 Subject: [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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "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; -- 2.15.1