sout: we don't modify the chain string
authorSteve Lhomme <robUx4@videolabs.io>
Thu, 29 Oct 2015 15:05:38 +0000 (16:05 +0100)
committerJean-Baptiste Kempf <jb@videolan.org>
Thu, 26 Nov 2015 17:11:46 +0000 (18:11 +0100)
without the const passing a std::string.c_str() in C++ fails

Signed-off-by: Jean-Baptiste Kempf <jb@videolan.org>
include/vlc_sout.h
src/missing.c
src/stream_output/stream_output.c

index c2470f2..aeae53a 100644 (file)
@@ -212,7 +212,7 @@ struct sout_stream_t
 
 VLC_API void sout_StreamChainDelete(sout_stream_t *p_first, sout_stream_t *p_last );
 VLC_API sout_stream_t *sout_StreamChainNew(sout_instance_t *p_sout,
-        char *psz_chain, sout_stream_t *p_next, sout_stream_t **p_last) VLC_USED;
+        const char *psz_chain, sout_stream_t *p_next, sout_stream_t **p_last) VLC_USED;
 
 static inline sout_stream_id_sys_t *sout_StreamIdAdd( sout_stream_t *s,
                                                       const es_format_t *fmt )
index a4897ee..24218f3 100644 (file)
@@ -320,7 +320,7 @@ void sout_StreamChainDelete (sout_stream_t *p_first, sout_stream_t *p_last)
     vlc_assert_unreachable ();
 }
 
-sout_stream_t *sout_StreamChainNew (sout_instance_t *p_sout, char *psz_chain,
+sout_stream_t *sout_StreamChainNew (sout_instance_t *p_sout, const char *psz_chain,
                                     sout_stream_t *p_next,
                                     sout_stream_t **pp_last)
 {
index 66bca45..113fce2 100644 (file)
@@ -810,7 +810,7 @@ static sout_stream_t *sout_StreamNew( sout_instance_t *p_sout, char *psz_name,
  *
  *  Returns a pointer to the first module.
  */
-sout_stream_t *sout_StreamChainNew(sout_instance_t *p_sout, char *psz_chain,
+sout_stream_t *sout_StreamChainNew(sout_instance_t *p_sout, const char *psz_chain,
                                 sout_stream_t *p_next, sout_stream_t **pp_last)
 {
     if(!psz_chain || !*psz_chain)
@@ -832,9 +832,9 @@ sout_stream_t *sout_StreamChainNew(sout_instance_t *p_sout, char *psz_chain,
     {
         config_chain_t *p_cfg;
         char *psz_name;
-        psz_chain = config_ChainCreate( &psz_name, &p_cfg, psz_parser );
+        char *psz_rest_chain = config_ChainCreate( &psz_name, &p_cfg, psz_parser );
         free( psz_parser );
-        psz_parser = psz_chain;
+        psz_parser = psz_rest_chain;
 
         vlc_array_append(&cfg, p_cfg);
         vlc_array_append(&name, psz_name);