Bug 846122 - Handle split multi-track Cues in nestegg. r=padenot

This commit is contained in:
Matthew Gregan 2013-04-16 13:20:18 +12:00
parent 0068a648e9
commit df6b4497ba
2 changed files with 23 additions and 6 deletions

View File

@ -5,4 +5,4 @@ Makefile.in build files for the Mozilla build system.
The nestegg git repository is: git://github.com/kinetiknz/nestegg.git
The git commit ID used was ebdbb688fb13dd315fc9d16e6897adb5ee42b7bb.
The git commit ID used was 443edc8d8cb1037275b055474256a7fa089766dc.

View File

@ -1407,10 +1407,14 @@ ne_find_seek_for_id(struct ebml_list_node * seek_head, uint64_t id)
}
static struct cue_point *
ne_find_cue_point_for_tstamp(struct ebml_list_node * cue_point, uint64_t scale, uint64_t tstamp)
ne_find_cue_point_for_tstamp(nestegg * ctx, struct ebml_list_node * cue_point, unsigned int track, uint64_t scale, uint64_t tstamp)
{
uint64_t time;
struct cue_point * c, * prev = NULL;
uint64_t track_number;
unsigned int t;
struct ebml_list_node * node;
struct cue_track_positions * pos;
while (cue_point) {
assert(cue_point->id == ID_CUE_POINT);
@ -1419,14 +1423,27 @@ ne_find_cue_point_for_tstamp(struct ebml_list_node * cue_point, uint64_t scale,
if (!prev)
prev = c;
if (ne_get_uint(c->time, &time) == 0 && time * scale > tstamp)
break;
node = prev->cue_track_positions.head;
while (node) {
assert(node->id == ID_CUE_TRACK_POSITIONS);
pos = node->data;
if (ne_get_uint(pos->track, &track_number) != 0)
return NULL;
if (ne_map_track_number_to_index(ctx, track_number, &t) != 0)
return NULL;
if (ne_get_uint(c->time, &time) == 0 && time * scale > tstamp && t == track)
return prev;
node = node->next;
}
prev = cue_point->data;
cue_point = cue_point->next;
}
return prev;
return NULL;
}
static int
@ -1850,7 +1867,7 @@ nestegg_track_seek(nestegg * ctx, unsigned int track, uint64_t tstamp)
tc_scale = ne_get_timecode_scale(ctx);
cue_point = ne_find_cue_point_for_tstamp(ctx->segment.cues.cue_point.head, tc_scale, tstamp);
cue_point = ne_find_cue_point_for_tstamp(ctx, ctx->segment.cues.cue_point.head, track, tc_scale, tstamp);
if (!cue_point)
return -1;