On Thu,  1 Aug 2013 19:06:19 +0200, Vittorio Giovara 
<[email protected]> wrote:
> ---
> This make transcoding mpeg to mpeg without losing side information.
> Valgrind'd and FATE'd.
> 
> Vittorio
> 
>  libavcodec/mpegvideo_enc.c |   18 ++----------------
>  1 file changed, 2 insertions(+), 16 deletions(-)
> 
> diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
> index 98292fa..58aae5c 100644
> --- a/libavcodec/mpegvideo_enc.c
> +++ b/libavcodec/mpegvideo_enc.c
> @@ -182,19 +182,6 @@ void ff_init_qscale_tab(MpegEncContext *s)
>      }
>  }
>  
> -static void copy_picture_attributes(MpegEncContext *s, AVFrame *dst,
> -                                    const AVFrame *src)
> -{
> -    dst->pict_type              = src->pict_type;
> -    dst->quality                = src->quality;
> -    dst->coded_picture_number   = src->coded_picture_number;
> -    dst->display_picture_number = src->display_picture_number;
> -    //dst->reference              = src->reference;
> -    dst->pts                    = src->pts;
> -    dst->interlaced_frame       = src->interlaced_frame;
> -    dst->top_field_first        = src->top_field_first;
> -}
> -
>  static void update_duplicate_context_after_me(MpegEncContext *dst,
>                                                MpegEncContext *src)
>  {
> @@ -953,7 +940,7 @@ static int load_input_picture(MpegEncContext *s, const 
> AVFrame *pic_arg)
>                  }
>              }
>          }
> -        copy_picture_attributes(s, &pic->f, pic_arg);
> +        av_frame_copy_props(&pic->f, pic_arg);
>          pic->f.display_picture_number = display_picture_number;
>          pic->f.pts = pts; // we set this here to avoid modifiying pic_arg
>      }
> @@ -1293,8 +1280,7 @@ no_output_pic:
>                  return -1;
>              }
>  
> -            copy_picture_attributes(s, &pic->f,
> -                                    &s->reordered_input_picture[0]->f);
> +            av_frame_copy_props(&pic->f, &s->reordered_input_picture[0]->f);
>  
>              /* mark us unused / free shared pic */
>              av_frame_unref(&s->reordered_input_picture[0]->f);
> -- 
> 1.7.9.5
> 

Strictly speaking those functions may allocate memory, so you should check the
return value

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

Reply via email to