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/vc1dec.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/vc1dec.c')
-rw-r--r-- | libavcodec/vc1dec.c | 53 |
1 files changed, 51 insertions, 2 deletions
diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c index 49facd273e..9bd5f69b34 100644 --- a/libavcodec/vc1dec.c +++ b/libavcodec/vc1dec.c @@ -38,6 +38,7 @@ #include "msmpeg4data.h" #include "unary.h" #include "mathops.h" +#include "vdpau_internal.h" #include "libavutil/avassert.h" #undef NDEBUG @@ -5778,6 +5779,13 @@ static int vc1_decode_frame(AVCodecContext *avctx, void *data, return buf_size; } + if (s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU) { + if (v->profile < PROFILE_ADVANCED) + avctx->pix_fmt = AV_PIX_FMT_VDPAU_WMV3; + else + avctx->pix_fmt = AV_PIX_FMT_VDPAU_VC1; + } + //for advanced profile we may need to parse and unescape data if (avctx->codec_id == AV_CODEC_ID_VC1 || avctx->codec_id == AV_CODEC_ID_VC1IMAGE) { int buf_size2 = 0; @@ -5796,7 +5804,8 @@ static int vc1_decode_frame(AVCodecContext *avctx, void *data, if (size <= 0) continue; switch (AV_RB32(start)) { case VC1_CODE_FRAME: - if (avctx->hwaccel) + if (avctx->hwaccel || + s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU) buf_start = start; buf_size2 = vc1_unescape_buffer(start + 4, size, buf2); break; @@ -5999,7 +6008,15 @@ static int vc1_decode_frame(AVCodecContext *avctx, void *data, s->me.qpel_put = s->dsp.put_qpel_pixels_tab; s->me.qpel_avg = s->dsp.avg_qpel_pixels_tab; - if (avctx->hwaccel) { + if ((CONFIG_VC1_VDPAU_DECODER) + &&s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU) { + if (v->field_mode && buf_start_second_field) { + ff_vdpau_vc1_decode_picture(s, buf_start, buf_start_second_field - buf_start); + ff_vdpau_vc1_decode_picture(s, buf_start_second_field, (buf + buf_size) - buf_start_second_field); + } else { + ff_vdpau_vc1_decode_picture(s, buf_start, (buf + buf_size) - buf_start); + } + } else if (avctx->hwaccel) { if (v->field_mode && buf_start_second_field) { // decode first field s->picture_structure = PICT_BOTTOM_FIELD - v->tff; @@ -6232,6 +6249,38 @@ AVCodec ff_wmv3_decoder = { }; #endif +#if CONFIG_WMV3_VDPAU_DECODER +AVCodec ff_wmv3_vdpau_decoder = { + .name = "wmv3_vdpau", + .type = AVMEDIA_TYPE_VIDEO, + .id = AV_CODEC_ID_WMV3, + .priv_data_size = sizeof(VC1Context), + .init = vc1_decode_init, + .close = ff_vc1_decode_end, + .decode = vc1_decode_frame, + .capabilities = CODEC_CAP_DR1 | CODEC_CAP_DELAY | CODEC_CAP_HWACCEL_VDPAU, + .long_name = NULL_IF_CONFIG_SMALL("Windows Media Video 9 VDPAU"), + .pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_VDPAU_WMV3, AV_PIX_FMT_NONE }, + .profiles = NULL_IF_CONFIG_SMALL(profiles) +}; +#endif + +#if CONFIG_VC1_VDPAU_DECODER +AVCodec ff_vc1_vdpau_decoder = { + .name = "vc1_vdpau", + .type = AVMEDIA_TYPE_VIDEO, + .id = AV_CODEC_ID_VC1, + .priv_data_size = sizeof(VC1Context), + .init = vc1_decode_init, + .close = ff_vc1_decode_end, + .decode = vc1_decode_frame, + .capabilities = CODEC_CAP_DR1 | CODEC_CAP_DELAY | CODEC_CAP_HWACCEL_VDPAU, + .long_name = NULL_IF_CONFIG_SMALL("SMPTE VC-1 VDPAU"), + .pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_VDPAU_VC1, AV_PIX_FMT_NONE }, + .profiles = NULL_IF_CONFIG_SMALL(profiles) +}; +#endif + #if CONFIG_WMV3IMAGE_DECODER AVCodec ff_wmv3image_decoder = { .name = "wmv3image", |