diff options
-rw-r--r-- | DOCS/man/en/mplayer.1 | 46 | ||||
-rw-r--r-- | Makefile | 1 | ||||
-rwxr-xr-x | configure | 41 | ||||
-rw-r--r-- | etc/codecs.conf | 35 | ||||
-rw-r--r-- | libmpcodecs/vd_ffmpeg.c | 41 | ||||
-rw-r--r-- | libvo/video_out.c | 4 | ||||
-rw-r--r-- | libvo/vo_xvmc.c | 1315 | ||||
-rw-r--r-- | rpm/mplayer.spec | 7 |
8 files changed, 9 insertions, 1481 deletions
diff --git a/DOCS/man/en/mplayer.1 b/DOCS/man/en/mplayer.1 index 6469f51e10..3ca8ff01f5 100644 --- a/DOCS/man/en/mplayer.1 +++ b/DOCS/man/en/mplayer.1 @@ -267,7 +267,7 @@ Show filename on the OSD. Show progression bar, elapsed time and total duration on the OSD. .IPs "! and @" Seek to the beginning of the previous/next chapter. -.IPs "D (\-vo xvmc, \-vo vdpau, \-vf yadif, \-vf kerndeint only)" +.IPs "D (\-vo vdpau, \-vf yadif, \-vf kerndeint only)" Activate/deactivate deinterlacer. .IPs "A\ \ \ \ " Cycle through the available DVD angles. @@ -748,15 +748,13 @@ chapter change instead of doing a seek. Changes the colorkey to an RGB value of your choice. 0x000000 is black and 0xffffff is white. Only supported by the fbdev, svga, vesa, xmga, -xover, xv (see \-vo xv:ck), xvmc (see \-vo xv:ck) and directx video output -drivers. +xover, xv (see \-vo xv:ck) and directx video output drivers. . .TP .B \-nocolorkey Disables colorkeying. Only supported by the fbdev, svga, vesa, xmga, -xover, xv (see \-vo xv:ck), xvmc (see \-vo xv:ck) and directx video output -drivers. +xover, xv (see \-vo xv:ck) and directx video output drivers. . .TP .B \-correct\-pts, \-nocorrect\-pts @@ -978,7 +976,7 @@ Display the main menu at MPlayer startup. Permit MPlayer to receive pointer events reported by the video output driver. Necessary to select the buttons in DVD menus. -Supported for X11-based VOs (x11, xv, xvmc, etc) and the gl, gl2, direct3d and +Supported for X11-based VOs (x11, xv, etc) and the gl, gl2, direct3d and corevideo VOs. . .TP @@ -3171,7 +3169,7 @@ y coordinates are relative to the top-left corner of the window rather than the screen. The coordinates are relative to the screen given with \-xineramascreen for the video output drivers that fully support \-xineramascreen (direct3d, gl, gl2, -vdpau, x11, xv, xvmc, corevideo). +vdpau, x11, xv, corevideo). .br .I NOTE: May not be supported by some of the older VO drivers. @@ -3558,38 +3556,6 @@ surfaces that work well or at all. .PD 1 . .TP -.B xvmc (X11 with \-vc ffmpeg12mc only) -Video output driver that uses the XvMC (X Video Motion Compensation) -extension of XFree86 4.x to speed up MPEG-1/2 and VCR2 decoding. -.PD 0 -.RSs -.IPs adaptor=<number> -Select a specific XVideo adaptor (check xvinfo results). -.IPs port=<number> -Select a specific XVideo port. -.IPs (no)benchmark -Disables image display. -Necessary for proper benchmarking of drivers that change -image buffers on monitor retrace only (nVidia). -Default is not to disable image display (nobenchmark). -.IPs (no)bobdeint -Very simple deinterlacer. -Might not look better than \-vf tfields=1, -but it is the only deinterlacer for xvmc (default: nobobdeint). -.IPs (no)queue -Queue frames for display to allow more parallel work of the video hardware. -May add a small (not noticeable) constant A/V desync (default: noqueue). -.IPs (no)sleep -Use sleep function while waiting for rendering to finish -(not recommended on Linux) (default: nosleep). -.IPs ck=cur|use|set -Same as \-vo xv:ck (see \-vo xv). -.IPs ck-method=man|bg|auto -Same as \-vo xv:ck-method (see \-vo xv). -.RE -.PD 1 -. -.TP .B dga (X11 only) Play video through the XFree86 Direct Graphics Access extension. Considered obsolete. @@ -4516,7 +4482,7 @@ Disable automatic movie aspect ratio compensation. .B "\-field\-dominance <\-1\-1>" Set first field for interlaced content. Useful for deinterlacers that double the framerate: \-vf tfields=1, -\-vf yadif=1, \-vo vdpau:deint and \-vo xvmc:bobdeint. +\-vf yadif=1 and \-vo vdpau:deint. .PD 0 .RSs .IPs \-1 @@ -509,7 +509,6 @@ SRCS_MPLAYER-$(X11) += libvo/vo_x11.c libvo/vo_xover.c \ libvo/x11_common.c SRCS_MPLAYER-$(XMGA) += libvo/vo_xmga.c SRCS_MPLAYER-$(XV) += libvo/vo_xv.c -SRCS_MPLAYER-$(XVMC) += libvo/vo_xvmc.c SRCS_MPLAYER-$(XVR100) += libvo/vo_xvr100.c SRCS_MPLAYER-$(YUV4MPEG) += libvo/vo_yuv4mpeg.c @@ -401,7 +401,6 @@ Video output: --enable-mga enable mga_vid video output [autodetect] --enable-xmga enable mga_vid X11 video output [autodetect] --enable-xv enable Xv video output [autodetect] - --enable-xvmc enable XvMC acceleration [disable] --enable-vdpau enable VDPAU acceleration [autodetect] --enable-vm enable XF86VidMode support [autodetect] --enable-xinerama enable Xinerama support [autodetect] @@ -503,7 +502,6 @@ Use these options if autodetection fails: --extra-ldflags=FLAGS extra LDFLAGS --extra-libs=FLAGS extra linker flags --extra-libs-mplayer=FLAGS extra linker flags for MPlayer - --with-xvmclib=NAME adapter-specific library name (e.g. XvMCNVIDIA) --with-freetype-config=PATH path to freetype-config --with-sdl-config=PATH path to sdl*-config @@ -560,7 +558,6 @@ _xss=auto _dga1=auto _dga2=auto _xv=auto -_xvmc=no #auto when complete _vdpau=auto _sdl=auto _kva=auto @@ -745,9 +742,6 @@ for ac_option do --with-install=*) _install=$(echo $ac_option | cut -d '=' -f 2 ) ;; - --with-xvmclib=*) - _xvmclib=$(echo $ac_option | cut -d '=' -f 2) - ;; --with-sdl-config=*) _sdlconfig=$(echo $ac_option | cut -d '=' -f 2) @@ -857,8 +851,6 @@ for ac_option do --disable-xss) _xss=no ;; --enable-xv) _xv=yes ;; --disable-xv) _xv=no ;; - --enable-xvmc) _xvmc=yes ;; - --disable-xvmc) _xvmc=no ;; --enable-vdpau) _vdpau=yes ;; --disable-vdpau) _vdpau=no ;; --enable-sdl) _sdl=yes ;; @@ -3873,7 +3865,7 @@ else novomodules="x11 $novomodules" res_comment="check if the dev(el) packages are installed" # disable stuff that depends on X - _xv=no ; _xvmc=no ; _xinerama=no ; _vm=no ; _xf86keysym=no ; _vdpau=no + _xv=no ; _xinerama=no ; _vm=no ; _xf86keysym=no ; _vdpau=no fi echores "$_x11" @@ -3937,34 +3929,6 @@ fi echores "$_xv" -echocheck "XvMC" -if test "$_xv" = yes && test "$_xvmc" != no ; then - _xvmc=no - cat > $TMPC <<EOF -#include <X11/Xlib.h> -#include <X11/extensions/Xvlib.h> -#include <X11/extensions/XvMClib.h> -int main(void) { - XvMCQueryExtension(0, 0, 0); - XvMCCreateContext(0, 0, 0, 0, 0, 0, 0); - return 0; } -EOF - for _ld_tmp in $_xvmclib XvMCNVIDIA XvMCW I810XvMC ; do - cc_check -lXvMC -l$_ld_tmp && _xvmc=yes && _xvmclib="$_ld_tmp" && break - done -fi -if test "$_xvmc" = yes ; then - def_xvmc='#define CONFIG_XVMC 1' - libs_mplayer="$libs_mplayer -lXvMC -l$_xvmclib" - vomodules="xvmc $vomodules" - res_comment="using $_xvmclib" -else - def_xvmc='#define CONFIG_XVMC 0' - novomodules="xvmc $novomodules" -fi -echores "$_xvmc" - - echocheck "VDPAU" if test "$_vdpau" = auto ; then _vdpau=no @@ -6846,7 +6810,6 @@ XMGA = $_xmga XMMS_PLUGINS = $_xmms XV = $_xv XVID4 = $_xvid -XVMC = $_xvmc XVR100 = $_xvr100 YUV4MPEG = $_yuv4mpeg @@ -6861,7 +6824,6 @@ YASM = $_yasm YASMFLAGS = $YASMFLAGS CONFIG_VDPAU = $_vdpau -CONFIG_XVMC = $_xvmc CONFIG_ZLIB = $_zlib HAVE_PTHREADS = $_pthreads @@ -7203,7 +7165,6 @@ $def_xinerama $def_xmga $def_xss $def_xv -$def_xvmc $def_xvr100 $def_yuv4mpeg diff --git a/etc/codecs.conf b/etc/codecs.conf index 8e37041599..b61c5d4f8d 100644 --- a/etc/codecs.conf +++ b/etc/codecs.conf @@ -260,41 +260,6 @@ videocodec ffmpeg12 out YV12,I420,IYUV out 422P,444P -videocodec ffmpeg12mc - info "FFmpeg MPEG-1/2 (XvMC)" - status buggy - format 0x10000001 ; MPEG-1 - format 0x10000002 ; MPEG-2 - fourcc mpg1,mpg2,MPG2 - fourcc "DVR " - fourcc PIM1 ; Pinnacle hardware-MPEG-1 - fourcc PIM2 ; Pinnacle hardware-MPEG-2 - fourcc VCR2 - fourcc MPEG - fourcc mx5p ; MPEG IMX 625/50 (50 Mb/s) - fourcc MMES,mmes ; matrox mpeg2 in avi - fourcc hdv1,hdv2,hdv3 - fourcc hdv4,hdv5,hdv6 - fourcc hdv7,hdv8,hdv9 - fourcc xdv1,xdv2,xdv3 - fourcc xdv4,xdv5,xdv6 - fourcc xdv7,xdv8,xdv9 - fourcc xdva,xdvb,xdvc - fourcc xdvd,xdve,xdvf - fourcc xd5a,xd5b,xd5c - fourcc xd5d,xd5e,xd5f - fourcc xd59,xd54,xd55 - fourcc mx5n,mx4n,mx4p - fourcc mx3n,mx3p - fourcc AVmp - fourcc mp2v,mpgv - fourcc m2v1,m1v1 - fourcc LMP2 ; Lead mpeg2 in avi - driver ffmpeg - dll "mpegvideo_xvmc" - out IDCT_MPEG2 - out MOCO_MPEG2 - videocodec ffmpeg12vdpau info "FFmpeg MPEG-1/2 (VDPAU)" status working diff --git a/libmpcodecs/vd_ffmpeg.c b/libmpcodecs/vd_ffmpeg.c index a5c21a2e62..5a17bc243e 100644 --- a/libmpcodecs/vd_ffmpeg.c +++ b/libmpcodecs/vd_ffmpeg.c @@ -54,10 +54,6 @@ static const vd_info_t info = { #error palette too large, adapt libmpcodecs/vf.c:vf_get_image #endif -#if CONFIG_XVMC -#include "libavcodec/xvmc.h" -#endif - int avcodec_initialized=0; typedef struct { @@ -142,11 +138,6 @@ static int control(sh_video_t *sh, int cmd, void *arg, ...){ if(ctx->best_csp == IMGFMT_YV12) return CONTROL_TRUE;// u/v swap if(ctx->best_csp == IMGFMT_422P && !ctx->do_dr1) return CONTROL_TRUE;// half stride break; -#if CONFIG_XVMC - case IMGFMT_XVMC_IDCT_MPEG2: - case IMGFMT_XVMC_MOCO_MPEG2: - if(avctx->pix_fmt==PIX_FMT_XVMC_MPEG2_IDCT) return CONTROL_TRUE; -#endif } return CONTROL_FALSE; } @@ -604,28 +595,6 @@ static int get_buffer(AVCodecContext *avctx, AVFrame *pic){ if(IMGFMT_IS_HWACCEL(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] - if(!avctx->xvmc_acceleration) { - mp_tmsg(MSGT_DECVIDEO, MSGL_INFO, "[VD_FFMPEG] The mc_get_buffer should work only with XVMC acceleration!!"); - assert(0); - exit(1); -// return -1;//!!fixme check error conditions in ffmpeg - } - if(!(mpi->flags & MP_IMGFLAG_DIRECT)) { - mp_tmsg(MSGT_DECVIDEO, MSGL_ERR, "[VD_FFMPEG] Only buffers allocated by vo_xvmc allowed.\n"); - assert(0); - exit(1); -// return -1;//!!fixme check error conditions in ffmpeg - } - if(mp_msg_test(MSGT_DECVIDEO, MSGL_DBG5)) - mp_msg(MSGT_DECVIDEO, MSGL_DBG5, "vd_ffmpeg::get_buffer (xvmc render=%p)\n", render); - assert(render != 0); - assert(render->xvmc_id == AV_XVMC_ID); - render->state |= AV_XVMC_STATE_PREDICTION; - } -#endif pic->data[0]= mpi->planes[0]; pic->data[1]= mpi->planes[1]; @@ -710,16 +679,6 @@ static void release_buffer(struct AVCodecContext *avctx, AVFrame *pic){ // Palette support: free palette buffer allocated in get_buffer if (mpi->bpp == 8) av_freep(&mpi->planes[1]); -#if CONFIG_XVMC - if (IMGFMT_IS_XVMC(mpi->imgfmt)) { - struct xvmc_pix_fmt *render = (struct xvmc_pix_fmt*)pic->data[2]; //same as mpi->priv - if(mp_msg_test(MSGT_DECVIDEO, MSGL_DBG5)) - mp_msg(MSGT_DECVIDEO, MSGL_DBG5, "vd_ffmpeg::release_buffer (xvmc render=%p)\n", render); - assert(render!=NULL); - assert(render->xvmc_id == AV_XVMC_ID); - render->state&=~AV_XVMC_STATE_PREDICTION; - } -#endif // release mpi (in case MPI_IMGTYPE_NUMBERED is used, e.g. for VDPAU) mpi->usage_count--; } diff --git a/libvo/video_out.c b/libvo/video_out.c index 070a66c679..443ef87cde 100644 --- a/libvo/video_out.c +++ b/libvo/video_out.c @@ -80,7 +80,6 @@ extern struct vo_driver video_out_mga; extern struct vo_driver video_out_xmga; extern struct vo_driver video_out_x11; extern struct vo_driver video_out_xover; -extern struct vo_driver video_out_xvmc; extern struct vo_driver video_out_vdpau; extern struct vo_driver video_out_xv; extern struct vo_driver video_out_gl_nosw; @@ -230,9 +229,6 @@ const struct vo_driver *video_out_drivers[] = // vo directfb can call exit() if initialization fails &video_out_directfb, #endif -#if CONFIG_XVMC - &video_out_xvmc, -#endif &video_out_mpegpes, #ifdef CONFIG_YUV4MPEG &video_out_yuv4mpeg, diff --git a/libvo/vo_xvmc.c b/libvo/vo_xvmc.c deleted file mode 100644 index 21a279beaa..0000000000 --- a/libvo/vo_xvmc.c +++ /dev/null @@ -1,1315 +0,0 @@ -/* - * This file is part of MPlayer. - * - * MPlayer is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * MPlayer is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with MPlayer; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#include <stdlib.h> -#include <stdio.h> -#include <string.h> -#include <unistd.h> - -#include "config.h" -#include "mp_msg.h" -#include "video_out.h" -#include "video_out_internal.h" -#include "osdep/timer.h" - -#include <X11/Xlib.h> -#include <X11/Xutil.h> -#include <X11/Xatom.h> - -#ifdef HAVE_SHM -#include <sys/ipc.h> -#include <sys/shm.h> -#include <X11/extensions/XShm.h> -#endif - -#include <X11/extensions/Xv.h> -#include <X11/extensions/Xvlib.h> -#include <X11/extensions/XvMClib.h> - -#include "x11_common.h" -#include "libavcodec/avcodec.h" -#include "libavcodec/xvmc.h" - -#include "sub/sub.h" -#include "aspect.h" - -#include "subopt-helper.h" - -#include "libavutil/common.h" - -//no chance for xinerama to be supported in the near future -#undef CONFIG_XINERAMA - -#undef NDEBUG -#include <assert.h> - - -#if LIBAVCODEC_BUILD < ((51<<16)+(40<<8)+2) -#error You need at least libavcodec v51.40.2 -#endif - - -static int benchmark; -static int use_sleep; -static int first_frame;//draw colorkey on first frame -static int use_queue; -static int xv_port_request = 0; -static int xv_adaptor = -1; -static int bob_deinterlace; -static int top_field_first; - -static int image_width,image_height; -static int image_format; - -#define NO_SUBPICTURE 0 -#define OVERLAY_SUBPICTURE 1 -#define BLEND_SUBPICTURE 2 -#define BACKEND_SUBPICTURE 3 - -static int subpicture_mode; -static int subpicture_alloc; -static XvMCSubpicture subpicture; -static XvImageFormatValues subpicture_info; -static int subpicture_clear_color;//transparent color for the subpicture or color key for overlay - -static XvMCSurfaceInfo surface_info; -static XvMCContext ctx; -static XvMCBlockArray data_blocks; -static XvMCMacroBlockArray mv_blocks; - -#define MAX_SURFACES 8 -static int number_of_surfaces=0; -static XvMCSurface surface_array[MAX_SURFACES]; -static struct xvmc_pix_fmt *surface_render; - -static struct xvmc_pix_fmt *p_render_surface_to_show = NULL; -static struct xvmc_pix_fmt *p_render_surface_visible = NULL; - -//display queue, kinda render ahead -static struct xvmc_pix_fmt *show_queue[MAX_SURFACES]; -static int free_element; - - -static void (*draw_osd_fnc)(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride); -static void (*clear_osd_fnc)(int x0,int y0, int w,int h); -static void (*init_osd_fnc)(void); - -static void draw_osd_AI44(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride); -static void draw_osd_IA44(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride); -static void clear_osd_subpic(int x0,int y0, int w,int h); -static void init_osd_yuv_pal(void); - - -static const struct{ - int id;//id as xvimages or as mplayer RGB|{8,15,16,24,32} - void (* init_func_ptr)(void); - void (* draw_func_ptr)(); - void (* clear_func_ptr)(); - } osd_render[]={ - {0x34344149,init_osd_yuv_pal,draw_osd_AI44,clear_osd_subpic}, - {0x34344941,init_osd_yuv_pal,draw_osd_IA44,clear_osd_subpic}, - {0,NULL,NULL,NULL} - }; - -static void xvmc_free(void); -static void xvmc_clean_surfaces(void); -static int count_free_surfaces(void); -static struct xvmc_pix_fmt *find_free_surface(void); - -static const vo_info_t info = { - "XVideo Motion Compensation", - "xvmc", - "Ivan Kalvachev <iive@users.sf.net>", - "" -}; - -const LIBVO_EXTERN(xvmc); - -//shm stuff from vo_xv -#ifdef HAVE_SHM -static XShmSegmentInfo Shminfo; -static int Shmem_Flag; -#endif -XvImage * xvimage; - - -static void allocate_xvimage(int xvimage_width,int xvimage_height,int xv_format) -{ - /* - * allocate XvImages. FIXME: no error checking, without - * mit-shm this will bomb... trzing to fix ::atmos - */ -#ifdef HAVE_SHM - if ( mLocalDisplay && XShmQueryExtension( mDisplay ) ) Shmem_Flag = 1; - else - { - Shmem_Flag = 0; - mp_msg(MSGT_VO,MSGL_WARN, "Shared memory not supported\nReverting to normal Xv\n" ); - } - if ( Shmem_Flag ) - { - xvimage = (XvImage *) XvShmCreateImage(mDisplay, xv_port, xv_format, - NULL, xvimage_width, xvimage_height, &Shminfo); - - Shminfo.shmid = shmget(IPC_PRIVATE, xvimage->data_size, IPC_CREAT | 0777); - Shminfo.shmaddr = (char *) shmat(Shminfo.shmid, 0, 0); - Shminfo.readOnly = False; - - xvimage->data = Shminfo.shmaddr; - XShmAttach(mDisplay, &Shminfo); - XSync(mDisplay, False); - shmctl(Shminfo.shmid, IPC_RMID, 0); - } - else -#endif - { - xvimage = (XvImage *) XvCreateImage(mDisplay, xv_port, xv_format, NULL, xvimage_width, xvimage_height); - xvimage->data = malloc(xvimage->data_size); - XSync(mDisplay,False); - } -// memset(xvimage->data,128,xvimage->data_size); - return; -} - -static void deallocate_xvimage(void) -{ -#ifdef HAVE_SHM - if ( Shmem_Flag ) - { - XShmDetach( mDisplay,&Shminfo ); - shmdt( Shminfo.shmaddr ); - } - else -#endif - { - free(xvimage->data); - } - XFree(xvimage); - - XSync(mDisplay, False); - return; -} -//end of vo_xv shm/xvimage code - -static int xvmc_check_surface_format(uint32_t format, XvMCSurfaceInfo * surf_info){ - if ( format == IMGFMT_XVMC_IDCT_MPEG2 ){ - if( surf_info->mc_type != (XVMC_IDCT|XVMC_MPEG_2) ) return -1; - if( surf_info->chroma_format != XVMC_CHROMA_FORMAT_420 ) return -1; - return 0; - } - if ( format == IMGFMT_XVMC_MOCO_MPEG2 ){ - if(surf_info->mc_type != XVMC_MPEG_2) return -1; - if(surf_info->chroma_format != XVMC_CHROMA_FORMAT_420) return -1; - return 0; - } -return -1;//fail -} - -//print all info needed to add new format -static void print_xvimage_format_values(XvImageFormatValues *xifv){ - int i; - const int msgl=MSGL_DBG4; - - mp_msg(MSGT_VO,msgl,"Format_ID = 0x%X\n",xifv->id); - - mp_msg(MSGT_VO,msgl," type = "); - if(xifv->type == XvRGB) mp_msg(MSGT_VO,msgl,"RGB\n"); - else if(xifv->type == XvYUV) mp_msg(MSGT_VO,msgl,"YUV\n"); - else mp_msg(MSGT_VO,msgl,"Unknown\n"); - - mp_msg(MSGT_VO,msgl," byte_order = "); - if(xifv->byte_order == LSBFirst) mp_msg(MSGT_VO,msgl,"LSB First\n"); - else if(xifv->type == MSBFirst) mp_msg(MSGT_VO,msgl,"MSB First\n"); - else mp_msg(MSGT_VO,msgl,"Unknown\n");//yes Linux support other types too - - mp_msg(MSGT_VO,msgl," guid = "); - for(i=0;i<16;i++) - mp_msg(MSGT_VO,msgl,"%02X ",(unsigned char)xifv->guid[i]); - mp_msg(MSGT_VO,msgl,"\n"); - - mp_msg(MSGT_VO,msgl," bits_per_pixel = %d\n",xifv->bits_per_pixel); - - mp_msg(MSGT_VO,msgl," format = "); - if(xifv->format == XvPacked) mp_msg(MSGT_VO,msgl,"XvPacked\n"); - else if(xifv->format == XvPlanar) mp_msg(MSGT_VO,msgl,"XvPlanar\n"); - else mp_msg(MSGT_VO,msgl,"Unknown\n"); - - mp_msg(MSGT_VO,msgl," num_planes = %d\n",xifv->num_planes); - - if(xifv->type == XvRGB){ - mp_msg(MSGT_VO,msgl," red_mask = %0X\n", xifv->red_mask); - mp_msg(MSGT_VO,msgl," green_mask = %0X\n",xifv->green_mask); - mp_msg(MSGT_VO,msgl," blue_mask = %0X\n", xifv->blue_mask); - } - if(xifv->type == XvYUV){ - mp_msg(MSGT_VO,msgl," y_sample_bits = %d\n u_sample_bits = %d\n v_sample_bits = %d\n", - xifv->y_sample_bits,xifv->u_sample_bits,xifv->v_sample_bits); - mp_msg(MSGT_VO,msgl," horz_y_period = %d\n horz_u_period = %d\n horz_v_period = %d\n", - xifv->horz_y_period,xifv->horz_u_period,xifv->horz_v_period); - mp_msg(MSGT_VO,msgl," vert_y_period = %d\n vert_u_period = %d\n vert_v_period = %d\n", - xifv->vert_y_period,xifv->vert_u_period,xifv->vert_v_period); - - mp_msg(MSGT_VO,msgl," component_order = "); - for(i=0;i<32;i++) - if(xifv->component_order[i]>=32) - mp_msg(MSGT_VO,msgl,"%c",xifv->component_order[i]); - mp_msg(MSGT_VO,msgl,"\n"); - - mp_msg(MSGT_VO,msgl," scanline = "); - if(xifv->scanline_order == XvTopToBottom) mp_msg(MSGT_VO,msgl,"XvTopToBottom\n"); - else if(xifv->scanline_order == XvBottomToTop) mp_msg(MSGT_VO,msgl,"XvBottomToTop\n"); - else mp_msg(MSGT_VO,msgl,"Unknown\n"); - } - mp_msg(MSGT_VO,msgl,"\n"); -} - -// WARNING This function may changes xv_port and surface_info! -static int xvmc_find_surface_by_format(int format,int width,int height, - XvMCSurfaceInfo * surf_info,int query){ - int rez; - XvAdaptorInfo * ai; - int num_adaptors,i; - unsigned long p; - int s,mc_surf_num; - XvMCSurfaceInfo * mc_surf_list; - - rez = XvQueryAdaptors(mDisplay,DefaultRootWindow(mDisplay),&num_adaptors,&ai); - if( rez != Success ) return -1; - mp_msg(MSGT_VO,MSGL_DBG3,"vo_xvmc: Querying %d adaptors\n",num_adaptors); - for(i=0; i<num_adaptors; i++) - { - /* check if adaptor number has been specified */ - if (xv_adaptor != -1 && xv_adaptor != i) - continue; - mp_msg(MSGT_VO,MSGL_DBG3,"vo_xvmc: Querying adaptor #%d\n",i); - if( ai[i].type == 0 ) continue;// we need at least dummy type! -//probing ports - for(p=ai[i].base_id; p<ai[i].base_id+ai[i].num_ports; p++) - { - mp_msg(MSGT_VO,MSGL_DBG3,"vo_xvmc: probing port #%ld\n",p); - mc_surf_list = XvMCListSurfaceTypes(mDisplay,p,&mc_surf_num); - if( mc_surf_list == NULL || mc_surf_num == 0){ - mp_msg(MSGT_VO,MSGL_DBG3,"vo_xvmc: No XvMC supported. \n"); - continue; - } - mp_msg(MSGT_VO,MSGL_DBG3,"vo_xvmc: XvMC list have %d surfaces\n",mc_surf_num); -//we have XvMC list! - for(s=0; s<mc_surf_num; s++) - { - if( width > mc_surf_list[s].max_width ) continue; - if( height > mc_surf_list[s].max_height ) continue; - if( xvmc_check_surface_format(format,&mc_surf_list[s])<0 ) continue; -//we have match! - /* respect the users wish */ - if ( xv_port_request != 0 && xv_port_request != p ) - { - continue; - } - - if(!query){ - rez = XvGrabPort(mDisplay,p,CurrentTime); - if(rez != Success){ - mp_msg(MSGT_VO,MSGL_DBG3,"vo_xvmc: Fail to grab port %ld\n",p); - continue; - } - mp_msg(MSGT_VO,MSGL_INFO,"vo_xvmc: Using Xv Adaptor #%d (%s)\n", i, ai[i].name); - mp_msg(MSGT_VO,MSGL_INFO,"vo_xvmc: Port %ld grabed\n",p); - xv_port = p; - } - goto surface_found; - }//for mc surf - XFree(mc_surf_list);//if mc_surf_num==0 is list==NULL ? - }//for ports - }//for adaptors - XvFreeAdaptorInfo(ai); - - if(!query) mp_msg(MSGT_VO,MSGL_ERR,"vo_xvmc: Could not find free matching surface. Sorry.\n"); - return 0; - -// somebody know cleaner way to escape from 3 internal loops? -surface_found: - XvFreeAdaptorInfo(ai); - - memcpy(surf_info,&mc_surf_list[s],sizeof(XvMCSurfaceInfo)); - mp_msg(MSGT_VO, query?MSGL_INFO:MSGL_DBG3, - "vo_xvmc: Found matching surface with id=%X on %ld port at %d adapter\n", - mc_surf_list[s].surface_type_id,p,i); - return mc_surf_list[s].surface_type_id; -} - -static uint32_t xvmc_draw_image(mp_image_t *mpi){ - struct xvmc_pix_fmt *rndr; - - assert(mpi!=NULL); - assert(mpi->flags &MP_IMGFLAG_DIRECT); -// assert(mpi->flags &MP_IMGFLAGS_DRAWBACK); - - rndr = (struct xvmc_pix_fmt*)mpi->priv; //there is copy in plane[2] - assert( rndr != NULL ); - assert( rndr->xvmc_id == AV_XVMC_ID ); - mp_msg(MSGT_VO,MSGL_DBG4,"vo_xvmc: draw_image(show rndr=%p)\n",rndr); -// the surface have passed vf system without been skiped, it will be displayed - rndr->state |= AV_XVMC_STATE_DISPLAY_PENDING; - p_render_surface_to_show = rndr; - top_field_first = mpi->fields & MP_IMGFIELD_TOP_FIRST; - return VO_TRUE; -} - -static int preinit(const char *arg){ - int xv_version,xv_release,xv_request_base,xv_event_base,xv_error_base; - int mc_eventBase,mc_errorBase; - int mc_ver,mc_rev; - strarg_t ck_src_arg = { 0, NULL }; - strarg_t ck_method_arg = { 0, NULL }; - const opt_t subopts [] = - { - /* name arg type arg var test */ - { "port", OPT_ARG_INT, &xv_port_request, int_pos }, - { "adaptor", OPT_ARG_INT, &xv_adaptor, int_non_neg }, - { "ck", OPT_ARG_STR, &ck_src_arg, xv_test_ck }, - { "ck-method", OPT_ARG_STR, &ck_method_arg, xv_test_ckm }, - { "benchmark", OPT_ARG_BOOL, &benchmark, NULL }, - { "sleep", OPT_ARG_BOOL, &use_sleep, NULL }, - { "queue", OPT_ARG_BOOL, &use_queue, NULL }, - { "bobdeint", OPT_ARG_BOOL, &bob_deinterlace, NULL }, - { NULL } - }; - - //Obtain display handler - if (!vo_init()) return -1;//vo_xv - - //XvMC is subdivision of XVideo - if (Success != XvQueryExtension(mDisplay,&xv_version,&xv_release,&xv_request_base, - &xv_event_base,&xv_error_base) ){ - mp_msg(MSGT_VO,MSGL_ERR,"Sorry, Xv(MC) not supported by this X11 version/driver\n"); - mp_msg(MSGT_VO,MSGL_ERR,"********** Try with -vo x11 or -vo sdl ***********\n"); - return -1; - } - mp_msg(MSGT_VO,MSGL_INFO,"vo_xvmc: X-Video extension %d.%d\n",xv_version,xv_release); - - if( True != XvMCQueryExtension(mDisplay,&mc_eventBase,&mc_errorBase) ){ - mp_msg(MSGT_VO,MSGL_ERR,"vo_xvmc: No X-Video MotionCompensation Extension on %s\n", - XDisplayName(NULL)); - return -1; - } - - if(Success == XvMCQueryVersion(mDisplay, &mc_ver, &mc_rev) ){ - mp_msg(MSGT_VO,MSGL_INFO,"vo_xvmc: X-Video MotionCompensation Extension version %i.%i\n", - mc_ver,mc_rev); - } - else{ - mp_msg(MSGT_VO,MSGL_ERR,"vo_xvmc: Error querying version info!\n"); - return -1; - } - surface_render = NULL; - xv_port = 0; - number_of_surfaces = 0; - subpicture_alloc = 0; - - benchmark = 0; //disable PutImageto allow faster display than screen refresh - use_sleep = 0; - use_queue = 0; - bob_deinterlace = 0; - - /* parse suboptions */ - if ( subopt_parse( arg, subopts ) != 0 ) - { - return -1; - } - - xv_setup_colorkeyhandling( ck_method_arg.str, ck_src_arg.str ); - - return 0; -} - -static int config(uint32_t width, uint32_t height, - uint32_t d_width, uint32_t d_height, - uint32_t flags, char *title, uint32_t format){ - int i,mode_id,rez; - int numblocks,blocks_per_macroblock;//bpmb we have 6,8,12 - -//from vo_xv - XVisualInfo vinfo; - XSetWindowAttributes xswa; - XWindowAttributes attribs; - unsigned long xswamask; - int depth; -#ifdef CONFIG_XF86VM - int vm = flags & VOFLAG_MODESWITCHING; -#endif -//end of vo_xv - - if( !IMGFMT_IS_XVMC(format) ) - { - assert(0);//should never happen, abort on debug or - return 1;//return error on relese - } - -// Find free port that supports MC, by querying adaptors - if( xv_port != 0 || number_of_surfaces != 0 ){ - if( height==image_height && width==image_width && image_format==format){ - xvmc_clean_surfaces(); - goto skip_surface_allocation; - } - xvmc_free(); - }; - numblocks=((width+15)/16)*((height+15)/16); -// Find Supported Surface Type - mode_id = xvmc_find_surface_by_format(format,width,height,&surface_info,0);//false=1 to grab port, not query - if ( mode_id == 0 ) - { - return -1; - } - - rez = XvMCCreateContext(mDisplay, xv_port,mode_id,width,height,XVMC_DIRECT,&ctx); - if( rez != Success ){ - mp_msg(MSGT_VO,MSGL_ERR,"vo_xvmc: XvMCCreateContext failed with error %d\n",rez); - return -1; - } - if( ctx.flags & XVMC_DIRECT ){ - mp_msg(MSGT_VO,MSGL_INFO,"vo_xvmc: Allocated Direct Context\n"); - }else{ - mp_msg(MSGT_VO,MSGL_INFO,"vo_xvmc: Allocated Indirect Context!\n"); - } - - - blocks_per_macroblock = 6; - if(surface_info.chroma_format == XVMC_CHROMA_FORMAT_422) - blocks_per_macroblock = 8; - if(surface_info.chroma_format == XVMC_CHROMA_FORMAT_444) - blocks_per_macroblock = 12; - - rez = XvMCCreateBlocks(mDisplay,&ctx,numblocks*blocks_per_macroblock,&data_blocks); - if( rez != Success ){ - XvMCDestroyContext(mDisplay,&ctx); - return -1; - } - mp_msg(MSGT_VO,MSGL_INFO,"vo_xvmc: data_blocks allocated\n"); - - rez = XvMCCreateMacroBlocks(mDisplay,&ctx,numblocks,&mv_blocks); - if( rez != Success ){ - XvMCDestroyBlocks(mDisplay,&data_blocks); - XvMCDestroyContext(mDisplay,&ctx); - return -1; - } - mp_msg(MSGT_VO,MSGL_INFO,"vo_xvmc: mv_blocks allocated\n"); - - if(surface_render==NULL) - surface_render = malloc(MAX_SURFACES * sizeof(struct xvmc_pix_fmt)); //easy mem debug - memset(surface_render, 0, MAX_SURFACES * sizeof(struct xvmc_pix_fmt)); - - for(i=0; i<MAX_SURFACES; i++){ - rez=XvMCCreateSurface(mDisplay,&ctx,&surface_array[i]); - if( rez != Success ) - break; - surface_render[i].xvmc_id = AV_XVMC_ID; - surface_render[i].data_blocks = data_blocks.blocks; - surface_render[i].mv_blocks = mv_blocks.macro_blocks; - surface_render[i].allocated_mv_blocks = numblocks; - surface_render[i].allocated_data_blocks = numblocks*blocks_per_macroblock; - surface_render[i].idct = (surface_info.mc_type & XVMC_IDCT) == XVMC_IDCT; - surface_render[i].unsigned_intra = (surface_info.flags & XVMC_INTRA_UNSIGNED) == XVMC_INTRA_UNSIGNED; - surface_render[i].p_surface = &surface_array[i]; - mp_msg(MSGT_VO,MSGL_DBG4,"vo_xvmc: surface[%d] = %p .rndr=%p\n", - i,&surface_array[i], &surface_render[i]); - } - number_of_surfaces = i; - if( number_of_surfaces < 4 ){// +2 I or P and +2 for B (to avoid visible motion drawing) - mp_msg(MSGT_VO,MSGL_ERR,"vo_xvmc: Unable to allocate at least 4 Surfaces\n"); - uninit(); - return -1; - } - mp_msg(MSGT_VO,MSGL_INFO,"vo_xvmc: Motion Compensation context allocated - %d surfaces\n", - number_of_surfaces); - - //debug - mp_msg(MSGT_VO,MSGL_INFO,"vo_xvmc: idct=%d unsigned_intra=%d\n", - (surface_info.mc_type & XVMC_IDCT) == XVMC_IDCT, - (surface_info.flags & XVMC_INTRA_UNSIGNED) == XVMC_INTRA_UNSIGNED); - -// Find way to display OSD & subtitle - mp_msg(MSGT_VO,MSGL_INFO,"vo_xvmc: looking for OSD support\n"); - subpicture_mode = NO_SUBPICTURE; - if(surface_info.flags & XVMC_OVERLAID_SURFACE) - subpicture_mode = OVERLAY_SUBPICTURE; - - if(surface_info.subpicture_max_width != 0 && - surface_info.subpicture_max_height != 0 ){ - int s,k,num_subpic; - - XvImageFormatValues * xvfmv; - xvfmv = XvMCListSubpictureTypes(mDisplay, xv_port, - surface_info.surface_type_id, &num_subpic); - - if(num_subpic != 0 && xvfmv != NULL){ - if( mp_msg_test(MSGT_VO,MSGL_DBG4) ){//Print all subpicture types for debug - for(s=0;s<num_subpic;s++) - print_xvimage_format_values(&xvfmv[s]); - } - - for(s=0;s<num_subpic;s++){ - for(k=0;osd_render[k].draw_func_ptr!=NULL;k++){ - if(xvfmv[s].id == osd_render[k].id) - { - init_osd_fnc = osd_render[k].init_func_ptr; - draw_osd_fnc = osd_render[k].draw_func_ptr; - clear_osd_fnc = osd_render[k].clear_func_ptr; - - subpicture_mode = BLEND_SUBPICTURE; - subpicture_info = xvfmv[s]; - mp_msg(MSGT_VO,MSGL_INFO," Subpicture id 0x%08X\n",subpicture_info.id); - goto found_subpic; - } - } |