static void list_chapters(stream_t *stream, ifo_handle_t *vts_file, tt_srpt_t *tt_srpt, int title_no) { MP_INFO(stream, "CHAPTERS: "); for (int n = 0; ; n++) { double p = n; int r; r = get_chapter_time(vts_file, tt_srpt, title_no, &p); if (!r) break; int t = p * 1000; MP_INFO(stream, "%02d:%02d:%02d.%03d,", t/3600000, (t/60000)%60, (t/1000)%60, t%1000); } MP_INFO(stream, "\n"); }
static void list_chapters(ifo_handle_t *vts_file, tt_srpt_t *tt_srpt, int title_no) { mp_msg(MSGT_IDENTIFY, MSGL_INFO, "CHAPTERS: "); for (int n = 0; ; n++) { double p = n; int r; r = get_chapter_time(vts_file, tt_srpt, title_no, &p); if (!r) break; int t = p * 1000; mp_msg(MSGT_IDENTIFY, MSGL_INFO, "%02d:%02d:%02d.%03d,", t/3600000, (t/60000)%60, (t/1000)%60, t%1000); } mp_msg(MSGT_IDENTIFY, MSGL_INFO, "\n"); }
static int control(stream_t *stream,int cmd,void* arg) { dvd_priv_t *d = stream->priv; switch(cmd) { case STREAM_CTRL_GET_TIME_LENGTH: { *((double *)arg) = (double) mp_get_titleset_length(d->vts_file, d->tt_srpt, d->cur_title)/1000.0; return 1; } case STREAM_CTRL_GET_START_TIME: { *((double *)arg) = 0; return 1; } case STREAM_CTRL_GET_NUM_TITLES: { *((unsigned int *)arg) = d->vmg_file->tt_srpt->nr_of_srpts; return 1; } case STREAM_CTRL_GET_NUM_CHAPTERS: { int r; r = get_num_chapter(d->vts_file, d->tt_srpt, d->cur_title); if(! r) return STREAM_UNSUPPORTED; *((unsigned int *)arg) = r; return 1; } case STREAM_CTRL_GET_CHAPTER_TIME: { int r; r = get_chapter_time(d->vts_file, d->tt_srpt, d->cur_title, (double *)arg); if(! r) return STREAM_UNSUPPORTED; return 1; } case STREAM_CTRL_GET_CURRENT_TITLE: { *((unsigned int *)arg) = d->cur_title; return 1; } case STREAM_CTRL_GET_CURRENT_TIME: { double tm; tm = dvd_get_current_time(stream, -1); if(tm != -1) { *((double *)arg) = tm; return 1; } break; } case STREAM_CTRL_SEEK_TO_TIME: { if(dvd_seek_to_time(stream, d->vts_file, *((double*)arg))) return 1; break; } case STREAM_CTRL_GET_ASPECT_RATIO: { *((double *)arg) = !d->vts_file->vtsi_mat->vts_video_attr.display_aspect_ratio ? 4.0/3.0 : 16.0/9.0; return 1; } case STREAM_CTRL_GET_NUM_ANGLES: { *((int *)arg) = d->vmg_file->tt_srpt->title[d->dvd_title].nr_of_angles; return 1; } case STREAM_CTRL_GET_ANGLE: { *((int *)arg) = d->dvd_angle; return 1; } case STREAM_CTRL_SET_ANGLE: { int ang = *((int *)arg); if(ang>d->vmg_file->tt_srpt->title[d->dvd_title].nr_of_angles || ang<=0) break; d->dvd_angle = ang; d->angle_seek = 1; return 1; } case STREAM_CTRL_GET_LANG: { struct stream_lang_req *req = arg; int lang = 0; switch(req->type) { case STREAM_AUDIO: lang = dvd_lang_from_aid(stream, req->id); break; case STREAM_SUB: lang = dvd_lang_from_sid(stream, req->id); break; } if (!lang) break; snprintf(req->name, sizeof(req->name), "%c%c", lang >> 8, lang); return STREAM_OK; } case STREAM_CTRL_GET_DVD_INFO: { struct stream_dvd_info_req *req = arg; memset(req, 0, sizeof(*req)); req->num_subs = dvd_number_of_subs(stream); memcpy(req->palette, d->cur_pgc->palette, sizeof(req->palette)); return STREAM_OK; } case STREAM_CTRL_GET_DISC_NAME: { char buffer[128]; if (DVDUDFVolumeInfo(d->dvd, buffer, sizeof(buffer), NULL, 0) < 0 && DVDISOVolumeInfo(d->dvd, buffer, sizeof(buffer), NULL, 0) < 0) break; if (!buffer[0]) break; *(char**)arg = talloc_strdup(NULL, buffer); return STREAM_OK; } } return STREAM_UNSUPPORTED; }