Il 16/02/2011 14:14, Gilles Maire ha scritto:
Hi Lorenzo

Perhaps you forget to make a

int size = avpicture_get_size(avctx->fmt, avctx->width, avctx->height);
tempFrame = av_malloc(size*sizeof(uint8_t));

before your
avpicture_fill ((AVPicture *)tempFrame,(uint8_t
*)img.data,PIX_FMT_BGR24,img.width,img.height)

After don't forget to free the tempFrame.


Cheers


Gilles Maire

2011/2/16 Lorenzo Mattiussi<[email protected]>

hi all,
I've a problem, when the program execute avpicture_fill, I find this
message error:
Unhandled exception at 0x632415fe in EraEndo.exe:0xC0000005: Access
violation writing location 0xcdcdcddd.
Someone can help me?!?
This is the code:
int videoCode::comprimi(const ImageData&img,AVPacket&pack)//PAck deve giĆ 
essere stato inizializzato
{

    uint8_t *tempFramebuf;
    int sizebuf;
    int x;
    frameMutex->lock();
    //riempo un immagine temporanea con i dati provenienti dalla webcam
    x = avpicture_fill ((AVPicture *)tempFrame,(uint8_t
*)img.data,PIX_FMT_BGR24,img.width,img.height)
...

where imageData is this structure:

struct ImageData
{
    // In DirectShow standard RGB formats
    // have an inverted memory layout
    enum Format {BGR24, BGR32};

    Format format;
    unsigned char* data;
    long dataSize;
    int width;
    int height;
};




_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user

_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user
Tnx for your replay
In a early function that initialize all FFmpeg parameter, I initialize tempFrame with this methods:

tempFrame = avcodec_alloc_frame();

I can't make:

int size = avpicture_get_size(avctx->fmt, avctx->width, avctx->height);
tempFrame = av_malloc(size*sizeof(uint8_t));

because the compiler say " Impossible conversion from 'void *' to 'AVFrame *' " at av_malloc function

_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user

Reply via email to