[FFmpeg-devel] Implemented non key frame support in NUV decoder
Reimar Döffinger
Reimar.Doeffinger
Tue Sep 2 21:02:47 CEST 2008
On Tue, Sep 02, 2008 at 07:52:10PM +0200, Laurent Aimar wrote:
> The attached patch provides non key frame support in NUV decoder.
How to reproduce the difference?
> @@ -159,6 +160,7 @@
> return -1;
> }
> comptype = buf[1];
> + key_frame = buf[2] == 0;
Are you sure this is always correctly set?
> @@ -184,18 +186,26 @@
> buf_size -= 12;
> }
>
> - if (c->pic.data[0])
> - avctx->release_buffer(avctx, &c->pic);
> c->pic.reference = 1;
> c->pic.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_READABLE |
> FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE;
> - if (avctx->get_buffer(avctx, &c->pic) < 0) {
> - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
> - return -1;
> + if (key_frame) {
> + if (c->pic.data[0])
> + avctx->release_buffer(avctx, &c->pic);
> +
> + if (avctx->get_buffer(avctx, &c->pic) < 0) {
> + av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
> + return -1;
> + }
> + } else {
> + if (avctx->reget_buffer(avctx, &c->pic) < 0) {
> + av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n");
> + return -1;
> + }
I just misunderstood the API. IMO the best solution would be to remove
the release_buffer call and replace get_buffer with reget_buffer - that
was the effect that I think I originally intended.
> }
>
> - c->pic.pict_type = FF_I_TYPE;
> - c->pic.key_frame = 1;
> + c->pic.pict_type = key_frame ? FF_I_TYPE : FF_P_TYPE;
> + c->pic.key_frame = key_frame;
That might a good idea, but possibly in an extra step.
Greetings,
Reimar D?ffinger
More information about the ffmpeg-devel
mailing list