1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-26 09:02:38 +00:00

stream_bluray: implement event handler for libbluray

This commit brings libbluray's event queue into stream_bluray.

Signed-off-by: wm4 <wm4@nowhere>
This commit is contained in:
xylosper 2014-03-27 03:15:37 +09:00 committed by wm4
parent b292ca8702
commit 4086a09695

View File

@ -42,6 +42,7 @@
#include "common/msg.h"
#include "options/m_option.h"
#include "stream.h"
#include "osdep/timer.h"
#define BLURAY_SECTOR_SIZE 6144
@ -98,10 +99,22 @@ static int bluray_stream_seek(stream_t *s, int64_t pos)
return 1;
}
static void handle_event(stream_t *s, const BD_EVENT *ev)
{
switch (ev->event) {
default:
MP_TRACE(s, "Unhandled event: %d %d\n", ev->event, ev->param);
break;
}
}
static int bluray_stream_fill_buffer(stream_t *s, char *buf, int len)
{
struct bluray_priv_s *b = s->priv;
BD_EVENT event;
while (bd_get_event(b->bd, &event))
handle_event(s, &event);
return bd_read(b->bd, buf, len);
}
@ -345,6 +358,9 @@ static int bluray_stream_open(stream_t *s, int mode)
bd_free_title_info(ti);
}
// initialize libbluray event queue
bd_get_event(bd, NULL);
/* Select current title */
if (b->cfg_title != BLURAY_DEFAULT_TITLE)
title = b->cfg_title;