From patchwork Tue Jul 10 21:51:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Keroulas X-Patchwork-Id: 9665 Delivered-To: ffmpegpatchwork@gmail.com Received: by 2002:a02:104:0:0:0:0:0 with SMTP id c4-v6csp4140162jad; Tue, 10 Jul 2018 14:52:14 -0700 (PDT) X-Google-Smtp-Source: AAOMgpccQIrJuCoS8O2Ot06dLgL32L6SVf+njzMF4CKHWDi8vCWquMz+AePU7N/33Z3mLGIY1OcC X-Received: by 2002:a1c:7e92:: with SMTP id z140-v6mr14458558wmc.48.1531259534861; Tue, 10 Jul 2018 14:52:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531259534; cv=none; d=google.com; s=arc-20160816; b=tvXpvhZczpsTLJtcWuzLQwuF9vDu6hpmDmOHOWSp3yt7psk4BtywXc5ARovYUkwMUT jI4cORUD8zGgjPteFAz6KqaJjS2Q8G1XN2C+BBIuOGelVJuNaUKk31dhuFv817r+zTYa JZrEyt1yFNxi1G+IV1umTvNUvtyLBHL+xCHKEUgkxqDViJQD7GA50WP7tSVpIjwsZ+5C EmS+rr4rFPKsq/RmnHcLGwh5hUBwhms6WjEQeXBRDjpRMIVxRsTfG0HmsyZGpgijg2v8 Qzrfzj76UyHWpMcgJjY5jX8k/fliPTxNg2vMIsj0NApwgvqPxXt440SYQtLFLqdkSdAG GFIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:message-id:date:to:from:delivered-to :arc-authentication-results; bh=v8mL7c29JWVx9rkGZnAHwTEAuAliym5XTYsfBzMPPMI=; b=CvIypL/++yttto8xR8XJPJ6nezxBXBiBbGZU5wjAiMDzpYjZUn7AKvWANirk18WKQ7 DEMPIISDUrtqpwuvlMjvwwBW12DmgCb4VEBX6uDvjsKY+Kfi2Pp+ItdlZxEhn/XUhG61 MY9y2Ij7F6cJzUxQzEDPJzoU4iywKbtHn1LNV9BIyX57fXoqodzf9naLL+FcDT2AeyrQ 9DBAAb5OHldRnFT71HYfwbnJMgArVGHlHk1FkaSsyfkHt5DB/q/fgtuUOC3C0mKQOHB2 pZTID+62fy+cOazDFrZdhmelMb5ssUAIFR44SGLgSyTfkcJsx68Ekm3X5alELor0awX/ ZcVA== 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 i76-v6si257915wmh.34.2018.07.10.14.52.14; Tue, 10 Jul 2018 14:52:14 -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; 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 8D09168A4BE; Wed, 11 Jul 2018 00:52:04 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail.savoirfairelinux.com (mail.savoirfairelinux.com [208.88.110.44]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 181C7689CBE for ; Wed, 11 Jul 2018 00:51:58 +0300 (EEST) Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id A65FB9C3150 for ; Tue, 10 Jul 2018 17:52:03 -0400 (EDT) Received: from mail.savoirfairelinux.com ([127.0.0.1]) by localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id EBRkOJ0TDPae; Tue, 10 Jul 2018 17:52:02 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id DA8EF9C316B; Tue, 10 Jul 2018 17:52:02 -0400 (EDT) X-Virus-Scanned: amavisd-new at mail.savoirfairelinux.com Received: from mail.savoirfairelinux.com ([127.0.0.1]) by localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id ONWrQ3TbEbZA; Tue, 10 Jul 2018 17:52:02 -0400 (EDT) Received: from pkeroulas.cbc-rc.ca (unknown [192.168.50.171]) by mail.savoirfairelinux.com (Postfix) with ESMTPSA id B05AB9C3150; Tue, 10 Jul 2018 17:52:02 -0400 (EDT) From: Patrick Keroulas To: ffmpeg-devel@ffmpeg.org Date: Tue, 10 Jul 2018 17:51:59 -0400 Message-Id: <1531259521-19421-1-git-send-email-patrick.keroulas@savoirfairelinux.com> X-Mailer: git-send-email 2.7.4 Subject: [FFmpeg-devel] [PATCH v8 1/3] avcodec: add side data type for ancillary 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: Patrick Keroulas MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Ancillary data can carry various side data that can't be transmitted in bitstreams. For now, this struct includes interlaced field flags and the must be attached to an AVPacket as side data. Signed-off-by: Patrick Keroulas --- Changes v7 -> v8: * Merge the definition of AVAncillaryData and its allocation in avcodec.h in a single patch. --- --- doc/APIchanges | 3 +++ libavcodec/avcodec.h | 7 +++++- libavcodec/avpacket.c | 1 + libavcodec/version.h | 4 ++-- libavutil/Makefile | 2 ++ libavutil/ancillary_data.c | 27 ++++++++++++++++++++++ libavutil/ancillary_data.h | 56 ++++++++++++++++++++++++++++++++++++++++++++++ libavutil/version.h | 4 ++-- 8 files changed, 99 insertions(+), 5 deletions(-) create mode 100644 libavutil/ancillary_data.c create mode 100644 libavutil/ancillary_data.h diff --git a/doc/APIchanges b/doc/APIchanges index efe15ba..ff2baff 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -15,6 +15,9 @@ libavutil: 2017-10-21 API changes, most recent first: +2018-05-xx - xxxxxxxxxx - lavc 58.20.100 - avcodec.h + Add AV_PKT_DATA_ANCILLARY to hold various side data. + 2018-05-xx - xxxxxxxxxx - lavf 58.15.100 - avformat.h Add pmt_version field to AVProgram diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index f85af3f..658bd9e 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -1360,6 +1360,12 @@ enum AVPacketSideDataType { AV_PKT_DATA_ENCRYPTION_INFO, /** + * Generic side data for any parameter that can't fit in a AVPacket, + * e.g. interlaced field flags. + */ + AV_PKT_DATA_ANCILLARY, + + /** * The number of side data types. * This is not part of the public API/ABI in the sense that it may * change when new side data types are added. @@ -1482,7 +1488,6 @@ typedef struct AVPacket { */ #define AV_PKT_FLAG_DISPOSABLE 0x0010 - enum AVSideDataParamChangeFlags { AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT = 0x0001, AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_LAYOUT = 0x0002, diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c index 99a0c13..27355e1 100644 --- a/libavcodec/avpacket.c +++ b/libavcodec/avpacket.c @@ -388,6 +388,7 @@ const char *av_packet_side_data_name(enum AVPacketSideDataType type) case AV_PKT_DATA_CONTENT_LIGHT_LEVEL: return "Content light level metadata"; case AV_PKT_DATA_SPHERICAL: return "Spherical Mapping"; case AV_PKT_DATA_A53_CC: return "A53 Closed Captions"; + case AV_PKT_DATA_ANCILLARY: return "Ancillary data"; } return NULL; } diff --git a/libavcodec/version.h b/libavcodec/version.h index 471ea4a..3f0d98e 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -28,8 +28,8 @@ #include "libavutil/version.h" #define LIBAVCODEC_VERSION_MAJOR 58 -#define LIBAVCODEC_VERSION_MINOR 21 -#define LIBAVCODEC_VERSION_MICRO 104 +#define LIBAVCODEC_VERSION_MINOR 22 +#define LIBAVCODEC_VERSION_MICRO 100 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ LIBAVCODEC_VERSION_MINOR, \ diff --git a/libavutil/Makefile b/libavutil/Makefile index 9ed24cf..100ce10 100644 --- a/libavutil/Makefile +++ b/libavutil/Makefile @@ -4,6 +4,7 @@ DESC = FFmpeg utility library HEADERS = adler32.h \ aes.h \ aes_ctr.h \ + ancillary_data.h \ attributes.h \ audio_fifo.h \ avassert.h \ @@ -92,6 +93,7 @@ BUILT_HEADERS = avconfig.h \ OBJS = adler32.o \ aes.o \ aes_ctr.o \ + ancillary_data.o \ audio_fifo.o \ avstring.o \ base64.o \ diff --git a/libavutil/ancillary_data.c b/libavutil/ancillary_data.c new file mode 100644 index 0000000..26686b8 --- /dev/null +++ b/libavutil/ancillary_data.c @@ -0,0 +1,27 @@ +/** + * Copyright (c) 2018 Patrick Keroulas + * + * 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 + */ + +#include "ancillary_data.h" +#include "mem.h" + +AVAncillaryData *av_ancillary_data_alloc(void) +{ + return av_mallocz(sizeof(AVAncillaryData)); +} diff --git a/libavutil/ancillary_data.h b/libavutil/ancillary_data.h new file mode 100644 index 0000000..d5a9da3 --- /dev/null +++ b/libavutil/ancillary_data.h @@ -0,0 +1,56 @@ +/** + * Copyright (c) 2018 Patrick Keroulas + * + * 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 AVUTIL_ANCILLARY_DATA_H +#define AVUTIL_ANCILLARY_DATA_H + +#include + +enum AVAncillaryDataFields { + AV_ANCILLARY_DATA_FIELD_NONE = 0x00, + AV_ANCILLARY_DATA_FIELD_TOP_FIELD = 0x01, + AV_ANCILLARY_DATA_FIELD_BOTTOM_FIELD = 0x02, +}; + +/** + * Ancillary data carries various side data that can't be transmitted in + * AV bit streams for codecs like bitpacked or v210. + * + * To be used as payload of a AVPacketSideData. + * + */ +typedef struct AVAncillaryData { + /** + * Flags to determine if the AVPacket holds a top/bottom field in + * case of interlaced format. + */ + uint8_t field; +} AVAncillaryData; + +/** + * Allocate an AVAncillaryData structure and set its fields to + * default values. The resulting struct can be freed using av_freep(). + * + * @return An AVAncillaryData filled with default values or NULL + * on failure. + */ +AVAncillaryData *av_ancillary_data_alloc(void); + +#endif /* AVUTIL_ANCILLARY_DATA_H */ diff --git a/libavutil/version.h b/libavutil/version.h index 44bdebd..84409b1 100644 --- a/libavutil/version.h +++ b/libavutil/version.h @@ -79,8 +79,8 @@ */ #define LIBAVUTIL_VERSION_MAJOR 56 -#define LIBAVUTIL_VERSION_MINOR 18 -#define LIBAVUTIL_VERSION_MICRO 102 +#define LIBAVUTIL_VERSION_MINOR 19 +#define LIBAVUTIL_VERSION_MICRO 100 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ LIBAVUTIL_VERSION_MINOR, \