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

mpeg: add DEMUX_GET_(TITLE|SEEKPOINT)

parent db33e6a2
......@@ -371,26 +371,32 @@ static inline int demux_Control( demux_t *p_demux, int i_query, ... )
* Miscellaneous helpers for demuxers
*************************************************************************/
static inline void demux_UpdateTitleFromStream( demux_t *demux )
#ifndef __cplusplus
static inline void demux_UpdateTitleFromStream( demux_t *demux,
int *restrict titlep, int *restrict seekpointp )
{
stream_t *s = demux->s;
unsigned title, seekpoint;
if( vlc_stream_Control( s, STREAM_GET_TITLE, &title ) == VLC_SUCCESS
&& title != (unsigned)demux->info.i_title )
&& title != (unsigned)*titlep )
{
demux->info.i_title = title;
*titlep = title;
demux->info.i_update |= INPUT_UPDATE_TITLE;
}
if( vlc_stream_Control( s, STREAM_GET_SEEKPOINT,
&seekpoint ) == VLC_SUCCESS
&& seekpoint != (unsigned)demux->info.i_seekpoint )
&& seekpoint != (unsigned)*seekpointp )
{
demux->info.i_seekpoint = seekpoint;
*seekpointp = seekpoint;
demux->info.i_update |= INPUT_UPDATE_SEEKPOINT;
}
}
# define demux_UpdateTitleFromStream(demux) \
demux_UpdateTitleFromStream(demux, &(demux)->p_sys->current_title, \
&(demux)->p_sys->current_seekpoint)
#endif
VLC_USED
static inline bool demux_IsPathExtension( demux_t *p_demux, const char *psz_extension )
......
......@@ -110,6 +110,9 @@ struct demux_sys_t
CDXA_PS,
PSMF_PS,
} format;
int current_title;
int current_seekpoint;
};
static int Demux ( demux_t *p_demux );
......@@ -223,6 +226,8 @@ static int OpenCommon( vlc_object_t *p_this, bool b_force )
p_sys->b_bad_scr = false;
p_sys->b_seekable = false;
p_sys->format = format;
p_sys->current_title = 0;
p_sys->current_seekpoint = 0;
vlc_stream_Control( p_demux->s, STREAM_CAN_SEEK, &p_sys->b_seekable );
......@@ -666,6 +671,14 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
*va_arg( args, bool * ) = p_sys->b_seekable;
return VLC_SUCCESS;
case DEMUX_GET_TITLE:
*va_arg( args, int * ) = p_sys->current_title;
return VLC_SUCCESS;
case DEMUX_GET_SEEKPOINT:
*va_arg( args, int * ) = p_sys->current_seekpoint;
return VLC_SUCCESS;
case DEMUX_GET_POSITION:
pf = va_arg( args, double * );
i64 = stream_Size( p_demux->s ) - p_sys->i_start_byte;
......
......@@ -894,6 +894,14 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
*va_arg( args, bool * ) = p_sys->b_canseek;
return VLC_SUCCESS;
case DEMUX_GET_TITLE:
*va_arg( args, int * ) = p_sys->current_title;
return VLC_SUCCESS;
case DEMUX_GET_SEEKPOINT:
*va_arg( args, int * ) = p_sys->current_seekpoint;
return VLC_SUCCESS;
case DEMUX_GET_POSITION:
pf = va_arg( args, double * );
......
......@@ -49,6 +49,8 @@ struct demux_sys_t
stream_t *stream;
bool b_canseek;
bool b_canfastseek;
int current_title;
int current_seekpoint;
vlc_mutex_t csa_lock;
/* TS packet size (188, 192, 204) */
......
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