0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-20 20:03:10 +02:00

Restructure get_format so it can easily be extended to handle VDPAU

and hardware-acceleration selected via get_format.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28599 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
reimar 2009-02-15 17:23:05 +00:00
parent 14b1991a42
commit de96ea2e01

View File

@ -884,10 +884,22 @@ static mp_image_t *decode(sh_video_t *sh, void *data, int len, int flags){
#if CONFIG_XVMC
static enum PixelFormat get_format(struct AVCodecContext *avctx,
const enum PixelFormat *fmt){
enum PixelFormat selected_format = fmt[0];
int imgfmt;
sh_video_t *sh = avctx->opaque;
int i;
if(avctx->xvmc_acceleration){
for(i=0;fmt[i]!=PIX_FMT_NONE;i++){
imgfmt = pixfmt2imgfmt(fmt[i]);
if(!IMGFMT_IS_XVMC(imgfmt)) continue;
mp_msg(MSGT_DECVIDEO, MSGL_INFO, MSGTR_MPCODECS_TryingPixfmt, i);
if(init_vo(sh, fmt[i]) >= 0) {
selected_format = fmt[i];
break;
}
}
imgfmt = pixfmt2imgfmt(selected_format);
if(IMGFMT_IS_XVMC(imgfmt)) {
vd_ffmpeg_ctx *ctx = sh->context;
avctx->get_buffer= get_buffer;
avctx->release_buffer= release_buffer;
@ -897,12 +909,7 @@ static enum PixelFormat get_format(struct AVCodecContext *avctx,
assert(ctx->do_slices); //it is (vo_)ffmpeg bug if this fails
avctx->slice_flags=SLICE_FLAG_CODED_ORDER|SLICE_FLAG_ALLOW_FIELD;
}
for(i=0;fmt[i]!=PIX_FMT_NONE;i++){
mp_msg(MSGT_DECVIDEO, MSGL_INFO, MSGTR_MPCODECS_TryingPixfmt, i);
if(init_vo(sh, fmt[i]) >= 0)
return fmt[i];
}
return fmt[0];
return selected_format;
}
#endif /* CONFIG_XVMC */