ext/dv/gstdvdec.c: Fix caps negotiation.

Original commit message from CVS:
* ext/dv/gstdvdec.c: (gst_dvdec_loop):
Fix caps negotiation.

* ext/dvdnav/dvdnavsrc.c: (dvdnavsrc_class_init),
(dvdnavsrc_update_buttoninfo), (dvdnavsrc_get),
(dvdnavsrc_get_event_mask), (dvdnav_handle_navigation_event),
(dvdnavsrc_event):
* ext/mpeg2dec/gstmpeg2dec.c:
* gst-libs/gst/navigation/navigation.c:
(gst_navigation_send_key_event), (gst_navigation_send_mouse_event):
* gst-libs/gst/navigation/navigation.h:
* gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_handle_src_event):
* sys/ximage/ximagesink.c: (gst_ximagesink_handle_xevents):
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_handle_xevents):
Super-simple first version of mouse and keyboard events. Clicking
on a DVD menu now works, although it may not take you where you
expected.

* gst/sine/gstsinesrc.c: (gst_sinesrc_src_fixate):
* gst/videotestsrc/gstvideotestsrc.c:
(gst_videotestsrc_src_fixate):
These fixate functions were broken - they never actually
fixated :)
This commit is contained in:
Jan Schmidt 2004-01-06 16:42:10 +00:00
parent 491381bf8c
commit b22d0599b3
9 changed files with 109 additions and 32 deletions

View file

@ -1,3 +1,29 @@
2004-01-07 Jan Schmidt <thaytan@mad.scientist.com>
* ext/dv/gstdvdec.c: (gst_dvdec_loop):
Fix caps negotiation.
* ext/dvdnav/dvdnavsrc.c: (dvdnavsrc_class_init),
(dvdnavsrc_update_buttoninfo), (dvdnavsrc_get),
(dvdnavsrc_get_event_mask), (dvdnav_handle_navigation_event),
(dvdnavsrc_event):
* ext/mpeg2dec/gstmpeg2dec.c:
* gst-libs/gst/navigation/navigation.c:
(gst_navigation_send_key_event), (gst_navigation_send_mouse_event):
* gst-libs/gst/navigation/navigation.h:
* gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_handle_src_event):
* sys/ximage/ximagesink.c: (gst_ximagesink_handle_xevents):
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_handle_xevents):
Super-simple first version of mouse and keyboard events. Clicking
on a DVD menu now works, although it may not take you where you
expected.
* gst/sine/gstsinesrc.c: (gst_sinesrc_src_fixate):
* gst/videotestsrc/gstvideotestsrc.c:
(gst_videotestsrc_src_fixate):
These fixate functions were broken - they never actually
fixated :)
2004-01-06 Ronald Bultje <rbultje@ronald.bitfreak.net> 2004-01-06 Ronald Bultje <rbultje@ronald.bitfreak.net>
* ext/shout/gstshout.c: (gst_icecastsend_base_init), * ext/shout/gstshout.c: (gst_icecastsend_base_init),

View file

@ -71,19 +71,23 @@ gst_navigation_send_event (GstNavigation *navigation, GstStructure *structure)
} }
void void
gst_navigation_send_key_event (GstNavigation *navigation, const char *key) gst_navigation_send_key_event (GstNavigation *navigation, const char *event,
const char *key)
{ {
gst_navigation_send_event (navigation, gst_structure_new ( gst_navigation_send_event (navigation, gst_structure_new (
"application/x-gst-navigation", "application/x-gst-navigation",
"event", G_TYPE_STRING, event,
"key", G_TYPE_STRING, key, NULL)); "key", G_TYPE_STRING, key, NULL));
} }
void void
gst_navigation_send_mouse_event (GstNavigation *navigation, double x, gst_navigation_send_mouse_event (GstNavigation *navigation, const char *event,
double y) int button, double x, double y)
{ {
gst_navigation_send_event (navigation, gst_structure_new ( gst_navigation_send_event (navigation, gst_structure_new (
"application/x-gst-navigation", "application/x-gst-navigation",
"event", G_TYPE_STRING, event,
"button", G_TYPE_INT, button,
"pointer_x", G_TYPE_DOUBLE, x, "pointer_x", G_TYPE_DOUBLE, x,
"pointer_y", G_TYPE_DOUBLE, y, NULL)); "pointer_y", G_TYPE_DOUBLE, y, NULL));
} }

View file

@ -52,9 +52,10 @@ GType gst_navigation_get_type (void);
/* virtual class function wrappers */ /* virtual class function wrappers */
void gst_navigation_send_event (GstNavigation *navigation, GstStructure *structure); void gst_navigation_send_event (GstNavigation *navigation, GstStructure *structure);
void gst_navigation_send_key_event (GstNavigation *navigation, const char *key); void gst_navigation_send_key_event (GstNavigation *navigation,
void gst_navigation_send_mouse_event (GstNavigation *navigation, double x, const char *event, const char *key);
double y); void gst_navigation_send_mouse_event (GstNavigation *navigation,
const char *event, int button, double x, double y);
G_END_DECLS G_END_DECLS

