ext/dv/gstdvdec.c: Fix caps negotiation.
authorJan Schmidt <thaytan@mad.scientist.com>
Tue, 6 Jan 2004 16:42:10 +0000 (16:42 +0000)
committerJan Schmidt <thaytan@mad.scientist.com>
Tue, 6 Jan 2004 16:42:10 +0000 (16:42 +0000)
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 :)

ChangeLog
gst-libs/gst/interfaces/navigation.c
gst-libs/gst/interfaces/navigation.h
gst-libs/gst/navigation/navigation.c
gst-libs/gst/navigation/navigation.h
gst/sine/gstsinesrc.c
gst/videotestsrc/gstvideotestsrc.c
sys/ximage/ximagesink.c
sys/xvimage/xvimagesink.c

index 87e1ec042bb2a1f988ef7e4e41ab09b0660247b3..744721e6634117ff4f7daf1f5fb96e2bb6ca9c04 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>
 
        * ext/shout/gstshout.c: (gst_icecastsend_base_init),
index feb84dfa8f0462d70564f9e2a118bb8f6d4e1491..e3333cbad3fc500a6331d88a3bd47699f107ad42 100644 (file)
@@ -71,19 +71,23 @@ gst_navigation_send_event (GstNavigation *navigation, GstStructure *structure)
 }
 
 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 (
         "application/x-gst-navigation",
+       "event", G_TYPE_STRING, event,
        "key", G_TYPE_STRING, key, NULL));
 }
 
 void
-gst_navigation_send_mouse_event (GstNavigation *navigation, double x,
-        double y)
+gst_navigation_send_mouse_event (GstNavigation *navigation, const char *event, 
+       int button, double x, double y)
 {
   gst_navigation_send_event (navigation, gst_structure_new (
        "application/x-gst-navigation",
+       "event", G_TYPE_STRING, event,
+       "button", G_TYPE_INT, button,
        "pointer_x", G_TYPE_DOUBLE, x,
        "pointer_y", G_TYPE_DOUBLE, y, NULL));
 }
index faa5b809f7ffb23cf75281492f9c6b82e088ee49..5ccaf74898c9f9350e7dbab6ed1dcc3efd24ba57 100644 (file)
@@ -52,9 +52,10 @@ GType                gst_navigation_get_type (void);
 /* virtual class function wrappers */
 void gst_navigation_send_event (GstNavigation *navigation, GstStructure *structure);
 
-void gst_navigation_send_key_event (GstNavigation *navigation, const char *key);
-void gst_navigation_send_mouse_event (GstNavigation *navigation, double x,
-    double y);
+void gst_navigation_send_key_event (GstNavigation *navigation, 
+       const char *event, const char *key);
+void gst_navigation_send_mouse_event (GstNavigation *navigation, 
+       const char *event, int button, double x, double y);
 
 G_END_DECLS
 
index feb84dfa8f0462d70564f9e2a118bb8f6d4e1491..e3333cbad3fc500a6331d88a3bd47699f107ad42 100644 (file)
@@ -71,19 +71,23 @@ gst_navigation_send_event (GstNavigation *navigation, GstStructure *structure)
 }
 
 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 (
         "application/x-gst-navigation",
+       "event", G_TYPE_STRING, event,
        "key", G_TYPE_STRING, key, NULL));
 }
 
 void
-gst_navigation_send_mouse_event (GstNavigation *navigation, double x,
-        double y)
+gst_navigation_send_mouse_event (GstNavigation *navigation, const char *event, 
+       int button, double x, double y)
 {
   gst_navigation_send_event (navigation, gst_structure_new (
        "application/x-gst-navigation",
+       "event", G_TYPE_STRING, event,
+       "button", G_TYPE_INT, button,
        "pointer_x", G_TYPE_DOUBLE, x,
        "pointer_y", G_TYPE_DOUBLE, y, NULL));
 }
index faa5b809f7ffb23cf75281492f9c6b82e088ee49..5ccaf74898c9f9350e7dbab6ed1dcc3efd24ba57 100644 (file)
@@ -52,9 +52,10 @@ GType                gst_navigation_get_type (void);
 /* virtual class function wrappers */
 void gst_navigation_send_event (GstNavigation *navigation, GstStructure *structure);
 
-void gst_navigation_send_key_event (GstNavigation *navigation, const char *key);
-void gst_navigation_send_mouse_event (GstNavigation *navigation, double x,
-    double y);
+void gst_navigation_send_key_event (GstNavigation *navigation, 
+       const char *event, const char *key);
+void gst_navigation_send_mouse_event (GstNavigation *navigation, 
+       const char *event, int button, double x, double y);
 
 G_END_DECLS
 
index 36f7244af79094d6bb865572c3b21b382b6e4b3d..bed9ab9cd1443d1aaaeca573d0b7f577347fdb8f 100644 (file)
@@ -221,8 +221,10 @@ gst_sinesrc_src_fixate (GstPad *pad, const GstCaps *caps)
   GstStructure *structure;
   GstCaps *newcaps;
 
