From patchwork Tue Aug 23 09:03:22 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: 248 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.140.134 with SMTP id o128csp2180231vsd; Tue, 23 Aug 2016 02:05:42 -0700 (PDT) X-Received: by 10.28.163.199 with SMTP id m190mr18027009wme.5.1471943141933; Tue, 23 Aug 2016 02:05:41 -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 d186si2625779wmc.125.2016.08.23.02.05.41; Tue, 23 Aug 2016 02:05:41 -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 8B622689CBF; Tue, 23 Aug 2016 12:04:53 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0111.outbound.protection.outlook.com [104.47.2.111]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 99D06689BFF for ; Tue, 23 Aug 2016 12:04:08 +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=doxfrkF/ew0xPp4PwA3oXozcFL3kj/pCOBAl+O7pYM0=; b=UkGS4bRPhGMnBZy/4zc1NUa81vvoGFw/tlxySwHC5M/4to0c8+PJN4eoICVqHGo+MpW5EYo2hlbUMjQ3cDmWRfERStojBfDp89z3qqbXb1fKw1qp9vNRW/ZzOuDoa0e8ZBS9MO9525GQrqsXWpB392BguhRsTLAb+xn+5h4xJdk= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=erkki.seppala.ext@nokia.com; Received: from erkkise-laptop.vincit.intranet (131.228.2.4) by DB6PR0701MB2534.eurprd07.prod.outlook.com (10.168.76.22) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.557.21; Tue, 23 Aug 2016 09:04:08 +0000 Received: by erkkise-laptop.vincit.intranet (Postfix, from userid 1000) id 4730F4449E4; Tue, 23 Aug 2016 12:04:04 +0300 (EEST) From: To: Date: Tue, 23 Aug 2016 12:03:22 +0300 Message-ID: <1471943019-14136-5-git-send-email-erkki.seppala.ext@nokia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1471943019-14136-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.4] X-ClientProxiedBy: VI1PR0901CA0049.eurprd09.prod.outlook.com (10.167.203.145) To DB6PR0701MB2534.eurprd07.prod.outlook.com (10.168.76.22) X-MS-Office365-Filtering-Correlation-Id: b6aabffe-f36e-4f3c-7844-08d3cb34710a X-Microsoft-Exchange-Diagnostics: 1; DB6PR0701MB2534; 2:csdeTm+zrV+YBm4vSV8UK6YpuXHupiBWHV2ucsoVonrCj+x8JlY5jXi/FNMePdxqeaPK1gDteyTh79B86YoxuxKu7/QLMpCcB6AQjIfp6XUnPxrxbbl92oVCGzMNyA5Xwa7SrI9QKVPZY9+jqEJjAlARYpL/BcjPQ65AzOnfCRdzr+bALIJrpA3j/YZus7r4; 3:0o5/GF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CftOjEi/D9cCs65QreOo96MhGb7ndKvYYnbxllmt+umpXwgn++fMN0= X-Microsoft-Exchange-Diagnostics: 1; DB6PR0701MB2534; 20:Gm/qzGDUT+cpnd1TH1S/UXCKQuw6ERlLAjQ5vBZdRVmLKfZTQJa0HZcrqkS6f9Nwbfo3WZiBF+3e2OrYkO84t+IrIP8MNu3CPrbJEv2bowNoZ3hYGTjYeiLDIj/PI6ryjargAEI+c6rPDacgTcPOEldBQmE+9iW0vMGXYz9z8IuXq3XqcCQRo7UFY/RTUTqLC6j6QDKs7XadNIOdQ5jyMH0gVvkmB/oboUB97iKvlChCr+pwvG8mbH0gDQefNcGzQoj8LEJyfO5D45YUUn5RMvKrW2M/C1irsmwUlmi5BooetKtlPTXt4dQfkFe8ACdsHzafqS74iuzxoLypjMRa+J7edgNIfjgiWpp+s+HewXlT2upmYadka1H/GyQajS3nAzSUzruDjTTuKiSPcGJEEss39p8l2DXTSZNZ4YnzQ2pldrQyajfHe0e6uhF7P8dLj3MVkGFfqSo8Z79798j7WeqNQXFn2l8w1DCgJD6Z6kpuQ6jQ+7Cpsl3wWcN+HbjU 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)(5005006)(8121501046)(3002001)(10201501046)(6055026); SRVR:DB6PR0701MB2534; BCL:0; PCL:0; RULEID:; SRVR:DB6PR0701MB2534; X-Microsoft-Exchange-Diagnostics: 1; DB6PR0701MB2534; 4:kOak9XnI0Bb6fxm4QZNmcVrAhkFqgyAFthJGZVEpLsTkkVxXNYzwpPAgpOpIWzIvuxLqwTrXT3ydwn9h7gfbGwzBZ672d7AhNS2ciOreCdu58dCoAOIAQFMaN9AANyCZDr+Gp8ey2eF1cahrKwtDYQdk+/AGQamgSJOLFa8A4mqAEfY41QTspsBoygBvh7ZTaDcCPhlLvaMGU2WJZQK6wa8KCb2z8EqzT3pgNcnZC08+hQTiozpL1zMREtamZFITM/oW07ogG/T2bhLCs+RqDT6eXiCErpTtgA15WaBb8VgQcHhGUufxMjt+znAczaWL/ulzbl58I7Nnrx1jNHH6wlmosWoYd2nGlD5LgvCM3qhB5u+mZau0QpUI8fKWi4l2Pto5b+cFQQys/62kECjMmsfM61syoTIaGAAhPfHsbliA3aoovWUmENo2ek8WksOCdonxv+9pM4xJmjwQ0OB8DQ== X-Forefront-PRVS: 004395A01C X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(6009001)(7916002)(189002)(199003)(3846002)(2950100001)(81156014)(81166006)(8676002)(66066001)(6116002)(52956003)(86152002)(36756003)(5820100001)(4001430100002)(86362001)(105586002)(586003)(92566002)(46386002)(68736007)(305945005)(5660300001)(7736002)(7846002)(47776003)(2876002)(23676002)(101416001)(19580395003)(106356001)(122856001)(229853001)(90966002)(45336002)(2351001)(19580405001)(107886002)(76176999)(110136002)(2870700001)(2906002)(189998001)(97736004)(450100001)(50986999)(33646002)(4326007)(50466002)(50226002)(42186005); DIR:OUT; SFP:1102; SCL:1; SRVR:DB6PR0701MB2534; H:erkkise-laptop.vincit.intranet; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: nokia.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtEQjZQUjA3MDFNQjI1MzQ7MjM6N25sSFNGa1JKVEVPMjRUR0IwYlRnTTk3?= =?utf-8?B?VCs4VHF6NmNHY1lnRXpBMUJ6RXFYblIwQ0VRRnBFSGNubGI4ajRrL3hUdXRC?= =?utf-8?B?SjdXNHZrLzVTN1d6VE9kZWp0c25IUVRuY2tFbnY3NTRLYkJwN2Y2V2FCS25w?= =?utf-8?B?bGc2V0lDQnkxZXpLRktYaldvaFVieWpyRmdUaGEzakc3Z2dVaVRtNGk4Vk1L?= =?utf-8?B?S1hRSTV4akE0SHFCVldHT0VlOVRVa0N1eVdINWh5ejJjU0l6M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C0Qhr82fJexdxod+pqo2v30CrUaWxFuYXGBqLmO/Hc2O2Uk45at5dYqvKrtyYNUg==; 5:dYEO313se2DoYWi0l+at5zrBKbxJpooMzQ4MdOW17AWljyA5/RKPl+FCpkpJRSF6/DDLQjEie9fLGjJO/HEss0FIHy9cLXJCBAg9+L7Izxow8bo+p6VwbYtAk6c5+AmAjRnldzQYLYMJNPJF5kgGoA==; 24:FnyEXw5nlAJUSKunI1LYmB3bgGmmer2bF/XfjgU3zQOhSEzxqK6d6jzqzAis+FceFBvsAjMJD+kM7oXwEfGSL3UPuKd7Ztc22i6hXDffPA4=; 7:aENHb/eZ0nhIIhunavVmU1mOSik4he0ffyKSuK2rHfmtge85Q2FP99Idy+j4tTD07FuSUMek4TqSwGXS4Bk8mM4jgwPxDoEH/Eal8uBlx25mwI6qA9hg6QXBzjDvyuR1f0skV0El4EwwfAHN2Z9potglndZxj2CCBWH0PeVrqhju/SNcxia6VURVhdBGBPGMo5w9bCtTTkiqYvYAQF0LqZuyRQM3JWMgjlezE56/0b0K1WTvRURFGdnOqJf1VxwS SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: nokia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Aug 2016 09:04:08.3790 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0701MB2534 Subject: [FFmpeg-devel] [PATCH 04/21] libavcodec: added a structure AVData for decoding timed 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 Cc: =?UTF-8?q?Erkki=20Sepp=C3=A4l=C3=A4?= , OZOPlayer Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" From: Erkki Seppälä Also added avdata_alloc and avdata_free for dealing with it. AVData can contain arbitrary binary data and comes with a format-field so far unused. The purpose is that AVMEDIA_TYPE_DATA -kind codecs can store frames in this format. Signed-off-by: Erkki Seppälä Signed-off-by: OZOPlayer --- libavcodec/avcodec.h | 20 ++++++++++++++++++++ libavcodec/utils.c | 19 +++++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 6ac6646..fb8f363 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -3934,6 +3934,14 @@ typedef struct AVSubtitle { int64_t pts; ///< Same as packet pts, in AV_TIME_BASE } AVSubtitle; +typedef struct AVData { + uint16_t format; /** 0 = timed metadata */ + int64_t pts; + int64_t dts; + + AVBufferRef *data; +} AVData; + /** * This struct describes the properties of an encoded stream. * @@ -4317,6 +4325,18 @@ int avcodec_close(AVCodecContext *avctx); void avsubtitle_free(AVSubtitle *sub); /** + * Allocate an empty data (typically use with timed metadata) + */ +AVData *avdata_alloc(void); + +/** + * Free all allocated data in the given data struct. + * + * @param sub AVData to free. + */ +void avdata_free(AVData *sub); + +/** * @} */ diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 138125a..dabe97e 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -2955,6 +2955,25 @@ int attribute_align_arg avcodec_receive_packet(AVCodecContext *avctx, AVPacket * return 0; } +AVData *avdata_alloc(void) +{ + AVData *data = av_mallocz(sizeof(*data)); + + if (!data) + return NULL; + + return data; +} + +void avdata_free(AVData *data) +{ + av_buffer_unref(&data->data); + + memset(data, 0, sizeof(AVData)); + + av_free(data); +} + av_cold int avcodec_close(AVCodecContext *avctx) { int i;