35 #include <dvdnav/dvdnav.h>
36 #include <dvdread/dvd_reader.h>
37 #include <dvdread/ifo_read.h>
38 #include <dvdread/ifo_types.h>
39 #include <dvdread/nav_read.h>
57 #define DVDVIDEO_MAX_PS_SEARCH_BLOCKS 128
58 #define DVDVIDEO_BLOCK_SIZE 2048
59 #define DVDVIDEO_TIME_BASE_Q (AVRational) { 1, 90000 }
60 #define DVDVIDEO_PTS_WRAP_BITS 32
61 #define DVDVIDEO_LIBDVDX_LOG_BUFFER_SIZE 1024
63 #define PCI_START_BYTE 45
73 "Fullscreen",
"Widescreen",
"Letterbox",
"Pan and Scan"
178 const char *msg, va_list msg_va)
184 vsnprintf(msg_buf,
sizeof(msg_buf), msg, msg_va);
186 if (
level == DVD_LOGGER_LEVEL_ERROR)
188 else if (
level == DVD_LOGGER_LEVEL_WARN)
191 av_log(
s, lavu_level,
"libdvdread: %s\n", msg_buf);
195 const char *msg, va_list msg_va)
201 vsnprintf(msg_buf,
sizeof(msg_buf), msg, msg_va);
203 if (
level == DVDNAV_LOGGER_LEVEL_ERROR)
209 av_log(
s, lavu_level,
"libdvdnav: %s\n", msg_buf);
217 ifoClose(
c->vts_ifo);
220 ifoClose(
c->vmg_ifo);
223 DVDClose(
c->dvdread);
230 dvd_logger_cb dvdread_log_cb;
231 title_info_t title_info;
234 c->dvdread = DVDOpen2(
s, &dvdread_log_cb,
s->url);
242 if (!(
c->vmg_ifo = ifoOpen(
c->dvdread, 0))) {
249 if (
c->opt_menu_vts > 0 && !(
c->vts_ifo = ifoOpen(
c->dvdread,
c->opt_menu_vts))) {
258 if (
c->opt_title >
c->vmg_ifo->tt_srpt->nr_of_srpts) {
264 title_info =
c->vmg_ifo->tt_srpt->title[
c->opt_title - 1];
265 if (
c->opt_angle > title_info.nr_of_angles) {
271 if (title_info.nr_of_ptts < 1) {
277 if (
c->opt_chapter_start > title_info.nr_of_ptts ||
278 (
c->opt_chapter_end > 0 &&
c->opt_chapter_end > title_info.nr_of_ptts)) {
280 c->opt_chapter_start,
c->opt_chapter_end);
285 if (!(
c->vts_ifo = ifoOpen(
c->dvdread, title_info.title_set_nr))) {
287 title_info.title_set_nr);
292 if (title_info.vts_ttn < 1 ||
293 title_info.vts_ttn > 99 ||
294 title_info.vts_ttn >
c->vts_ifo->vts_ptt_srpt->nr_of_srpts ||
295 c->vts_ifo->vtsi_mat->nr_of_vts_audio_streams > 8 ||
296 c->vts_ifo->vtsi_mat->nr_of_vts_subp_streams > 32) {
302 c->nb_angles = title_info.nr_of_angles;
309 dvd_time_t cell_duration = pgc->cell_playback[celln - 1].playback_time;
311 return cell_duration.second >= 1 || cell_duration.minute >= 1 || cell_duration.hour >= 1;
316 for (
int i = 1;
i <= pgc->nr_of_cells;
i++)
326 DVDCloseFile(
state->vob_file);
334 pgci_ut =
c->opt_menu_vts ?
c->vts_ifo->pgci_ut :
c->vmg_ifo->pgci_ut;
337 c->opt_menu_lu,
c->opt_pgc);
342 if (
c->opt_pgc < 1 ||
343 c->opt_menu_lu < 1 ||
344 c->opt_menu_lu > pgci_ut->nr_of_lus ||
345 c->opt_pgc > pgci_ut->lu[
c->opt_menu_lu - 1].pgcit->nr_of_pgci_srp) {
354 state->pgc = pgci_ut->lu[
c->opt_menu_lu - 1].pgcit->pgci_srp[
c->opt_pgc - 1].pgc;
355 if (!
state->pgc || !
state->pgc->program_map || !
state->pgc->cell_playback) {
357 c->opt_menu_lu,
c->opt_pgc);
363 state->entry_pgn =
c->opt_pg;
364 if (
state->entry_pgn < 1 ||
state->entry_pgn >
state->pgc->nr_of_programs) {
374 if (
state->celln_start >
state->pgc->nr_of_cells) {
380 state->sector_end =
state->pgc->cell_playback[
state->celln - 1].last_sector;
381 state->vobu_next =
state->pgc->cell_playback[
state->celln - 1].first_sector;
384 if (
c->opt_menu_vts > 0)
387 if (!(
state->vob_file = DVDOpenFile(
c->dvdread,
c->opt_menu_vts, DVD_READ_MENU_VOBS))) {
389 "Unable to open main menu VOB (VIDEO_TS.VOB)\n" :
390 "Unable to open menu VOBs for VTS %d\n",
c->opt_menu_vts);
399 uint8_t *buf,
int buf_size,
int *p_is_nav_packet)
403 pci_t pci = (pci_t) {0};
404 dsi_t dsi = (dsi_t) {0};
406 (*p_is_nav_packet) = 0;
407 state->ptm_discont = 0;
417 if (!
state->vobu_remaining &&
state->in_pgc) {
418 if (
state->vobu_next == SRI_END_OF_CELL) {
423 state->sector_offset =
state->pgc->cell_playback[
state->celln - 1].first_sector;
424 state->sector_end =
state->pgc->cell_playback[
state->celln - 1].last_sector;
433 blocks_read = DVDReadBlocks(
state->vob_file,
state->sector_offset, 1, read_buf);
434 if (blocks_read != 1) {
436 state->sector_offset, blocks_read);
442 if (!
state->vobu_remaining) {
446 read_buf[DSI_START_BYTE - 1] != 0x01) {
449 state->sector_offset);
455 navRead_DSI(&dsi, &read_buf[DSI_START_BYTE]);
457 if (!pci.pci_gi.vobu_s_ptm ||
458 !pci.pci_gi.vobu_e_ptm ||
459 pci.pci_gi.vobu_s_ptm > pci.pci_gi.vobu_e_ptm) {
462 state->sector_offset);
467 state->vobu_remaining = dsi.dsi_gi.vobu_ea;
468 state->vobu_next = dsi.vobu_sri.next_vobu == SRI_END_OF_CELL ? SRI_END_OF_CELL :
469 dsi.dsi_gi.nv_pck_lbn + (dsi.vobu_sri.next_vobu & 0x7FFFFFFF);
470 state->sector_offset++;
473 if (
state->vobu_e_ptm != pci.pci_gi.vobu_s_ptm) {
474 state->ptm_discont = 1;
475 state->ptm_offset +=
state->vobu_e_ptm - pci.pci_gi.vobu_s_ptm;
482 state->vobu_e_ptm = pci.pci_gi.vobu_e_ptm;
483 state->vobu_duration = pci.pci_gi.vobu_e_ptm - pci.pci_gi.vobu_s_ptm;
486 "vobu_s_ptm=%d vobu_e_ptm=%d ptm_offset=%" PRId64
"\n",
487 dsi.dsi_gi.nv_pck_lbn,
488 pci.pci_gi.vobu_s_ptm, pci.pci_gi.vobu_e_ptm,
state->ptm_offset);
491 (*p_is_nav_packet) = 1;
498 state->sector_offset++;
499 state->vobu_remaining--;
510 if (
state->pgc_pg_times_est)
511 free(
state->pgc_pg_times_est);
513 if (dvdnav_close(
state->dvdnav) != DVDNAV_STATUS_OK)
515 dvdnav_err_to_string(
state->dvdnav));
522 dvdnav_logger_cb dvdnav_log_cb;
523 dvdnav_status_t dvdnav_open_status;
526 int cur_title, cur_pgcn, cur_pgn;
530 dvdnav_open_status = dvdnav_open2(&
state->dvdnav,
s, &dvdnav_log_cb,
s->url);
532 if (!
state->dvdnav ||
533 dvdnav_open_status != DVDNAV_STATUS_OK ||
534 dvdnav_set_readahead_flag(
state->dvdnav, 0) != DVDNAV_STATUS_OK ||
535 dvdnav_set_PGC_positioning_flag(
state->dvdnav, 1) != DVDNAV_STATUS_OK ||
536 dvdnav_get_region_mask(
state->dvdnav, &disc_region_mask) != DVDNAV_STATUS_OK) {
539 goto end_dvdnav_error;
542 player_region_mask =
c->opt_region > 0 ? (1 << (
c->opt_region - 1)) : disc_region_mask;
543 if (dvdnav_set_region_mask(
state->dvdnav, player_region_mask) != DVDNAV_STATUS_OK) {
546 goto end_dvdnav_error;
549 if (
c->opt_pgc > 0) {
550 if (dvdnav_program_play(
state->dvdnav,
c->opt_title,
c->opt_pgc,
c->opt_pg) != DVDNAV_STATUS_OK) {
552 c->opt_title,
c->opt_pgc,
c->opt_pg);
554 goto end_dvdnav_error;
558 state->entry_pgn =
c->opt_pg;
560 if (dvdnav_part_play(
state->dvdnav,
c->opt_title,
c->opt_chapter_start) != DVDNAV_STATUS_OK ||
561 dvdnav_current_title_program(
state->dvdnav, &cur_title, &cur_pgcn, &cur_pgn) != DVDNAV_STATUS_OK) {
564 c->opt_title,
c->opt_chapter_start);
565 goto end_dvdnav_error;
568 state->pgcn = cur_pgcn;
569 state->entry_pgn = cur_pgn;
572 pgc =
c->vts_ifo->vts_pgcit->pgci_srp[
state->pgcn - 1].pgc;
574 if (pgc->pg_playback_mode != 0) {
582 "if you want to try anyway, disable the -trim option\n",
583 c->opt_title,
state->pgcn);
588 if (dvdnav_angle_change(
state->dvdnav,
c->opt_angle) != DVDNAV_STATUS_OK) {
591 goto end_dvdnav_error;
596 state->pgc_nb_pg_est = dvdnav_describe_title_chapters(
state->dvdnav,
c->opt_title,
597 &
state->pgc_pg_times_est,
598 &
state->pgc_duration_est);
601 if (!
state->pgc_nb_pg_est) {
604 goto end_dvdnav_error;
607 state->nav_pts = dvdnav_get_current_time(
state->dvdnav);
608 state->vtsn =
c->vmg_ifo->tt_srpt->title[
c->opt_title - 1].title_set_nr;
623 uint8_t *buf,
int buf_size,
int *p_is_nav_packet)
631 dvdnav_vts_change_event_t *e_vts;
632 dvdnav_cell_change_event_t *e_cell;
633 int cur_title, cur_pgcn, cur_pgn, cur_angle, cur_title_unused, cur_ptt, cur_nb_angles;
637 (*p_is_nav_packet) = 0;
638 state->ptm_discont = 0;
651 if (dvdnav_get_next_block(
state->dvdnav, nav_buf, &nav_event, &nav_len) != DVDNAV_STATUS_OK) {
654 goto end_dvdnav_error;
658 if (nav_event == DVDNAV_STOP)
668 if (dvdnav_current_title_info(
state->dvdnav, &cur_title, &cur_ptt) != DVDNAV_STATUS_OK) {
671 goto end_dvdnav_error;
675 if (cur_title == 0 || !dvdnav_is_domain_vts(
state->dvdnav))
678 if (dvdnav_current_title_program(
state->dvdnav, &cur_title_unused, &cur_pgcn, &cur_pgn) != DVDNAV_STATUS_OK) {
681 goto end_dvdnav_error;
688 if (dvdnav_get_angle_info(
state->dvdnav, &cur_angle, &cur_nb_angles) != DVDNAV_STATUS_OK) {
691 goto end_dvdnav_error;
695 "new block: i=%d nav_event=%d nav_len=%d cur_title=%d "
696 "cur_ptt=%d cur_angle=%d cur_celln=%d cur_pgcn=%d cur_pgn=%d "
697 "play_in_vts=%d play_in_pgc=%d play_in_ps=%d\n",
698 i, nav_event, nav_len, cur_title,
699 cur_ptt, cur_angle,
state->celln, cur_pgcn, cur_pgn,
703 case DVDNAV_VTS_CHANGE:
707 e_vts = (dvdnav_vts_change_event_t *) nav_buf;
709 if (e_vts->new_vtsN ==
state->vtsn && e_vts->new_domain == DVD_DOMAIN_VTSTitle)
713 case DVDNAV_CELL_CHANGE:
717 e_cell = (dvdnav_cell_change_event_t *) nav_buf;
722 if (cur_title ==
c->opt_title &&
723 (
c->opt_pgc || cur_ptt ==
c->opt_chapter_start) &&
724 cur_pgcn ==
state->pgcn &&
725 cur_pgn ==
state->entry_pgn) {
729 }
else if (!
state->is_seeking &&
730 (
state->celln >= e_cell->cellN ||
state->pgn > cur_pgn)) {
734 state->celln = e_cell->cellN;
735 state->ptt = cur_ptt;
736 state->pgn = cur_pgn;
739 case DVDNAV_NAV_PACKET:
744 (
c->opt_chapter_end > 0 && cur_ptt >
c->opt_chapter_end)) {
755 e_pci = dvdnav_get_current_nav_pci(
state->dvdnav);
756 e_dsi = dvdnav_get_current_nav_dsi(
state->dvdnav);
758 if (e_pci ==
NULL || e_dsi ==
NULL ||
759 e_pci->pci_gi.vobu_s_ptm > e_pci->pci_gi.vobu_e_ptm) {
765 if (
state->nb_vobu_skip > 0) {
767 e_dsi->dsi_gi.nv_pck_scr);
768 state->nb_vobu_skip -= 1;
772 state->vobu_duration = e_pci->pci_gi.vobu_e_ptm - e_pci->pci_gi.vobu_s_ptm;
774 state->nav_pts = dvdnav_get_current_time(
state->dvdnav);
775 state->ptt = cur_ptt;
776 state->pgn = cur_pgn;
779 "NAV packet: s_ptm=%d e_ptm=%d "
780 "scr=%d lbn=%d vobu_duration=%d nav_pts=%" PRId64
"\n",
781 e_pci->pci_gi.vobu_s_ptm, e_pci->pci_gi.vobu_e_ptm,
782 e_dsi->dsi_gi.nv_pck_scr,
783 e_pci->pci_gi.nv_pck_lbn,
state->vobu_duration,
state->nav_pts);
797 if (
state->vobu_e_ptm != e_pci->pci_gi.vobu_s_ptm) {
798 state->ptm_discont = 1;
799 state->ptm_offset +=
state->vobu_e_ptm - e_pci->pci_gi.vobu_s_ptm;
803 state->vobu_e_ptm = e_pci->pci_gi.vobu_e_ptm;
805 (*p_is_nav_packet) = 1;
808 case DVDNAV_BLOCK_OK:
822 if (cur_angle !=
c->opt_angle) {
824 c->opt_angle, cur_angle);
829 if (
state->pgn != cur_pgn)
831 "this could be due to a missed NAV packet\n",
832 state->pgn, cur_pgn);
834 memcpy(buf, &nav_buf, nav_len);
836 state->is_seeking = 0;
840 if (dvdnav_wait_skip(
state->dvdnav) != DVDNAV_STATUS_OK) {
843 goto end_dvdnav_error;
847 case DVDNAV_STILL_FRAME:
848 case DVDNAV_HOP_CHANNEL:
849 case DVDNAV_HIGHLIGHT:
853 if (nav_event == DVDNAV_STILL_FRAME) {
854 if (dvdnav_still_skip(
state->dvdnav) != DVDNAV_STATUS_OK) {
857 goto end_dvdnav_error;
873 cur_title, cur_pgcn, cur_pgn,
state->celln,
874 dvdnav_err_to_string(
state->dvdnav));
883 uint64_t time_prev = 0;
886 int chapter_start =
c->opt_chapter_start;
887 int chapter_end =
c->opt_chapter_end > 0 ?
c->opt_chapter_end :
c->play_state.pgc_nb_pg_est;
890 if (
c->play_state.pgc_nb_pg_est == 1 ||
891 chapter_start >
c->play_state.pgc_nb_pg_est ||
892 chapter_end >
c->play_state.pgc_nb_pg_est) {
899 for (
int i = chapter_start - 1;
i < chapter_end;
i++) {
900 uint64_t time_effective =
c->play_state.pgc_pg_times_est[
i] -
c->play_state.nav_pts;
902 if (time_effective - time_prev == 0)
905 if (chapter_start != chapter_end &&
911 time_prev = time_effective;
912 total_duration = time_effective;
915 if (
c->opt_chapter_start == 1 &&
c->opt_chapter_end == 0)
929 int ret, partn, last_partn;
930 int interrupt = 0, nb_chapters = 0;
931 uint64_t cur_chapter_offset = 0, cur_chapter_duration = 0;
937 if (
c->opt_chapter_start ==
c->opt_chapter_end)
943 last_partn =
state.celln;
947 last_partn =
c->opt_chapter_start;
950 if (
state.pgc->nr_of_programs == 1)
954 "Indexing chapter markers, this will take a long time. Please wait...\n");
970 if (partn == last_partn) {
971 cur_chapter_duration +=
state.vobu_duration;
977 if (cur_chapter_duration > 0) {
979 cur_chapter_offset + cur_chapter_duration,
NULL)) {
987 cur_chapter_offset += cur_chapter_duration;
988 cur_chapter_duration =
state.vobu_duration;
1023 int is_pal = video_attr.video_format == 1;
1026 height = is_pal ? 576 : 480;
1029 switch (video_attr.picture_size) {
1048 "this could be an authoring error or empty title "
1049 "(video_format=%d picture_size=%d)\n",
1050 video_attr.video_format, video_attr.picture_size);
1055 entry->startcode = 0x1E0;
1082 #if FF_API_R_FRAME_RATE
1104 video_attr_t video_attr;
1107 video_attr = !
c->opt_menu_vts ?
c->vmg_ifo->vmgi_mat->vmgm_video_attr :
1108 c->vts_ifo->vtsi_mat->vtsm_video_attr;
1110 video_attr =
c->vts_ifo->vtsi_mat->vts_video_attr;
1128 int sample_rate = 0;
1130 int nb_channels = 0;
1132 char lang_dvd[3] = {0};
1134 int position = (audio_control & 0x7F00) >> 8;
1137 switch (audio_attr.audio_format) {
1141 sample_rate = 48000;
1142 startcode = 0x80 + position;
1147 sample_rate = 48000;
1148 bit_depth = audio_attr.quantization ? 20 : 16;
1149 startcode = 0x1C0 + position;
1154 sample_rate = 48000;
1155 bit_depth = audio_attr.quantization ? 20 : 16;
1156 startcode = 0x1C0 + position;
1161 sample_rate = audio_attr.sample_frequency ? 96000 : 48000;
1162 bit_depth = audio_attr.quantization == 2 ? 24 : (audio_attr.quantization ? 20 : 16);
1163 startcode = 0xA0 + position;
1168 sample_rate = 48000;
1169 bit_depth = audio_attr.quantization == 2 ? 24 : (audio_attr.quantization ? 20 : 16);
1170 startcode = 0x88 + position;
1174 nb_channels = audio_attr.channels + 1;
1183 "this could be an authoring error or dummy title "
1184 "(stream position %d in IFO)\n", position);
1188 if (nb_channels == 1)
1190 else if (nb_channels == 2)
1192 else if (nb_channels == 6)
1194 else if (nb_channels == 7)
1196 else if (nb_channels == 8)
1200 if (audio_attr.application_mode == 1) {
1204 "(stream id=%d)\n", startcode);
1207 if (audio_attr.code_extension == 2)
1209 if (audio_attr.code_extension == 3 || audio_attr.code_extension == 4)
1212 AV_WB16(lang_dvd, audio_attr.lang_code);
1214 entry->startcode = startcode;
1216 entry->sample_rate = sample_rate;
1218 entry->nb_channels = nb_channels;
1219 entry->ch_layout = ch_layout;
1245 if (
entry->lang_iso)
1266 nb_streams = !
c->opt_menu_vts ?
c->vmg_ifo->vmgi_mat->nr_of_vmgm_audio_streams :
1267 c->vts_ifo->vtsi_mat->nr_of_vtsm_audio_streams;
1269 nb_streams =
c->vts_ifo->vtsi_mat->nr_of_vts_audio_streams;
1273 audio_attr_t audio_attr;
1276 audio_attr = !
c->opt_menu_vts ?
c->vmg_ifo->vmgi_mat->vmgm_audio_attr :
1277 c->vts_ifo->vtsi_mat->vtsm_audio_attr;
1279 audio_attr =
c->vts_ifo->vtsi_mat->vts_audio_attr[
i];
1281 if (!(
c->play_state.pgc->audio_control[
i] & 0x8000))
1289 for (
int j = 0; j <
s->nb_streams; j++)
1290 if (
s->streams[j]->id ==
entry.startcode)
1312 char lang_dvd[3] = {0};
1316 if (subp_attr.lang_extension == 9)
1327 AV_WB16(lang_dvd, subp_attr.lang_code);
1350 if (
entry->lang_iso)
1368 subp_attr_t subp_attr,
1374 entry.viewport = viewport;
1380 for (
int i = 0;
i <
s->nb_streams;
i++)
1381 if (
s->streams[
i]->id ==
entry.startcode)
1401 nb_streams = !
c->opt_menu_vts ?
c->vmg_ifo->vmgi_mat->nr_of_vmgm_subp_streams :
1402 c->vts_ifo->vtsi_mat->nr_of_vtsm_subp_streams;
1404 nb_streams =
c->vts_ifo->vtsi_mat->nr_of_vts_subp_streams;
1409 uint32_t subp_control;
1410 subp_attr_t subp_attr;
1411 video_attr_t video_attr;
1413 subp_control =
c->play_state.pgc->subp_control[
i];
1414 if (!(subp_control & 0x80000000))
1420 video_attr = !
c->opt_menu_vts ?
c->vmg_ifo->vmgi_mat->vmgm_video_attr :
1421 c->vts_ifo->vtsi_mat->vtsm_video_attr;
1423 subp_attr = !
c->opt_menu_vts ?
c->vmg_ifo->vmgi_mat->vmgm_subp_attr :
1424 c->vts_ifo->vtsi_mat->vtsm_subp_attr;
1426 video_attr =
c->vts_ifo->vtsi_mat->vts_video_attr;
1427 subp_attr =
c->vts_ifo->vtsi_mat->vts_subp_attr[
i];
1431 if (!video_attr.display_aspect_ratio) {
1445 if (video_attr.permitted_df == 2 || video_attr.permitted_df == 0)
1451 if (video_attr.permitted_df == 1 || video_attr.permitted_df == 0)
1476 if (is_nav_packet) {
1477 if (
c->play_state.ptm_discont) {
1478 c->subdemux_reset = 1;
1490 c->mpeg_pb.pub.eof_reached = 1;
1491 c->mpeg_pb.pub.error =
ret;
1492 c->mpeg_pb.pub.read_packet =
NULL;
1493 c->mpeg_pb.pub.buf_end =
c->mpeg_pb.pub.buf_ptr =
c->mpeg_pb.pub.buffer;
1517 c->mpeg_pb.pub.seekable = 0;
1531 c->mpeg_ctx->probesize = 0;
1532 c->mpeg_ctx->max_analyze_duration = 0;
1533 c->mpeg_ctx->interrupt_callback =
s->interrupt_callback;
1534 c->mpeg_ctx->pb = &
c->mpeg_pb.pub;
1535 c->mpeg_ctx->io_open =
NULL;
1560 if (
c->opt_region ||
1562 c->opt_chapter_start > 1 ||
1563 c->opt_chapter_end > 0) {
1565 "or -chapter_start/-chapter_end options\n");
1586 if (
c->opt_pgc && (
c->opt_chapter_start > 1 ||
c->opt_chapter_end > 0 ||
c->opt_preindex)) {
1587 av_log(
s,
AV_LOG_ERROR,
"PGC extraction not compatible with chapter or preindex options\n");
1592 if (!
c->opt_pgc && (
c->opt_chapter_end != 0 &&
c->opt_chapter_start >
c->opt_chapter_end)) {
1594 c->opt_chapter_start,
c->opt_chapter_end);
1599 if (
c->opt_title == 0) {
1601 "This is not always the main feature, validation suggested.\n");
1625 for (
int i = 0;
i <
s->nb_streams;
i++)
1639 uint8_t ac3_bitstream_id;
1640 uint16_t ac3_frame_size;
1645 c->subdemux_reset = 0;
1646 c->pts_offset =
c->play_state.ptm_offset;
1661 for (
int i = 0;
i <
s->nb_streams;
i++) {
1662 if (
s->streams[
i]->id == st_subdemux->
id) {
1673 if (!
c->play_started) {
1679 c->play_started = 1;
1682 pkt->
pts +=
c->pts_offset -
c->first_pts;
1683 pkt->
dts +=
c->pts_offset -
c->first_pts;
1696 &ac3_bitstream_id, &ac3_frame_size);
1698 if (ret < 0 || pkt->
size != ac3_frame_size)
1703 "pts_offset=%" PRId64
" first_pts=%" PRId64
"\n",
1705 c->pts_offset,
c->first_pts);
1713 "Discarding frame @ st=%d pts=%" PRId64
" dts=%" PRId64
" is_key=%d st_mapped=%d\n",
1748 int seek_failed = 0;
1750 if (
c->opt_menu ||
c->opt_chapter_start > 1) {
1759 if (timestamp < 0 || timestamp >
s->duration)
1762 if (!
c->seek_warned) {
1764 "in imprecise timecodes from this point\n");
1769 if (
c->nb_angles > 1) {
1770 if (dvdnav_angle_change(
c->play_state.dvdnav, 1) != DVDNAV_STATUS_OK) {
1779 if (dvdnav_time_search(
c->play_state.dvdnav, timestamp) != DVDNAV_STATUS_OK) {
1783 if (
c->nb_angles > 1) {
1784 if (dvdnav_angle_change(
c->play_state.dvdnav,
c->opt_angle) != DVDNAV_STATUS_OK) {
1797 new_nav_pts = dvdnav_get_current_time (
c->play_state.dvdnav);
1798 new_nav_pci = dvdnav_get_current_nav_pci(
c->play_state.dvdnav);
1799 new_nav_dsi = dvdnav_get_current_nav_dsi(
c->play_state.dvdnav);
1801 if (new_nav_pci ==
NULL || new_nav_dsi ==
NULL) {
1807 c->play_state.in_pgc = 1;
1808 c->play_state.in_ps = 0;
1809 c->play_state.is_seeking = 1;
1810 c->play_state.nav_pts = timestamp;
1811 c->play_state.ptm_offset = timestamp;
1812 c->play_state.ptm_discont = 0;
1813 c->play_state.vobu_e_ptm = new_nav_pci->pci_gi.vobu_s_ptm;
1816 c->play_state.nb_vobu_skip =
c->nb_angles > 1 ? 3 : 0;
1819 c->play_started = 0;
1820 c->pts_offset = timestamp;
1821 c->subdemux_reset = 0;
1826 av_log(
s,
AV_LOG_DEBUG,
"seeking: requested_nav_pts=%" PRId64
" new_nav_pts=%" PRId64
"\n",
1827 timestamp, new_nav_pts);
1832 #define OFFSET(x) offsetof(DVDVideoDemuxContext, x)
1857 .
p.
name =
"dvdvideo",