[vlc-devel] commit: Don't compile sout code if sout is disabled ( Rémi Denis-Courmont )

git version control git at videolan.org
Thu May 1 19:03:26 CEST 2008


vlc | branch: master | Rémi Denis-Courmont <rem at videolan.org> | Thu May  1 20:04:27 2008 +0300| [77d07c4028f5760684f3f41b6e0c382731d2de11]

Don't compile sout code if sout is disabled

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

 src/Makefile.am       |   21 ++++++++++++++-------
 src/input/decoder.c   |   13 +++++++++++--
 src/input/input.c     |   13 ++++++++-----
 src/libvlc-common.c   |   12 ++++++++++--
 src/playlist/engine.c |    4 ++++
 5 files changed, 47 insertions(+), 16 deletions(-)

diff --git a/src/Makefile.am b/src/Makefile.am
index c5e1e16..16c9611 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -200,6 +200,7 @@ EXTRA_libvlc_la_SOURCES = \
 	$(SOURCES_libvlc_win32) \
 	$(SOURCES_libvlc_dirent) \
 	$(SOURCES_libvlc_getopt) \
+	$(SOURCES_libvlc_sout) \
 	$(NULL)
 if HAVE_BEOS
 libvlc_la_SOURCES += $(SOURCES_libvlc_beos)
@@ -219,6 +220,9 @@ endif
 if BUILD_GETOPT
 libvlc_la_SOURCES += $(SOURCES_libvlc_getopt)
 endif
+if ENABLE_SOUT
+libvlc_la_SOURCES += $(SOURCES_libvlc_sout)
+endif
 
 SOURCES_libvlc_beos = \
 	misc/beos_specific.cpp \
@@ -292,12 +296,6 @@ SOURCES_libvlc_common = \
 	audio_output/mixer.c \
 	audio_output/output.c \
 	audio_output/intf.c \
-	stream_output/stream_output.c \
-	stream_output/stream_output.h \
-	stream_output/announce.c \
-	stream_output/profiles.c \
-	stream_output/sap.c \
-	stream_output/sdp.c \
 	osd/osd.c \
 	osd/osd_text.c \
 	osd/osd_widgets.c \
@@ -344,12 +342,21 @@ SOURCES_libvlc_common = \
 	misc/variables.c \
 	misc/error.c \
 	misc/update.c \
-	input/vlm.c \
 	misc/xml.c \
 	misc/devices.c \
 	extras/libc.c \
 	$(NULL)
 
+SOURCES_libvlc_sout = \
+	input/vlm.c \
+	stream_output/stream_output.c \
+	stream_output/stream_output.h \
+	stream_output/announce.c \
+	stream_output/profiles.c \
+	stream_output/sap.c \
+	stream_output/sdp.c \
+	$(NULL)
+
 SOURCES_libvlc = \
 	$(SOURCES_libvlc_common) \
 	$(OPT_SOURCES_libvlc_beos) \
diff --git a/src/input/decoder.c b/src/input/decoder.c
index 69dc112..5eaa1b3 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -153,6 +153,9 @@ decoder_t *input_DecoderNew( input_thread_t *p_input,
     decoder_t   *p_dec = NULL;
     vlc_value_t val;
 
+#ifndef ENABLE_SOUT
+    (void)b_force_decoder;
+#else
     /* If we are in sout mode, search for packetizer module */
     if( p_input->p->p_sout && !b_force_decoder )
     {
@@ -167,6 +170,7 @@ decoder_t *input_DecoderNew( input_thread_t *p_input,
         }
     }
     else
+#endif
     {
         /* Create the decoder configuration structure */
         p_dec = CreateDecoder( p_input, fmt, VLC_OBJECT_DECODER );
@@ -775,6 +779,7 @@ static int DecoderDecode( decoder_t *p_dec, block_t *p_block )
         return VLC_SUCCESS;
     }
 
+#ifdef ENABLE_SOUT
     if( p_dec->i_object_type == VLC_OBJECT_PACKETIZER )
     {
         block_t *p_sout_block;
@@ -829,7 +834,7 @@ static int DecoderDecode( decoder_t *p_dec, block_t *p_block )
                 p_sout_block = p_next;
             }
 
-            /* For now it's enough, as only sout inpact on this flag */
+            /* For now it's enough, as only sout impact on this flag */
             if( p_dec->p_owner->p_sout->i_out_pace_nocontrol > 0 &&
                 p_dec->p_owner->p_input->p->b_out_pace_control )
             {
@@ -844,7 +849,9 @@ static int DecoderDecode( decoder_t *p_dec, block_t *p_block )
             }
         }
     }
