mirror of
https://code.videolan.org/videolan/vlc
synced 2024-10-03 01:31:53 +02:00
demux: implement DEMUX_CAN_SEEK control
This commit is contained in:
parent
567822715f
commit
f208b6516d
@ -278,6 +278,9 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
|
|||||||
|
|
||||||
switch( i_query )
|
switch( i_query )
|
||||||
{
|
{
|
||||||
|
case DEMUX_CAN_SEEK:
|
||||||
|
return stream_vaControl( p_demux->s, i_query, args );
|
||||||
|
|
||||||
case DEMUX_GET_POSITION:
|
case DEMUX_GET_POSITION:
|
||||||
{
|
{
|
||||||
int64_t i_start = p_sys->i_ssnd_start;
|
int64_t i_start = p_sys->i_ssnd_start;
|
||||||
|
@ -900,6 +900,10 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
|
|||||||
|
|
||||||
switch( i_query )
|
switch( i_query )
|
||||||
{
|
{
|
||||||
|
case DEMUX_CAN_SEEK:
|
||||||
|
*va_arg( args, bool * ) = true;
|
||||||
|
return VLC_SUCCESS;
|
||||||
|
|
||||||
case DEMUX_GET_POSITION:
|
case DEMUX_GET_POSITION:
|
||||||
pf = (double*) va_arg( args, double* ); *pf = 0.0;
|
pf = (double*) va_arg( args, double* ); *pf = 0.0;
|
||||||
i64 = stream_Size( p_demux->s );
|
i64 = stream_Size( p_demux->s );
|
||||||
|
@ -1595,6 +1595,10 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
|
|||||||
|
|
||||||
switch( i_query )
|
switch( i_query )
|
||||||
{
|
{
|
||||||
|
case DEMUX_CAN_SEEK:
|
||||||
|
*va_arg( args, bool * ) = p_sys->b_seekable;
|
||||||
|
return VLC_SUCCESS;
|
||||||
|
|
||||||
case DEMUX_GET_POSITION:
|
case DEMUX_GET_POSITION:
|
||||||
pf = (double*)va_arg( args, double * );
|
pf = (double*)va_arg( args, double * );
|
||||||
*pf = ControlGetPosition( p_demux );
|
*pf = ControlGetPosition( p_demux );
|
||||||
|
@ -1007,6 +1007,10 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
|
|||||||
|
|
||||||
switch( i_query )
|
switch( i_query )
|
||||||
{
|
{
|
||||||
|
case DEMUX_CAN_SEEK:
|
||||||
|
*va_arg( args, bool * ) = true;
|
||||||
|
return VLC_SUCCESS;
|
||||||
|
|
||||||
case DEMUX_GET_LENGTH:
|
case DEMUX_GET_LENGTH:
|
||||||
pi64 = ( int64_t* )va_arg( args, int64_t * );
|
pi64 = ( int64_t* )va_arg( args, int64_t * );
|
||||||
*pi64 = CLOCK_FREQ * ( i_num_samples / p_sys->fmt.audio.i_rate );
|
*pi64 = CLOCK_FREQ * ( i_num_samples / p_sys->fmt.audio.i_rate );
|
||||||
|
@ -240,6 +240,10 @@ static int Control (demux_t *demux, int query, va_list args)
|
|||||||
|
|
||||||
switch (query)
|
switch (query)
|
||||||
{
|
{
|
||||||
|
case DEMUX_CAN_SEEK:
|
||||||
|
*va_arg (args, bool *) = true;
|
||||||
|
return VLC_SUCCESS;
|
||||||
|
|
||||||
case DEMUX_GET_POSITION:
|
case DEMUX_GET_POSITION:
|
||||||
{
|
{
|
||||||
double *pos = va_arg (args, double *);
|
double *pos = va_arg (args, double *);
|
||||||
|
@ -220,6 +220,9 @@ static int Control(demux_t *demux, int query, va_list args)
|
|||||||
demux_sys_t *sys = demux->p_sys;
|
demux_sys_t *sys = demux->p_sys;
|
||||||
|
|
||||||
switch (query) {
|
switch (query) {
|
||||||
|
case DEMUX_CAN_SEEK:
|
||||||
|
*va_arg(args, bool *) = sys->duration >= 0 && !sys->is_realtime;
|
||||||
|
return VLC_SUCCESS;
|
||||||
case DEMUX_GET_POSITION: {
|
case DEMUX_GET_POSITION: {
|
||||||
double *position = va_arg(args, double *);
|
double *position = va_arg(args, double *);
|
||||||
if (sys->duration > 0)
|
if (sys->duration > 0)
|
||||||
|
@ -295,6 +295,9 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
|
|||||||
|
|
||||||
switch( i_query )
|
switch( i_query )
|
||||||
{
|
{
|
||||||
|
case DEMUX_CAN_SEEK:
|
||||||
|
return stream_vaControl( p_demux->s, i_query, args );
|
||||||
|
|
||||||
case DEMUX_GET_ATTACHMENTS:
|
case DEMUX_GET_ATTACHMENTS:
|
||||||
ppp_attach = (input_attachment_t***)va_arg( args, input_attachment_t*** );
|
ppp_attach = (input_attachment_t***)va_arg( args, input_attachment_t*** );
|
||||||
pi_int = (int*)va_arg( args, int * );
|
pi_int = (int*)va_arg( args, int * );
|
||||||
|
@ -304,6 +304,10 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
|
|||||||
|
|
||||||
switch( i_query )
|
switch( i_query )
|
||||||
{
|
{
|
||||||
|
case DEMUX_CAN_SEEK:
|
||||||
|
*va_arg( args, bool * ) = true;
|
||||||
|
return VLC_SUCCESS;
|
||||||
|
|
||||||
case DEMUX_GET_POSITION:
|
case DEMUX_GET_POSITION:
|
||||||
pf = (double*) va_arg( args, double* );
|
pf = (double*) va_arg( args, double* );
|
||||||
if( p_sys->i_length > 0 )
|
if( p_sys->i_length > 0 )
|
||||||
|
@ -1431,6 +1431,10 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
|
|||||||
|
|
||||||
switch( i_query )
|
switch( i_query )
|
||||||
{
|
{
|
||||||
|
case DEMUX_CAN_SEEK:
|
||||||
|
*va_arg( args, bool * ) = p_sys->b_seekable;
|
||||||
|
return VLC_SUCCESS;
|
||||||
|
|
||||||
case DEMUX_GET_POSITION:
|
case DEMUX_GET_POSITION:
|
||||||
pf = (double*)va_arg( args, double * );
|
pf = (double*)va_arg( args, double * );
|
||||||
if( p_sys->i_overall_duration > 0 )
|
if( p_sys->i_overall_duration > 0 )
|
||||||
|
@ -317,6 +317,9 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
|
|||||||
|
|
||||||
switch( i_query )
|
switch( i_query )
|
||||||
{
|
{
|
||||||
|
case DEMUX_CAN_SEEK:
|
||||||
|
return stream_vaControl( p_demux->s, i_query, args );
|
||||||
|
|
||||||
case DEMUX_HAS_UNSUPPORTED_META:
|
case DEMUX_HAS_UNSUPPORTED_META:
|
||||||
pb_bool = (bool*)va_arg( args, bool* );
|
pb_bool = (bool*)va_arg( args, bool* );
|
||||||
*pb_bool = true;
|
*pb_bool = true;
|
||||||
|
@ -462,6 +462,10 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
|
|||||||
|
|
||||||
switch( i_query )
|
switch( i_query )
|
||||||
{
|
{
|
||||||
|
case DEMUX_CAN_SEEK:
|
||||||
|
*va_arg( args, bool * ) = p_sys->b_seekable;
|
||||||
|
return VLC_SUCCESS;
|
||||||
|
|
||||||
case DEMUX_GET_POSITION:
|
case DEMUX_GET_POSITION:
|
||||||
pf = (double*) va_arg( args, double* );
|
pf = (double*) va_arg( args, double* );
|
||||||
i64 = stream_Size( p_demux->s );
|
i64 = stream_Size( p_demux->s );
|
||||||
|
@ -1469,6 +1469,10 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
|
|||||||
|
|
||||||
switch( i_query )
|
switch( i_query )
|
||||||
{
|
{
|
||||||
|
case DEMUX_CAN_SEEK:
|
||||||
|
*va_arg( args, bool * ) = p_sys->b_canseek;
|
||||||
|
return VLC_SUCCESS;
|
||||||
|
|
||||||
case DEMUX_GET_POSITION:
|
case DEMUX_GET_POSITION:
|
||||||
pf = (double*) va_arg( args, double* );
|
pf = (double*) va_arg( args, double* );
|
||||||
|
|
||||||
|
@ -330,6 +330,9 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
|
|||||||
|
|
||||||
switch( i_query )
|
switch( i_query )
|
||||||
{
|
{
|
||||||
|
case DEMUX_CAN_SEEK:
|
||||||
|
return stream_vaControl( p_demux->s, i_query, args );
|
||||||
|
|
||||||
case DEMUX_GET_POSITION:
|
case DEMUX_GET_POSITION:
|
||||||
pf = (double*) va_arg( args, double* );
|
pf = (double*) va_arg( args, double* );
|
||||||
i64 = stream_Size( p_demux->s );
|
i64 = stream_Size( p_demux->s );
|
||||||
|
@ -450,6 +450,9 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
|
|||||||
|
|
||||||
switch( i_query )
|
switch( i_query )
|
||||||
{
|
{
|
||||||
|
case DEMUX_CAN_SEEK:
|
||||||
|
*va_arg( args, bool * ) = p_sys->b_seekable;
|
||||||
|
return VLC_SUCCESS;
|
||||||
|
|
||||||
case DEMUX_GET_POSITION:
|
case DEMUX_GET_POSITION:
|
||||||
pf = (double*)va_arg( args, double * );
|
pf = (double*)va_arg( args, double * );
|
||||||
|
@ -746,6 +746,9 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
|
|||||||
|
|
||||||
switch( i_query )
|
switch( i_query )
|
||||||
{
|
{
|
||||||
|
case DEMUX_CAN_SEEK:
|
||||||
|
return stream_vaControl( p_demux->s, i_query, args );
|
||||||
|
|
||||||
case DEMUX_GET_META:
|
case DEMUX_GET_META:
|
||||||
p_meta = (vlc_meta_t *)va_arg( args, vlc_meta_t* );
|
p_meta = (vlc_meta_t *)va_arg( args, vlc_meta_t* );
|
||||||
if( p_sys->p_meta )
|
if( p_sys->p_meta )
|
||||||
|
@ -290,6 +290,9 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
|
|||||||
int64_t i64;
|
int64_t i64;
|
||||||
switch( i_query )
|
switch( i_query )
|
||||||
{
|
{
|
||||||
|
case DEMUX_CAN_SEEK:
|
||||||
|
return stream_vaControl( p_demux->s, i_query, args );
|
||||||
|
|
||||||
case DEMUX_GET_POSITION:
|
case DEMUX_GET_POSITION:
|
||||||
if( ( i64 = stream_Size( p_demux->s ) ) > 0 )
|
if( ( i64 = stream_Size( p_demux->s ) ) > 0 )
|
||||||
{
|
{
|
||||||
|
@ -371,6 +371,22 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
|
|||||||
|
|
||||||
switch( i_query )
|
switch( i_query )
|
||||||
{
|
{
|
||||||
|
case DEMUX_CAN_SEEK:
|
||||||
|
{
|
||||||
|
bool *b = va_arg( args, bool * );
|
||||||
|
|
||||||
|
if( stream_Size( p_demux->s ) == 0 )
|
||||||
|
*b = true; /* FIXME: kludge for Real-dialectal RTSP */
|
||||||
|
else
|
||||||
|
if( p_sys->p_index == NULL )
|
||||||
|
*b = false;
|
||||||
|
else
|
||||||
|
if( stream_Control( p_demux->s, STREAM_CAN_SEEK, &b ) )
|
||||||
|
*b = false;
|
||||||
|
|
||||||
|
return VLC_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
case DEMUX_GET_POSITION:
|
case DEMUX_GET_POSITION:
|
||||||
pf = (double*) va_arg( args, double* );
|
pf = (double*) va_arg( args, double* );
|
||||||
|
|
||||||
|
@ -497,6 +497,9 @@ static int Control (demux_t *demux, int i_query, va_list args)
|
|||||||
|
|
||||||
switch (i_query)
|
switch (i_query)
|
||||||
{
|
{
|
||||||
|
case DEMUX_CAN_SEEK:
|
||||||
|
*va_arg (args, bool *) = true;
|
||||||
|
break;
|
||||||
case DEMUX_GET_POSITION:
|
case DEMUX_GET_POSITION:
|
||||||
if (!sys->duration)
|
if (!sys->duration)
|
||||||
return VLC_EGENERIC;
|
return VLC_EGENERIC;
|
||||||
|
@ -96,6 +96,8 @@ static int Control(demux_t *demux, int query, va_list args)
|
|||||||
{
|
{
|
||||||
demux_sys_t *sys = demux->p_sys;
|
demux_sys_t *sys = demux->p_sys;
|
||||||
switch(query) {
|
switch(query) {
|
||||||
|
case DEMUX_CAN_SEEK:
|
||||||
|
return stream_vaControl(demux->s, query, args);
|
||||||
case DEMUX_GET_LENGTH: {
|
case DEMUX_GET_LENGTH: {
|
||||||
int64_t *l = va_arg(args, int64_t *);
|
int64_t *l = va_arg(args, int64_t *);
|
||||||
*l = sys->count > 0 ? sys->index[sys->count-1].stop : 0;
|
*l = sys->count > 0 ? sys->index[sys->count-1].stop : 0;
|
||||||
|
@ -619,6 +619,10 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
|
|||||||
|
|
||||||
switch( i_query )
|
switch( i_query )
|
||||||
{
|
{
|
||||||
|
case DEMUX_CAN_SEEK:
|
||||||
|
*va_arg( args, bool * ) = true;
|
||||||
|
return VLC_SUCCESS;
|
||||||
|
|
||||||
case DEMUX_GET_LENGTH:
|
case DEMUX_GET_LENGTH:
|
||||||
pi64 = (int64_t*)va_arg( args, int64_t * );
|
pi64 = (int64_t*)va_arg( args, int64_t * );
|
||||||
*pi64 = p_sys->i_length;
|
*pi64 = p_sys->i_length;
|
||||||
|
@ -221,6 +221,9 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
|
|||||||
|
|
||||||
switch( i_query )
|
switch( i_query )
|
||||||
{
|
{
|
||||||
|
case DEMUX_CAN_SEEK:
|
||||||
|
return stream_vaControl( p_demux->s, i_query, args );
|
||||||
|
|
||||||
case DEMUX_GET_POSITION:
|
case DEMUX_GET_POSITION:
|
||||||
pf = (double*) va_arg( args, double* );
|
pf = (double*) va_arg( args, double* );
|
||||||
i64 = stream_Size( p_demux->s ) - p_sys->i_start;
|
i64 = stream_Size( p_demux->s ) - p_sys->i_start;
|
||||||
|
@ -77,6 +77,9 @@ static int Control( demux_t* p_demux, int i_query, va_list args )
|
|||||||
|
|
||||||
switch( i_query )
|
switch( i_query )
|
||||||
{
|
{
|
||||||
|
case DEMUX_CAN_SEEK:
|
||||||
|
*va_arg( args, bool * ) = true;
|
||||||
|
return VLC_SUCCESS;
|
||||||
case DEMUX_GET_TIME:
|
case DEMUX_GET_TIME:
|
||||||
pi64 = (int64_t*)va_arg( args, int64_t * );
|
pi64 = (int64_t*)va_arg( args, int64_t * );
|
||||||
if( p_sys->i_subtitle < p_sys->i_subtitles )
|
if( p_sys->i_subtitle < p_sys->i_subtitles )
|
||||||
|
@ -505,6 +505,10 @@ static int Control(demux_t *p_demux, int i_query, va_list args)
|
|||||||
/*msg_Info(p_demux, "control cmd %d", i_query);*/
|
/*msg_Info(p_demux, "control cmd %d", i_query);*/
|
||||||
switch( i_query )
|
switch( i_query )
|
||||||
{
|
{
|
||||||
|
case DEMUX_CAN_SEEK:
|
||||||
|
*va_arg( args, bool * ) = p_sys->b_seekable;
|
||||||
|
return VLC_SUCCESS;
|
||||||
|
|
||||||
case DEMUX_GET_POSITION:
|
case DEMUX_GET_POSITION:
|
||||||
/* arg is 0.0 - 1.0 percent of overall file position */
|
/* arg is 0.0 - 1.0 percent of overall file position */
|
||||||
if( ( i64 = p_sys->i_stream_size ) > 0 )
|
if( ( i64 = p_sys->i_stream_size ) > 0 )
|
||||||
|
@ -241,6 +241,10 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
|
|||||||
|
|
||||||
switch( i_query )
|
switch( i_query )
|
||||||
{
|
{
|
||||||
|
case DEMUX_CAN_SEEK:
|
||||||
|
*va_arg( args, bool * ) = true;
|
||||||
|
return VLC_SUCCESS;
|
||||||
|
|
||||||
case DEMUX_GET_LENGTH:
|
case DEMUX_GET_LENGTH:
|
||||||
pi64 = (int64_t*)va_arg( args, int64_t * );
|
pi64 = (int64_t*)va_arg( args, int64_t * );
|
||||||
*pi64 = (int64_t) p_sys->i_length;
|
*pi64 = (int64_t) p_sys->i_length;
|
||||||
|
Loading…
Reference in New Issue
Block a user