[FFmpeg-devel] [PATCH] lavfi/avcodec: always use av_frame* accessors in avfilter_copy_buf_props()

Michael Niedermayer michaelni at gmx.at
Tue Jun 19 02:32:00 CEST 2012


On Tue, Jun 19, 2012 at 01:31:13AM +0200, Stefano Sabatini wrote:
> Use av_frame_* accessors for the newly added fields in AVFrame (for which
> we are supposed to use such accessors), and group the istructions
> accordingly.
> ---
>  libavfilter/avcodec.c |    7 +++----
>  1 files changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/libavfilter/avcodec.c b/libavfilter/avcodec.c
> index d6cd4d1..aa98334 100644
> --- a/libavfilter/avcodec.c
> +++ b/libavfilter/avcodec.c
> @@ -93,8 +93,8 @@ int avfilter_copy_buf_props(AVFrame *dst, const AVFilterBufferRef *src)
>      memcpy(dst->linesize, src->linesize, sizeof(dst->linesize));
>  
>      dst->pts     = src->pts;
> -    dst->pkt_pos = src->pos;
>      dst->format  = src->format;
> +    av_frame_set_pkt_pos(dst, src->pos);
>  
>      switch (src->type) {
>      case AVMEDIA_TYPE_VIDEO:

LGTM


> @@ -120,10 +120,9 @@ int avfilter_copy_buf_props(AVFrame *dst, const AVFilterBufferRef *src)
>                     planes * sizeof(dst->extended_data));
>          } else
>              dst->extended_data = dst->data;
> -
> -        dst->sample_rate         = src->audio->sample_rate;
> -        dst->channel_layout      = src->audio->channel_layout;
>          dst->nb_samples          = src->audio->nb_samples;
> +        av_frame_set_sample_rate   (dst, src->audio->sample_rate);
> +        av_frame_set_channel_layout(dst, src->audio->channel_layout);
>          break;

iam not 100% sure these are still needed but it might help
compatibility with older versions ...


[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Freedom in capitalist society always remains about the same as it was in
ancient Greek republics: Freedom for slave owners. -- Vladimir Lenin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120619/acdf3579/attachment.asc>


More information about the ffmpeg-devel mailing list