[vlc-commits] [Git][videolan/vlc][master] 3 commits: sout: add `set_pcr` callback

Rémi Denis-Courmont (@Courmisch) gitlab at videolan.org
Thu Jul 7 20:35:32 UTC 2022



Rémi Denis-Courmont pushed to branch master at VideoLAN / VLC


Commits:
240cf3ca by Alaric Senat at 2022-07-07T20:18:50+00:00
sout: add `set_pcr` callback

This is the first step for the `SetPCR` implementation in stream output.
These callbacks will allow stream outputs to have precise information
about the stream time advancement.

This patchset only provides the basis for now, a correct implementation
for all stream filters will come in a separate merge request.

Refs #27050

Co-authored-by: Alexandre Janniaux <ajanni at videolabs.io>

- - - - -
b405dc1e by Alaric Senat at 2022-07-07T20:18:50+00:00
sout: add SetPCR API wrapper

- - - - -
ea8ffe90 by Alaric Senat at 2022-07-07T20:18:50+00:00
es_out: implement PCR forwarding to sout

Now that the input_decoder thread has been disabled for the stream
output case, forwarding PCR events to the stream output is quite
straightforward as everything is now treated synchronously.

Refs !1847 #26870

- - - - -


25 changed files:

- include/vlc_sout.h
- modules/stream_out/autodel.c
- modules/stream_out/bridge.c
- modules/stream_out/chromaprint.c
- modules/stream_out/chromecast/cast.cpp
- modules/stream_out/cycle.c
- modules/stream_out/delay.c
- modules/stream_out/display.c
- modules/stream_out/dlna/dlna.cpp
- modules/stream_out/dummy.c
- modules/stream_out/duplicate.c
- modules/stream_out/es.c
- modules/stream_out/gather.c
- modules/stream_out/mosaic_bridge.c
- modules/stream_out/record.c
- modules/stream_out/rtp.c
- modules/stream_out/setid.c
- modules/stream_out/smem.c
- modules/stream_out/standard.c
- modules/stream_out/stats.c
- modules/stream_out/transcode/transcode.c
- modules/stream_out/udp.c
- src/input/es_out.c
- src/libvlccore.sym
- src/stream_output/stream_output.c


Changes:

=====================================
include/vlc_sout.h
=====================================
@@ -178,6 +178,7 @@ struct sout_stream_operations {
     int (*send)(sout_stream_t *, void *, block_t *);
     int (*control)( sout_stream_t *, int, va_list );
     void (*flush)( sout_stream_t *, void *);
+    void (*set_pcr)(sout_stream_t *, vlc_tick_t);
 };
 
 struct sout_stream_t
@@ -200,6 +201,7 @@ VLC_API void *sout_StreamIdAdd(sout_stream_t *s, const es_format_t *fmt);
 VLC_API void sout_StreamIdDel(sout_stream_t *s, void *id);
 VLC_API int sout_StreamIdSend( sout_stream_t *s, void *id, block_t *b);
 VLC_API void sout_StreamFlush(sout_stream_t *s, void *id);
+VLC_API void sout_StreamSetPCR(sout_stream_t *s, vlc_tick_t pcr);
 VLC_API int sout_StreamControlVa(sout_stream_t *s, int i_query, va_list args);
 
 static inline int sout_StreamControl( sout_stream_t *s, int i_query, ... )


=====================================
modules/stream_out/autodel.c
=====================================
@@ -113,7 +113,7 @@ static int Send( sout_stream_t *p_stream, void *_p_es, block_t *p_buffer )
 }
 
 static const struct sout_stream_operations ops = {
-    Add, Del, Send, NULL, NULL,
+    Add, Del, Send, NULL, NULL, NULL,
 };
 
 static int Open( vlc_object_t *p_this )


