]> git.sesse.net Git - vlc/commitdiff
Rename all sout_Cfg* stuff to config_Chain* (as it isn't really sout specific)
authorAntoine Cellerier <dionoea@videolan.org>
Sun, 1 Oct 2006 16:08:37 +0000 (16:08 +0000)
committerAntoine Cellerier <dionoea@videolan.org>
Sun, 1 Oct 2006 16:08:37 +0000 (16:08 +0000)
40 files changed:
include/configuration.h
include/stream_output.h
include/video_output.h
include/vlc_codec.h
include/vlc_common.h
include/vlc_filter.h
include/vlc_symbols.h
modules/access_output/file.c
modules/access_output/http.c
modules/access_output/shout.c
modules/access_output/udp.c
modules/codec/dirac.c
modules/codec/dvbsub.c
modules/codec/ffmpeg/encoder.c
modules/codec/theora.c
modules/codec/twolame.c
modules/codec/vorbis.c
modules/codec/x264.c
modules/gui/wxwidgets/timer.cpp
modules/mux/asf.c
modules/mux/mp4.c
modules/mux/mpeg/ps.c
modules/mux/mpeg/ts.c
modules/mux/mpjpeg.c
modules/stream_out/bridge.c
modules/stream_out/display.c
modules/stream_out/duplicate.c
modules/stream_out/es.c
modules/stream_out/mosaic_bridge.c
modules/stream_out/rtp.c
modules/stream_out/standard.c
modules/stream_out/switcher.c
modules/stream_out/transcode.c
modules/video_filter/adjust.c
modules/video_filter/deinterlace.c
modules/video_filter/gradient.c
src/Makefile.am
src/misc/configuration_chain.c [new file with mode: 0644]
src/stream_output/stream_output.c
src/video_output/video_output.c

index 7b9a53a8228aa59c34922e988934e52e76991ae1..3e0c0dc69181acebbc4a83161fdab27dbc5f702c 100644 (file)
@@ -407,3 +407,45 @@ int config_AutoSaveConfigFile( vlc_object_t * );
 
 #define change_autosave() \
     p_config[i_config].b_autosave = VLC_TRUE;
+
+
+/****************************************************************************
+ * config_chain_t:
+ ****************************************************************************/
+struct config_chain_t
+{
+    config_chain_t *p_next;
+
+    char        *psz_name;
+    char        *psz_value;
+};
+
+#define config_ChainParse( a, b, c, d ) __config_ChainParse( VLC_OBJECT(a), b, c, d )
+VLC_EXPORT( void,   __config_ChainParse, ( vlc_object_t *, char *psz_prefix, const char **ppsz_options, config_chain_t * ) );
+VLC_EXPORT( char *, config_ChainCreate, ( char **, config_chain_t **, char * ) );
+VLC_EXPORT( void, config_ChainDestroy, ( config_chain_t * ) );
+
+static inline config_chain_t *config_chain_find( config_chain_t *p_cfg, char *psz_name )
+{
+    while( p_cfg && strcmp( p_cfg->psz_name, psz_name ) )
+    {
+        p_cfg = p_cfg->p_next;
+    }
+
+    return p_cfg;
+}
+
+static inline char *config_chain_find_value( config_chain_t *p_cfg, char *psz_name )
+{
+    while( p_cfg && strcmp( p_cfg->psz_name, psz_name ) )
+    {
+        p_cfg = p_cfg->p_next;
+    }
+
+    if( p_cfg && p_cfg->psz_value )
+    {
+        return( p_cfg->psz_value );
+    }
+
+    return NULL;
+}
index 641ec997a789302052555c7c199178259d8b0189..1d378e891a9296e91bedc127cf6d0b573a818e55 100644 (file)
@@ -52,21 +52,6 @@ struct sout_instance_t
     sout_instance_sys_t *p_sys;
 };
 
-/****************************************************************************
- * sout_cfg_t:
- ****************************************************************************/
-struct sout_cfg_t
-{
-    sout_cfg_t  *p_next;
-
-    char        *psz_name;
-    char        *psz_value;
-};
-
-#define sout_CfgParse( a, b, c, d ) __sout_CfgParse( VLC_OBJECT(a), b, c, d )
-VLC_EXPORT( void,   __sout_CfgParse, ( vlc_object_t *, char *psz_prefix, const char **ppsz_options, sout_cfg_t * ) );
-VLC_EXPORT( char *, sout_CfgCreate, ( char **, sout_cfg_t **, char * ) );
-
 /****************************************************************************
  * sout_stream_id_t: opaque (private for all sout_stream_t)
  ****************************************************************************/
@@ -104,7 +89,7 @@ struct sout_access_out_t
     sout_instance_t         *p_sout;
 
     char                    *psz_access;
-    sout_cfg_t              *p_cfg;
+    config_chain_t              *p_cfg;
 
     int                      i_writes;
     int64_t                  i_sent_bytes;      ///< This is a "local" counter that is reset each
@@ -134,7 +119,7 @@ struct  sout_mux_t
     sout_instance_t     *p_sout;
 
     char                *psz_mux;
-    sout_cfg_t          *p_cfg;
+    config_chain_t          *p_cfg;
 
     sout_access_out_t   *p_access;
 
@@ -208,7 +193,7 @@ struct sout_stream_t
     sout_instance_t   *p_sout;
 
     char              *psz_name;
-    sout_cfg_t        *p_cfg;
+    config_chain_t        *p_cfg;
     char              *psz_next;
 
     /* Subpicture unit */
@@ -312,32 +297,6 @@ struct announce_handler_t
 
 /* End */
 
-
-static inline sout_cfg_t *sout_cfg_find( sout_cfg_t *p_cfg, char *psz_name )
-{
-    while( p_cfg && strcmp( p_cfg->psz_name, psz_name ) )
-    {
-        p_cfg = p_cfg->p_next;
-    }
-
-    return p_cfg;
-}
-
-static inline char *sout_cfg_find_value( sout_cfg_t *p_cfg, char *psz_name )
-{
-    while( p_cfg && strcmp( p_cfg->psz_name, psz_name ) )
-    {
-        p_cfg = p_cfg->p_next;
-    }
-
-    if( p_cfg && p_cfg->psz_value )
-    {
-        return( p_cfg->psz_value );
-    }
-
-    return NULL;
-}
-
 /* Announce system */
 VLC_EXPORT( int,                sout_AnnounceRegister, (sout_instance_t *,session_descriptor_t*, announce_method_t* ) );
 VLC_EXPORT(session_descriptor_t*,sout_AnnounceRegisterSDP, (sout_instance_t *,const char *, const char *, announce_method_t* ) );
index f3e0d7fbbf909827f583199eb21230690f4e9cf1..ac776338a76fc4e210603f8809095d164c93040f 100644 (file)
@@ -157,7 +157,7 @@ struct vout_thread_t
      * these are handled like in transcode.c
      * XXX: we might need to merge the two chains (v1 and v2 filters) */
     char       *psz_vfilters[MAX_VFILTERS];
-    sout_cfg_t *p_vfilters_cfg[MAX_VFILTERS];
+    config_chain_t *p_vfilters_cfg[MAX_VFILTERS];
     int         i_vfilters_cfg;
 
     filter_t   *pp_vfilters[MAX_VFILTERS];
index 74f82cd6e4146d6bb77e5c0c3ed7a04092c85e63..c8dd5ebca97ae1eb78ce2a3383c239cdf73633c5 100644 (file)
@@ -127,7 +127,7 @@ struct encoder_t
     int i_tolerance;             /* Bitrate tolerance */
 
     /* Encoder config */
-    sout_cfg_t *p_cfg;
+    config_chain_t *p_cfg;
 };
 
 /**
index cce8fa2d5586020213bb23e966e1aeae4cb13d94..647b8c2f28910717ca102c79eb2b9caaf6c75027 100644 (file)
@@ -328,7 +328,7 @@ typedef struct sout_mux_sys_t sout_mux_sys_t;
 typedef struct sout_stream_t    sout_stream_t;
 typedef struct sout_stream_sys_t sout_stream_sys_t;
 
-typedef struct sout_cfg_t       sout_cfg_t;
+typedef struct config_chain_t       config_chain_t;
 typedef struct sap_session_t    sap_session_t;
 typedef struct sap_address_t sap_address_t;
 typedef struct session_descriptor_t session_descriptor_t;
index 656f15954779cdec3bc04cb1ccab85aaa65dbbc3..10db66bec801c8eca70442563d8bf3534dd5b4b9 100644 (file)
@@ -58,7 +58,7 @@ struct filter_t
     es_format_t         fmt_out;
 
     /* Filter configuration */
