mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-07 07:58:51 +00:00
oggdemux: handle theora streams with 0 keyoffset
This commit is contained in:
parent
a8e99f80df
commit
d2c9d7fc1c
2 changed files with 23 additions and 1 deletions
|
@ -299,6 +299,26 @@ setup_theora_mapper (GstOggStream * pad, ogg_packet * packet)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gint64
|
||||||
|
granulepos_to_granule_theora (GstOggStream * pad, gint64 granulepos)
|
||||||
|
{
|
||||||
|
gint64 keyindex, keyoffset;
|
||||||
|
|
||||||
|
if (pad->granuleshift != 0) {
|
||||||
|
keyindex = granulepos >> pad->granuleshift;
|
||||||
|
keyoffset = granulepos - (keyindex << pad->granuleshift);
|
||||||
|
if (keyoffset == 0) {
|
||||||
|
pad->theora_has_zero_keyoffset = TRUE;
|
||||||
|
}
|
||||||
|
if (pad->theora_has_zero_keyoffset) {
|
||||||
|
keyoffset++;
|
||||||
|
}
|
||||||
|
return keyindex + keyoffset;
|
||||||
|
} else {
|
||||||
|
return granulepos;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
is_keyframe_theora (GstOggStream * pad, gint64 granulepos)
|
is_keyframe_theora (GstOggStream * pad, gint64 granulepos)
|
||||||
{
|
{
|
||||||
|
@ -944,7 +964,7 @@ static const GstOggMap mappers[] = {
|
||||||
"\200theora", 7, 42,
|
"\200theora", 7, 42,
|
||||||
"video/x-theora",
|
"video/x-theora",
|
||||||
setup_theora_mapper,
|
setup_theora_mapper,
|
||||||
granulepos_to_granule_default,
|
granulepos_to_granule_theora,
|
||||||
granule_to_granulepos_default,
|
granule_to_granulepos_default,
|
||||||
is_keyframe_theora,
|
is_keyframe_theora,
|
||||||
is_header_theora,
|
is_header_theora,
|
||||||
|
|
|
@ -63,6 +63,8 @@ struct _GstOggStream
|
||||||
int vorbis_log2_num_modes;
|
int vorbis_log2_num_modes;
|
||||||
int vorbis_mode_sizes[256];
|
int vorbis_mode_sizes[256];
|
||||||
int last_size;
|
int last_size;
|
||||||
|
/* theora stuff */
|
||||||
|
gboolean theora_has_zero_keyoffset;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue