mirror of
https://github.com/mpv-player/mpv
synced 2024-10-22 08:51:57 +02:00
stream_bluray: return number of titles
So that the "titles" property returns the number of titles.
This commit is contained in:
parent
328b951019
commit
c9a740fccd
@ -58,6 +58,7 @@ int bluray_angle = 0;
|
|||||||
|
|
||||||
struct bluray_priv_s {
|
struct bluray_priv_s {
|
||||||
BLURAY *bd;
|
BLURAY *bd;
|
||||||
|
int num_titles;
|
||||||
int current_angle;
|
int current_angle;
|
||||||
int current_title;
|
int current_title;
|
||||||
|
|
||||||
@ -146,6 +147,10 @@ static int bluray_stream_control(stream_t *s, int cmd, void *arg)
|
|||||||
*((unsigned int *) arg) = b->current_title;
|
*((unsigned int *) arg) = b->current_title;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
case STREAM_CTRL_GET_NUM_TITLES: {
|
||||||
|
*((unsigned int *)arg) = b->num_titles;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
case STREAM_CTRL_GET_CURRENT_CHAPTER: {
|
case STREAM_CTRL_GET_CURRENT_CHAPTER: {
|
||||||
*((unsigned int *) arg) = bd_get_current_chapter(b->bd);
|
*((unsigned int *) arg) = bd_get_current_chapter(b->bd);
|
||||||
@ -287,7 +292,7 @@ static int bluray_stream_open(stream_t *s, int mode)
|
|||||||
BLURAY_TITLE_INFO *info = NULL;
|
BLURAY_TITLE_INFO *info = NULL;
|
||||||
BLURAY *bd;
|
BLURAY *bd;
|
||||||
|
|
||||||
int title, title_guess, title_count;
|
int title, title_guess;
|
||||||
uint64_t title_size;
|
uint64_t title_size;
|
||||||
|
|
||||||
unsigned int angle = 0;
|
unsigned int angle = 0;
|
||||||
@ -317,9 +322,9 @@ static int bluray_stream_open(stream_t *s, int mode)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* check for available titles on disc */
|
/* check for available titles on disc */
|
||||||
title_count = bd_get_titles(bd, TITLES_RELEVANT, angle);
|
b->num_titles = bd_get_titles(bd, TITLES_RELEVANT, angle);
|
||||||
mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_BLURAY_TITLES=%d\n", title_count);
|
mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_BLURAY_TITLES=%d\n", b->num_titles);
|
||||||
if (!title_count) {
|
if (!b->num_titles) {
|
||||||
mp_msg(MSGT_OPEN, MSGL_ERR,
|
mp_msg(MSGT_OPEN, MSGL_ERR,
|
||||||
"Can't find any Blu-ray-compatible title here.\n");
|
"Can't find any Blu-ray-compatible title here.\n");
|
||||||
bd_close(bd);
|
bd_close(bd);
|
||||||
@ -328,7 +333,7 @@ static int bluray_stream_open(stream_t *s, int mode)
|
|||||||
|
|
||||||
/* parse titles information */
|
/* parse titles information */
|
||||||
title_guess = BLURAY_DEFAULT_TITLE;
|
title_guess = BLURAY_DEFAULT_TITLE;
|
||||||
for (i = 0; i < title_count; i++) {
|
for (i = 0; i < b->num_titles; i++) {
|
||||||
BLURAY_TITLE_INFO *ti;
|
BLURAY_TITLE_INFO *ti;
|
||||||
int sec, msec;
|
int sec, msec;
|
||||||
|
|
||||||
@ -357,7 +362,7 @@ static int bluray_stream_open(stream_t *s, int mode)
|
|||||||
|
|
||||||
/* Select current title */
|
/* Select current title */
|
||||||
title = b->cfg_title ? b->cfg_title - 1: title_guess;
|
title = b->cfg_title ? b->cfg_title - 1: title_guess;
|
||||||
title = FFMIN(title, title_count - 1);
|
title = FFMIN(title, b->num_titles - 1);
|
||||||
|
|
||||||
bd_select_title(bd, title);
|
bd_select_title(bd, title);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user