oggdemux: Fix granulepos->key granule calculation for Dirac

This commit is contained in:
Sebastian Dröge 2010-05-14 13:31:42 +02:00
parent d6b6d0cdad
commit ac2d0170a8

View file

@ -465,6 +465,29 @@ granule_to_granulepos_dirac (GstOggStream * pad, gint64 granule,
return -1;
}
static gint64
granulepos_to_key_granule_dirac (GstOggStream * pad, gint64 gp)
{
gint64 pt;
int dist_h;
int dist_l;
int dist;
int delay;
gint64 dt;
if (gp == -1 || gp == 0)
return gp;
pt = ((gp >> 22) + (gp & OGG_DIRAC_GRANULE_LOW_MASK)) >> 9;
dist_h = (gp >> 22) & 0xff;
dist_l = gp & 0xff;
dist = (dist_h << 8) | dist_l;
delay = (gp >> 9) & 0x1fff;
dt = pt - delay;
return dt - 2 * dist + 4;
}
/* VP8 */
static gboolean
@ -1600,7 +1623,7 @@ static const GstOggMap mappers[] = {
is_keyframe_dirac,
is_header_count,
packet_duration_constant,
NULL
granulepos_to_key_granule_dirac
},
{
"VP80\1", 5, 4,