[FFmpeg-devel] [PATCH 01/15] mpegvideo: Fix several warnings about incompatible pointer type

Michael Niedermayer michaelni at gmx.at
Fri Jul 27 19:19:52 CEST 2012


On Fri, Jul 27, 2012 at 05:23:12AM -0300, jamal wrote:
> ---
>  libavcodec/mpegvideo.h     |    2 +-
>  libavcodec/mpegvideo_enc.c |    4 ++--
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h
> index 89160d2..4445a29 100644
> --- a/libavcodec/mpegvideo.h
> +++ b/libavcodec/mpegvideo.h
> @@ -757,7 +757,7 @@ void ff_MPV_frame_end(MpegEncContext *s);
>  int ff_MPV_encode_init(AVCodecContext *avctx);
>  int ff_MPV_encode_end(AVCodecContext *avctx);
>  int ff_MPV_encode_picture(AVCodecContext *avctx, AVPacket *pkt,
> -                          AVFrame *frame, int *got_packet);
> +                          const AVFrame *frame, int *got_packet);
>  void ff_MPV_common_init_mmx(MpegEncContext *s);
>  void ff_MPV_common_init_axp(MpegEncContext *s);
>  void ff_MPV_common_init_mmi(MpegEncContext *s);
> diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
> index f3f7162..3e9204d 100644
> --- a/libavcodec/mpegvideo_enc.c
> +++ b/libavcodec/mpegvideo_enc.c
> @@ -1445,7 +1445,7 @@ no_output_pic:
>  }
>  
>  int ff_MPV_encode_picture(AVCodecContext *avctx, AVPacket *pkt,
> -                          AVFrame *pic_arg, int *got_packet)
> +                          const AVFrame *pic_arg, int *got_packet)
>  {
>      MpegEncContext *s = avctx->priv_data;
>      int i, stuffing_count, ret;
> @@ -1453,7 +1453,7 @@ int ff_MPV_encode_picture(AVCodecContext *avctx, AVPacket *pkt,
>  
>      s->picture_in_gop_number++;
>  
> -    if (load_input_picture(s, pic_arg) < 0)
> +    if (load_input_picture(s, (AVFrame *)pic_arg) < 0)
>          return -1;

this may fix the warnings but the code casts the const away and then
changes some fields in it
thus the problem that the warnings point to is not fixed just the
warnings hidden

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

Rewriting code that is poorly written but fully understood is good.
Rewriting code that one doesnt understand is a sign that one is less smart
then the original author, trying to rewrite it will not make it better.
-------------- 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/20120727/d363df4a/attachment.asc>


More information about the ffmpeg-devel mailing list