resindvd: Use new GstNavigation functionality.

Handle the new DVD commands, so that we can handle commands from a player
to change angle, jump to menus etc. Use the new GstNavigation event parsing
functions, instead of hand-rolled stuff.

Send GstNavigation notification messages when the mouse enters a button
or leaves it, so UI can turn the mouse cursor to a hand icon.
This commit is contained in:
Jan Schmidt 2009-04-01 02:23:20 +01:00
parent 97a1f14fc0
commit 0cf5e27b5b
3 changed files with 246 additions and 119 deletions

View file

@ -17,8 +17,11 @@ libresindvd_la_SOURCES = \
rsnparsetter.c \ rsnparsetter.c \
rsnwrappedbuffer.c rsnwrappedbuffer.c
libresindvd_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS) $(DVDNAV_CFLAGS) libresindvd_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) \
libresindvd_la_LIBADD = $(GST_PLUGINS_BASE_CFLAGS) -lgstvideo-$(GST_MAJORMINOR) $(GST_BASE_LIBS) $(GST_LIBS) $(DVDNAV_LIBS) $(GST_CFLAGS) $(DVDNAV_CFLAGS)
libresindvd_la_LIBADD = $(GST_PLUGINS_BASE_CFLAGS) \
-lgstinterfaces-$(GST_MAJORMINOR) -lgstvideo-$(GST_MAJORMINOR) \
$(GST_BASE_LIBS) $(GST_LIBS) $(DVDNAV_LIBS)
libresindvd_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) libresindvd_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
libresindvd_la_LIBTOOLFLAGS = --tag=disable-static libresindvd_la_LIBTOOLFLAGS = --tag=disable-static

View file

