]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/mmaldec.c
mjpegdec: consider chroma subsampling in size check
[ffmpeg] / libavcodec / mmaldec.c
index 91fb084e1004d0ed1306b4c5079f85177de9c85c..281071cc808d3e96052b7bfbcf82970e66a3f77a 100644 (file)
@@ -160,6 +160,9 @@ static void ffmmal_stop_decoder(AVCodecContext *avctx)
 
         ctx->waiting_buffers = buffer->next;
 
+        if (buffer->flags & MMAL_BUFFER_HEADER_FLAG_FRAME_END)
+            avpriv_atomic_int_add_and_fetch(&ctx->packets_buffered, -1);
+
         av_buffer_unref(&buffer->ref);
         av_free(buffer);
     }
@@ -355,6 +358,10 @@ static av_cold int ffmmal_init_decoder(AVCodecContext *avctx)
             format_in->encoding = MMAL_ENCODING_MP2V;
             av_log(avctx, AV_LOG_DEBUG, "Use MMAL MP2V encoding\n");
             break;
+        case AV_CODEC_ID_VC1:
+            format_in->encoding = MMAL_ENCODING_WVC1;
+            av_log(avctx, AV_LOG_DEBUG, "Use MMAL WVC1 encoding\n");
+            break;
         case AV_CODEC_ID_H264:
         default:
             format_in->encoding = MMAL_ENCODING_H264;
@@ -469,6 +476,8 @@ static int ffmmal_add_packet(AVCodecContext *avctx, AVPacket *avpkt,
         if (!is_extradata)
             ctx->packets_sent++;
     } else {
+        if (ctx->eos_sent)
+            goto done;
         if (!ctx->packets_sent) {
             // Short-cut the flush logic to avoid upsetting MMAL.
             ctx->eos_sent = 1;
@@ -783,6 +792,13 @@ AVHWAccel ff_mpeg2_mmal_hwaccel = {
     .pix_fmt    = AV_PIX_FMT_MMAL,
 };
 
+AVHWAccel ff_vc1_mmal_hwaccel = {
+    .name       = "vc1_mmal",
+    .type       = AVMEDIA_TYPE_VIDEO,
+    .id         = AV_CODEC_ID_VC1,
+    .pix_fmt    = AV_PIX_FMT_MMAL,
+};
+
 static const AVOption options[]={
     {"extra_buffers", "extra buffers", offsetof(MMALDecodeContext, extra_buffers), AV_OPT_TYPE_INT, {.i64 = 10}, 0, 256, 0},
     {NULL}
@@ -817,3 +833,4 @@ static const AVOption options[]={
 
 FFMMAL_DEC(h264, AV_CODEC_ID_H264)
 FFMMAL_DEC(mpeg2, AV_CODEC_ID_MPEG2VIDEO)
+FFMMAL_DEC(vc1, AV_CODEC_ID_VC1)