summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xine/BluRay/input_bluray.c83
1 files changed, 82 insertions, 1 deletions
diff --git a/xine/BluRay/input_bluray.c b/xine/BluRay/input_bluray.c
index a473c739..aa609489 100644
--- a/xine/BluRay/input_bluray.c
+++ b/xine/BluRay/input_bluray.c
@@ -116,6 +116,7 @@ typedef struct {
int current_title;
BLURAY_TITLE_INFO *title_info;
int current_clip;
+ int error;
uint32_t cap_seekable;
@@ -278,6 +279,80 @@ static void stream_reset(bluray_input_plugin_t *this)
this->cap_seekable = INPUT_CAP_SEEKABLE;
}
+static void handle_libbluray_event(bluray_input_plugin_t *this, BD_EVENT ev)
+{
+ switch (ev.event) {
+
+ case BD_EVENT_ERROR:
+ LOGMSG("BD_EVENT_ERROR\n");
+ this->error = 1;
+ return;
+
+ /* playback control */
+
+ case BD_EVENT_STILL:
+ LOGMSG("BD_EVENT_STILL %d\n", ev.param);
+ break;
+
+ /* playback position */
+
+ case BD_EVENT_ANGLE:
+ lprintf("BD_EVENT_ANGLE_NUMBER %d\n", ev.param);
+ _x_stream_info_set(this->stream, XINE_STREAM_INFO_DVD_ANGLE_NUMBER, ev.param);
+ break;
+
+ case BD_EVENT_TITLE:
+ LOGMSG("BD_EVENT_TITLE_ID %d\n", ev.param);
+ break;
+
+ case BD_EVENT_PLAYLIST:
+ lprintf("BD_EVENT_PLAYLIST %d\n", ev.param);
+ this->current_title = bd_get_current_title(this->bdh);
+ update_title_info(this);
+ break;
+
+ case BD_EVENT_PLAYITEM:
+ lprintf("BD_EVENT_PLAYITEM %d\n", ev.param);
+ this->current_clip = ev.param;
+ break;
+
+ case BD_EVENT_CHAPTER:
+ lprintf("BD_EVENT_CHAPTER %d\n", ev.param);
+ _x_stream_info_set(this->stream, XINE_STREAM_INFO_DVD_CHAPTER_NUMBER, ev.param);
+ break;
+
+ /* stream selection */
+
+ case BD_EVENT_AUDIO_STREAM:
+ case BD_EVENT_PG_TEXTST:
+ case BD_EVENT_PG_TEXTST_STREAM:
+ case BD_EVENT_IG_STREAM:
+ case BD_EVENT_SECONDARY_AUDIO:
+ case BD_EVENT_SECONDARY_AUDIO_STREAM:
+ case BD_EVENT_SECONDARY_VIDEO:
+ case BD_EVENT_SECONDARY_VIDEO_SIZE:
+ case BD_EVENT_SECONDARY_VIDEO_STREAM:
+ // TODO
+
+ case BD_EVENT_NONE:
+ break;
+
+ default:
+ LOGMSG("unhandled libbluray event %d [param %d]\n", ev.event, ev.param);
+ break;
+ }
+}
+
+static void handle_libbluray_events(bluray_input_plugin_t *this)
+{
+ BD_EVENT ev;
+ while (bd_get_event(this->bdh, &ev)) {
+ handle_libbluray_event(this, ev);
+ if (this->error || ev.event == BD_EVENT_NONE || ev.event == BD_EVENT_ERROR)
+ break;
+ }
+}
+
static void handle_events(bluray_input_plugin_t *this)
{
if (!this->event_queue)
@@ -384,13 +459,15 @@ static off_t bluray_plugin_read (input_plugin_t *this_gen, char *buf, off_t len)
#endif
{
bluray_input_plugin_t *this = (bluray_input_plugin_t *) this_gen;
+ off_t result;
if (!this || !this->bdh || len < 0)
return -1;
handle_events(this);
- off_t result = bd_read (this->bdh, (unsigned char *)buf, len);
+ result = bd_read(this->bdh, (unsigned char *)buf, len);
+ handle_libbluray_events(this);
if (result < 0)
LOGMSG("bd_read() failed: %s (%d of %d)\n", strerror(errno), (int)result, (int)len);
@@ -753,6 +830,10 @@ static int bluray_plugin_open (input_plugin_t *this_gen)
bd_register_overlay_proc(this->bdh, this, overlay_proc);
+ /* init libbluray event queue */
+
+ handle_libbluray_events(this);
+
/* open */
if (open_title(this, title) <= 0 &&