diff options
author | Uoti Urpala <uau@glyph.nonexistent.invalid> | 2009-02-18 01:07:37 +0200 |
---|---|---|
committer | Uoti Urpala <uau@glyph.nonexistent.invalid> | 2009-02-18 01:45:36 +0200 |
commit | 186e5a998c8424b3c850b62d6f5755a0928cd64c (patch) | |
tree | cabc9881fb5ed2c6dbe5f771323a55c50136a091 /libmpcodecs/vd_ffmpeg.c | |
parent | 41ac08d2b45f0f6eb369ea57604796be69200185 (diff) | |
parent | e5ee1232c5e00e730d69cf57767b1ee3ab5b4e16 (diff) | |
download | mpv-186e5a998c8424b3c850b62d6f5755a0928cd64c.tar.bz2 mpv-186e5a998c8424b3c850b62d6f5755a0928cd64c.tar.xz |
Merge svn changes up to r28641
Convert vo_x11_border (used in vo_gl/gl2 though the vo_gl_border
macro) to use a wrapper macro in old-style VOs which do not provide a
VO object argument. Before this function had an explicit global_vo
argument in vo_gl/gl2. New vo_vdpau uses it too so use the same
mechanism as most other functions.
Diffstat (limited to 'libmpcodecs/vd_ffmpeg.c')
-rw-r--r-- | libmpcodecs/vd_ffmpeg.c | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/libmpcodecs/vd_ffmpeg.c b/libmpcodecs/vd_ffmpeg.c index 9e3aae2d08..c70da3a9f3 100644 --- a/libmpcodecs/vd_ffmpeg.c +++ b/libmpcodecs/vd_ffmpeg.c @@ -215,15 +215,24 @@ static int init(sh_video_t *sh){ if(lavc_codec->capabilities&CODEC_CAP_DR1 && !do_vis_debug && lavc_codec->id != CODEC_ID_H264 && lavc_codec->id != CODEC_ID_INTERPLAY_VIDEO && lavc_codec->id != CODEC_ID_ROQ) ctx->do_dr1=1; + if (lavc_codec->capabilities & CODEC_CAP_HWACCEL_VDPAU) + ctx->do_dr1=1; ctx->b_age= ctx->ip_age[0]= ctx->ip_age[1]= 256*256*256*64; ctx->ip_count= ctx->b_count= 0; ctx->pic = avcodec_alloc_frame(); ctx->avctx = avcodec_alloc_context(); avctx = ctx->avctx; + avctx->opaque = sh; +#if CONFIG_VDPAU + if(lavc_codec->capabilities & CODEC_CAP_HWACCEL_VDPAU){ + avctx->get_format = get_format; + avctx->draw_horiz_band = draw_slice; + avctx->slice_flags = SLICE_FLAG_CODED_ORDER|SLICE_FLAG_ALLOW_FIELD; + } +#endif /* CONFIG_VDPAU */ #if CONFIG_XVMC - if(lavc_codec->capabilities & CODEC_CAP_HWACCEL){ mp_msg(MSGT_DECVIDEO, MSGL_INFO, MSGTR_MPCODECS_XVMCAcceleratedCodec); assert(ctx->do_dr1);//these are must to! @@ -529,7 +538,7 @@ static int get_buffer(AVCodecContext *avctx, AVFrame *pic){ return avctx->get_buffer(avctx, pic); } - if (IMGFMT_IS_XVMC(ctx->best_csp)) { + if (IMGFMT_IS_XVMC(ctx->best_csp) || IMGFMT_IS_VDPAU(ctx->best_csp)) { type = MP_IMGTYPE_NUMBERED | (0xffff << 16); } else if (!pic->buffer_hints) { @@ -559,6 +568,9 @@ static int get_buffer(AVCodecContext *avctx, AVFrame *pic){ avctx->draw_horiz_band= draw_slice; } else avctx->draw_horiz_band= NULL; + if(IMGFMT_IS_VDPAU(mpi->imgfmt)) { + avctx->draw_horiz_band= draw_slice; + } #if CONFIG_XVMC if(IMGFMT_IS_XVMC(mpi->imgfmt)) { struct xvmc_pix_fmt *render = mpi->priv; //same as data[2] @@ -718,7 +730,6 @@ static mp_image_t *decode(sh_video_t *sh, void *data, int len, int flags){ //ffmpeg interlace (mpeg2) bug have been fixed. no need of -noslices if (!dr1) avctx->draw_horiz_band=NULL; - avctx->opaque=sh; if(ctx->vo_initialized && !(flags&3) && !dr1){ mpi=mpcodecs_get_image(sh, MP_IMGTYPE_EXPORT, MP_IMGFLAG_PRESERVE | (ctx->do_slices?MP_IMGFLAG_DRAW_CALLBACK:0), @@ -864,7 +875,7 @@ static mp_image_t *decode(sh_video_t *sh, void *data, int len, int flags){ return mpi; } -#if CONFIG_XVMC +#if CONFIG_XVMC || CONFIG_VDPAU static enum PixelFormat get_format(struct AVCodecContext *avctx, const enum PixelFormat *fmt){ enum PixelFormat selected_format = fmt[0]; @@ -874,7 +885,7 @@ static enum PixelFormat get_format(struct AVCodecContext *avctx, for(i=0;fmt[i]!=PIX_FMT_NONE;i++){ imgfmt = pixfmt2imgfmt(fmt[i]); - if(!IMGFMT_IS_XVMC(imgfmt)) continue; + if(!IMGFMT_IS_XVMC(imgfmt) && !IMGFMT_IS_VDPAU(imgfmt)) continue; mp_msg(MSGT_DECVIDEO, MSGL_INFO, MSGTR_MPCODECS_TryingPixfmt, i); if(init_vo(sh, fmt[i]) >= 0) { selected_format = fmt[i]; @@ -882,7 +893,7 @@ static enum PixelFormat get_format(struct AVCodecContext *avctx, } } imgfmt = pixfmt2imgfmt(selected_format); - if(IMGFMT_IS_XVMC(imgfmt)) { + if(IMGFMT_IS_XVMC(imgfmt) || IMGFMT_IS_VDPAU(imgfmt)) { vd_ffmpeg_ctx *ctx = sh->context; avctx->get_buffer= get_buffer; avctx->release_buffer= release_buffer; @@ -894,5 +905,4 @@ static enum PixelFormat get_format(struct AVCodecContext *avctx, } return selected_format; } - -#endif /* CONFIG_XVMC */ +#endif /* CONFIG_XVMC || CONFIG_VDPAU */ |