From patchwork Mon Sep 19 13:25:29 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: erkki.seppala.ext@nokia.com X-Patchwork-Id: 631 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.140.134 with SMTP id o128csp1000450vsd; Mon, 19 Sep 2016 06:27:16 -0700 (PDT) X-Received: by 10.194.141.203 with SMTP id rq11mr24367549wjb.112.1474291636585; Mon, 19 Sep 2016 06:27:16 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id p27si9365192wma.19.2016.09.19.06.27.16; Mon, 19 Sep 2016 06:27:16 -0700 (PDT) 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; dkim=neutral (body hash did not verify) header.i=@nokia.onmicrosoft.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; dmarc=fail (p=NONE dis=NONE) header.from=nokia.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 43380689FBE; Mon, 19 Sep 2016 16:26:01 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on0136.outbound.protection.outlook.com [104.47.1.136]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 18AF4689D9C for ; Mon, 19 Sep 2016 16:25:53 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nokia.onmicrosoft.com; s=selector1-nokia-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=ouJlpBFx0iTQ7VfcnpQvxETMXvJXm5ptjKclWKbrE3o=; b=IDOsGxu6C6G8QH0oR5lBi+06ZpgOerIgRAbpOgYwA0jzD8gUP5JXmww/leDUTE2OLQ9E8SsJ8op+jWzK4y1a0CWq37g4InkceCnOcav5grm/TK/iCaNkqscQ6inlnhm8p+U9eehs+RTvObaBeV+///D8jzSLfk80gTcI7rPeAP8= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=erkki.seppala.ext@nokia.com; Received: from erkkise-laptop.vincit.intranet (131.228.2.24) by AM5PR0701MB2530.eurprd07.prod.outlook.com (10.169.153.150) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.629.8; Mon, 19 Sep 2016 13:26:06 +0000 Received: by erkkise-laptop.vincit.intranet (Postfix, from userid 1000) id AE8924F0F47; Mon, 19 Sep 2016 16:25:48 +0300 (EEST) From: =?UTF-8?q?Erkki=20Sepp=C3=A4l=C3=A4?= To: Date: Mon, 19 Sep 2016 16:25:29 +0300 Message-ID: <1474291548-17810-7-git-send-email-erkki.seppala.ext@nokia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1474291548-17810-1-git-send-email-erkki.seppala.ext@nokia.com> References: <1471943019-14136-1-git-send-email-erkki.seppala.ext@nokia.com> <1474291548-17810-1-git-send-email-erkki.seppala.ext@nokia.com> MIME-Version: 1.0 X-Originating-IP: [131.228.2.24] X-ClientProxiedBy: BN6PR17CA0046.namprd17.prod.outlook.com (10.175.189.32) To AM5PR0701MB2530.eurprd07.prod.outlook.com (10.169.153.150) X-MS-Office365-Filtering-Correlation-Id: d3754a21-7d93-41d4-239d-08d3e090832d X-Microsoft-Exchange-Diagnostics: 1; AM5PR0701MB2530; 2:/2DbHHRCEXHrW9Hx3YaIqSG/B4qHNMxZ53+gwx6m38v+X6hWVRaL0v5VG0PCB7gwJ9WlBaCOtRYRzXjfkDYW1i/GDJISd7G/WAf0kiZV4UFnoU/GxT7nokMBTKGSnmn2q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+DFfOrlwGWMLh0rZrlM0IE8eMn/y0RH3tWRsXhlQ727GEO6omNBRRq3hRfxmWOQ5R2gcH6CGDeW5RFGWS/BpbfsLgCH+aEoH1dS2D1Mz3+iyBYjX4fFLi1Urt22NgG0u64HWZ/fGaLog89WipEYyNPigqxPeUIkuwd87WBTd1pPGmnKFyicVMcDIBPXNb+RWsQpklIUuh4ixQPXTjcbOM+0kAtj6JnieRZW1330Q0f7TCiZdTkKgC4VnxiyktIwhK0jKI3+W86fzjI72vv5pW6lJyyxwbjZfqLOAEbxQVpJD7+QzqXaqD0t6H2NcTqcYws7BI6oonfqijUmNbuZu5hxnW58YUqkrumhiwhdrai3CrOJV3gzf7MhFoeCKWoRyRTtS22Zsw0BBFelib9wcEBlIb39fMz X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(82608151540597); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(6055026); SRVR:AM5PR0701MB2530; BCL:0; PCL:0; RULEID:; SRVR:AM5PR0701MB2530; X-Microsoft-Exchange-Diagnostics: 1; AM5PR0701MB2530; 4:dMgo9GJHYqsBoCdO/KKlOnwBDWgRKmuPI1Y7zwbOfnbpgWaAYRb6oox4g4Vl8jhnWQDX3VZDAxZ1/EHd5/96bDgiG2r70EZDyu+czq0IG/xrvVV4X7FWhEdobKRLHBcvlp/HLBgjLOouaeBxyYaf3h4z6KEtvMZvoEHTqkbsCyKEfgjhSkmvOQzwBhVCZsmKwLMc6X/mx8nAh/e8iR636NSFhCs539iTHCtTpU0ceKO55JEAY5662nO/YMD+n+ahCyQSCkRwlpC9XIcgAXJIdNdM8gnT/rDzrfqbfjZojDGsyMHTRCVOa1DEFwoRWnmUKQiTMM6/nqTr/zlfv7cxZa673MAY2/LC7SStzM8zFIs4Cc3VTmX79j7q9plezJ26EhY1b8rXevq6oOo8JzM6JbQ+ouJRemB7pKJHjw8WqWXfp5kpLRb925z4lLFTjnEMQzHZTsz6aIlXF2rs/uypHA== X-Forefront-PRVS: 0070A8666B X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(6009001)(7916002)(199003)(189002)(6116002)(3846002)(101416001)(305945005)(36756003)(86362001)(33646002)(50466002)(586003)(76176999)(50986999)(81166006)(81156014)(4326007)(8676002)(66066001)(2351001)(47776003)(7846002)(23676002)(7736002)(45336002)(2906002)(110136003)(50226002)(229853001)(46386002)(5820100001)(19580395003)(4001430100002)(107886002)(42186005)(2950100001)(97736004)(2870700001)(189998001)(68736007)(92566002)(19580405001)(450100001)(90966002)(5660300001)(52956003)(105586002)(106356001)(122856001); DIR:OUT; SFP:1102; SCL:1; SRVR:AM5PR0701MB2530; H:erkkise-laptop.vincit.intranet; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: nokia.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtBTTVQUjA3MDFNQjI1MzA7MjM6N1BIR1ZmcTJKVFcxUXdaa1IrMXVrZGU5?= =?utf-8?B?TFgwTmcwTk9MeFRlRFlLNWZzdlorUXVLMEpkVG9yd21kbTZ0eHc0Ykora0pH?= =?utf-8?B?eFVvTTVVd1AxSnkwOEhqREZ4OHRDdTJvcmRUUURMaVduektjNjViUUp1QVYr?= =?utf-8?B?NHBpRElIZStmd1ZqN1hTc2djY1hGbFp1N0UzMFFUS0pYay9qUmFTS3Jsa0c0?= =?utf-8?B?WVhTQk40YUdRT2ZBSTNNWW1RclF1YUI5c0tJak9Rb1M1eXlYUXJPQVpsaVFU?= =?utf-8?B?VjZHaTV6WGI3ZURWcDdiYUtQeXBsUXpxbzhTTVl4Uy83NlhUOTJQMjIrVHow?= =?utf-8?B?MFEvL0NKcWM1elk3Wndqd3JQWkk1SUJrVUJjdUVxTEQrUFNQN2RPU2IvUUxZ?= =?utf-8?B?eHZFb1Nzd0wybE9CSHBDOEtvRl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7NL+WEoA1IuGXG4K4oomYVlvhMcO7YYrL6FD9+vV0=; 7:t8+2E/OM7TuYwUzr58NmpvlWYRYDTI65Yt03kc/T7VIpYZViucv8llGQgwukvErh9cGP34o1n0N3E3qAh6DA0zBA7Ob0R9nSxLgpCHpDIfs3yELeOyontVIVWC79+95qI43d0nyiyugjLPAeaWEcIVTTDoBu7MMMDo1lteRt/LexSm01YeUZkmfXDfx59qvwIqcYAYf+K7L0jEUo8jJ85GFe8VFgyojD38p5oKfcWZusP+zpIies+rTfHX+MgFjLjgb3eumDDUSBySQOwj09ulTDlbVXPvR9SOl4pOBc625219ffkObLSZBzo0Y5U4Im SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: nokia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Sep 2016 13:26:06.7966 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0701MB2530 Subject: [FFmpeg-devel] [PATCH v3 06/25] avcodec/avcodec, avformat/movenc: introduced AV_PKT_DATA_TRACK_ALTERNATE_GROUP side data for expressing alternate groups 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?q?Erkki=20Sepp=C3=A4l=C3=A4?= , OZOPlayer Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Alternate groups previously always generated for ISO media files. With this addition client code can define track groups arbitrarily. Signed-off-by: Erkki Seppälä Signed-off-by: OZOPlayer --- libavcodec/avcodec.h | 11 +++++++++++ libavformat/movenc.c | 9 +++++++++ 2 files changed, 20 insertions(+) diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 56bb9b0..3be54d4 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -1543,6 +1543,17 @@ enum AVPacketSideDataType { * indicated by the key's length. */ AV_PKT_DATA_TRACK_REFERENCES, + + /** + * Assign alternate groups for tracks. An example of alternate + * groups would be audio tracks (or video tracks) that are + * alternative to each other. Each alternative track shares the + * same non-zero alternate group. + * + * The content is: + * uint: The alternate group of this track + */ + AV_PKT_DATA_TRACK_ALTERNATE_GROUP, }; #define AV_PKT_DATA_QUALITY_FACTOR AV_PKT_DATA_QUALITY_STATS //DEPRECATED diff --git a/libavformat/movenc.c b/libavformat/movenc.c index aed30dc..b2e87ed 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -2407,6 +2407,8 @@ static int mov_write_tkhd_tag(AVIOContext *pb, MOVMuxContext *mov, int flags = MOV_TKHD_FLAG_IN_MOVIE; int rotation = 0; int group = 0; + int *alternate_group = NULL; + int alternate_group_size; uint32_t *display_matrix = NULL; int display_matrix_size, i; @@ -2423,6 +2425,13 @@ static int mov_write_tkhd_tag(AVIOContext *pb, MOVMuxContext *mov, display_matrix = NULL; } + if (st) { + alternate_group = (int*) av_stream_get_side_data(st, AV_PKT_DATA_TRACK_ALTERNATE_GROUP, + &alternate_group_size); + if (alternate_group && alternate_group_size >= sizeof(int)) + group = *alternate_group; + } + if (track->flags & MOV_TRACK_ENABLED) flags |= MOV_TKHD_FLAG_ENABLED;