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"
177 const char *msg, va_list msg_va)
183 vsnprintf(msg_buf,
sizeof(msg_buf), msg, msg_va);
185 if (
level == DVD_LOGGER_LEVEL_ERROR)
187 else if (
level == DVD_LOGGER_LEVEL_WARN)
190 av_log(
s, lavu_level,
"libdvdread: %s\n", msg_buf);
194 const char *msg, va_list msg_va)
200 vsnprintf(msg_buf,
sizeof(msg_buf), msg, msg_va);
202 if (
level == DVDNAV_LOGGER_LEVEL_ERROR)
208 av_log(
s, lavu_level,
"libdvdnav: %s\n", msg_buf);
216 ifoClose(
c->vts_ifo);
219 ifoClose(
c->vmg_ifo);
222 DVDClose(
c->dvdread);
229 dvd_logger_cb dvdread_log_cb;
230 title_info_t title_info;
233 c->dvdread = DVDOpen2(
s, &dvdread_log_cb,
s->url);
241 if (!(
c->vmg_ifo = ifoOpen(
c->dvdread, 0))) {
248 if (
c->opt_menu_vts > 0 && !(
c->vts_ifo = ifoOpen(
c->dvdread,
c->opt_menu_vts))) {
257 if (
c->opt_title >
c->vmg_ifo->tt_srpt->nr_of_srpts) {
263 title_info =
c->vmg_ifo->tt_srpt->title[
c->opt_title - 1];
264 if (
c->opt_angle > title_info.nr_of_angles) {
270 if (title_info.nr_of_ptts < 1) {
276 if (
c->opt_chapter_start > title_info.nr_of_ptts ||
277 (
c->opt_chapter_end > 0 &&
c->opt_chapter_end > title_info.nr_of_ptts)) {
279 c->opt_chapter_start,
c->opt_chapter_end);
284 if (!(
c->vts_ifo = ifoOpen(
c->dvdread, title_info.title_set_nr))) {
286 title_info.title_set_nr);
291 if (title_info.vts_ttn < 1 ||
292 title_info.vts_ttn > 99 ||
293 title_info.vts_ttn >
c->vts_ifo->vts_ptt_srpt->nr_of_srpts ||
294 c->vts_ifo->vtsi_mat->nr_of_vts_audio_streams > 8 ||
295 c->vts_ifo->vtsi_mat->nr_of_vts_subp_streams > 32) {
306 dvd_time_t cell_duration = pgc->cell_playback[celln - 1].playback_time;
308 return cell_duration.second >= 1 || cell_duration.minute >= 1 || cell_duration.hour >= 1;
313 for (
int i = 1;
i <= pgc->nr_of_cells;
i++)
323 DVDCloseFile(
state->vob_file);
331 pgci_ut =
c->opt_menu_vts ?
c->vts_ifo->pgci_ut :
c->vmg_ifo->pgci_ut;
334 c->opt_menu_lu,
c->opt_pgc);
339 if (
c->opt_pgc < 1 ||
340 c->opt_menu_lu < 1 ||
341 c->opt_menu_lu > pgci_ut->nr_of_lus ||
342 c->opt_pgc > pgci_ut->lu[
c->opt_menu_lu - 1].pgcit->nr_of_pgci_srp) {
351 state->pgc = pgci_ut->lu[
c->opt_menu_lu - 1].pgcit->pgci_srp[
c->opt_pgc - 1].pgc;
352 if (!
state->pgc || !
state->pgc->program_map || !
state->pgc->cell_playback) {
354 c->opt_menu_lu,
c->opt_pgc);
360 state->entry_pgn =
c->opt_pg;
361 if (
state->entry_pgn < 1 ||
state->entry_pgn >
state->pgc->nr_of_programs) {
371 if (
state->celln_start >
state->pgc->nr_of_cells) {
377 state->sector_end =
state->pgc->cell_playback[
state->celln - 1].last_sector;
378 state->vobu_next =
state->pgc->cell_playback[
state->celln - 1].first_sector;
381 if (
c->opt_menu_vts > 0)
384 if (!(
state->vob_file = DVDOpenFile(
c->dvdread,
c->opt_menu_vts, DVD_READ_MENU_VOBS))) {
386 "Unable to open main menu VOB (VIDEO_TS.VOB)\n" :
387 "Unable to open menu VOBs for VTS %d\n",
c->opt_menu_vts);
396 uint8_t *buf,
int buf_size,
int *p_is_nav_packet)
400 pci_t pci = (pci_t) {0};
401 dsi_t dsi = (dsi_t) {0};
403 (*p_is_nav_packet) = 0;
404 state->ptm_discont = 0;
414 if (!
state->vobu_remaining &&
state->in_pgc) {
415 if (
state->vobu_next == SRI_END_OF_CELL) {
420 state->sector_offset =
state->pgc->cell_playback[
state->celln - 1].first_sector;
421 state->sector_end =
state->pgc->cell_playback[
state->celln - 1].last_sector;
430 blocks_read = DVDReadBlocks(
state->vob_file,
state->sector_offset, 1, read_buf);
431 if (blocks_read != 1) {
433 state->sector_offset, blocks_read);
439 if (!
state->vobu_remaining) {
443 read_buf[DSI_START_BYTE - 1] != 0x01) {
446 state->sector_offset);
452 navRead_DSI(&dsi, &read_buf[DSI_START_BYTE]);
454 if (!pci.pci_gi.vobu_s_ptm ||
455 !pci.pci_gi.vobu_e_ptm ||
456 pci.pci_gi.vobu_s_ptm > pci.pci_gi.vobu_e_ptm) {
459 state->sector_offset);
464 state->vobu_remaining = dsi.dsi_gi.vobu_ea;
465 state->vobu_next = dsi.vobu_sri.next_vobu == SRI_END_OF_CELL ? SRI_END_OF_CELL :
466 dsi.dsi_gi.nv_pck_lbn + (dsi.vobu_sri.next_vobu & 0x7FFFFFFF);
467 state->sector_offset++;
470 if (
state->vobu_e_ptm != pci.pci_gi.vobu_s_ptm) {
471 state->ptm_discont = 1;
472 state->ptm_offset +=
state->vobu_e_ptm - pci.pci_gi.vobu_s_ptm;
479 state->vobu_e_ptm = pci.pci_gi.vobu_e_ptm;
480 state->vobu_duration = pci.pci_gi.vobu_e_ptm - pci.pci_gi.vobu_s_ptm;
483 "vobu_s_ptm=%d vobu_e_ptm=%d ptm_offset=%" PRId64
"\n",
484 dsi.dsi_gi.nv_pck_lbn,
485 pci.pci_gi.vobu_s_ptm, pci.pci_gi.vobu_e_ptm,
state->ptm_offset);
488 (*p_is_nav_packet) = 1;
495 state->sector_offset++;
496 state->vobu_remaining--;
507 if (
state->pgc_pg_times_est)
508 free(
state->pgc_pg_times_est);
510 if (dvdnav_close(
state->dvdnav) != DVDNAV_STATUS_OK)
512 dvdnav_err_to_string(
state->dvdnav));
519 dvdnav_logger_cb dvdnav_log_cb;
520 dvdnav_status_t dvdnav_open_status;
523 int cur_title, cur_pgcn, cur_pgn;
527 dvdnav_open_status = dvdnav_open2(&
state->dvdnav,
s, &dvdnav_log_cb,
s->url);
529 if (!
state->dvdnav ||
530 dvdnav_open_status != DVDNAV_STATUS_OK ||
531 dvdnav_set_readahead_flag(
state->dvdnav, 0) != DVDNAV_STATUS_OK ||
532 dvdnav_set_PGC_positioning_flag(
state->dvdnav, 1) != DVDNAV_STATUS_OK ||
533 dvdnav_get_region_mask(
state->dvdnav, &disc_region_mask) != DVDNAV_STATUS_OK) {
536 goto end_dvdnav_error;
539 player_region_mask =
c->opt_region > 0 ? (1 << (
c->opt_region - 1)) : disc_region_mask;
540 if (dvdnav_set_region_mask(
state->dvdnav, player_region_mask) != DVDNAV_STATUS_OK) {
543 goto end_dvdnav_error;
546 if (
c->opt_pgc > 0) {
547 if (dvdnav_program_play(
state->dvdnav,
c->opt_title,
c->opt_pgc,
c->opt_pg) != DVDNAV_STATUS_OK) {
549 c->opt_title,
c->opt_pgc,
c->opt_pg);
551 goto end_dvdnav_error;
555 state->entry_pgn =
c->opt_pg;
557 if (dvdnav_part_play(
state->dvdnav,
c->opt_title,
c->opt_chapter_start) != DVDNAV_STATUS_OK ||
558 dvdnav_current_title_program(
state->dvdnav, &cur_title, &cur_pgcn, &cur_pgn) != DVDNAV_STATUS_OK) {
561 c->opt_title,
c->opt_chapter_start);
562 goto end_dvdnav_error;
565 state->pgcn = cur_pgcn;
566 state->entry_pgn = cur_pgn;
569 pgc =
c->vts_ifo->vts_pgcit->pgci_srp[
state->pgcn - 1].pgc;
571 if (pgc->pg_playback_mode != 0) {
579 "if you want to try anyway, disable the -trim option\n",
580 c->opt_title,
state->pgcn);
585 if (dvdnav_angle_change(
state->dvdnav,
c->opt_angle) != DVDNAV_STATUS_OK) {
588 goto end_dvdnav_error;
593 state->pgc_nb_pg_est = dvdnav_describe_title_chapters(
state->dvdnav,
c->opt_title,
594 &
state->pgc_pg_times_est,
595 &
state->pgc_duration_est);
598 if (!
state->pgc_nb_pg_est) {
601 goto end_dvdnav_error;
604 state->nav_pts = dvdnav_get_current_time(
state->dvdnav);
605 state->vtsn =
c->vmg_ifo->tt_srpt->title[
c->opt_title - 1].title_set_nr;
620 uint8_t *buf,
int buf_size,
int *p_is_nav_packet)
628 dvdnav_vts_change_event_t *e_vts;
629 dvdnav_cell_change_event_t *e_cell;
630 int cur_title, cur_pgcn, cur_pgn, cur_angle, cur_title_unused, cur_ptt, cur_nb_angles;
634 (*p_is_nav_packet) = 0;
635 state->ptm_discont = 0;
648 if (dvdnav_get_next_block(
state->dvdnav, nav_buf, &nav_event, &nav_len) != DVDNAV_STATUS_OK) {
651 goto end_dvdnav_error;
655 if (nav_event == DVDNAV_STOP)
665 if (dvdnav_current_title_info(
state->dvdnav, &cur_title, &cur_ptt) != DVDNAV_STATUS_OK) {
668 goto end_dvdnav_error;
672 if (cur_title == 0 || !dvdnav_is_domain_vts(
state->dvdnav))
675 if (dvdnav_current_title_program(
state->dvdnav, &cur_title_unused, &cur_pgcn, &cur_pgn) != DVDNAV_STATUS_OK) {
678 goto end_dvdnav_error;
685 if (dvdnav_get_angle_info(
state->dvdnav, &cur_angle, &cur_nb_angles) != DVDNAV_STATUS_OK) {
688 goto end_dvdnav_error;
692 "new block: i=%d nav_event=%d nav_len=%d cur_title=%d "
693 "cur_ptt=%d cur_angle=%d cur_celln=%d cur_pgcn=%d cur_pgn=%d "
694 "play_in_vts=%d play_in_pgc=%d play_in_ps=%d\n",
695 i, nav_event, nav_len, cur_title,
696 cur_ptt, cur_angle,
state->celln, cur_pgcn, cur_pgn,
700 case DVDNAV_VTS_CHANGE:
704 e_vts = (dvdnav_vts_change_event_t *) nav_buf;
706 if (e_vts->new_vtsN ==
state->vtsn && e_vts->new_domain == DVD_DOMAIN_VTSTitle)
710 case DVDNAV_CELL_CHANGE:
714 e_cell = (dvdnav_cell_change_event_t *) nav_buf;
719 if (cur_title ==
c->opt_title &&
720 (
c->opt_pgc || cur_ptt ==
c->opt_chapter_start) &&
721 cur_pgcn ==
state->pgcn &&
722 cur_pgn ==
state->entry_pgn) {
726 }
else if (!
state->is_seeking &&
727 (
state->celln >= e_cell->cellN ||
state->pgn > cur_pgn)) {
731 state->celln = e_cell->cellN;
732 state->ptt = cur_ptt;
733 state->pgn = cur_pgn;
736 case DVDNAV_NAV_PACKET:
741 (
c->opt_chapter_end > 0 && cur_ptt >
c->opt_chapter_end)) {
752 e_pci = dvdnav_get_current_nav_pci(
state->dvdnav);
753 e_dsi = dvdnav_get_current_nav_dsi(
state->dvdnav);
755 if (e_pci ==
NULL || e_dsi ==
NULL ||
756 e_pci->pci_gi.vobu_s_ptm > e_pci->pci_gi.vobu_e_ptm) {
762 state->vobu_duration = e_pci->pci_gi.vobu_e_ptm - e_pci->pci_gi.vobu_s_ptm;
764 state->nav_pts = dvdnav_get_current_time(
state->dvdnav);
765 state->ptt = cur_ptt;
766 state->pgn = cur_pgn;
769 "NAV packet: s_ptm=%d e_ptm=%d "
770 "scr=%d lbn=%d vobu_duration=%d nav_pts=%" PRId64
"\n",
771 e_pci->pci_gi.vobu_s_ptm, e_pci->pci_gi.vobu_e_ptm,
772 e_dsi->dsi_gi.nv_pck_scr,
773 e_pci->pci_gi.nv_pck_lbn,
state->vobu_duration,
state->nav_pts);
787 if (
state->vobu_e_ptm != e_pci->pci_gi.vobu_s_ptm) {
788 state->ptm_discont = 1;
789 state->ptm_offset +=
state->vobu_e_ptm - e_pci->pci_gi.vobu_s_ptm;
793 state->vobu_e_ptm = e_pci->pci_gi.vobu_e_ptm;
795 (*p_is_nav_packet) = 1;
798 case DVDNAV_BLOCK_OK:
812 if (cur_angle !=
c->opt_angle) {
814 c->opt_angle, cur_angle);
819 if (
state->pgn != cur_pgn)
821 "this could be due to a missed NAV packet\n",
822 state->pgn, cur_pgn);
824 memcpy(buf, &nav_buf, nav_len);
826 state->is_seeking = 0;
830 if (dvdnav_wait_skip(
state->dvdnav) != DVDNAV_STATUS_OK) {
833 goto end_dvdnav_error;
837 case DVDNAV_STILL_FRAME:
838 case DVDNAV_HOP_CHANNEL:
839 case DVDNAV_HIGHLIGHT:
843 if (nav_event == DVDNAV_STILL_FRAME) {
844 if (dvdnav_still_skip(
state->dvdnav) != DVDNAV_STATUS_OK) {
847 goto end_dvdnav_error;
863 cur_title, cur_pgcn, cur_pgn,
state->celln,
864 dvdnav_err_to_string(
state->dvdnav));
873 uint64_t time_prev = 0;
876 int chapter_start =
c->opt_chapter_start;
877 int chapter_end =
c->opt_chapter_end > 0 ?
c->opt_chapter_end :
c->play_state.pgc_nb_pg_est;
880 if (
c->play_state.pgc_nb_pg_est == 1 ||
881 chapter_start >
c->play_state.pgc_nb_pg_est ||
882 chapter_end >
c->play_state.pgc_nb_pg_est) {
889 for (
int i = chapter_start - 1;
i < chapter_end;
i++) {
890 uint64_t time_effective =
c->play_state.pgc_pg_times_est[
i] -
c->play_state.nav_pts;
892 if (time_effective - time_prev == 0)
895 if (chapter_start != chapter_end &&
901 time_prev = time_effective;
902 total_duration = time_effective;
905 if (
c->opt_chapter_start == 1 &&
c->opt_chapter_end == 0)
919 int ret, partn, last_partn;
920 int interrupt = 0, nb_chapters = 0;
921 uint64_t cur_chapter_offset = 0, cur_chapter_duration = 0;
927 if (
c->opt_chapter_start ==
c->opt_chapter_end)
933 last_partn =
state.celln;
937 last_partn =
c->opt_chapter_start;
940 if (
state.pgc->nr_of_programs == 1)
944 "Indexing chapter markers, this will take a long time. Please wait...\n");
960 if (partn == last_partn) {
961 cur_chapter_duration +=
state.vobu_duration;
967 if (cur_chapter_duration > 0) {
969 cur_chapter_offset + cur_chapter_duration,
NULL)) {
977 cur_chapter_offset += cur_chapter_duration;
978 cur_chapter_duration =
state.vobu_duration;
1013 int is_pal = video_attr.video_format == 1;
1016 height = is_pal ? 576 : 480;
1019 switch (video_attr.picture_size) {
1038 "this could be an authoring error or empty title "
1039 "(video_format=%d picture_size=%d)\n",
1040 video_attr.video_format, video_attr.picture_size);
1045 entry->startcode = 0x1E0;
1051 entry->has_cc = !is_pal && (video_attr.line21_cc_1 || video_attr.line21_cc_2);
1073 #if FF_API_R_FRAME_RATE
1095 video_attr_t video_attr;
1098 video_attr = !
c->opt_menu_vts ?
c->vmg_ifo->vmgi_mat->vmgm_video_attr :
1099 c->vts_ifo->vtsi_mat->vtsm_video_attr;
1101 video_attr =
c->vts_ifo->vtsi_mat->vts_video_attr;
1119 int sample_rate = 0;
1121 int nb_channels = 0;
1123 char lang_dvd[3] = {0};
1125 int position = (audio_control & 0x7F00) >> 8;
1128 switch (audio_attr.audio_format) {
1132 sample_rate = 48000;
1133 startcode = 0x80 + position;
1138 sample_rate = 48000;
1139 bit_depth = audio_attr.quantization ? 20 : 16;
1140 startcode = 0x1C0 + position;
1145 sample_rate = 48000;
1146 bit_depth = audio_attr.quantization ? 20 : 16;
1147 startcode = 0x1C0 + position;
1152 sample_rate = audio_attr.sample_frequency ? 96000 : 48000;
1153 bit_depth = audio_attr.quantization == 2 ? 24 : (audio_attr.quantization ? 20 : 16);
1154 startcode = 0xA0 + position;
1159 sample_rate = 48000;
1160 bit_depth = audio_attr.quantization == 2 ? 24 : (audio_attr.quantization ? 20 : 16);
1161 startcode = 0x88 + position;
1165 nb_channels = audio_attr.channels + 1;
1174 "this could be an authoring error or dummy title "
1175 "(stream position %d in IFO)\n", position);
1179 if (nb_channels == 1)
1181 else if (nb_channels == 2)
1183 else if (nb_channels == 6)
1185 else if (nb_channels == 7)
1187 else if (nb_channels == 8)
1191 if (audio_attr.application_mode == 1) {
1195 "(stream id=%d)\n", startcode);
1198 if (audio_attr.code_extension == 2)
1200 if (audio_attr.code_extension == 3 || audio_attr.code_extension == 4)
1203 AV_WB16(lang_dvd, audio_attr.lang_code);
1205 entry->startcode = startcode;
1207 entry->sample_rate = sample_rate;
1209 entry->nb_channels = nb_channels;
1210 entry->ch_layout = ch_layout;
1236 if (
entry->lang_iso)
1257 nb_streams = !
c->opt_menu_vts ?
c->vmg_ifo->vmgi_mat->nr_of_vmgm_audio_streams :
1258 c->vts_ifo->vtsi_mat->nr_of_vtsm_audio_streams;
1260 nb_streams =
c->vts_ifo->vtsi_mat->nr_of_vts_audio_streams;
1264 audio_attr_t audio_attr;
1267 audio_attr = !
c->opt_menu_vts ?
c->vmg_ifo->vmgi_mat->vmgm_audio_attr :
1268 c->vts_ifo->vtsi_mat->vtsm_audio_attr;
1270 audio_attr =
c->vts_ifo->vtsi_mat->vts_audio_attr[
i];
1272 if (!(
c->play_state.pgc->audio_control[
i] & 0x8000))
1280 for (
int j = 0; j <
s->nb_streams; j++)
1281 if (
s->streams[j]->id ==
entry.startcode)
1303 char lang_dvd[3] = {0};
1307 if (subp_attr.lang_extension == 9)
1318 AV_WB16(lang_dvd, subp_attr.lang_code);
1341 if (
entry->lang_iso)
1359 subp_attr_t subp_attr,
1365 entry.viewport = viewport;
1371 for (
int i = 0;
i <
s->nb_streams;
i++)
1372 if (
s->streams[
i]->id ==
entry.startcode)
1392 nb_streams = !
c->opt_menu_vts ?
c->vmg_ifo->vmgi_mat->nr_of_vmgm_subp_streams :
1393 c->vts_ifo->vtsi_mat->nr_of_vtsm_subp_streams;
1395 nb_streams =
c->vts_ifo->vtsi_mat->nr_of_vts_subp_streams;
1400 uint32_t subp_control;
1401 subp_attr_t subp_attr;
1402 video_attr_t video_attr;
1404 subp_control =
c->play_state.pgc->subp_control[
i];
1405 if (!(subp_control & 0x80000000))
1411 video_attr = !
c->opt_menu_vts ?
c->vmg_ifo->vmgi_mat->vmgm_video_attr :
1412 c->vts_ifo->vtsi_mat->vtsm_video_attr;
1414 subp_attr = !
c->opt_menu_vts ?
c->vmg_ifo->vmgi_mat->vmgm_subp_attr :
1415 c->vts_ifo->vtsi_mat->vtsm_subp_attr;
1417 video_attr =
c->vts_ifo->vtsi_mat->vts_video_attr;
1418 subp_attr =
c->vts_ifo->vtsi_mat->vts_subp_attr[
i];
1422 if (!video_attr.display_aspect_ratio) {
1436 if (video_attr.permitted_df == 2 || video_attr.permitted_df == 0)
1442 if (video_attr.permitted_df == 1 || video_attr.permitted_df == 0)
1467 if (is_nav_packet) {
1468 if (
c->play_state.ptm_discont) {
1469 c->subdemux_reset = 1;
1481 c->mpeg_pb.pub.eof_reached = 1;
1482 c->mpeg_pb.pub.error =
ret;
1483 c->mpeg_pb.pub.read_packet =
NULL;
1484 c->mpeg_pb.pub.buf_end =
c->mpeg_pb.pub.buf_ptr =
c->mpeg_pb.pub.buffer;
1508 c->mpeg_pb.pub.seekable = 0;
1522 c->mpeg_ctx->probesize = 0;
1523 c->mpeg_ctx->max_analyze_duration = 0;
1524 c->mpeg_ctx->interrupt_callback =
s->interrupt_callback;
1525 c->mpeg_ctx->pb = &
c->mpeg_pb.pub;
1526 c->mpeg_ctx->io_open =
NULL;
1551 if (
c->opt_region ||
1553 c->opt_chapter_start > 1 ||
1554 c->opt_chapter_end > 0) {
1556 "or -chapter_start/-chapter_end options\n");
1577 if (
c->opt_pgc && (
c->opt_chapter_start > 1 ||
c->opt_chapter_end > 0 ||
c->opt_preindex)) {
1578 av_log(
s,
AV_LOG_ERROR,
"PGC extraction not compatible with chapter or preindex options\n");
1583 if (!
c->opt_pgc && (
c->opt_chapter_end != 0 &&
c->opt_chapter_start >
c->opt_chapter_end)) {
1585 c->opt_chapter_start,
c->opt_chapter_end);
1590 if (
c->opt_title == 0) {
1592 "This is not always the main feature, validation suggested.\n");
1616 for (
int i = 0;
i <
s->nb_streams;
i++)
1630 uint8_t ac3_bitstream_id;
1631 uint16_t ac3_frame_size;
1636 c->subdemux_reset = 0;
1637 c->pts_offset =
c->play_state.ptm_offset;
1652 for (
int i = 0;
i <
s->nb_streams;
i++) {
1653 if (
s->streams[
i]->id == st_subdemux->
id) {
1664 if (!
c->play_started) {
1670 c->play_started = 1;
1673 pkt->
pts +=
c->pts_offset -
c->first_pts;
1674 pkt->
dts +=
c->pts_offset -
c->first_pts;
1687 &ac3_bitstream_id, &ac3_frame_size);
1689 if (ret < 0 || pkt->
size != ac3_frame_size)
1694 "pts_offset=%" PRId64
" first_pts=%" PRId64
"\n",
1696 c->pts_offset,
c->first_pts);
1704 "Discarding frame @ st=%d pts=%" PRId64
" dts=%" PRId64
" is_key=%d st_mapped=%d\n",
1740 if (
c->opt_menu ||
c->opt_chapter_start > 1) {
1749 if (timestamp < 0 || timestamp >
s->duration)
1752 if (!
c->seek_warned) {
1754 "in imprecise timecodes from this point\n");
1760 if (dvdnav_time_search(
c->play_state.dvdnav, timestamp) != DVDNAV_STATUS_OK) {
1766 new_nav_pts = dvdnav_get_current_time (
c->play_state.dvdnav);
1767 new_nav_pci = dvdnav_get_current_nav_pci(
c->play_state.dvdnav);
1768 new_nav_dsi = dvdnav_get_current_nav_dsi(
c->play_state.dvdnav);
1770 if (new_nav_pci ==
NULL || new_nav_dsi ==
NULL) {
1776 c->play_state.in_pgc = 1;
1777 c->play_state.in_ps = 0;
1778 c->play_state.is_seeking = 1;
1779 c->play_state.nav_pts = timestamp;
1780 c->play_state.ptm_offset = timestamp;
1781 c->play_state.ptm_discont = 0;
1782 c->play_state.vobu_e_ptm = new_nav_pci->pci_gi.vobu_s_ptm;
1785 c->play_started = 0;
1786 c->pts_offset = timestamp;
1787 c->subdemux_reset = 0;
1792 av_log(
s,
AV_LOG_DEBUG,
"seeking: requested_nav_pts=%" PRId64
" new_nav_pts=%" PRId64
"\n",
1793 timestamp, new_nav_pts);
1798 #define OFFSET(x) offsetof(DVDVideoDemuxContext, x)
1823 .
p.
name =
"dvdvideo",