[Libav-user] A question about sws_scale and pointer types

James Felix Black jfb at homonculus.net
Wed Sep 28 04:06:49 CEST 2011


All,

I have a chunk of code that creates an AVPicture from a raw stream of YUV420P, and rescales it.  Easy-peasy, but I'm getting the error:

zc_libav.c:29: error: passing argument 2 of ‘sws_scale’ from incompatible pointer type

(I run -pedantic-errors when building test builds.)

Looking at libswscale/swscale.h, I see that the function signature is:

int sws_scale(struct SwsContext *c, const uint8_t* const srcSlice[],
              const int srcStride[], int srcSliceY, int srcSliceH,
              uint8_t* const dst[], const int dstStride[]);

My code (assume that in_pic and out_pic are properly generated AVPictures):

  sws_scale(sws_ctx, 
            in_pic->data,
            in_pic->linesize, 
            0, 
            in->y, 
            out_pic->data, 
            out_pic->linesize); 

I'm happy to cast that 'in_pic->data' to get the compiler to shut up, but I don't know how.  If I turn off errors (-pedantic), it compiles and runs fine.  So this is really about my neurotic need not to see warnings, I guess.  But I'm still curious as to how someone with more C experience would handle this.  Am I doomed to special-casing this makefile rule to turn off -pedantic-errors?  That would make me sad, but then again, there is much that makes me sad.

TIA,
~ jfb

-- 
James Felix Black <jfb at homonculus.net>
"Some strangey that!"
Words: http://homonculus.net

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4225 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20110927/75014dee/attachment.p7s>


More information about the Libav-user mailing list