git.videolan.org
/
ffmpeg.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
nuv: do not rely on get_buffer() initializing the frame.
[ffmpeg.git]
/
libavcodec
/
nuv.c
diff --git
a/libavcodec/nuv.c
b/libavcodec/nuv.c
index
f7d348a
..
bba4df3
100644
(file)
--- a/
libavcodec/nuv.c
+++ b/
libavcodec/nuv.c
@@
-149,7
+149,7
@@
static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
AVFrame *picture = data;
int orig_size = buf_size;
int keyframe;
AVFrame *picture = data;
int orig_size = buf_size;
int keyframe;
- int result;
+ int result
, init_frame = !avctx->frame_number
;
enum {
NUV_UNCOMPRESSED = '0',
NUV_RTJPEG = '1',
enum {
NUV_UNCOMPRESSED = '0',
NUV_RTJPEG = '1',
@@
-221,8
+221,10
@@
static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
buf_size -= RTJPEG_HEADER_SIZE;
}
buf_size -= RTJPEG_HEADER_SIZE;
}
- if (keyframe && c->pic.data[0])
+ if (keyframe && c->pic.data[0])
{
avctx->release_buffer(avctx, &c->pic);
avctx->release_buffer(avctx, &c->pic);
+ init_frame = 1;
+ }
c->pic.reference = 3;
c->pic.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_READABLE |
FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE;
c->pic.reference = 3;
c->pic.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_READABLE |
FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE;
@@
-231,6
+233,11
@@
static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return result;
}
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return result;
}
+ if (init_frame) {
+ memset(c->pic.data[0], 0, avctx->height * c->pic.linesize[0]);
+ memset(c->pic.data[1], 0x80, avctx->height * c->pic.linesize[1] / 2);
+ memset(c->pic.data[2], 0x80, avctx->height * c->pic.linesize[2] / 2);
+ }
c->pic.pict_type = keyframe ? AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_P;
c->pic.key_frame = keyframe;
c->pic.pict_type = keyframe ? AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_P;
c->pic.key_frame = keyframe;