[vlc-devel] [PATCH 2/2] Remove Xlib XVideo video output

Rémi Denis-Courmont remi at remlab.net
Sun Aug 16 22:37:55 CEST 2009


---
 modules/video_output/x11/Modules.am |    6 --
 modules/video_output/x11/xcommon.c  |  114 +++------------------------------
 modules/video_output/x11/xcommon.h  |    8 +--
 modules/video_output/x11/xvideo.c   |  122 -----------------------------------
 4 files changed, 12 insertions(+), 238 deletions(-)
 delete mode 100644 modules/video_output/x11/xvideo.c

diff --git a/modules/video_output/x11/Modules.am b/modules/video_output/x11/Modules.am
index 6aadb8a..f3e563a 100644
--- a/modules/video_output/x11/Modules.am
+++ b/modules/video_output/x11/Modules.am
@@ -1,9 +1,3 @@
-SOURCES_xvideo = \
-	xvideo.c \
-	xcommon.c \
-	xcommon.h \
-	$(NULL)
-
 SOURCES_glx = \
 	glx.c \
 	xcommon.c \
diff --git a/modules/video_output/x11/xcommon.c b/modules/video_output/x11/xcommon.c
index e6ccefd..7e3fca8 100644
--- a/modules/video_output/x11/xcommon.c
+++ b/modules/video_output/x11/xcommon.c
@@ -64,16 +64,13 @@
 #   include <X11/extensions/dpms.h>
 #endif
 
-#if defined(MODULE_NAME_IS_xvideo) || defined(MODULE_NAME_IS_xvmc)
-#   include <X11/extensions/Xv.h>
-#   include <X11/extensions/Xvlib.h>
-#endif
-
 #ifdef MODULE_NAME_IS_glx
 #   include <GL/glx.h>
 #endif
 
 #ifdef MODULE_NAME_IS_xvmc
+#   include <X11/extensions/Xv.h>
+#   include <X11/extensions/Xvlib.h>
 #   include <X11/extensions/vldXvMC.h>
 #   include "../../codec/xvmc/accel_xvmc.h"
 #endif
@@ -117,12 +114,9 @@ static void CreateCursor   ( vout_thread_t * );
 static void DestroyCursor  ( vout_thread_t * );
 static void ToggleCursor   ( vout_thread_t * );
 
-#if defined(MODULE_NAME_IS_xvideo) || defined(MODULE_NAME_IS_xvmc)
+#if defined(MODULE_NAME_IS_xvmc)
 static int  XVideoGetPort    ( vout_thread_t *, vlc_fourcc_t, picture_heap_t * );
 static void XVideoReleasePort( vout_thread_t *, int );
-#endif
-
-#ifdef MODULE_NAME_IS_xvmc
 static void RenderVideo    ( vout_thread_t *, picture_t * );
 static int  xvmc_check_yv12( Display *display, XvPortID port );
 static void xvmc_update_XV_DOUBLE_BUFFER( vout_thread_t *p_vout );
@@ -154,8 +148,6 @@ int Activate ( vlc_object_t *p_this )
     char *        psz_display;
 #if defined(MODULE_NAME_IS_xvmc)
     char *psz_value;
-#endif
-#if defined(MODULE_NAME_IS_xvideo) || defined(MODULE_NAME_IS_xvmc)
     char *       psz_chroma;
     vlc_fourcc_t i_chroma = 0;
     bool   b_chroma = 0;
@@ -204,7 +196,7 @@ int Activate ( vlc_object_t *p_this )
     /* Get a screen ID matching the XOpenDisplay return value */
     p_vout->p_sys->i_screen = DefaultScreen( p_vout->p_sys->p_display );
 
-#if defined(MODULE_NAME_IS_xvideo) || defined(MODULE_NAME_IS_xvmc)
+#if defined(MODULE_NAME_IS_xvmc)
     psz_chroma = config_GetPsz( p_vout, "xvideo-chroma" );
     if( psz_chroma )
     {
@@ -441,9 +433,7 @@ void Deactivate ( vlc_object_t *p_this )
         ToggleCursor( p_vout );
     }
 
