[vlc-commits] [Git][videolan/vlc][master] 2 commits: stream_output: refactor main clock behind wrapper
Steve Lhomme (@robUx4)
gitlab at videolan.org
Mon Aug 5 20:24:46 UTC 2024
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
5664a753 by Alexandre Janniaux at 2024-08-05T19:52:07+00:00
stream_output: refactor main clock behind wrapper
Move the sout_CreateMainClock resulting clock behind a dedicated
wrapper, allowing to:
1) Prevent using the API against "main clocks" that are not created
from the stream output.
2) Embed more metadata and other objects for the future. In particular,
an "input-like" clock will be needed to specify start time and
transmit discontinuities to the output clocks.
- - - - -
a1ef9c24 by Alexandre Janniaux at 2024-08-05T19:52:07+00:00
stream_output: introduce input clock for sout
The input vlc_clock is used to be able to provide the future
vlc_clock_Start() operation in the stream output pipeline also.
- - - - -
3 changed files:
- include/vlc_sout.h
- modules/stream_out/display.c
- src/stream_output/stream_output.c
Changes:
=====================================
include/vlc_sout.h
=====================================
@@ -390,10 +390,11 @@ VLC_API void sout_StreamFlush(sout_stream_t *s, void *id);
*/
VLC_API void sout_StreamSetPCR(sout_stream_t *, vlc_tick_t pcr);
-VLC_API vlc_clock_main_t *sout_ClockMainCreate(sout_stream_t *) VLC_USED;
-VLC_API void sout_ClockMainDelete(vlc_clock_main_t *);
-VLC_API void sout_ClockMainSetFirstPcr(vlc_clock_main_t *, vlc_tick_t pcr);
-VLC_API vlc_clock_t *sout_ClockCreate(vlc_clock_main_t *, const es_format_t *) VLC_USED;
+struct vlc_sout_clock_bus;
+VLC_API struct vlc_sout_clock_bus *sout_ClockMainCreate(sout_stream_t *) VLC_USED;
+VLC_API void sout_ClockMainDelete(struct vlc_sout_clock_bus *);
+VLC_API void sout_ClockMainSetFirstPcr(struct vlc_sout_clock_bus *, vlc_tick_t pcr);
+VLC_API vlc_clock_t *sout_ClockCreate(struct vlc_sout_clock_bus *, const es_format_t *) VLC_USED;
VLC_API void sout_ClockDelete(vlc_clock_t *);
=====================================
modules/stream_out/display.c
=====================================
@@ -83,7 +83,7 @@ typedef struct
vlc_tick_t i_delay;
input_resource_t *p_resource;
- vlc_clock_main_t *main_clock;
+ struct vlc_sout_clock_bus *main_clock;
bool first_pcr_signaled;
bool error;
} sout_stream_sys_t;
=====================================
src/stream_output/stream_output.c
=====================================
@@ -683,6 +683,13 @@ struct sout_stream_private {
vlc_mutex_t lock;
};
+struct vlc_sout_clock_bus {
+ struct {
+ vlc_clock_main_t *bus;
+ vlc_clock_t *input;
+ } clocks;
+};
+
#define sout_stream_priv(s) \
container_of(s, struct sout_stream_private, stream)
@@ -779,33 +786,55 @@ static void sout_StreamDelete( sout_stream_t *p_stream )
vlc_object_delete(p_stream);
}
-vlc_clock_main_t *sout_ClockMainCreate( sout_stream_t *p_stream )
+struct vlc_sout_clock_bus *sout_ClockMainCreate(sout_stream_t *p_stream)
{
struct vlc_tracer *tracer = vlc_object_get_tracer( &p_stream->obj );
- return vlc_clock_main_New( p_stream->obj.logger, tracer );
+
+ struct vlc_sout_clock_bus *bus = malloc(sizeof *bus);
+ if (bus == NULL)
+ return NULL;
+
+ bus->clocks.bus = vlc_clock_main_New(p_stream->obj.logger, tracer);
+ if (bus->clocks.bus == NULL)
+ goto error_bus;
+
+ vlc_clock_main_Lock(bus->clocks.bus);
+ bus->clocks.input = vlc_clock_main_CreateInputSlave(bus->clocks.bus);
+ vlc_clock_main_Unlock(bus->clocks.bus);
+ if (bus->clocks.input == NULL)
+ goto error_input;
+
+ return bus;
+
+error_input:
+ vlc_clock_main_Delete(bus->clocks.bus);
+error_bus:
+ free(bus);
+ return NULL;
}
-void sout_ClockMainDelete( vlc_clock_main_t *main_clock )
+void sout_ClockMainDelete(struct vlc_sout_clock_bus *bus)
{
- vlc_clock_main_Delete( main_clock );
+ vlc_clock_Delete(bus->clocks.input);
+ vlc_clock_main_Delete(bus->clocks.bus);
}
-void sout_ClockMainSetFirstPcr( vlc_clock_main_t *main_clock, vlc_tick_t pcr )
+void sout_ClockMainSetFirstPcr(struct vlc_sout_clock_bus *bus, vlc_tick_t pcr )
{
- vlc_clock_main_Lock( main_clock );
- vlc_clock_main_Reset( main_clock );
- vlc_clock_main_SetFirstPcr( main_clock, vlc_tick_now(), pcr );
- vlc_clock_main_Unlock( main_clock );
+ vlc_clock_main_Lock(bus->clocks.bus);
+ vlc_clock_main_Reset(bus->clocks.bus);
+ vlc_clock_main_SetFirstPcr(bus->clocks.bus, vlc_tick_now(), pcr);
+ vlc_clock_main_Unlock(bus->clocks.bus);
}
-vlc_clock_t *sout_ClockCreate( vlc_clock_main_t *main_clock,
- const es_format_t *fmt )
+vlc_clock_t *sout_ClockCreate(struct vlc_sout_clock_bus *bus,
+ const es_format_t *fmt)
{
- vlc_clock_main_Lock( main_clock );
+ vlc_clock_main_Lock(bus->clocks.bus);
vlc_clock_t *clock =
- vlc_clock_main_CreateSlave( main_clock, NULL, fmt->i_cat,
- NULL, NULL );
- vlc_clock_main_Unlock( main_clock );
+ vlc_clock_main_CreateSlave(bus->clocks.bus, NULL, fmt->i_cat,
+ NULL, NULL);
+ vlc_clock_main_Unlock(bus->clocks.bus);
return clock;
}
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/0e8769eea4d8c176e9d09a504a35c238b4b5159e...a1ef9c244258be256a671cc77b2a5c9a87422b67
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/0e8769eea4d8c176e9d09a504a35c238b4b5159e...a1ef9c244258be256a671cc77b2a5c9a87422b67
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