@ -25,6 +25,7 @@
#include <gst/gst.h> #include <gst/gst.h>
#include <gst/gst-i18n-plugin.h> #include <gst/gst-i18n-plugin.h>
#include <gst/interfaces/navigation.h>
#include "resindvdsrc.h" #include "resindvdsrc.h"
@ -48,18 +49,10 @@ typedef enum
{ {
RSN_NAV_RESULT_NONE, RSN_NAV_RESULT_NONE,
RSN_NAV_RESULT_HIGHLIGHT, RSN_NAV_RESULT_HIGHLIGHT,
RSN_NAV_RESULT_BRANCH RSN_NAV_RESULT_BRANCH,
RSN_NAV_RESULT_BRANCH_AND_HIGHLIGHT
} RsnNavResult; } RsnNavResult;
typedef enum
{
RSN_NAV_ACTION_ACTIVATE,
RSN_NAV_ACTION_LEFT,
RSN_NAV_ACTION_RIGHT,
RSN_NAV_ACTION_DOWN,
RSN_NAV_ACTION_UP
} RsnNavAction;
enum enum
{ {
/* FILL ME */ /* FILL ME */
@ -473,6 +466,7 @@ rsn_dvdsrc_stop (RsnBaseSrc * bsrc)
{ {
resinDvdSrc *src = RESINDVDSRC (bsrc); resinDvdSrc *src = RESINDVDSRC (bsrc);
gboolean ret = TRUE; gboolean ret = TRUE;
GstMessage *mouse_over_msg = NULL;
g_mutex_lock (src->dvd_lock); g_mutex_lock (src->dvd_lock);
@ -484,6 +478,12 @@ rsn_dvdsrc_stop (RsnBaseSrc * bsrc)
rsn_dvdsrc_clear_nav_blocks (src); rsn_dvdsrc_clear_nav_blocks (src);
src->have_pci = FALSE; src->have_pci = FALSE;
if (src->was_mouse_over) {
mouse_over_msg =
gst_navigation_message_new_mouse_over ((GstObject *) src, FALSE);
src->was_mouse_over = FALSE;
}
/* Clear any allocated output buffer */ /* Clear any allocated output buffer */
gst_buffer_replace (&src->alloc_buf, NULL); gst_buffer_replace (&src->alloc_buf, NULL);
gst_buffer_replace (&src->next_buf, NULL); gst_buffer_replace (&src->next_buf, NULL);
@ -534,6 +534,8 @@ rsn_dvdsrc_stop (RsnBaseSrc * bsrc)
g_mutex_unlock (src->dvd_lock); g_mutex_unlock (src->dvd_lock);
if (mouse_over_msg)
gst_element_post_message (GST_ELEMENT_CAST (src), mouse_over_msg);
return ret; return ret;
} }
@ -1082,7 +1084,8 @@ rsn_dvdsrc_create (RsnPushSrc * psrc, GstBuffer ** outbuf)
} }
static RsnNavResult static RsnNavResult
rsn_dvdsrc_perform_button_action (resinDvdSrc * src, RsnNavAction action) rsn_dvdsrc_perform_button_action (resinDvdSrc * src,
GstNavigationCommand action)
{ {
pci_t *pci; pci_t *pci;
RsnNavResult result = RSN_NAV_RESULT_NONE; RsnNavResult result = RSN_NAV_RESULT_NONE;
@ -1104,49 +1107,120 @@ rsn_dvdsrc_perform_button_action (resinDvdSrc * src, RsnNavAction action)
btn_info = pci->hli.btnit + button - 1; btn_info = pci->hli.btnit + button - 1;
switch (action) { switch (action) {
case RSN_NAV_ACTION_ACTIVATE: case GST_NAVIGATION_COMMAND_ACTIVATE:
if (dvdnav_button_activate (src->dvdnav, pci) == DVDNAV_STATUS_OK) if (dvdnav_button_activate (src->dvdnav, pci) == DVDNAV_STATUS_OK)
result = RSN_NAV_RESULT_BRANCH; result = RSN_NAV_RESULT_BRANCH_AND_HIGHLIGHT;
break; break;
case RSN_NAV_ACTION_LEFT: case GST_NAVIGATION_COMMAND_LEFT:
if (dvdnav_left_button_select (src->dvdnav, pci) == DVDNAV_STATUS_OK) { if (dvdnav_left_button_select (src->dvdnav, pci) == DVDNAV_STATUS_OK) {
if (btn_info->left && if (btn_info->left &&
pci->hli.btnit[btn_info->left - 1].auto_action_mode) pci->hli.btnit[btn_info->left - 1].auto_action_mode)
result = RSN_NAV_RESULT_BRANCH; result = RSN_NAV_RESULT_BRANCH_AND_HIGHLIGHT;
else else
result = RSN_NAV_RESULT_HIGHLIGHT; result = RSN_NAV_RESULT_HIGHLIGHT;
} }
break; break;
case RSN_NAV_ACTION_RIGHT: case GST_NAVIGATION_COMMAND_RIGHT:
if (dvdnav_right_button_select (src->dvdnav, pci) == DVDNAV_STATUS_OK) { if (dvdnav_right_button_select (src->dvdnav, pci) == DVDNAV_STATUS_OK) {
if (btn_info->right && if (btn_info->right &&
pci->hli.btnit[btn_info->right - 1].auto_action_mode) pci->hli.btnit[btn_info->right - 1].auto_action_mode)
result = RSN_NAV_RESULT_BRANCH; result = RSN_NAV_RESULT_BRANCH_AND_HIGHLIGHT;
else else
result = RSN_NAV_RESULT_HIGHLIGHT; result = RSN_NAV_RESULT_HIGHLIGHT;
} }
break; break;
case RSN_NAV_ACTION_DOWN: case GST_NAVIGATION_COMMAND_DOWN:
if (dvdnav_lower_button_select (src->dvdnav, pci) == DVDNAV_STATUS_OK) { if (dvdnav_lower_button_select (src->dvdnav, pci) == DVDNAV_STATUS_OK) {
if (btn_info->down && if (btn_info->down &&
pci->hli.btnit[btn_info->down - 1].auto_action_mode) pci->hli.btnit[btn_info->down - 1].auto_action_mode)
result = RSN_NAV_RESULT_BRANCH; result = RSN_NAV_RESULT_BRANCH_AND_HIGHLIGHT;
else else
result = RSN_NAV_RESULT_HIGHLIGHT; result = RSN_NAV_RESULT_HIGHLIGHT;
} }
break; break;
case RSN_NAV_ACTION_UP: case GST_NAVIGATION_COMMAND_UP:
if (dvdnav_upper_button_select (src->dvdnav, pci) == DVDNAV_STATUS_OK) { if (dvdnav_upper_button_select (src->dvdnav, pci) == DVDNAV_STATUS_OK) {
if (btn_info->up && pci->hli.btnit[btn_info->up - 1].auto_action_mode) if (btn_info->up && pci->hli.btnit[btn_info->up - 1].auto_action_mode)
result = RSN_NAV_RESULT_BRANCH; result = RSN_NAV_RESULT_BRANCH_AND_HIGHLIGHT;
else else
result = RSN_NAV_RESULT_HIGHLIGHT; result = RSN_NAV_RESULT_HIGHLIGHT;
} }
break; break;
default:
break;
} }
if (result == RSN_NAV_RESULT_HIGHLIGHT) if (result == RSN_NAV_RESULT_HIGHLIGHT) {
/* If we're *only* changing the highlight, wake up the still condition.
* If we're branching, that will happen anyway */
g_cond_broadcast (src->still_cond); g_cond_broadcast (src->still_cond);
}
return result;
}
static RsnNavResult
rsn_dvdsrc_do_command (resinDvdSrc * src, GstNavigationCommand command)
{
RsnNavResult result = RSN_NAV_RESULT_NONE;
switch (command) {
case GST_NAVIGATION_COMMAND_DVD_MENU:
if (dvdnav_menu_call (src->dvdnav, DVD_MENU_Escape) == DVDNAV_STATUS_OK)
result = RSN_NAV_RESULT_BRANCH;
break;
case GST_NAVIGATION_COMMAND_DVD_TITLE_MENU:
if (dvdnav_menu_call (src->dvdnav, DVD_MENU_Title) == DVDNAV_STATUS_OK)
result = RSN_NAV_RESULT_BRANCH;
break;
case GST_NAVIGATION_COMMAND_DVD_ROOT_MENU:
if (dvdnav_menu_call (src->dvdnav, DVD_MENU_Root) == DVDNAV_STATUS_OK)
result = RSN_NAV_RESULT_BRANCH;
break;
case GST_NAVIGATION_COMMAND_DVD_SUBPICTURE_MENU:
if (dvdnav_menu_call (src->dvdnav, DVD_MENU_Subpicture) ==
DVDNAV_STATUS_OK)
result = RSN_NAV_RESULT_BRANCH;
break;
case GST_NAVIGATION_COMMAND_DVD_AUDIO_MENU:
if (dvdnav_menu_call (src->dvdnav, DVD_MENU_Audio) == DVDNAV_STATUS_OK)
result = RSN_NAV_RESULT_BRANCH;
break;
case GST_NAVIGATION_COMMAND_DVD_ANGLE_MENU:
if (dvdnav_menu_call (src->dvdnav, DVD_MENU_Angle) == DVDNAV_STATUS_OK)
result = RSN_NAV_RESULT_BRANCH;
break;
case GST_NAVIGATION_COMMAND_DVD_CHAPTER_MENU:
if (dvdnav_menu_call (src->dvdnav, DVD_MENU_Part) == DVDNAV_STATUS_OK)
result = RSN_NAV_RESULT_BRANCH;
break;
case GST_NAVIGATION_COMMAND_LEFT:
case GST_NAVIGATION_COMMAND_RIGHT:
case GST_NAVIGATION_COMMAND_UP:
case GST_NAVIGATION_COMMAND_DOWN:
case GST_NAVIGATION_COMMAND_ACTIVATE:
return rsn_dvdsrc_perform_button_action (src, command);
case GST_NAVIGATION_COMMAND_PREV_ANGLE:{
gint32 cur, agls;
if (dvdnav_get_angle_info (src->dvdnav, &cur, &agls) == DVDNAV_STATUS_OK
&& cur > 0
&& dvdnav_angle_change (src->dvdnav, cur - 1) == DVDNAV_STATUS_OK)
g_print ("Switched to angle %d\n", cur - 1);
/* Angle switches are seamless and involve no branching */
break;
}
case GST_NAVIGATION_COMMAND_NEXT_ANGLE:{
gint32 cur, agls;
if (dvdnav_get_angle_info (src->dvdnav, &cur, &agls) == DVDNAV_STATUS_OK
&& dvdnav_angle_change (src->dvdnav, cur + 1) == DVDNAV_STATUS_OK)
g_print ("Switched to angle %d\n", cur + 1);
/* Angle switches are seamless and involve no branching */
break;
}
default:
break;
}
return result; return result;
} }
@ -1154,23 +1228,16 @@ rsn_dvdsrc_perform_button_action (resinDvdSrc * src, RsnNavAction action)
static gboolean static gboolean
rsn_dvdsrc_handle_navigation_event (resinDvdSrc * src, GstEvent * event) rsn_dvdsrc_handle_navigation_event (resinDvdSrc * src, GstEvent * event)
{ {
const GstStructure *s = gst_event_get_structure (event);
const gchar *event_type;
gboolean channel_hop = FALSE;
gboolean have_lock = FALSE; gboolean have_lock = FALSE;
GstEvent *hl_event = NULL; GstEvent *hl_event = NULL;
RsnNavResult nav_res = RSN_NAV_RESULT_NONE; RsnNavResult nav_res = RSN_NAV_RESULT_NONE;
GstNavigationEventType etype = gst_navigation_event_get_type (event);
GstMessage *mouse_over_msg = NULL;
if (s == NULL) switch (etype) {
return FALSE; case GST_NAVIGATION_EVENT_KEY_PRESS:{
event_type = gst_structure_get_string (s, "event"); const gchar *key;
if (event_type == NULL) if (!gst_navigation_event_parse_key_event (event, &key))
return FALSE;
if (strcmp (event_type, "key-press") == 0) {
const gchar *key = gst_structure_get_string (s, "key");
if (key == NULL)
return FALSE; return FALSE;
GST_DEBUG ("dvdnavsrc got a keypress: %s", key); GST_DEBUG ("dvdnavsrc got a keypress: %s", key);
@ -1181,24 +1248,23 @@ rsn_dvdsrc_handle_navigation_event (resinDvdSrc * src, GstEvent * event)
goto not_running; goto not_running;
if (g_str_equal (key, "Return")) { if (g_str_equal (key, "Return")) {
nav_res = rsn_dvdsrc_perform_button_action (src, RSN_NAV_ACTION_ACTIVATE); nav_res = rsn_dvdsrc_do_command (src, GST_NAVIGATION_COMMAND_ACTIVATE);
} else if (g_str_equal (key, "Left")) { } else if (g_str_equal (key, "Left")) {
nav_res = rsn_dvdsrc_perform_button_action (src, RSN_NAV_ACTION_LEFT); nav_res = rsn_dvdsrc_do_command (src, GST_NAVIGATION_COMMAND_LEFT);
} else if (g_str_equal (key, "Right")) { } else if (g_str_equal (key, "Right")) {
nav_res = rsn_dvdsrc_perform_button_action (src, RSN_NAV_ACTION_RIGHT); nav_res = rsn_dvdsrc_do_command (src, GST_NAVIGATION_COMMAND_RIGHT);
} else if (g_str_equal (key, "Up")) { } else if (g_str_equal (key, "Up")) {
nav_res = rsn_dvdsrc_perform_button_action (src, RSN_NAV_ACTION_UP); nav_res = rsn_dvdsrc_do_command (src, GST_NAVIGATION_COMMAND_UP);
} else if (g_str_equal (key, "Down")) { } else if (g_str_equal (key, "Down")) {
nav_res = rsn_dvdsrc_perform_button_action (src, RSN_NAV_ACTION_DOWN); nav_res = rsn_dvdsrc_do_command (src, GST_NAVIGATION_COMMAND_DOWN);
} else if (g_str_equal (key, "m")) { } else if (g_str_equal (key, "m")) {
if (dvdnav_menu_call (src->dvdnav, DVD_MENU_Escape) == DVDNAV_STATUS_OK) nav_res = rsn_dvdsrc_do_command (src, GST_NAVIGATION_COMMAND_DVD_MENU);
channel_hop = TRUE;
} else if (g_str_equal (key, "t")) { } else if (g_str_equal (key, "t")) {
if (dvdnav_menu_call (src->dvdnav, DVD_MENU_Title) == DVDNAV_STATUS_OK) nav_res =
channel_hop = TRUE; rsn_dvdsrc_do_command (src, GST_NAVIGATION_COMMAND_DVD_TITLE_MENU);
} else if (g_str_equal (key, "r")) { } else if (g_str_equal (key, "r")) {
if (dvdnav_menu_call (src->dvdnav, DVD_MENU_Root) == DVDNAV_STATUS_OK) nav_res =
channel_hop = TRUE; rsn_dvdsrc_do_command (src, GST_NAVIGATION_COMMAND_DVD_ROOT_MENU);
} else if (g_str_equal (key, "comma")) { } else if (g_str_equal (key, "comma")) {
gint title = 0; gint title = 0;
gint part = 0; gint part = 0;
@ -1208,31 +1274,27 @@ rsn_dvdsrc_handle_navigation_event (resinDvdSrc * src, GstEvent * event)
if (dvdnav_part_play (src->dvdnav, title, part - 1) == if (dvdnav_part_play (src->dvdnav, title, part - 1) ==
DVDNAV_STATUS_ERR) DVDNAV_STATUS_ERR)
dvdnav_prev_pg_search (src->dvdnav); dvdnav_prev_pg_search (src->dvdnav);
channel_hop = TRUE; nav_res = RSN_NAV_RESULT_BRANCH;
} else {
dvdnav_prev_pg_search (src->dvdnav);
nav_res = RSN_NAV_RESULT_BRANCH;
} }
} else if (g_str_equal (key, "period")) { } else if (g_str_equal (key, "period")) {
dvdnav_next_pg_search (src->dvdnav); dvdnav_next_pg_search (src->dvdnav);
channel_hop = TRUE; nav_res = RSN_NAV_RESULT_BRANCH;
} else if (g_str_equal (key, "bracketleft")) { } else if (g_str_equal (key, "bracketleft")) {
gint32 cur, agls; nav_res =
if (dvdnav_get_angle_info (src->dvdnav, &cur, &agls) == DVDNAV_STATUS_OK rsn_dvdsrc_do_command (src, GST_NAVIGATION_COMMAND_PREV_ANGLE);
&& cur > 0
&& dvdnav_angle_change (src->dvdnav, cur - 1) == DVDNAV_STATUS_OK)
g_print ("Switched to angle %d\n", cur - 1);
} else if (g_str_equal (key, "bracketright")) { } else if (g_str_equal (key, "bracketright")) {
gint32 cur, agls; nav_res =
if (dvdnav_get_angle_info (src->dvdnav, &cur, &agls) == DVDNAV_STATUS_OK rsn_dvdsrc_do_command (src, GST_NAVIGATION_COMMAND_NEXT_ANGLE);
&& dvdnav_angle_change (src->dvdnav, cur + 1) == DVDNAV_STATUS_OK)
g_print ("Switched to angle %d\n", cur + 1);
} else {
g_print ("Unknown keypress: %s\n", key);
} }
break;
} else if (strcmp (event_type, "mouse-move") == 0) { }
case GST_NAVIGATION_EVENT_MOUSE_MOVE:{
gdouble x, y; gdouble x, y;
if (!gst_structure_get_double (s, "pointer_x", &x) || if (!gst_navigation_event_parse_mouse_move_event (event, &x, &y))
!gst_structure_get_double (s, "pointer_y", &y))
return FALSE; return FALSE;
g_mutex_lock (src->dvd_lock); g_mutex_lock (src->dvd_lock);
@ -1244,12 +1306,28 @@ rsn_dvdsrc_handle_navigation_event (resinDvdSrc * src, GstEvent * event)
dvdnav_mouse_select (src->dvdnav, &src->cur_pci, (int) x, (int) y) == dvdnav_mouse_select (src->dvdnav, &src->cur_pci, (int) x, (int) y) ==
DVDNAV_STATUS_OK) { DVDNAV_STATUS_OK) {
nav_res = RSN_NAV_RESULT_HIGHLIGHT; nav_res = RSN_NAV_RESULT_HIGHLIGHT;
if (!src->was_mouse_over) {
GST_DEBUG_OBJECT (src, "Mouse moved onto a button");
mouse_over_msg =
gst_navigation_message_new_mouse_over ((GstObject *) src, TRUE);
src->was_mouse_over = TRUE;
} }
} else if (strcmp (event_type, "mouse-button-release") == 0) { } else if (src->was_mouse_over) {
GST_DEBUG_OBJECT (src, "Mouse moved out of a button");
mouse_over_msg =
gst_navigation_message_new_mouse_over ((GstObject *) src, FALSE);
src->was_mouse_over = FALSE;
}
break;
}
case GST_NAVIGATION_EVENT_MOUSE_BUTTON_RELEASE:{
gdouble x, y; gdouble x, y;
gint button;
if (!gst_structure_get_double (s, "pointer_x", &x) || if (!gst_navigation_event_parse_mouse_button_event (event, &button, &x,
!gst_structure_get_double (s, "pointer_y", &y)) &y))
return FALSE;
if (button != 1)
return FALSE; return FALSE;
GST_DEBUG_OBJECT (src, "Got click at %g, %g", x, y); GST_DEBUG_OBJECT (src, "Got click at %g, %g", x, y);
@ -1259,16 +1337,40 @@ rsn_dvdsrc_handle_navigation_event (resinDvdSrc * src, GstEvent * event)
if (!src->running) if (!src->running)
goto not_running; goto not_running;
if (src->have_pci && if (src->have_pci && dvdnav_mouse_activate (src->dvdnav, &src->cur_pci,
dvdnav_mouse_activate (src->dvdnav, &src->cur_pci, (int) x, (int) y) == (int) x, (int) y) == DVDNAV_STATUS_OK) {
DVDNAV_STATUS_OK) { nav_res = RSN_NAV_RESULT_BRANCH_AND_HIGHLIGHT;
nav_res = RSN_NAV_RESULT_BRANCH;
} }
break;
}
case GST_NAVIGATION_EVENT_COMMAND:{
GstNavigationCommand command;
if (!gst_navigation_event_parse_command (event, &command))
return FALSE;
if (command == GST_NAVIGATION_COMMAND_INVALID)
return FALSE;
g_mutex_lock (src->dvd_lock);
have_lock = TRUE;
if (!src->running)
goto not_running;
GST_LOG_OBJECT (src, "handling navigation command %d", command);
nav_res = rsn_dvdsrc_do_command (src, command);
break;
}
default:
return TRUE;
} }
if (have_lock) { if (have_lock) {
gboolean channel_hop = FALSE;
if (nav_res != RSN_NAV_RESULT_NONE) { if (nav_res != RSN_NAV_RESULT_NONE) {
if (nav_res == RSN_NAV_RESULT_BRANCH) { if (nav_res == RSN_NAV_RESULT_BRANCH) {
channel_hop = TRUE;
} else if (nav_res == RSN_NAV_RESULT_BRANCH_AND_HIGHLIGHT) {
src->active_highlight = TRUE; src->active_highlight = TRUE;
channel_hop = TRUE; channel_hop = TRUE;
} }
@ -1320,8 +1422,13 @@ rsn_dvdsrc_handle_navigation_event (resinDvdSrc * src, GstEvent * event)
} }
} }
if (mouse_over_msg) {
gst_element_post_message (GST_ELEMENT_CAST (src), mouse_over_msg);
}
return TRUE; return TRUE;
not_running: not_running:
if (have_lock)
g_mutex_unlock (src->dvd_lock); g_mutex_unlock (src->dvd_lock);
GST_DEBUG_OBJECT (src, "Element not started. Ignoring navigation event"); GST_DEBUG_OBJECT (src, "Element not started. Ignoring navigation event");
return FALSE; return FALSE;
@ -1430,6 +1537,9 @@ rsn_dvdsrc_prepare_streamsinfo_event (resinDvdSrc * src)
n_subp = vts_attr->nr_of_vts_subp_streams; n_subp = vts_attr->nr_of_vts_subp_streams;
} }
GST_DEBUG_OBJECT (src, "Preparing streamsinfo for %d audio and "
"%d subpicture streams", n_audio, n_subp);
/* build event */ /* build event */
s = gst_structure_new ("application/x-gst-dvd", s = gst_structure_new ("application/x-gst-dvd",
"event", G_TYPE_STRING, "dvd-lang-codes", NULL); "event", G_TYPE_STRING, "dvd-lang-codes", NULL);
@ -1578,7 +1688,7 @@ rsn_dvdsrc_update_highlight (resinDvdSrc * src)
if (button == 0) { if (button == 0) {
/* No highlight available, or no button selected - clear the SPU */ /* No highlight available, or no button selected - clear the SPU */
if (src->active_button != 0) { if (src->active_button < 1) {
src->active_button = 0; src->active_button = 0;
s = gst_structure_new ("application/x-gst-dvd", "event", s = gst_structure_new ("application/x-gst-dvd", "event",
@ -1624,7 +1734,7 @@ rsn_dvdsrc_update_highlight (resinDvdSrc * src)
event = gst_event_new_custom (GST_EVENT_CUSTOM_DOWNSTREAM_OOB, s); event = gst_event_new_custom (GST_EVENT_CUSTOM_DOWNSTREAM_OOB, s);
if (src->active_button == 0) { if (src->active_button < 1) {
/* When setting the button for the first time, take the /* When setting the button for the first time, take the
timestamp into account. */ timestamp into account. */
GST_EVENT_TIMESTAMP (event) = MPEGTIME_TO_GSTTIME (area.pts); GST_EVENT_TIMESTAMP (event) = MPEGTIME_TO_GSTTIME (area.pts);
@ -1816,14 +1926,15 @@ rsn_dvdsrc_src_event (RsnBaseSrc * basesrc, GstEvent * event)
resinDvdSrc *src = RESINDVDSRC (basesrc); resinDvdSrc *src = RESINDVDSRC (basesrc);
gboolean res; gboolean res;
GST_LOG_OBJECT (src, "handling %s event", GST_EVENT_TYPE_NAME (event));
switch (GST_EVENT_TYPE (event)) { switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_NAVIGATION: case GST_EVENT_NAVIGATION:
res = rsn_dvdsrc_handle_navigation_event (src, event); res = rsn_dvdsrc_handle_navigation_event (src, event);
break; break;
case GST_EVENT_SEEK:{ case GST_EVENT_SEEK:{
GstSeekFlags flags; GstSeekFlags flags;
GST_LOG_OBJECT (src, "handling seek event");
gst_event_parse_seek (event, NULL, NULL, &flags, NULL, NULL, NULL, NULL); gst_event_parse_seek (event, NULL, NULL, &flags, NULL, NULL, NULL, NULL);
src->flushing_seek = !!(flags & GST_SEEK_FLAG_FLUSH); src->flushing_seek = !!(flags & GST_SEEK_FLAG_FLUSH);
GST_DEBUG_OBJECT (src, "%s seek event", GST_DEBUG_OBJECT (src, "%s seek event",
@ -1833,6 +1944,8 @@ rsn_dvdsrc_src_event (RsnBaseSrc * basesrc, GstEvent * event)
break; break;
} }
default: default:
GST_LOG_OBJECT (src, "handling %s event", GST_EVENT_TYPE_NAME (event));
res = GST_BASE_SRC_CLASS (parent_class)->event (basesrc, event); res = GST_BASE_SRC_CLASS (parent_class)->event (basesrc, event);
break; break;
} }
@ -2196,6 +2309,7 @@ rsn_dvdsrc_do_seek (RsnBaseSrc * bsrc, GstSegment * segment)
src->active_button = -1; src->active_button = -1;
if (src->flushing_seek) { if (src->flushing_seek) {
GstMessage *mouse_over_msg = NULL;
g_mutex_lock (src->dvd_lock); g_mutex_lock (src->dvd_lock);
src->flushing_seek = FALSE; src->flushing_seek = FALSE;
@ -2210,7 +2324,15 @@ rsn_dvdsrc_do_seek (RsnBaseSrc * bsrc, GstSegment * segment)
src->nav_clock_id = NULL; src->nav_clock_id = NULL;
} }
rsn_dvdsrc_clear_nav_blocks (src); rsn_dvdsrc_clear_nav_blocks (src);
if (src->was_mouse_over) {
mouse_over_msg =
gst_navigation_message_new_mouse_over ((GstObject *) src, FALSE);
src->was_mouse_over = FALSE;
}
g_mutex_unlock (src->dvd_lock); g_mutex_unlock (src->dvd_lock);
if (mouse_over_msg)
gst_element_post_message (GST_ELEMENT_CAST (src), mouse_over_msg);
} }
GST_LOG_OBJECT (src, "Entering prepare_next_block after seek." GST_LOG_OBJECT (src, "Entering prepare_next_block after seek."

View file

@ -94,6 +94,8 @@ struct _resinDvdSrc
gboolean in_still_state; gboolean in_still_state;
gboolean in_playing; gboolean in_playing;
gboolean was_mouse_over;
GstBuffer *alloc_buf; GstBuffer *alloc_buf;
GstBuffer *next_buf; GstBuffer *next_buf;
/* TRUE if the next_buf is a nav block that needs enqueueing */ /* TRUE if the next_buf is a nav block that needs enqueueing */