I am trying to implement a custom IO read, where I have some jpeg frames coming
as byte array and I have to decode them for later processing.For now my
function just read the first two successive frames, then the call to
avformat_open_input return -1094995529
uint8_t* buffer = NULL, * avioCxt_buffer = NULL; buffer_data bd;
int ret = 0;
bd.ptr = (uint8_t *) pJPEGFrame; bd.size = len;
// allocate the context data structure if (
(*outputFormatCxt = avformat_alloc_context() ) == NULL) {
fprintf(stderr, "convert_JPEG_Frame_TO_AVFrame @line(%d) - failed to
allocate memory for context", __LINE__); return -1;
}
if ( (avioCxt_buffer = (uint8_t *) av_malloc(len)) == NULL)
{ fprintf(stderr, "convert_JPEG_Frame_TO_AVFrame
@line(%d) - failed to allocate memory", __LINE__);
avformat_close_input(outputFormatCxt); return -1;
}
if ( (*pAvIOCxt = avio_alloc_context(avioCxt_buffer, len, 0,
&bd, read_packet, NULL, NULL)) == NULL) {
fprintf(stderr, "convert_JPEG_Frame_TO_AVFrame @line(%d) - failed to allocate
memory", __LINE__); return -1; }
(*outputFormatCxt)->pb = *pAvIOCxt; if ( (ret =
avformat_open_input(outputFormatCxt, NULL, NULL, NULL)) < 0) {
fprintf(stderr, "convert_JPEG_Frame_TO_AVFrame @line(%d) -
failed to allocate memory", __LINE__); return -1;
}
I am following the avio_read example using the same read callback function for
the avio context.
Thanks in advance. _______________________________________________
Libav-user mailing list
[email protected]
http://ffmpeg.org/mailman/listinfo/libav-user