[vlc-devel] commit: Converted dummy vout to "vout display". (Laurent Aimar )

git version control git at videolan.org
Sun Aug 30 20:11:44 CEST 2009


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Sun Aug 30 01:07:54 2009 +0200| [d7892f1243a8d8513547ad0a46800eedff32d059] | committer: Laurent Aimar 

Converted dummy vout to "vout display".

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d7892f1243a8d8513547ad0a46800eedff32d059
---

 modules/misc/dummy/dummy.c |    2 +-
 modules/misc/dummy/vout.c  |  201 ++++++++------------------------------------
 2 files changed, 38 insertions(+), 165 deletions(-)

diff --git a/modules/misc/dummy/dummy.c b/modules/misc/dummy/dummy.c
index 9fd1940..b82fed0 100644
--- a/modules/misc/dummy/dummy.c
+++ b/modules/misc/dummy/dummy.c
@@ -97,7 +97,7 @@ vlc_module_begin ()
     add_submodule ()
         set_description( N_("Dummy video output function") )
         set_section( N_( "Dummy Video output" ), NULL )
-        set_capability( "video output", 1 )
+        set_capability( "vout display", 1 )
         set_callbacks( OpenVideo, NULL )
         set_category( CAT_VIDEO )
         set_subcategory( SUBCAT_VIDEO_VOUT )
diff --git a/modules/misc/dummy/vout.c b/modules/misc/dummy/vout.c
index 3311041..9bc06ab 100644
--- a/modules/misc/dummy/vout.c
+++ b/modules/misc/dummy/vout.c
@@ -1,7 +1,7 @@
 /*****************************************************************************
- * vout_dummy.c: Dummy video output display method for testing purposes
+ * vout.c: Dummy video output display method for testing purposes
  *****************************************************************************
- * Copyright (C) 2000, 2001 the VideoLAN team
+ * Copyright (C) 2000-2009 the VideoLAN team
  * $Id$
  *
  * Authors: Samuel Hocevar <sam at zoy.org>
@@ -30,189 +30,62 @@
 #endif
 
 #include <vlc_common.h>
-#include <vlc_vout.h>
-
-#define DUMMY_WIDTH 16
-#define DUMMY_HEIGHT 16
-#define DUMMY_MAX_DIRECTBUFFERS 10
-
+#include <vlc_vout_display.h>
 #include "dummy.h"
 
 /*****************************************************************************
  * Local prototypes
  *****************************************************************************/
-static int  Init       ( vout_thread_t * );
-static void End        ( vout_thread_t * );
-static int  Manage     ( vout_thread_t * );
-static void Render     ( vout_thread_t *, picture_t * );
-static void Display    ( vout_thread_t *, picture_t * );
-static void SetPalette ( vout_thread_t *, uint16_t *, uint16_t *, uint16_t * );
-static int  Control   ( vout_thread_t *, int, va_list );
-
-/*****************************************************************************
- * OpenVideo: activates dummy video thread output method
- *****************************************************************************
- * This function initializes a dummy vout method.
- *****************************************************************************/
-int OpenVideo ( vlc_object_t *p_this )
-{
-    vout_thread_t * p_vout = (vout_thread_t *)p_this;
-
-    p_vout->pf_init = Init;
-    p_vout->pf_end = End;
-    p_vout->pf_manage = Manage;
-    p_vout->pf_render = Render;
-    p_vout->pf_display = Display;
-    p_vout->pf_control = Control;
-
-    return VLC_SUCCESS;
-}
-
-/*****************************************************************************
- * Control: control facility for the vout
- *****************************************************************************/
-static int Control( vout_thread_t *p_vout, int i_query, va_list args )
-{
-    (void) p_vout; (void) i_query; (void) args;
-    return VLC_EGENERIC;
-}
-
+static picture_t *Get(vout_display_t *);
+static void       Display(vout_display_t *, picture_t *);
+static int        Control(vout_display_t *, int, va_list);
+static void       Manage(vout_display_t *);
 
 /*****************************************************************************
- * Init: initialize dummy video thread output method
+ * OpenVideo: activates dummy vout display method
  *****************************************************************************/
