[FFmpeg-devel] [PATCH v2 21/33] avdevice: capabilities API details no longer public

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Thu Jun 17 05:46:32 EEST 2021


Diederick Niehorster:
> Signed-off-by: Diederick Niehorster <dcnieho at gmail.com>
> ---
>  libavdevice/avdevice.c |  2 +-
>  libavdevice/avdevice.h | 28 +---------------------------
>  libavdevice/internal.h | 33 +++++++++++++++++++++++++++++++++
>  libavdevice/version.h  |  2 +-
>  4 files changed, 36 insertions(+), 29 deletions(-)
> 
> diff --git a/libavdevice/avdevice.c b/libavdevice/avdevice.c
> index e66906e91b..cb139e6d4a 100644
> --- a/libavdevice/avdevice.c
> +++ b/libavdevice/avdevice.c
> @@ -33,7 +33,7 @@ const char av_device_ffversion[] = "FFmpeg version " FFMPEG_VERSION;
>  #define V AV_OPT_FLAG_VIDEO_PARAM
>  #define OFFSET(x) offsetof(AVDeviceCapabilitiesQuery, x)
>  
> -const AVOption av_device_capabilities[] = {
> +const AVOption ff_device_capabilities[] = {
>      { "codec", "codec", OFFSET(codec), AV_OPT_TYPE_INT,
>          {.i64 = AV_CODEC_ID_NONE}, AV_CODEC_ID_NONE, INT_MAX, E|D|A|V },
>      { "sample_format", "sample format", OFFSET(sample_format), AV_OPT_TYPE_SAMPLE_FMT,
> diff --git a/libavdevice/avdevice.h b/libavdevice/avdevice.h
> index 6443f865d5..44c4f185a2 100644
> --- a/libavdevice/avdevice.h
> +++ b/libavdevice/avdevice.h
> @@ -400,33 +400,7 @@ int avdevice_dev_to_app_control_message(struct AVFormatContext *s,
>   *  avformat_free_context(oc);
>   * @endcode
>   */
> -
> -/**
> - * Structure describes device capabilities.
> - *
> - * It is used by devices in conjunction with av_device_capabilities AVOption table
> - * to implement capabilities probing API based on AVOption API. Should not be used directly.
> - */
> -typedef struct AVDeviceCapabilitiesQuery {
> -    const AVClass *av_class;
> -    AVFormatContext *device_context;
> -    enum AVCodecID codec;
> -    enum AVSampleFormat sample_format;
> -    enum AVPixelFormat pixel_format;
> -    int sample_rate;
> -    int channels;
> -    int64_t channel_layout;
> -    int window_width;
> -    int window_height;
> -    int frame_width;
> -    int frame_height;
> -    AVRational fps;
> -} AVDeviceCapabilitiesQuery;
> -
> -/**
> - * AVOption table used by devices to implement device capabilities API. Should not be used by a user.
> - */
> -extern const AVOption av_device_capabilities[];
> +typedef struct AVDeviceCapabilitiesQuery AVDeviceCapabilitiesQuery;
>  
>  /**
>   * Initialize capabilities probing API based on AVOption API.
> diff --git a/libavdevice/internal.h b/libavdevice/internal.h
> index 67c90e1f87..e7a72d008d 100644
> --- a/libavdevice/internal.h
> +++ b/libavdevice/internal.h
> @@ -19,10 +19,43 @@
>  #ifndef AVDEVICE_INTERNAL_H
>  #define AVDEVICE_INTERNAL_H
>  
> +#include "libavutil/log.h"
> +#include "libavutil/opt.h"
> +#include "libavutil/pixfmt.h"
> +#include "libavutil/rational.h"
> +#include "libavutil/samplefmt.h"
> +#include "libavcodec/codec_id.h"
>  #include "libavformat/avformat.h"
>  
>  av_warn_unused_result
>  int ff_alloc_input_device_context(struct AVFormatContext **avctx, const AVInputFormat *iformat,
>                                    const char *format);
>  
> +/**
> + * Structure describes device capabilities.
> + *
> + * It is used by devices in conjunction with ff_device_capabilities AVOption table
> + * to implement capabilities probing API based on AVOption API.
> + */
> +typedef struct AVDeviceCapabilitiesQuery {

You are typedefing twice; this is only valid since C11; before that,
typedefs were subject to the one-definition-rule. This will break older
compilers for no benefit whatsoever, so please don't typedef here.

> +    const AVClass *av_class;
> +    AVFormatContext *device_context;
> +    enum AVCodecID codec;
> +    enum AVSampleFormat sample_format;
> +    enum AVPixelFormat pixel_format;
> +    int sample_rate;
> +    int channels;
> +    int64_t channel_layout;
> +    int window_width;
> +    int window_height;
> +    int frame_width;
> +    int frame_height;
> +    AVRational fps;
> +} AVDeviceCapabilitiesQuery;
> +
> +/**
> + * AVOption table used by devices to implement device capabilities API.
> + */
> +extern const AVOption ff_device_capabilities[];
> +
>  #endif
> diff --git a/libavdevice/version.h b/libavdevice/version.h
> index 0381d6cd0d..53af6fa0d0 100644
> --- a/libavdevice/version.h
> +++ b/libavdevice/version.h
> @@ -28,7 +28,7 @@
>  #include "libavutil/version.h"
>  
>  #define LIBAVDEVICE_VERSION_MAJOR  59
> -#define LIBAVDEVICE_VERSION_MINOR   2
> +#define LIBAVDEVICE_VERSION_MINOR   3
>  #define LIBAVDEVICE_VERSION_MICRO 100
>  
>  #define LIBAVDEVICE_VERSION_INT AV_VERSION_INT(LIBAVDEVICE_VERSION_MAJOR, \
> 



More information about the ffmpeg-devel mailing list