On 2011-12-31 17:17:55 +0100, Anton Khirnov wrote:
> It's the same as av_vsrc_buffer_add_frame(), except it doesn't take pts
> or pixel_aspect parameters. Those are read from AVFrame.
> 
> Deprecate av_vsrc_buffer_add_frame().
> ---
>  avconv.c                  |    5 ++---
>  doc/APIchanges            |    5 +++++
>  libavfilter/buffersrc.h   |    9 +++++++++
>  libavfilter/version.h     |   11 ++++++++++-
>  libavfilter/vsrc_buffer.c |   17 +++++++++++++++--
>  libavfilter/vsrc_buffer.h |    3 +++
>  6 files changed, 44 insertions(+), 6 deletions(-)
> 
> diff --git a/avconv.c b/avconv.c
> index 56a8ee4..add2ba1 100644
> --- a/avconv.c
> +++ b/avconv.c
> @@ -1921,6 +1921,7 @@ static int transcode_video(InputStream *ist, AVPacket 
> *pkt, int *got_output, int
>  #if CONFIG_AVFILTER
>          if (ist->st->sample_aspect_ratio.num)
>              decoded_frame->sample_aspect_ratio = 
> ist->st->sample_aspect_ratio;
> +        decoded_frame->pts = ist->pts;
>          if (ist->st->codec->codec->capabilities & CODEC_CAP_DR1) {
>              FrameBuffer      *buf = decoded_frame->opaque;
>              AVFilterBufferRef *fb = 
> avfilter_get_video_buffer_ref_from_arrays(
> @@ -1930,15 +1931,13 @@ static int transcode_video(InputStream *ist, AVPacket 
> *pkt, int *got_output, int
>                                          ist->st->codec->pix_fmt);
>  
>              avfilter_copy_frame_props(fb, decoded_frame);
> -            fb->pts                 = ist->pts;
>              fb->buf->priv           = buf;
>              fb->buf->free           = filter_release_buffer;
>  
>              buf->refcount++;
>              av_buffersrc_buffer(ost->input_video_filter, fb);
>          } else
> -            av_vsrc_buffer_add_frame(ost->input_video_filter, decoded_frame,
> -                                     ist->pts, 
> decoded_frame->sample_aspect_ratio);
> +            av_buffersrc_add_frame(ost->input_video_filter, decoded_frame);
>  
>          if (!ist->filtered_frame && !(ist->filtered_frame = 
> avcodec_alloc_frame())) {
>              av_free(buffer_to_free);
> diff --git a/doc/APIchanges b/doc/APIchanges
> index 9f51456..9a34b67 100644
> --- a/doc/APIchanges
> +++ b/doc/APIchanges
> @@ -13,6 +13,11 @@ libavutil:   2011-04-18
>  
>  API changes, most recent first:
>  
> +2012-01-xx - xxxxxxx - lavfi 2.16.0
> +  Add av_buffersrc_add_frame() that replaces av_vsrc_buffer_add_frame().
> +  It works pretty much the same, but does not take the pts and
> +  pixel_aspect parameters, which are now read from the frame.
> +
>  2012-01-xx - xxxxxxx - lavfi 2.15.0
>    Add a new installed header -- version.h -- with version macros.
>  
> diff --git a/libavfilter/buffersrc.h b/libavfilter/buffersrc.h
> index bd82c06..d9533cb 100644
> --- a/libavfilter/buffersrc.h
> +++ b/libavfilter/buffersrc.h
> @@ -35,4 +35,13 @@
>   */
>  int av_buffersrc_buffer(AVFilterContext *s, AVFilterBufferRef *buf);
>  
> +/**
> + * Add a frame to the filtergraph s.
> + *
> + * @param frame frame to be added.
> + * @warning frame data will be memcpy()ed, which may be a big performance
> + * issue. Use av_buffersrc_buffer() to avoid copying the data.
> + */
> +int av_buffersrc_add_frame(AVFilterContext *s, AVFrame *frame);
> +
>  #endif /* AVFILTER_BUFFERSRC_H */
> diff --git a/libavfilter/version.h b/libavfilter/version.h
> index 09d6700..9825adc 100644
> --- a/libavfilter/version.h
> +++ b/libavfilter/version.h
> @@ -29,7 +29,7 @@
>  #include "libavutil/avutil.h"
>  
>  #define LIBAVFILTER_VERSION_MAJOR  2
> -#define LIBAVFILTER_VERSION_MINOR  15
> +#define LIBAVFILTER_VERSION_MINOR  16
>  #define LIBAVFILTER_VERSION_MICRO  0
>  
>  #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
> @@ -40,4 +40,13 @@
>                                             LIBAVFILTER_VERSION_MICRO)
>  #define LIBAVFILTER_BUILD       LIBAVFILTER_VERSION_INT
>  
> +/**
> + * Those FF_API_* defines are not part of public API.
> + * They may change, break or disappear at any time.
> + */
> +#ifndef FF_API_VSRC_BUFFER_ADD_FRAME
> +#define FF_API_VSRC_BUFFER_ADD_FRAME        (LIBAVFILTER_VERSION_MAJOR < 3)
> +#endif
> +
> +
>  #endif // AVFILTER_VERSION_H
> diff --git a/libavfilter/vsrc_buffer.c b/libavfilter/vsrc_buffer.c
> index 7918094..7894e09 100644
> --- a/libavfilter/vsrc_buffer.c
> +++ b/libavfilter/vsrc_buffer.c
> @@ -84,12 +84,27 @@ static int insert_scaler(AVFilterContext *s, int width, 
> int height,
>      return 0;
>  }
>  
> +#if FF_API_VSRC_BUFFER_ADD_FRAME
>  int av_vsrc_buffer_add_frame(AVFilterContext *buffer_filter, AVFrame *frame,
>                               int64_t pts, AVRational pixel_aspect)
>  {
>      BufferSourceContext *c = buffer_filter->priv;
>      int ret;
>  
> +    if ((ret = av_buffersrc_add_frame(buffer_filter, frame)) < 0)
> +        return ret;
> +    c->buf->pts                    = pts;
> +    c->buf->video->pixel_aspect    = pixel_aspect;
> +
> +    return 0;
> +}
> +#endif
> +
> +int av_buffersrc_add_frame(AVFilterContext *buffer_filter, AVFrame *frame)
> +{
> +    BufferSourceContext *c = buffer_filter->priv;
> +    int ret;
> +
>      if (c->buf) {
>          av_log(buffer_filter, AV_LOG_ERROR,
>                 "Buffering several frames is not supported. "
> @@ -110,8 +125,6 @@ int av_vsrc_buffer_add_frame(AVFilterContext 
> *buffer_filter, AVFrame *frame,
>                    c->pix_fmt, c->w, c->h);
>  
>      avfilter_copy_frame_props(c->buf, frame);
> -    c->buf->pts                    = pts;
> -    c->buf->video->pixel_aspect    = pixel_aspect;
>  
>      return 0;
>  }
> diff --git a/libavfilter/vsrc_buffer.h b/libavfilter/vsrc_buffer.h
> index 13a209c..c18c915 100644
> --- a/libavfilter/vsrc_buffer.h
> +++ b/libavfilter/vsrc_buffer.h
> @@ -29,7 +29,10 @@
>  #include "libavcodec/avcodec.h" /* AVFrame */
>  #include "avfilter.h"
>  
> +#if FF_API_VSRC_BUFFER_ADD_FRAME
> +attribute_deprecated
>  int av_vsrc_buffer_add_frame(AVFilterContext *buffer_filter, AVFrame *frame,
>                               int64_t pts, AVRational pixel_aspect);
> +#endif
>  
>  #endif /* AVFILTER_VSRC_BUFFER_H */

ok

Janne
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to