summaryrefslogtreecommitdiffstats
path: root/stream
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-09-10 15:39:48 +0200
committerwm4 <wm4@nowhere>2013-09-10 15:39:48 +0200
commitc9a740fccd1128e43542beeec6f50bc59c2bddb9 (patch)
tree1015d63b880c7989a7057b54913ef7101e6ec714 /stream
parent328b95101971e407d9db031e1d6186ada0bd5a6e (diff)
downloadmpv-c9a740fccd1128e43542beeec6f50bc59c2bddb9.tar.bz2
mpv-c9a740fccd1128e43542beeec6f50bc59c2bddb9.tar.xz
stream_bluray: return number of titles
So that the "titles" property returns the number of titles.
Diffstat (limited to 'stream')
-rw-r--r--stream/stream_bluray.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/stream/stream_bluray.c b/stream/stream_bluray.c
index 69e47a0589..cde7267713 100644
--- a/stream/stream_bluray.c
+++ b/stream/stream_bluray.c
@@ -58,6 +58,7 @@ int bluray_angle = 0;
struct bluray_priv_s {
BLURAY *bd;
+ int num_titles;
int current_angle;
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;
return 1;
}
+ case STREAM_CTRL_GET_NUM_TITLES: {
+ *((unsigned int *)arg) = b->num_titles;
+ return 1;
+ }
case STREAM_CTRL_GET_CURRENT_CHAPTER: {
*((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 *bd;
- int title, title_guess, title_count;
+ int title, title_guess;
uint64_t title_size;
unsigned int angle = 0;
@@ -317,9 +322,9 @@ static int bluray_stream_open(stream_t *s, int mode)
}
/* check for available titles on disc */
- title_count = bd_get_titles(bd, TITLES_RELEVANT, angle);
- mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_BLURAY_TITLES=%d\n", title_count);
- if (!title_count) {
+ b->num_titles = bd_get_titles(bd, TITLES_RELEVANT, angle);
+ mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_BLURAY_TITLES=%d\n", b->num_titles);
+ if (!b->num_titles) {
mp_msg(MSGT_OPEN, MSGL_ERR,
"Can't find any Blu-ray-compatible title here.\n");
bd_close(bd);
@@ -328,7 +333,7 @@ static int bluray_stream_open(stream_t *s, int mode)
/* parse titles information */
title_guess = BLURAY_DEFAULT_TITLE;
- for (i = 0; i < title_count; i++) {
+ for (i = 0; i < b->num_titles; i++) {
BLURAY_TITLE_INFO *ti;
int sec, msec;
@@ -357,7 +362,7 @@ static int bluray_stream_open(stream_t *s, int mode)
/* Select current title */
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);