-#if defined(MODULE_NAME_IS_xvideo)
-    XVideoReleasePort( p_vout, p_vout->p_sys->i_xvport );
-#elif defined(MODULE_NAME_IS_xvmc)
+#if defined(MODULE_NAME_IS_xvmc)
     if( p_vout->p_sys->xvmc_cap )
     {
         xvmc_context_writer_lock( &p_vout->p_sys->xvmc_lock );
@@ -763,7 +753,7 @@ static int InitVideo( vout_thread_t *p_vout )
 
     I_OUTPUTPICTURES = 0;
 
-#if defined(MODULE_NAME_IS_xvideo) || defined(MODULE_NAME_IS_xvmc)
+#if defined(MODULE_NAME_IS_xvmc)
     /* Initialize the output structure; we already found an XVideo port,
      * and the corresponding chroma we will be using. Since we can
      * arbitrary scale, stick to the coordinates and aspect. */
@@ -1217,43 +1207,7 @@ static int ManageVideo( vout_thread_t *p_vout )
     /* Handle events for video output sub-window */
     while( XCheckWindowEvent( p_vout->p_sys->p_display,
                               p_vout->p_sys->window.video_window,
-                              ExposureMask, &xevent ) == True )
-    {
-        /* Window exposed (only handled if stream playback is paused) */
-        if( xevent.type == Expose )
-        {
-            if( ((XExposeEvent *)&xevent)->count == 0 )
-            {
-                /* (if this is the last a collection of expose events...) */
-
-#if defined(MODULE_NAME_IS_xvideo)
-                x11_window_t *p_win = &p_vout->p_sys->window;
-
-                /* Paint the colour key if needed */
-                if( p_vout->p_sys->b_paint_colourkey &&
-                    xevent.xexpose.window == p_win->video_window )
-                {
-                    XSetForeground( p_vout->p_sys->p_display,
-                                    p_win->gc, p_vout->p_sys->i_colourkey );
-                    XFillRectangle( p_vout->p_sys->p_display,
-                                    p_win->video_window, p_win->gc, 0, 0,
-                                    p_win->i_width, p_win->i_height );
-                }
-#endif
-
-#if 0
-                if( p_vout->p_libvlc->p_input_bank->pp_input[0] != NULL )
-                {
-                    if( PAUSE_S == p_vout->p_libvlc->p_input_bank->pp_input[0]
-                                                   ->stream.control.i_status )
-                    {
-                        /* XVideoDisplay( p_vout )*/;
-                    }
-                }
-#endif
-            }
-        }
-    }
+                              ExposureMask, &xevent ) == True );
 
     /* ClientMessage event - only WM_PROTOCOLS with WM_DELETE_WINDOW data
      * are handled - according to the man pages, the format is always 32
@@ -1919,7 +1873,7 @@ static void ToggleCursor( vout_thread_t *p_vout )
     }
 }
 
-#if defined(MODULE_NAME_IS_xvideo) || defined(MODULE_NAME_IS_xvmc)
+#if defined(MODULE_NAME_IS_xvmc)
 /*****************************************************************************
  * XVideoGetPort: get YUV12 port
  *****************************************************************************/
@@ -1971,11 +1925,7 @@ static int XVideoGetPort( vout_thread_t *p_vout,
     }
 
     i_selected_port = -1;
-#ifdef MODULE_NAME_IS_xvmc
     i_requested_adaptor = config_GetInt( p_vout, "xvmc-adaptor" );
-#else
-    i_requested_adaptor = config_GetInt( p_vout, "xvideo-adaptor" );
-#endif
     for( i_adaptor = 0; i_adaptor < i_num_adaptors; ++i_adaptor )
     {
         XvImageFormatValues *p_formats;
@@ -2162,15 +2112,6 @@ static int InitDisplay( vout_thread_t *p_vout )
         msg_Dbg( p_vout, "XShm video extension disabled" );
 #endif
 
-#ifdef MODULE_NAME_IS_xvideo
-    /* XXX The brightness and contrast values should be read from environment
-     * XXX variables... */
-#if 0
-    XVideoSetAttribute( p_vout, "XV_BRIGHTNESS", 0.5 );
-    XVideoSetAttribute( p_vout, "XV_CONTRAST",   0.5 );
-#endif
-#endif
-
     return VLC_SUCCESS;
 }
 
