Mercurial > mplayer.hg
annotate stream/stream_bluray.c @ 35905:0989cbea18b4
Add _BSD_SOURCE #define for getpagesize().
author | diego |
---|---|
date | Sun, 17 Mar 2013 22:47:35 +0000 |
parents | 3389262720da |
children | 4c42154f7aa3 |
rev | line source |
---|---|
31565
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
1 /* |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
2 * Copyright (C) 2010 Benjamin Zores <ben@geexbox.org> |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
3 * |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
4 * This file is part of MPlayer. |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
5 * |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
6 * MPlayer is free software; you can redistribute it and/or modify |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
7 * it under the terms of the GNU General Public License as published by |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
8 * the Free Software Foundation; either version 2 of the License, or |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
9 * (at your option) any later version. |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
10 * |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
11 * MPlayer is distributed in the hope that it will be useful, |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
14 * GNU General Public License for more details. |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
15 * |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
16 * You should have received a copy of the GNU General Public License along |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
17 * with MPlayer; if not, write to the Free Software Foundation, Inc., |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
19 */ |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
20 |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
21 /* |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
22 * Blu-ray parser/reader using libbluray |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
23 * Use 'git clone git://git.videolan.org/libbluray' to get it. |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
24 * |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
25 * TODO: |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
26 * - Add libbdnav support for menus navigation |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
27 * - Add AACS/BD+ protection detection |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
28 * - Add descrambled keys database support (KEYDB.cfg) |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
29 * |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
30 */ |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
31 |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
32 #include <libbluray/bluray.h> |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
33 |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
34 #include "config.h" |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
35 #include "libavutil/common.h" |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
36 #include "libmpdemux/demuxer.h" |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
37 #include "mp_msg.h" |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
38 #include "help_mp.h" |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
39 #include "m_struct.h" |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
40 #include "m_option.h" |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
41 #include "stream.h" |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
42 |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
43 #define BLURAY_SECTOR_SIZE 6144 |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
44 |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
45 #define BLURAY_DEFAULT_ANGLE 0 |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
46 #define BLURAY_DEFAULT_CHAPTER 0 |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
47 #define BLURAY_DEFAULT_TITLE 0 |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
48 |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
49 int bluray_angle = 0; |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
50 int bluray_chapter = 0; |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
51 |
31574
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
52 struct bluray_priv_s { |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
53 BLURAY *bd; |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
54 int current_angle; |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
55 int current_chapter; |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
56 int current_title; |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
57 }; |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
58 |
31565
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
59 static struct stream_priv_s { |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
60 int title; |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
61 char *device; |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
62 } bluray_stream_priv_dflts = { |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
63 BLURAY_DEFAULT_TITLE, |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
64 NULL |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
65 }; |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
66 |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
67 #define ST_OFF(f) M_ST_OFF(struct stream_priv_s,f) |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
68 static const m_option_t bluray_stream_opts_fields[] = { |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
69 { "hostname", ST_OFF(title), CONF_TYPE_INT, M_OPT_RANGE, 0, 99999, NULL}, |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
70 { "filename", ST_OFF(device), CONF_TYPE_STRING, 0, 0 ,0, NULL}, |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
71 { NULL, NULL, 0, 0, 0, 0, NULL } |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
72 }; |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
73 |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
74 static const struct m_struct_st bluray_stream_opts = { |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
75 "bluray", |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
76 sizeof(struct stream_priv_s), |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
77 &bluray_stream_priv_dflts, |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
78 bluray_stream_opts_fields |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
79 }; |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
80 |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
81 static void bluray_stream_close(stream_t *s) |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
82 { |
31574
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
83 struct bluray_priv_s *b = s->priv; |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
84 |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
85 bd_close(b->bd); |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
86 b->bd = NULL; |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
87 free(b); |
31565
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
88 } |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
89 |
35885
3389262720da
Fix previous commit, off_t must be replaced by int64_t
reimar
parents:
35881
diff
changeset
|
90 static int bluray_stream_seek(stream_t *s, int64_t pos) |
31565
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
91 { |
31574
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
92 struct bluray_priv_s *b = s->priv; |
35885
3389262720da
Fix previous commit, off_t must be replaced by int64_t
reimar
parents:
35881
diff
changeset
|
93 int64_t p; |
31565
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
94 |
31574
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
95 p = bd_seek(b->bd, pos); |
31565
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
96 if (p == -1) |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
97 return 0; |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
98 |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
99 s->pos = p; |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
100 return 1; |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
101 } |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
102 |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
103 static int bluray_stream_fill_buffer(stream_t *s, char *buf, int len) |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
104 { |
31574
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
105 struct bluray_priv_s *b = s->priv; |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
106 |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
107 return bd_read(b->bd, buf, len); |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
108 } |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
109 |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
110 static int bluray_stream_control(stream_t *s, int cmd, void *arg) |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
111 { |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
112 struct bluray_priv_s *b = s->priv; |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
113 |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
114 switch (cmd) { |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
115 |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
116 case STREAM_CTRL_GET_NUM_CHAPTERS: { |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
117 BLURAY_TITLE_INFO *ti; |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
118 |
34038 | 119 ti = bd_get_title_info(b->bd, b->current_title, b->current_angle); |
31574
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
120 if (!ti) |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
121 return STREAM_UNSUPPORTED; |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
122 |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
123 *((unsigned int *) arg) = ti->chapter_count; |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
124 bd_free_title_info(ti); |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
125 |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
126 return 1; |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
127 } |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
128 |
35169
3b2c280da1af
Add new stream control command STREAM_CTRL_GET_CURRENT_TITLE for DVDs.
ib
parents:
34649
diff
changeset
|
129 case STREAM_CTRL_GET_CURRENT_TITLE: { |
3b2c280da1af
Add new stream control command STREAM_CTRL_GET_CURRENT_TITLE for DVDs.
ib
parents:
34649
diff
changeset
|
130 *((unsigned int *) arg) = b->current_title; |
3b2c280da1af
Add new stream control command STREAM_CTRL_GET_CURRENT_TITLE for DVDs.
ib
parents:
34649
diff
changeset
|
131 return 1; |
3b2c280da1af
Add new stream control command STREAM_CTRL_GET_CURRENT_TITLE for DVDs.
ib
parents:
34649
diff
changeset
|
132 } |
3b2c280da1af
Add new stream control command STREAM_CTRL_GET_CURRENT_TITLE for DVDs.
ib
parents:
34649
diff
changeset
|
133 |
31574
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
134 case STREAM_CTRL_GET_CURRENT_CHAPTER: { |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
135 *((unsigned int *) arg) = b->current_chapter; |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
136 return 1; |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
137 } |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
138 |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
139 case STREAM_CTRL_SEEK_TO_CHAPTER: { |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
140 BLURAY_TITLE_INFO *ti; |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
141 int chapter = *((unsigned int *) arg); |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
142 int64_t pos; |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
143 int r; |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
144 |
34038 | 145 ti = bd_get_title_info(b->bd, b->current_title, b->current_angle); |
31574
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
146 if (!ti) |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
147 return STREAM_UNSUPPORTED; |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
148 |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
149 if (chapter < 0 || chapter > ti->chapter_count) { |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
150 bd_free_title_info(ti); |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
151 return STREAM_UNSUPPORTED; |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
152 } |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
153 |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
154 pos = bd_chapter_pos(b->bd, chapter); |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
155 r = bluray_stream_seek(s, pos); |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
156 bd_free_title_info(ti); |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
157 |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
158 return r ? 1 : STREAM_UNSUPPORTED; |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
159 } |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
160 |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
161 case STREAM_CTRL_GET_NUM_ANGLES: { |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
162 BLURAY_TITLE_INFO *ti; |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
163 |
34038 | 164 ti = bd_get_title_info(b->bd, b->current_title, b->current_angle); |
31574
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
165 if (!ti) |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
166 return STREAM_UNSUPPORTED; |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
167 |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
168 *((int *) arg) = ti->angle_count; |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
169 bd_free_title_info(ti); |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
170 |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
171 return 1; |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
172 } |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
173 |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
174 case STREAM_CTRL_GET_ANGLE: { |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
175 *((int *) arg) = b->current_angle; |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
176 return 1; |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
177 } |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
178 |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
179 case STREAM_CTRL_SET_ANGLE: { |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
180 BLURAY_TITLE_INFO *ti; |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
181 int angle = *((int *) arg); |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
182 |
34038 | 183 ti = bd_get_title_info(b->bd, b->current_title, b->current_angle); |
31574
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
184 if (!ti) |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
185 return STREAM_UNSUPPORTED; |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
186 |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
187 if (angle < 0 || angle > ti->angle_count) { |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
188 bd_free_title_info(ti); |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
189 return STREAM_UNSUPPORTED; |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
190 } |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
191 |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
192 b->current_angle = angle; |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
193 bd_seamless_angle_change(b->bd, angle); |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
194 bd_free_title_info(ti); |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
195 |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
196 return 1; |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
197 } |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
198 |
34649
6dcc91eb3cf8
Support showing the stream language with br:// playback.
reimar
parents:
34038
diff
changeset
|
199 case STREAM_CTRL_GET_LANG: { |
6dcc91eb3cf8
Support showing the stream language with br:// playback.
reimar
parents:
34038
diff
changeset
|
200 struct stream_lang_req *req = arg; |
6dcc91eb3cf8
Support showing the stream language with br:// playback.
reimar
parents:
34038
diff
changeset
|
201 BLURAY_TITLE_INFO *ti = bd_get_title_info(b->bd, b->current_title, b->current_angle); |
6dcc91eb3cf8
Support showing the stream language with br:// playback.
reimar
parents:
34038
diff
changeset
|
202 if (ti->clip_count) { |
6dcc91eb3cf8
Support showing the stream language with br:// playback.
reimar
parents:
34038
diff
changeset
|
203 BLURAY_STREAM_INFO *si = NULL; |
6dcc91eb3cf8
Support showing the stream language with br:// playback.
reimar
parents:
34038
diff
changeset
|
204 int count = 0; |
6dcc91eb3cf8
Support showing the stream language with br:// playback.
reimar
parents:
34038
diff
changeset
|
205 switch (req->type) { |
6dcc91eb3cf8
Support showing the stream language with br:// playback.
reimar
parents:
34038
diff
changeset
|
206 case stream_ctrl_audio: |
6dcc91eb3cf8
Support showing the stream language with br:// playback.
reimar
parents:
34038
diff
changeset
|
207 count = ti->clips[0].audio_stream_count; |
6dcc91eb3cf8
Support showing the stream language with br:// playback.
reimar
parents:
34038
diff
changeset
|
208 si = ti->clips[0].audio_streams; |
6dcc91eb3cf8
Support showing the stream language with br:// playback.
reimar
parents:
34038
diff
changeset
|
209 break; |
6dcc91eb3cf8
Support showing the stream language with br:// playback.
reimar
parents:
34038
diff
changeset
|
210 case stream_ctrl_sub: |
6dcc91eb3cf8
Support showing the stream language with br:// playback.
reimar
parents:
34038
diff
changeset
|
211 count = ti->clips[0].pg_stream_count; |
6dcc91eb3cf8
Support showing the stream language with br:// playback.
reimar
parents:
34038
diff
changeset
|
212 si = ti->clips[0].pg_streams; |
6dcc91eb3cf8
Support showing the stream language with br:// playback.
reimar
parents:
34038
diff
changeset
|
213 break; |
6dcc91eb3cf8
Support showing the stream language with br:// playback.
reimar
parents:
34038
diff
changeset
|
214 } |
6dcc91eb3cf8
Support showing the stream language with br:// playback.
reimar
parents:
34038
diff
changeset
|
215 while (count-- > 0) { |
6dcc91eb3cf8
Support showing the stream language with br:// playback.
reimar
parents:
34038
diff
changeset
|
216 if (si->pid == req->id) { |
6dcc91eb3cf8
Support showing the stream language with br:// playback.
reimar
parents:
34038
diff
changeset
|
217 memcpy(req->buf, si->lang, 4); |
6dcc91eb3cf8
Support showing the stream language with br:// playback.
reimar
parents:
34038
diff
changeset
|
218 req->buf[4] = 0; |
6dcc91eb3cf8
Support showing the stream language with br:// playback.
reimar
parents:
34038
diff
changeset
|
219 bd_free_title_info(ti); |
6dcc91eb3cf8
Support showing the stream language with br:// playback.
reimar
parents:
34038
diff
changeset
|
220 return STREAM_OK; |
6dcc91eb3cf8
Support showing the stream language with br:// playback.
reimar
parents:
34038
diff
changeset
|
221 } |
6dcc91eb3cf8
Support showing the stream language with br:// playback.
reimar
parents:
34038
diff
changeset
|
222 si++; |
6dcc91eb3cf8
Support showing the stream language with br:// playback.
reimar
parents:
34038
diff
changeset
|
223 } |
6dcc91eb3cf8
Support showing the stream language with br:// playback.
reimar
parents:
34038
diff
changeset
|
224 } |
6dcc91eb3cf8
Support showing the stream language with br:// playback.
reimar
parents:
34038
diff
changeset
|
225 bd_free_title_info(ti); |
6dcc91eb3cf8
Support showing the stream language with br:// playback.
reimar
parents:
34038
diff
changeset
|
226 return STREAM_ERROR; |
6dcc91eb3cf8
Support showing the stream language with br:// playback.
reimar
parents:
34038
diff
changeset
|
227 } |
6dcc91eb3cf8
Support showing the stream language with br:// playback.
reimar
parents:
34038
diff
changeset
|
228 |
31574
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
229 default: |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
230 break; |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
231 } |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
232 |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
233 return STREAM_UNSUPPORTED; |
31565
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
234 } |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
235 |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
236 static int bluray_stream_open(stream_t *s, int mode, |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
237 void *opts, int *file_format) |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
238 { |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
239 struct stream_priv_s *p = opts; |
31574
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
240 struct bluray_priv_s *b; |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
241 |
31565
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
242 BLURAY_TITLE_INFO *info = NULL; |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
243 BLURAY *bd; |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
244 |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
245 int title, title_guess, title_count; |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
246 uint64_t title_size; |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
247 |
31574
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
248 unsigned int chapter = 0, angle = 0; |
31565
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
249 uint64_t max_duration = 0; |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
250 int64_t chapter_pos = 0; |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
251 |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
252 char *device = NULL; |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
253 int i; |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
254 |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
255 /* find the requested device */ |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
256 if (p->device) |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
257 device = p->device; |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
258 else if (bluray_device) |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
259 device = bluray_device; |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
260 |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
261 if (!device) { |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
262 mp_msg(MSGT_OPEN, MSGL_ERR, MSGTR_BlurayNoDevice); |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
263 return STREAM_UNSUPPORTED; |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
264 } |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
265 |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
266 /* open device */ |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
267 bd = bd_open(device, NULL); |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
268 if (!bd) { |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
269 mp_msg(MSGT_OPEN, MSGL_ERR, MSGTR_CantOpenBluray, device); |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
270 return STREAM_UNSUPPORTED; |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
271 } |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
272 |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
273 /* check for available titles on disc */ |
34038 | 274 title_count = bd_get_titles(bd, TITLES_RELEVANT, angle); |
31565
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
275 mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_BLURAY_TITLES=%d\n", title_count); |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
276 if (!title_count) { |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
277 mp_msg(MSGT_OPEN, MSGL_ERR, MSGTR_BlurayNoTitles); |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
278 bd_close(bd); |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
279 return STREAM_UNSUPPORTED; |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
280 } |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
281 |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
282 /* parse titles information */ |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
283 title_guess = BLURAY_DEFAULT_TITLE; |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
284 for (i = 0; i < title_count; i++) { |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
285 BLURAY_TITLE_INFO *ti; |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
286 int sec, msec; |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
287 |
34038 | 288 ti = bd_get_title_info(bd, i, angle); |
31565
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
289 if (!ti) |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
290 continue; |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
291 |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
292 sec = ti->duration / 90000; |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
293 msec = (ti->duration - sec) % 1000; |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
294 |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
295 mp_msg(MSGT_IDENTIFY, MSGL_INFO, |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
296 "ID_BLURAY_TITLE_%d_CHAPTERS=%d\n", i + 1, ti->chapter_count); |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
297 mp_msg(MSGT_IDENTIFY, MSGL_INFO, |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
298 "ID_BLURAY_TITLE_%d_ANGLE=%d\n", i + 1, ti->angle_count); |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
299 mp_msg(MSGT_IDENTIFY, MSGL_V, |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
300 "ID_BLURAY_TITLE_%d_LENGTH=%d.%03d\n", i + 1, sec, msec); |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
301 |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
302 /* try to guess which title may contain the main movie */ |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
303 if (ti->duration > max_duration) { |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
304 max_duration = ti->duration; |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
305 title_guess = i; |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
306 } |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
307 |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
308 bd_free_title_info(ti); |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
309 } |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
310 |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
311 /* Select current title */ |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
312 title = p->title ? p->title - 1: title_guess; |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
313 title = FFMIN(title, title_count - 1); |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
314 |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
315 bd_select_title(bd, title); |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
316 |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
317 title_size = bd_get_title_size(bd); |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
318 mp_msg(MSGT_IDENTIFY, MSGL_INFO, |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
319 "ID_BLURAY_CURRENT_TITLE=%d\n", title + 1); |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
320 |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
321 /* Get current title information */ |
34038 | 322 info = bd_get_title_info(bd, title, angle); |
31565
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
323 if (!info) |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
324 goto err_no_info; |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
325 |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
326 /* Select chapter */ |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
327 chapter = bluray_chapter ? bluray_chapter : BLURAY_DEFAULT_CHAPTER; |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
328 chapter = FFMIN(chapter, info->chapter_count); |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
329 |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
330 if (chapter) |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
331 chapter_pos = bd_chapter_pos(bd, chapter); |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
332 |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
333 mp_msg(MSGT_IDENTIFY, MSGL_INFO, |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
334 "ID_BLURAY_CURRENT_CHAPTER=%d\n", chapter + 1); |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
335 |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
336 /* Select angle */ |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
337 angle = bluray_angle ? bluray_angle : BLURAY_DEFAULT_ANGLE; |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
338 angle = FFMIN(angle, info->angle_count); |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
339 |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
340 if (angle) |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
341 bd_select_angle(bd, angle); |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
342 |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
343 mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_BLURAY_CURRENT_ANGLE=%d\n", angle + 1); |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
344 |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
345 bd_free_title_info(info); |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
346 |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
347 err_no_info: |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
348 s->fill_buffer = bluray_stream_fill_buffer; |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
349 s->seek = bluray_stream_seek; |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
350 s->close = bluray_stream_close; |
31574
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
351 s->control = bluray_stream_control; |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
352 |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
353 b = calloc(1, sizeof(struct bluray_priv_s)); |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
354 b->bd = bd; |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
355 b->current_angle = angle; |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
356 b->current_chapter = chapter; |
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
357 b->current_title = title; |
31565
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
358 |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
359 s->start_pos = chapter_pos; |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
360 s->end_pos = title_size; |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
361 s->sector_size = BLURAY_SECTOR_SIZE; |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
362 s->flags = mode | MP_STREAM_SEEK; |
31574
1d31cd52aa08
Implement slave mode compatible stream controls for Blu-ray.
ben
parents:
31565
diff
changeset
|
363 s->priv = b; |
31565
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
364 s->type = STREAMTYPE_BLURAY; |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
365 s->url = strdup("br://"); |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
366 |
33827
277ec491a8a7
Do not translate console messages of verbosity level MSGL_V and above.
diego
parents:
32326
diff
changeset
|
367 mp_msg(MSGT_OPEN, MSGL_V, "Blu-ray successfully opened.\n"); |
31565
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
368 |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
369 return STREAM_OK; |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
370 } |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
371 |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
372 const stream_info_t stream_info_bluray = { |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
373 "Blu-ray Disc", |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
374 "bd", |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
375 "Benjamin Zores", |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
376 "Play Blu-ray discs through external libbluray", |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
377 bluray_stream_open, |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
378 { "br", "bluray", NULL }, |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
379 &bluray_stream_opts, |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
380 1 |
9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
ben
parents:
diff
changeset
|
381 }; |