[FFmpeg-devel] [PATCH] lavfi: Update AVFrame<->AVFillterBufferRef props copying.

Nicolas George nicolas.george at normalesup.org
Fri May 4 12:22:03 CEST 2012


Le sextidi 16 floréal, an CCXX, Robert Nagy a écrit :
>  int avfilter_copy_frame_props(AVFilterBufferRef *dst, const AVFrame *src)
>  {
>      dst->pts    = src->pts;
> -    dst->pos    = src->pkt_pos;
> +    dst->pos    = av_frame_get_pkt_pos(src);
>      dst->format = src->format;

Looks good.

>  
>      switch (dst->type) {
> @@ -38,6 +38,11 @@ int avfilter_copy_frame_props(AVFilterBufferRef *dst, const AVFrame *src)
>          dst->video->top_field_first     = src->top_field_first;
>          dst->video->key_frame           = src->key_frame;
>          dst->video->pict_type           = src->pict_type;
> +        break;
> +    case AVMEDIA_TYPE_AUDIO:
> +        dst->audio->sample_date         = av_frame_get_sample_rate(src);
> +        dst->audio->channel_layout      = av_frame_get_channel_layout(src);
> +        dst->audio->nb_samples          = src->nb_samples;
> +        break;

Redundant with an incoming patch of mine.

>      return 0;
> @@ -63,10 +68,12 @@ int avfilter_fill_frame_from_audio_buffer_ref(AVFrame *frame,
>          return AVERROR(EINVAL);
>  
>      memcpy(frame->data, samplesref->data, sizeof(frame->data));
> -    frame->pkt_pos    = samplesref->pos;
> +    av_frame_set_pkt_pos(frame->pkt_pos, samplesref->pos);
>      frame->format     = samplesref->format;
>      frame->nb_samples = samplesref->audio->nb_samples;
>      frame->pts        = samplesref->pts;
> +    av_frame_set_channel_layout(frame, samplesref->audio->channel_layout);
> +    av_frame_set_sample_rate(frame, samplesref->audio->sample_rate);
>  
>      return 0;
>  }
> @@ -79,7 +86,7 @@ int avfilter_fill_frame_from_video_buffer_ref(AVFrame *frame,
>  
>      memcpy(frame->data,     picref->data,     sizeof(frame->data));
>      memcpy(frame->linesize, picref->linesize, sizeof(frame->linesize));
> -    frame->pkt_pos          = picref->pos;
> +    av_frame_set_pkt_pos(frame->pkt_pos, picref->pos);
>      frame->interlaced_frame = picref->video->interlaced;
>      frame->top_field_first  = picref->video->top_field_first;
>      frame->key_frame        = picref->video->key_frame;

Looks good, thanks.

Regards,

-- 
  Nicolas George


More information about the ffmpeg-devel mailing list