diff mbox

[FFmpeg-devel,3/3] avfilter/buffersink: remove AVBufferSinkParams and AVABufferSinkParams

Message ID 20191206051447.31830-3-quinkblack@foxmail.com
State New
Headers show

Commit Message

Zhao Zhili Dec. 6, 2019, 5:14 a.m. UTC
From: Zhao Zhili <zhilizhao@tencent.com>

The patch breaks API in theory. Since there is no reason to allocate
an object which you can do nothing with it, the API break should have
no effect.
---
 libavfilter/buffersink.c | 20 --------------------
 libavfilter/buffersink.h | 32 --------------------------------
 2 files changed, 52 deletions(-)

Comments

Zhao Zhili Dec. 6, 2019, 6:34 a.m. UTC | #1
Please ignore patch 3/3. FFmpeg user may pass AVBufferSinkParams to 
avfilter_graph_create_filter with the opaque pointer, which is ignored by
implementation. It should be marked as obsolete.

> On Dec 6, 2019, at 1:14 PM, quinkblack@foxmail.com wrote:
> 
> From: Zhao Zhili <zhilizhao@tencent.com>
> 
> The patch breaks API in theory. Since there is no reason to allocate
> an object which you can do nothing with it, the API break should have
> no effect.
> ---
> libavfilter/buffersink.c | 20 --------------------
> libavfilter/buffersink.h | 32 --------------------------------
> 2 files changed, 52 deletions(-)
> 
> diff --git a/libavfilter/buffersink.c b/libavfilter/buffersink.c
> index 5f2ed0e4b3..5d30c55281 100644
> --- a/libavfilter/buffersink.c
> +++ b/libavfilter/buffersink.c
> @@ -125,26 +125,6 @@ int attribute_align_arg av_buffersink_get_samples(AVFilterContext *ctx,
>     return get_frame_internal(ctx, frame, 0, nb_samples);
> }
> 
> -AVBufferSinkParams *av_buffersink_params_alloc(void)
> -{
> -    static const int pixel_fmts[] = { AV_PIX_FMT_NONE };
> -    AVBufferSinkParams *params = av_malloc(sizeof(AVBufferSinkParams));
> -    if (!params)
> -        return NULL;
> -
> -    params->pixel_fmts = pixel_fmts;
> -    return params;
> -}
> -
> -AVABufferSinkParams *av_abuffersink_params_alloc(void)
> -{
> -    AVABufferSinkParams *params = av_mallocz(sizeof(AVABufferSinkParams));
> -
> -    if (!params)
> -        return NULL;
> -    return params;
> -}
> -
> static av_cold int common_init(AVFilterContext *ctx)
> {
>     BufferSinkContext *buf = ctx->priv;
> diff --git a/libavfilter/buffersink.h b/libavfilter/buffersink.h
> index 3c846bb527..be63bd1af1 100644
> --- a/libavfilter/buffersink.h
> +++ b/libavfilter/buffersink.h
> @@ -59,38 +59,6 @@ int av_buffersink_get_frame_flags(AVFilterContext *ctx, AVFrame *frame, int flag
>  */
> #define AV_BUFFERSINK_FLAG_NO_REQUEST 2
> 
> -/**
> - * Struct to use for initializing a buffersink context.
> - */
> -typedef struct AVBufferSinkParams {
> -    const enum AVPixelFormat *pixel_fmts; ///< list of allowed pixel formats, terminated by AV_PIX_FMT_NONE
> -} AVBufferSinkParams;
> -
> -/**
> - * Create an AVBufferSinkParams structure.
> - *
> - * Must be freed with av_free().
> - */
> -AVBufferSinkParams *av_buffersink_params_alloc(void);
> -
> -/**
> - * Struct to use for initializing an abuffersink context.
> - */
> -typedef struct AVABufferSinkParams {
> -    const enum AVSampleFormat *sample_fmts; ///< list of allowed sample formats, terminated by AV_SAMPLE_FMT_NONE
> -    const int64_t *channel_layouts;         ///< list of allowed channel layouts, terminated by -1
> -    const int *channel_counts;              ///< list of allowed channel counts, terminated by -1
> -    int all_channel_counts;                 ///< if not 0, accept any channel count or layout
> -    int *sample_rates;                      ///< list of allowed sample rates, terminated by -1
> -} AVABufferSinkParams;
> -
> -/**
> - * Create an AVABufferSinkParams structure.
> - *
> - * Must be freed with av_free().
> - */
> -AVABufferSinkParams *av_abuffersink_params_alloc(void);
> -
> /**
>  * Set the frame size for an audio buffer sink.
>  *
> -- 
> 2.22.0
> 
> 
> 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
diff mbox

Patch

diff --git a/libavfilter/buffersink.c b/libavfilter/buffersink.c
index 5f2ed0e4b3..5d30c55281 100644
--- a/libavfilter/buffersink.c
+++ b/libavfilter/buffersink.c
@@ -125,26 +125,6 @@  int attribute_align_arg av_buffersink_get_samples(AVFilterContext *ctx,
     return get_frame_internal(ctx, frame, 0, nb_samples);
 }
 
-AVBufferSinkParams *av_buffersink_params_alloc(void)
-{
-    static const int pixel_fmts[] = { AV_PIX_FMT_NONE };
-    AVBufferSinkParams *params = av_malloc(sizeof(AVBufferSinkParams));
-    if (!params)
-        return NULL;
-
-    params->pixel_fmts = pixel_fmts;
-    return params;
-}
-
-AVABufferSinkParams *av_abuffersink_params_alloc(void)
-{
-    AVABufferSinkParams *params = av_mallocz(sizeof(AVABufferSinkParams));
-
-    if (!params)
-        return NULL;
-    return params;
-}
-
 static av_cold int common_init(AVFilterContext *ctx)
 {
     BufferSinkContext *buf = ctx->priv;
diff --git a/libavfilter/buffersink.h b/libavfilter/buffersink.h
index 3c846bb527..be63bd1af1 100644
--- a/libavfilter/buffersink.h
+++ b/libavfilter/buffersink.h
@@ -59,38 +59,6 @@  int av_buffersink_get_frame_flags(AVFilterContext *ctx, AVFrame *frame, int flag
  */
 #define AV_BUFFERSINK_FLAG_NO_REQUEST 2
 
-/**
- * Struct to use for initializing a buffersink context.
- */
-typedef struct AVBufferSinkParams {
-    const enum AVPixelFormat *pixel_fmts; ///< list of allowed pixel formats, terminated by AV_PIX_FMT_NONE
-} AVBufferSinkParams;
-
-/**
- * Create an AVBufferSinkParams structure.
- *
- * Must be freed with av_free().
- */
-AVBufferSinkParams *av_buffersink_params_alloc(void);
-
-/**
- * Struct to use for initializing an abuffersink context.
- */
-typedef struct AVABufferSinkParams {
-    const enum AVSampleFormat *sample_fmts; ///< list of allowed sample formats, terminated by AV_SAMPLE_FMT_NONE
-    const int64_t *channel_layouts;         ///< list of allowed channel layouts, terminated by -1
-    const int *channel_counts;              ///< list of allowed channel counts, terminated by -1
-    int all_channel_counts;                 ///< if not 0, accept any channel count or layout
-    int *sample_rates;                      ///< list of allowed sample rates, terminated by -1
-} AVABufferSinkParams;
-
-/**
- * Create an AVABufferSinkParams structure.
- *
- * Must be freed with av_free().
- */
-AVABufferSinkParams *av_abuffersink_params_alloc(void);
-
 /**
  * Set the frame size for an audio buffer sink.
  *