summaryrefslogtreecommitdiffstats
path: root/libmpcodecs
diff options
context:
space:
mode:
authorreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2009-02-15 17:23:05 +0000
committerreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2009-02-15 17:23:05 +0000
commitde96ea2e01c0a90227c1cd6ae61272abcfb90ab3 (patch)
tree8fbe1dfa6f16dc4d9aa7b3ccfacd12a97a3bd84f /libmpcodecs
parent14b1991a42855d5c8c9faf7affb11279040c1c07 (diff)
downloadmpv-de96ea2e01c0a90227c1cd6ae61272abcfb90ab3.tar.bz2
mpv-de96ea2e01c0a90227c1cd6ae61272abcfb90ab3.tar.xz
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
Diffstat (limited to 'libmpcodecs')
-rw-r--r--libmpcodecs/vd_ffmpeg.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/libmpcodecs/vd_ffmpeg.c b/libmpcodecs/vd_ffmpeg.c
index 7dbe419547..5a77279c28 100644
--- a/libmpcodecs/vd_ffmpeg.c
+++ b/libmpcodecs/vd_ffmpeg.c
@@ -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 */