[libav-devel] [PATCH 04/13] vaapi: add a mpeg1 hwaccel.

Anton Khirnov anton at khirnov.net
Thu Nov 21 11:50:54 CET 2013


mpeg12 decoder passes the vaapi pixel format to get_format for both
mpeg 1 and 2. If the caller chooses vaapi for mpeg1, the decoder will
crash after failing to find a hwaccel for it.
---
 libavcodec/allcodecs.c   |    1 +
 libavcodec/vaapi_mpeg2.c |   10 ++++++++++
 2 files changed, 11 insertions(+)

diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 6453e30..8159fa4 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -80,6 +80,7 @@ void avcodec_register_all(void)
     REGISTER_HWACCEL(H264_VAAPI,        h264_vaapi);
     REGISTER_HWACCEL(H264_VDA,          h264_vda);
     REGISTER_HWACCEL(H264_VDPAU,        h264_vdpau);
+    REGISTER_HWACCEL(MPEG1_VAAPI,       mpeg1_vaapi);
     REGISTER_HWACCEL(MPEG1_VDPAU,       mpeg1_vdpau);
     REGISTER_HWACCEL(MPEG2_DXVA2,       mpeg2_dxva2);
     REGISTER_HWACCEL(MPEG2_VAAPI,       mpeg2_vaapi);
diff --git a/libavcodec/vaapi_mpeg2.c b/libavcodec/vaapi_mpeg2.c
index b773765..02b50f0 100644
--- a/libavcodec/vaapi_mpeg2.c
+++ b/libavcodec/vaapi_mpeg2.c
@@ -132,6 +132,16 @@ static int vaapi_mpeg2_decode_slice(AVCodecContext *avctx, const uint8_t *buffer
     return 0;
 }
 
+AVHWAccel ff_mpeg1_vaapi_hwaccel = {
+    .name           = "mpeg1_vaapi",
+    .type           = AVMEDIA_TYPE_VIDEO,
+    .id             = AV_CODEC_ID_MPEG1VIDEO,
+    .pix_fmt        = AV_PIX_FMT_VAAPI_VLD,
+    .start_frame    = vaapi_mpeg2_start_frame,
+    .end_frame      = ff_vaapi_mpeg_end_frame,
+    .decode_slice   = vaapi_mpeg2_decode_slice,
+};
+
 AVHWAccel ff_mpeg2_vaapi_hwaccel = {
     .name           = "mpeg2_vaapi",
     .type           = AVMEDIA_TYPE_VIDEO,
-- 
1.7.10.4



More information about the libav-devel mailing list