Commit cab4efd5 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Ogg: parse and create Vorbis Comment Chapter Extension seekpoints

This does not actually seek to the right position yet
Ref #6895
parent f8c07e70
......@@ -510,6 +510,41 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
*pi64 = p_sys->i_length * 1000000;
return VLC_SUCCESS;
case DEMUX_GET_TITLE_INFO:
{
input_title_t ***ppp_title = (input_title_t***)va_arg( args, input_title_t*** );
int *pi_int = (int*)va_arg( args, int* );
int *pi_title_offset = (int*)va_arg( args, int* );
int *pi_seekpoint_offset = (int*)va_arg( args, int* );
if( p_sys->i_seekpoints > 0 )
{
*pi_int = 1;
*ppp_title = malloc( sizeof( input_title_t**) );
input_title_t *p_title = (*ppp_title)[0] = vlc_input_title_New();
for( int i = 0; i < p_sys->i_seekpoints; i++ )
{
TAB_APPEND( p_title->i_seekpoint, p_title->seekpoint, p_sys->pp_seekpoints[i] );
}
*pi_title_offset = 0;
*pi_seekpoint_offset = 0;
}
return VLC_SUCCESS;
}
case DEMUX_SET_TITLE:
{
const int i_title = (int)va_arg( args, int );
if( i_title > 1 )
return VLC_EGENERIC;
return VLC_SUCCESS;
}
case DEMUX_SET_SEEKPOINT:
{
const int i_seekpoint = (int)va_arg( args, int );
if( i_seekpoint > p_sys->i_seekpoints )
return VLC_EGENERIC;
return VLC_EGENERIC;// Seek( p_demux, p_sys->pp_seekpoints[i_seekpoint]->i_time_offset );
}
default:
return demux_vaControlHelper( p_demux->s, 0, -1, p_sys->i_bitrate,
......@@ -1789,6 +1824,11 @@ static void Ogg_ExtractXiphMeta( demux_t *p_demux, const void *p_headers, unsign
&p_ogg->i_attachments, &p_ogg->attachments,
&p_ogg->i_seekpoints, &p_ogg->pp_seekpoints );
if( p_ogg->i_seekpoints > 1 )
{
p_demux->info.i_update |= INPUT_UPDATE_TITLE_LIST;
}
for( unsigned i = 0; i < i_count; i++ )
free( pp_data[i] );
}
......
......@@ -79,6 +79,7 @@ static inline void vorbis_ParseComment( vlc_meta_t **pp_meta,
int n;
int i_comment;
int i_attach = 0;
seekpoint_t *sk = NULL;
if( i_data < 8 )
return;
......@@ -198,6 +199,7 @@ static inline void vorbis_ParseComment( vlc_meta_t **pp_meta,
{
char *p = strchr( psz_comment, '=' );
*p++ = '\0';
sk->psz_name = strdup( p );
}
else if( sscanf( psz_comment, "chapter %i=", &i_chapt ) == 1 )
{
......@@ -207,7 +209,7 @@ static inline void vorbis_ParseComment( vlc_meta_t **pp_meta,
if( sscanf( p, "%d:%d:%d.%d", &h, &m, &s, &ms ) == 4 )
{
seekpoint_t *sk = vlc_seekpoint_New();
sk = vlc_seekpoint_New();
sk->i_time_offset = ((h * 3600 + m * 60 + s) *1000 + ms) * 1000;
TAB_APPEND_CAST( (seekpoint_t**), *i_seekpoint, *ppp_seekpoint, sk );
}
......
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