support buffers containing more than one frame

Originally committed as revision 1016 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Fabrice Bellard 2002-10-09 12:35:22 +00:00
parent f20dca4020
commit d017ab70f4
1 changed files with 8 additions and 8 deletions

View File

@ -494,7 +494,7 @@ static int dvvideo_decode_frame(AVCodecContext *avctx,
UINT8 *buf, int buf_size) UINT8 *buf, int buf_size)
{ {
DVVideoDecodeContext *s = avctx->priv_data; DVVideoDecodeContext *s = avctx->priv_data;
int sct, dsf, apt, ds, nb_dif_segs, vs, size, width, height, i; int sct, dsf, apt, ds, nb_dif_segs, vs, size, width, height, i, packet_size;
UINT8 *buf_ptr; UINT8 *buf_ptr;
const UINT16 *mb_pos_ptr; const UINT16 *mb_pos_ptr;
AVPicture *picture; AVPicture *picture;
@ -531,17 +531,18 @@ static int dvvideo_decode_frame(AVCodecContext *avctx,
/* init size */ /* init size */
width = 720; width = 720;
if (dsf) { if (dsf) {
if (buf_size != PAL_FRAME_SIZE) packet_size = PAL_FRAME_SIZE;
return -1;
height = 576; height = 576;
nb_dif_segs = 12; nb_dif_segs = 12;
} else { } else {
if (buf_size != NTSC_FRAME_SIZE) packet_size = NTSC_FRAME_SIZE;
return -1;
height = 480; height = 480;
nb_dif_segs = 10; nb_dif_segs = 10;
} }
/* NOTE: we only accept several full frames */
if (buf_size < packet_size)
return -1;
/* XXX: is it correct to assume that 420 is always used in PAL /* XXX: is it correct to assume that 420 is always used in PAL
mode ? */ mode ? */
s->sampling_411 = !dsf; s->sampling_411 = !dsf;
@ -604,8 +605,7 @@ static int dvvideo_decode_frame(AVCodecContext *avctx,
picture->data[i] = s->current_picture[i]; picture->data[i] = s->current_picture[i];
picture->linesize[i] = s->linesize[i]; picture->linesize[i] = s->linesize[i];
} }
return packet_size;
return buf_size;
} }
static int dvvideo_decode_end(AVCodecContext *avctx) static int dvvideo_decode_end(AVCodecContext *avctx)