Skip to content

Commit

Permalink
libmythbluray: Add BD_EVENT_STILL_TIME event, and mouse click handling.
Browse files Browse the repository at this point in the history
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 14, 2010
1 parent 6e4b2c4 commit 1b6ea77
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 10 deletions.
41 changes: 32 additions & 9 deletions mythtv/libs/libmythbluray/bluray.c
Expand Up @@ -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);
Expand All @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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) {
Expand Down
17 changes: 16 additions & 1 deletion mythtv/libs/libmythbluray/bluray.h
Expand Up @@ -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;

Expand Down Expand Up @@ -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_ */
4 changes: 4 additions & 0 deletions mythtv/libs/libmythbluray/keys.h
Expand Up @@ -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
Expand Down

0 comments on commit 1b6ea77

Please sign in to comment.