-  structure = gst_structure_copy (gst_caps_get_structure (caps, 0));
-  newcaps = gst_caps_new_full (structure, NULL);
+  if (gst_caps_get_size (caps) > 1) return NULL;
+
+  newcaps = gst_caps_copy (caps);
+  structure = gst_caps_get_structure (newcaps, 0);
 
   if (gst_caps_structure_fixate_field_nearest_int (structure, "rate", 44100)) {
     return newcaps;
index f9a7fe2589182d54e622face90710ea8346fc822..f5f8f1fb17f0cf5585e7f7401664c80e3209d84a 100644 (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 */
 
-  structure = gst_structure_copy(gst_caps_get_structure (caps, 0));
-  newcaps = gst_caps_new_full (structure, NULL);
+  if (gst_caps_get_size (caps) > 1) return NULL;
 
-  if (gst_caps_get_size (caps) > 1) {
-    return newcaps;
-  }
+  newcaps = gst_caps_copy (caps);
+  structure = gst_caps_get_structure (newcaps, 0);
 
   if (gst_caps_structure_fixate_field_nearest_int (structure, "width", 320)) {
     return newcaps;
index b9eb7504c546e68330122e42a8ba565db36bb8fe..e0dc80cbce28fe940630fcfb8521ce2b8514e414 100644 (file)
@@ -352,16 +352,27 @@ gst_ximagesink_handle_xevents (GstXImageSink *ximagesink, GstPad *pad)
             GST_DEBUG ("ximagesink pointer moved over window at %d,%d",
                        e.xmotion.x, e.xmotion.y);
             gst_navigation_send_mouse_event (GST_NAVIGATION (ximagesink),
+                                             "mouse-move",
+                                            0,
                                              e.xmotion.x, e.xmotion.y);
             break;
           case ButtonPress:
+            GST_DEBUG ("ximagesink button %d pressed over window at %d,%d",
+                       e.xbutton.button, e.xbutton.x, e.xbutton.x);
+            gst_navigation_send_mouse_event (GST_NAVIGATION (ximagesink),
+                                             "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 pressed over window at %d,%d",
+            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),
-                                             e.xmotion.x, e.xmotion.y);
+                                            "mouse-button-release",
+                                            e.xbutton.button,
+                                             e.xbutton.x, e.xbutton.y);
             break;
           case KeyPress:
           case KeyRelease:
@@ -371,11 +382,19 @@ gst_ximagesink_handle_xevents (GstXImageSink *ximagesink, GstPad *pad)
                        e.xkey.keycode, e.xkey.x, e.xkey.x);
             keysym = XKeycodeToKeysym (ximagesink->xcontext->disp,
                                        e.xkey.keycode, 0);
-            gst_navigation_send_key_event (GST_NAVIGATION (ximagesink),
-                                           XKeysymToString (keysym));
-            /* FIXME : What's that ? */
-            gst_navigation_send_key_event (GST_NAVIGATION (ximagesink),
-                                           "unknown");
+           if (keysym != NoSymbol) {
+               gst_navigation_send_key_event (GST_NAVIGATION (ximagesink),
+                                              e.type == KeyPress ? 
+                                                 "key-press" : "key-release",
+                                               XKeysymToString (keysym));
+           }
+           else {
+               /* FIXME : What's that ? */
+               gst_navigation_send_key_event (GST_NAVIGATION (ximagesink),
+                                              e.type == KeyPress ? 
+                                                 "key-press" : "key-release",
+                                               "unknown");
+           }
             break;
           default:
             GST_DEBUG ("ximagesink unhandled X event (%d)", e.type);
index 27de14cd4babec3b5e436207ab0a9044bc37e01d..7c3da91ef281e2f9c44be425362e0e0b62b4ef17 100644 (file)
@@ -313,15 +313,27 @@ gst_xvimagesink_handle_xevents (GstXvImageSink *xvimagesink, GstPad *pad)
             GST_DEBUG ("xvimagesink pointer moved over window at %d,%d",
                        e.xmotion.x, e.xmotion.y);
             gst_navigation_send_mouse_event (GST_NAVIGATION (xvimagesink),
+                                            "mouse-move", 0, 
                                              e.xmotion.x, e.xmotion.y);
             break;
           case ButtonPress:
-          case ButtonRelease:
-            /* Mouse button pressed/released over our window. We send upstream
+            /* Mouse button pressed over our window. We send upstream
                events for interactivity/navigation */
             GST_DEBUG ("xvimagesink button %d pressed over window at %d,%d",
                        e.xbutton.button, e.xbutton.x, e.xbutton.y);
             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);
             break;
           case KeyPress:
@@ -332,8 +344,18 @@ gst_xvimagesink_handle_xevents (GstXvImageSink *xvimagesink, GstPad *pad)
                        e.xkey.keycode, e.xkey.x, e.xkey.y);
             keysym = XKeycodeToKeysym (xvimagesink->xcontext->disp,
                                        e.xkey.keycode, 0);
-            gst_navigation_send_key_event (GST_NAVIGATION (xvimagesink),
-                                           XKeysymToString (keysym));
+           if (keysym != NoSymbol) {
+               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;
           default:
             GST_DEBUG ("xvimagesink unhandled X event (%d)", e.type);