[FFmpeg-devel] [PATCH 5/9] lavfi/avcodec: deprecate avfilter_fill_frame_from_*_buffer_ref API

Clément Bœsch ubitux at gmail.com
Sat Jun 23 10:37:18 CEST 2012


On Fri, Jun 22, 2012 at 12:11:19PM +0200, Stefano Sabatini wrote:
> Deprecate functions:
> avfilter_fill_frame_from_buffer_ref
> avfilter_fill_frame_from_audio_buffer_ref
> avfilter_fill_frame_from_video_buffer_ref
> 
> and schedule to drop them at the next API major bump.
> 
> The function avfilter_copy_buf_props() should be used instead.
> ---
>  ffplay.c              |    2 +-
>  libavfilter/avcodec.c |    2 ++
>  libavfilter/avcodec.h |    9 +++++++++
>  libavfilter/version.h |    3 +++
>  4 files changed, 15 insertions(+), 1 deletions(-)
> 
> diff --git a/ffplay.c b/ffplay.c
> index 55c7825..5421968 100644
> --- a/ffplay.c
> +++ b/ffplay.c
> @@ -1732,7 +1732,7 @@ static int video_thread(void *arg)
>              if (fabs(is->frame_last_filter_delay) > AV_NOSYNC_THRESHOLD / 10.0)
>                  is->frame_last_filter_delay = 0;
>  
> -            avfilter_fill_frame_from_video_buffer_ref(frame, picref);
> +            avfilter_copy_buf_props(frame, picref);
>  
>              pts_int = picref->pts;
>              tb      = filt_out->inputs[0]->time_base;

Don't you need to update ffmpeg.c as well?

ffmpeg.c: avfilter_fill_frame_from_video_buffer_ref(filtered_frame, picref);

> diff --git a/libavfilter/avcodec.c b/libavfilter/avcodec.c
> index ce53ed9..c50cd18 100644
> --- a/libavfilter/avcodec.c
> +++ b/libavfilter/avcodec.c
> @@ -131,6 +131,7 @@ int avfilter_copy_buf_props(AVFrame *dst, const AVFilterBufferRef *src)
>      return 0;
>  }
>  
> +#ifdef FF_API_FILL_FRAME
>  int avfilter_fill_frame_from_audio_buffer_ref(AVFrame *frame,
>                                                const AVFilterBufferRef *samplesref)
>  {
> @@ -148,3 +149,4 @@ int avfilter_fill_frame_from_buffer_ref(AVFrame *frame,
>  {
>      return avfilter_copy_buf_props(frame, ref);
>  }
> +#endif
> diff --git a/libavfilter/avcodec.h b/libavfilter/avcodec.h
> index 9636cfd..36ee4eb 100644
> --- a/libavfilter/avcodec.h
> +++ b/libavfilter/avcodec.h
> @@ -48,6 +48,7 @@ int avfilter_copy_frame_props(AVFilterBufferRef *dst, const AVFrame *src);
>   */
>  int avfilter_copy_buf_props(AVFrame *dst, const AVFilterBufferRef *src);
>  
> +

Looks unrelated but it shouldn't hurt if you want it.

>  /**
>   * Create and return a picref reference from the data and properties
>   * contained in frame.
> @@ -66,6 +67,7 @@ AVFilterBufferRef *avfilter_get_video_buffer_ref_from_frame(const AVFrame *frame
>  AVFilterBufferRef *avfilter_get_audio_buffer_ref_from_frame(const AVFrame *frame,
>                                                              int perms);
>  
> +#ifdef FF_API_FILL_FRAME
>  /**
>   * Fill an AVFrame with the information stored in samplesref.
>   *
> @@ -73,7 +75,9 @@ AVFilterBufferRef *avfilter_get_audio_buffer_ref_from_frame(const AVFrame *frame
>   * @param samplesref an audio buffer reference
>   * @return 0 in case of success, a negative AVERROR code in case of
>   * failure
> + * @deprecated Use avfilter_copy_buf_props() instead.
>   */
> +attribute_deprecated
>  int avfilter_fill_frame_from_audio_buffer_ref(AVFrame *frame,
>                                                const AVFilterBufferRef *samplesref);
>  
> @@ -84,7 +88,9 @@ int avfilter_fill_frame_from_audio_buffer_ref(AVFrame *frame,
>   * @param picref a video buffer reference
>   * @return 0 in case of success, a negative AVERROR code in case of
>   * failure
> + * @deprecated Use avfilter_copy_buf_props() instead.
>   */
> +attribute_deprecated
>  int avfilter_fill_frame_from_video_buffer_ref(AVFrame *frame,
>                                                const AVFilterBufferRef *picref);
>  
> @@ -95,9 +101,12 @@ int avfilter_fill_frame_from_video_buffer_ref(AVFrame *frame,
>   * @param ref a video or audio buffer reference
>   * @return 0 in case of success, a negative AVERROR code in case of
>   * failure
> + * @deprecated Use avfilter_copy_buf_props() instead.
>   */
> +attribute_deprecated
>  int avfilter_fill_frame_from_buffer_ref(AVFrame *frame,
>                                          const AVFilterBufferRef *ref);
> +#endif
>  
>  /**
>   * Add frame data to buffer_src.
> diff --git a/libavfilter/version.h b/libavfilter/version.h
> index 221a0de..32426f4 100644
> --- a/libavfilter/version.h
> +++ b/libavfilter/version.h
> @@ -68,5 +68,8 @@
>  #ifndef FF_API_FOO_COUNT
>  #define FF_API_FOO_COUNT                    (LIBAVFILTER_VERSION_MAJOR < 4)

Note: why is this < 4 (and not < 3)?

[...]

Looks OK otherwise.

-- 
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120623/e04dd510/attachment.asc>


More information about the ffmpeg-devel mailing list