[vlc-devel] [RFC PATCH 14/14] FIXUP: converts PTS in visualisation filters too
Thomas Guillem
thomas at gllm.fr
Fri Jun 29 18:25:57 CEST 2018
Quite ulgy (the void *audio part) but that's the idea, the decoder create a new
slave clock that is passed to the sub vout.
---
include/vlc_filter.h | 1 +
src/audio_output/aout_internal.h | 4 +++-
src/audio_output/filters.c | 3 ++-
src/clock/clock.c | 5 +++++
src/clock/clock.h | 3 +++
src/input/decoder.c | 23 +++++++++++++++++++++--
6 files changed, 35 insertions(+), 4 deletions(-)
diff --git a/include/vlc_filter.h b/include/vlc_filter.h
index 847dc76604..90b23bb356 100644
--- a/include/vlc_filter.h
+++ b/include/vlc_filter.h
@@ -54,6 +54,7 @@ typedef struct filter_owner_t
{
const struct filter_video_callbacks *video;
const struct filter_subpicture_callbacks *sub;
+ void *audio;
};
void *sys;
} filter_owner_t;
diff --git a/src/audio_output/aout_internal.h b/src/audio_output/aout_internal.h
index 42d0f1ff35..b94bda58ec 100644
--- a/src/audio_output/aout_internal.h
+++ b/src/audio_output/aout_internal.h
@@ -37,10 +37,12 @@ enum {
AOUT_RESAMPLING_DOWN
};
+typedef struct vlc_clock_t vlc_clock_t;
struct aout_request_vout
{
struct vout_thread_t *(*pf_request_vout)( void *, struct vout_thread_t *,
- const video_format_t *, bool );
+ vlc_clock_t **,
+ const video_format_t *, bool);
void *p_private;
};
diff --git a/src/audio_output/filters.c b/src/audio_output/filters.c
index a8c3df0296..228bb666e1 100644
--- a/src/audio_output/filters.c
+++ b/src/audio_output/filters.c
@@ -397,7 +397,8 @@ vout_thread_t *aout_filter_RequestVout (filter_t *filter, vout_thread_t *vout,
bool recycle = false;
free (visual);
- return req->pf_request_vout (req->p_private, vout, fmt, recycle);
+ return req->pf_request_vout (req->p_private, vout, &filter->owner.audio,
+ fmt, recycle);
}
static int AppendFilter(vlc_object_t *obj, const char *type, const char *name,
diff --git a/src/clock/clock.c b/src/clock/clock.c
index 55d163284d..5f0220b97a 100644
--- a/src/clock/clock.c
+++ b/src/clock/clock.c
@@ -552,6 +552,11 @@ vlc_clock_t * vlc_clock_NewSlave(vlc_clock_main_t * main_clock)
return clk;
}
+vlc_clock_t * vlc_clock_NewSlaveFromClock(vlc_clock_t * clock)
+{
+ return vlc_clock_NewSlave(clock->owner);
+}
+
void vlc_clock_SetMaster(vlc_clock_main_t * main_clock, vlc_clock_t * clk)
{
vlc_mutex_lock(&main_clock->lock);
diff --git a/src/clock/clock.h b/src/clock/clock.h
index ff55ed17fb..62b5063de6 100644
--- a/src/clock/clock.h
+++ b/src/clock/clock.h
@@ -69,6 +69,9 @@ vlc_clock_t * vlc_clock_NewMaster(vlc_clock_main_t * main);
*/
vlc_clock_t * vlc_clock_NewSlave(vlc_clock_main_t * main);
+
+vlc_clock_t * vlc_clock_NewSlaveFromClock(vlc_clock_t * clock);
+
/**
* This function free the resources allocated by vlc_clock_New
*/
diff --git a/src/input/decoder.c b/src/input/decoder.c
index 1601201fbb..78ff9dca51 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -282,17 +282,36 @@ static void DecoderUpdateFormatLocked( decoder_t *p_dec )
*****************************************************************************/
static vout_thread_t *aout_request_vout( void *p_private,
vout_thread_t *p_vout,
+ vlc_clock_t **outclock,
const video_format_t *p_fmt, bool b_recyle )
{
decoder_t *p_dec = p_private;
struct decoder_owner *p_owner = dec_get_owner( p_dec );
input_thread_t *p_input = p_owner->p_input;
+ vlc_clock_t *clock = NULL, *freeclock = NULL;
- p_vout = input_resource_RequestVout( p_owner->p_resource, p_vout, NULL, p_fmt, 1,
- b_recyle );
+ if( outclock )
+ {
+ if( !*outclock )
+ {
+ clock = *outclock = vlc_clock_NewSlaveFromClock( p_owner->p_clock );
+ if( !clock )
+ return NULL;
+ }
+ else
+ freeclock = *outclock;
+ }
+ p_vout = input_resource_RequestVout( p_owner->p_resource, p_vout, clock,
+ p_fmt, 1, b_recyle );
if( p_input != NULL )
input_SendEventVout( p_input );
+ if( !p_vout && clock )
+ vlc_clock_Delete( clock );
+
+ if( freeclock)
+ vlc_clock_Delete( freeclock );
+
return p_vout;
}
--
2.18.0
More information about the vlc-devel
mailing list