From patchwork Fri Apr 10 15:41:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 18811 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 7E5C744A415 for ; Fri, 10 Apr 2020 18:42:23 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4A53168B499; Fri, 10 Apr 2020 18:42:23 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail.red.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 0F98C68B3FD for ; Fri, 10 Apr 2020 18:42:17 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail.red.khirnov.net (Postfix) with ESMTP id BCDDD28790D for ; Fri, 10 Apr 2020 17:42:16 +0200 (CEST) Received: from mail.red.khirnov.net ([IPv6:::1]) by localhost (mail.red.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id Lr-wRzSfZEqX for ; Fri, 10 Apr 2020 17:42:16 +0200 (CEST) Received: from quelana.khirnov.net (unknown [IPv6:2002:b061:f0a:201:5e:e696:5100:0]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "quelana.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail.red.khirnov.net (Postfix) with ESMTPS id 8AC112883BA for ; Fri, 10 Apr 2020 17:42:15 +0200 (CEST) Received: from localhost (quelana.khirnov.net [IPv6:::1]) by quelana.khirnov.net (Postfix) with ESMTP id 2867621829 for ; Fri, 10 Apr 2020 17:42:15 +0200 (CEST) Received: from quelana.khirnov.net ([IPv6:::1]) by localhost (quelana.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id fELplziDjKHf for ; Fri, 10 Apr 2020 17:42:14 +0200 (CEST) Received: from libav.daenerys.khirnov.net (libav.daenerys.khirnov.net [IPv6:2a00:c500:561:201::7]) by quelana.khirnov.net (Postfix) with ESMTP id CE8FA2182A for ; Fri, 10 Apr 2020 17:42:10 +0200 (CEST) Received: by libav.daenerys.khirnov.net (Postfix, from userid 1000) id D6BD320E0085; Fri, 10 Apr 2020 17:42:05 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Fri, 10 Apr 2020 17:41:58 +0200 Message-Id: <20200410154201.22678-1-anton@khirnov.net> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/4] lavc: install codec_desc.h 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" Forgotten in 672946c7fe6de56ccf5d2271ad1bfeb2290f394f --- Oops, sorry --- libavcodec/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/libavcodec/Makefile b/libavcodec/Makefile index d9b04964ca..1970ff027f 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -6,6 +6,7 @@ HEADERS = ac3_parser.h \ avcodec.h \ avdct.h \ avfft.h \ + codec_desc.h \ codec_id.h \ d3d11va.h \ dirac.h \ From patchwork Fri Apr 10 15:41:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 18812 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 57BC044A415 for ; Fri, 10 Apr 2020 18:42:24 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 43B5968B4C8; Fri, 10 Apr 2020 18:42:24 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail.red.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id F149768B314 for ; Fri, 10 Apr 2020 18:42:16 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail.red.khirnov.net (Postfix) with ESMTP id 62D6A2883C0 for ; Fri, 10 Apr 2020 17:42:16 +0200 (CEST) Received: from mail.red.khirnov.net ([IPv6:::1]) by localhost (mail.red.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id vnzBGhanBQtn for ; Fri, 10 Apr 2020 17:42:15 +0200 (CEST) Received: from quelana.khirnov.net (unknown [IPv6:2a00:c500:61:23b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "quelana.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail.red.khirnov.net (Postfix) with ESMTPS id 4A6CD28790D for ; Fri, 10 Apr 2020 17:42:15 +0200 (CEST) Received: from localhost (quelana.khirnov.net [IPv6:::1]) by quelana.khirnov.net (Postfix) with ESMTP id 837BB21200 for ; Fri, 10 Apr 2020 17:42:14 +0200 (CEST) Received: from quelana.khirnov.net ([IPv6:::1]) by localhost (quelana.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id zyv3v6nfL2Oz for ; Fri, 10 Apr 2020 17:42:10 +0200 (CEST) Received: from libav.daenerys.khirnov.net (libav.daenerys.khirnov.net [IPv6:2a00:c500:561:201::7]) by quelana.khirnov.net (Postfix) with ESMTP id CC9F421829 for ; Fri, 10 Apr 2020 17:42:10 +0200 (CEST) Received: by libav.daenerys.khirnov.net (Postfix, from userid 1000) id 0FD1220E0041; Fri, 10 Apr 2020 17:42:05 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Fri, 10 Apr 2020 17:41:59 +0200 Message-Id: <20200410154201.22678-2-anton@khirnov.net> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200410154201.22678-1-anton@khirnov.net> References: <20200410154201.22678-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/4] avcodec.h: split AVCodecParameters API into its own header 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" --- Not sure what to do with AVFieldOrder. It gets moved to codec_par.h since it is used in AVCodecParameters, but it isn't precisely the right place for it, though it's not horribly wrong either. Least bad solution I've come up with is making a separate header for "misc small types used in lavc" and move there: - AVFieldOrder - AVAudioServiceType - AVPanScan - AVCPBProperties - AVProducerReferenceTime - AVProfile - AVPictureStructure but - it's a "misc" header and misc headers are evil - I can't come up with a good name for it Suggestions? --- doc/APIchanges | 3 + libavcodec/Makefile | 1 + libavcodec/avcodec.h | 189 +--------------------------------- libavcodec/codec_par.h | 229 +++++++++++++++++++++++++++++++++++++++++ libavcodec/version.h | 2 +- 5 files changed, 235 insertions(+), 189 deletions(-) create mode 100644 libavcodec/codec_par.h diff --git a/doc/APIchanges b/doc/APIchanges index 4cc2367e69..dbe7f5cd55 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -15,6 +15,9 @@ libavutil: 2017-10-21 API changes, most recent first: +2020-xx-xx - xxxxxxxxxx - lavc 58.79.100 - avcodec.h codec_par.h + Move AVCodecParameters-related public API to new header codec_par.h. + 2020-xx-xx - xxxxxxxxxx - lavc 58.78.100 - avcodec.h codec_desc.h codec_id.h packet.h Move AVCodecDesc-related public API to new header codec_desc.h. Move AVCodecID enum to new header codec_id.h. diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 1970ff027f..7347f9c25b 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -8,6 +8,7 @@ HEADERS = ac3_parser.h \ avfft.h \ codec_desc.h \ codec_id.h \ + codec_par.h \ d3d11va.h \ dirac.h \ dv_profile.h \ diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 55151a0b71..c91f0749ef 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -42,6 +42,7 @@ #include "libavutil/rational.h" #include "codec_desc.h" +#include "codec_par.h" #include "codec_id.h" #include "packet.h" #include "version.h" @@ -624,15 +625,6 @@ typedef struct AVProducerReferenceTime { struct AVCodecInternal; -enum AVFieldOrder { - AV_FIELD_UNKNOWN, - AV_FIELD_PROGRESSIVE, - AV_FIELD_TT, //< Top coded_first, top displayed first - AV_FIELD_BB, //< Bottom coded first, bottom displayed first - AV_FIELD_TB, //< Top coded first, bottom displayed first - AV_FIELD_BT, //< Bottom coded first, top displayed first -}; - /** * main external API structure. * New fields can be added to the end with minor version bumps. @@ -3040,164 +3032,6 @@ typedef struct AVSubtitle { int64_t pts; ///< Same as packet pts, in AV_TIME_BASE } AVSubtitle; -/** - * This struct describes the properties of an encoded stream. - * - * sizeof(AVCodecParameters) is not a part of the public ABI, this struct must - * be allocated with avcodec_parameters_alloc() and freed with - * avcodec_parameters_free(). - */ -typedef struct AVCodecParameters { - /** - * General type of the encoded data. - */ - enum AVMediaType codec_type; - /** - * Specific type of the encoded data (the codec used). - */ - enum AVCodecID codec_id; - /** - * Additional information about the codec (corresponds to the AVI FOURCC). - */ - uint32_t codec_tag; - - /** - * Extra binary data needed for initializing the decoder, codec-dependent. - * - * Must be allocated with av_malloc() and will be freed by - * avcodec_parameters_free(). The allocated size of extradata must be at - * least extradata_size + AV_INPUT_BUFFER_PADDING_SIZE, with the padding - * bytes zeroed. - */ - uint8_t *extradata; - /** - * Size of the extradata content in bytes. - */ - int extradata_size; - - /** - * - video: the pixel format, the value corresponds to enum AVPixelFormat. - * - audio: the sample format, the value corresponds to enum AVSampleFormat. - */ - int format; - - /** - * The average bitrate of the encoded data (in bits per second). - */ - int64_t bit_rate; - - /** - * The number of bits per sample in the codedwords. - * - * This is basically the bitrate per sample. It is mandatory for a bunch of - * formats to actually decode them. It's the number of bits for one sample in - * the actual coded bitstream. - * - * This could be for example 4 for ADPCM - * For PCM formats this matches bits_per_raw_sample - * Can be 0 - */ - int bits_per_coded_sample; - - /** - * This is the number of valid bits in each output sample. If the - * sample format has more bits, the least significant bits are additional - * padding bits, which are always 0. Use right shifts to reduce the sample - * to its actual size. For example, audio formats with 24 bit samples will - * have bits_per_raw_sample set to 24, and format set to AV_SAMPLE_FMT_S32. - * To get the original sample use "(int32_t)sample >> 8"." - * - * For ADPCM this might be 12 or 16 or similar - * Can be 0 - */ - int bits_per_raw_sample; - - /** - * Codec-specific bitstream restrictions that the stream conforms to. - */ - int profile; - int level; - - /** - * Video only. The dimensions of the video frame in pixels. - */ - int width; - int height; - - /** - * Video only. The aspect ratio (width / height) which a single pixel - * should have when displayed. - * - * When the aspect ratio is unknown / undefined, the numerator should be - * set to 0 (the denominator may have any value). - */ - AVRational sample_aspect_ratio; - - /** - * Video only. The order of the fields in interlaced video. - */ - enum AVFieldOrder field_order; - - /** - * Video only. Additional colorspace characteristics. - */ - enum AVColorRange color_range; - enum AVColorPrimaries color_primaries; - enum AVColorTransferCharacteristic color_trc; - enum AVColorSpace color_space; - enum AVChromaLocation chroma_location; - - /** - * Video only. Number of delayed frames. - */ - int video_delay; - - /** - * Audio only. The channel layout bitmask. May be 0 if the channel layout is - * unknown or unspecified, otherwise the number of bits set must be equal to - * the channels field. - */ - uint64_t channel_layout; - /** - * Audio only. The number of audio channels. - */ - int channels; - /** - * Audio only. The number of audio samples per second. - */ - int sample_rate; - /** - * Audio only. The number of bytes per coded audio frame, required by some - * formats. - * - * Corresponds to nBlockAlign in WAVEFORMATEX. - */ - int block_align; - /** - * Audio only. Audio frame size, if known. Required by some formats to be static. - */ - int frame_size; - - /** - * Audio only. The amount of padding (in samples) inserted by the encoder at - * the beginning of the audio. I.e. this number of leading decoded samples - * must be discarded by the caller to get the original audio without leading - * padding. - */ - int initial_padding; - /** - * Audio only. The amount of padding (in samples) appended by the encoder to - * the end of the audio. I.e. this number of decoded samples must be - * discarded by the caller from the end of the stream to get the original - * audio without any trailing padding. - */ - int trailing_padding; - /** - * Audio only. Number of samples to skip after a discontinuity. - */ - int seek_preroll; -} AVCodecParameters; - /** * Iterate over all registered codecs. * @@ -3336,27 +3170,6 @@ attribute_deprecated int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src); #endif -/** - * Allocate a new AVCodecParameters and set its fields to default values - * (unknown/invalid/0). The returned struct must be freed with - * avcodec_parameters_free(). - */ -AVCodecParameters *avcodec_parameters_alloc(void); - -/** - * Free an AVCodecParameters instance and everything associated with it and - * write NULL to the supplied pointer. - */ -void avcodec_parameters_free(AVCodecParameters **par); - -/** - * Copy the contents of src to dst. Any allocated fields in dst are freed and - * replaced with newly allocated duplicates of the corresponding fields in src. - * - * @return >= 0 on success, a negative AVERROR code on failure. - */ -int avcodec_parameters_copy(AVCodecParameters *dst, const AVCodecParameters *src); - /** * Fill the parameters struct based on the values from the supplied codec * context. Any allocated fields in par are freed and replaced with duplicates diff --git a/libavcodec/codec_par.h b/libavcodec/codec_par.h new file mode 100644 index 0000000000..948758e237 --- /dev/null +++ b/libavcodec/codec_par.h @@ -0,0 +1,229 @@ +/* + * Codec parameters public API + * + * 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 AVCODEC_CODEC_PAR_H +#define AVCODEC_CODEC_PAR_H + +#include + +#include "libavutil/avutil.h" +#include "libavutil/rational.h" +#include "libavutil/pixfmt.h" + +#include "codec_id.h" + +/** + * @addtogroup lavc_core + */ + +enum AVFieldOrder { + AV_FIELD_UNKNOWN, + AV_FIELD_PROGRESSIVE, + AV_FIELD_TT, //< Top coded_first, top displayed first + AV_FIELD_BB, //< Bottom coded first, bottom displayed first + AV_FIELD_TB, //< Top coded first, bottom displayed first + AV_FIELD_BT, //< Bottom coded first, top displayed first +}; + +/** + * This struct describes the properties of an encoded stream. + * + * sizeof(AVCodecParameters) is not a part of the public ABI, this struct must + * be allocated with avcodec_parameters_alloc() and freed with + * avcodec_parameters_free(). + */ +typedef struct AVCodecParameters { + /** + * General type of the encoded data. + */ + enum AVMediaType codec_type; + /** + * Specific type of the encoded data (the codec used). + */ + enum AVCodecID codec_id; + /** + * Additional information about the codec (corresponds to the AVI FOURCC). + */ + uint32_t codec_tag; + + /** + * Extra binary data needed for initializing the decoder, codec-dependent. + * + * Must be allocated with av_malloc() and will be freed by + * avcodec_parameters_free(). The allocated size of extradata must be at + * least extradata_size + AV_INPUT_BUFFER_PADDING_SIZE, with the padding + * bytes zeroed. + */ + uint8_t *extradata; + /** + * Size of the extradata content in bytes. + */ + int extradata_size; + + /** + * - video: the pixel format, the value corresponds to enum AVPixelFormat. + * - audio: the sample format, the value corresponds to enum AVSampleFormat. + */ + int format; + + /** + * The average bitrate of the encoded data (in bits per second). + */ + int64_t bit_rate; + + /** + * The number of bits per sample in the codedwords. + * + * This is basically the bitrate per sample. It is mandatory for a bunch of + * formats to actually decode them. It's the number of bits for one sample in + * the actual coded bitstream. + * + * This could be for example 4 for ADPCM + * For PCM formats this matches bits_per_raw_sample + * Can be 0 + */ + int bits_per_coded_sample; + + /** + * This is the number of valid bits in each output sample. If the + * sample format has more bits, the least significant bits are additional + * padding bits, which are always 0. Use right shifts to reduce the sample + * to its actual size. For example, audio formats with 24 bit samples will + * have bits_per_raw_sample set to 24, and format set to AV_SAMPLE_FMT_S32. + * To get the original sample use "(int32_t)sample >> 8"." + * + * For ADPCM this might be 12 or 16 or similar + * Can be 0 + */ + int bits_per_raw_sample; + + /** + * Codec-specific bitstream restrictions that the stream conforms to. + */ + int profile; + int level; + + /** + * Video only. The dimensions of the video frame in pixels. + */ + int width; + int height; + + /** + * Video only. The aspect ratio (width / height) which a single pixel + * should have when displayed. + * + * When the aspect ratio is unknown / undefined, the numerator should be + * set to 0 (the denominator may have any value). + */ + AVRational sample_aspect_ratio; + + /** + * Video only. The order of the fields in interlaced video. + */ + enum AVFieldOrder field_order; + + /** + * Video only. Additional colorspace characteristics. + */ + enum AVColorRange color_range; + enum AVColorPrimaries color_primaries; + enum AVColorTransferCharacteristic color_trc; + enum AVColorSpace color_space; + enum AVChromaLocation chroma_location; + + /** + * Video only. Number of delayed frames. + */ + int video_delay; + + /** + * Audio only. The channel layout bitmask. May be 0 if the channel layout is + * unknown or unspecified, otherwise the number of bits set must be equal to + * the channels field. + */ + uint64_t channel_layout; + /** + * Audio only. The number of audio channels. + */ + int channels; + /** + * Audio only. The number of audio samples per second. + */ + int sample_rate; + /** + * Audio only. The number of bytes per coded audio frame, required by some + * formats. + * + * Corresponds to nBlockAlign in WAVEFORMATEX. + */ + int block_align; + /** + * Audio only. Audio frame size, if known. Required by some formats to be static. + */ + int frame_size; + + /** + * Audio only. The amount of padding (in samples) inserted by the encoder at + * the beginning of the audio. I.e. this number of leading decoded samples + * must be discarded by the caller to get the original audio without leading + * padding. + */ + int initial_padding; + /** + * Audio only. The amount of padding (in samples) appended by the encoder to + * the end of the audio. I.e. this number of decoded samples must be + * discarded by the caller from the end of the stream to get the original + * audio without any trailing padding. + */ + int trailing_padding; + /** + * Audio only. Number of samples to skip after a discontinuity. + */ + int seek_preroll; +} AVCodecParameters; + +/** + * Allocate a new AVCodecParameters and set its fields to default values + * (unknown/invalid/0). The returned struct must be freed with + * avcodec_parameters_free(). + */ +AVCodecParameters *avcodec_parameters_alloc(void); + +/** + * Free an AVCodecParameters instance and everything associated with it and + * write NULL to the supplied pointer. + */ +void avcodec_parameters_free(AVCodecParameters **par); + +/** + * Copy the contents of src to dst. Any allocated fields in dst are freed and + * replaced with newly allocated duplicates of the corresponding fields in src. + * + * @return >= 0 on success, a negative AVERROR code on failure. + */ +int avcodec_parameters_copy(AVCodecParameters *dst, const AVCodecParameters *src); + + +/** + * @} + */ + +#endif // AVCODEC_CODEC_PAR_H diff --git a/libavcodec/version.h b/libavcodec/version.h index e62d1a7925..a4eb83124c 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -28,7 +28,7 @@ #include "libavutil/version.h" #define LIBAVCODEC_VERSION_MAJOR 58 -#define LIBAVCODEC_VERSION_MINOR 78 +#define LIBAVCODEC_VERSION_MINOR 79 #define LIBAVCODEC_VERSION_MICRO 100 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ From patchwork Fri Apr 10 15:42:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 18813 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 5E5BB44A415 for ; Fri, 10 Apr 2020 18:42:25 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4294E68B549; Fri, 10 Apr 2020 18:42:25 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail.red.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id F387168B319 for ; Fri, 10 Apr 2020 18:42:16 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail.red.khirnov.net (Postfix) with ESMTP id 57FE02883BE for ; Fri, 10 Apr 2020 17:42:16 +0200 (CEST) Received: from mail.red.khirnov.net ([IPv6:::1]) by localhost (mail.red.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id nLeFGQLGK-in for ; Fri, 10 Apr 2020 17:42:15 +0200 (CEST) Received: from quelana.khirnov.net (unknown [IPv6:2002:b061:f0a:201:5e:e696:5100:0]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "quelana.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail.red.khirnov.net (Postfix) with ESMTPS id 6DA212883B9 for ; Fri, 10 Apr 2020 17:42:15 +0200 (CEST) Received: from localhost (quelana.khirnov.net [IPv6:::1]) by quelana.khirnov.net (Postfix) with ESMTP id 672892182C for ; Fri, 10 Apr 2020 17:42:14 +0200 (CEST) Received: from quelana.khirnov.net ([IPv6:::1]) by localhost (quelana.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id 4FsXK11tjI_Y for ; Fri, 10 Apr 2020 17:42:10 +0200 (CEST) Received: from libav.daenerys.khirnov.net (libav.daenerys.khirnov.net [IPv6:2a00:c500:561:201::7]) by quelana.khirnov.net (Postfix) with ESMTP id CA62A21200 for ; Fri, 10 Apr 2020 17:42:10 +0200 (CEST) Received: by libav.daenerys.khirnov.net (Postfix, from userid 1000) id 2E9AD20E004C; Fri, 10 Apr 2020 17:42:05 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Fri, 10 Apr 2020 17:42:00 +0200 Message-Id: <20200410154201.22678-3-anton@khirnov.net> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200410154201.22678-1-anton@khirnov.net> References: <20200410154201.22678-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 3/4] lavc: rename bsf.h to bsf_internal.h 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" This will allow adding a public header named bsf.h --- libavcodec/aac_adtstoasc_bsf.c | 2 +- libavcodec/av1_frame_merge_bsf.c | 2 +- libavcodec/av1_frame_split_bsf.c | 2 +- libavcodec/av1_metadata_bsf.c | 2 +- libavcodec/bitstream_filters.c | 2 +- libavcodec/bsf.c | 2 +- libavcodec/{bsf.h => bsf_internal.h} | 6 +++--- libavcodec/chomp_bsf.c | 2 +- libavcodec/dca_core_bsf.c | 2 +- libavcodec/dump_extradata_bsf.c | 2 +- libavcodec/eac3_core_bsf.c | 2 +- libavcodec/extract_extradata_bsf.c | 2 +- libavcodec/filter_units_bsf.c | 2 +- libavcodec/h264_metadata_bsf.c | 2 +- libavcodec/h264_mp4toannexb_bsf.c | 2 +- libavcodec/h264_redundant_pps_bsf.c | 2 +- libavcodec/h265_metadata_bsf.c | 2 +- libavcodec/hapqa_extract_bsf.c | 2 +- libavcodec/hevc_mp4toannexb_bsf.c | 2 +- libavcodec/imx_dump_header_bsf.c | 2 +- libavcodec/mjpeg2jpeg_bsf.c | 2 +- libavcodec/mjpega_dump_header_bsf.c | 2 +- libavcodec/movsub_bsf.c | 2 +- libavcodec/mp3_header_decompress_bsf.c | 2 +- libavcodec/mpeg2_metadata_bsf.c | 2 +- libavcodec/mpeg4_unpack_bframes_bsf.c | 2 +- libavcodec/noise_bsf.c | 2 +- libavcodec/null_bsf.c | 2 +- libavcodec/prores_metadata_bsf.c | 2 +- libavcodec/remove_extradata_bsf.c | 2 +- libavcodec/trace_headers_bsf.c | 2 +- libavcodec/truehd_core_bsf.c | 2 +- libavcodec/vp9_metadata_bsf.c | 2 +- libavcodec/vp9_raw_reorder_bsf.c | 2 +- libavcodec/vp9_superframe_bsf.c | 2 +- libavcodec/vp9_superframe_split_bsf.c | 2 +- 36 files changed, 38 insertions(+), 38 deletions(-) rename libavcodec/{bsf.h => bsf_internal.h} (93%) diff --git a/libavcodec/aac_adtstoasc_bsf.c b/libavcodec/aac_adtstoasc_bsf.c index e378296950..1d0117fecb 100644 --- a/libavcodec/aac_adtstoasc_bsf.c +++ b/libavcodec/aac_adtstoasc_bsf.c @@ -22,7 +22,7 @@ #include "adts_header.h" #include "adts_parser.h" #include "avcodec.h" -#include "bsf.h" +#include "bsf_internal.h" #include "put_bits.h" #include "get_bits.h" #include "mpeg4audio.h" diff --git a/libavcodec/av1_frame_merge_bsf.c b/libavcodec/av1_frame_merge_bsf.c index 49397111fc..c67b86c8d4 100644 --- a/libavcodec/av1_frame_merge_bsf.c +++ b/libavcodec/av1_frame_merge_bsf.c @@ -19,7 +19,7 @@ */ #include "avcodec.h" -#include "bsf.h" +#include "bsf_internal.h" #include "cbs.h" #include "cbs_av1.h" diff --git a/libavcodec/av1_frame_split_bsf.c b/libavcodec/av1_frame_split_bsf.c index a386c6edc1..fc9eac0324 100644 --- a/libavcodec/av1_frame_split_bsf.c +++ b/libavcodec/av1_frame_split_bsf.c @@ -33,7 +33,7 @@ #include "libavutil/avassert.h" #include "avcodec.h" -#include "bsf.h" +#include "bsf_internal.h" #include "cbs.h" #include "cbs_av1.h" diff --git a/libavcodec/av1_metadata_bsf.c b/libavcodec/av1_metadata_bsf.c index dd0c9b6148..d704bc1409 100644 --- a/libavcodec/av1_metadata_bsf.c +++ b/libavcodec/av1_metadata_bsf.c @@ -19,7 +19,7 @@ #include "libavutil/common.h" #include "libavutil/opt.h" -#include "bsf.h" +#include "bsf_internal.h" #include "cbs.h" #include "cbs_av1.h" diff --git a/libavcodec/bitstream_filters.c b/libavcodec/bitstream_filters.c index 6b5ffe4d70..8a1005ac56 100644 --- a/libavcodec/bitstream_filters.c +++ b/libavcodec/bitstream_filters.c @@ -22,7 +22,7 @@ #include "libavutil/log.h" #include "avcodec.h" -#include "bsf.h" +#include "bsf_internal.h" extern const AVBitStreamFilter ff_aac_adtstoasc_bsf; extern const AVBitStreamFilter ff_av1_frame_merge_bsf; diff --git a/libavcodec/bsf.c b/libavcodec/bsf.c index 7b96183e64..a8d5c3082a 100644 --- a/libavcodec/bsf.c +++ b/libavcodec/bsf.c @@ -25,7 +25,7 @@ #include "libavutil/bprint.h" #include "avcodec.h" -#include "bsf.h" +#include "bsf_internal.h" struct AVBSFInternal { AVPacket *buffer_pkt; diff --git a/libavcodec/bsf.h b/libavcodec/bsf_internal.h similarity index 93% rename from libavcodec/bsf.h rename to libavcodec/bsf_internal.h index af035eee44..de4684c4c2 100644 --- a/libavcodec/bsf.h +++ b/libavcodec/bsf_internal.h @@ -16,8 +16,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef AVCODEC_BSF_H -#define AVCODEC_BSF_H +#ifndef AVCODEC_BSF_INTERNAL_H +#define AVCODEC_BSF_INTERNAL_H #include "avcodec.h" @@ -41,4 +41,4 @@ int ff_bsf_get_packet_ref(AVBSFContext *ctx, AVPacket *pkt); const AVClass *ff_bsf_child_class_next(const AVClass *prev); -#endif /* AVCODEC_BSF_H */ +#endif /* AVCODEC_BSF_INTERNAL_H */ diff --git a/libavcodec/chomp_bsf.c b/libavcodec/chomp_bsf.c index 3ba45f3e06..d7461afebd 100644 --- a/libavcodec/chomp_bsf.c +++ b/libavcodec/chomp_bsf.c @@ -20,7 +20,7 @@ */ #include "avcodec.h" -#include "bsf.h" +#include "bsf_internal.h" #include "internal.h" static int chomp_filter(AVBSFContext *ctx, AVPacket *pkt) diff --git a/libavcodec/dca_core_bsf.c b/libavcodec/dca_core_bsf.c index 8565796951..b78995dbb7 100644 --- a/libavcodec/dca_core_bsf.c +++ b/libavcodec/dca_core_bsf.c @@ -19,7 +19,7 @@ */ #include "avcodec.h" -#include "bsf.h" +#include "bsf_internal.h" #include "bytestream.h" #include "dca_syncwords.h" #include "libavutil/mem.h" diff --git a/libavcodec/dump_extradata_bsf.c b/libavcodec/dump_extradata_bsf.c index 0b6d404792..9727b9983a 100644 --- a/libavcodec/dump_extradata_bsf.c +++ b/libavcodec/dump_extradata_bsf.c @@ -21,7 +21,7 @@ #include #include "avcodec.h" -#include "bsf.h" +#include "bsf_internal.h" #include "libavutil/log.h" #include "libavutil/mem.h" diff --git a/libavcodec/eac3_core_bsf.c b/libavcodec/eac3_core_bsf.c index 3e4dc2e2a2..c584d69227 100644 --- a/libavcodec/eac3_core_bsf.c +++ b/libavcodec/eac3_core_bsf.c @@ -19,7 +19,7 @@ */ #include "avcodec.h" -#include "bsf.h" +#include "bsf_internal.h" #include "get_bits.h" #include "ac3_parser_internal.h" diff --git a/libavcodec/extract_extradata_bsf.c b/libavcodec/extract_extradata_bsf.c index 46b76dfbef..d7ffa1bff2 100644 --- a/libavcodec/extract_extradata_bsf.c +++ b/libavcodec/extract_extradata_bsf.c @@ -26,7 +26,7 @@ #include "avcodec.h" #include "av1.h" #include "av1_parse.h" -#include "bsf.h" +#include "bsf_internal.h" #include "bytestream.h" #include "h2645_parse.h" #include "h264.h" diff --git a/libavcodec/filter_units_bsf.c b/libavcodec/filter_units_bsf.c index 380f23e5a7..7c3819c7b3 100644 --- a/libavcodec/filter_units_bsf.c +++ b/libavcodec/filter_units_bsf.c @@ -21,7 +21,7 @@ #include "libavutil/common.h" #include "libavutil/opt.h" -#include "bsf.h" +#include "bsf_internal.h" #include "cbs.h" diff --git a/libavcodec/h264_metadata_bsf.c b/libavcodec/h264_metadata_bsf.c index d96a50dbf7..4cce5b1f1a 100644 --- a/libavcodec/h264_metadata_bsf.c +++ b/libavcodec/h264_metadata_bsf.c @@ -21,7 +21,7 @@ #include "libavutil/common.h" #include "libavutil/opt.h" -#include "bsf.h" +#include "bsf_internal.h" #include "cbs.h" #include "cbs_h264.h" #include "h264.h" diff --git a/libavcodec/h264_mp4toannexb_bsf.c b/libavcodec/h264_mp4toannexb_bsf.c index 0150f97a1a..52fc9b90cf 100644 --- a/libavcodec/h264_mp4toannexb_bsf.c +++ b/libavcodec/h264_mp4toannexb_bsf.c @@ -26,7 +26,7 @@ #include "libavutil/mem.h" #include "avcodec.h" -#include "bsf.h" +#include "bsf_internal.h" #include "bytestream.h" #include "h264.h" diff --git a/libavcodec/h264_redundant_pps_bsf.c b/libavcodec/h264_redundant_pps_bsf.c index 8405738c4b..34885d320a 100644 --- a/libavcodec/h264_redundant_pps_bsf.c +++ b/libavcodec/h264_redundant_pps_bsf.c @@ -21,7 +21,7 @@ #include "libavutil/common.h" #include "libavutil/mem.h" -#include "bsf.h" +#include "bsf_internal.h" #include "cbs.h" #include "cbs_h264.h" #include "h264.h" diff --git a/libavcodec/h265_metadata_bsf.c b/libavcodec/h265_metadata_bsf.c index 730f7ac28f..6269ca00ab 100644 --- a/libavcodec/h265_metadata_bsf.c +++ b/libavcodec/h265_metadata_bsf.c @@ -19,7 +19,7 @@ #include "libavutil/common.h" #include "libavutil/opt.h" -#include "bsf.h" +#include "bsf_internal.h" #include "cbs.h" #include "cbs_h265.h" #include "hevc.h" diff --git a/libavcodec/hapqa_extract_bsf.c b/libavcodec/hapqa_extract_bsf.c index 5c22184813..9fdcbe2886 100644 --- a/libavcodec/hapqa_extract_bsf.c +++ b/libavcodec/hapqa_extract_bsf.c @@ -26,7 +26,7 @@ */ #include "avcodec.h" -#include "bsf.h" +#include "bsf_internal.h" #include "bytestream.h" #include "hap.h" diff --git a/libavcodec/hevc_mp4toannexb_bsf.c b/libavcodec/hevc_mp4toannexb_bsf.c index baa93628ed..f3efc33ab8 100644 --- a/libavcodec/hevc_mp4toannexb_bsf.c +++ b/libavcodec/hevc_mp4toannexb_bsf.c @@ -25,7 +25,7 @@ #include "libavutil/mem.h" #include "avcodec.h" -#include "bsf.h" +#include "bsf_internal.h" #include "bytestream.h" #include "hevc.h" diff --git a/libavcodec/imx_dump_header_bsf.c b/libavcodec/imx_dump_header_bsf.c index 9a9de05f05..6f3d7e52b0 100644 --- a/libavcodec/imx_dump_header_bsf.c +++ b/libavcodec/imx_dump_header_bsf.c @@ -26,7 +26,7 @@ */ #include "avcodec.h" -#include "bsf.h" +#include "bsf_internal.h" #include "bytestream.h" diff --git a/libavcodec/mjpeg2jpeg_bsf.c b/libavcodec/mjpeg2jpeg_bsf.c index 6f02bc033c..25f5b31a73 100644 --- a/libavcodec/mjpeg2jpeg_bsf.c +++ b/libavcodec/mjpeg2jpeg_bsf.c @@ -31,7 +31,7 @@ #include "libavutil/intreadwrite.h" #include "avcodec.h" -#include "bsf.h" +#include "bsf_internal.h" #include "jpegtables.h" #include "mjpeg.h" diff --git a/libavcodec/mjpega_dump_header_bsf.c b/libavcodec/mjpega_dump_header_bsf.c index ca5fb3a377..e8a440a69f 100644 --- a/libavcodec/mjpega_dump_header_bsf.c +++ b/libavcodec/mjpega_dump_header_bsf.c @@ -26,7 +26,7 @@ */ #include "avcodec.h" -#include "bsf.h" +#include "bsf_internal.h" #include "bytestream.h" #include "mjpeg.h" diff --git a/libavcodec/movsub_bsf.c b/libavcodec/movsub_bsf.c index cd48aa7bb8..bfc06a70f8 100644 --- a/libavcodec/movsub_bsf.c +++ b/libavcodec/movsub_bsf.c @@ -21,7 +21,7 @@ #include "libavutil/common.h" #include "libavutil/intreadwrite.h" #include "avcodec.h" -#include "bsf.h" +#include "bsf_internal.h" static int text2movsub(AVBSFContext *ctx, AVPacket *out) { diff --git a/libavcodec/mp3_header_decompress_bsf.c b/libavcodec/mp3_header_decompress_bsf.c index ab3d420300..158d96853e 100644 --- a/libavcodec/mp3_header_decompress_bsf.c +++ b/libavcodec/mp3_header_decompress_bsf.c @@ -21,7 +21,7 @@ #include "libavutil/common.h" #include "libavutil/intreadwrite.h" #include "avcodec.h" -#include "bsf.h" +#include "bsf_internal.h" #include "mpegaudiodecheader.h" #include "mpegaudiodata.h" diff --git a/libavcodec/mpeg2_metadata_bsf.c b/libavcodec/mpeg2_metadata_bsf.c index 3f371a028d..8c6dad9625 100644 --- a/libavcodec/mpeg2_metadata_bsf.c +++ b/libavcodec/mpeg2_metadata_bsf.c @@ -20,7 +20,7 @@ #include "libavutil/common.h" #include "libavutil/opt.h" -#include "bsf.h" +#include "bsf_internal.h" #include "cbs.h" #include "cbs_mpeg2.h" #include "mpeg12.h" diff --git a/libavcodec/mpeg4_unpack_bframes_bsf.c b/libavcodec/mpeg4_unpack_bframes_bsf.c index 1500d2135d..6934cce73a 100644 --- a/libavcodec/mpeg4_unpack_bframes_bsf.c +++ b/libavcodec/mpeg4_unpack_bframes_bsf.c @@ -20,7 +20,7 @@ */ #include "avcodec.h" -#include "bsf.h" +#include "bsf_internal.h" #include "internal.h" #include "mpeg4video.h" diff --git a/libavcodec/noise_bsf.c b/libavcodec/noise_bsf.c index 721fd217ec..69bd87f3f3 100644 --- a/libavcodec/noise_bsf.c +++ b/libavcodec/noise_bsf.c @@ -22,7 +22,7 @@ #include #include "avcodec.h" -#include "bsf.h" +#include "bsf_internal.h" #include "libavutil/log.h" #include "libavutil/mem.h" diff --git a/libavcodec/null_bsf.c b/libavcodec/null_bsf.c index 24d26dfb1a..052355b6e6 100644 --- a/libavcodec/null_bsf.c +++ b/libavcodec/null_bsf.c @@ -22,7 +22,7 @@ */ #include "avcodec.h" -#include "bsf.h" +#include "bsf_internal.h" static int null_filter(AVBSFContext *ctx, AVPacket *pkt) { diff --git a/libavcodec/prores_metadata_bsf.c b/libavcodec/prores_metadata_bsf.c index 0510d3520a..239f5c3cfa 100644 --- a/libavcodec/prores_metadata_bsf.c +++ b/libavcodec/prores_metadata_bsf.c @@ -28,7 +28,7 @@ #include "libavutil/common.h" #include "libavutil/intreadwrite.h" #include "libavutil/opt.h" -#include "bsf.h" +#include "bsf_internal.h" typedef struct ProresMetadataContext { const AVClass *class; diff --git a/libavcodec/remove_extradata_bsf.c b/libavcodec/remove_extradata_bsf.c index b762079e05..7ea12d260a 100644 --- a/libavcodec/remove_extradata_bsf.c +++ b/libavcodec/remove_extradata_bsf.c @@ -22,7 +22,7 @@ #include "libavutil/opt.h" #include "avcodec.h" -#include "bsf.h" +#include "bsf_internal.h" enum RemoveFreq { REMOVE_FREQ_KEYFRAME, diff --git a/libavcodec/trace_headers_bsf.c b/libavcodec/trace_headers_bsf.c index 3ec78fe822..ffd4e5465b 100644 --- a/libavcodec/trace_headers_bsf.c +++ b/libavcodec/trace_headers_bsf.c @@ -22,7 +22,7 @@ #include "libavutil/common.h" #include "libavutil/log.h" -#include "bsf.h" +#include "bsf_internal.h" #include "cbs.h" diff --git a/libavcodec/truehd_core_bsf.c b/libavcodec/truehd_core_bsf.c index dbd05b34ca..59e5b0035c 100644 --- a/libavcodec/truehd_core_bsf.c +++ b/libavcodec/truehd_core_bsf.c @@ -19,7 +19,7 @@ */ #include "avcodec.h" -#include "bsf.h" +#include "bsf_internal.h" #include "get_bits.h" #include "mlp_parse.h" #include "mlp.h" diff --git a/libavcodec/vp9_metadata_bsf.c b/libavcodec/vp9_metadata_bsf.c index 52e962b1c0..974a5fc6dd 100644 --- a/libavcodec/vp9_metadata_bsf.c +++ b/libavcodec/vp9_metadata_bsf.c @@ -20,7 +20,7 @@ #include "libavutil/common.h" #include "libavutil/opt.h" -#include "bsf.h" +#include "bsf_internal.h" #include "cbs.h" #include "cbs_vp9.h" diff --git a/libavcodec/vp9_raw_reorder_bsf.c b/libavcodec/vp9_raw_reorder_bsf.c index e55a358457..531cd99003 100644 --- a/libavcodec/vp9_raw_reorder_bsf.c +++ b/libavcodec/vp9_raw_reorder_bsf.c @@ -22,7 +22,7 @@ #include "libavutil/mem.h" #include "libavutil/opt.h" -#include "bsf.h" +#include "bsf_internal.h" #include "get_bits.h" #include "put_bits.h" diff --git a/libavcodec/vp9_superframe_bsf.c b/libavcodec/vp9_superframe_bsf.c index b79911bb2c..2584604817 100644 --- a/libavcodec/vp9_superframe_bsf.c +++ b/libavcodec/vp9_superframe_bsf.c @@ -21,7 +21,7 @@ #include "libavutil/avassert.h" #include "avcodec.h" -#include "bsf.h" +#include "bsf_internal.h" #include "get_bits.h" #define MAX_CACHE 8 diff --git a/libavcodec/vp9_superframe_split_bsf.c b/libavcodec/vp9_superframe_split_bsf.c index 13e85c3ca4..00f40aa96e 100644 --- a/libavcodec/vp9_superframe_split_bsf.c +++ b/libavcodec/vp9_superframe_split_bsf.c @@ -25,7 +25,7 @@ #include #include "avcodec.h" -#include "bsf.h" +#include "bsf_internal.h" #include "bytestream.h" #include "get_bits.h" From patchwork Fri Apr 10 15:42:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 18814 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 3C70344A415 for ; Fri, 10 Apr 2020 18:42:28 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 254C368B551; Fri, 10 Apr 2020 18:42:28 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail.red.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 9598068B497 for ; Fri, 10 Apr 2020 18:42:22 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail.red.khirnov.net (Postfix) with ESMTP id 4D9CD28790D for ; Fri, 10 Apr 2020 17:42:22 +0200 (CEST) Received: from mail.red.khirnov.net ([IPv6:::1]) by localhost (mail.red.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id VZRX1jlBlI44 for ; Fri, 10 Apr 2020 17:42:21 +0200 (CEST) Received: from quelana.khirnov.net (unknown [IPv6:2a00:c500:61:23b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) client-signature RSA-PSS (2048 bits)) (Client CN "quelana.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail.red.khirnov.net (Postfix) with ESMTPS id 286E12883B9 for ; Fri, 10 Apr 2020 17:42:21 +0200 (CEST) Received: from localhost (quelana.khirnov.net [IPv6:::1]) by quelana.khirnov.net (Postfix) with ESMTP id B13BB21200 for ; Fri, 10 Apr 2020 17:42:20 +0200 (CEST) Received: from quelana.khirnov.net ([IPv6:::1]) by localhost (quelana.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id o8dWx1QVQe0v for ; Fri, 10 Apr 2020 17:42:14 +0200 (CEST) Received: from libav.daenerys.khirnov.net (libav.daenerys.khirnov.net [IPv6:2a00:c500:561:201::7]) by quelana.khirnov.net (Postfix) with ESMTP id D03932182B for ; Fri, 10 Apr 2020 17:42:10 +0200 (CEST) Received: by libav.daenerys.khirnov.net (Postfix, from userid 1000) id 4E4AF20E0087; Fri, 10 Apr 2020 17:42:06 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Fri, 10 Apr 2020 17:42:01 +0200 Message-Id: <20200410154201.22678-4-anton@khirnov.net> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200410154201.22678-1-anton@khirnov.net> References: <20200410154201.22678-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 4/4] avcodec.h: split bitstream filters API into its own header 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" --- doc/APIchanges | 3 +- libavcodec/Makefile | 1 + libavcodec/aac_adtstoasc_bsf.c | 2 +- libavcodec/av1_frame_merge_bsf.c | 2 +- libavcodec/av1_frame_split_bsf.c | 2 +- libavcodec/av1_metadata_bsf.c | 1 + libavcodec/avcodec.h | 285 +--------------------- libavcodec/bsf.c | 4 +- libavcodec/bsf.h | 324 +++++++++++++++++++++++++ libavcodec/bsf_internal.h | 5 +- libavcodec/chomp_bsf.c | 2 +- libavcodec/dca_core_bsf.c | 2 +- libavcodec/dump_extradata_bsf.c | 2 +- libavcodec/eac3_core_bsf.c | 2 +- libavcodec/extract_extradata_bsf.c | 2 +- libavcodec/filter_units_bsf.c | 1 + libavcodec/h264_metadata_bsf.c | 1 + libavcodec/h264_mp4toannexb_bsf.c | 1 + libavcodec/h264_redundant_pps_bsf.c | 1 + libavcodec/h265_metadata_bsf.c | 1 + libavcodec/hapqa_extract_bsf.c | 2 +- libavcodec/hevc_mp4toannexb_bsf.c | 1 + libavcodec/imx_dump_header_bsf.c | 2 +- libavcodec/mjpeg2jpeg_bsf.c | 2 +- libavcodec/mjpega_dump_header_bsf.c | 2 +- libavcodec/movsub_bsf.c | 2 +- libavcodec/mp3_header_decompress_bsf.c | 2 +- libavcodec/mpeg2_metadata_bsf.c | 1 + libavcodec/mpeg4_unpack_bframes_bsf.c | 2 +- libavcodec/noise_bsf.c | 2 +- libavcodec/null_bsf.c | 2 +- libavcodec/prores_metadata_bsf.c | 2 + libavcodec/remove_extradata_bsf.c | 1 + libavcodec/trace_headers_bsf.c | 1 + libavcodec/truehd_core_bsf.c | 2 +- libavcodec/vp9_metadata_bsf.c | 1 + libavcodec/vp9_raw_reorder_bsf.c | 1 + libavcodec/vp9_superframe_bsf.c | 3 +- libavcodec/vp9_superframe_split_bsf.c | 2 +- 39 files changed, 370 insertions(+), 307 deletions(-) create mode 100644 libavcodec/bsf.h diff --git a/doc/APIchanges b/doc/APIchanges index dbe7f5cd55..b9e5895e95 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -15,7 +15,8 @@ libavutil: 2017-10-21 API changes, most recent first: -2020-xx-xx - xxxxxxxxxx - lavc 58.79.100 - avcodec.h codec_par.h +2020-xx-xx - xxxxxxxxxx - lavc 58.79.100 - avcodec.h bsf.h codec_par.h + Move AVBitstreamFilter-related public API to new header bsf.h. Move AVCodecParameters-related public API to new header codec_par.h. 2020-xx-xx - xxxxxxxxxx - lavc 58.78.100 - avcodec.h codec_desc.h codec_id.h packet.h diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 7347f9c25b..77f77ec48b 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -6,6 +6,7 @@ HEADERS = ac3_parser.h \ avcodec.h \ avdct.h \ avfft.h \ + bsf.h \ codec_desc.h \ codec_id.h \ codec_par.h \ diff --git a/libavcodec/aac_adtstoasc_bsf.c b/libavcodec/aac_adtstoasc_bsf.c index 1d0117fecb..69453c706f 100644 --- a/libavcodec/aac_adtstoasc_bsf.c +++ b/libavcodec/aac_adtstoasc_bsf.c @@ -21,7 +21,7 @@ #include "adts_header.h" #include "adts_parser.h" -#include "avcodec.h" +#include "bsf.h" #include "bsf_internal.h" #include "put_bits.h" #include "get_bits.h" diff --git a/libavcodec/av1_frame_merge_bsf.c b/libavcodec/av1_frame_merge_bsf.c index c67b86c8d4..b5aa57e0ff 100644 --- a/libavcodec/av1_frame_merge_bsf.c +++ b/libavcodec/av1_frame_merge_bsf.c @@ -18,7 +18,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "avcodec.h" +#include "bsf.h" #include "bsf_internal.h" #include "cbs.h" #include "cbs_av1.h" diff --git a/libavcodec/av1_frame_split_bsf.c b/libavcodec/av1_frame_split_bsf.c index fc9eac0324..87dfc83103 100644 --- a/libavcodec/av1_frame_split_bsf.c +++ b/libavcodec/av1_frame_split_bsf.c @@ -32,7 +32,7 @@ #include "libavutil/avassert.h" -#include "avcodec.h" +#include "bsf.h" #include "bsf_internal.h" #include "cbs.h" #include "cbs_av1.h" diff --git a/libavcodec/av1_metadata_bsf.c b/libavcodec/av1_metadata_bsf.c index d704bc1409..d078ba3e8f 100644 --- a/libavcodec/av1_metadata_bsf.c +++ b/libavcodec/av1_metadata_bsf.c @@ -19,6 +19,7 @@ #include "libavutil/common.h" #include "libavutil/opt.h" +#include "bsf.h" #include "bsf_internal.h" #include "cbs.h" #include "cbs_av1.h" diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index c91f0749ef..0339edaeb3 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -41,6 +41,7 @@ #include "libavutil/pixfmt.h" #include "libavutil/rational.h" +#include "bsf.h" #include "codec_desc.h" #include "codec_par.h" #include "codec_id.h" @@ -4350,106 +4351,7 @@ typedef struct AVBitStreamFilterContext { */ char *args; } AVBitStreamFilterContext; -#endif - -typedef struct AVBSFInternal AVBSFInternal; - -/** - * The bitstream filter state. - * - * This struct must be allocated with av_bsf_alloc() and freed with - * av_bsf_free(). - * - * The fields in the struct will only be changed (by the caller or by the - * filter) as described in their documentation, and are to be considered - * immutable otherwise. - */ -typedef struct AVBSFContext { - /** - * A class for logging and AVOptions - */ - const AVClass *av_class; - - /** - * The bitstream filter this context is an instance of. - */ - const struct AVBitStreamFilter *filter; - - /** - * Opaque libavcodec internal data. Must not be touched by the caller in any - * way. - */ - AVBSFInternal *internal; - - /** - * Opaque filter-specific private data. If filter->priv_class is non-NULL, - * this is an AVOptions-enabled struct. - */ - void *priv_data; - - /** - * Parameters of the input stream. This field is allocated in - * av_bsf_alloc(), it needs to be filled by the caller before - * av_bsf_init(). - */ - AVCodecParameters *par_in; - - /** - * Parameters of the output stream. This field is allocated in - * av_bsf_alloc(), it is set by the filter in av_bsf_init(). - */ - AVCodecParameters *par_out; - - /** - * The timebase used for the timestamps of the input packets. Set by the - * caller before av_bsf_init(). - */ - AVRational time_base_in; - - /** - * The timebase used for the timestamps of the output packets. Set by the - * filter in av_bsf_init(). - */ - AVRational time_base_out; -} AVBSFContext; -typedef struct AVBitStreamFilter { - const char *name; - - /** - * A list of codec ids supported by the filter, terminated by - * AV_CODEC_ID_NONE. - * May be NULL, in that case the bitstream filter works with any codec id. - */ - const enum AVCodecID *codec_ids; - - /** - * A class for the private data, used to declare bitstream filter private - * AVOptions. This field is NULL for bitstream filters that do not declare - * any options. - * - * If this field is non-NULL, the first member of the filter private data - * must be a pointer to AVClass, which will be set by libavcodec generic - * code to this class. - */ - const AVClass *priv_class; - - /***************************************************************** - * No fields below this line are part of the public API. They - * may not be used outside of libavcodec and can be changed and - * removed at will. - * New public fields should be added right above. - ***************************************************************** - */ - - int priv_data_size; - int (*init)(AVBSFContext *ctx); - int (*filter)(AVBSFContext *ctx, AVPacket *pkt); - void (*close)(AVBSFContext *ctx); - void (*flush)(AVBSFContext *ctx); -} AVBitStreamFilter; - -#if FF_API_OLD_BSF /** * @deprecated the old bitstream filtering API (using AVBitStreamFilterContext) * is deprecated. Use the new bitstream filtering API (using AVBSFContext). @@ -4489,196 +4391,11 @@ attribute_deprecated const AVBitStreamFilter *av_bitstream_filter_next(const AVBitStreamFilter *f); #endif -/** - * @return a bitstream filter with the specified name or NULL if no such - * bitstream filter exists. - */ -const AVBitStreamFilter *av_bsf_get_by_name(const char *name); - -/** - * Iterate over all registered bitstream filters. - * - * @param opaque a pointer where libavcodec will store the iteration state. Must - * point to NULL to start the iteration. - * - * @return the next registered bitstream filter or NULL when the iteration is - * finished - */ -const AVBitStreamFilter *av_bsf_iterate(void **opaque); #if FF_API_NEXT attribute_deprecated const AVBitStreamFilter *av_bsf_next(void **opaque); #endif -/** - * Allocate a context for a given bitstream filter. The caller must fill in the - * context parameters as described in the documentation and then call - * av_bsf_init() before sending any data to the filter. - * - * @param filter the filter for which to allocate an instance. - * @param ctx a pointer into which the pointer to the newly-allocated context - * will be written. It must be freed with av_bsf_free() after the - * filtering is done. - * - * @return 0 on success, a negative AVERROR code on failure - */ -int av_bsf_alloc(const AVBitStreamFilter *filter, AVBSFContext **ctx); - -/** - * Prepare the filter for use, after all the parameters and options have been - * set. - */ -int av_bsf_init(AVBSFContext *ctx); - -/** - * Submit a packet for filtering. - * - * After sending each packet, the filter must be completely drained by calling - * av_bsf_receive_packet() repeatedly until it returns AVERROR(EAGAIN) or - * AVERROR_EOF. - * - * @param pkt the packet to filter. The bitstream filter will take ownership of - * the packet and reset the contents of pkt. pkt is not touched if an error occurs. - * If pkt is empty (i.e. NULL, or pkt->data is NULL and pkt->side_data_elems zero), - * it signals the end of the stream (i.e. no more non-empty packets will be sent; - * sending more empty packets does nothing) and will cause the filter to output - * any packets it may have buffered internally. - * - * @return 0 on success, a negative AVERROR on error. This function never fails if - * pkt is empty. - */ -int av_bsf_send_packet(AVBSFContext *ctx, AVPacket *pkt); - -/** - * Retrieve a filtered packet. - * - * @param[out] pkt this struct will be filled with the contents of the filtered - * packet. It is owned by the caller and must be freed using - * av_packet_unref() when it is no longer needed. - * This parameter should be "clean" (i.e. freshly allocated - * with av_packet_alloc() or unreffed with av_packet_unref()) - * when this function is called. If this function returns - * successfully, the contents of pkt will be completely - * overwritten by the returned data. On failure, pkt is not - * touched. - * - * @return 0 on success. AVERROR(EAGAIN) if more packets need to be sent to the - * filter (using av_bsf_send_packet()) to get more output. AVERROR_EOF if there - * will be no further output from the filter. Another negative AVERROR value if - * an error occurs. - * - * @note one input packet may result in several output packets, so after sending - * a packet with av_bsf_send_packet(), this function needs to be called - * repeatedly until it stops returning 0. It is also possible for a filter to - * output fewer packets than were sent to it, so this function may return - * AVERROR(EAGAIN) immediately after a successful av_bsf_send_packet() call. - */ -int av_bsf_receive_packet(AVBSFContext *ctx, AVPacket *pkt); - -/** - * Reset the internal bitstream filter state / flush internal buffers. - */ -void av_bsf_flush(AVBSFContext *ctx); - -/** - * Free a bitstream filter context and everything associated with it; write NULL - * into the supplied pointer. - */ -void av_bsf_free(AVBSFContext **ctx); - -/** - * Get the AVClass for AVBSFContext. It can be used in combination with - * AV_OPT_SEARCH_FAKE_OBJ for examining options. - * - * @see av_opt_find(). - */ -const AVClass *av_bsf_get_class(void); - -/** - * Structure for chain/list of bitstream filters. - * Empty list can be allocated by av_bsf_list_alloc(). - */ -typedef struct AVBSFList AVBSFList; - -/** - * Allocate empty list of bitstream filters. - * The list must be later freed by av_bsf_list_free() - * or finalized by av_bsf_list_finalize(). - * - * @return Pointer to @ref AVBSFList on success, NULL in case of failure - */ -AVBSFList *av_bsf_list_alloc(void); - -/** - * Free list of bitstream filters. - * - * @param lst Pointer to pointer returned by av_bsf_list_alloc() - */ -void av_bsf_list_free(AVBSFList **lst); - -/** - * Append bitstream filter to the list of bitstream filters. - * - * @param lst List to append to - * @param bsf Filter context to be appended - * - * @return >=0 on success, negative AVERROR in case of failure - */ -int av_bsf_list_append(AVBSFList *lst, AVBSFContext *bsf); - -/** - * Construct new bitstream filter context given it's name and options - * and append it to the list of bitstream filters. - * - * @param lst List to append to - * @param bsf_name Name of the bitstream filter - * @param options Options for the bitstream filter, can be set to NULL - * - * @return >=0 on success, negative AVERROR in case of failure - */ -int av_bsf_list_append2(AVBSFList *lst, const char * bsf_name, AVDictionary **options); -/** - * Finalize list of bitstream filters. - * - * This function will transform @ref AVBSFList to single @ref AVBSFContext, - * so the whole chain of bitstream filters can be treated as single filter - * freshly allocated by av_bsf_alloc(). - * If the call is successful, @ref AVBSFList structure is freed and lst - * will be set to NULL. In case of failure, caller is responsible for - * freeing the structure by av_bsf_list_free() - * - * @param lst Filter list structure to be transformed - * @param[out] bsf Pointer to be set to newly created @ref AVBSFContext structure - * representing the chain of bitstream filters - * - * @return >=0 on success, negative AVERROR in case of failure - */ -int av_bsf_list_finalize(AVBSFList **lst, AVBSFContext **bsf); - -/** - * Parse string describing list of bitstream filters and create single - * @ref AVBSFContext describing the whole chain of bitstream filters. - * Resulting @ref AVBSFContext can be treated as any other @ref AVBSFContext freshly - * allocated by av_bsf_alloc(). - * - * @param str String describing chain of bitstream filters in format - * `bsf1[=opt1=val1:opt2=val2][,bsf2]` - * @param[out] bsf Pointer to be set to newly created @ref AVBSFContext structure - * representing the chain of bitstream filters - * - * @return >=0 on success, negative AVERROR in case of failure - */ -int av_bsf_list_parse_str(const char *str, AVBSFContext **bsf); - -/** - * Get null/pass-through bitstream filter. - * - * @param[out] bsf Pointer to be set to new instance of pass-through bitstream filter - * - * @return - */ -int av_bsf_get_null_filter(AVBSFContext **bsf); - /* memory */ /** diff --git a/libavcodec/bsf.c b/libavcodec/bsf.c index a8d5c3082a..17982a2ed7 100644 --- a/libavcodec/bsf.c +++ b/libavcodec/bsf.c @@ -24,8 +24,10 @@ #include "libavutil/avstring.h" #include "libavutil/bprint.h" -#include "avcodec.h" +#include "bsf.h" #include "bsf_internal.h" +#include "codec_desc.h" +#include "codec_par.h" struct AVBSFInternal { AVPacket *buffer_pkt; diff --git a/libavcodec/bsf.h b/libavcodec/bsf.h new file mode 100644 index 0000000000..264a10a9b8 --- /dev/null +++ b/libavcodec/bsf.h @@ -0,0 +1,324 @@ +/* + * Bitstream filters public API + * + * 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 AVCODEC_BSF_H +#define AVCODEC_BSF_H + +#include "libavutil/dict.h" +#include "libavutil/log.h" +#include "libavutil/rational.h" + +#include "codec_id.h" +#include "codec_par.h" +#include "packet.h" + +/** + * @addtogroup lavc_core + * @{ + */ + +typedef struct AVBSFInternal AVBSFInternal; + +/** + * The bitstream filter state. + * + * This struct must be allocated with av_bsf_alloc() and freed with + * av_bsf_free(). + * + * The fields in the struct will only be changed (by the caller or by the + * filter) as described in their documentation, and are to be considered + * immutable otherwise. + */ +typedef struct AVBSFContext { + /** + * A class for logging and AVOptions + */ + const AVClass *av_class; + + /** + * The bitstream filter this context is an instance of. + */ + const struct AVBitStreamFilter *filter; + + /** + * Opaque libavcodec internal data. Must not be touched by the caller in any + * way. + */ + AVBSFInternal *internal; + + /** + * Opaque filter-specific private data. If filter->priv_class is non-NULL, + * this is an AVOptions-enabled struct. + */ + void *priv_data; + + /** + * Parameters of the input stream. This field is allocated in + * av_bsf_alloc(), it needs to be filled by the caller before + * av_bsf_init(). + */ + AVCodecParameters *par_in; + + /** + * Parameters of the output stream. This field is allocated in + * av_bsf_alloc(), it is set by the filter in av_bsf_init(). + */ + AVCodecParameters *par_out; + + /** + * The timebase used for the timestamps of the input packets. Set by the + * caller before av_bsf_init(). + */ + AVRational time_base_in; + + /** + * The timebase used for the timestamps of the output packets. Set by the + * filter in av_bsf_init(). + */ + AVRational time_base_out; +} AVBSFContext; + +typedef struct AVBitStreamFilter { + const char *name; + + /** + * A list of codec ids supported by the filter, terminated by + * AV_CODEC_ID_NONE. + * May be NULL, in that case the bitstream filter works with any codec id. + */ + const enum AVCodecID *codec_ids; + + /** + * A class for the private data, used to declare bitstream filter private + * AVOptions. This field is NULL for bitstream filters that do not declare + * any options. + * + * If this field is non-NULL, the first member of the filter private data + * must be a pointer to AVClass, which will be set by libavcodec generic + * code to this class. + */ + const AVClass *priv_class; + + /***************************************************************** + * No fields below this line are part of the public API. They + * may not be used outside of libavcodec and can be changed and + * removed at will. + * New public fields should be added right above. + ***************************************************************** + */ + + int priv_data_size; + int (*init)(AVBSFContext *ctx); + int (*filter)(AVBSFContext *ctx, AVPacket *pkt); + void (*close)(AVBSFContext *ctx); + void (*flush)(AVBSFContext *ctx); +} AVBitStreamFilter; + +/** + * @return a bitstream filter with the specified name or NULL if no such + * bitstream filter exists. + */ +const AVBitStreamFilter *av_bsf_get_by_name(const char *name); + +/** + * Iterate over all registered bitstream filters. + * + * @param opaque a pointer where libavcodec will store the iteration state. Must + * point to NULL to start the iteration. + * + * @return the next registered bitstream filter or NULL when the iteration is + * finished + */ +const AVBitStreamFilter *av_bsf_iterate(void **opaque); + +/** + * Allocate a context for a given bitstream filter. The caller must fill in the + * context parameters as described in the documentation and then call + * av_bsf_init() before sending any data to the filter. + * + * @param filter the filter for which to allocate an instance. + * @param ctx a pointer into which the pointer to the newly-allocated context + * will be written. It must be freed with av_bsf_free() after the + * filtering is done. + * + * @return 0 on success, a negative AVERROR code on failure + */ +int av_bsf_alloc(const AVBitStreamFilter *filter, AVBSFContext **ctx); + +/** + * Prepare the filter for use, after all the parameters and options have been + * set. + */ +int av_bsf_init(AVBSFContext *ctx); + +/** + * Submit a packet for filtering. + * + * After sending each packet, the filter must be completely drained by calling + * av_bsf_receive_packet() repeatedly until it returns AVERROR(EAGAIN) or + * AVERROR_EOF. + * + * @param pkt the packet to filter. The bitstream filter will take ownership of + * the packet and reset the contents of pkt. pkt is not touched if an error occurs. + * If pkt is empty (i.e. NULL, or pkt->data is NULL and pkt->side_data_elems zero), + * it signals the end of the stream (i.e. no more non-empty packets will be sent; + * sending more empty packets does nothing) and will cause the filter to output + * any packets it may have buffered internally. + * + * @return 0 on success, a negative AVERROR on error. This function never fails if + * pkt is empty. + */ +int av_bsf_send_packet(AVBSFContext *ctx, AVPacket *pkt); + +/** + * Retrieve a filtered packet. + * + * @param[out] pkt this struct will be filled with the contents of the filtered + * packet. It is owned by the caller and must be freed using + * av_packet_unref() when it is no longer needed. + * This parameter should be "clean" (i.e. freshly allocated + * with av_packet_alloc() or unreffed with av_packet_unref()) + * when this function is called. If this function returns + * successfully, the contents of pkt will be completely + * overwritten by the returned data. On failure, pkt is not + * touched. + * + * @return 0 on success. AVERROR(EAGAIN) if more packets need to be sent to the + * filter (using av_bsf_send_packet()) to get more output. AVERROR_EOF if there + * will be no further output from the filter. Another negative AVERROR value if + * an error occurs. + * + * @note one input packet may result in several output packets, so after sending + * a packet with av_bsf_send_packet(), this function needs to be called + * repeatedly until it stops returning 0. It is also possible for a filter to + * output fewer packets than were sent to it, so this function may return + * AVERROR(EAGAIN) immediately after a successful av_bsf_send_packet() call. + */ +int av_bsf_receive_packet(AVBSFContext *ctx, AVPacket *pkt); + +/** + * Reset the internal bitstream filter state / flush internal buffers. + */ +void av_bsf_flush(AVBSFContext *ctx); + +/** + * Free a bitstream filter context and everything associated with it; write NULL + * into the supplied pointer. + */ +void av_bsf_free(AVBSFContext **ctx); + +/** + * Get the AVClass for AVBSFContext. It can be used in combination with + * AV_OPT_SEARCH_FAKE_OBJ for examining options. + * + * @see av_opt_find(). + */ +const AVClass *av_bsf_get_class(void); + +/** + * Structure for chain/list of bitstream filters. + * Empty list can be allocated by av_bsf_list_alloc(). + */ +typedef struct AVBSFList AVBSFList; + +/** + * Allocate empty list of bitstream filters. + * The list must be later freed by av_bsf_list_free() + * or finalized by av_bsf_list_finalize(). + * + * @return Pointer to @ref AVBSFList on success, NULL in case of failure + */ +AVBSFList *av_bsf_list_alloc(void); + +/** + * Free list of bitstream filters. + * + * @param lst Pointer to pointer returned by av_bsf_list_alloc() + */ +void av_bsf_list_free(AVBSFList **lst); + +/** + * Append bitstream filter to the list of bitstream filters. + * + * @param lst List to append to + * @param bsf Filter context to be appended + * + * @return >=0 on success, negative AVERROR in case of failure + */ +int av_bsf_list_append(AVBSFList *lst, AVBSFContext *bsf); + +/** + * Construct new bitstream filter context given it's name and options + * and append it to the list of bitstream filters. + * + * @param lst List to append to + * @param bsf_name Name of the bitstream filter + * @param options Options for the bitstream filter, can be set to NULL + * + * @return >=0 on success, negative AVERROR in case of failure + */ +int av_bsf_list_append2(AVBSFList *lst, const char * bsf_name, AVDictionary **options); +/** + * Finalize list of bitstream filters. + * + * This function will transform @ref AVBSFList to single @ref AVBSFContext, + * so the whole chain of bitstream filters can be treated as single filter + * freshly allocated by av_bsf_alloc(). + * If the call is successful, @ref AVBSFList structure is freed and lst + * will be set to NULL. In case of failure, caller is responsible for + * freeing the structure by av_bsf_list_free() + * + * @param lst Filter list structure to be transformed + * @param[out] bsf Pointer to be set to newly created @ref AVBSFContext structure + * representing the chain of bitstream filters + * + * @return >=0 on success, negative AVERROR in case of failure + */ +int av_bsf_list_finalize(AVBSFList **lst, AVBSFContext **bsf); + +/** + * Parse string describing list of bitstream filters and create single + * @ref AVBSFContext describing the whole chain of bitstream filters. + * Resulting @ref AVBSFContext can be treated as any other @ref AVBSFContext freshly + * allocated by av_bsf_alloc(). + * + * @param str String describing chain of bitstream filters in format + * `bsf1[=opt1=val1:opt2=val2][,bsf2]` + * @param[out] bsf Pointer to be set to newly created @ref AVBSFContext structure + * representing the chain of bitstream filters + * + * @return >=0 on success, negative AVERROR in case of failure + */ +int av_bsf_list_parse_str(const char *str, AVBSFContext **bsf); + +/** + * Get null/pass-through bitstream filter. + * + * @param[out] bsf Pointer to be set to new instance of pass-through bitstream filter + * + * @return + */ +int av_bsf_get_null_filter(AVBSFContext **bsf); + +/** + * @} + */ + +#endif // AVCODEC_BSF_H diff --git a/libavcodec/bsf_internal.h b/libavcodec/bsf_internal.h index de4684c4c2..af8344a709 100644 --- a/libavcodec/bsf_internal.h +++ b/libavcodec/bsf_internal.h @@ -19,7 +19,10 @@ #ifndef AVCODEC_BSF_INTERNAL_H #define AVCODEC_BSF_INTERNAL_H -#include "avcodec.h" +#include "libavutil/log.h" + +#include "bsf.h" +#include "packet.h" /** * Called by the bitstream filters to get the next packet for filtering. diff --git a/libavcodec/chomp_bsf.c b/libavcodec/chomp_bsf.c index d7461afebd..2173e1ba33 100644 --- a/libavcodec/chomp_bsf.c +++ b/libavcodec/chomp_bsf.c @@ -19,7 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "avcodec.h" +#include "bsf.h" #include "bsf_internal.h" #include "internal.h" diff --git a/libavcodec/dca_core_bsf.c b/libavcodec/dca_core_bsf.c index b78995dbb7..7149a1f24f 100644 --- a/libavcodec/dca_core_bsf.c +++ b/libavcodec/dca_core_bsf.c @@ -18,7 +18,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "avcodec.h" +#include "bsf.h" #include "bsf_internal.h" #include "bytestream.h" #include "dca_syncwords.h" diff --git a/libavcodec/dump_extradata_bsf.c b/libavcodec/dump_extradata_bsf.c index 9727b9983a..7adfa48250 100644 --- a/libavcodec/dump_extradata_bsf.c +++ b/libavcodec/dump_extradata_bsf.c @@ -20,7 +20,7 @@ #include -#include "avcodec.h" +#include "bsf.h" #include "bsf_internal.h" #include "libavutil/log.h" diff --git a/libavcodec/eac3_core_bsf.c b/libavcodec/eac3_core_bsf.c index c584d69227..49c3389ee1 100644 --- a/libavcodec/eac3_core_bsf.c +++ b/libavcodec/eac3_core_bsf.c @@ -18,7 +18,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "avcodec.h" +#include "bsf.h" #include "bsf_internal.h" #include "get_bits.h" #include "ac3_parser_internal.h" diff --git a/libavcodec/extract_extradata_bsf.c b/libavcodec/extract_extradata_bsf.c index d7ffa1bff2..1fead74b57 100644 --- a/libavcodec/extract_extradata_bsf.c +++ b/libavcodec/extract_extradata_bsf.c @@ -23,9 +23,9 @@ #include "libavutil/log.h" #include "libavutil/opt.h" -#include "avcodec.h" #include "av1.h" #include "av1_parse.h" +#include "bsf.h" #include "bsf_internal.h" #include "bytestream.h" #include "h2645_parse.h" diff --git a/libavcodec/filter_units_bsf.c b/libavcodec/filter_units_bsf.c index 7c3819c7b3..700dc06ef6 100644 --- a/libavcodec/filter_units_bsf.c +++ b/libavcodec/filter_units_bsf.c @@ -21,6 +21,7 @@ #include "libavutil/common.h" #include "libavutil/opt.h" +#include "bsf.h" #include "bsf_internal.h" #include "cbs.h" diff --git a/libavcodec/h264_metadata_bsf.c b/libavcodec/h264_metadata_bsf.c index 4cce5b1f1a..4cc241aa05 100644 --- a/libavcodec/h264_metadata_bsf.c +++ b/libavcodec/h264_metadata_bsf.c @@ -21,6 +21,7 @@ #include "libavutil/common.h" #include "libavutil/opt.h" +#include "bsf.h" #include "bsf_internal.h" #include "cbs.h" #include "cbs_h264.h" diff --git a/libavcodec/h264_mp4toannexb_bsf.c b/libavcodec/h264_mp4toannexb_bsf.c index 52fc9b90cf..2822644b10 100644 --- a/libavcodec/h264_mp4toannexb_bsf.c +++ b/libavcodec/h264_mp4toannexb_bsf.c @@ -26,6 +26,7 @@ #include "libavutil/mem.h" #include "avcodec.h" +#include "bsf.h" #include "bsf_internal.h" #include "bytestream.h" #include "h264.h" diff --git a/libavcodec/h264_redundant_pps_bsf.c b/libavcodec/h264_redundant_pps_bsf.c index 34885d320a..8f69780951 100644 --- a/libavcodec/h264_redundant_pps_bsf.c +++ b/libavcodec/h264_redundant_pps_bsf.c @@ -21,6 +21,7 @@ #include "libavutil/common.h" #include "libavutil/mem.h" +#include "bsf.h" #include "bsf_internal.h" #include "cbs.h" #include "cbs_h264.h" diff --git a/libavcodec/h265_metadata_bsf.c b/libavcodec/h265_metadata_bsf.c index 6269ca00ab..56f8aa9c8b 100644 --- a/libavcodec/h265_metadata_bsf.c +++ b/libavcodec/h265_metadata_bsf.c @@ -19,6 +19,7 @@ #include "libavutil/common.h" #include "libavutil/opt.h" +#include "bsf.h" #include "bsf_internal.h" #include "cbs.h" #include "cbs_h265.h" diff --git a/libavcodec/hapqa_extract_bsf.c b/libavcodec/hapqa_extract_bsf.c index 9fdcbe2886..1c8b0669b7 100644 --- a/libavcodec/hapqa_extract_bsf.c +++ b/libavcodec/hapqa_extract_bsf.c @@ -25,7 +25,7 @@ * extract one of the two textures of the HAQA */ -#include "avcodec.h" +#include "bsf.h" #include "bsf_internal.h" #include "bytestream.h" #include "hap.h" diff --git a/libavcodec/hevc_mp4toannexb_bsf.c b/libavcodec/hevc_mp4toannexb_bsf.c index f3efc33ab8..03dbf084e4 100644 --- a/libavcodec/hevc_mp4toannexb_bsf.c +++ b/libavcodec/hevc_mp4toannexb_bsf.c @@ -25,6 +25,7 @@ #include "libavutil/mem.h" #include "avcodec.h" +#include "bsf.h" #include "bsf_internal.h" #include "bytestream.h" #include "hevc.h" diff --git a/libavcodec/imx_dump_header_bsf.c b/libavcodec/imx_dump_header_bsf.c index 6f3d7e52b0..e2b6a15591 100644 --- a/libavcodec/imx_dump_header_bsf.c +++ b/libavcodec/imx_dump_header_bsf.c @@ -25,7 +25,7 @@ * modifies bitstream to fit in mov and be decoded by final cut pro decoder */ -#include "avcodec.h" +#include "bsf.h" #include "bsf_internal.h" #include "bytestream.h" diff --git a/libavcodec/mjpeg2jpeg_bsf.c b/libavcodec/mjpeg2jpeg_bsf.c index 25f5b31a73..6ac2882354 100644 --- a/libavcodec/mjpeg2jpeg_bsf.c +++ b/libavcodec/mjpeg2jpeg_bsf.c @@ -30,7 +30,7 @@ #include "libavutil/mem.h" #include "libavutil/intreadwrite.h" -#include "avcodec.h" +#include "bsf.h" #include "bsf_internal.h" #include "jpegtables.h" #include "mjpeg.h" diff --git a/libavcodec/mjpega_dump_header_bsf.c b/libavcodec/mjpega_dump_header_bsf.c index e8a440a69f..ab68f9c3e9 100644 --- a/libavcodec/mjpega_dump_header_bsf.c +++ b/libavcodec/mjpega_dump_header_bsf.c @@ -25,7 +25,7 @@ * modifies bitstream to be decoded by quicktime */ -#include "avcodec.h" +#include "bsf.h" #include "bsf_internal.h" #include "bytestream.h" #include "mjpeg.h" diff --git a/libavcodec/movsub_bsf.c b/libavcodec/movsub_bsf.c index bfc06a70f8..6e29fa8e50 100644 --- a/libavcodec/movsub_bsf.c +++ b/libavcodec/movsub_bsf.c @@ -20,7 +20,7 @@ #include "libavutil/common.h" #include "libavutil/intreadwrite.h" -#include "avcodec.h" +#include "bsf.h" #include "bsf_internal.h" static int text2movsub(AVBSFContext *ctx, AVPacket *out) diff --git a/libavcodec/mp3_header_decompress_bsf.c b/libavcodec/mp3_header_decompress_bsf.c index 158d96853e..44c174c21c 100644 --- a/libavcodec/mp3_header_decompress_bsf.c +++ b/libavcodec/mp3_header_decompress_bsf.c @@ -20,7 +20,7 @@ #include "libavutil/common.h" #include "libavutil/intreadwrite.h" -#include "avcodec.h" +#include "bsf.h" #include "bsf_internal.h" #include "mpegaudiodecheader.h" #include "mpegaudiodata.h" diff --git a/libavcodec/mpeg2_metadata_bsf.c b/libavcodec/mpeg2_metadata_bsf.c index 8c6dad9625..b1e2d6128a 100644 --- a/libavcodec/mpeg2_metadata_bsf.c +++ b/libavcodec/mpeg2_metadata_bsf.c @@ -20,6 +20,7 @@ #include "libavutil/common.h" #include "libavutil/opt.h" +#include "bsf.h" #include "bsf_internal.h" #include "cbs.h" #include "cbs_mpeg2.h" diff --git a/libavcodec/mpeg4_unpack_bframes_bsf.c b/libavcodec/mpeg4_unpack_bframes_bsf.c index 6934cce73a..6f8595713d 100644 --- a/libavcodec/mpeg4_unpack_bframes_bsf.c +++ b/libavcodec/mpeg4_unpack_bframes_bsf.c @@ -19,7 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "avcodec.h" +#include "bsf.h" #include "bsf_internal.h" #include "internal.h" #include "mpeg4video.h" diff --git a/libavcodec/noise_bsf.c b/libavcodec/noise_bsf.c index 69bd87f3f3..4cc2968dde 100644 --- a/libavcodec/noise_bsf.c +++ b/libavcodec/noise_bsf.c @@ -21,7 +21,7 @@ #include #include -#include "avcodec.h" +#include "bsf.h" #include "bsf_internal.h" #include "libavutil/log.h" diff --git a/libavcodec/null_bsf.c b/libavcodec/null_bsf.c index 052355b6e6..ab5185a1d5 100644 --- a/libavcodec/null_bsf.c +++ b/libavcodec/null_bsf.c @@ -21,7 +21,7 @@ * Null bitstream filter -- pass the input through unchanged. */ -#include "avcodec.h" +#include "bsf.h" #include "bsf_internal.h" static int null_filter(AVBSFContext *ctx, AVPacket *pkt) diff --git a/libavcodec/prores_metadata_bsf.c b/libavcodec/prores_metadata_bsf.c index 239f5c3cfa..85da297c99 100644 --- a/libavcodec/prores_metadata_bsf.c +++ b/libavcodec/prores_metadata_bsf.c @@ -28,6 +28,8 @@ #include "libavutil/common.h" #include "libavutil/intreadwrite.h" #include "libavutil/opt.h" + +#include "bsf.h" #include "bsf_internal.h" typedef struct ProresMetadataContext { diff --git a/libavcodec/remove_extradata_bsf.c b/libavcodec/remove_extradata_bsf.c index 7ea12d260a..5783b075f0 100644 --- a/libavcodec/remove_extradata_bsf.c +++ b/libavcodec/remove_extradata_bsf.c @@ -22,6 +22,7 @@ #include "libavutil/opt.h" #include "avcodec.h" +#include "bsf.h" #include "bsf_internal.h" enum RemoveFreq { diff --git a/libavcodec/trace_headers_bsf.c b/libavcodec/trace_headers_bsf.c index ffd4e5465b..8ee4dbd668 100644 --- a/libavcodec/trace_headers_bsf.c +++ b/libavcodec/trace_headers_bsf.c @@ -22,6 +22,7 @@ #include "libavutil/common.h" #include "libavutil/log.h" +#include "bsf.h" #include "bsf_internal.h" #include "cbs.h" diff --git a/libavcodec/truehd_core_bsf.c b/libavcodec/truehd_core_bsf.c index 59e5b0035c..7231306ad7 100644 --- a/libavcodec/truehd_core_bsf.c +++ b/libavcodec/truehd_core_bsf.c @@ -18,7 +18,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "avcodec.h" +#include "bsf.h" #include "bsf_internal.h" #include "get_bits.h" #include "mlp_parse.h" diff --git a/libavcodec/vp9_metadata_bsf.c b/libavcodec/vp9_metadata_bsf.c index 974a5fc6dd..2ca494e695 100644 --- a/libavcodec/vp9_metadata_bsf.c +++ b/libavcodec/vp9_metadata_bsf.c @@ -20,6 +20,7 @@ #include "libavutil/common.h" #include "libavutil/opt.h" +#include "bsf.h" #include "bsf_internal.h" #include "cbs.h" #include "cbs_vp9.h" diff --git a/libavcodec/vp9_raw_reorder_bsf.c b/libavcodec/vp9_raw_reorder_bsf.c index 531cd99003..d62b516742 100644 --- a/libavcodec/vp9_raw_reorder_bsf.c +++ b/libavcodec/vp9_raw_reorder_bsf.c @@ -22,6 +22,7 @@ #include "libavutil/mem.h" #include "libavutil/opt.h" +#include "bsf.h" #include "bsf_internal.h" #include "get_bits.h" #include "put_bits.h" diff --git a/libavcodec/vp9_superframe_bsf.c b/libavcodec/vp9_superframe_bsf.c index 2584604817..57681e29e4 100644 --- a/libavcodec/vp9_superframe_bsf.c +++ b/libavcodec/vp9_superframe_bsf.c @@ -20,7 +20,8 @@ */ #include "libavutil/avassert.h" -#include "avcodec.h" + +#include "bsf.h" #include "bsf_internal.h" #include "get_bits.h" diff --git a/libavcodec/vp9_superframe_split_bsf.c b/libavcodec/vp9_superframe_split_bsf.c index 00f40aa96e..ed0444561a 100644 --- a/libavcodec/vp9_superframe_split_bsf.c +++ b/libavcodec/vp9_superframe_split_bsf.c @@ -24,7 +24,7 @@ #include -#include "avcodec.h" +#include "bsf.h" #include "bsf_internal.h" #include "bytestream.h" #include "get_bits.h"