-    sout_cfg_t *        p_cfg;
+    config_chain_t *        p_cfg;
 
     picture_t *         ( * pf_video_filter ) ( filter_t *, picture_t * );
     block_t *           ( * pf_audio_filter ) ( filter_t *, block_t * );
index 4b425a2846ac6857db2cda6e4cd0e123c5758540..376ad0fcc6469923cc7f6f025db88af95e73477b 100644 (file)
@@ -109,8 +109,8 @@ struct module_symbols_t
     void (*__vout_OSDMessage_inner) (vlc_object_t *, int, char *, ...);
     void (*vout_OSDSlider_inner) (vlc_object_t *, int, int , short);
     void (*vout_OSDIcon_inner) (vlc_object_t *, int, short);
-    void (*__sout_CfgParse_inner) (vlc_object_t *, char *psz_prefix, const char **ppsz_options, sout_cfg_t *);
-    char * (*sout_CfgCreate_inner) (char **, sout_cfg_t **, char *);
+    void *__sout_CfgParse_deprecated;
+    void *sout_CfgCreate_deprecated;
     sout_instance_t * (*__sout_NewInstance_inner) (vlc_object_t *, char *);
     void (*sout_DeleteInstance_inner) (sout_instance_t *);
     sout_packetizer_input_t * (*sout_InputNew_inner) (sout_instance_t *, es_format_t *);
@@ -550,6 +550,9 @@ struct module_symbols_t
     void *input_AskForArt_deprecated;
     int (*playlist_AskForArtEnqueue_inner) (playlist_t *, input_item_t *);
     uint32_t (*input_CurrentMetaFlags_inner) (vlc_meta_t *p_meta);
+    void (*__config_ChainParse_inner) (vlc_object_t *, char *psz_prefix, const char **ppsz_options, config_chain_t *);
+    void (*config_ChainDestroy_inner) (config_chain_t *);
+    char * (*config_ChainCreate_inner) (char **, config_chain_t **, char *);
 };
 # if defined (__PLUGIN__)
 #  define aout_FiltersCreatePipeline (p_symbols)->aout_FiltersCreatePipeline_inner
@@ -641,8 +644,6 @@ struct module_symbols_t
 #  define __vout_OSDMessage (p_symbols)->__vout_OSDMessage_inner
 #  define vout_OSDSlider (p_symbols)->vout_OSDSlider_inner
 #  define vout_OSDIcon (p_symbols)->vout_OSDIcon_inner
-#  define __sout_CfgParse (p_symbols)->__sout_CfgParse_inner
-#  define sout_CfgCreate (p_symbols)->sout_CfgCreate_inner
 #  define __sout_NewInstance (p_symbols)->__sout_NewInstance_inner
 #  define sout_DeleteInstance (p_symbols)->sout_DeleteInstance_inner
 #  define sout_InputNew (p_symbols)->sout_InputNew_inner
@@ -1025,6 +1026,9 @@ struct module_symbols_t
 #  define input_ItemAddOptionNoDup (p_symbols)->input_ItemAddOptionNoDup_inner
 #  define playlist_AskForArtEnqueue (p_symbols)->playlist_AskForArtEnqueue_inner
 #  define input_CurrentMetaFlags (p_symbols)->input_CurrentMetaFlags_inner
+#  define __config_ChainParse (p_symbols)->__config_ChainParse_inner
+#  define config_ChainDestroy (p_symbols)->config_ChainDestroy_inner
+#  define config_ChainCreate (p_symbols)->config_ChainCreate_inner
 # elif defined (HAVE_DYNAMIC_PLUGINS) && !defined (__BUILTIN__)
 /******************************************************************
  * STORE_SYMBOLS: store VLC APIs into p_symbols for plugin access.
@@ -1119,8 +1123,6 @@ struct module_symbols_t
     ((p_symbols)->__vout_OSDMessage_inner) = __vout_OSDMessage; \
     ((p_symbols)->vout_OSDSlider_inner) = vout_OSDSlider; \
     ((p_symbols)->vout_OSDIcon_inner) = vout_OSDIcon; \
-    ((p_symbols)->__sout_CfgParse_inner) = __sout_CfgParse; \
-    ((p_symbols)->sout_CfgCreate_inner) = sout_CfgCreate; \
     ((p_symbols)->__sout_NewInstance_inner) = __sout_NewInstance; \
     ((p_symbols)->sout_DeleteInstance_inner) = sout_DeleteInstance; \
     ((p_symbols)->sout_InputNew_inner) = sout_InputNew; \
@@ -1503,7 +1505,12 @@ struct module_symbols_t
     ((p_symbols)->input_ItemAddOptionNoDup_inner) = input_ItemAddOptionNoDup; \
     ((p_symbols)->playlist_AskForArtEnqueue_inner) = playlist_AskForArtEnqueue; \
     ((p_symbols)->input_CurrentMetaFlags_inner) = input_CurrentMetaFlags; \
+    ((p_symbols)->__config_ChainParse_inner) = __config_ChainParse; \
+    ((p_symbols)->config_ChainDestroy_inner) = config_ChainDestroy; \
+    ((p_symbols)->config_ChainCreate_inner) = config_ChainCreate; \
     (p_symbols)->net_ConvertIPv4_deprecated = NULL; \
+    (p_symbols)->__sout_CfgParse_deprecated = NULL; \
+    (p_symbols)->sout_CfgCreate_deprecated = NULL; \
     (p_symbols)->vlc_input_item_GetInfo_deprecated = NULL; \
     (p_symbols)->vlc_input_item_AddInfo_deprecated = NULL; \
     (p_symbols)->__playlist_ItemNew_deprecated = NULL; \
index 23e36fe6576eb003db613998b411583d72c75e62..200860e5a12c6a2cc3d8d5a956c93f2e14ea61d1 100644 (file)
@@ -101,7 +101,7 @@ static int Open( vlc_object_t *p_this )
     int                 i_flags;
     vlc_value_t         val;
 
-    sout_CfgParse( p_access, SOUT_CFG_PREFIX, ppsz_sout_options, p_access->p_cfg );
+    config_ChainParse( p_access, SOUT_CFG_PREFIX, ppsz_sout_options, p_access->p_cfg );
 
     if( !p_access->psz_name )
     {
index 907ce3227173adac0e34774573fcc4ed4fab0a15..1a955c906a5fdbe3909994aa98aab33a9257ad93 100644 (file)
@@ -172,7 +172,7 @@ static int Open( vlc_object_t *p_this )
         return VLC_ENOMEM ;
     }
 
-    sout_CfgParse( p_access, SOUT_CFG_PREFIX, ppsz_sout_options, p_access->p_cfg );
+    config_ChainParse( p_access, SOUT_CFG_PREFIX, ppsz_sout_options, p_access->p_cfg );
 
     /* p_access->psz_name = "hostname:port/filename" */
     psz_bind_addr = psz_parser = strdup( p_access->psz_name );
index 995de3c6dce7a5bd1a91259c36f54b4d80443dac..1372208a08cdbd95dae421a7f5030a8b6e783219 100644 (file)
@@ -177,7 +177,7 @@ static int Open( vlc_object_t *p_this )
     char *psz_genre = NULL;
     char *psz_url = NULL;
 
-    sout_CfgParse( p_access, SOUT_CFG_PREFIX, ppsz_sout_options, p_access->p_cfg );
+    config_ChainParse( p_access, SOUT_CFG_PREFIX, ppsz_sout_options, p_access->p_cfg );
 
     psz_accessname = psz_parser = strdup( p_access->psz_name );
 
index fe979520f3e008ea8f2c3436db556b5b350cbce2..b4f95a58c77d768c3646d19d1b85a9d6481bdf0c 100644 (file)
@@ -182,7 +182,7 @@ static int Open( vlc_object_t *p_this )
 
     vlc_value_t         val;
 
-    sout_CfgParse( p_access, SOUT_CFG_PREFIX,
+    config_ChainParse( p_access, SOUT_CFG_PREFIX,
                    ppsz_sout_options, p_access->p_cfg );
 
     if( !( p_sys = malloc( sizeof( sout_access_out_sys_t ) ) ) )
index 449e23aeca98078ade81c032487d0af8c62aebcc..aa385dbceaa84b2c4ca58edc362125d3afaa3a7a 100644 (file)
@@ -350,7 +350,7 @@ static int OpenEncoder( vlc_object_t *p_this )
     p_enc->fmt_in.video.i_bits_per_pixel = 12;
     p_enc->fmt_out.i_codec = VLC_FOURCC('d','r','a','c');
 
-    sout_CfgParse( p_enc, ENC_CFG_PREFIX, ppsz_enc_options, p_enc->p_cfg );
+    config_ChainParse( p_enc, ENC_CFG_PREFIX, ppsz_enc_options, p_enc->p_cfg );
 
     /* Initialse the encoder context with the presets for SD576 - Standard
      * Definition Digital (some parameters will be overwritten later on) */
index d7fa2f613c33aaa43a8ac7e0e4b3cd5541c81616..ffc240f7530f424aa56a26128220f7bb974c69f2 100644 (file)
@@ -1526,7 +1526,7 @@ static int OpenEncoder( vlc_object_t *p_this )
     p_enc->fmt_out.i_codec = VLC_FOURCC('d','v','b','s');
     p_enc->fmt_out.subs.dvb.i_id  = 1 << 16 | 1;
 
-    sout_CfgParse( p_enc, ENC_CFG_PREFIX, ppsz_enc_options, p_enc->p_cfg );
+    config_ChainParse( p_enc, ENC_CFG_PREFIX, ppsz_enc_options, p_enc->p_cfg );
 
     p_sys->i_page_ver = 0;
     p_sys->i_region_ver = 0;
index 4c7221d2466d080efa17736592c0421e6e66f0b9..0540c9e814d4a82025a1f4edd70be99aa98d9d9a 100644 (file)
@@ -289,7 +289,7 @@ int E_(OpenEncoder)( vlc_object_t *p_this )
         p_context->dsp_mask |= FF_MM_SSE2;
     }
 
-    sout_CfgParse( p_enc, ENC_CFG_PREFIX, ppsz_enc_options, p_enc->p_cfg );
+    config_ChainParse( p_enc, ENC_CFG_PREFIX, ppsz_enc_options, p_enc->p_cfg );
 
     var_Get( p_enc, ENC_CFG_PREFIX "keyint", &val );
     p_sys->i_key_int = val.i_int;
index 5ded10482549a13b954b5bf6d6c5ea87727e4c12..6ffd3343b80d7d71f7cea2c61c8c196be95ab07f 100644 (file)
@@ -619,7 +619,7 @@ static int OpenEncoder( vlc_object_t *p_this )
     p_enc->fmt_in.i_codec = VLC_FOURCC('I','4','2','0');
     p_enc->fmt_out.i_codec = VLC_FOURCC('t','h','e','o');
 
-    sout_CfgParse( p_enc, ENC_CFG_PREFIX, ppsz_enc_options, p_enc->p_cfg );
+    config_ChainParse( p_enc, ENC_CFG_PREFIX, ppsz_enc_options, p_enc->p_cfg );
 
     var_Get( p_enc, ENC_CFG_PREFIX "quality", &val );
     i_quality = val.i_int;
index 95c622e04810d1e51476dcee3613e90c28849b4c..780f5421354e8b87148084453cee0be4fb298ade 100644 (file)
@@ -165,7 +165,7 @@ static int OpenEncoder( vlc_object_t *p_this )
     p_enc->fmt_in.i_codec = AOUT_FMT_S16_NE;
     p_enc->fmt_out.i_codec = VLC_FOURCC('m','p','g','a');
 
-    sout_CfgParse( p_enc, ENC_CFG_PREFIX, ppsz_enc_options, p_enc->p_cfg );
+    config_ChainParse( p_enc, ENC_CFG_PREFIX, ppsz_enc_options, p_enc->p_cfg );
 
     p_sys->p_twolame = twolame_init();
 
index e17e28ac8bb23cad82b727f6908d84b0bf836c74..8ae69924482b55bccb02b30166908bbb155ef53c 100644 (file)
@@ -792,7 +792,7 @@ static int OpenEncoder( vlc_object_t *p_this )
     p_enc->fmt_in.i_codec = VLC_FOURCC('f','l','3','2');
     p_enc->fmt_out.i_codec = VLC_FOURCC('v','o','r','b');
 
-    sout_CfgParse( p_enc, ENC_CFG_PREFIX, ppsz_enc_options, p_enc->p_cfg );
+    config_ChainParse( p_enc, ENC_CFG_PREFIX, ppsz_enc_options, p_enc->p_cfg );
 
     var_Get( p_enc, ENC_CFG_PREFIX "quality", &val );
     i_quality = val.i_int;
index 58e50bcbb91f1aff2763bf0aa6f6cd489f68a0f2..7fbbb8b611e548b61984ae81ff3aef1a576f850f 100644 (file)
@@ -576,7 +576,7 @@ static int  Open ( vlc_object_t *p_this )
     }
 #endif
 
-    sout_CfgParse( p_enc, SOUT_CFG_PREFIX, ppsz_sout_options, p_enc->p_cfg );
+    config_ChainParse( p_enc, SOUT_CFG_PREFIX, ppsz_sout_options, p_enc->p_cfg );
 
     p_enc->fmt_out.i_codec = VLC_FOURCC( 'h', '2', '6', '4' );
     p_enc->fmt_in.i_codec = VLC_FOURCC('I','4','2','0');
index 9d77eccf30e5dea8a580b30d989fd8697668bb44..1655fe4379cb317fd6841cd758661dcb47151fe6 100644 (file)
@@ -104,6 +104,7 @@ void Timer::Notify()
     if( p_intf->p_sys->b_intf_show )
     {
         p_main_interface->Raise();
+        p_main_interface->Show();
         p_intf->p_sys->b_intf_show = VLC_FALSE;
     }
 
index 1378dacdd1f945f3165f33b0e76905cb7fb22e91..eb8be8ff94b07a2e254530018ecd17590316dc0e 100644 (file)
@@ -182,7 +182,7 @@ static int Open( vlc_object_t *p_this )
     int i;
 
     msg_Dbg( p_mux, "asf muxer opened" );
-    sout_CfgParse( p_mux, SOUT_CFG_PREFIX, ppsz_sout_options, p_mux->p_cfg );
+    config_ChainParse( p_mux, SOUT_CFG_PREFIX, ppsz_sout_options, p_mux->p_cfg );
 
     p_mux->pf_control   = Control;
     p_mux->pf_addstream = AddStream;
index 50f496b0c159326e9610067ae71daad8e2cefe17..12f5399e12992c967045065cbe15c4e746dd6dcc 100644 (file)
@@ -196,7 +196,7 @@ static int Open( vlc_object_t *p_this )
     bo_t            *box;
 
     msg_Dbg( p_mux, "Mp4 muxer opend" );
-    sout_CfgParse( p_mux, SOUT_CFG_PREFIX, ppsz_sout_options, p_mux->p_cfg );
+    config_ChainParse( p_mux, SOUT_CFG_PREFIX, ppsz_sout_options, p_mux->p_cfg );
 
     p_mux->pf_control   = Control;
     p_mux->pf_addstream = AddStream;
index 300f52cbe8ff5bac43e1e2512f8cbc01e67764c6..a72f2566c0006cb8f749d82ec0e2430b36edda4c 100644 (file)
@@ -149,7 +149,7 @@ static int Open( vlc_object_t *p_this )
     vlc_value_t val;
 
     msg_Info( p_mux, "Open" );
-    sout_CfgParse( p_mux, SOUT_CFG_PREFIX, ppsz_sout_options, p_mux->p_cfg );
+    config_ChainParse( p_mux, SOUT_CFG_PREFIX, ppsz_sout_options, p_mux->p_cfg );
 
     p_mux->pf_control   = Control;
     p_mux->pf_addstream = AddStream;
index 018790081ce96ea20fb5e55ef17b099e60e97d7b..3759c44d33065805cb198ec13c11d6cb6ed93714 100644 (file)
@@ -479,7 +479,7 @@ static int Open( vlc_object_t *p_this )
     vlc_value_t         val;
     int i;
 
-    sout_CfgParse( p_mux, SOUT_CFG_PREFIX, ppsz_sout_options, p_mux->p_cfg );
+    config_ChainParse( p_mux, SOUT_CFG_PREFIX, ppsz_sout_options, p_mux->p_cfg );
 
     p_sys = malloc( sizeof( sout_mux_sys_t ) );
     if( !p_sys )
index 0a16c7ddb6169b6bfbd3b5d060c6b910fa384ac6..895c57f00f4462393c62d5bd939afb5d741803b9 100644 (file)
@@ -84,7 +84,7 @@ static int Open( vlc_object_t *p_this )
     char *psz_separator_block, *psz_separator;
 
     msg_Dbg( p_mux, "Multipart jpeg muxer opened" );
-    sout_CfgParse( p_mux, SOUT_CFG_PREFIX, ppsz_sout_options, p_mux->p_cfg );
+    config_ChainParse( p_mux, SOUT_CFG_PREFIX, ppsz_sout_options, p_mux->p_cfg );
 
     p_sys = p_mux->p_sys = malloc( sizeof(sout_mux_sys_t) );
     p_sys->b_send_headers = VLC_TRUE;
index 3d53d05e96d1664bf6fcec602ef17acd95ef3ab5..92156f2c7e21f59d39afec73d19b08c2cf99b8c8 100644 (file)
@@ -164,7 +164,7 @@ static int OpenOut( vlc_object_t *p_this )
     out_sout_stream_sys_t *p_sys;
     vlc_value_t val;
 
-    sout_CfgParse( p_stream, SOUT_CFG_PREFIX_OUT, ppsz_sout_options_out,
+    config_ChainParse( p_stream, SOUT_CFG_PREFIX_OUT, ppsz_sout_options_out,
                    p_stream->p_cfg );
 
     p_sys          = malloc( sizeof( out_sout_stream_sys_t ) );
@@ -351,7 +351,7 @@ static int OpenIn( vlc_object_t *p_this )
         return VLC_EGENERIC;
     }
 
-    sout_CfgParse( p_stream, SOUT_CFG_PREFIX_IN, ppsz_sout_options_in,
+    config_ChainParse( p_stream, SOUT_CFG_PREFIX_IN, ppsz_sout_options_in,
                    p_stream->p_cfg );
 
     var_Get( p_this->p_libvlc_global, "bridge-lock", &val );
index da65780ecd2ffa178a3edc487bd902d6c9b5248b..264af9862d71666ad8e19e3ebb3177a935eb8532 100644 (file)
@@ -93,7 +93,7 @@ static int Open( vlc_object_t *p_this )
     sout_stream_sys_t *p_sys;
     vlc_value_t val;
 
-    sout_CfgParse( p_stream, SOUT_CFG_PREFIX, ppsz_sout_options,
+    config_ChainParse( p_stream, SOUT_CFG_PREFIX, ppsz_sout_options,
                    p_stream->p_cfg );
 
     p_sys          = malloc( sizeof( sout_stream_sys_t ) );
index a6c39e3bfc92a1f3ee04c36bbaf09e1734dbead2..1eccf44ce9e149f002725efc76a9dd52a008e03d 100644 (file)
@@ -79,7 +79,7 @@ static int Open( vlc_object_t *p_this )
 {
     sout_stream_t     *p_stream = (sout_stream_t*)p_this;
     sout_stream_sys_t *p_sys;
-    sout_cfg_t        *p_cfg;
+    config_chain_t        *p_cfg;
 
     msg_Dbg( p_stream, "creating 'duplicate'" );
 
index 0536d5dda58859056f88f9307b7bfc4edbfc5272..0a52e11bc6b0477f45384c655fb23bc1fd42fecb 100644 (file)
@@ -145,7 +145,7 @@ static int Open( vlc_object_t *p_this )
     sout_stream_sys_t   *p_sys;
     vlc_value_t         val;
 
-    sout_CfgParse( p_stream, SOUT_CFG_PREFIX, ppsz_sout_options, p_stream->p_cfg );
+    config_ChainParse( p_stream, SOUT_CFG_PREFIX, ppsz_sout_options, p_stream->p_cfg );
     p_sys                   = malloc( sizeof( sout_stream_sys_t ) );
 
     p_sys->i_count          = 0;
index 1e059f51f40fefdcd6843a116b3618686c40ea52..5be43c344c1dd5f7fe0893a0440632ad14c41de0 100644 (file)
@@ -150,7 +150,7 @@ static int Open( vlc_object_t *p_this )
     libvlc_global_data_t *p_libvlc_global = p_this->p_libvlc_global;
     vlc_value_t val;
 
-    sout_CfgParse( p_stream, SOUT_CFG_PREFIX, ppsz_sout_options,
+    config_ChainParse( p_stream, SOUT_CFG_PREFIX, ppsz_sout_options,
                    p_stream->p_cfg );
 
     p_sys          = malloc( sizeof( sout_stream_sys_t ) );
index 314a222f365a69200fe61dae234bc11c62918f3d..cf1d4a96cce5c9acfd233936b8fdcd168ace93b1 100644 (file)
@@ -296,11 +296,12 @@ static int Open( vlc_object_t *p_this )
     sout_stream_t       *p_stream = (sout_stream_t*)p_this;
     sout_instance_t     *p_sout = p_stream->p_sout;
     sout_stream_sys_t   *p_sys = NULL;
-    sout_cfg_t          *p_cfg = NULL;
+    config_chain_t      *p_cfg = NULL;
     vlc_value_t         val;
     vlc_bool_t          b_rtsp = VLC_FALSE;
 
-    sout_CfgParse( p_stream, SOUT_CFG_PREFIX, ppsz_sout_options, p_stream->p_cfg );
+    config_ChainParse( p_stream, SOUT_CFG_PREFIX,
+                       ppsz_sout_options, p_stream->p_cfg );
 
     p_sys = malloc( sizeof( sout_stream_sys_t ) );
 
@@ -590,7 +591,7 @@ static int Open( vlc_object_t *p_this )
     var_Get( p_stream, SOUT_CFG_PREFIX "sdp", &val );
     if( *val.psz_string )
     {
-        sout_cfg_t *p_cfg;
+        config_chain_t *p_cfg;
 
         SDPHandleUrl( p_stream, val.psz_string );
 
index e2d2ba0439e93ef489b295555cd3eb428c9886a6..ab569a6e200c01737803809999a06a556cff94f3 100644 (file)
@@ -133,7 +133,7 @@ static int Open( vlc_object_t *p_this )
 
     char                *psz_mux_byext = NULL;
 
-    sout_CfgParse( p_stream, SOUT_CFG_PREFIX, ppsz_sout_options,
+    config_ChainParse( p_stream, SOUT_CFG_PREFIX, ppsz_sout_options,
                    p_stream->p_cfg );
 
     var_Get( p_stream, SOUT_CFG_PREFIX "access", &val );
index 7d5b9c7beeb2ad29794a9efc59929e012cdde273..01c6ab993bbaefb486350ebe973ca5e3c2257dcd 100644 (file)
@@ -189,7 +189,7 @@ static int Open( vlc_object_t *p_this )
         return VLC_EGENERIC;
     }
 
-    sout_CfgParse( p_stream, SOUT_CFG_PREFIX, ppsz_sout_options,
+    config_ChainParse( p_stream, SOUT_CFG_PREFIX, ppsz_sout_options,
                    p_stream->p_cfg );
 
     var_Get( p_stream, SOUT_CFG_PREFIX "files", &val );
index 6a052afbd4938ec18ebc082ded73ea98a7f69190..43ddc31bed93d68ed4a59b0d4944cc2876c26208 100644 (file)
@@ -372,18 +372,18 @@ struct sout_stream_sys_t
     /* Audio */
     vlc_fourcc_t    i_acodec;   /* codec audio (0 if not transcode) */
     char            *psz_aenc;
-    sout_cfg_t      *p_audio_cfg;
+    config_chain_t  *p_audio_cfg;
     int             i_sample_rate;
     int             i_channels;
     int             i_abitrate;
     char            *psz_afilters[TRANSCODE_FILTERS];
-    sout_cfg_t      *p_afilters_cfg[TRANSCODE_FILTERS];
+    config_chain_t  *p_afilters_cfg[TRANSCODE_FILTERS];
     int             i_afilters;
 
     /* Video */
     vlc_fourcc_t    i_vcodec;   /* codec video (0 if not transcode) */
     char            *psz_venc;
-    sout_cfg_t      *p_video_cfg;
+    config_chain_t  *p_video_cfg;
     int             i_vbitrate;
     double          f_scale;
     double          f_fps;
@@ -391,12 +391,12 @@ struct sout_stream_sys_t
     unsigned int    i_height, i_maxheight;
     vlc_bool_t      b_deinterlace;
     char            *psz_deinterlace;
-    sout_cfg_t      *p_deinterlace_cfg;
+    config_chain_t  *p_deinterlace_cfg;
     int             i_threads;
     vlc_bool_t      b_high_priority;
     vlc_bool_t      b_hurry_up;
     char            *psz_vfilters[TRANSCODE_FILTERS];
-    sout_cfg_t      *p_vfilters_cfg[TRANSCODE_FILTERS];
+    config_chain_t  *p_vfilters_cfg[TRANSCODE_FILTERS];
     int             i_vfilters;
 
     int             i_crop_top;
@@ -428,14 +428,14 @@ struct sout_stream_sys_t
     vlc_fourcc_t    i_scodec;   /* codec spu (0 if not transcode) */
     char            *psz_senc;
     vlc_bool_t      b_soverlay;
-    sout_cfg_t      *p_spu_cfg;
+    config_chain_t  *p_spu_cfg;
     spu_t           *p_spu;
 
     /* OSD Menu */
     sout_stream_id_t *id_osd;   /* extension for streaming OSD menus */
     vlc_fourcc_t    i_osdcodec; /* codec osd menu (0 if not transcode) */
     char            *psz_osdenc;
-    sout_cfg_t      *p_osd_cfg;
+    config_chain_t  *p_osd_cfg;
     vlc_bool_t      b_es_osd;      /* VLC_TRUE when osd es is registered */
     vlc_bool_t      b_sout_osd;
 
@@ -476,7 +476,7 @@ static int Open( vlc_object_t *p_this )
 
     p_sys->i_master_drift = 0;
 
-    sout_CfgParse( p_stream, SOUT_CFG_PREFIX, ppsz_sout_options,
+    config_ChainParse( p_stream, SOUT_CFG_PREFIX, ppsz_sout_options,
                    p_stream->p_cfg );
 
     /* Audio transcoding parameters */
@@ -486,8 +486,8 @@ static int Open( vlc_object_t *p_this )
     if( val.psz_string && *val.psz_string )
     {
         char *psz_next;
-        psz_next = sout_CfgCreate( &p_sys->psz_aenc, &p_sys->p_audio_cfg,
-                                   val.psz_string );
+        psz_next = config_ChainCreate( &p_sys->psz_aenc, &p_sys->p_audio_cfg,
+                                       val.psz_string );
         if( psz_next ) free( psz_next );
     }
     if( val.psz_string ) free( val.psz_string );
@@ -535,7 +535,7 @@ static int Open( vlc_object_t *p_this )
         while( (psz_parser != NULL) && (*psz_parser != '\0')
                 && (p_sys->i_afilters < TRANSCODE_FILTERS) )
         {
-            psz_parser = sout_CfgCreate(
+            psz_parser = config_ChainCreate(
                                    &p_sys->psz_afilters[p_sys->i_afilters],
                                    &p_sys->p_afilters_cfg[p_sys->i_afilters],
                                    psz_parser );
@@ -557,7 +557,7 @@ static int Open( vlc_object_t *p_this )
     if( val.psz_string && *val.psz_string )
     {
         char *psz_next;
-        psz_next = sout_CfgCreate( &p_sys->psz_venc, &p_sys->p_video_cfg,
+        psz_next = config_ChainCreate( &p_sys->psz_venc, &p_sys->p_video_cfg,
                                    val.psz_string );
         if( psz_next ) free( psz_next );
     }
@@ -607,7 +607,7 @@ static int Open( vlc_object_t *p_this )
         while( (psz_parser != NULL) && (*psz_parser != '\0')
                 && (p_sys->i_vfilters < TRANSCODE_FILTERS) )
         {
-            psz_parser = sout_CfgCreate(
+            psz_parser = config_ChainCreate(
                                    &p_sys->psz_vfilters[p_sys->i_vfilters],
                                    &p_sys->p_vfilters_cfg[p_sys->i_vfilters],
                                    psz_parser );
@@ -631,7 +631,7 @@ static int Open( vlc_object_t *p_this )
     if( val.psz_string && *val.psz_string )
     {
         char *psz_next;
-        psz_next = sout_CfgCreate( &p_sys->psz_deinterlace,
+        psz_next = config_ChainCreate( &p_sys->psz_deinterlace,
                                    &p_sys->p_deinterlace_cfg,
                                    val.psz_string );
         if( psz_next ) free( psz_next );
@@ -699,7 +699,7 @@ static int Open( vlc_object_t *p_this )
     if( val.psz_string && *val.psz_string )
     {
         char *psz_next;
-        psz_next = sout_CfgCreate( &p_sys->psz_senc, &p_sys->p_spu_cfg,
+        psz_next = config_ChainCreate( &p_sys->psz_senc, &p_sys->p_spu_cfg,
                                    val.psz_string );
         if( psz_next ) free( psz_next );
     }
@@ -745,7 +745,7 @@ static int Open( vlc_object_t *p_this )
         vlc_value_t osd_val;
         char *psz_next;
 
-        psz_next = sout_CfgCreate( &p_sys->psz_osdenc,
+        psz_next = config_ChainCreate( &p_sys->psz_osdenc,
                                    &p_sys->p_osd_cfg, strdup( "dvbsub") );
         if( psz_next ) free( psz_next );
 
@@ -795,7 +795,7 @@ static void Close( vlc_object_t * p_this )
 
     while( p_sys->p_audio_cfg != NULL )
     {
-        sout_cfg_t *p_next = p_sys->p_audio_cfg->p_next;
+        config_chain_t *p_next = p_sys->p_audio_cfg->p_next;
 
         if( p_sys->p_audio_cfg->psz_name )
             free( p_sys->p_audio_cfg->psz_name );
@@ -809,7 +809,7 @@ static void Close( vlc_object_t * p_this )
 
     while( p_sys->p_video_cfg != NULL )
     {
-        sout_cfg_t *p_next = p_sys->p_video_cfg->p_next;
+        config_chain_t *p_next = p_sys->p_video_cfg->p_next;
 
         if( p_sys->p_video_cfg->psz_name )
             free( p_sys->p_video_cfg->psz_name );
@@ -823,7 +823,7 @@ static void Close( vlc_object_t * p_this )
 
     while( p_sys->p_deinterlace_cfg != NULL )
     {
-        sout_cfg_t *p_next = p_sys->p_deinterlace_cfg->p_next;
+        config_chain_t *p_next = p_sys->p_deinterlace_cfg->p_next;
 
         if( p_sys->p_deinterlace_cfg->psz_name )
             free( p_sys->p_deinterlace_cfg->psz_name );
@@ -837,7 +837,7 @@ static void Close( vlc_object_t * p_this )
 
     while( p_sys->p_spu_cfg != NULL )
     {
-        sout_cfg_t *p_next = p_sys->p_spu_cfg->p_next;
+        config_chain_t *p_next = p_sys->p_spu_cfg->p_next;
 
         if( p_sys->p_spu_cfg->psz_name )
             free( p_sys->p_spu_cfg->psz_name );
@@ -853,7 +853,7 @@ static void Close( vlc_object_t * p_this )
 
     while( p_sys->p_osd_cfg != NULL )
     {
-        sout_cfg_t *p_next = p_sys->p_osd_cfg->p_next;
+        config_chain_t *p_next = p_sys->p_osd_cfg->p_next;
 
         if( p_sys->p_osd_cfg->psz_name )
             free( p_sys->p_osd_cfg->psz_name );
index 478397e25690985669b266867467c2f265984470..d1b9220ccdca3804410f15968b25e0c553cc59ec 100644 (file)
@@ -167,7 +167,7 @@ static int Create( vlc_object_t *p_this )
 
     /* needed to get options passed in transcode using the
      * adjust{name=value} syntax */
-    sout_CfgParse( p_filter, "", ppsz_filter_options,
+    config_ChainParse( p_filter, "", ppsz_filter_options,
                    p_filter->p_cfg );
 
     var_Create( p_filter, "contrast",
index 9b4a03cde41e341506aeadf777a244d28c670a26..3665ed5957fa2555036e9b3553493d0fca872868 100644 (file)
@@ -2205,7 +2205,7 @@ static int OpenFilter( vlc_object_t *p_this )
     p_filter->p_sys = (filter_sys_t *)p_vout;
     p_vout->render.i_chroma = p_filter->fmt_in.video.i_chroma;
 
-    sout_CfgParse( p_filter, FILTER_CFG_PREFIX, ppsz_filter_options,
+    config_ChainParse( p_filter, FILTER_CFG_PREFIX, ppsz_filter_options,
                    p_filter->p_cfg );
     var_Get( p_filter, FILTER_CFG_PREFIX "mode", &val );
     var_Create( p_filter, "deinterlace-mode", VLC_VAR_STRING );
index eb6f7c9523989e05c91ab6de498c9414e214a8ec..8595eb8c7e2aacbc653479e2017cd16a88dc5051 100644 (file)
@@ -137,7 +137,7 @@ static int Create( vlc_object_t *p_this )
 
     p_filter->p_sys->p_pre_hough = NULL;
 
-    sout_CfgParse( p_filter, FILTER_PREFIX, ppsz_filter_options,
+    config_ChainParse( p_filter, FILTER_PREFIX, ppsz_filter_options,
                    p_filter->p_cfg );
 
     var_Create( p_filter, FILTER_PREFIX "mode",
index 6d6b96e61a5b58339750d661c3c5b5074e74a5f6..a8cd8470154a22ca707e4396aea4a09da220c8b1 100644 (file)
@@ -324,6 +324,7 @@ SOURCES_libvlc_common = \
        misc/unicode.c \
        misc/cpu.c \
        misc/configuration.c \
+       misc/configuration_chain.c \
        misc/image.c \
        misc/iso_lang.c \
        misc/iso-639_def.h \
diff --git a/src/misc/configuration_chain.c b/src/misc/configuration_chain.c
new file mode 100644 (file)
index 0000000..d736142
--- /dev/null
@@ -0,0 +1,386 @@
+/*****************************************************************************
+ * configuration_chain.c : configuration module chain parsing stuff
+ *****************************************************************************
+ * Copyright (C) 2002-2006 the VideoLAN team
+ * $Id$
+ *
+ * Authors: Christophe Massiot <massiot@via.ecp.fr>
+ *          Laurent Aimar <fenrir@via.ecp.fr>
+ *          Eric Petit <titer@videolan.org>
+ *
+ * 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
+ *****************************************************************************/
+
+#include <vlc/vlc.h>
+
+#include <stdlib.h>                                                /* free() */
+#include <stdio.h>                                              /* sprintf() */
+#include <string.h>                                            /* strerror() */
+
+/*****************************************************************************
+ * Local prototypes
+ *****************************************************************************/
+
+/* chain format:
+    module{option=*:option=*}[:module{option=*:...}]
+ */
+#define SKIPSPACE( p ) { while( *p && ( *p == ' ' || *p == '\t' ) ) p++; }
+#define SKIPTRAILINGSPACE( p, e ) \
+    { while( e > p && ( *(e-1) == ' ' || *(e-1) == '\t' ) ) e--; }
+
+/* go accross " " and { } */
+static char *_get_chain_end( char *str )
+{
+    char c, *p = str;
+
+    SKIPSPACE( p );
+
+    for( ;; )
+    {
+        if( !*p || *p == ',' || *p == '}' ) return p;
+
+        if( *p != '{' && *p != '"' && *p != '\'' )
+        {
+            p++;
+            continue;
+        }
+
+        if( *p == '{' ) c = '}';
+        else c = *p;
+        p++;
+
+        for( ;; )
+        {
+            if( !*p ) return p;
+
+            if( *p == c ) return ++p;
+            else if( *p == '{' && c == '}' ) p = _get_chain_end( p );
+            else p++;
+        }
+    }
+}
+
+char *config_ChainCreate( char **ppsz_name, config_chain_t **pp_cfg, char *psz_chain )
+{
+    config_chain_t *p_cfg = NULL;
+    char       *p = psz_chain;
+
+    *ppsz_name = NULL;
+    *pp_cfg    = NULL;
+
+    if( !p ) return NULL;
+
+    SKIPSPACE( p );
+
+    while( *p && *p != '{' && *p != ':' && *p != ' ' && *p != '\t' ) p++;
+
+    if( p == psz_chain ) return NULL;
+
+    *ppsz_name = strndup( psz_chain, p - psz_chain );
+
+    SKIPSPACE( p );
+
+    if( *p == '{' )
+    {
+        char *psz_name;
+
+        p++;
+
+        for( ;; )
+        {
+            config_chain_t cfg;
+
+            SKIPSPACE( p );
+
+            psz_name = p;
+
+            while( *p && *p != '=' && *p != ',' && *p != '{' && *p != '}' &&
+                   *p != ' ' && *p != '\t' ) p++;
+
+            /* fprintf( stderr, "name=%s - rest=%s\n", psz_name, p ); */
+            if( p == psz_name )
+            {
+                fprintf( stderr, "invalid options (empty)" );
+                break;
+            }
+
+            cfg.psz_name = strndup( psz_name, p - psz_name );
+
+            SKIPSPACE( p );
+
+            if( *p == '=' || *p == '{' )
+            {
+                char *end;
+                vlc_bool_t b_keep_brackets = (*p == '{');
+
+                if( *p == '=' ) p++;
+
+                end = _get_chain_end( p );
+                if( end <= p )
+                {
+                    cfg.psz_value = NULL;
+                }
+                else
+                {
+                    /* Skip heading and trailing spaces.
+                     * This ain't necessary but will avoid simple
+                     * user mistakes. */
+                    SKIPSPACE( p );
+                }
+
+                if( end <= p )
+                {
+                    cfg.psz_value = NULL;
+                }
+                else
+                {
+                    if( *p == '\'' || *p == '"' ||
+                        ( !b_keep_brackets && *p == '{' ) )
+                    {
+                        p++;
+
+                        if( *(end-1) != '\'' && *(end-1) == '"' )
+                            SKIPTRAILINGSPACE( p, end );
+
+                        if( end - 1 <= p ) cfg.psz_value = NULL;
+                        else cfg.psz_value = strndup( p, end -1 - p );
+                    }
+                    else
+                    {
+                        SKIPTRAILINGSPACE( p, end );
+                        if( end <= p ) cfg.psz_value = NULL;
+                        else cfg.psz_value = strndup( p, end - p );
+                    }
+                }
+
+                p = end;
+                SKIPSPACE( p );
+            }
+            else
+            {
+                cfg.psz_value = NULL;
+            }
+
+            cfg.p_next = NULL;
+            if( p_cfg )
+            {
+                p_cfg->p_next = malloc( sizeof( config_chain_t ) );
+                memcpy( p_cfg->p_next, &cfg, sizeof( config_chain_t ) );
+
+                p_cfg = p_cfg->p_next;
+            }
+            else
+            {
+                p_cfg = malloc( sizeof( config_chain_t ) );
+                memcpy( p_cfg, &cfg, sizeof( config_chain_t ) );
+
+                *pp_cfg = p_cfg;
+            }
+
+            if( *p == ',' ) p++;
+
+            if( *p == '}' )
+            {
+                p++;
+                break;
+            }
+        }
+    }
+
+    if( *p == ':' ) return( strdup( p + 1 ) );
+
+    return NULL;
+}
+
+void config_ChainDestroy( config_chain_t *p_cfg )
+{
+    while( p_cfg != NULL )
+    {
+        config_chain_t *p_next;
+
+        p_next = p_cfg->p_next;
+
+        FREENULL( p_cfg->psz_name );
+        FREENULL( p_cfg->psz_value );
+        free( p_cfg );
+
+        p_cfg = p_next;
+    }
+}
+
+void __config_ChainParse( vlc_object_t *p_this, char *psz_prefix,
+                      const char **ppsz_options, config_chain_t *cfg )
+{
+    char *psz_name;
+    int  i_type;
+    int  i;
+
+    /* First, var_Create all variables */
+    for( i = 0; ppsz_options[i] != NULL; i++ )
+    {
+        asprintf( &psz_name, "%s%s", psz_prefix,
+                  *ppsz_options[i] == '*' ? &ppsz_options[i][1] : ppsz_options[i] );
+
+        i_type = config_GetType( p_this, psz_name );
+
+        var_Create( p_this, psz_name, i_type | VLC_VAR_DOINHERIT );
+        free( psz_name );
+    }
+
+    /* Now parse options and set value */
+    if( psz_prefix == NULL ) psz_prefix = "";
+
+    while( cfg )
+    {
+        vlc_value_t val;
+        vlc_bool_t b_yes = VLC_TRUE;
+        vlc_bool_t b_once = VLC_FALSE;
+        module_config_t *p_conf;
+
+        if( cfg->psz_name == NULL || *cfg->psz_name == '\0' )
+        {
+            cfg = cfg->p_next;
+            continue;
+        }
+        for( i = 0; ppsz_options[i] != NULL; i++ )
+        {
+            if( !strcmp( ppsz_options[i], cfg->psz_name ) )
+            {
+                break;
+            }
+            if( ( !strncmp( cfg->psz_name, "no-", 3 ) &&
+                  !strcmp( ppsz_options[i], cfg->psz_name + 3 ) ) ||
+                ( !strncmp( cfg->psz_name, "no", 2 ) &&
+                  !strcmp( ppsz_options[i], cfg->psz_name + 2 ) ) )
+            {
+                b_yes = VLC_FALSE;
+                break;
+            }
+
+            if( *ppsz_options[i] == '*' &&
+                !strcmp( &ppsz_options[i][1], cfg->psz_name ) )
+            {
+                b_once = VLC_TRUE;
+                break;
+            }
+
+        }
+        if( ppsz_options[i] == NULL )
+        {
+            msg_Warn( p_this, "option %s is unknown", cfg->psz_name );
+            cfg = cfg->p_next;
+            continue;
+        }
+
+        /* create name */
+        asprintf( &psz_name, "%s%s", psz_prefix, b_once ? &ppsz_options[i][1] : ppsz_options[i] );
+
+        /* Check if the option is deprecated */
+        p_conf = config_FindConfig( p_this, psz_name );
+
+        /* This is basically cut and paste from src/misc/configuration.c
+         * with slight changes */
+        if( p_conf && p_conf->psz_current )
+        {
+            if( !strcmp( p_conf->psz_current, "SUPPRESSED" ) )
+            {
+                msg_Err( p_this, "Option %s is no longer used.",
+                         p_conf->psz_name );
+                goto next;
+            }
+            else if( p_conf->b_strict )
+            {
+                msg_Err( p_this, "Option %s is deprecated. Use %s instead.",
+                         p_conf->psz_name, p_conf->psz_current );
+                /* TODO: this should return an error and end option parsing
+                 * ... but doing this would change the VLC API and all the
+                 * modules so i'll do it later */
+                goto next;
+            }
+            else
+            {
+                msg_Warn( p_this, "Option %s is deprecated. You should use "
+                        "%s instead.", p_conf->psz_name, p_conf->psz_current );
+                free( psz_name );
+                psz_name = strdup( p_conf->psz_current );
+            }
+        }
+        /* </Check if the option is deprecated> */
+
+        /* get the type of the variable */
+        i_type = config_GetType( p_this, psz_name );
+        if( !i_type )
+        {
+            msg_Warn( p_this, "unknown option %s (value=%s)",
+                      cfg->psz_name, cfg->psz_value );
+            goto next;
+        }
+        if( i_type != VLC_VAR_BOOL && cfg->psz_value == NULL )
+        {
+            msg_Warn( p_this, "missing value for option %s", cfg->psz_name );
+            goto next;
+        }
+        if( i_type != VLC_VAR_STRING && b_once )
+        {
+            msg_Warn( p_this, "*option_name need to be a string option" );
+            goto next;
+        }
+
+        switch( i_type )
+        {
+            case VLC_VAR_BOOL:
+                val.b_bool = b_yes;
+                break;
+            case VLC_VAR_INTEGER:
+                val.i_int = strtol( cfg->psz_value ? cfg->psz_value : "0",
+                                    NULL, 0 );
+                break;
+            case VLC_VAR_FLOAT:
+                val.f_float = atof( cfg->psz_value ? cfg->psz_value : "0" );
+                break;
+            case VLC_VAR_STRING:
+            case VLC_VAR_MODULE:
+                val.psz_string = cfg->psz_value;
+                break;
+            default:
+                msg_Warn( p_this, "unhandled config var type" );
+                memset( &val, 0, sizeof( vlc_value_t ) );
+                break;
+        }
+        if( b_once )
+        {
+            vlc_value_t val2;
+
+            var_Get( p_this, psz_name, &val2 );
+            if( *val2.psz_string )
+            {
+                free( val2.psz_string );
+                msg_Dbg( p_this, "ignoring option %s (not first occurrence)", psz_name );
+                goto next;
+            }
+            free( val2.psz_string );
+        }
+        var_Set( p_this, psz_name, val );
+        msg_Dbg( p_this, "set config option: %s to %s", psz_name, cfg->psz_value );
+
+    next:
+        free( psz_name );
+        cfg = cfg->p_next;
+    }
+}
index c8bc465ce401ec792da446f60b198391685342e3..16cbad85e5b112abe352d87433c51ee5bde37127 100644 (file)
@@ -42,8 +42,6 @@
 /*****************************************************************************
  * Local prototypes
  *****************************************************************************/
-static void sout_CfgDestroy( sout_cfg_t * );
-
 #define sout_stream_url_to_chain( p, s ) \
     _sout_stream_url_to_chain( VLC_OBJECT(p), s )
 static char *_sout_stream_url_to_chain( vlc_object_t *, char * );
@@ -286,8 +284,8 @@ sout_access_out_t *sout_AccessOutNew( sout_instance_t *p_sout,
         return NULL;
     }
 
-    psz_next = sout_CfgCreate( &p_access->psz_access, &p_access->p_cfg,
-                                psz_access );
+    psz_next = config_ChainCreate( &p_access->psz_access, &p_access->p_cfg,
+                                   psz_access );
     if( psz_next )
     {
         free( psz_next );
@@ -331,7 +329,7 @@ void sout_AccessOutDelete( sout_access_out_t *p_access )
     }
     free( p_access->psz_access );
 
-    sout_CfgDestroy( p_access->p_cfg );
+    config_ChainDestroy( p_access->p_cfg );
 
     free( p_access->psz_name );
 
@@ -401,7 +399,7 @@ sout_mux_t * sout_MuxNew( sout_instance_t *p_sout, char *psz_mux,
     }
 
     p_mux->p_sout = p_sout;
-    psz_next = sout_CfgCreate( &p_mux->psz_mux, &p_mux->p_cfg, psz_mux );
+    psz_next = config_ChainCreate( &p_mux->psz_mux, &p_mux->p_cfg, psz_mux );
     if( psz_next ) free( psz_next );
 
     p_mux->p_access     = p_access;
@@ -486,7 +484,7 @@ void sout_MuxDelete( sout_mux_t *p_mux )
     }
     free( p_mux->psz_mux );
 
-    sout_CfgDestroy( p_mux->p_cfg );
+    config_ChainDestroy( p_mux->p_cfg );
 
     vlc_object_destroy( p_mux );
 }
@@ -783,316 +781,6 @@ static char *_get_chain_end( char *str )
     }
 }
 
-char *sout_CfgCreate( char **ppsz_name, sout_cfg_t **pp_cfg, char *psz_chain )
-{
-    sout_cfg_t *p_cfg = NULL;
-    char       *p = psz_chain;
-
-    *ppsz_name = NULL;
-    *pp_cfg    = NULL;
-
-    if( !p ) return NULL;
-
-    SKIPSPACE( p );
-
-    while( *p && *p != '{' && *p != ':' && *p != ' ' && *p != '\t' ) p++;
-
-    if( p == psz_chain ) return NULL;
-
-    *ppsz_name = strndup( psz_chain, p - psz_chain );
-
-    SKIPSPACE( p );
-
-    if( *p == '{' )
-    {
-        char *psz_name;
-
-        p++;
-
-        for( ;; )
-        {
-            sout_cfg_t cfg;
-
-            SKIPSPACE( p );
-
-            psz_name = p;
-
-            while( *p && *p != '=' && *p != ',' && *p != '{' && *p != '}' &&
-                   *p != ' ' && *p != '\t' ) p++;
-
-            /* fprintf( stderr, "name=%s - rest=%s\n", psz_name, p ); */
-            if( p == psz_name )
-            {
-                fprintf( stderr, "invalid options (empty)" );
-                break;
-            }
-
-            cfg.psz_name = strndup( psz_name, p - psz_name );
-
-            SKIPSPACE( p );
-
-            if( *p == '=' || *p == '{' )
-            {
-                char *end;
-                vlc_bool_t b_keep_brackets = (*p == '{');
-
-                if( *p == '=' ) p++;
-
-                end = _get_chain_end( p );
-                if( end <= p )
-                {
-                    cfg.psz_value = NULL;
-                }
-                else
-                {
-                    /* Skip heading and trailing spaces.
-                     * This ain't necessary but will avoid simple
-                     * user mistakes. */
-                    SKIPSPACE( p );
-                }
-
-                if( end <= p )
-                {
-                    cfg.psz_value = NULL;
-                }
-                else
-                {
-                    if( *p == '\'' || *p == '"' ||
-                        ( !b_keep_brackets && *p == '{' ) )
-                    {
-                        p++;
-
-                        if( *(end-1) != '\'' && *(end-1) == '"' )
-                            SKIPTRAILINGSPACE( p, end );
-
-                        if( end - 1 <= p ) cfg.psz_value = NULL;
-                        else cfg.psz_value = strndup( p, end -1 - p );
-                    }
-                    else
-                    {
-                        SKIPTRAILINGSPACE( p, end );
-                        if( end <= p ) cfg.psz_value = NULL;
-                        else cfg.psz_value = strndup( p, end - p );
-                    }
-                }
-
-                p = end;
-                SKIPSPACE( p );
-            }
-            else
-            {
-                cfg.psz_value = NULL;
-            }
-
-            cfg.p_next = NULL;
-            if( p_cfg )
-            {
-                p_cfg->p_next = malloc( sizeof( sout_cfg_t ) );
-                memcpy( p_cfg->p_next, &cfg, sizeof( sout_cfg_t ) );
-
-                p_cfg = p_cfg->p_next;
-            }
-            else
-            {
-                p_cfg = malloc( sizeof( sout_cfg_t ) );
-                memcpy( p_cfg, &cfg, sizeof( sout_cfg_t ) );
-
-                *pp_cfg = p_cfg;
-            }
-
-            if( *p == ',' ) p++;
-
-            if( *p == '}' )
-            {
-                p++;
-                break;
-            }
-        }
-    }
-
-    if( *p == ':' ) return( strdup( p + 1 ) );
-
-    return NULL;
-}
-
-static void sout_CfgDestroy( sout_cfg_t *p_cfg )
-{
-    while( p_cfg != NULL )
-    {
-        sout_cfg_t *p_next;
-
-        p_next = p_cfg->p_next;
-
-        FREENULL( p_cfg->psz_name );
-        FREENULL( p_cfg->psz_value );
-        free( p_cfg );
-
-        p_cfg = p_next;
-    }
-}
-
-void __sout_CfgParse( vlc_object_t *p_this, char *psz_prefix,
-                      const char **ppsz_options, sout_cfg_t *cfg )
-{
-    char *psz_name;
-    int  i_type;
-    int  i;
-
-    /* First, var_Create all variables */
-    for( i = 0; ppsz_options[i] != NULL; i++ )
-    {
-        asprintf( &psz_name, "%s%s", psz_prefix,
-                  *ppsz_options[i] == '*' ? &ppsz_options[i][1] : ppsz_options[i] );
-
-        i_type = config_GetType( p_this, psz_name );
-
-        var_Create( p_this, psz_name, i_type | VLC_VAR_DOINHERIT );
-        free( psz_name );
-    }
-
-    /* Now parse options and set value */
-    if( psz_prefix == NULL ) psz_prefix = "";
-
-    while( cfg )
-    {
-        vlc_value_t val;
-        vlc_bool_t b_yes = VLC_TRUE;
-        vlc_bool_t b_once = VLC_FALSE;
-        module_config_t *p_conf;
-
-        if( cfg->psz_name == NULL || *cfg->psz_name == '\0' )
-        {
-            cfg = cfg->p_next;
-            continue;
-        }
-        for( i = 0; ppsz_options[i] != NULL; i++ )
-        {
-            if( !strcmp( ppsz_options[i], cfg->psz_name ) )
-            {
-                break;
-            }
-            if( ( !strncmp( cfg->psz_name, "no-", 3 ) &&
-                  !strcmp( ppsz_options[i], cfg->psz_name + 3 ) ) ||
-                ( !strncmp( cfg->psz_name, "no", 2 ) &&
-                  !strcmp( ppsz_options[i], cfg->psz_name + 2 ) ) )
-            {
-                b_yes = VLC_FALSE;
-                break;
-            }
-
-            if( *ppsz_options[i] == '*' &&
-                !strcmp( &ppsz_options[i][1], cfg->psz_name ) )
-            {
-                b_once = VLC_TRUE;
-                break;
-            }
-
-        }
-        if( ppsz_options[i] == NULL )
-        {
-            msg_Warn( p_this, "option %s is unknown", cfg->psz_name );
-            cfg = cfg->p_next;
-            continue;
-        }
-
-        /* create name */
-        asprintf( &psz_name, "%s%s", psz_prefix, b_once ? &ppsz_options[i][1] : ppsz_options[i] );
-
-        /* Check if the option is deprecated */
-        p_conf = config_FindConfig( p_this, psz_name );
-
-        /* This is basically cut and paste from src/misc/configuration.c
-         * with slight changes */
-        if( p_conf && p_conf->psz_current )
-        {
-            if( !strcmp( p_conf->psz_current, "SUPPRESSED" ) )
-            {
-                msg_Err( p_this, "Option %s is no longer used.",
-                         p_conf->psz_name );
-                goto next;
-            }
-            else if( p_conf->b_strict )
-            {
-                msg_Err( p_this, "Option %s is deprecated. Use %s instead.",
-                         p_conf->psz_name, p_conf->psz_current );
-                /* TODO: this should return an error and end option parsing
-                 * ... but doing this would change the VLC API and all the
-                 * modules so i'll do it later */
-                goto next;
-            }
-            else
-            {
-                msg_Warn( p_this, "Option %s is deprecated. You should use "
-                        "%s instead.", p_conf->psz_name, p_conf->psz_current );
-                free( psz_name );
-                psz_name = strdup( p_conf->psz_current );
-            }
-        }
-        /* </Check if the option is deprecated> */
-
-        /* get the type of the variable */
-        i_type = config_GetType( p_this, psz_name );
-        if( !i_type )
-        {
-            msg_Warn( p_this, "unknown option %s (value=%s)",
-                      cfg->psz_name, cfg->psz_value );
-            goto next;
-        }
-        if( i_type != VLC_VAR_BOOL && cfg->psz_value == NULL )
-        {
-            msg_Warn( p_this, "missing value for option %s", cfg->psz_name );
-            goto next;
-        }
-        if( i_type != VLC_VAR_STRING && b_once )
-        {
-            msg_Warn( p_this, "*option_name need to be a string option" );
-            goto next;
-        }
-
-        switch( i_type )
-        {
-            case VLC_VAR_BOOL:
-                val.b_bool = b_yes;
-                break;
-            case VLC_VAR_INTEGER:
-                val.i_int = strtol( cfg->psz_value ? cfg->psz_value : "0",
-                                    NULL, 0 );
-                break;
-            case VLC_VAR_FLOAT:
-                val.f_float = atof( cfg->psz_value ? cfg->psz_value : "0" );
-                break;
-            case VLC_VAR_STRING:
-            case VLC_VAR_MODULE:
-                val.psz_string = cfg->psz_value;
-                break;
-            default:
-                msg_Warn( p_this, "unhandled config var type" );
-                memset( &val, 0, sizeof( vlc_value_t ) );
-                break;
-        }
-        if( b_once )
-        {
-            vlc_value_t val2;
-
-            var_Get( p_this, psz_name, &val2 );
-            if( *val2.psz_string )
-            {
-                free( val2.psz_string );
-                msg_Dbg( p_this, "ignoring option %s (not first occurrence)", psz_name );
-                goto next;
-            }
-            free( val2.psz_string );
-        }
-        var_Set( p_this, psz_name, val );
-        msg_Dbg( p_this, "set sout option: %s to %s", psz_name, cfg->psz_value );
-
-    next:
-        free( psz_name );
-        cfg = cfg->p_next;
-    }
-}
-
-
 /*
  * XXX name and p_cfg are used (-> do NOT free them)
  */
@@ -1118,7 +806,7 @@ sout_stream_t *sout_StreamNew( sout_instance_t *p_sout, char *psz_chain )
     p_stream->p_sys    = NULL;
 
     p_stream->psz_next =
-        sout_CfgCreate( &p_stream->psz_name, &p_stream->p_cfg, psz_chain);
+        config_ChainCreate( &p_stream->psz_name, &p_stream->p_cfg, psz_chain);
 
     msg_Dbg( p_sout, "stream=`%s'", p_stream->psz_name );
 
@@ -1146,7 +834,7 @@ void sout_StreamDelete( sout_stream_t *p_stream )
     FREENULL( p_stream->psz_name );
     FREENULL( p_stream->psz_next );
 
-    sout_CfgDestroy( p_stream->p_cfg );
+    config_ChainDestroy( p_stream->p_cfg );
 
     msg_Dbg( p_stream, "destroying chain done" );
     vlc_object_destroy( p_stream );
index 20493384a6b3662e321c2a43e63667927550ad3d..b686b3b11de4adfee6ddcd729b2c8665f26b6e7f 100644 (file)
@@ -46,7 +46,6 @@
 #include "vlc_playlist.h"
 
 #include "vlc_filter.h"
-#include <vlc/sout.h> /* sout_CfgParse */
 
 #if defined( __APPLE__ )
 #include "darwin_specific.h"
@@ -1540,19 +1539,9 @@ static int ParseVideoFilter2Chain( vout_thread_t *p_vout, char *psz_vfilters )
     int i;
     for( i = 0; i < p_vout->i_vfilters_cfg; i++ )
     {
-        /* FIXME: this should be moved in a separate function */
-        struct sout_cfg_t *p_cfg =
+        struct config_chain_t *p_cfg =
             p_vout->p_vfilters_cfg[p_vout->i_vfilters_cfg];
-        while( p_cfg )
-        {
-            struct sout_cfg_t *p_next = p_cfg->p_next;
-            free( p_cfg->psz_name );
-            free( p_cfg->psz_value );
-            free( p_cfg );
-            p_cfg = p_next;
-        }
-        /* </FIXME> */
-
+        config_ChainDestroy( p_cfg );
         free( p_vout->psz_vfilters[p_vout->i_vfilters_cfg] );
     }
     p_vout->i_vfilters_cfg = 0;
@@ -1562,7 +1551,7 @@ static int ParseVideoFilter2Chain( vout_thread_t *p_vout, char *psz_vfilters )
 
         while( psz_parser && *psz_parser )
         {
-            psz_parser = sout_CfgCreate(
+            psz_parser = config_ChainCreate(
                             &p_vout->psz_vfilters[p_vout->i_vfilters_cfg],
                             &p_vout->p_vfilters_cfg[p_vout->i_vfilters_cfg],
                             psz_parser );