[vlc-devel] commit: Added dump alias module to dummy decoder. (Laurent Aimar )

git version control git at videolan.org
Tue Sep 30 22:30:59 CEST 2008


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Sun Sep 28 16:57:04 2008 +0200| [46ff41d473e1dcea72326167e71781223db3cdea] | committer: Laurent Aimar 

Added dump alias module to dummy decoder.

It allows replacing --codec dummy --dummy-save-es by --codec dump.

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

 modules/misc/dummy/decoder.c |   21 +++++++++++++++++----
 modules/misc/dummy/dummy.c   |    6 ++++++
 modules/misc/dummy/dummy.h   |    5 +++--
 3 files changed, 26 insertions(+), 6 deletions(-)

diff --git a/modules/misc/dummy/decoder.c b/modules/misc/dummy/decoder.c
index 732008c..4b96808 100644
--- a/modules/misc/dummy/decoder.c
+++ b/modules/misc/dummy/decoder.c
@@ -67,7 +67,7 @@ static void *DecodeBlock( decoder_t *p_dec, block_t **pp_block );
 /*****************************************************************************
  * OpenDecoder: Open the decoder
  *****************************************************************************/
-int OpenDecoder ( vlc_object_t *p_this )
+static int OpenDecoderCommon( vlc_object_t *p_this, bool b_force_dump )
 {
     decoder_t *p_dec = (decoder_t*)p_this;
     decoder_sys_t *p_sys;
@@ -85,9 +85,13 @@ int OpenDecoder ( vlc_object_t *p_this )
     snprintf( psz_file, sizeof( psz_file), "stream.%p", p_dec );
 
 #ifndef UNDER_CE
-    var_Create( p_dec, "dummy-save-es", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
-    var_Get( p_dec, "dummy-save-es", &val );
-    if( val.b_bool )
+    if( !b_force_dump )
+    {
+        var_Create( p_dec, "dummy-save-es", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
+        var_Get( p_dec, "dummy-save-es", &val );
+        b_force_dump = val.b_bool;
+    }
+    if( b_force_dump )
     {
         p_sys->i_fd = open( psz_file, O_WRONLY | O_CREAT | O_TRUNC, 00644 );
 
@@ -116,6 +120,15 @@ int OpenDecoder ( vlc_object_t *p_this )
     return VLC_SUCCESS;
 }
 
+int OpenDecoder( vlc_object_t *p_this )
+{
+    return OpenDecoderCommon( p_this, false );
+}
+int  OpenDecoderDump( vlc_object_t *p_this )
+{
+    return OpenDecoderCommon( p_this, true );
+}
+
 /****************************************************************************
  * RunDecoder: the whole thing
  ****************************************************************************
diff --git a/modules/misc/dummy/dummy.c b/modules/misc/dummy/dummy.c
index c49e7ee..2bad913 100644
--- a/modules/misc/dummy/dummy.c
+++ b/modules/misc/dummy/dummy.c
@@ -83,6 +83,12 @@ vlc_module_begin();
         set_callbacks( OpenDecoder, CloseDecoder );
         add_bool( "dummy-save-es", 0, NULL, SAVE_TEXT, SAVE_LONGTEXT, true );
     add_submodule();
+        set_section( N_( "Dump decoder" ), NULL );
+        set_description( N_("Dump decoder function") );
+        set_capability( "decoder", -1 );
+        set_callbacks( OpenDecoderDump, CloseDecoder );
+        add_shortcut( "dump" );
+    add_submodule();
         set_description( N_("Dummy encoder function") );
         set_capability( "encoder", 0 );
         set_callbacks( OpenEncoder, CloseEncoder );
diff --git a/modules/misc/dummy/dummy.h b/modules/misc/dummy/dummy.h
index a31c872..09f8972 100644
--- a/modules/misc/dummy/dummy.h
+++ b/modules/misc/dummy/dummy.h
@@ -31,8 +31,9 @@ int  OpenAccess   ( vlc_object_t * );
 int  OpenDemux    ( vlc_object_t * );
 void CloseDemux   ( vlc_object_t * );
 
-int  OpenDecoder  ( vlc_object_t * );
-void CloseDecoder ( vlc_object_t * );
+int  OpenDecoder    ( vlc_object_t * );
+int  OpenDecoderDump( vlc_object_t * );
+void CloseDecoder   ( vlc_object_t * );
 
 int  OpenEncoder  ( vlc_object_t * );
 void CloseEncoder ( vlc_object_t * );




More information about the vlc-devel mailing list