Commit 8584fc6e authored by Francois Cartegnie's avatar Francois Cartegnie

demux: ogg: split comments parsing from xiph unpack

parent 18b224c9
...@@ -2119,20 +2119,11 @@ static bool Ogg_LogicalStreamResetEsFormat( demux_t *p_demux, logical_stream_t * ...@@ -2119,20 +2119,11 @@ static bool Ogg_LogicalStreamResetEsFormat( demux_t *p_demux, logical_stream_t *
return !b_compatible; return !b_compatible;
} }
static void Ogg_ExtractXiphMeta( demux_t *p_demux, es_format_t *p_fmt,
const void *p_headers, unsigned i_headers, unsigned i_skip ) static void Ogg_ExtractComments( demux_t *p_demux, es_format_t *p_fmt,
const void *p_headers, unsigned i_headers )
{ {
demux_sys_t *p_ogg = p_demux->p_sys; demux_sys_t *p_ogg = p_demux->p_sys;
unsigned pi_size[XIPH_MAX_HEADER_COUNT];
void *pp_data[XIPH_MAX_HEADER_COUNT];
unsigned i_count;
if( xiph_SplitHeaders( pi_size, pp_data, &i_count, i_headers, p_headers ) )
return;
/* TODO how to handle multiple comments properly ? */
if( i_count >= 2 && pi_size[1] > i_skip )
{
int i_cover_score = 0; int i_cover_score = 0;
int i_cover_idx = 0; int i_cover_idx = 0;
float pf_replay_gain[AUDIO_REPLAY_GAIN_MAX]; float pf_replay_gain[AUDIO_REPLAY_GAIN_MAX];
...@@ -2142,7 +2133,7 @@ static void Ogg_ExtractXiphMeta( demux_t *p_demux, es_format_t *p_fmt, ...@@ -2142,7 +2133,7 @@ static void Ogg_ExtractXiphMeta( demux_t *p_demux, es_format_t *p_fmt,
pf_replay_gain[i] = 0; pf_replay_gain[i] = 0;
pf_replay_peak[i] = 0; pf_replay_peak[i] = 0;
} }
vorbis_ParseComment( &p_ogg->p_meta, (uint8_t*)pp_data[1] + i_skip, pi_size[1] - i_skip, vorbis_ParseComment( &p_ogg->p_meta, p_headers, i_headers,
&p_ogg->i_attachments, &p_ogg->attachments, &p_ogg->i_attachments, &p_ogg->attachments,
&i_cover_score, &i_cover_idx, &i_cover_score, &i_cover_idx,
&p_ogg->i_seekpoints, &p_ogg->pp_seekpoints, &p_ogg->i_seekpoints, &p_ogg->pp_seekpoints,
...@@ -2170,13 +2161,29 @@ static void Ogg_ExtractXiphMeta( demux_t *p_demux, es_format_t *p_fmt, ...@@ -2170,13 +2161,29 @@ static void Ogg_ExtractXiphMeta( demux_t *p_demux, es_format_t *p_fmt,
msg_Dbg( p_demux, "setting replay peak %d to %f", i, pf_replay_gain[i] ); msg_Dbg( p_demux, "setting replay peak %d to %f", i, pf_replay_gain[i] );
} }
} }
}
if( p_ogg->i_seekpoints > 1 ) if( p_ogg->i_seekpoints > 1 )
{ {
p_demux->info.i_update |= INPUT_UPDATE_TITLE_LIST; p_demux->info.i_update |= INPUT_UPDATE_TITLE_LIST;
} }
} }
static void Ogg_ExtractXiphMeta( demux_t *p_demux, es_format_t *p_fmt,
const void *p_headers, unsigned i_headers, unsigned i_skip )
{
unsigned pi_size[XIPH_MAX_HEADER_COUNT];
void *pp_data[XIPH_MAX_HEADER_COUNT];
unsigned i_count;
if( xiph_SplitHeaders( pi_size, pp_data, &i_count, i_headers, p_headers ) )
return;
/* TODO how to handle multiple comments properly ? */
if( i_count >= 2 && pi_size[1] > i_skip )
{
Ogg_ExtractComments( p_demux, p_fmt, (uint8_t*)pp_data[1] + i_skip, pi_size[1] - i_skip );
}
}
static void Ogg_ExtractMeta( demux_t *p_demux, es_format_t *p_fmt, const uint8_t *p_headers, int i_headers ) static void Ogg_ExtractMeta( demux_t *p_demux, es_format_t *p_fmt, const uint8_t *p_headers, int i_headers )
{ {
demux_sys_t *p_ogg = p_demux->p_sys; demux_sys_t *p_ogg = p_demux->p_sys;
......
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