diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-08-17 15:31:14 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-08-17 22:17:49 +0200 |
commit | a0c6c8e53ebc32cebcc0182e514cecc6eb30c8a7 (patch) | |
tree | add4728a4e1bbc762e5c058259103e659455217a /libavcodec/mpeg12dec.c | |
parent | 0a141b0e49ba3989a28f5f006a978bdab92a9217 (diff) | |
download | ffmpeg-a0c6c8e53ebc32cebcc0182e514cecc6eb30c8a7.tar.gz |
Revert "Merge commit of 'vdpau: remove old-style decoders'"
This reverts commit bf36dc50ea448999c8f8c7a35f6139a7040f6275, reversing
changes made to b7fc2693c70fe72936e4ce124c802ac23857c476.
Conflicts:
libavcodec/h264.c
Keeping support for the old VDPAU API has been requested by our VDPAU maintainer
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/mpeg12dec.c')
-rw-r--r-- | libavcodec/mpeg12dec.c | 48 |
1 files changed, 47 insertions, 1 deletions
diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c index 93a11a149b..4e7b944813 100644 --- a/libavcodec/mpeg12dec.c +++ b/libavcodec/mpeg12dec.c @@ -35,6 +35,7 @@ #include "mpeg12.h" #include "mpeg12data.h" #include "bytestream.h" +#include "vdpau_internal.h" #include "xvmc_internal.h" #include "thread.h" @@ -1152,6 +1153,10 @@ static const enum AVPixelFormat mpeg2_hwaccel_pixfmt_list_420[] = { AV_PIX_FMT_NONE }; +static inline int uses_vdpau(AVCodecContext *avctx) { + return avctx->pix_fmt == AV_PIX_FMT_VDPAU_MPEG1 || avctx->pix_fmt == AV_PIX_FMT_VDPAU_MPEG2; +} + static enum AVPixelFormat mpeg_get_pixelformat(AVCodecContext *avctx) { Mpeg1Context *s1 = avctx->priv_data; @@ -1178,7 +1183,7 @@ static void setup_hwaccel_for_pixfmt(AVCodecContext *avctx) avctx->hwaccel = ff_find_hwaccel(avctx->codec->id, avctx->pix_fmt); // until then pix_fmt may be changed right after codec init if (avctx->pix_fmt == AV_PIX_FMT_XVMC_MPEG2_IDCT || - avctx->hwaccel) + avctx->hwaccel || uses_vdpau(avctx)) if (avctx->idct_algo == FF_IDCT_AUTO) avctx->idct_algo = FF_IDCT_SIMPLE; } @@ -2165,6 +2170,10 @@ static int decode_chunks(AVCodecContext *avctx, s2->er.error_count += s2->thread_context[i]->er.error_count; } + if ((CONFIG_MPEG_VDPAU_DECODER || CONFIG_MPEG1_VDPAU_DECODER) + && uses_vdpau(avctx)) + ff_vdpau_mpeg_picture_complete(s2, buf, buf_size, s->slice_count); + ret = slice_end(avctx, picture); if (ret < 0) return ret; @@ -2392,6 +2401,11 @@ static int decode_chunks(AVCodecContext *avctx, return AVERROR_INVALIDDATA; } + if (uses_vdpau(avctx)) { + s->slice_count++; + break; + } + if (HAVE_THREADS && (avctx->active_thread_type & FF_THREAD_SLICE) && !avctx->hwaccel) { int threshold = (s2->mb_height * s->slice_count + @@ -2608,3 +2622,35 @@ AVCodec ff_mpeg_xvmc_decoder = { }; #endif + +#if CONFIG_MPEG_VDPAU_DECODER +AVCodec ff_mpeg_vdpau_decoder = { + .name = "mpegvideo_vdpau", + .type = AVMEDIA_TYPE_VIDEO, + .id = AV_CODEC_ID_MPEG2VIDEO, + .priv_data_size = sizeof(Mpeg1Context), + .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, + .flush = flush, + .long_name = NULL_IF_CONFIG_SMALL("MPEG-1/2 video (VDPAU acceleration)"), +}; +#endif + +#if CONFIG_MPEG1_VDPAU_DECODER +AVCodec ff_mpeg1_vdpau_decoder = { + .name = "mpeg1video_vdpau", + .type = AVMEDIA_TYPE_VIDEO, + .id = AV_CODEC_ID_MPEG1VIDEO, + .priv_data_size = sizeof(Mpeg1Context), + .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, + .flush = flush, + .long_name = NULL_IF_CONFIG_SMALL("MPEG-1 video (VDPAU acceleration)"), +}; +#endif |