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

stream: add explicit controls for titles and seekpoints

parent 766ba5cc
......@@ -109,8 +109,13 @@ enum stream_query_e
STREAM_UPDATE_SIZE,
/* */
STREAM_GET_TITLE_INFO = 0x102, /**< arg1=input_title_t*** arg2=int* res=can fail */
STREAM_RESERVED_FOR_GET_META_DO_NOT_USE,
STREAM_GET_CONTENT_TYPE, /**< arg1= char ** res=can fail */
STREAM_SET_PAUSE_STATE = 0x200, /**< arg1= bool res=can fail */
STREAM_SET_TITLE, /**< arg1= int res=can fail */
STREAM_SET_SEEKPOINT, /**< arg1= int res=can fail */
/* XXX only data read through stream_Read/Block will be recorded */
STREAM_SET_RECORD_STATE, /**< arg1=bool, arg2=const char *psz_ext (if arg1 is true) res=can fail */
......
......@@ -1920,7 +1920,7 @@ static bool Control( input_thread_t *p_input,
DEMUX_SET_TITLE, i_title );
else
stream_Control( p_input->p->input.p_stream,
STREAM_CONTROL_ACCESS, ACCESS_SET_TITLE, i_title );
STREAM_SET_TITLE, i_title );
input_SendEventTitle( p_input, i_title );
break;
}
......@@ -1978,8 +1978,7 @@ static bool Control( input_thread_t *p_input,
DEMUX_SET_SEEKPOINT, i_seekpoint );
else
stream_Control( p_input->p->input.p_stream,
STREAM_CONTROL_ACCESS,
ACCESS_SET_SEEKPOINT, i_seekpoint );
STREAM_SET_SEEKPOINT, i_seekpoint );
input_SendEventSeekpoint( p_input, i_title, i_seekpoint );
break;
}
......@@ -2433,15 +2432,6 @@ static int InputSourceInit( input_thread_t *p_input,
/* Get infos from access */
if( !p_input->b_preparsing )
{
in->b_title_demux = false;
if( access_Control( p_access, ACCESS_GET_TITLE_INFO,
&in->title, &in->i_title,
&in->i_title_offset, &in->i_seekpoint_offset ) )
{
TAB_INIT( in->i_title, in->title );
}
access_Control( p_access, ACCESS_GET_PTS_DELAY, &i_pts_delay );
}
......@@ -2532,6 +2522,12 @@ static int InputSourceInit( input_thread_t *p_input,
stream_Control( in->p_stream, STREAM_CAN_SEEK, &b );
var_SetBool( p_input, "can-seek", b );
in->b_title_demux = false;
if( stream_Control( in->p_stream, STREAM_GET_TITLE_INFO,
&in->title, &in->i_title, &in->i_title_offset,
&in->i_seekpoint_offset ) )
TAB_INIT( in->i_title, in->title );
}
in->p_demux = demux_New( p_input, p_input, psz_access, psz_demux,
......
......@@ -549,7 +549,6 @@ static int AStreamControl( stream_t *s, int i_query, va_list args )
access_t *p_access = p_sys->p_access;
uint64_t *pi_64, i_64;
int i_int;
switch( i_query )
{
......@@ -595,32 +594,43 @@ static int AStreamControl( stream_t *s, int i_query, va_list args )
case STREAM_CONTROL_ACCESS:
{
i_int = (int) va_arg( args, int );
int i_int = (int) va_arg( args, int );
if( i_int != ACCESS_SET_PRIVATE_ID_STATE &&
i_int != ACCESS_SET_PRIVATE_ID_CA &&
i_int != ACCESS_GET_PRIVATE_ID_STATE &&
i_int != ACCESS_SET_TITLE &&
i_int != ACCESS_SET_SEEKPOINT )
i_int != ACCESS_GET_PRIVATE_ID_STATE )
{
msg_Err( s, "Hey, what are you thinking ?"
"DON'T USE STREAM_CONTROL_ACCESS !!!" );
return VLC_EGENERIC;
}
int i_ret = access_vaControl( p_access, i_int, args );
if( i_int == ACCESS_SET_TITLE || i_int == ACCESS_SET_SEEKPOINT )
AStreamControlReset( s );
return i_ret;
return access_vaControl( p_access, i_int, args );
}
case STREAM_UPDATE_SIZE:
AStreamControlUpdate( s );
return VLC_SUCCESS;
case STREAM_GET_TITLE_INFO:
return access_vaControl( p_access, ACCESS_GET_TITLE_INFO, args );
case STREAM_GET_CONTENT_TYPE:
return access_vaControl( p_access, ACCESS_GET_CONTENT_TYPE, args );
case STREAM_SET_PAUSE_STATE:
return access_vaControl( p_access, ACCESS_SET_PAUSE_STATE, args );
case STREAM_SET_TITLE:
{
int ret = access_vaControl( p_access, ACCESS_SET_TITLE, args );
if( ret == VLC_SUCCESS )
AStreamControlReset( s );
return ret;
}
case STREAM_SET_SEEKPOINT:
{
int ret = access_vaControl( p_access, ACCESS_SET_SEEKPOINT, args );
if( ret == VLC_SUCCESS )
AStreamControlReset( s );
return ret;
}
case STREAM_SET_RECORD_STATE:
default:
......
......@@ -297,8 +297,11 @@ static int DStreamControl( stream_t *s, int i_query, va_list args )
}
case STREAM_CONTROL_ACCESS:
case STREAM_GET_TITLE_INFO:
case STREAM_GET_CONTENT_TYPE:
case STREAM_SET_PAUSE_STATE:
case STREAM_SET_TITLE:
case STREAM_SET_SEEKPOINT:
case STREAM_SET_RECORD_STATE:
return VLC_EGENERIC;
......
......@@ -122,7 +122,10 @@ static int Control( stream_t *s, int i_query, va_list args )
p_sys->i_pos = i_64;
break;
case STREAM_GET_TITLE_INFO:
case STREAM_GET_CONTENT_TYPE:
case STREAM_SET_TITLE:
case STREAM_SET_SEEKPOINT:
return VLC_EGENERIC;
case STREAM_SET_PAUSE_STATE:
......
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