#if CONFIG_MPEG1_XVMC_HWACCEL
AV_PIX_FMT_XVMC,
#endif
-#if CONFIG_MPEG1_VDPAU_HWACCEL
+#if CONFIG_MPEG1_VDPAU_DECODER && FF_API_VDPAU
AV_PIX_FMT_VDPAU_MPEG1,
+#endif
+#if CONFIG_MPEG1_VDPAU_HWACCEL
AV_PIX_FMT_VDPAU,
#endif
AV_PIX_FMT_YUV420P,
#if CONFIG_MPEG2_XVMC_HWACCEL
AV_PIX_FMT_XVMC,
#endif
-#if CONFIG_MPEG2_VDPAU_HWACCEL
+#if CONFIG_MPEG_VDPAU_DECODER && FF_API_VDPAU
AV_PIX_FMT_VDPAU_MPEG2,
+#endif
+#if CONFIG_MPEG2_VDPAU_HWACCEL
AV_PIX_FMT_VDPAU,
#endif
#if CONFIG_MPEG2_DXVA2_HWACCEL
AV_PIX_FMT_D3D11VA_VLD,
#endif
#if CONFIG_MPEG2_VAAPI_HWACCEL
- AV_PIX_FMT_VAAPI_VLD,
+ AV_PIX_FMT_VAAPI,
+#endif
+#if CONFIG_MPEG2_VIDEOTOOLBOX_HWACCEL
+ AV_PIX_FMT_VIDEOTOOLBOX,
#endif
AV_PIX_FMT_YUV420P,
AV_PIX_FMT_NONE
AV_PIX_FMT_NONE
};
+#if FF_API_VDPAU
static inline int uses_vdpau(AVCodecContext *avctx) {
return avctx->pix_fmt == AV_PIX_FMT_VDPAU_MPEG1 || avctx->pix_fmt == AV_PIX_FMT_VDPAU_MPEG2;
}
+#endif
static enum AVPixelFormat mpeg_get_pixelformat(AVCodecContext *avctx)
{
static void setup_hwaccel_for_pixfmt(AVCodecContext *avctx)
{
// until then pix_fmt may be changed right after codec init
- if (avctx->hwaccel || uses_vdpau(avctx))
+ if (avctx->hwaccel
+#if FF_API_VDPAU
+ || uses_vdpau(avctx)
+#endif
+ )
if (avctx->idct_algo == FF_IDCT_AUTO)
avctx->idct_algo = FF_IDCT_SIMPLE;
case 1: avctx->chroma_sample_location = AVCHROMA_LOC_LEFT; break;
case 2:
case 3: avctx->chroma_sample_location = AVCHROMA_LOC_TOPLEFT; break;
+ default: av_assert0(0);
}
} // MPEG-2
s->avctx->level = get_bits(&s->gb, 4);
s->progressive_sequence = get_bits1(&s->gb); /* progressive_sequence */
s->chroma_format = get_bits(&s->gb, 2); /* chroma_format 1=420, 2=422, 3=444 */
+
+ if (!s->chroma_format) {
+ s->chroma_format = 1;
+ av_log(s->avctx, AV_LOG_WARNING, "Chroma format invalid\n");
+ }
+
horiz_size_ext = get_bits(&s->gb, 2);
vert_size_ext = get_bits(&s->gb, 2);
s->width |= (horiz_size_ext << 12);
if (s->avctx->hwaccel &&
(s->avctx->slice_flags & SLICE_FLAG_ALLOW_FIELD)) {
- if (s->avctx->hwaccel->end_frame(s->avctx) < 0)
+ if ((ret = s->avctx->hwaccel->end_frame(s->avctx)) < 0) {
av_log(avctx, AV_LOG_ERROR,
"hardware accelerator failed to decode first field\n");
+ return ret;
+ }
}
for (i = 0; i < 4; i++) {
return 0;
if (s->avctx->hwaccel) {
- if (s->avctx->hwaccel->end_frame(s->avctx) < 0)
+ int ret = s->avctx->hwaccel->end_frame(s->avctx);
+ if (ret < 0) {
av_log(avctx, AV_LOG_ERROR,
"hardware accelerator failed to decode picture\n");
+ return ret;
+ }
}
/* end of slice reached */
s2->er.error_count += s2->thread_context[i]->er.error_count;
}
+#if FF_API_VDPAU
if ((CONFIG_MPEG_VDPAU_DECODER || CONFIG_MPEG1_VDPAU_DECODER)
&& uses_vdpau(avctx))
ff_vdpau_mpeg_picture_complete(s2, buf, buf_size, s->slice_count);
+#endif
ret = slice_end(avctx, picture);
if (ret < 0)
return AVERROR_INVALIDDATA;
}
+#if FF_API_VDPAU
if (uses_vdpau(avctx)) {
s->slice_count++;
break;
}
+#endif
if (HAVE_THREADS &&
(avctx->active_thread_type & FF_THREAD_SLICE) &&
.init = mpeg_decode_init,
.close = mpeg_decode_end,
.decode = mpeg_decode_frame,
- .capabilities = CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1 |
- CODEC_CAP_TRUNCATED | CODEC_CAP_DELAY |
- CODEC_CAP_SLICE_THREADS,
+ .capabilities = AV_CODEC_CAP_DRAW_HORIZ_BAND | AV_CODEC_CAP_DR1 |
+ AV_CODEC_CAP_TRUNCATED | AV_CODEC_CAP_DELAY |
+ AV_CODEC_CAP_SLICE_THREADS,
.flush = flush,
.max_lowres = 3,
.update_thread_context = ONLY_IF_THREADS_ENABLED(mpeg_decode_update_thread_context)
.init = mpeg_decode_init,
.close = mpeg_decode_end,
.decode = mpeg_decode_frame,
- .capabilities = CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1 |
- CODEC_CAP_TRUNCATED | CODEC_CAP_DELAY |
- CODEC_CAP_SLICE_THREADS,
+ .capabilities = AV_CODEC_CAP_DRAW_HORIZ_BAND | AV_CODEC_CAP_DR1 |
+ AV_CODEC_CAP_TRUNCATED | AV_CODEC_CAP_DELAY |
+ AV_CODEC_CAP_SLICE_THREADS,
.flush = flush,
.max_lowres = 3,
.profiles = NULL_IF_CONFIG_SMALL(mpeg2_video_profiles),
.init = mpeg_decode_init,
.close = mpeg_decode_end,
.decode = mpeg_decode_frame,
- .capabilities = CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1 | CODEC_CAP_TRUNCATED | CODEC_CAP_DELAY | CODEC_CAP_SLICE_THREADS,
+ .capabilities = AV_CODEC_CAP_DRAW_HORIZ_BAND | AV_CODEC_CAP_DR1 | AV_CODEC_CAP_TRUNCATED | AV_CODEC_CAP_DELAY | AV_CODEC_CAP_SLICE_THREADS,
.flush = flush,
.max_lowres = 3,
};
.init = mpeg_mc_decode_init,
.close = mpeg_decode_end,
.decode = mpeg_decode_frame,
- .capabilities = CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1 |
- CODEC_CAP_TRUNCATED | CODEC_CAP_HWACCEL | CODEC_CAP_DELAY,
+ .capabilities = AV_CODEC_CAP_DRAW_HORIZ_BAND | AV_CODEC_CAP_DR1 |
+ AV_CODEC_CAP_TRUNCATED | CODEC_CAP_HWACCEL |
+ AV_CODEC_CAP_DELAY,
.flush = flush,
};
#endif
#endif /* FF_API_XVMC */
-#if CONFIG_MPEG_VDPAU_DECODER
+#if CONFIG_MPEG_VDPAU_DECODER && FF_API_VDPAU
AVCodec ff_mpeg_vdpau_decoder = {
.name = "mpegvideo_vdpau",
.long_name = NULL_IF_CONFIG_SMALL("MPEG-1/2 video (VDPAU acceleration)"),
.init = mpeg_decode_init,
.close = mpeg_decode_end,
.decode = mpeg_decode_frame,
- .capabilities = CODEC_CAP_DR1 | CODEC_CAP_TRUNCATED |
- CODEC_CAP_HWACCEL_VDPAU | CODEC_CAP_DELAY,
+ .capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_TRUNCATED |
+ AV_CODEC_CAP_HWACCEL_VDPAU | AV_CODEC_CAP_DELAY,
.flush = flush,
};
#endif
-#if CONFIG_MPEG1_VDPAU_DECODER
+#if CONFIG_MPEG1_VDPAU_DECODER && FF_API_VDPAU
AVCodec ff_mpeg1_vdpau_decoder = {
.name = "mpeg1video_vdpau",
.long_name = NULL_IF_CONFIG_SMALL("MPEG-1 video (VDPAU acceleration)"),
.init = mpeg_decode_init,
.close = mpeg_decode_end,
.decode = mpeg_decode_frame,
- .capabilities = CODEC_CAP_DR1 | CODEC_CAP_TRUNCATED |
- CODEC_CAP_HWACCEL_VDPAU | CODEC_CAP_DELAY,
+ .capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_TRUNCATED |
+ AV_CODEC_CAP_HWACCEL_VDPAU | AV_CODEC_CAP_DELAY,
.flush = flush,
};
#endif