Commit d2cd2e5d authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

input: poll signal level through demux (refs #8456)

parent 4543c9c8
......@@ -138,6 +138,8 @@ enum demux_query_e
DEMUX_CAN_RECORD, /* arg1=bool* res=can fail(assume false) */
DEMUX_SET_RECORD_STATE, /* arg1=bool res=can fail */
DEMUX_GET_SIGNAL, /* arg1=double *pf_quality, arg2=double *pf_strength
res=can fail */
/* II. Specific access_demux queries */
/* PAUSE you are ensured that it is never called twice with the same state */
......
......@@ -206,7 +206,6 @@ static inline void vlc_input_attachment_Delete( input_attachment_t *a )
#define INPUT_UPDATE_TITLE 0x0010
#define INPUT_UPDATE_SEEKPOINT 0x0020
#define INPUT_UPDATE_META 0x0040
#define INPUT_UPDATE_SIGNAL 0x0080
#define INPUT_UPDATE_TITLE_LIST 0x0100
/**
......
......@@ -521,11 +521,6 @@ static block_t *Read (access_t *access)
block->i_buffer = val;
/* Fetch the signal levels every so often. Some devices do not like this
* to be requested too frequently, e.g. due to low bandwidth I²C bus. */
if ((sys->signal_poll++) == 0)
access->info.i_update |= INPUT_UPDATE_SIGNAL;
return block;
}
......@@ -555,6 +550,11 @@ static int Control (access_t *access, int query, va_list args)
break;
case ACCESS_GET_SIGNAL:
/* Fetch the signal levels only every so often to avoid stressing
* the device bus. */
if ((sys->signal_poll++))
return VLC_EGENERIC;
*va_arg (args, double *) = dvb_get_snr (dev);
*va_arg (args, double *) = dvb_get_signal_strength (dev);
return VLC_SUCCESS;
......
......@@ -1202,8 +1202,9 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
p_sys->b_start_record = b_bool;
return VLC_SUCCESS;
case DEMUX_GET_FPS:
case DEMUX_SET_TIME:
case DEMUX_GET_SIGNAL:
return stream_Control( p_demux->s, STREAM_GET_SIGNAL, args );
default:
return VLC_EGENERIC;
}
......
......@@ -2212,6 +2212,13 @@ static void UpdateGenericFromDemux( input_thread_t *p_input )
}
p_demux->info.i_update &= ~INPUT_UPDATE_META;
}
{
double quality;
double strength;
if( !demux_Control( p_demux, DEMUX_GET_SIGNAL, &quality, &strength ) )
input_SendEventSignal( p_input, quality, strength );
}
}
static void UpdateTitleListfromDemux( input_thread_t *p_input )
......@@ -2284,18 +2291,6 @@ static void UpdateGenericFromAccess( input_thread_t *p_input )
}
p_access->info.i_update &= ~INPUT_UPDATE_META;
}
if( p_access->info.i_update & INPUT_UPDATE_SIGNAL )
{
double f_quality;
double f_strength;
if( stream_Control( p_stream, STREAM_GET_SIGNAL, &f_quality, &f_strength ) )
f_quality = f_strength = -1;
input_SendEventSignal( p_input, f_quality, f_strength );
p_access->info.i_update &= ~INPUT_UPDATE_SIGNAL;
}
}
/*****************************************************************************
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment