mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-09-08 21:28:45 +00:00
Revert "qtdemux: Always snap to the start of the keyframe"
This reverts commit 107902ec51
.
This commit intended to ensure that keyframe seeks land at the
start timestamp of a keyframe, rather than in the middle of one,
but they cause trouble on files with sparse streams, or with
JPEG 'cover art' tracks that have only one or a few JPEG samples
with very long durations.
That's still desirable for doing seamless cutting of videos,
but needs a rethink for implementation.
https://bugzilla.gnome.org/show_bug.cgi?id=778690
This commit is contained in:
parent
c32bf052a0
commit
488e8edba4
1 changed files with 26 additions and 22 deletions
|
@ -1296,7 +1296,7 @@ gst_qtdemux_adjust_seek (GstQTDemux * qtdemux, gint64 desired_time,
|
||||||
* and move back to the previous keyframe. */
|
* and move back to the previous keyframe. */
|
||||||
for (n = 0; n < qtdemux->n_streams; n++) {
|
for (n = 0; n < qtdemux->n_streams; n++) {
|
||||||
QtDemuxStream *str;
|
QtDemuxStream *str;
|
||||||
guint32 index;
|
guint32 index, kindex;
|
||||||
guint32 seg_idx;
|
guint32 seg_idx;
|
||||||
GstClockTime media_start;
|
GstClockTime media_start;
|
||||||
GstClockTime media_time;
|
GstClockTime media_time;
|
||||||
|
@ -1350,20 +1350,23 @@ gst_qtdemux_adjust_seek (GstQTDemux * qtdemux, gint64 desired_time,
|
||||||
|
|
||||||
if (!empty_segment) {
|
if (!empty_segment) {
|
||||||
/* find previous keyframe */
|
/* find previous keyframe */
|
||||||
index = gst_qtdemux_find_keyframe (qtdemux, str, index, next);
|
kindex = gst_qtdemux_find_keyframe (qtdemux, str, index, next);
|
||||||
|
|
||||||
/* we will settle for one before if none found after */
|
/* we will settle for one before if none found after */
|
||||||
if (next && index == -1)
|
if (next && kindex == -1)
|
||||||
index = gst_qtdemux_find_keyframe (qtdemux, str, index, FALSE);
|
kindex = gst_qtdemux_find_keyframe (qtdemux, str, index, FALSE);
|
||||||
|
|
||||||
/* Snap to the start ts of the keyframe we found */
|
/* if the keyframe is at a different position, we need to update the
|
||||||
|
* requested seek time */
|
||||||
|
if (index != kindex) {
|
||||||
|
index = kindex;
|
||||||
|
|
||||||
/* get timestamp of keyframe */
|
/* get timestamp of keyframe */
|
||||||
media_time = QTSAMPLE_PTS_NO_CSLG (str, &str->samples[index]);
|
media_time = QTSAMPLE_PTS_NO_CSLG (str, &str->samples[kindex]);
|
||||||
GST_DEBUG_OBJECT (qtdemux,
|
GST_DEBUG_OBJECT (qtdemux,
|
||||||
"keyframe at %u with time %" GST_TIME_FORMAT " at offset %"
|
"keyframe at %u with time %" GST_TIME_FORMAT " at offset %"
|
||||||
G_GUINT64_FORMAT, index, GST_TIME_ARGS (media_time),
|
G_GUINT64_FORMAT, kindex, GST_TIME_ARGS (media_time),
|
||||||
str->samples[index].offset);
|
str->samples[kindex].offset);
|
||||||
|
|
||||||
/* keyframes in the segment get a chance to change the
|
/* keyframes in the segment get a chance to change the
|
||||||
* desired_offset. keyframes out of the segment are
|
* desired_offset. keyframes out of the segment are
|
||||||
|
@ -1379,6 +1382,7 @@ gst_qtdemux_adjust_seek (GstQTDemux * qtdemux, gint64 desired_time,
|
||||||
min_offset = seg_time;
|
min_offset = seg_time;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (min_byte_offset < 0 || str->samples[index].offset < min_byte_offset)
|
if (min_byte_offset < 0 || str->samples[index].offset < min_byte_offset)
|
||||||
min_byte_offset = str->samples[index].offset;
|
min_byte_offset = str->samples[index].offset;
|
||||||
|
|
Loading…
Reference in a new issue