[Libav-user] AVFormatContext buffer flush

Shawn Donnelly scdmusic at gmail.com
Wed Feb 27 14:19:15 CET 2013


I have set up a custom AVIOContext that takes a callback function and
writes out data to a buffer.

static int WritePacket(void *opaque, uint8_t *pBuffer, int pBufferSize) {
    printf("Writen to file %i\n",pBufferSize);
    return fwrite(pBuffer, pBufferSize, 1, FileOut);
}

int BUFFERSIZE= 32768;
AVIOContext *pAVIOContext= NULL;
unsigned char *pBufferCallBack= (unsigned char*)av_malloc(BUFFERSIZE *
sizeof(uint8_t));
pAVIOContext= avio_alloc_context(pBufferCallBack, BUFFERSIZE, 1, NULL,
NULL, WritePacket, NULL);

After avformat_write_header I would like to flush that to direct to the
buffer before I write any frames to the buffer.  As of now it takes a 30
frames before that buffer flushes.  I need access to the header before
frames are written.  I tried avio_flush, but that didn't seem to do
anything.

Is there a way I can do this?

Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20130227/eed70302/attachment.html>


More information about the Libav-user mailing list