Marc Mason wrote:
I'm not sure how to convince avcodec_decode_video() to output an
uncompressed picture to a user-supplied buffer.
avctx.get_buffer is set to avcodec_default_get_buffer() by default.
Do I need to provide my own function? Do I also need to provide
release_buffer? reget_buffer? get_format? other?
If I code the following (error-handling omitted for concision).
av_register_all();
AVCodec *codec = avcodec_find_decoder(CODEC_ID_MJPEG);
AVCodecContext *context = avcodec_alloc_context();
avcodec_open(context, codec);
AVFrame frame;
int foo;
avcodec_decode_video(context, &frame, &foo, inbuf, size);
then ff_mjpeg_decode_frame allocates an internal buffer to hold the
compressed picture once 0xff escapes have been deleted.
The main problem is in avcodec_default_get_buffer, where a buffer is
allocated for each uncompressed component.
for(i=0; i<4 && size[i]; i++) {
const int h_shift= i==0 ? 0 : h_chroma_shift;
const int v_shift= i==0 ? 0 : v_chroma_shift;
buf->linesize[i]= picture.linesize[i];
buf->base[i]= av_malloc(size[i]+16); //FIXME 16
#0 avcodec_default_get_buffer at libavcodec/utils.c:298
#1 0x005669cf in ff_mjpeg_decode_sof at libavcodec/mjpegdec.c:334
#2 0x0056ac38 in ff_mjpeg_decode_frame at libavcodec/mjpegdec.c:1396
I'm confused...
--
Regards.
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user