From patchwork Sun Jan 7 18:46:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: sfan5 X-Patchwork-Id: 7182 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.78.2 with SMTP id r2csp1815501jaa; Sun, 7 Jan 2018 10:46:15 -0800 (PST) X-Google-Smtp-Source: ACJfBosiYXSRK9w2wfrLR/9GI59FNEA3+ek74IIxwl+YHsGXR7v4KVZyWe88HTiJIDoFrKsSHOMc X-Received: by 10.223.156.145 with SMTP id d17mr8113683wre.198.1515350775113; Sun, 07 Jan 2018 10:46:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515350775; cv=none; d=google.com; s=arc-20160816; b=gDC4OsWalH2gfWoFZ73pTTep18TfigSPtZSsF9ZVenQxgRrGt5pvTFbSWcu+sKAoA6 jvtF+270nTFUxD2nqZ7SSB9OBDhevyooon6p8NmKh/bEZ0brX6w08ZrcHUNBHHotSGKP 3au0kR9wM+dEuKGimLCBMAzOYz9PU8yocFTF+xow3F9THzm/tq0yn/mIThOjl5Qtpbp/ sQEPGrV2WJJhjfikgnO+jbHtP6qqblwt/eYVAkxZoEnlvAoGT6jEAZLqHNqkoLZPOOiu PuzkRgDX221liGrqCceOrE5eGj4E+cpmHkkiokrWxeWA73AQ8SJg2+ZF0DfwR1DSCWzN kgkQ== 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=OwddX/d1a3FziTxcWFOU/EknfxI32oZxMWwDKj+6FPY=; b=qNl5eGBzaCRZ0qmYIBqJ6el45ugujWFUQ+dFfxmG9fjwsZgTJvMI0wkpRyCZ9qowKQ pNOAW2Gfi/epeKNdMszHneFX1DrZXqzXy8WutqRdUbvxcM6za1mSgPmI34oZNf6CeEH4 2chwYccprjvDgMMmg7qyINHgnD1t5x8/a90F98Ys7GdzzLuYzdm7EbNLvCsfmLcjKqjn jfqVATCwDmW4euxBiIczLTj9ZDxdemBkWQbcuvzTKF+T1hwQCDbu3z0BEAhUSUxoY2kP 4XLi67jgeS1DdWbNpnk8MxWcrZwEF4QZbhYQy4BMiwps4L0GlPuXSkbsHVPEla6i3SsK LBCQ== 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 n64si6742279wmn.209.2018.01.07.10.46.14; Sun, 07 Jan 2018 10:46: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 22FC1689DE9; Sun, 7 Jan 2018 20:46:12 +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-oln040092071025.outbound.protection.outlook.com [40.92.71.25]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 6AA97689D3E for ; Sun, 7 Jan 2018 20:46:05 +0200 (EET) Received: from VE1EUR03FT036.eop-EUR03.prod.protection.outlook.com (10.152.18.51) by VE1EUR03HT021.eop-EUR03.prod.protection.outlook.com (10.152.19.124) 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:05 +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:04 +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:04 +0000 From: Stefan _ To: FFmpeg development discussions and patches Thread-Topic: [PATCH 1/6] dashdec: Expose bandwidth and representation ID as metadata Thread-Index: AQHTh+fFInMrzRRzwUy8AW/1ArwOrQ== Date: Sun, 7 Jan 2018 18:46:04 +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:BB7F30FEFD51D17C6ED1BBD716B60E70B105BEF2CD6062967E4D5DD9F2E43B37; UpperCasedChecksum:D1FC312F5AE16C2732E6BCBB9FB0595E7CFD7B23728D380233D868945E7712E1; SizeAsReceived:6976; Count:44 x-ms-exchange-messagesentrepresentingtype: 1 x-tmn: [qGeKwsm92maUjRtiqtlcrreMwLdalG/7] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; VE1EUR03HT021; 6:EiWTKA505+BpmziTaLd6P6PKIW3yDqsz5CE7hoxsRrPZkWZRdNrHPUgnWuDGDkm0dBLVXOLFFKk0b0zbrVvoZAgoX0eKXnauNGwXdBVIixoLD5lhDQtAopafblWhAoAUX+M+IG/qquc+bqLvMJ+SDUaNnuMgGLJO1TPAkO+Jt0+WQvHBZx/0T5eH9GMSS2oAgx/Rl5EojrEz2fz+gstBflXmgHG/bI3wZSDdcImoPdDSPRT2FIbzs9Akpf6LHqNbauO+J/Wmab3lvKpF8iHcF7AENn1RNan+vVKwqhK6zjQk+CAspXgk/T/DbiurSIYsMCTOvP3ggfTIkxtg9ZNe7QkOdRlsn+shYjWfEU2hdvs=; 5:LV8F62sEyfXw4Sva0gy6NPnjPcqjJn53dfS7ExhMV/rGsG9Je0DKOZkW5Or8NV4oaJeFYzMiZ/TUosKh2wSfF+xcG1N25evj0WBaw0uyEcJSReXLnwi0mMC/XpILGKhqYmIlf/5eR+9WzupxIM+9lmivWnqPjwNCmLFssdnyZTc=; 24:yZSZbvG0xvLpnqRFW+8F6xMsqXkywab2rnEKuz2mlblA0SbUxAFTfCvk5Hmq03hddC/uNSB/Q1jfGCbyLGRrIVh3cJi0/PPwduJ/tr7U4fY=; 7:5cmWmBdJmrG+RgPZoWgO+cHx16bqHbTTP1VSiUWoXqUTsxP1JSUooydsasTv/nzwqfeDBLNeqfESRvgYDLy2RnAAB/xUe3/jboH+HQgPV4UIQKpPNeRNcA4YFkVWm8azT90hx2lXQYdkUG4QeE5mVrrTxV3JI/I8xsPb8npTyQ+6X2krHHfPUOJamDwpbsyoImhBPfgyMROO/PbjA4hslNuZMtkq6LwqgyYXMIGOrBNOy3xHDVogSSfWGKzSPjMz 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:VE1EUR03HT021; x-ms-traffictypediagnostic: VE1EUR03HT021: x-ms-office365-filtering-correlation-id: ae196c27-c740-4899-d4a4-08d555fee7c6 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(444000031); SRVR:VE1EUR03HT021; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:VE1EUR03HT021; x-forefront-prvs: 0545EFAC9A x-forefront-antispam-report: SFV:NSPM; SFS:(7070007)(98901004); DIR:OUT; SFP:1901; SCL:1; SRVR:VE1EUR03HT021; 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: ae196c27-c740-4899-d4a4-08d555fee7c6 X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Jan 2018 18:46:04.7977 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1EUR03HT021 Subject: [FFmpeg-devel] [PATCH 1/6] dashdec: Expose bandwidth and representation ID as metadata 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, I did some work on the DASH demuxer. The primary goal was making it viable to play YouTube/Vimeo/... videos using the native demuxer, since mpv currently uses a workaround in form of Edit Decision Lists (EDL). Implemented features: * Exposing id / bitrate as stream metadata (similar to the HLS demuxer) * Support for multiple video and audio streams * A few minor parts of the specification that are in use at YouTube >From ba640900c260f8b5b1919c4274b2c2e3e57e2546 Mon Sep 17 00:00:00 2001 From: sfan5 Date: Thu, 4 Jan 2018 23:45:26 +0100 Subject: [PATCH 1/6] dashdec: Expose bandwidth and representation ID as metadata --- libavformat/dashdec.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c index 0e3afd2a3..1a18ab021 100644 --- a/libavformat/dashdec.c +++ b/libavformat/dashdec.c @@ -84,6 +84,8 @@ struct representation { int stream_index; enum AVMediaType type; + char id[20]; + int bandwidth; int n_fragments; struct fragment **fragments; /* VOD list of fragment for profile */ @@ -801,6 +803,8 @@ static int parse_manifest_representation(AVFormatContext *s, const char *url, if (rep) { if (rep->fragment_duration > 0 && !rep->fragment_timescale) rep->fragment_timescale = 1; + rep->bandwidth = rep_bandwidth_val ? atoi(rep_bandwidth_val) : 0; + strncpy(rep->id, rep_id_val ? rep_id_val : "", sizeof(rep->id)); if (type == AVMEDIA_TYPE_VIDEO) { rep->rep_idx = video_rep_idx; c->cur_video = rep; @@ -1650,10 +1654,20 @@ static int dash_read_header(AVFormatContext *s) } if (c->cur_video) { - av_program_add_stream_index(s, 0, c->cur_video->stream_index); + int stream_index = c->cur_video->stream_index; + av_program_add_stream_index(s, 0, stream_index); + if (c->cur_video->bandwidth > 0) + av_dict_set_int(&s->streams[stream_index]->metadata, "variant_bitrate", c->cur_video->bandwidth, 0); + if (c->cur_video->id[0]) + av_dict_set(&s->streams[stream_index]->metadata, "id", c->cur_video->id, 0); } if (c->cur_audio) { - av_program_add_stream_index(s, 0, c->cur_audio->stream_index); + int stream_index = c->cur_audio->stream_index; + av_program_add_stream_index(s, 0, stream_index); + if (c->cur_audio->bandwidth > 0) + av_dict_set_int(&s->streams[stream_index]->metadata, "variant_bitrate", c->cur_audio->bandwidth, 0); + if (c->cur_audio->id[0]) + av_dict_set(&s->streams[stream_index]->metadata, "id", c->cur_audio->id, 0); } } -- 2.15.1