[vlc-commits] sout: simplify sout_StreamChainDelete() semantics
Rémi Denis-Courmont
git at videolan.org
Mon Oct 12 17:02:58 CEST 2020
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Oct 11 16:15:40 2020 +0300| [83443b5fd0752eadd20c2812239dd3a3e8780722] | committer: Rémi Denis-Courmont
sout: simplify sout_StreamChainDelete() semantics
Delete instances up to the second parameter exclusive, instead of
inclusive.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=83443b5fd0752eadd20c2812239dd3a3e8780722
---
include/vlc_sout.h | 2 +-
modules/stream_out/duplicate.c | 2 +-
modules/stream_out/record.c | 4 ++--
src/missing.c | 4 ++--
src/stream_output/stream_output.c | 6 ++----
5 files changed, 8 insertions(+), 10 deletions(-)
diff --git a/include/vlc_sout.h b/include/vlc_sout.h
index c0701360a4..6f4d557cea 100644
--- a/include/vlc_sout.h
+++ b/include/vlc_sout.h
@@ -193,7 +193,7 @@ struct sout_stream_t
void *p_sys;
};
-VLC_API void sout_StreamChainDelete(sout_stream_t *p_first, sout_stream_t *p_last );
+VLC_API void sout_StreamChainDelete(sout_stream_t *first, sout_stream_t *end);
VLC_API sout_stream_t *sout_StreamChainNew(vlc_object_t *parent,
const char *psz_chain, sout_stream_t *p_next, sout_stream_t **p_last) VLC_USED;
diff --git a/modules/stream_out/duplicate.c b/modules/stream_out/duplicate.c
index 63e186ee35..d2fed44e6a 100644
--- a/modules/stream_out/duplicate.c
+++ b/modules/stream_out/duplicate.c
@@ -200,7 +200,7 @@ static void Close( vlc_object_t * p_this )
msg_Dbg( p_stream, "closing a duplication" );
for( int i = 0; i < p_sys->i_nb_streams; i++ )
{
- sout_StreamChainDelete(p_sys->pp_streams[i], p_sys->pp_last_streams[i]);
+ sout_StreamChainDelete(p_sys->pp_streams[i], p_stream->p_next);
free( p_sys->ppsz_select[i] );
}
free( p_sys->pp_streams );
diff --git a/modules/stream_out/record.c b/modules/stream_out/record.c
index 70dee74934..2d8e557f9c 100644
--- a/modules/stream_out/record.c
+++ b/modules/stream_out/record.c
@@ -170,7 +170,7 @@ static void Close( vlc_object_t * p_this )
sout_stream_sys_t *p_sys = p_stream->p_sys;
if( p_sys->p_out )
- sout_StreamChainDelete( p_sys->p_out, p_sys->p_out );
+ sout_StreamChainDelete( p_sys->p_out, NULL );
TAB_CLEAN( p_sys->i_id, p_sys->id );
free( p_sys->psz_prefix );
@@ -491,7 +491,7 @@ static void OutputStart( sout_stream_t *p_stream )
id->id = NULL;
}
if( p_sys->p_out )
- sout_StreamChainDelete( p_sys->p_out, p_sys->p_out );
+ sout_StreamChainDelete( p_sys->p_out, NULL );
p_sys->p_out = NULL;
if( i_es > i_best_es )
diff --git a/src/missing.c b/src/missing.c
index 45fddf177f..0053f5816e 100644
--- a/src/missing.c
+++ b/src/missing.c
@@ -151,9 +151,9 @@ noreturn void sout_MuxFlush(sout_mux_t *mux, sout_input_t *input)
}
noreturn void sout_StreamChainDelete(sout_stream_t *first,
- sout_stream_t *last)
+ sout_stream_t *end)
{
- (void) first; (void) last;
+ (void) first; (void) end;
vlc_assert_unreachable ();
}
diff --git a/src/stream_output/stream_output.c b/src/stream_output/stream_output.c
index 76c479efa7..d66223ed61 100644
--- a/src/stream_output/stream_output.c
+++ b/src/stream_output/stream_output.c
@@ -757,15 +757,13 @@ static void sout_StreamDelete( sout_stream_t *p_stream )
* if NULL, all modules are destroyed
* if not NULL, modules following it must be destroyed separately
*/
-void sout_StreamChainDelete(sout_stream_t *p_first, sout_stream_t *p_last)
+void sout_StreamChainDelete(sout_stream_t *p_first, sout_stream_t *end)
{
- while(p_first != NULL)
+ while (p_first != end)
{
sout_stream_t *p_next = p_first->p_next;
sout_StreamDelete(p_first);
- if(p_first == p_last)
- break;
p_first = p_next;
}
}
More information about the vlc-commits
mailing list