[vlc-devel] [RFC PATCH 08/10] sout: Provide a default control callback
Hugo Beauzée-Luyssen
hugo at beauzee.fr
Thu Sep 7 15:46:04 CEST 2017
It forwards the request to the next stream out in the chain, if any, or
returns an error
---
include/vlc_sout.h | 5 +----
src/stream_output/stream_output.c | 10 +++++++++-
2 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/include/vlc_sout.h b/include/vlc_sout.h
index 38ac269303..706960dfe0 100644
--- a/include/vlc_sout.h
+++ b/include/vlc_sout.h
@@ -257,10 +257,7 @@ static inline int sout_StreamControl( sout_stream_t *s, int i_query, ... )
int i_result;
va_start( args, i_query );
- if ( !s->pf_control )
- i_result = VLC_EGENERIC;
- else
- i_result = s->pf_control( s, i_query, args );
+ i_result = s->pf_control( s, i_query, args );
va_end( args );
return i_result;
}
diff --git a/src/stream_output/stream_output.c b/src/stream_output/stream_output.c
index 89f7503eee..0df7d397b5 100644
--- a/src/stream_output/stream_output.c
+++ b/src/stream_output/stream_output.c
@@ -838,6 +838,14 @@ void sout_StreamChainDelete(sout_stream_t *p_first, sout_stream_t *p_last)
}
}
+static int sout_DefaultControl( sout_stream_t *p_stream, int i_control,
+ va_list va )
+{
+ if( p_stream->p_next )
+ return p_stream->p_next->pf_control( p_stream->p_next, i_control, va );
+ return VLC_EGENERIC;
+}
+
/* Create a "stream_out" module, which may forward its ES to p_next module */
/*
* XXX name and p_cfg are used (-> do NOT free them)
@@ -858,7 +866,7 @@ static sout_stream_t *sout_StreamNew( sout_instance_t *p_sout, char *psz_name,
p_stream->p_cfg = p_cfg;
p_stream->p_next = p_next;
p_stream->pf_flush = NULL;
- p_stream->pf_control = NULL;
+ p_stream->pf_control = sout_DefaultControl;
p_stream->pace_nocontrol = false;
p_stream->p_sys = NULL;
--
2.11.0
More information about the vlc-devel
mailing list