[FFmpeg-devel] [PATCH]Fix MPEG-2 decoding of interlaced streams with hwaccel

Carl Eugen Hoyos cehoyos at ag.or.at
Tue Apr 10 07:51:48 CEST 2012


Hi!

Attached patch fixes MPEG-2 interlaced decoding with hwaccel.
The accelerator needs to decode the field pictures when they are complete, in 
case of an error, the function returns -1.

Please comment, Carl Eugen
-------------- next part --------------
diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c
index ea19b81..4abb145 100644
--- a/libavcodec/mpeg12.c
+++ b/libavcodec/mpeg12.c
@@ -1641,6 +1641,11 @@ static int mpeg_field_start(MpegEncContext *s, const uint8_t *buf, int buf_size)
                 av_log(avctx, AV_LOG_ERROR, "hardware accelerator failed to decode first field\n");
         }
 
+        if (avctx->hwaccel && avctx->hwaccel->end_frame(avctx) < 0) {
+            av_log(avctx, AV_LOG_ERROR, "hardware accelerator failed to decode first field\n");
+            return -1;
+        }
+
         for (i = 0; i < 4; i++) {
             s->current_picture.f.data[i] = s->current_picture_ptr->f.data[i];
             if (s->picture_structure == PICT_BOTTOM_FIELD) {


More information about the ffmpeg-devel mailing list