Code: Select all
// in my module's Open function:
var_AddCallback( p_input, "time", TimeChangeCallback, NULL );
var_AddCallback( p_input, "position", PositionChangeCallback, NULL );
// ...
// The "time" change callback
int TimeChangeCallback( vlc_object_t *p_this, const char *psz_var, vlc_value_t oldval, vlc_value_t newval, void *p_data )
{
MyRoutine(newval.i_int);
}
// The "position" change callback
int PositionChangeCallback( vlc_object_t *p_this, const char *psz_var, vlc_value_t oldval, vlc_value_t newval, void *p_data )
{
input_thread_t * p_input;
// ... p_input gets set ...
mtime_t new_time = newval.f_float * var_GetTime( p_input, "length" );
MyRoutine(new_time);
}
void MyRoutine(mtime_t time)
{
input_thread_t * p_input;
// ... p_input gets set ...
if (time < 1000000000L)
var_SetTime( p_input, "time", 2000000000L ); // !!! This line triggers TimeChangeCallback
}
I imagined that I might solve the problem by acquiring a mutex lock on my module (even though there appears to be no danger of race conditions), but it makes no difference: the programme freezes just the same.
Often freezes are caused by infinite loops, but it doesn't appear to me to be the problem because I added a call to msg_Info() at the start of my callback, and the message only gets outputted once, no more.
Any idea what I should look for?