After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 709770 - [PATCH] signal for message received by GstRTSPMedia
[PATCH] signal for message received by GstRTSPMedia
Status: RESOLVED INCOMPLETE
Product: GStreamer
Classification: Platform
Component: gst-rtsp-server
unspecified
Other Linux
: Normal enhancement
: NONE
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2013-10-09 20:15 UTC by Craig
Modified: 2018-01-13 14:25 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Craig 2013-10-09 20:15:26 UTC
diff -r d196ca9dfc7a gst/rtsp-server/rtsp-media.c
--- a/gst/rtsp-server/rtsp-media.c	Fri Sep 27 10:38:39 2013 -0600
+++ b/gst/rtsp-server/rtsp-media.c	Wed Oct 09 14:13:37 2013 -0600
@@ -56,6 +56,7 @@
   SIGNAL_PREPARED,
   SIGNAL_UNPREPARED,
   SIGNAL_NEW_STATE,
+  SIGNAL_BUS_MESSAGE,
   SIGNAL_LAST
 };
 
@@ -137,6 +138,11 @@
       G_STRUCT_OFFSET (GstRTSPMediaClass, new_state), NULL, NULL,
       g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 0, G_TYPE_INT);
 
+  gst_rtsp_media_signals[SIGNAL_BUS_MESSAGE] =
+      g_signal_new ("bus-message", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
+      G_STRUCT_OFFSET (GstRTSPMediaClass, bus_message), NULL, NULL,
+      g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, GST_TYPE_MESSAGE);
+
   klass->context = g_main_context_new ();
   klass->loop = g_main_loop_new (klass->context, TRUE);
 
@@ -1517,6 +1523,8 @@
 {
   GstMessageType type;
 
+  g_signal_emit (media, gst_rtsp_media_signals[SIGNAL_BUS_MESSAGE], 0, message,NULL);
+
   type = GST_MESSAGE_TYPE (message);
 
   switch (type) {
@@ -1622,6 +1630,7 @@
           gst_message_type_get_name (type));
       break;
   }
+
   return TRUE;
 }
 
diff -r d196ca9dfc7a gst/rtsp-server/rtsp-media.h
--- a/gst/rtsp-server/rtsp-media.h	Fri Sep 27 10:38:39 2013 -0600
+++ b/gst/rtsp-server/rtsp-media.h	Wed Oct 09 14:13:37 2013 -0600
@@ -260,6 +260,7 @@
   gboolean     (*unprepared)      (GstRTSPMedia *media);
 
   gboolean     (*new_state)       (GstRTSPMedia *media, GstState state);
+  gboolean     (*bus_message)       (GstRTSPMedia *media, GstMessage *message);
 };
 
 GType                 gst_rtsp_media_get_type         (void);
Comment 1 Wim Taymans 2013-11-12 08:41:40 UTC
We usually use subclassing to get the messages because then you can modify or drop the message or decide to call the parent before or after you custom implementation.

You can actually do all that if you hook the vmethod in a signal. I would accept a patch do implement it like that.