summaryrefslogtreecommitdiff
path: root/libavcodec/mpeg12.c
diff options
context:
space:
mode:
authorBaptiste Coudurier <baptiste.coudurier@gmail.com>2009-07-01 17:29:52 +0000
committerBaptiste Coudurier <baptiste.coudurier@gmail.com>2009-07-01 17:29:52 +0000
commitf7f1eb6cc9ce3e22dc48d20191eedc10008d878f (patch)
tree588d703ccea32474e85d37f7228867012c872c8b /libavcodec/mpeg12.c
parent39c601b5e7e03ae13d1946149ace7c8b617c7ef3 (diff)
simplify slice_end, return size of output frame
Originally committed as revision 19317 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/mpeg12.c')
-rw-r--r--libavcodec/mpeg12.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c
index 477e99c444..f5410b1fce 100644
--- a/libavcodec/mpeg12.c
+++ b/libavcodec/mpeg12.c
@@ -1935,7 +1935,7 @@ static int slice_decode_thread(AVCodecContext *c, void *arg){
/**
* Handles slice ends.
- * @return 1 if it seems to be the last slice
+ * @return sizeof(AVFrame) if a frame is output, 0 otherwise
*/
static int slice_end(AVCodecContext *avctx, AVFrame *pict)
{
@@ -1966,6 +1966,7 @@ static int slice_end(AVCodecContext *avctx, AVFrame *pict)
if (s->pict_type == FF_B_TYPE || s->low_delay) {
*pict= *(AVFrame*)s->current_picture_ptr;
ff_print_debug_info(s, pict);
+ return sizeof(*pict);
} else {
s->picture_number++;
/* latency of 1 frame for I- and P-frames */
@@ -1973,13 +1974,11 @@ static int slice_end(AVCodecContext *avctx, AVFrame *pict)
if (s->last_picture_ptr != NULL) {
*pict= *(AVFrame*)s->last_picture_ptr;
ff_print_debug_info(s, pict);
+ return sizeof(*pict);
}
}
-
- return 1;
- } else {
- return 0;
}
+ return 0;
}
static int mpeg1_decode_sequence(AVCodecContext *avctx,
@@ -2317,10 +2316,7 @@ static int decode_chunks(AVCodecContext *avctx,
if (CONFIG_MPEG_VDPAU_DECODER && avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU)
ff_vdpau_mpeg_picture_complete(s2, buf, buf_size, s->slice_count);
- if (slice_end(avctx, picture)) {
- if(s2->last_picture_ptr || s2->low_delay) //FIXME merge with the stuff in mpeg_decode_slice
- *data_size = sizeof(AVPicture);
- }
+ *data_size = slice_end(avctx, picture);
}
s2->pict_type= 0;
return FFMAX(0, buf_ptr - buf - s2->parse_context.last_index);