View file

@ -71,19 +71,23 @@ gst_navigation_send_event (GstNavigation *navigation, GstStructure *structure)
} }
void void
gst_navigation_send_key_event (GstNavigation *navigation, const char *key) gst_navigation_send_key_event (GstNavigation *navigation, const char *event,
const char *key)
{ {
gst_navigation_send_event (navigation, gst_structure_new ( gst_navigation_send_event (navigation, gst_structure_new (
"application/x-gst-navigation", "application/x-gst-navigation",
"event", G_TYPE_STRING, event,
"key", G_TYPE_STRING, key, NULL)); "key", G_TYPE_STRING, key, NULL));
} }
void void
gst_navigation_send_mouse_event (GstNavigation *navigation, double x, gst_navigation_send_mouse_event (GstNavigation *navigation, const char *event,
double y) int button, double x, double y)
{ {
gst_navigation_send_event (navigation, gst_structure_new ( gst_navigation_send_event (navigation, gst_structure_new (
"application/x-gst-navigation", "application/x-gst-navigation",
"event", G_TYPE_STRING, event,
"button", G_TYPE_INT, button,
"pointer_x", G_TYPE_DOUBLE, x, "pointer_x", G_TYPE_DOUBLE, x,
"pointer_y", G_TYPE_DOUBLE, y, NULL)); "pointer_y", G_TYPE_DOUBLE, y, NULL));
} }

View file

@ -52,9 +52,10 @@ GType gst_navigation_get_type (void);
/* virtual class function wrappers */ /* virtual class function wrappers */
void gst_navigation_send_event (GstNavigation *navigation, GstStructure *structure); void gst_navigation_send_event (GstNavigation *navigation, GstStructure *structure);
void gst_navigation_send_key_event (GstNavigation *navigation, const char *key); void gst_navigation_send_key_event (GstNavigation *navigation,
void gst_navigation_send_mouse_event (GstNavigation *navigation, double x, const char *event, const char *key);
double y); void gst_navigation_send_mouse_event (GstNavigation *navigation,
const char *event, int button, double x, double y);
G_END_DECLS G_END_DECLS

View file

