index 0ad709f75c57ed9330e5f9c512f0a25cfef3ae15..9877f072478a54ebfc40cbc443d3e767ce40411a 100644 (file)
--- a/ext/dvdread/dvdreadsrc.c
+++ b/ext/dvdread/dvdreadsrc.c
*p_first_cell = pgc->program_map[pgn - 1] - 1;
if (chapter == (src->num_chapters - 1)) {
- *p_last_cell = pgc->nr_of_cells;
+ *p_last_cell = pgc->nr_of_cells - 1;
} else {
pgn_next_ch = src->vts_ptt_srpt->title[src->ttn - 1].ptt[chapter + 1].pgn;
*p_last_cell = pgc->program_map[pgn_next_ch - 1] - 1;
}
+
+ GST_DEBUG_OBJECT (src, "Chapter %d bounds: %d %d (within %d cells)",
+ chapter, *p_first_cell, *p_last_cell, pgc->nr_of_cells);
}
static gboolean
/* subtitle */
for (i = 0; i < src->vts_file->vtsi_mat->nr_of_vts_subp_streams; i++) {
const subp_attr_t *u;
+ const video_attr_t *v;
+ gint sid;
/* subpicture stream present? */
if (pgc0 != NULL && (pgc0->subp_control[i] & 0x80000000) == 0)
continue;
u = &src->vts_file->vtsi_mat->vts_subp_attr[i];
+ v = &src->vts_file->vtsi_mat->vts_video_attr;
+
+ sid = i;
+ if (pgc0 != NULL) {
+ if (v->display_aspect_ratio == 0) /* 4:3 */
+ sid = (pgc0->subp_control[i] >> 24) & 0x1f;
+ else if (v->display_aspect_ratio == 3) /* 16:9 */
+ sid = (pgc0->subp_control[i] >> 8) & 0x1f;
+ }
if (u->type) {
- t = g_strdup_printf ("subtitle-%d-language", i);
+ t = g_strdup_printf ("subtitle-%d-language", sid);
lang_code[0] = (u->lang_code >> 8) & 0xff;
lang_code[1] = u->lang_code & 0xff;
gst_structure_set (s, t, G_TYPE_STRING, lang_code, NULL);
}
GST_INFO_OBJECT (src, "[%02d] Subtitle %02d: lang='%s', type=%d",
- src->title + 1, i, lang_code, u->type);
+ src->title + 1, sid, lang_code, u->type);
}
src->title_lang_event_pending =
if (s->format == sector_format) {
gint first, last;
gst_dvd_read_src_get_sector_bounds (src, &first, &last);
- GST_DEBUG_OBJECT (src, "Format is sector, seeking to %d", s->last_stop);
+ GST_DEBUG_OBJECT (src, "Format is sector, seeking to %" G_GINT64_FORMAT,
+ s->last_stop);
src->cur_pack = s->last_stop;
if (src->cur_pack < first)
src->cur_pack = first;
gint first = src->cur_pgc->cell_playback[cur].first_sector;
gint last = src->cur_pgc->cell_playback[cur].last_sector;
GST_DEBUG_OBJECT (src, "Cell %d sector bounds: %d %d", cur, first, last);
- if (seek_to >= first && seek_to <= last) {
+ /* seeking to 0 should end up at first chapter in any case */
+ if ((seek_to >= first && seek_to <= last) || (seek_to == 0 && i == 0)) {
GST_DEBUG_OBJECT (src, "Seek target found in chapter %d", i);
chapter = i;
goto done;