diff options
author | Wim Taymans <wim.taymans@collabora.co.uk> | 2010-01-04 13:41:18 +0100 |
---|---|---|
committer | Wim Taymans <wim.taymans@collabora.co.uk> | 2010-01-05 15:51:48 +0100 |
commit | 22eb18f828e9c6208fadd67b193261780b019255 (patch) | |
tree | aa1036e5447095d66d3158ddfa255acb703bbe1a | |
parent | 1c27ed4dae0c04a70fc945f623f8be47025403a5 (diff) |
qtdemux: simplify logic to calculate duration
Since we no longer store the timestamp and duration in nanoseconds, we can now
simply store the duration as-is.
-rw-r--r-- | gst/qtdemux/qtdemux.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/gst/qtdemux/qtdemux.c b/gst/qtdemux/qtdemux.c index 1652f0bed..54e264ba4 100644 --- a/gst/qtdemux/qtdemux.c +++ b/gst/qtdemux/qtdemux.c @@ -4320,11 +4320,12 @@ qtdemux_parse_samples (GstQTDemux * qtdemux, QtDemuxStream * stream, guint32 n) "sample %d: timestamp %" GST_TIME_FORMAT ", size %u", j, GST_TIME_ARGS (gst_util_uint64_scale (stream->stco_sample_index, GST_SECOND, stream->timescale)), stream->samples[j].size); + stream->samples[j].timestamp = stream->stco_sample_index; - stream->stco_sample_index += stream->samples_per_chunk; - stream->samples[j].duration = - stream->stco_sample_index - stream->samples[j].timestamp; + stream->samples[j].duration = stream->samples_per_chunk; stream->samples[j].keyframe = TRUE; + + stream->stco_sample_index += stream->samples_per_chunk; stream->stsc_chunk_index++; } } @@ -4358,11 +4359,12 @@ done2: "sample %d: index %d, timestamp %" GST_TIME_FORMAT, index, j, GST_TIME_ARGS (gst_util_uint64_scale (stream->stts_time, GST_SECOND, stream->timescale))); + stream->samples[index].timestamp = stream->stts_time; + stream->samples[index].duration = stream->stts_duration; + /* add non-scaled values to avoid rounding errors */ stream->stts_time += stream->stts_duration; - stream->samples[index].duration = - stream->stts_time - stream->samples[index].timestamp; stream->stts_sample_index++; index++; if (G_UNLIKELY (index > n)) |