[vlc-devel] [PATCH] sout: we don't modify the chain string

Steve Lhomme robux4 at videolabs.io
Thu Oct 29 16:05:38 CET 2015


without the const passing a std::string.c_str() in C++ fails

--
replaces https://patches.videolan.org/patch/10568/ and https://patches.videolan.org/patch/10582/
---
 include/vlc_sout.h                | 2 +-
 src/missing.c                     | 2 +-
 src/stream_output/stream_output.c | 6 +++---
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/include/vlc_sout.h b/include/vlc_sout.h
index e4cc0e8..bc91349 100644
--- a/include/vlc_sout.h
+++ b/include/vlc_sout.h
@@ -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 )
diff --git a/src/missing.c b/src/missing.c
index a4897ee..24218f3 100644
--- a/src/missing.c
+++ b/src/missing.c
@@ -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)
 {
diff --git a/src/stream_output/stream_output.c b/src/stream_output/stream_output.c
index b03bb84..fac281e 100644
--- a/src/stream_output/stream_output.c
+++ b/src/stream_output/stream_output.c
@@ -807,7 +807,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)
@@ -829,9 +829,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);
-- 
2.6.2



More information about the vlc-devel mailing list