-static int Init( vout_thread_t *p_vout )
+int OpenVideo(vlc_object_t *object)
 {
-    int i_index, i_chroma;
-    char *psz_chroma;
-    picture_t *p_pic;
-    bool b_chroma = 0;
-
-    psz_chroma = config_GetPsz( p_vout, "dummy-chroma" );
-    i_chroma = vlc_fourcc_GetCodecFromString( VIDEO_ES, psz_chroma );
-    b_chroma = i_chroma != 0;
-    free( psz_chroma );
-
-    I_OUTPUTPICTURES = 0;
-
-    /* Initialize the output structure */
-    if( b_chroma )
-    {
-        msg_Dbg( p_vout, "forcing chroma 0x%.8x (%4.4s)",
-                         i_chroma, (char*)&i_chroma );
-        p_vout->output.i_chroma = i_chroma;
-        if ( i_chroma == VLC_CODEC_RGB8 )
-        {
-            p_vout->output.pf_setpalette = SetPalette;
-        }
-        p_vout->output.i_width  = p_vout->render.i_width;
-        p_vout->output.i_height = p_vout->render.i_height;
-        p_vout->output.i_aspect = p_vout->render.i_aspect;
-    }
-    else
-    {
-        /* Use same chroma as input */
-        p_vout->output.i_chroma = p_vout->render.i_chroma;
-        p_vout->output.i_rmask  = p_vout->render.i_rmask;
-        p_vout->output.i_gmask  = p_vout->render.i_gmask;
-        p_vout->output.i_bmask  = p_vout->render.i_bmask;
-        p_vout->output.i_width  = p_vout->render.i_width;
-        p_vout->output.i_height = p_vout->render.i_height;
-        p_vout->output.i_aspect = p_vout->render.i_aspect;
-    }
-
-    /* Try to initialize DUMMY_MAX_DIRECTBUFFERS direct buffers */
-    while( I_OUTPUTPICTURES < DUMMY_MAX_DIRECTBUFFERS )
-    {
-        p_pic = NULL;
-
-        /* Find an empty picture slot */
-        for( i_index = 0 ; i_index < VOUT_MAX_PICTURES ; i_index++ )
-        {
-            if( p_vout->p_picture[ i_index ].i_status == FREE_PICTURE )
-            {
-                p_pic = p_vout->p_picture + i_index;
-                break;
-            }
-        }
+    vout_display_t *vd = (vout_display_t *)object;
 
-        /* Allocate the picture */
-        if( p_pic == NULL )
-        {
-            break;
-        }
-
-        vout_AllocatePicture( VLC_OBJECT(p_vout), p_pic, p_vout->output.i_chroma,
-                              p_vout->output.i_width, p_vout->output.i_height,
-                              p_vout->output.i_aspect );
+    /* p_vd->info is not modified */
 
-        if( p_pic->i_planes == 0 )
-        {
-            break;
+    char *chroma = var_CreateGetNonEmptyString(vd, "dummy-chroma");
+    if (chroma) {
+        vlc_fourcc_t fcc = vlc_fourcc_GetCodecFromString(VIDEO_ES, chroma);
+        if (fcc != 0) {
+            msg_Dbg(vd, "forcing chroma 0x%.8x (%4.4s)", fcc, (char*)&fcc);
+            vd->fmt.i_chroma = fcc;
         }
-
-        p_pic->i_status = DESTROYED_PICTURE;
-        p_pic->i_type   = DIRECT_PICTURE;
-
-        PP_OUTPUTPICTURE[ I_OUTPUTPICTURES ] = p_pic;
-
-        I_OUTPUTPICTURES++;
+        free(chroma);
     }
+    vd->get = Get;
+    vd->prepare = NULL;
+    vd->display = Display;
+    vd->control = Control;
+    vd->manage = Manage;
 
-    return( 0 );
-}
-
-/*****************************************************************************
- * End: terminate dummy video thread output method
- *****************************************************************************/
-static void End( vout_thread_t *p_vout )
-{
-    int i_index;
-
-    /* Free the fake output buffers we allocated */
-    for( i_index = I_OUTPUTPICTURES ; i_index ; )
-    {
-        i_index--;
-        free( PP_OUTPUTPICTURE[ i_index ]->p_data_orig );
-    }
+    return VLC_SUCCESS;
 }
 
-/*****************************************************************************
- * Manage: handle dummy events
- *****************************************************************************
- * This function should be called regularly by video output thread. It manages
- * console events. It returns a non null value on error.
- *****************************************************************************/
-static int Manage( vout_thread_t *p_vout )
+static picture_t *Get(vout_display_t *vd)
 {
-    VLC_UNUSED(p_vout);
-    return( 0 );
+    VLC_UNUSED(vd);
+    return picture_NewFromFormat(&vd->fmt);
 }
-
-/*****************************************************************************
- * Render: render previously calculated output
- *****************************************************************************/
-static void Render( vout_thread_t *p_vout, picture_t *p_pic )
+static void Display(vout_display_t *vd, picture_t *picture)
 {
-    VLC_UNUSED(p_vout); VLC_UNUSED(p_pic);
-    /* No need to do anything, the fake direct buffers stay as they are */
+    VLC_UNUSED(vd);
+    picture_Release(picture);
 }
-
-/*****************************************************************************
- * Display: displays previously rendered output
- *****************************************************************************/
-static void Display( vout_thread_t *p_vout, picture_t *p_pic )
+static int Control(vout_display_t *vd, int query, va_list args)
 {
-    VLC_UNUSED(p_vout); VLC_UNUSED(p_pic);
-    /* No need to do anything, the fake direct buffers stay as they are */
+    VLC_UNUSED(vd);
+    VLC_UNUSED(query);
+    VLC_UNUSED(args);
+    return VLC_SUCCESS;
 }
-
-/*****************************************************************************
- * SetPalette: set the palette for the picture
- *****************************************************************************/
-static void SetPalette ( vout_thread_t *p_vout,
-                         uint16_t *red, uint16_t *green, uint16_t *blue )
+static void Manage(vout_display_t *vd)
 {
-    VLC_UNUSED(p_vout); VLC_UNUSED(red); VLC_UNUSED(green); VLC_UNUSED(blue);
-    /* No need to do anything, the fake direct buffers stay as they are */
+    VLC_UNUSED(vd);
 }




More information about the vlc-devel mailing list