[vlc-devel] [PATCH 5/5] sout: remove sout_stream_t.p_sout
RĂ©mi Denis-Courmont
remi at remlab.net
Sun Mar 1 13:11:59 CET 2020
---
include/vlc_sout.h | 5 +++--
modules/stream_out/cycle.c | 3 +--
modules/stream_out/duplicate.c | 2 +-
modules/stream_out/record.c | 3 +--
src/stream_output/stream_output.c | 15 +++++++--------
5 files changed, 13 insertions(+), 15 deletions(-)
diff --git a/include/vlc_sout.h b/include/vlc_sout.h
index 4534d9f5d5..29ed9307dc 100644
--- a/include/vlc_sout.h
+++ b/include/vlc_sout.h
@@ -193,7 +193,6 @@ struct sout_stream_t
struct vlc_object_t obj;
module_t *p_module;
- sout_instance_t *p_sout;
char *psz_name;
config_chain_t *p_cfg;
@@ -212,8 +211,10 @@ 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,
+VLC_API sout_stream_t *sout_StreamChainNew(vlc_object_t *,
const char *psz_chain, sout_stream_t *p_next, sout_stream_t **p_last) VLC_USED;
+#define sout_StreamChainNew(o,c,n,pp) \
+ sout_StreamChainNew(VLC_OBJECT(o),c,n,pp)
static inline void *sout_StreamIdAdd( sout_stream_t *s,
const es_format_t *fmt )
diff --git a/modules/stream_out/cycle.c b/modules/stream_out/cycle.c
index 0c7481339e..bbfcf83778 100644
--- a/modules/stream_out/cycle.c
+++ b/modules/stream_out/cycle.c
@@ -127,8 +127,7 @@ static int AddStream(sout_stream_t *stream, char *chain)
msg_Dbg(stream, "starting new phase \"%s\"", chain);
/* TODO format */
- sys->stream = sout_StreamChainNew(stream->p_sout, chain,
- stream->p_next, NULL);
+ sys->stream = sout_StreamChainNew(stream, chain, stream->p_next, NULL);
if (sys->stream == NULL)
return -1;
diff --git a/modules/stream_out/duplicate.c b/modules/stream_out/duplicate.c
index 916b264b92..744eece663 100644
--- a/modules/stream_out/duplicate.c
+++ b/modules/stream_out/duplicate.c
@@ -129,7 +129,7 @@ static int Open( vlc_object_t *p_this )
sout_stream_t *s, *p_last;
msg_Dbg( p_stream, " * adding `%s'", p_cfg->psz_value );
- s = sout_StreamChainNew( p_stream->p_sout, p_cfg->psz_value,
+ s = sout_StreamChainNew( p_stream, p_cfg->psz_value,
p_stream->p_next, &p_last );
if( s )
diff --git a/modules/stream_out/record.c b/modules/stream_out/record.c
index 50348224fc..d06dbb8a6b 100644
--- a/modules/stream_out/record.c
+++ b/modules/stream_out/record.c
@@ -346,8 +346,7 @@ static int OutputNew( sout_stream_t *p_stream,
/* Create the output */
msg_Dbg( p_stream, "Using record output `%s'", psz_output );
- p_sys->p_out = sout_StreamChainNew( p_stream->p_sout, psz_output, NULL, NULL );
-
+ p_sys->p_out = sout_StreamChainNew( p_stream, psz_output, NULL, NULL );
if( !p_sys->p_out )
goto error;
diff --git a/src/stream_output/stream_output.c b/src/stream_output/stream_output.c
index 8bee21d226..5a1aafcb45 100644
--- a/src/stream_output/stream_output.c
+++ b/src/stream_output/stream_output.c
@@ -116,7 +116,7 @@ sout_instance_t *sout_NewInstance( vlc_object_t *p_parent, const char *psz_dest
var_Create( p_sout, "sout-mux-caching", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
- p_sout->p_stream = sout_StreamChainNew( p_sout, psz_chain, NULL, NULL );
+ p_sout->p_stream = sout_StreamChainNew( p_parent, psz_chain, NULL, NULL );
if( p_sout->p_stream )
{
free( psz_chain );
@@ -796,18 +796,17 @@ void sout_StreamChainDelete(sout_stream_t *p_first, sout_stream_t *p_last)
/*
* XXX name and p_cfg are used (-> do NOT free them)
*/
-static sout_stream_t *sout_StreamNew( sout_instance_t *p_sout, char *psz_name,
+static sout_stream_t *sout_StreamNew( vlc_object_t *parent, char *psz_name,
config_chain_t *p_cfg, sout_stream_t *p_next)
{
sout_stream_t *p_stream;
assert(psz_name);
- p_stream = vlc_custom_create( p_sout, sizeof( *p_stream ), "stream out" );
+ p_stream = vlc_custom_create( parent, sizeof( *p_stream ), "stream out" );
if( !p_stream )
return NULL;
- p_stream->p_sout = p_sout;
p_stream->psz_name = psz_name;
p_stream->p_cfg = p_cfg;
p_stream->p_next = p_next;
@@ -816,7 +815,7 @@ static sout_stream_t *sout_StreamNew( sout_instance_t *p_sout, char *psz_name,
p_stream->pace_nocontrol = false;
p_stream->p_sys = NULL;
- msg_Dbg( p_sout, "stream=`%s'", p_stream->psz_name );
+ msg_Dbg( parent, "stream=`%s'", p_stream->psz_name );
p_stream->p_module =
module_need( p_stream, "sout stream", p_stream->psz_name, true );
@@ -845,8 +844,8 @@ 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, const char *psz_chain,
- sout_stream_t *p_next, sout_stream_t **pp_last)
+sout_stream_t *(sout_StreamChainNew)(vlc_object_t *parent, const char *psz_chain,
+ sout_stream_t *p_next, sout_stream_t **pp_last)
{
if(!psz_chain || !*psz_chain)
{
@@ -880,7 +879,7 @@ sout_stream_t *sout_StreamChainNew(sout_instance_t *p_sout, const char *psz_chai
vlc_array_init(&module);
while(i--)
{
- p_next = sout_StreamNew( p_sout, vlc_array_item_at_index(&name, i),
+ p_next = sout_StreamNew( parent, vlc_array_item_at_index(&name, i),
vlc_array_item_at_index(&cfg, i), p_next);
if(!p_next)
--
2.20.1
More information about the vlc-devel
mailing list