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

mpeg: implement title/seekpoint controls (refs #8455)

This is intended for VDR directories and Video CDs.
parent 15e2e50e
......@@ -172,6 +172,26 @@ enum demux_query_e
VLC_API int demux_vaControlHelper( stream_t *, int64_t i_start, int64_t i_end, int64_t i_bitrate, int i_align, int i_query, va_list args );
static inline void demux_UpdateTitleFromStream( demux_t *demux )
{
stream_t *s = demux->s;
unsigned title, seekpoint;
if( stream_Control( s, STREAM_GET_TITLE, &title ) == VLC_SUCCESS
&& title != (unsigned)demux->info.i_title )
{
demux->info.i_title = title;
demux->info.i_update = INPUT_UPDATE_TITLE;
}
if( stream_Control( s, STREAM_GET_SEEKPOINT, &seekpoint ) == VLC_SUCCESS
&& seekpoint != (unsigned)demux->info.i_seekpoint )
{
demux->info.i_seekpoint = seekpoint;
demux->info.i_update = INPUT_UPDATE_SEEKPOINT;
}
}
/*************************************************************************
* Miscellaneous helpers for demuxers
*************************************************************************/
......
......@@ -77,7 +77,7 @@ static inline seekpoint_t *vlc_seekpoint_Duplicate( const seekpoint_t *src )
/*****************************************************************************
* Title:
*****************************************************************************/
typedef struct
typedef struct input_title_t
{
char *psz_name;
......
......@@ -444,6 +444,7 @@ static int Demux( demux_t *p_demux )
break;
}
demux_UpdateTitleFromStream( p_demux );
return 1;
}
......@@ -530,6 +531,22 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
}
return VLC_EGENERIC;
case DEMUX_GET_TITLE_INFO:
{
struct input_title_t ***v = va_arg( args, struct input_title_t*** );
int *c = va_arg( args, int * );
*va_arg( args, int* ) = 0; /* Title offset */
*va_arg( args, int* ) = 0; /* Chapter offset */
return stream_Control( p_demux->s, STREAM_GET_TITLE_INFO, v, c );
}
case DEMUX_SET_TITLE:
return stream_Control( p_demux->s, STREAM_SET_TITLE, args );
case DEMUX_SET_SEEKPOINT:
return stream_Control( p_demux->s, STREAM_SET_SEEKPOINT, args );
case DEMUX_GET_META:
return stream_Control( p_demux->s, STREAM_GET_META, args );
......
......@@ -1019,6 +1019,7 @@ static int Demux( demux_t *p_demux )
p_sys->i_ts_read * p_sys->i_packet_size );
}
demux_UpdateTitleFromStream( p_demux );
return 1;
}
......@@ -1189,6 +1190,22 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
return VLC_SUCCESS;
}
case DEMUX_GET_TITLE_INFO:
{
struct input_title_t ***v = va_arg( args, struct input_title_t*** );
int *c = va_arg( args, int * );
*va_arg( args, int* ) = 0; /* Title offset */
*va_arg( args, int* ) = 0; /* Chapter offset */
return stream_Control( p_demux->s, STREAM_GET_TITLE_INFO, v, c );
}
case DEMUX_SET_TITLE:
return stream_Control( p_demux->s, STREAM_SET_TITLE, args );
case DEMUX_SET_SEEKPOINT:
return stream_Control( p_demux->s, STREAM_SET_SEEKPOINT, args );
case DEMUX_GET_META:
return stream_Control( p_demux->s, STREAM_GET_META, args );
......
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