@@ -2193,10 +2134,7 @@ IMAGE_TYPE * CreateShmImage( vout_thread_t *p_vout,
     Status result;
 
     /* Create XImage / XvImage */
-#ifdef MODULE_NAME_IS_xvideo
-    p_image = XvShmCreateImage( p_display, i_xvport, i_chroma, 0,
-                                i_width, i_height, p_shm );
-#elif defined(MODULE_NAME_IS_xvmc)
+#if defined(MODULE_NAME_IS_xvmc)
     p_image = XvShmCreateImage( p_display, i_xvport, i_chroma, 0,
                                 i_width, i_height, p_shm );
 #endif
@@ -2271,40 +2209,6 @@ IMAGE_TYPE * CreateShmImage( vout_thread_t *p_vout,
 }
 #endif
 
-/*****************************************************************************
- * CreateImage: create an XImage or XvImage
- *****************************************************************************
- * Create a simple image used as a buffer.
- *****************************************************************************/
-static IMAGE_TYPE * CreateImage( vout_thread_t *p_vout,
-                                 Display *p_display, EXTRA_ARGS,
-                                 int i_width, int i_height )
-{
-    uint8_t *    p_data;                          /* image data storage zone */
-    IMAGE_TYPE *p_image;
-
-    /* Allocate memory for image */
-#ifdef MODULE_NAME_IS_xvideo
-    p_data = malloc( i_width * i_height * i_bits_per_pixel / 8 );
-#endif
-    if( !p_data )
-        return NULL;
-
-    /* Create XImage. p_data will be automatically freed */
-#ifdef MODULE_NAME_IS_xvideo
-    p_image = XvCreateImage( p_display, i_xvport, i_chroma,
-                             (char *)p_data, i_width, i_height );
-#endif
-    if( p_image == NULL )
-    {
-        msg_Err( p_vout, "XCreateImage() failed" );
-        free( p_data );
-        return NULL;
-    }
-
-    return p_image;
-}
-
 #endif
 /*****************************************************************************
  * X11ErrorHandler: replace error handler so we can intercept some of them
diff --git a/modules/video_output/x11/xcommon.h b/modules/video_output/x11/xcommon.h
index 7dac1c9..8337c28 100644
--- a/modules/video_output/x11/xcommon.h
+++ b/modules/video_output/x11/xcommon.h
@@ -27,7 +27,7 @@
 /*****************************************************************************
  * Defines
  *****************************************************************************/
-#if defined(MODULE_NAME_IS_xvideo) || defined(MODULE_NAME_IS_xvmc)
+#if defined(MODULE_NAME_IS_xvmc)
 #   define IMAGE_TYPE     XvImage
 #   define EXTRA_ARGS     int i_xvport, int i_chroma, int i_bits_per_pixel
 #   define EXTRA_ARGS_SHM int i_xvport, int i_chroma, XShmSegmentInfo *p_shm
@@ -219,7 +219,7 @@ struct vout_sys_t
     int                 i_shm_opcode;      /* shared memory extension opcode */
 #endif
 
-#if defined(MODULE_NAME_IS_xvideo) || defined(MODULE_NAME_IS_xvmc)
+#if defined(MODULE_NAME_IS_xvmc)
     int                 i_xvport;
     bool          b_paint_colourkey;
     int                 i_colourkey;
@@ -359,9 +359,7 @@ typedef struct mwmhints_t
 /*****************************************************************************
  * Chroma defines
  *****************************************************************************/
-#ifdef MODULE_NAME_IS_xvideo
-#   define MAX_DIRECTBUFFERS (VOUT_MAX_PICTURES)
-#elif defined(MODULE_NAME_IS_xvmc)
+#if defined(MODULE_NAME_IS_xvmc)
 #   define MAX_DIRECTBUFFERS (VOUT_MAX_PICTURES+2)
 #else
 #   define MAX_DIRECTBUFFERS 2
diff --git a/modules/video_output/x11/xvideo.c b/modules/video_output/x11/xvideo.c
deleted file mode 100644
index c381938..0000000
--- a/modules/video_output/x11/xvideo.c
+++ /dev/null
@@ -1,122 +0,0 @@
-/*****************************************************************************
- * xvideo.c : Xvideo plugin for vlc
- *****************************************************************************
- * Copyright (C) 1998-2001 the VideoLAN team
- * $Id$
- *
- * Authors: Shane Harper <shanegh at optusnet.com.au>
- *          Vincent Seguin <seguin at via.ecp.fr>
- *          Samuel Hocevar <sam at zoy.org>
- *          David Kennedy <dkennedy at tinytoad.com>
- *
- * This program 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.
- *
- * This program 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 this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-
-/*****************************************************************************
- * Preamble
- *****************************************************************************/
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include <vlc_common.h>
-#include <vlc_plugin.h>
-
-/*****************************************************************************
- * Exported prototypes
- *****************************************************************************/
-extern int  Activate   ( vlc_object_t * );
-extern void Deactivate ( vlc_object_t * );
-
-/*****************************************************************************
- * Module descriptor
- *****************************************************************************/
-#define ADAPTOR_TEXT N_("XVideo adaptor number")
-#define ADAPTOR_LONGTEXT N_( \
-    "If your graphics card provides several adaptors, you need to choose " \
-    "which one will be used (you shouldn't have to change this).")
-
-#define DISPLAY_TEXT N_("X11 display")
-#define DISPLAY_LONGTEXT N_( \
-    "X11 hardware display to use. By default VLC will " \
-    "use the value of the DISPLAY environment variable.")
-
-#define CHROMA_TEXT N_("XVimage chroma format")
-#define CHROMA_LONGTEXT N_( \
-    "Force the XVideo renderer to use a specific chroma format instead of " \
-    "trying to improve performances by using the most efficient one.")
-
-#define SHM_TEXT N_("Use shared memory")
-#define SHM_LONGTEXT N_( \
-    "Use shared memory to communicate between VLC and the X server.")
-
-vlc_module_begin ()
-    set_shortname( "XVideo" )
-    set_category( CAT_VIDEO )
-    set_subcategory( SUBCAT_VIDEO_VOUT )
-    add_string( "xvideo-display", NULL, NULL, DISPLAY_TEXT, DISPLAY_LONGTEXT, true )
-    add_integer( "xvideo-adaptor", -1, NULL, ADAPTOR_TEXT, ADAPTOR_LONGTEXT, true )
-    add_string( "xvideo-chroma", NULL, NULL, CHROMA_TEXT, CHROMA_LONGTEXT, true )
-#ifdef HAVE_SYS_SHM_H
-    add_bool( "xvideo-shm", 1, NULL, SHM_TEXT, SHM_LONGTEXT, true )
-#endif
-
-    set_description( N_("XVideo extension video output") )
-    set_capability( "video output", 150 )
-    set_callbacks( Activate, Deactivate )
-vlc_module_end ()
-
-/* following functions are local */
-
-#if 0
-/*****************************************************************************
- * XVideoSetAttribute
- *****************************************************************************
- * This function can be used to set attributes, e.g. XV_BRIGHTNESS and
- * XV_CONTRAST. "f_value" should be in the range of 0 to 1.
- *****************************************************************************/
-static void XVideoSetAttribute( vout_thread_t *p_vout,
-                                char *attr_name, float f_value )
-{
-    int             i_attrib;
-    XvAttribute    *p_attrib;
-    Display        *p_display = p_vout->p_sys->p_display;
-    int             i_xvport  = p_vout->p_sys->i_xvport;
-
-    p_attrib = XvQueryPortAttributes( p_display, i_xvport, &i_attrib );
-
-    do
-    {
-        i_attrib--;
-
-        if( i_attrib >= 0 && !strcmp( p_attrib[ i_attrib ].name, attr_name ) )
-        {
-            int i_sv = f_value * ( p_attrib[ i_attrib ].max_value
-                                    - p_attrib[ i_attrib ].min_value + 1 )
-                        + p_attrib[ i_attrib ].min_value;
-
-            XvSetPortAttribute( p_display, i_xvport,
-                            XInternAtom( p_display, attr_name, False ), i_sv );
-            break;
-        }
-
-    } while( i_attrib > 0 );
-
-    if( p_attrib )
-        XFree( p_attrib );
-}
-#endif
-
-- 
1.6.3.3




More information about the vlc-devel mailing list