[MPlayer-cvslog] r28599 - trunk/libmpcodecs/vd_ffmpeg.c
reimar
subversion at mplayerhq.hu
Sun Feb 15 18:23:05 CET 2009
Author: reimar
Date: Sun Feb 15 18:23:05 2009
New Revision: 28599
Log:
Restructure get_format so it can easily be extended to handle VDPAU
and hardware-acceleration selected via get_format.
Modified:
trunk/libmpcodecs/vd_ffmpeg.c
Modified: trunk/libmpcodecs/vd_ffmpeg.c
==============================================================================
--- trunk/libmpcodecs/vd_ffmpeg.c Sun Feb 15 17:57:08 2009 (r28598)
+++ trunk/libmpcodecs/vd_ffmpeg.c Sun Feb 15 18:23:05 2009 (r28599)
@@ -884,10 +884,22 @@ static mp_image_t *decode(sh_video_t *sh
#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(struc
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 */
More information about the MPlayer-cvslog
mailing list