oggstream: only use information from skeleton if we have nothing better

The codec setup headers are a lot more likely to have correct information,
especially as it's easy to remux a skeleton in a file where streams don't
have the same parameters (I've even seen a file with two skeletons).

Still, this is useful in the case we have a codec we can't decode, so we
can at least (theoretically) convert granpos to time, so we discard this
information if the codec setup has already provided it.

This fixes playback on (at lesat) the original archive.org encoding of
"The Night of the Living Dead" (now replaced by another encoding).

https://bugzilla.gnome.org/show_bug.cgi?id=612443
This commit is contained in:
Vincent Penquerc'h 2011-01-13 15:35:30 +00:00 committed by Tim-Philipp Müller
parent 043ee22e25
commit c956c5fd00
2 changed files with 18 additions and 4 deletions

View file

@ -189,6 +189,10 @@ gst_ogg_pad_init (GstOggPad * pad)
pad->continued = NULL;
pad->map.headers = NULL;
pad->map.queued = NULL;
pad->map.granulerate_n = 0;
pad->map.granulerate_d = 0;
pad->map.granuleshift = -1;
}
static void

View file

@ -1160,13 +1160,23 @@ gst_ogg_map_add_fisbone (GstOggStream * pad, GstOggStream * skel_pad,
pad->have_fisbone = TRUE;
/* we just overwrite whatever was set before by the format-specific setup */
pad->granulerate_n = GST_READ_UINT64_LE (data);
pad->granulerate_d = GST_READ_UINT64_LE (data + 8);
/* We don't overwrite whatever was set before by the format-specific
setup: skeleton contains wrong information sometimes, and the codec
headers are authoritative.
So we only gather information that was not already filled out by
the mapper setup. This should hopefully allow handling unknown
streams a bit better, while not trashing correct setup from bad
skeleton data. */
if (pad->granulerate_n == 0 || pad->granulerate_d == 0) {
pad->granulerate_n = GST_READ_UINT64_LE (data);
pad->granulerate_d = GST_READ_UINT64_LE (data + 8);
}
if (pad->granuleshift < 0) {
pad->granuleshift = GST_READ_UINT8 (data + 28);
}
start_granule = GST_READ_UINT64_LE (data + 16);
pad->preroll = GST_READ_UINT32_LE (data + 24);
pad->granuleshift = GST_READ_UINT8 (data + 28);
start_time = granulepos_to_granule_default (pad, start_granule);