-    else if( p_dec->fmt_in.i_cat == AUDIO_ES )
+    else
+#endif
+    if( p_dec->fmt_in.i_cat == AUDIO_ES )
     {
         if( p_block )
             DecoderUpdatePreroll( &p_dec->p_owner->i_preroll_end, p_block );
@@ -1000,11 +1007,13 @@ static void DeleteDecoder( decoder_t * p_dec )
         vout_Request( p_dec, p_dec->p_owner->p_vout, 0 );
     }
 
+#ifdef ENABLE_SOUT
     if( p_dec->p_owner->p_sout_input )
     {
         sout_InputDelete( p_dec->p_owner->p_sout_input );
         es_format_Clean( &p_dec->p_owner->sout );
     }
+#endif
 
     if( p_dec->fmt_in.i_cat == SPU_ES )
     {
diff --git a/src/input/input.c b/src/input/input.c
index a6ddee4..6121f71 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -319,7 +319,7 @@ static void Destructor( input_thread_t * p_input )
 
     stats_TimerDump( p_input, STATS_TIMER_INPUT_LAUNCHING );
     stats_TimerClean( p_input, STATS_TIMER_INPUT_LAUNCHING );
-
+#ifdef ENABLE_SOUT
     if( priv->b_owns_its_sout && priv->p_sout )
     {
         if( priv->b_sout_keep )
@@ -330,7 +330,7 @@ static void Destructor( input_thread_t * p_input )
             priv->p_sout = NULL;
         }
     }
-
+#endif
     vlc_gc_decref( p_input->p->input.p_item );
 
     vlc_mutex_destroy( &p_input->p->counters.counters_lock );
@@ -819,6 +819,7 @@ static void InitStatistics( input_thread_t * p_input )
     }
 }
 
+#ifdef ENABLE_SOUT
 static int InitSout( input_thread_t * p_input )
 {
     char *psz;
@@ -883,6 +884,7 @@ static int InitSout( input_thread_t * p_input )
 
     return VLC_SUCCESS;
 }
+#endif
 
 static void InitTitle( input_thread_t * p_input )
 {
@@ -1161,10 +1163,11 @@ static int Init( input_thread_t * p_input )
     }
 
     InitStatistics( p_input );
+#ifdef ENABLE_SOUT
     ret = InitSout( p_input );
-
     if( ret != VLC_SUCCESS )
         return ret; /* FIXME: goto error; should be better here */
+#endif
 
     /* Create es out */
     p_input->p->p_es_out = input_EsOutNew( p_input, p_input->p->i_rate );
@@ -1249,13 +1252,13 @@ error:
 
     if( p_input->p->p_es_out )
         input_EsOutDelete( p_input->p->p_es_out );
-
+#ifdef ENABLE_SOUT
     if( p_input->p->p_sout )
     {
         vlc_object_detach( p_input->p->p_sout );
         sout_DeleteInstance( p_input->p->p_sout );
     }
-
+#endif
 
     if( !p_input->b_preparsing && p_input->p_libvlc->b_stats )
     {
diff --git a/src/libvlc-common.c b/src/libvlc-common.c
index ee4dfe7..2acfc03 100644
--- a/src/libvlc-common.c
+++ b/src/libvlc-common.c
@@ -778,6 +778,7 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
     }
     free( psz_modules );
 
+#ifdef ENABLE_SOUT
     /* Initialize VLM if vlm-conf is specified */
     psz_parser = config_GetPsz( p_libvlc, "vlm-conf" );
     if( psz_parser && *psz_parser )
@@ -787,6 +788,7 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
             msg_Err( p_libvlc, "VLM initialization failed" );
     }
     free( psz_parser );
+#endif
 
     /*
      * Load background interfaces
@@ -944,8 +946,6 @@ int libvlc_InternalCleanup( libvlc_int_t *p_libvlc )
     intf_thread_t      * p_intf = NULL;
     vout_thread_t      * p_vout = NULL;
     aout_instance_t    * p_aout = NULL;
-    announce_handler_t * p_announce = NULL;
-    sout_instance_t    * p_sout = NULL;
 
     /* Ask the interfaces to stop and destroy them */
     msg_Dbg( p_libvlc, "removing all interfaces" );
@@ -980,6 +980,9 @@ int libvlc_InternalCleanup( libvlc_int_t *p_libvlc )
         aout_Delete( p_aout );
     }
 
+#ifdef ENABLE_SOUT
+    sout_instance_t    * p_sout;
+
     p_sout = vlc_object_find( p_libvlc, VLC_OBJECT_SOUT, FIND_CHILD );
     if( p_sout )
     {
@@ -994,6 +997,7 @@ int libvlc_InternalCleanup( libvlc_int_t *p_libvlc )
     {
         vlm_Delete( p_libvlc->p_vlm );
     }
+#endif
 
     /* Free interaction */
     msg_Dbg( p_libvlc, "removing interaction" );
@@ -1002,6 +1006,9 @@ int libvlc_InternalCleanup( libvlc_int_t *p_libvlc )
     stats_TimersDumpAll( p_libvlc );
     stats_TimersCleanAll( p_libvlc );
 
+#ifdef ENABLE_SOUT
+    announce_handler_t * p_announce;
+
     /* Free announce handler(s?) */
     while( (p_announce = vlc_object_find( p_libvlc, VLC_OBJECT_ANNOUNCE,
                                                  FIND_CHILD ) ) )
@@ -1011,6 +1018,7 @@ int libvlc_InternalCleanup( libvlc_int_t *p_libvlc )
         vlc_object_release( p_announce );
         announce_HandlerDestroy( p_announce );
     }
+#endif
 
     bool b_clean = true;
     FOREACH_ARRAY( input_item_t *p_del, p_libvlc->input_items )
diff --git a/src/playlist/engine.c b/src/playlist/engine.c
index 4359ee5..18d831e 100644
--- a/src/playlist/engine.c
+++ b/src/playlist/engine.c
@@ -231,6 +231,7 @@ static void ObjectGarbageCollector( playlist_t *p_playlist, bool b_force )
         vlc_object_release( p_obj );
         vout_Destroy( (vout_thread_t *)p_obj );
     }
+#ifdef ENABLE_SOUT
     while( ( p_obj = vlc_object_find( p_playlist, VLC_OBJECT_SOUT,
                                                   FIND_CHILD ) ) )
     {
@@ -244,6 +245,7 @@ static void ObjectGarbageCollector( playlist_t *p_playlist, bool b_force )
         vlc_object_release( p_obj );
         sout_DeleteInstance( (sout_instance_t*)p_obj );
     }
+#endif
     p_playlist->b_cant_sleep = false;
     vlc_mutex_unlock( &p_playlist->gc_lock );
 }
@@ -447,6 +449,7 @@ void playlist_LastLoop( playlist_t *p_playlist )
         msleep( INTF_IDLE_SLEEP );
     }
 
+#ifdef ENABLE_SOUT
     /* close all remaining sout */
     while( ( p_obj = vlc_object_find( p_playlist,
                                       VLC_OBJECT_SOUT, FIND_CHILD ) ) )
@@ -455,6 +458,7 @@ void playlist_LastLoop( playlist_t *p_playlist )
         vlc_object_release( p_obj );
         sout_DeleteInstance( (sout_instance_t*)p_obj );
     }
+#endif
 
     /* close all remaining vout */
     while( ( p_obj = vlc_object_find( p_playlist,




More information about the vlc-devel mailing list