Sorry if I wasted anyone's time. I have figured it out. The message about
sw_scale expecting a const uint_t * const * was just a warning. There is no
problem casting a "uint_t **" to this, as you would expect, and older gcc
versions don't even warn  about it. The reason it did not compile was
because i forgot to include the swscale library.

On Tue, Mar 2, 2010 at 1:12 PM, Kaspar Bumke <[email protected]> wrote:

> I am forwarding this question from ffmpeg-user to libav-user as I have
> gotten no responses.
>
> ---------- Forwarded message ----------
> From: Kaspar Bumke <[email protected]>
> Date: Sat, Feb 27, 2010 at 10:34 PM
> Subject: swscale and AVFrame use of const
> To: [email protected]
>
>
> Hi,
>
> I have been trying to follow a simple tutorial on writing a player for
> ffmpeg: http://dranger.com/ffmpeg/tutorial01.html
>
> It is a little outdated as I am using ffmpeg SVN-r21688 but I have replaced
> img_convert with sws_scale as follows:
>
> --- tutorial01_old.c  2010-02-27 22:06:43.000000000 +0000
> +++ tutorial01.c  2010-02-27 22:17:35.000000000 +0000
>
>
> (...)
>
> @@ -124,17 +125,23 @@
>      // Is this a packet from the video stream?
>      if(packet.stream_index==videoStream) {
>        // Decode video frame
> -      avcodec_decode_video(pCodecCtx, pFrame, &frameFinished,
> -        packet.data, packet.size);
> +     avcodec_decode_video2(pCodecCtx, pFrame, &frameFinished,
> +        &packet);
>
>        // Did we get a video frame?
>        if(frameFinished) {
>   // Convert the image from its native format to RGB
> - img_convert((AVPicture *)pFrameRGB, PIX_FMT_RGB24,
> -                    (AVPicture*)pFrame, pCodecCtx->pix_fmt,
> pCodecCtx->width,
> -                    pCodecCtx->height);
> -
> - // Save the frame to disk
> +
> +       convert_ctx = sws_getContext( pCodecCtx->width,
> +                                     pCodecCtx->height,
> +                                     pCodecCtx->pix_fmt,
> +                                     pCodecCtx->width,
> +                                     pCodecCtx->height,
> +                                     PIX_FMT_RGB24,
> +                                      SWS_BILINEAR, 0, 0, 0);
> +
> +       sws_scale(convert_ctx, pFrame->data, pFrame->linesize, 0,
> pCodecCtx->height, pFrameRGB->data, pFrameRGB->linesize);
> +
>   if(++i<=5)
>     SaveFrame(pFrameRGB, pCodecCtx->width, pCodecCtx->height,
>         i);
>
> I have attached the whole modified file which should be compiled with:
>
> gcc -o tutorial01 tutorial01.c -lavformat -lavcodec -lz
>
> The problem is during compilation it says sws_scale expexts a ‘const
> uint8_t * const*’ but argument is of type ‘uint8_t **’ in the second field.
> I have been lookign at the doxygen documentation and other peoples players
> and trying all sorts of things but I cannot figure out how to change and
> AVFrame->data to a const or what what I should really be passing to
> sws_scale in the second field.
>
> Any help at all would be greatly appreciated.
>
> --Kaspar
>
> P.S.
> This similar implementation has exactly the same problem:
>
>
> http://web.me.com/dhoerl/Home/Tech_Blog/Entries/2009/1/22_Revised_avcodec_sample.c_files/avcodec_sample.0.5.0.c
>
>
>
>
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user

Reply via email to