On Fri, 2014-01-10 at 21:19 +0100, Anton Khirnov wrote: > On Wed, 8 Jan 2014 03:25:38 +0100, Luca Barbato <lu_z...@gentoo.org> wrote: > > From: Tomas Härdin <tomas.har...@codemill.se> > > > > Such files have IndexTableSegments which when parsed cover EditUnit ranges > > like this: > > > > [0,1) > > [249,250) > > [249,377) > > [0,249) > > > > where each interval is > > > > [IndexStartPosition, IndexStartPosition + IndexDuration) > > > > This would be reduced to a sparse index like: > > > > [0,1), [249,250) > > > > instead of the full range: > > > > [0,249), [249,377) > > > > Sample: http://streams.videolan.org/issues/7302/TimeCode_HD.mxf > > Signed-off-by: Luca Barbato <lu_z...@gentoo.org> > > --- > > libavformat/mxfdec.c | 6 +++++- > > 1 file changed, 5 insertions(+), 1 deletion(-) > > > > diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c > > index 7bca23d..2fc31bf 100644 > > --- a/libavformat/mxfdec.c > > +++ b/libavformat/mxfdec.c > > @@ -980,19 +980,23 @@ static int mxf_get_sorted_table_segments(MXFContext > > *mxf, int *nb_sorted_segment > > /* sort segments by {BodySID, IndexSID, IndexStartPosition}, remove > > duplicates while we're at it */ > > for (i = 0; i < nb_segments; i++) { > > int best = -1, best_body_sid = -1, best_index_sid = -1, > > best_index_start = -1; > > + uint64_t best_index_duration = 0; > > > > for (j = 0; j < nb_segments; j++) { > > MXFIndexTableSegment *s = unsorted_segments[j]; > > > > /* Require larger BosySID, IndexSID or IndexStartPosition then > > the previous entry. This removes duplicates. > > * We want the smallest values for the keys than what we > > currently have, unless this is the first such entry this time around. > > + * If we come across an entry with the same IndexStartPosition > > but larger IndexDuration, then we'll prefer it over the one we currently > > have. > > */ > > if ((i == 0 || s->body_sid > last_body_sid || s->index_sid > > > last_index_sid || s->index_start_position > last_index_start) && > > - (best == -1 || s->body_sid < best_body_sid || s->index_sid > > < best_index_sid || s->index_start_position < best_index_start)) { > > + (best == -1 || s->body_sid < best_body_sid || s->index_sid > > < best_index_sid || s->index_start_position < best_index_start || > > + (s->index_start_position == best_index_start && > > s->index_duration > best_index_duration))) { > > best = j; > > best_body_sid = s->body_sid; > > best_index_sid = s->index_sid; > > best_index_start = s->index_start_position; > > + best_index_duration = s->index_duration; > > } > > } > > > > -- > > 1.8.5.1 > > > > Wow, this format really is insane.
You have no idea..
signature.asc
Description: This is a digitally signed message part
_______________________________________________ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel