mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-21 07:46:38 +00:00
gst/qtdemux/qtdemux.c: Fix framerate calculation.
Original commit message from CVS: * gst/qtdemux/qtdemux.c: (gst_qtdemux_add_stream), (qtdemux_parse_trak): Fix framerate calculation.
This commit is contained in:
parent
7ea44d8a2f
commit
5b097ce855
2 changed files with 17 additions and 4 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
2006-04-10 Wim Taymans <wim@fluendo.com>
|
||||||
|
|
||||||
|
* gst/qtdemux/qtdemux.c: (gst_qtdemux_add_stream),
|
||||||
|
(qtdemux_parse_trak):
|
||||||
|
Fix framerate calculation.
|
||||||
|
|
||||||
2006-04-10 Tim-Philipp Müller <tim at centricular dot net>
|
2006-04-10 Tim-Philipp Müller <tim at centricular dot net>
|
||||||
|
|
||||||
* ext/swfdec/gstswfdec.c: (gst_swfdecbuffer_class_init):
|
* ext/swfdec/gstswfdec.c: (gst_swfdecbuffer_class_init):
|
||||||
|
|
|
@ -105,6 +105,8 @@ struct _QtDemuxStream
|
||||||
guint32 n_samples;
|
guint32 n_samples;
|
||||||
QtDemuxSample *samples;
|
QtDemuxSample *samples;
|
||||||
gboolean all_keyframe; /* TRUE when all samples are keyframes (no stss) */
|
gboolean all_keyframe; /* TRUE when all samples are keyframes (no stss) */
|
||||||
|
guint32 min_duration; /* duration of dirst sample, used for figuring out
|
||||||
|
the framerate, in timescale units */
|
||||||
|
|
||||||
/* if we use chunks or samples */
|
/* if we use chunks or samples */
|
||||||
gboolean sampled;
|
gboolean sampled;
|
||||||
|
@ -1757,16 +1759,17 @@ gst_qtdemux_add_stream (GstQTDemux * qtdemux,
|
||||||
gst_pad_new_from_static_template (&gst_qtdemux_videosrc_template, name);
|
gst_pad_new_from_static_template (&gst_qtdemux_videosrc_template, name);
|
||||||
g_free (name);
|
g_free (name);
|
||||||
|
|
||||||
/* guess fps, FIXME */
|
/* fps is calculated base on the duration of the first frames since
|
||||||
if ((stream->n_samples == 1) && (stream->samples[0].duration == 0)) {
|
* qt does not have a fixed framerate. */
|
||||||
|
if ((stream->n_samples == 1) && (stream->min_duration == 0)) {
|
||||||
stream->fps_n = 0;
|
stream->fps_n = 0;
|
||||||
stream->fps_d = 1;
|
stream->fps_d = 1;
|
||||||
} else {
|
} else {
|
||||||
stream->fps_n = stream->timescale;
|
stream->fps_n = stream->timescale;
|
||||||
if (stream->samples[0].duration == 0)
|
if (stream->min_duration == 0)
|
||||||
stream->fps_d = 1;
|
stream->fps_d = 1;
|
||||||
else
|
else
|
||||||
stream->fps_d = stream->samples[0].duration;
|
stream->fps_d = stream->min_duration;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stream->caps) {
|
if (stream->caps) {
|
||||||
|
@ -3368,6 +3371,7 @@ qtdemux_parse_trak (GstQTDemux * qtdemux, GNode * trak)
|
||||||
|
|
||||||
n_sample_times = QTDEMUX_GUINT32_GET (stts->data + 12);
|
n_sample_times = QTDEMUX_GUINT32_GET (stts->data + 12);
|
||||||
timestamp = 0;
|
timestamp = 0;
|
||||||
|
stream->min_duration = 0;
|
||||||
time = 0;
|
time = 0;
|
||||||
index = 0;
|
index = 0;
|
||||||
for (i = 0; i < n_sample_times; i++) {
|
for (i = 0; i < n_sample_times; i++) {
|
||||||
|
@ -3381,6 +3385,9 @@ qtdemux_parse_trak (GstQTDemux * qtdemux, GNode * trak)
|
||||||
index, GST_TIME_ARGS (timestamp));
|
index, GST_TIME_ARGS (timestamp));
|
||||||
|
|
||||||
samples[index].timestamp = timestamp;
|
samples[index].timestamp = timestamp;
|
||||||
|
/* take first duration for fps */
|
||||||
|
if (stream->min_duration == 0)
|
||||||
|
stream->min_duration = duration;
|
||||||
/* add non-scaled values to avoid rounding errors */
|
/* add non-scaled values to avoid rounding errors */
|
||||||
time += duration;
|
time += duration;
|
||||||
timestamp = gst_util_uint64_scale_int (time,
|
timestamp = gst_util_uint64_scale_int (time,
|
||||||
|
|
Loading…
Reference in a new issue