From patchwork Wed Aug 31 11:35:49 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: 362 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.140.134 with SMTP id o128csp328100vsd; Wed, 31 Aug 2016 04:37:33 -0700 (PDT) X-Received: by 10.194.235.229 with SMTP id up5mr8508984wjc.69.1472643453347; Wed, 31 Aug 2016 04:37:33 -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 76si10093687wmr.124.2016.08.31.04.37.27; Wed, 31 Aug 2016 04:37:33 -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 3AA9F689AEB; Wed, 31 Aug 2016 14:36:13 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20093.outbound.protection.outlook.com [40.107.2.93]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7EB39680D07 for ; Wed, 31 Aug 2016 14:36:04 +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=DHNc9T2fCDfTjgfP6+9JTThggG4Ypp1fusPTn6KjF9M=; b=inUJK1SjqLhiQwQA6HBKX3CosuXarV0i/030HPBxCX3H6N0ANEO9XV8SsvRw6EuPlwFlfzm5/O3XQw6yvoN1sj6BiHZTp7PkC1fcrBbdCdw2uX8dT6rchZ6n4UnqfBKPi5LxCgDpZnDSH5ChARz3luhvJekmpThfL1yq8MLM5/U= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=erkki.seppala.ext@nokia.com; Received: from erkkise-laptop.vincit.intranet (131.228.2.27) by VI1PR0701MB2544.eurprd07.prod.outlook.com (10.168.139.145) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.609.9; Wed, 31 Aug 2016 11:36:06 +0000 Received: by erkkise-laptop.vincit.intranet (Postfix, from userid 1000) id D03574CB94A; Wed, 31 Aug 2016 14:36:01 +0300 (EEST) From: =?UTF-8?q?Erkki=20Sepp=C3=A4l=C3=A4?= To: Date: Wed, 31 Aug 2016 14:35:49 +0300 Message-ID: <1472643361-10118-7-git-send-email-erkki.seppala.ext@nokia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1472643361-10118-1-git-send-email-erkki.seppala.ext@nokia.com> References: <1471943019-14136-1-git-send-email-erkki.seppala.ext@nokia.com> MIME-Version: 1.0 X-Originating-IP: [131.228.2.27] X-ClientProxiedBy: AM5PR0101CA0014.eurprd01.prod.exchangelabs.com (10.169.240.24) To VI1PR0701MB2544.eurprd07.prod.outlook.com (10.168.139.145) X-MS-Office365-Filtering-Correlation-Id: 7ed11e1d-3238-4740-1026-08d3d192ff23 X-Microsoft-Exchange-Diagnostics: 1; VI1PR0701MB2544; 2:LoNCgzDzgiqcpouvWUejN1w+ih+qOmPpjoO0rLsGama5JXjsFsqe2Khve1rFZ0dcHttSYyLgyhb3UCcgx1S3JGvI/MiQ6dDNq5V3HkEuGyzf9IxwRBLmEdNW8hXmBb022WFkyGnPW2oRCuUgGA5km6n32XRRHNapY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HnTCqICoh8+LU2OmnvTgsdhXXU5O6yO8VoklK+4BBv6CgTYFU9Vr8v373ceA3csFB9fUETnfq/ZfwQHM/LcDx5CfC3uIhNI6klVq+ibwVwwcL6B6ZUGj87p9FTCFRC5PX+wqCfeetPPOrBHPrJHinCqcBihXFw= X-Microsoft-Exchange-Diagnostics: 1; VI1PR0701MB2544; 20:3jIS88yB3J97kla4QJniXZIm5OdsHaCyrOisryDREF8h76Bj2z5bCCune5YjzMPd9WsoCcGGLQ5gqU2OqNIi2/ekGbo73Lv2tA8OVlrjsCWZ7FJ6k8zOID7nnefEUDkyCu11Vf3DCnnrnCU+4hNQkczzrc1jmxhAmQfrNrZTtpme3rAxGtxq+RiQ8He/BRzOZBmDUdK8ihhKUHeLjY5LZ9WPGqtnu6EZPOHmKPR7mxXNDjkj3L72XXzgtUyBDoctHBtwXtlNWqpjX8KM2gjR1KHLFqDzSLkU8euKj22Zh85Xs8tVVMkj6lxYEMcLQ3UqQz80DlDAS3wXgvU6B29eeKhK7f3xnzwx+5OtjnNh+HUGyPCfTwJI/z0tkob+8nJDaCjLLoo3LP/uIaPwJYFCzx3r+i6/slVBEK6MfXVXTmXr8/jO3Lc5wizH5jEl7+VvKzHBzPnuE7gZ0atM0uK1FRflygTWnIe5aGeK3P+81FjqNkfx3lM2Stae5rldALz7 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(82608151540597)(17755550239193); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001)(6055026); SRVR:VI1PR0701MB2544; BCL:0; PCL:0; RULEID:; SRVR:VI1PR0701MB2544; X-Microsoft-Exchange-Diagnostics: 1; VI1PR0701MB2544; 4:u27VyYzfc2+zziVQS5hbkb8nqQuJFPRoSPGo1G0SzouUbps/aRE2jTPm9MAUI/0O0VSIB8kwsn7S27aevPktG4RFVQqjT4LcLfMVmOWEX9ghZQgcMeT7LqEIH8rSLPblIygXRd5Ve5eBGehfAxSMH3b8cPJD0ifELJleW3h0tx9E5BFFDEJ+dd9bfFB1E+2POcEPiZJ+Mkn1ECaKoX0RysB76CYpYGBJDdZDGroVnkPuk1efaQDX6nMroHwnJxb8pMTM9M26h4MzQdnL51c0CZSgJaZD81BK7n4BoRccl12cMPG6jJJaHPpfg6Hde4E88GvpYidoH7M+w8yA8CDyuOT87C1Q/3Ilx/JchFx2gVcIpKec3Lr6HxPaEjrzSdvE72SQ13j/jM6oyuCUNdtKg8MvnHAWXDy9L2xqwmjdG6fP2PlcOF8pdQavGzojjGuRFoSlO2MH6ATLddLh/XzpL0Jik1moQBVlkinkBJlWAHA= X-Forefront-PRVS: 00514A2FE6 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(6009001)(7916002)(199003)(189002)(229853001)(2351001)(5820100001)(50986999)(76176999)(4001430100002)(33646002)(97736004)(110136002)(42186005)(189998001)(50466002)(101416001)(2950100001)(36756003)(107886002)(52956003)(68736007)(90966002)(92566002)(86362001)(81166006)(81156014)(305945005)(46386002)(23676002)(7846002)(19580395003)(19580405001)(8676002)(586003)(7736002)(45336002)(6116002)(66066001)(47776003)(3846002)(122856001)(450100001)(4326007)(2906002)(105586002)(2870700001)(50226002)(106356001)(5660300001)(2004002); DIR:OUT; SFP:1102; SCL:1; SRVR:VI1PR0701MB2544; 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?MTtWSTFQUjA3MDFNQjI1NDQ7MjM6R2c5cmE5ODhmRTNKcUlmYnFCTG1QUGZ0?= =?utf-8?B?ZTMrYjR6S0RGRklPM2crdngvSWsyNGx3K2NTVHk2V2wrdjRQSlYvMkVlencv?= =?utf-8?B?NFBGNnJWOFVRU05qTHJqdm9rb3RWUnNUREptOHp5YlpPeUtpcTdaVHlTMTF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Ir8hZMwXRIebdRU8VZ6ZN+X4B0RMCwXL4eM5hs/ECOCJLRZkc2vKhGnjeIoOqzDhAEdYa6zaALO/uIMuNmz6ekfGg6ZPxefIMB07Pnp7gOBAWCc/xwneDrPbXZVtbWCnYrdUL45Rlfu44mjRmFHIHKP66EHDxv/AJ8V0wrXjw9qnrnNgg==; 5:k4sRjvKCKI1L2vSI1h1TKPNsJLXyyeLDOfDkSyDuPnRn+mnQJoK+/9YzUu206IuA9azceJoGJHZyo/nxHyppd3/rmWYaWPqa/SDIAIfEkn1L/Z0m+R4VGQv8K33SZQ6Pd5OvV9Rvosp2RNpUFYzWvA==; 24:RNdJs7ZQjYA6UmR+doKnxVjD51OA0C1Giu36hPBJS42JEDcs3CjuZFluOlQEJUnnL31LKST7j7hKXgjEaSe7kZyYc2Y5vsSDOHBXg2a/35M=; 7:U47O0RGFfKWrkLyPgIfGSt2fhBhgZ12oSRJ8QUXS1MBhiB1gu4zP9tYp9cFJmSoffU7K5oVvcwlnboRYEpFsFq7bgjo1fHfAdKm/6yu5fm5Qq/67JHBUg1cZv+AvZIJK9qALEaoSb5XFjcA6yUr7o+353mwjiUcXS0RwTWmx3RTDVutqciiw87zsKyKbksaSqmexELRz236MCtPwK5++LrN6YW7opkqi5X0RU1nKu75GLWyVS7UNV+y9T+lvfb6W SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: nokia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Aug 2016 11:36:06.4689 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0701MB2544 Subject: [FFmpeg-devel] [PATCH v2 06/18] avformat/movenc: add the urim sample descriptor 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" This also adds libavformat/movmeta that contains the meta data information. Actually the sample configuration data is performed with side packet data AV_PKT_DATA_TIMED_METADATA_INFO where the value is stored inside AVTimedMetadataInfo. Signed-off-by: Erkki Seppälä Signed-off-by: OZOPlayer --- libavcodec/avcodec.h | 16 ++++++++++ libavformat/isom.c | 1 + libavformat/movenc.c | 83 ++++++++++++++++++++++++++++++++++++++++++++++++--- libavformat/movenc.h | 1 + libavformat/movmeta.h | 46 ++++++++++++++++++++++++++++ 5 files changed, 143 insertions(+), 4 deletions(-) create mode 100644 libavformat/movmeta.h diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index f45cdc2..8373bca 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -1349,6 +1349,16 @@ typedef struct AVCPBProperties { * @{ */ +typedef struct AVTimedMetadataInfo { + char meta_tag[4]; /** 4cc describing this metadata box type */ + int meta_length; /** length of data for the metadata type information */ + + char conf_tag[4]; /** configurationg box type 4cc, ie. 'conf' */ + int conf_length; /** length of the data for the configuration box */ + + /** followed by meta_length bytes of meta data followed by conf_length bytes of conf data */ +} AVTimedMetadataInfo; + typedef struct AVTrackReferences { int next_tref_ofs; /** offset in bytes to the next AVTrackReferences or 0 if this is the last one*/ char tag[4]; /** 4cc used for describing this */ @@ -1543,6 +1553,12 @@ enum AVPacketSideDataType { * indicated by the key's length. */ AV_PKT_DATA_TRACK_REFERENCES, + + /** + * Configured the timed metadata parameters, such as the uri and + * meta data configuration. The value is of type AVTimedMetadataInfo. + */ + AV_PKT_DATA_TIMED_METADATA_INFO, }; #define AV_PKT_DATA_QUALITY_FACTOR AV_PKT_DATA_QUALITY_STATS //DEPRECATED diff --git a/libavformat/isom.c b/libavformat/isom.c index 1a90d00..473700f 100644 --- a/libavformat/isom.c +++ b/libavformat/isom.c @@ -357,6 +357,7 @@ const AVCodecTag ff_codec_movsubtitle_tags[] = { const AVCodecTag ff_codec_metadata_tags[] = { { AV_CODEC_ID_META, MKTAG('m', 'e', 't', 'a') }, + { AV_CODEC_ID_META, MKTAG('u', 'r', 'i', 'm') }, { AV_CODEC_ID_NONE, 0 }, }; diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 6cc315a..282551b 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -1552,6 +1552,69 @@ static int mov_write_fiel_tag(AVIOContext *pb, MOVTrack *track, int field_order) return 10; } +static int mov_write_urim_uri_box(AVIOContext *pb, const char *uri, int length) +{ + int64_t pos = avio_tell(pb); + avio_wb32(pb, 0); /* size */ + ffio_wfourcc(pb, "uri "); + avio_w8(pb, 0); /* version */ + avio_wb24(pb, 0); /* flags */ + + avio_write(pb, uri, length); /* uri */ + avio_w8(pb, 0); /* null-terminated */ + + return update_size(pb, pos); +} + +static int mov_write_conf_box(AVIOContext *pb, const uint8_t *data, int length, char* tag) +{ + int64_t pos = avio_tell(pb); + avio_wb32(pb, 0); /* size */ + ffio_wfourcc(pb, tag); + + avio_w8(pb, 0); /* version */ + avio_wb24(pb, 0); /* flags */ + + avio_write(pb, data, length); /* data */ + + return update_size(pb, pos); +} + +static int mov_write_meta_codec(AVIOContext *pb, MOVTrack *track) +{ + int64_t pos = avio_tell(pb); + + char *data; + char *tag; + + AVTimedMetadataInfo *meta = + (void*) av_stream_get_side_data(track->st, AV_PKT_DATA_TIMED_METADATA_INFO, + NULL); + + av_assert0(meta); + + avio_wb32(pb, 0); /* size */ + ffio_wfourcc(pb, meta->meta_tag); + + avio_wb32(pb, 0); /* Reserved */ + avio_wb16(pb, 0); /* Reserved */ + avio_wb16(pb, 1); /* Data-reference index */ + + data = (char*) (meta + 1); + tag = meta->meta_tag; + if (tag[0] == 'u' && tag[1] == 'r' && tag[2] == 'i' && tag[3] == 'm') { + mov_write_urim_uri_box(pb, data, meta->meta_length); + data += meta->meta_length; + } + + if (meta->conf_length) { + mov_write_conf_box(pb, data, meta->conf_length, meta->conf_tag); + data += meta->conf_length; + } + + return update_size(pb, pos); +} + static int mov_write_subtitle_tag(AVIOContext *pb, MOVTrack *track) { int64_t pos = avio_tell(pb); @@ -1951,6 +2014,18 @@ static int mov_write_tmcd_tag(AVIOContext *pb, MOVTrack *track) return update_size(pb, pos); } +static int mov_write_data_tag(AVIOContext *pb, MOVTrack *track) +{ + if (track->par->codec_id == AV_CODEC_ID_META) + return mov_write_meta_codec(pb, track); + else if (track->par->codec_tag == MKTAG('t','m','c','d')) + return mov_write_tmcd_tag(pb, track); + else if (track->par->codec_tag == MKTAG('r','t','p',' ')) + return mov_write_rtp_tag(pb, track); + else + return 0; +} + static int mov_write_stsd_tag(AVFormatContext *s, AVIOContext *pb, MOVMuxContext *mov, MOVTrack *track) { int64_t pos = avio_tell(pb); @@ -1962,12 +2037,10 @@ static int mov_write_stsd_tag(AVFormatContext *s, AVIOContext *pb, MOVMuxContext mov_write_video_tag(pb, mov, track); else if (track->par->codec_type == AVMEDIA_TYPE_AUDIO) mov_write_audio_tag(s, pb, mov, track); + else if (track->par->codec_type == AVMEDIA_TYPE_DATA) + mov_write_data_tag(pb, track); else if (track->par->codec_type == AVMEDIA_TYPE_SUBTITLE) mov_write_subtitle_tag(pb, track); - else if (track->par->codec_tag == MKTAG('r','t','p',' ')) - mov_write_rtp_tag(pb, track); - else if (track->par->codec_tag == MKTAG('t','m','c','d')) - mov_write_tmcd_tag(pb, track); return update_size(pb, pos); } @@ -2323,6 +2396,8 @@ static int mov_write_minf_tag(AVFormatContext *s, AVIOContext *pb, MOVMuxContext else mov_write_gmhd_tag(pb, track); } + else if (track->par->codec_type == AVMEDIA_TYPE_DATA) + mov_write_nmhd_tag(pb); if (track->mode == MODE_MOV) /* FIXME: Why do it for MODE_MOV only ? */ mov_write_hdlr_tag(s, pb, NULL); mov_write_dinf_tag(pb); diff --git a/libavformat/movenc.h b/libavformat/movenc.h index 700d8d5..0fdc70f 100644 --- a/libavformat/movenc.h +++ b/libavformat/movenc.h @@ -27,6 +27,7 @@ #include "avformat.h" #include "movenccenc.h" #include "movtref.h" +#include "movmeta.h" #define MOV_FRAG_INFO_ALLOC_INCREMENT 64 #define MOV_INDEX_CLUSTER_SIZE 1024 diff --git a/libavformat/movmeta.h b/libavformat/movmeta.h new file mode 100644 index 0000000..e57b381 --- /dev/null +++ b/libavformat/movmeta.h @@ -0,0 +1,46 @@ +/* + * MOV, 3GP, MP4 muxer + * Copyright (c) 2015 Erkki Seppälä + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVFORMAT_MOVMETA_H +#define AVFORMAT_MOVMETA_H + +#include "avformat.h" + +typedef enum MOVMetaType { + MOV_META_NONE, + MOV_META_URIM +} MOVMetaType; + +typedef struct MOVConfMeta { + uint32_t tag; + int length; + void *data; +} MOVConfMeta; + +typedef struct MOVMeta { + uint32_t tag; + int length; + void *data; + + MOVConfMeta conf; +} MOVMeta; + +#endif /* AVFORMAT_MOVMETA_H */