=====================================
modules/stream_out/bridge.c
=====================================
@@ -302,7 +302,7 @@ static int ControlCommon(sout_stream_t *stream, int query, va_list args)
 }
 
 static const struct sout_stream_operations ops_out = {
-    AddOut, DelOut, SendOut, ControlCommon, NULL,
+    AddOut, DelOut, SendOut, ControlCommon, NULL, NULL,
 };
 
 /*****************************************************************************
@@ -628,7 +628,7 @@ static int SendIn( sout_stream_t *p_stream, void *_id, block_t *p_buffer )
 }
 
 static const struct sout_stream_operations ops_in = {
-    AddIn, DelIn, SendIn, ControlCommon, NULL,
+    AddIn, DelIn, SendIn, ControlCommon, NULL, NULL,
 };
 
 /*****************************************************************************


=====================================
modules/stream_out/chromaprint.c
=====================================
@@ -88,7 +88,7 @@ struct sout_stream_id_sys_t
 #define BYTESPERSAMPLE 2
 
 static const struct sout_stream_operations ops = {
-    Add, Del, Send, NULL, NULL,
+    Add, Del, Send, NULL, NULL, NULL,
 };
 
 /*****************************************************************************


=====================================
modules/stream_out/chromecast/cast.cpp
=====================================
@@ -313,7 +313,7 @@ static void ProxyFlush(sout_stream_t *p_stream, void *id)
 }
 
 static const struct sout_stream_operations proxy_ops = {
-    ProxyAdd, ProxyDel, ProxySend, NULL, ProxyFlush,
+    ProxyAdd, ProxyDel, ProxySend, nullptr, ProxyFlush, nullptr,
 };
 
 static int ProxyOpen(vlc_object_t *p_this)
@@ -1223,7 +1223,7 @@ static void on_input_event_cb(void *data, enum cc_input_event event, union cc_in
 }
 
 static const struct sout_stream_operations ops = {
-    Add, Del, Send, NULL, Flush,
+    Add, Del, Send, nullptr, Flush, nullptr
 };
 
 /*****************************************************************************


=====================================
modules/stream_out/cycle.c
=====================================
@@ -219,7 +219,7 @@ static vlc_tick_t ParseTime(const char *str)
 }
 
 static const struct sout_stream_operations ops = {
-    Add, Del, Send, NULL, NULL,
+    Add, Del, Send, NULL, NULL, NULL,
 };
 
 static int Open(vlc_object_t *obj)


=====================================
modules/stream_out/delay.c
=====================================
@@ -87,7 +87,7 @@ static int Send( sout_stream_t *p_stream, void *id, block_t *p_buffer )
 }
 
 static const struct sout_stream_operations ops = {
-    Add, Del, Send, NULL, NULL,
+    Add, Del, Send, NULL, NULL, NULL,
 };
 
 static const char *ppsz_sout_options[] = {


=====================================
modules/stream_out/display.c
=====================================
@@ -164,7 +164,7 @@ static int Control( sout_stream_t *p_stream, int i_query, va_list args )
 }
 
 static const struct sout_stream_operations ops = {
-    Add, Del, Send, Control, NULL,
+    Add, Del, Send, Control, NULL, NULL
 };
 
 /*****************************************************************************


=====================================
modules/stream_out/dlna/dlna.cpp
=====================================
@@ -849,7 +849,7 @@ static void Del(sout_stream_t *p_stream, void *_id)
 }
 
 static const struct sout_stream_operations ops = {
-    Add, Del, Send, NULL, Flush,
+    Add, Del, Send, NULL, Flush, NULL,
 };
 
 int OpenSout( vlc_object_t *p_this )


=====================================
modules/stream_out/dummy.c
=====================================
@@ -53,7 +53,7 @@ static int Send( sout_stream_t *p_stream, void *id, block_t *p_buffer )
 }
 
 static const struct sout_stream_operations ops = {
-    Add, Del, Send, NULL, NULL,
+    Add, Del, Send, NULL, NULL, NULL,
 };
 
 /*****************************************************************************


=====================================
modules/stream_out/duplicate.c
=====================================
@@ -105,7 +105,7 @@ static int Control( sout_stream_t *p_stream, int i_query, va_list args )
 }
 
 static const struct sout_stream_operations ops = {
-    Add, Del, Send, Control, NULL,
+    Add, Del, Send, Control, NULL, NULL,
 };
 
 /*****************************************************************************


=====================================
modules/stream_out/es.c
=====================================
@@ -264,7 +264,7 @@ static int Send( sout_stream_t *p_stream, void *_id, block_t *p_buffer )
 }
 
 static const struct sout_stream_operations ops = {
-    Add, Del, Send, NULL, NULL,
+    Add, Del, Send, NULL, NULL, NULL,
 };
 
 #define SOUT_CFG_PREFIX "sout-es-"


=====================================
modules/stream_out/gather.c
=====================================
@@ -70,7 +70,7 @@ typedef struct
 } sout_stream_sys_t;
 
 static const struct sout_stream_operations ops = {
-    Add, Del, Send, NULL, NULL,
+    Add, Del, Send, NULL, NULL, NULL,
 };
 
 /*****************************************************************************


=====================================
modules/stream_out/mosaic_bridge.c
=====================================
@@ -183,7 +183,7 @@ static int Control(sout_stream_t *stream, int query, va_list args)
 }
 
 static const struct sout_stream_operations ops = {
-    Add, Del, Send, Control, NULL,
+    Add, Del, Send, Control, NULL, NULL,
 };
 
 static const char *const ppsz_sout_options[] = {


=====================================
modules/stream_out/record.c
=====================================
@@ -114,7 +114,7 @@ static void OutputStart( sout_stream_t *p_stream );
 static void OutputSend( sout_stream_t *p_stream, sout_stream_id_sys_t *id, block_t * );
 
 static const struct sout_stream_operations ops = {
-    Add, Del, Send, NULL, NULL,
+    Add, Del, Send, NULL, NULL, NULL,
 };
 
 /*****************************************************************************


=====================================
modules/stream_out/rtp.c
=====================================
@@ -374,11 +374,11 @@ static int Control(sout_stream_t *stream, int query, va_list args)
 }
 
 static const struct sout_stream_operations stream_ops = {
-    Add, Del, Send, Control, NULL,
+    Add, Del, Send, Control, NULL, NULL,
 };
 
 static const struct sout_stream_operations mux_ops = {
-    MuxAdd, MuxDel, MuxSend, Control, NULL,
+    MuxAdd, MuxDel, MuxSend, Control, NULL, NULL,
 };
 
 /*****************************************************************************


=====================================
modules/stream_out/setid.c
=====================================
@@ -122,7 +122,7 @@ static int OpenCommon( vlc_object_t *p_this )
 }
 
 static const struct sout_stream_operations id_ops = {
-    AddId, Del, Send, NULL, NULL,
+    AddId, Del, Send, NULL, NULL, NULL,
 };
 
 static int OpenId( vlc_object_t *p_this )
@@ -147,7 +147,7 @@ static int OpenId( vlc_object_t *p_this )
 }
 
 static const struct sout_stream_operations lang_ops = {
-    AddLang, Del, Send, NULL, NULL,
+    AddLang, Del, Send, NULL, NULL, NULL,
 };
 
 static int OpenLang( vlc_object_t *p_this )


=====================================
modules/stream_out/smem.c
=====================================
@@ -206,7 +206,7 @@ static int Control(sout_stream_t *stream, int query, va_list args)
 }
 
 static const struct sout_stream_operations ops = {
-    Add, Del, Send, Control, NULL,
+    Add, Del, Send, Control, NULL, NULL,
 };
 
 /*****************************************************************************


=====================================
modules/stream_out/standard.c
=====================================
@@ -252,7 +252,7 @@ static int Control(sout_stream_t *stream, int query, va_list args)
 }
 
 static const struct sout_stream_operations ops = {
-    Add, Del, Send, Control, Flush,
+    Add, Del, Send, Control, Flush, NULL,
 };
 
 /*****************************************************************************


=====================================
modules/stream_out/stats.c
=====================================
@@ -205,7 +205,7 @@ static int OutputSend(sout_stream_t *stream, void *id, block_t *block)
 }
 
 static const struct sout_stream_operations output_ops = {
-    Add, Del, OutputSend, NULL, NULL,
+    Add, Del, OutputSend, NULL, NULL, NULL,
 };
 
 static int OutputOpen(vlc_object_t *obj)
@@ -251,7 +251,7 @@ static int FilterSend(sout_stream_t *stream, void *opaque, block_t *block)
 }
 
 static const struct sout_stream_operations filter_ops = {
-    FilterAdd, FilterDel, FilterSend, NULL, NULL,
+    FilterAdd, FilterDel, FilterSend, NULL, NULL, NULL,
 };
 
 static int FilterOpen(vlc_object_t *obj)


=====================================
modules/stream_out/transcode/transcode.c
=====================================
@@ -368,7 +368,7 @@ static int Control( sout_stream_t *p_stream, int i_query, va_list args )
 }
 
 static const struct sout_stream_operations ops = {
-    Add, Del, Send, Control, NULL,
+    Add, Del, Send, Control, NULL, NULL,
 };
 
 /*****************************************************************************


=====================================
modules/stream_out/udp.c
=====================================
@@ -206,7 +206,7 @@ static void Close(vlc_object_t *obj)
 }
 
 static const struct sout_stream_operations ops = {
-    Add, Del, Send, Control, Flush,
+    Add, Del, Send, Control, Flush, NULL
 };
 
 static const char *const chain_options[] = {


=====================================
src/input/es_out.c
=====================================
@@ -3394,6 +3394,11 @@ static int EsOutVaControlLocked( es_out_t *out, input_source_t *source,
         }
         input_thread_private_t *priv = input_priv(p_sys->p_input);
 
+        if ( priv->p_sout != NULL )
+        {
+            sout_StreamSetPCR( priv->p_sout, i_pcr );
+        }
+
         /* TODO do not use vlc_tick_now() but proper stream acquisition date */
         const bool b_low_delay = priv->b_low_delay;
         bool b_extra_buffering_allowed = !b_low_delay && EsOutIsExtraBufferingAllowed( out );


=====================================
src/libvlccore.sym
=====================================
@@ -356,6 +356,7 @@ sout_StreamIdAdd
 sout_StreamIdDel
 sout_StreamIdSend
 sout_StreamFlush
+sout_StreamSetPCR
 sout_StreamControlVa
 spu_Create
 spu_Destroy


=====================================
src/stream_output/stream_output.c
=====================================
@@ -728,6 +728,16 @@ void sout_StreamFlush(sout_stream_t *s, void *id)
     }
 }
 
+void sout_StreamSetPCR(sout_stream_t *s, vlc_tick_t pcr)
+{
+    if (s->ops->set_pcr != NULL)
+    {
+        sout_StreamLock(s);
+        s->ops->set_pcr(s, pcr);
+        sout_StreamUnlock(s);
+    }
+}
+
 int sout_StreamControlVa(sout_stream_t *s, int i_query, va_list args)
 {
     int val = VLC_EGENERIC;



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/4d9fdbbfe88b23ae2ede9ee5b9f9286d65c787fd...ea8ffe90af43501ce17ce582f4894cd0cb6edebb

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/4d9fdbbfe88b23ae2ede9ee5b9f9286d65c787fd...ea8ffe90af43501ce17ce582f4894cd0cb6edebb
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list