mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 20:21:24 +00:00
dvdreadsrc: fix sector seeking
It was overly complicated, and did not take into account the offset needed for titles which do not start on a new file. https://bugzilla.gnome.org/show_bug.cgi?id=659252
This commit is contained in:
parent
20464efc8e
commit
59ed3b7bf2
1 changed files with 12 additions and 10 deletions
|
@ -1545,26 +1545,28 @@ static gboolean
|
||||||
gst_dvd_read_src_goto_sector (GstDvdReadSrc * src, int angle)
|
gst_dvd_read_src_goto_sector (GstDvdReadSrc * src, int angle)
|
||||||
{
|
{
|
||||||
gint seek_to = src->cur_pack;
|
gint seek_to = src->cur_pack;
|
||||||
gint chapter, sectors, next, cur, i;
|
gint chapter, next, cur, i;
|
||||||
|
|
||||||
/* retrieve position */
|
/* retrieve position */
|
||||||
src->cur_pack = 0;
|
src->cur_pack = 0;
|
||||||
|
GST_DEBUG_OBJECT (src, "Goto sector %d, angle %d, within %d chapters",
|
||||||
|
seek_to, angle, src->num_chapters);
|
||||||
|
|
||||||
for (i = 0; i < src->num_chapters; i++) {
|
for (i = 0; i < src->num_chapters; i++) {
|
||||||
gint c1, c2;
|
gint c1, c2;
|
||||||
|
|
||||||
cur_title_get_chapter_bounds (src, i, &c1, &c2);
|
cur_title_get_chapter_bounds (src, i, &c1, &c2);
|
||||||
|
GST_DEBUG_OBJECT (src, " Looking in chapter %d, bounds: %d %d", i, c1, c2);
|
||||||
|
|
||||||
for (next = cur = c1; cur < c2;) {
|
for (next = cur = c1; cur < c2;) {
|
||||||
if (next != cur) {
|
gint first = src->cur_pgc->cell_playback[cur].first_sector;
|
||||||
sectors =
|
gint last = src->cur_pgc->cell_playback[cur].last_sector;
|
||||||
src->cur_pgc->cell_playback[cur].last_sector -
|
GST_DEBUG_OBJECT (src, "Cell %d sector bounds: %d %d", cur, first, last);
|
||||||
src->cur_pgc->cell_playback[cur].first_sector;
|
if (seek_to >= first && seek_to <= last) {
|
||||||
if (src->cur_pack + sectors > seek_to) {
|
GST_DEBUG_OBJECT (src, "Seek target found in chapter %d", i);
|
||||||
chapter = i;
|
chapter = i;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
src->cur_pack += sectors;
|
|
||||||
}
|
|
||||||
cur = next;
|
cur = next;
|
||||||
if (src->cur_pgc->cell_playback[cur].block_type == BLOCK_TYPE_ANGLE_BLOCK)
|
if (src->cur_pgc->cell_playback[cur].block_type == BLOCK_TYPE_ANGLE_BLOCK)
|
||||||
cur += angle;
|
cur += angle;
|
||||||
|
|
Loading…
Reference in a new issue