Skip to content
Permalink
Browse files

libmythbluray: Add BD_EVENT_STILL_TIME event, and mouse click handling.

Not quite sure how to make mouse handling work in our player yet, but it would be nice.
  • Loading branch information
Robert McNamara authored and jyavenard committed Dec 10, 2010
1 parent 6e4b2c4 commit 1b6ea775a8be64df317d54c22214c4bff9b1dd2d
Showing with 52 additions and 10 deletions.
  1. +32 −9 mythtv/libs/libmythbluray/bluray.c
  2. +16 −1 mythtv/libs/libmythbluray/bluray.h
  3. +4 −0 mythtv/libs/libmythbluray/keys.h
@@ -1039,6 +1039,18 @@ int bd_read(BLURAY *bd, unsigned char *buf, int len)
return out_len;
}

MPLS_PI *pi = &st->clip->title->pl->play_item[st->clip->ref];

// handle still mode clips
if (pi->still_mode == BLURAY_STILL_INFINITE) {
_queue_event(bd, (BD_EVENT){BD_EVENT_STILL_TIME, 0});
return 0;
}
if (pi->still_mode == BLURAY_STILL_TIME) {
_queue_event(bd, (BD_EVENT){BD_EVENT_STILL_TIME, pi->still_time});
}

// find next clip
st->clip = nav_next_clip(bd->title, st->clip);
if (st->clip == NULL) {
DEBUG(DBG_BLURAY|DBG_STREAM, "End of title (%p)\n", bd);
@@ -1048,7 +1060,16 @@ int bd_read(BLURAY *bd, unsigned char *buf, int len)
if (!_open_m2ts(bd, st)) {
return -1;
}

// timed still mode: allow application to process BD_EVENT_STILL_TIME.
// next bd_read() will return new data.
if (bd->event_queue) {
if (pi->still_mode == BLURAY_STILL_TIME) {
return 0;
}
}
}

if (_read_block(bd, st, bd->int_buf)) {

st->int_buf_off = st->clip_pos % 6144;
@@ -1906,15 +1927,8 @@ int bd_read_ext(BLURAY *bd, unsigned char *buf, int len, BD_EVENT *event)

if (bytes == 0) {

MPLS_PI *pi = &bd->title->pl->play_item[0];
if (pi->still_mode == BLURAY_STILL_INFINITE) {
// most likely menu background ; waiting for user interaction
DEBUG(DBG_BLURAY, "Reached end of infinite still mode play item\n");
_get_event(bd, event);
return 0;
}

if (bd->title_type == title_hdmv) {
// if no next clip (=end of title), resume HDMV VM
if (!bd->st0.clip && bd->title_type == title_hdmv) {
hdmv_vm_resume(bd->hdmv_vm);
bd->hdmv_suspended = !hdmv_vm_running(bd->hdmv_vm);
DEBUG(DBG_BLURAY, "bd_read_ext(): reached end of playlist. hdmv_suspended=%d\n", bd->hdmv_suspended);
@@ -1942,6 +1956,15 @@ int bd_get_event(BLURAY *bd, BD_EVENT *event)
* user interaction
*/

void bd_mouse_select(BLURAY *bd, int64_t pts, uint16_t x, uint16_t y)
{
if (pts >= 0) {
bd_psr_write(bd->regs, PSR_TIME, (uint32_t)(((uint64_t)pts) >> 1));
}

_run_gc(bd, GC_CTRL_MOUSE_MOVE, (x << 16) | y);
}

void bd_user_input(BLURAY *bd, int64_t pts, uint32_t key)
{
if (pts >= 0) {
@@ -481,7 +481,10 @@ typedef enum {
BD_EVENT_SEEK,

/* still playback (pause) */
BD_EVENT_STILL, /* 0 - off, 1 - on */
BD_EVENT_STILL, /* 0 - off, 1 - on */

/* Still playback for n seconds (reached end of still mode play item) */
BD_EVENT_STILL_TIME, /* 0 = infinite ; 1...300 = seconds */

} bd_event_e;

@@ -590,4 +593,16 @@ void bd_user_input(BLURAY *bd, int64_t pts, uint32_t key);
};
#endif

/**
*
* Select menu button at location (x,y).
*
* @param bd BLURAY object
* @param pts current playback position (1/90000s) or -1
* @param x mouse pointer x-position
* @param y mouse pointer y-position
* @return none
*/
void bd_mouse_select(BLURAY *bd, int64_t pts, uint16_t x, uint16_t y);

#endif /* BLURAY_H_ */
@@ -54,6 +54,10 @@ typedef enum {
BD_VK_RIGHT = 15,
BD_VK_ENTER = 16,

/* Mouse click */
/* Translated to BD_VK_ENTER if mouse is over valid button */
BD_VK_MOUSE_ACTIVATE = 17,

} bd_vk_key_e;

#ifdef __cplusplus

0 comments on commit 1b6ea77

Please sign in to comment.
You can’t perform that action at this time.