@ -221,8 +221,10 @@ gst_sinesrc_src_fixate (GstPad *pad, const GstCaps *caps)
GstStructure *structure; GstStructure *structure;
GstCaps *newcaps; GstCaps *newcaps;
structure = gst_structure_copy (gst_caps_get_structure (caps, 0)); if (gst_caps_get_size (caps) > 1) return NULL;
newcaps = gst_caps_new_full (structure, NULL);
newcaps = gst_caps_copy (caps);
structure = gst_caps_get_structure (newcaps, 0);
if (gst_caps_structure_fixate_field_nearest_int (structure, "rate", 44100)) { if (gst_caps_structure_fixate_field_nearest_int (structure, "rate", 44100)) {
return newcaps; return newcaps;

View file

@ -201,12 +201,10 @@ gst_videotestsrc_src_fixate (GstPad * pad, const GstCaps * caps)
/* FIXME this function isn't very intelligent in choosing "good" caps */ /* FIXME this function isn't very intelligent in choosing "good" caps */
structure = gst_structure_copy(gst_caps_get_structure (caps, 0)); if (gst_caps_get_size (caps) > 1) return NULL;
newcaps = gst_caps_new_full (structure, NULL);
if (gst_caps_get_size (caps) > 1) { newcaps = gst_caps_copy (caps);
return newcaps; structure = gst_caps_get_structure (newcaps, 0);
}
if (gst_caps_structure_fixate_field_nearest_int (structure, "width", 320)) { if (gst_caps_structure_fixate_field_nearest_int (structure, "width", 320)) {
return newcaps; return newcaps;

View file

@ -352,16 +352,27 @@ gst_ximagesink_handle_xevents (GstXImageSink *ximagesink, GstPad *pad)
GST_DEBUG ("ximagesink pointer moved over window at %d,%d", GST_DEBUG ("ximagesink pointer moved over window at %d,%d",
e.xmotion.x, e.xmotion.y); e.xmotion.x, e.xmotion.y);
gst_navigation_send_mouse_event (GST_NAVIGATION (ximagesink), gst_navigation_send_mouse_event (GST_NAVIGATION (ximagesink),
"mouse-move",
0,
e.xmotion.x, e.xmotion.y); e.xmotion.x, e.xmotion.y);
break; break;
case ButtonPress: case ButtonPress:
case ButtonRelease:
/* Mouse button pressed/released over our window. We send upstream
events for interactivity/navigation */
GST_DEBUG ("ximagesink button %d pressed over window at %d,%d", GST_DEBUG ("ximagesink button %d pressed over window at %d,%d",
e.xbutton.button, e.xbutton.x, e.xbutton.x); e.xbutton.button, e.xbutton.x, e.xbutton.x);
gst_navigation_send_mouse_event (GST_NAVIGATION (ximagesink), gst_navigation_send_mouse_event (GST_NAVIGATION (ximagesink),
e.xmotion.x, e.xmotion.y); "mouse-button-press",
e.xbutton.button,
e.xbutton.x, e.xbutton.y);
break;
case ButtonRelease:
/* Mouse button pressed/released over our window. We send upstream
events for interactivity/navigation */
GST_DEBUG ("ximagesink button %d release over window at %d,%d",
e.xbutton.button, e.xbutton.x, e.xbutton.x);
gst_navigation_send_mouse_event (GST_NAVIGATION (ximagesink),
"mouse-button-release",
e.xbutton.button,
e.xbutton.x, e.xbutton.y);
break; break;
case KeyPress: case KeyPress:
case KeyRelease: case KeyRelease:
@ -371,11 +382,19 @@ gst_ximagesink_handle_xevents (GstXImageSink *ximagesink, GstPad *pad)
e.xkey.keycode, e.xkey.x, e.xkey.x); e.xkey.keycode, e.xkey.x, e.xkey.x);
keysym = XKeycodeToKeysym (ximagesink->xcontext->disp, keysym = XKeycodeToKeysym (ximagesink->xcontext->disp,
e.xkey.keycode, 0); e.xkey.keycode, 0);
gst_navigation_send_key_event (GST_NAVIGATION (ximagesink), if (keysym != NoSymbol) {
XKeysymToString (keysym)); gst_navigation_send_key_event (GST_NAVIGATION (ximagesink),
/* FIXME : What's that ? */ e.type == KeyPress ?
gst_navigation_send_key_event (GST_NAVIGATION (ximagesink), "key-press" : "key-release",
"unknown"); XKeysymToString (keysym));
}
else {
/* FIXME : What's that ? */
gst_navigation_send_key_event (GST_NAVIGATION (ximagesink),
e.type == KeyPress ?
"key-press" : "key-release",
"unknown");
}
break; break;
default: default:
GST_DEBUG ("ximagesink unhandled X event (%d)", e.type); GST_DEBUG ("ximagesink unhandled X event (%d)", e.type);

View file

@ -313,15 +313,27 @@ gst_xvimagesink_handle_xevents (GstXvImageSink *xvimagesink, GstPad *pad)
GST_DEBUG ("xvimagesink pointer moved over window at %d,%d", GST_DEBUG ("xvimagesink pointer moved over window at %d,%d",
e.xmotion.x, e.xmotion.y); e.xmotion.x, e.xmotion.y);
gst_navigation_send_mouse_event (GST_NAVIGATION (xvimagesink), gst_navigation_send_mouse_event (GST_NAVIGATION (xvimagesink),
"mouse-move", 0,
e.xmotion.x, e.xmotion.y); e.xmotion.x, e.xmotion.y);
break; break;
case ButtonPress: case ButtonPress:
case ButtonRelease: /* Mouse button pressed over our window. We send upstream
/* Mouse button pressed/released over our window. We send upstream
events for interactivity/navigation */ events for interactivity/navigation */
GST_DEBUG ("xvimagesink button %d pressed over window at %d,%d", GST_DEBUG ("xvimagesink button %d pressed over window at %d,%d",
e.xbutton.button, e.xbutton.x, e.xbutton.y); e.xbutton.button, e.xbutton.x, e.xbutton.y);
gst_navigation_send_mouse_event (GST_NAVIGATION (xvimagesink), gst_navigation_send_mouse_event (GST_NAVIGATION (xvimagesink),
"mouse-button-press",
e.xbutton.button,
e.xbutton.x, e.xbutton.y);
break;
case ButtonRelease:
/* Mouse button released over our window. We send upstream
events for interactivity/navigation */
GST_DEBUG ("xvimagesink button %d released over window at %d,%d",
e.xbutton.button, e.xbutton.x, e.xbutton.y);
gst_navigation_send_mouse_event (GST_NAVIGATION (xvimagesink),
"mouse-button-release",
e.xbutton.button,
e.xbutton.x, e.xbutton.y); e.xbutton.x, e.xbutton.y);
break; break;
case KeyPress: case KeyPress:
@ -332,8 +344,18 @@ gst_xvimagesink_handle_xevents (GstXvImageSink *xvimagesink, GstPad *pad)
e.xkey.keycode, e.xkey.x, e.xkey.y); e.xkey.keycode, e.xkey.x, e.xkey.y);
keysym = XKeycodeToKeysym (xvimagesink->xcontext->disp, keysym = XKeycodeToKeysym (xvimagesink->xcontext->disp,
e.xkey.keycode, 0); e.xkey.keycode, 0);
gst_navigation_send_key_event (GST_NAVIGATION (xvimagesink), if (keysym != NoSymbol) {
XKeysymToString (keysym)); gst_navigation_send_key_event (GST_NAVIGATION (xvimagesink),
e.type == KeyPress ?
"key-press" : "key-release",
XKeysymToString (keysym));
}
else {
gst_navigation_send_key_event (GST_NAVIGATION (xvimagesink),
e.type == KeyPress ?
"key-press" : "key-release",
"unknown");
}
break; break;
default: default:
GST_DEBUG ("xvimagesink unhandled X event (%d)", e.type); GST_DEBUG ("xvimagesink unhandled X event (%d)", e.type);