Use GStreamer's debugging subsystem
authorSebastian Pölsterl <sebp@k-d-w.org>
Sat, 21 Nov 2009 18:20:23 +0000 (19:20 +0100)
committerSebastian Pölsterl <sebp@k-d-w.org>
Sat, 21 Nov 2009 18:20:23 +0000 (19:20 +0100)
gst/rtsp-server/rtsp-client.c
gst/rtsp-server/rtsp-media-factory.c
gst/rtsp-server/rtsp-media-mapping.c
gst/rtsp-server/rtsp-media.c
gst/rtsp-server/rtsp-server.c
gst/rtsp-server/rtsp-session-pool.c
gst/rtsp-server/rtsp-session.c

index 050969d..22477b2 100644 (file)
@@ -36,6 +36,9 @@ enum
   PROP_LAST
 };
 
+GST_DEBUG_CATEGORY_STATIC (rtsp_client_debug);
+#define GST_CAT_DEFAULT rtsp_client_debug
+
 static void gst_rtsp_client_get_property (GObject * object, guint propid,
     GValue * value, GParamSpec * pspec);
 static void gst_rtsp_client_set_property (GObject * object, guint propid,
@@ -73,6 +76,8 @@ gst_rtsp_client_class_init (GstRTSPClientClass * klass)
   tunnels =
       g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref);
   tunnels_lock = g_mutex_new ();
+
+  GST_DEBUG_CATEGORY_INIT (rtsp_client_debug, "rtspclient", 0, "GstRTSPClient");
 }
 
 static void
@@ -87,7 +92,7 @@ gst_rtsp_client_finalize (GObject * obj)
   GstRTSPClient *client = GST_RTSP_CLIENT (obj);
   GList *walk;
 
-  g_message ("finalize client %p", client);
+  GST_INFO ("finalize client %p", client);
 
   /* remove weak-ref from sessions */
   for (walk = client->sessions; walk; walk = g_list_next (walk)) {
@@ -259,7 +264,7 @@ find_media (GstRTSPClient * client, GstRTSPUrl * uri, GstRTSPMessage * request)
   } else {
     /* we have seen this uri before, used cached media */
     media = client->media;
-    g_message ("reusing cached media %p", media);
+    GST_INFO ("reusing cached media %p", media);
   }
 
   if (media)
@@ -601,7 +606,7 @@ handle_play_request (GstRTSPClient * client, GstRTSPUrl * uri,
     sstream = gst_rtsp_session_media_get_stream (media, i);
     /* get the transport, if there is no transport configured, skip this stream */
     if (!(tr = sstream->trans.transport)) {
-      g_message ("stream %d is not configured", i);
+      GST_INFO ("stream %d is not configured", i);
       continue;
     }
 
@@ -633,7 +638,7 @@ handle_play_request (GstRTSPClient * client, GstRTSPUrl * uri,
 
       infocount++;
     } else {
-      g_warning ("RTP-Info cannot be determined for stream %d", i);
+      GST_WARNING ("RTP-Info cannot be determined for stream %d", i);
     }
   }
 
@@ -685,7 +690,7 @@ invalid_state:
 static void
 do_keepalive (GstRTSPSession * session)
 {
-  g_message ("keep session %p alive", session);
+  GST_INFO ("keep session %p alive", session);
   gst_rtsp_session_touch (session);
 }
 
@@ -1023,7 +1028,7 @@ static void
 client_session_finalized (GstRTSPClient * client, GstRTSPSession * session)
 {
   if (!(client->sessions = g_list_remove (client->sessions, session))) {
-    g_message ("all sessions finalized, close the connection");
+    GST_INFO ("all sessions finalized, close the connection");
     g_source_destroy ((GSource *) client->watch);
   }
 }
@@ -1041,7 +1046,7 @@ client_watch_session (GstRTSPClient * client, GstRTSPSession * session)
       return;
   }
 
-  g_message ("watching session %p", session);
+  GST_INFO ("watching session %p", session);
 
   g_object_weak_ref (G_OBJECT (session), (GWeakNotify) client_session_finalized,
       client);
@@ -1063,7 +1068,7 @@ handle_request (GstRTSPClient * client, GstRTSPMessage * request)
   gst_rtsp_message_dump (request);
 #endif
 
-  g_message ("client %p: received a request", client);
+  GST_INFO ("client %p: received a request", client);
 
   gst_rtsp_message_parse_request (request, &method, &uristr, &version);
 
@@ -1327,7 +1332,7 @@ message_sent (GstRTSPWatch * watch, guint cseq, gpointer user_data)
   
   client = GST_RTSP_CLIENT (user_data);
 
-  /* g_message ("client %p: sent a message with cseq %d", client, cseq); */
+  /* GST_INFO ("client %p: sent a message with cseq %d", client, cseq); */
 
   return GST_RTSP_OK;
 }
@@ -1338,7 +1343,7 @@ closed (GstRTSPWatch * watch, gpointer user_data)
   GstRTSPClient *client = GST_RTSP_CLIENT (user_data);
   const gchar *tunnelid;
 
-  g_message ("client %p: connection closed", client);
+  GST_INFO ("client %p: connection closed", client);
 
   if ((tunnelid = gst_rtsp_connection_get_tunnelid (client->connection))) {
     g_mutex_lock (tunnels_lock);
@@ -1359,7 +1364,7 @@ error (GstRTSPWatch * watch, GstRTSPResult result, gpointer user_data)
   gchar *str;
 
   str = gst_rtsp_strresult (result);
-  g_message ("client %p: received an error %s", client, str);
+  GST_INFO ("client %p: received an error %s", client, str);
   g_free (str);
 
   return GST_RTSP_OK;
@@ -1373,14 +1378,14 @@ tunnel_start (GstRTSPWatch * watch, gpointer user_data)
 
   client = GST_RTSP_CLIENT (user_data);
 
-  g_message ("client %p: tunnel start", client);
+  GST_INFO ("client %p: tunnel start", client);
 
   /* store client in the pending tunnels */
   tunnelid = gst_rtsp_connection_get_tunnelid (client->connection);
   if (tunnelid == NULL)
     goto no_tunnelid;
 
-  g_message ("client %p: inserting %s", client, tunnelid);
+  GST_INFO ("client %p: inserting %s", client, tunnelid);
 
   /* we can't have two clients connecting with the same tunnelid */
   g_mutex_lock (tunnels_lock);
@@ -1395,13 +1400,13 @@ tunnel_start (GstRTSPWatch * watch, gpointer user_data)
   /* ERRORS */
 no_tunnelid:
   {
-    g_message ("client %p: no tunnelid provided", client);
+    GST_INFO ("client %p: no tunnelid provided", client);
     return GST_RTSP_STS_SERVICE_UNAVAILABLE;
   }
 tunnel_existed:
   {
     g_mutex_unlock (tunnels_lock);
-    g_message ("client %p: tunnel session %s existed", client, tunnelid);
+    GST_INFO ("client %p: tunnel session %s existed", client, tunnelid);
     return GST_RTSP_STS_SERVICE_UNAVAILABLE;
   }
 }
@@ -1413,7 +1418,7 @@ tunnel_complete (GstRTSPWatch * watch, gpointer user_data)
   GstRTSPClient *client = GST_RTSP_CLIENT (user_data);
   GstRTSPClient *oclient;
 
-  g_message ("client %p: tunnel complete", client);
+  GST_INFO ("client %p: tunnel complete", client);
 
   /* find previous tunnel */
   tunnelid = gst_rtsp_connection_get_tunnelid (client->connection);
@@ -1430,7 +1435,7 @@ tunnel_complete (GstRTSPWatch * watch, gpointer user_data)
   g_hash_table_remove (tunnels, tunnelid);
   g_mutex_unlock (tunnels_lock);
 
-  g_message ("client %p: found tunnel %p", client, oclient);
+  GST_INFO ("client %p: found tunnel %p", client, oclient);
 
   /* merge the tunnels into the first client */
   gst_rtsp_connection_do_tunnel (oclient->connection, client->connection);
@@ -1446,13 +1451,13 @@ tunnel_complete (GstRTSPWatch * watch, gpointer user_data)
   /* ERRORS */
 no_tunnelid:
   {
-    g_message ("client %p: no tunnelid provided", client);
+    GST_INFO ("client %p: no tunnelid provided", client);
     return GST_RTSP_STS_SERVICE_UNAVAILABLE;
   }
 no_tunnel:
   {
     g_mutex_unlock (tunnels_lock);
-    g_message ("client %p: tunnel session %s not found", client, tunnelid);
+    GST_INFO ("client %p: tunnel session %s not found", client, tunnelid);
     return GST_RTSP_STS_SERVICE_UNAVAILABLE;
   }
 }
@@ -1494,7 +1499,7 @@ gst_rtsp_client_accept (GstRTSPClient * client, GIOChannel * channel)
   GST_RTSP_CHECK (gst_rtsp_connection_accept (sock, &conn), accept_failed);
 
   url = gst_rtsp_connection_get_url (conn);
-  g_message ("added new client %p ip %s:%d", client, url->host, url->port);
+  GST_INFO ("added new client %p ip %s:%d", client, url->host, url->port);
 
   client->connection = conn;
 
@@ -1508,7 +1513,7 @@ gst_rtsp_client_accept (GstRTSPClient * client, GIOChannel * channel)
   else
     context = NULL;
 
-  g_message ("attaching to context %p", context);
+  GST_INFO ("attaching to context %p", context);
 
   client->watchid = gst_rtsp_watch_attach (client->watch, context);
   gst_rtsp_watch_unref (client->watch);
@@ -1520,7 +1525,7 @@ accept_failed:
   {
     gchar *str = gst_rtsp_strresult (res);
 
-    g_error ("Could not accept client on server socket %d: %s", sock, str);
+    GST_ERROR ("Could not accept client on server socket %d: %s", sock, str);
     g_free (str);
     return FALSE;
   }
index 31823ce..52f9471 100644 (file)
@@ -30,6 +30,9 @@ enum
   PROP_LAST
 };
 
+GST_DEBUG_CATEGORY (rtsp_media_debug);
+#define GST_CAT_DEFAULT rtsp_media_debug
+
 static void gst_rtsp_media_factory_get_property (GObject *object, guint propid,
     GValue *value, GParamSpec *pspec);
 static void gst_rtsp_media_factory_set_property (GObject *object, guint propid,
@@ -81,6 +84,8 @@ gst_rtsp_media_factory_class_init (GstRTSPMediaFactoryClass * klass)
   klass->construct = default_construct;
   klass->configure = default_configure;
   klass->create_pipeline = default_create_pipeline;
+
+  GST_DEBUG_CATEGORY_INIT (rtsp_media_debug, "rtspmedia", 0, "GstRTSPMedia");
 }
 
 static void
@@ -340,7 +345,7 @@ gst_rtsp_media_factory_construct (GstRTSPMediaFactory *factory, const GstRTSPUrl
   if (key)
     g_free (key);
 
-  g_message ("constructed media %p for url %s", media, url->abspath);
+  GST_INFO ("constructed media %p for url %s", media, url->abspath);
 
   return media;
 }
@@ -375,7 +380,7 @@ default_get_element (GstRTSPMediaFactory *factory, const GstRTSPUrl *url)
 
   if (error != NULL) {
     /* a recoverable error was encountered */
-    g_warning ("recoverable parsing error: %s", error->message);
+    GST_WARNING ("recoverable parsing error: %s", error->message);
     g_error_free (error);
   }
   return element;
@@ -424,7 +429,7 @@ gst_rtsp_media_factory_collect_streams (GstRTSPMediaFactory *factory, const GstR
       stream = g_new0 (GstRTSPMediaStream, 1);
       stream->payloader = elem;
 
-      g_message ("found stream %d with payloader %p", i, elem);
+      GST_INFO ("found stream %d with payloader %p", i, elem);
 
       pad = gst_element_get_static_pad (elem, "src");
 
@@ -444,7 +449,7 @@ gst_rtsp_media_factory_collect_streams (GstRTSPMediaFactory *factory, const GstR
     if ((elem = gst_bin_get_by_name (GST_BIN (element), name))) {
       /* a stream that will dynamically create pads to provide RTP packets */
 
-      g_message ("found dynamic element %d, %p", i, elem);
+      GST_INFO ("found dynamic element %d, %p", i, elem);
 
       media->dynamic = g_list_prepend (media->dynamic, elem);
 
index 52490cd..b0020fd 100644 (file)
@@ -21,6 +21,9 @@
 
 G_DEFINE_TYPE (GstRTSPMediaMapping, gst_rtsp_media_mapping, G_TYPE_OBJECT);
 
+GST_DEBUG_CATEGORY_EXTERN (rtsp_media_debug);
+#define GST_CAT_DEFAULT rtsp_media_debug
+
 static void gst_rtsp_media_mapping_finalize (GObject * obj);
 
 static GstRTSPMediaFactory * find_media (GstRTSPMediaMapping *mapping, const GstRTSPUrl *url);
@@ -76,7 +79,7 @@ find_media (GstRTSPMediaMapping *mapping, const GstRTSPUrl *url)
   if (result) 
     g_object_ref (result);
 
-  g_message ("found media %p for url abspath %s", result, url->abspath);
+  GST_INFO ("found media %p for url abspath %s", result, url->abspath);
 
   return result;
 }
index fe79296..70de6fd 100644 (file)
@@ -44,6 +44,9 @@ enum
   SIGNAL_LAST
 };
 
+GST_DEBUG_CATEGORY_EXTERN (rtsp_media_debug);
+#define GST_CAT_DEFAULT rtsp_media_debug
+
 static GQuark ssrc_stream_map_key;
 
 static void gst_rtsp_media_get_property (GObject *object, guint propid,
@@ -141,7 +144,7 @@ gst_rtsp_media_finalize (GObject * obj)
 
   media = GST_RTSP_MEDIA (obj);
 
-  g_message ("finalize media %p", media);
+  GST_INFO ("finalize media %p", media);
 
   if (media->pipeline) {
     unlock_streams (media);
@@ -208,9 +211,9 @@ gst_rtsp_media_set_property (GObject *object, guint propid,
 static gpointer
 do_loop (GstRTSPMediaClass *klass)
 {
-  g_message ("enter mainloop");
+  GST_INFO ("enter mainloop");
   g_main_loop_run (klass->loop);
-  g_message ("exit mainloop");
+  GST_INFO ("exit mainloop");
 
   return NULL;
 }
@@ -233,18 +236,18 @@ collect_media_stats (GstRTSPMedia *media)
     /* get the position */
     format = GST_FORMAT_TIME;
     if (!gst_element_query_position (media->pipeline, &format, &position)) {
-      g_message ("position query failed");
+      GST_INFO ("position query failed");
       position = 0;
     }
 
     /* get the duration */
     format = GST_FORMAT_TIME;
     if (!gst_element_query_duration (media->pipeline, &format, &duration)) {
-      g_message ("duration query failed");
+      GST_INFO ("duration query failed");
       duration = -1;
     }
 
-    g_message ("stats: position %"GST_TIME_FORMAT", duration %"GST_TIME_FORMAT,
+    GST_INFO ("stats: position %"GST_TIME_FORMAT", duration %"GST_TIME_FORMAT,
        GST_TIME_ARGS (position), GST_TIME_ARGS (duration));
 
     if (position == -1) {
@@ -457,21 +460,21 @@ gst_rtsp_media_seek (GstRTSPMedia *media, GstRTSPTimeRange *range)
   }
   
   if (start != -1 || stop != -1) {
-    g_message ("seeking to %"GST_TIME_FORMAT" - %"GST_TIME_FORMAT,
+    GST_INFO ("seeking to %"GST_TIME_FORMAT" - %"GST_TIME_FORMAT,
                GST_TIME_ARGS (start), GST_TIME_ARGS (stop));
 
     res = gst_element_seek (media->pipeline, 1.0, GST_FORMAT_TIME,
        flags, start_type, start, stop_type, stop);
 
     /* and block for the seek to complete */
-    g_message ("done seeking %d", res);
+    GST_INFO ("done seeking %d", res);
     gst_element_get_state (media->pipeline, NULL, NULL, -1);
-    g_message ("prerolled again");
+    GST_INFO ("prerolled again");
 
     collect_media_stats (media);
   }
   else {
-    g_message ("no seek needed");
+    GST_INFO ("no seek needed");
     res = TRUE;
   }
 
@@ -480,12 +483,12 @@ gst_rtsp_media_seek (GstRTSPMedia *media, GstRTSPTimeRange *range)
   /* ERRORS */
 not_supported:
   {
-    g_warning ("seek unit %d not supported", range->unit);
+    GST_WARNING ("seek unit %d not supported", range->unit);
     return FALSE;
   }
 weird_type:
   {
-    g_warning ("weird range type %d not supported", range->min.type);
+    GST_WARNING ("weird range type %d not supported", range->min.type);
     return FALSE;
   }
 }
@@ -710,7 +713,7 @@ caps_notify (GstPad * pad, GParamSpec * unused, GstRTSPMediaStream * stream)
     gst_caps_unref (oldcaps);
 
   capsstr = gst_caps_to_string (newcaps);
-  g_message ("stream %p received caps %p, %s", stream, newcaps, capsstr);
+  GST_INFO ("stream %p received caps %p, %s", stream, newcaps, capsstr);
   g_free (capsstr);
 }
 
@@ -720,7 +723,7 @@ dump_structure (const GstStructure *s)
   gchar *sstr;
 
   sstr = gst_structure_to_string (s);
-  g_message ("structure: %s", sstr);
+  GST_INFO ("structure: %s", sstr);
   g_free (sstr);
 }
 
@@ -743,7 +746,7 @@ find_transport (GstRTSPMediaStream *stream, const gchar *rtcp_from)
   port = atoi (tmp + 1);
   dest = g_strndup (rtcp_from, tmp - rtcp_from);
 
-  g_message ("finding %s:%d", dest, port);
+  GST_INFO ("finding %s:%d", dest, port);
 
   for (walk = stream->transports; walk; walk = g_list_next (walk)) {
     GstRTSPMediaTrans *trans = walk->data;
@@ -768,7 +771,7 @@ on_new_ssrc (GObject *session, GObject *source, GstRTSPMediaStream *stream)
   GstStructure *stats;
   GstRTSPMediaTrans *trans;
 
-  g_message ("%p: new source %p", stream, source);
+  GST_INFO ("%p: new source %p", stream, source);
 
   /* see if we have a stream to match with the origin of the RTCP packet */
   trans = g_object_get_qdata (source, ssrc_stream_map_key);
@@ -781,7 +784,7 @@ on_new_ssrc (GObject *session, GObject *source, GstRTSPMediaStream *stream)
 
       rtcp_from = gst_structure_get_string (stats, "rtcp-from");
       if ((trans = find_transport (stream, rtcp_from))) {
-        g_message ("%p: found transport %p for source  %p", stream, trans, source);
+        GST_INFO ("%p: found transport %p for source  %p", stream, trans, source);
 
        /* keep ref to the source */
        trans->rtpsource = source;
@@ -791,14 +794,14 @@ on_new_ssrc (GObject *session, GObject *source, GstRTSPMediaStream *stream)
       gst_structure_free (stats);
     }
   } else {
-    g_message ("%p: source %p for transport %p", stream, source, trans);
+    GST_INFO ("%p: source %p for transport %p", stream, source, trans);
   }
 }
 
 static void
 on_ssrc_sdes (GObject *session, GObject *source, GstRTSPMediaStream *stream)
 {
-  g_message ("%p: new SDES %p", stream, source);
+  GST_INFO ("%p: new SDES %p", stream, source);
 }
 
 static void
@@ -808,7 +811,7 @@ on_ssrc_active (GObject *session, GObject *source, GstRTSPMediaStream *stream)
 
   trans = g_object_get_qdata (source, ssrc_stream_map_key);
 
-  g_message ("%p: source %p in transport %p is active", stream, source, trans);
+  GST_INFO ("%p: source %p in transport %p is active", stream, source, trans);
 
   if (trans && trans->keep_alive)
     trans->keep_alive (trans->ka_user_data);
@@ -828,7 +831,7 @@ on_ssrc_active (GObject *session, GObject *source, GstRTSPMediaStream *stream)
 static void
 on_bye_ssrc (GObject *session, GObject *source, GstRTSPMediaStream *stream)
 {
-  g_message ("%p: source %p bye", stream, source);
+  GST_INFO ("%p: source %p bye", stream, source);
 }
 
 static void
@@ -836,7 +839,7 @@ on_bye_timeout (GObject *session, GObject *source, GstRTSPMediaStream *stream)
 {
   GstRTSPMediaTrans *trans;
 
-  g_message ("%p: source %p bye timeout", stream, source);
+  GST_INFO ("%p: source %p bye timeout", stream, source);
 
   if ((trans = g_object_get_qdata (source, ssrc_stream_map_key))) {
     trans->rtpsource = NULL;
@@ -849,7 +852,7 @@ on_timeout (GObject *session, GObject *source, GstRTSPMediaStream *stream)
 {
   GstRTSPMediaTrans *trans;
 
-  g_message ("%p: source %p timeout", stream, source);
+  GST_INFO ("%p: source %p timeout", stream, source);
 
   if ((trans = g_object_get_qdata (source, ssrc_stream_map_key))) {
     trans->rtpsource = NULL;
@@ -1068,7 +1071,7 @@ setup_stream (GstRTSPMediaStream *stream, guint idx, GstRTSPMedia *media)
   /* ERRORS */
 link_failed:
   {
-    g_warning ("failed to link stream %d", idx);
+    GST_WARNING ("failed to link stream %d", idx);
     return FALSE;
   }
 }
@@ -1115,22 +1118,22 @@ default_handle_message (GstRTSPMedia *media, GstMessage *message)
         media->buffering = FALSE;
         /* if the desired state is playing, go back */
         if (media->target_state == GST_STATE_PLAYING) {
-          g_message ("Buffering done, setting pipeline to PLAYING");
+          GST_INFO ("Buffering done, setting pipeline to PLAYING");
           gst_element_set_state (media->pipeline, GST_STATE_PLAYING);
         }
        else {
-          g_message ("Buffering done");
+          GST_INFO ("Buffering done");
        }
       } else {
         /* buffering busy */
         if (media->buffering == FALSE) {
          if (media->target_state == GST_STATE_PLAYING) {
             /* we were not buffering but PLAYING, PAUSE  the pipeline. */
-            g_message ("Buffering, setting pipeline to PAUSED ...");
+            GST_INFO ("Buffering, setting pipeline to PAUSED ...");
             gst_element_set_state (media->pipeline, GST_STATE_PAUSED);
          }
          else {
-            g_message ("Buffering ...");
+            GST_INFO ("Buffering ...");
          }
         }
         media->buffering = TRUE;
@@ -1148,7 +1151,7 @@ default_handle_message (GstRTSPMedia *media, GstMessage *message)
       gchar *debug;
 
       gst_message_parse_error (message, &gerror, &debug);
-      g_warning ("%p: got error %s (%s)", media, gerror->message, debug);
+      GST_WARNING ("%p: got error %s (%s)", media, gerror->message, debug);
       g_error_free (gerror);
       g_free (debug);
       break;
@@ -1159,7 +1162,7 @@ default_handle_message (GstRTSPMedia *media, GstMessage *message)
       gchar *debug;
 
       gst_message_parse_warning (message, &gerror, &debug);
-      g_warning ("%p: got warning %s (%s)", media, gerror->message, debug);
+      GST_WARNING ("%p: got warning %s (%s)", media, gerror->message, debug);
       g_error_free (gerror);
       g_free (debug);
       break;
@@ -1169,7 +1172,7 @@ default_handle_message (GstRTSPMedia *media, GstMessage *message)
     case GST_MESSAGE_STREAM_STATUS:
       break;
     default:
-      g_message ("%p: got message type %s", media, gst_message_type_get_name (type));
+      GST_INFO ("%p: got message type %s", media, gst_message_type_get_name (type));
       break;
   }
   return TRUE;
@@ -1200,7 +1203,7 @@ pad_added_cb (GstElement *element, GstPad *pad, GstRTSPMedia *media)
 
   i = media->streams->len + 1;
 
-  g_message ("pad added %s:%s, stream %d", GST_DEBUG_PAD_NAME (pad), i);
+  GST_INFO ("pad added %s:%s, stream %d", GST_DEBUG_PAD_NAME (pad), i);
 
   stream = g_new0 (GstRTSPMediaStream, 1);
   stream->payloader = element;
@@ -1230,14 +1233,14 @@ pad_added_cb (GstElement *element, GstPad *pad, GstRTSPMedia *media)
 static void
 no_more_pads_cb (GstElement *element, GstRTSPMedia *media)
 {
-  g_message ("no more pads");
+  GST_INFO ("no more pads");
   if (media->fakesink) {
     gst_object_ref (media->fakesink);
     gst_bin_remove (GST_BIN (media->pipeline), media->fakesink);
     gst_element_set_state (media->fakesink, GST_STATE_NULL);
     gst_object_unref (media->fakesink);
     media->fakesink = NULL;
-    g_message ("removed fakesink");
+    GST_INFO ("removed fakesink");
   }
 }
 
@@ -1268,7 +1271,7 @@ gst_rtsp_media_prepare (GstRTSPMedia *media)
   if (!media->reusable && media->reused)
     goto is_reused;
 
-  g_message ("preparing media %p", media);
+  GST_INFO ("preparing media %p", media);
 
   bus = gst_pipeline_get_bus (GST_PIPELINE_CAST (media->pipeline));
 
@@ -1318,7 +1321,7 @@ gst_rtsp_media_prepare (GstRTSPMedia *media)
       break;
     case GST_STATE_CHANGE_NO_PREROLL:
       /* we need to go to PLAYING */
-      g_message ("live media %p", media);
+      GST_INFO ("live media %p", media);
       media->is_live = TRUE;
       ret = gst_element_set_state (media->pipeline, GST_STATE_PLAYING);
       if (ret == GST_STATE_CHANGE_FAILURE)
@@ -1336,7 +1339,7 @@ gst_rtsp_media_prepare (GstRTSPMedia *media)
   /* collect stats about the media */
   collect_media_stats (media);
 
-  g_message ("object %p is prerolled", media);
+  GST_INFO ("object %p is prerolled", media);
 
   media->prepared = TRUE;
 
@@ -1350,14 +1353,14 @@ was_prepared:
   /* ERRORS */
 state_failed:
   {
-    g_warning ("failed to preroll pipeline");
+    GST_WARNING ("failed to preroll pipeline");
     unlock_streams (media);
     gst_element_set_state (media->pipeline, GST_STATE_NULL);
     return FALSE;
   }
 is_reused:
   {
-    g_warning ("can not reuse media %p", media);
+    GST_WARNING ("can not reuse media %p", media);
     return FALSE;
   }
 }
@@ -1381,7 +1384,7 @@ gst_rtsp_media_unprepare (GstRTSPMedia *media)
   if (!media->prepared)
     return TRUE;
 
-  g_message ("unprepare media %p", media);
+  GST_INFO ("unprepare media %p", media);
   media->target_state = GST_STATE_NULL;
 
   klass = GST_RTSP_MEDIA_GET_CLASS (media);
@@ -1435,7 +1438,7 @@ gst_rtsp_media_set_state (GstRTSPMedia *media, GstState state, GArray *transport
 
   add = remove = FALSE;
 
-  g_message ("going to state %s media %p", gst_element_state_get_name (state), media);
+  GST_INFO ("going to state %s media %p", gst_element_state_get_name (state), media);
 
   switch (state) {
     case GST_STATE_NULL:
@@ -1484,14 +1487,14 @@ gst_rtsp_media_set_state (GstRTSPMedia *media, GstState state, GArray *transport
        max = trans->client_port.max;
 
        if (add && !tr->active) {
-          g_message ("adding %s:%d-%d", dest, min, max);
+          GST_INFO ("adding %s:%d-%d", dest, min, max);
           g_signal_emit_by_name (stream->udpsink[0], "add", dest, min, NULL);
           g_signal_emit_by_name (stream->udpsink[1], "add", dest, max, NULL);
          stream->transports = g_list_prepend (stream->transports, tr);
          tr->active = TRUE;
          media->active++;
        } else if (remove && tr->active) {
-          g_message ("removing %s:%d-%d", dest, min, max);
+          GST_INFO ("removing %s:%d-%d", dest, min, max);
           g_signal_emit_by_name (stream->udpsink[0], "remove", dest, min, NULL);
           g_signal_emit_by_name (stream->udpsink[1], "remove", dest, max, NULL);
          stream->transports = g_list_remove (stream->transports, tr);
@@ -1502,19 +1505,19 @@ gst_rtsp_media_set_state (GstRTSPMedia *media, GstState state, GArray *transport
       }
       case GST_RTSP_LOWER_TRANS_TCP:
        if (add && !tr->active) {
-          g_message ("adding TCP %s", trans->destination);
+          GST_INFO ("adding TCP %s", trans->destination);
          stream->transports = g_list_prepend (stream->transports, tr);
          tr->active = TRUE;
          media->active++;
        } else if (remove && tr->active) {
-          g_message ("removing TCP %s", trans->destination);
+          GST_INFO ("removing TCP %s", trans->destination);
          stream->transports = g_list_remove (stream->transports, tr);
          tr->active = FALSE;
          media->active--;
        }
         break;
       default:
-        g_message ("Unknown transport %d", trans->lower_transport);
+        GST_INFO ("Unknown transport %d", trans->lower_transport);
         break;
     }
   }
@@ -1528,13 +1531,13 @@ gst_rtsp_media_set_state (GstRTSPMedia *media, GstState state, GArray *transport
   else
     do_state = FALSE;
 
-  g_message ("active %d media %p", media->active, media);
+  GST_INFO ("active %d media %p", media->active, media);
 
   if (do_state && media->target_state != state) {
     if (state == GST_STATE_NULL) {
       gst_rtsp_media_unprepare (media);
     } else {
-      g_message ("state %s media %p", gst_element_state_get_name (state), media);
+      GST_INFO ("state %s media %p", gst_element_state_get_name (state), media);
       media->target_state = state;
       ret = gst_element_set_state (media->pipeline, state);
     }
@@ -1563,7 +1566,7 @@ gst_rtsp_media_remove_elements (GstRTSPMedia *media)
   for (i = 0; i < media->streams->len; i++) {
     GstRTSPMediaStream *stream;
     
-    g_message ("Removing elements of stream %d from pipeline", i);
+    GST_INFO ("Removing elements of stream %d from pipeline", i);
 
     stream = g_array_index (media->streams, GstRTSPMediaStream *, i);
     
index 0d1353d..3d690f8 100644 (file)
@@ -37,6 +37,9 @@ enum
 
 G_DEFINE_TYPE (GstRTSPServer, gst_rtsp_server, G_TYPE_OBJECT);
 
+GST_DEBUG_CATEGORY_STATIC (rtsp_server_debug);
+#define GST_CAT_DEFAULT rtsp_server_debug
+
 static void gst_rtsp_server_get_property (GObject *object, guint propid,
     GValue *value, GParamSpec *pspec);
 static void gst_rtsp_server_set_property (GObject *object, guint propid,
@@ -102,6 +105,8 @@ gst_rtsp_server_class_init (GstRTSPServerClass * klass)
           GST_TYPE_RTSP_MEDIA_MAPPING, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 
   klass->accept_client = default_accept_client;
+
+  GST_DEBUG_CATEGORY_INIT (rtsp_server_debug, "rtspserver", 0, "GstRTSPServer");
 }
 
 static void
@@ -399,7 +404,7 @@ gst_rtsp_server_sink_init_send (GstRTSPServer * server)
       "listened on server socket %d, returning from connection setup",
       server->server_sock.fd);
 
-  g_message ("listening on port %d", server->port);
+  GST_INFO_OBJECT (server, "listening on port %d", server->port);
 
   return TRUE;
 
@@ -474,7 +479,7 @@ default_accept_client (GstRTSPServer *server, GIOChannel *channel)
   /* ERRORS */
 accept_failed:
   {
-    g_error ("Could not accept client on server socket %d: %s (%d)",
+    GST_ERROR_OBJECT (server, "Could not accept client on server socket %d: %s (%d)",
             server->server_sock.fd, g_strerror (errno), errno);
     gst_object_unref (client);
     return NULL;
@@ -511,7 +516,7 @@ gst_rtsp_server_io_func (GIOChannel *channel, GIOCondition condition, GstRTSPSer
     gst_object_unref (client);
   }
   else {
-    g_print ("received unknown event %08x", condition);
+    GST_WARNING_OBJECT (server, "received unknown event %08x", condition);
   }
   return TRUE;
 
index 7c68da1..8fec319 100644 (file)
@@ -30,6 +30,9 @@ enum
   PROP_LAST
 };
 
+GST_DEBUG_CATEGORY (rtsp_session_debug);
+#define GST_CAT_DEFAULT rtsp_session_debug
+
 static void gst_rtsp_session_pool_get_property (GObject *object, guint propid,
     GValue *value, GParamSpec *pspec);
 static void gst_rtsp_session_pool_set_property (GObject *object, guint propid,
@@ -59,6 +62,7 @@ gst_rtsp_session_pool_class_init (GstRTSPSessionPoolClass * klass)
 
   klass->create_session_id = create_session_id;
 
+  GST_DEBUG_CATEGORY_INIT (rtsp_session_debug, "rtspsession", 0, "GstRTSPSession");
 }
 
 static void
@@ -300,24 +304,24 @@ gst_rtsp_session_pool_create (GstRTSPSessionPool *pool)
   /* ERRORS */
 no_function:
   {
-    g_warning ("no create_session_id vmethod in GstRTSPSessionPool %p", pool);
+    GST_WARNING ("no create_session_id vmethod in GstRTSPSessionPool %p", pool);
     return NULL;
   }
 no_session:
   {
-    g_warning ("can't create session id with GstRTSPSessionPool %p", pool);
+    GST_WARNING ("can't create session id with GstRTSPSessionPool %p", pool);
     return NULL;
   }
 collision:
   {
-    g_warning ("can't find unique sessionid for GstRTSPSessionPool %p", pool);
+    GST_WARNING ("can't find unique sessionid for GstRTSPSessionPool %p", pool);
     g_mutex_unlock (pool->lock);
     g_free (id);
     return NULL;
   }
 too_many_sessions:
   {
-    g_warning ("session pool reached max sessions of %d", pool->max_sessions);
+    GST_WARNING ("session pool reached max sessions of %d", pool->max_sessions);
     g_mutex_unlock (pool->lock);
     g_free (id);
     return NULL;
@@ -464,7 +468,7 @@ collect_timeout (gchar *sessionid, GstRTSPSession *sess, GstPoolSource *psrc)
   g_source_get_current_time ((GSource*)psrc, &now);
 
   timeout = gst_rtsp_session_next_timeout (sess, &now);
-  g_message ("%p: next timeout: %d", sess, timeout);
+  GST_INFO ("%p: next timeout: %d", sess, timeout);
   if (psrc->timeout == -1 || timeout < psrc->timeout)
     psrc->timeout = timeout;
 }
@@ -487,7 +491,7 @@ gst_pool_source_prepare (GSource * source, gint * timeout)
 
   result = psrc->timeout == 0;
 
-  g_message ("prepare %d, %d", psrc->timeout, result);
+  GST_INFO ("prepare %d, %d", psrc->timeout, result);
 
   return result;
 }
@@ -495,7 +499,7 @@ gst_pool_source_prepare (GSource * source, gint * timeout)
 static gboolean
 gst_pool_source_check (GSource * source)
 {
-  g_message ("check");
+  GST_INFO ("check");
 
   return gst_pool_source_prepare (source, NULL);
 }
@@ -508,7 +512,7 @@ gst_pool_source_dispatch (GSource * source, GSourceFunc callback,
   GstPoolSource *psrc = (GstPoolSource *) source;
   GstRTSPSessionPoolFunc func = (GstRTSPSessionPoolFunc) callback;
 
-  g_message ("dispatch");
+  GST_INFO ("dispatch");
 
   if (func)
     res = func (psrc->pool, user_data);
@@ -523,7 +527,7 @@ gst_pool_source_finalize (GSource * source)
 {
   GstPoolSource *psrc = (GstPoolSource *) source;
 
-  g_message ("finalize %p", psrc);
+  GST_INFO ("finalize %p", psrc);
 
   g_object_unref (psrc->pool);
   psrc->pool = NULL;
index 7525036..ea33fa0 100644 (file)
@@ -32,6 +32,9 @@ enum
   PROP_LAST
 };
 
+GST_DEBUG_CATEGORY_EXTERN (rtsp_session_debug);
+#define GST_CAT_DEFAULT rtsp_session_debug
+
 static void gst_rtsp_session_get_property (GObject *object, guint propid,
     GValue *value, GParamSpec *pspec);
 static void gst_rtsp_session_set_property (GObject *object, guint propid,
@@ -72,7 +75,7 @@ gst_rtsp_session_init (GstRTSPSession * session)
 static void
 gst_rtsp_session_free_stream (GstRTSPSessionStream *stream)
 {
-  g_message ("free session stream %p", stream);
+  GST_INFO ("free session stream %p", stream);
 
   /* remove callbacks now */
   gst_rtsp_session_stream_set_callbacks (stream, NULL, NULL, NULL, NULL);
@@ -91,7 +94,7 @@ gst_rtsp_session_free_media (GstRTSPSessionMedia *media, GstRTSPSession *session
 
   size = media->streams->len;
 
-  g_message ("free session media %p", media);
+  GST_INFO ("free session media %p", media);
 
   gst_rtsp_session_media_set_state (media, GST_STATE_NULL);
 
@@ -121,7 +124,7 @@ gst_rtsp_session_finalize (GObject * obj)
 
   session = GST_RTSP_SESSION (obj);
 
-  g_message ("finalize session %p", session);
+  GST_INFO ("finalize session %p", session);
 
   /* free all media */
   g_list_foreach (session->medias, (GFunc) gst_rtsp_session_free_media,
@@ -208,7 +211,7 @@ gst_rtsp_session_manage_media (GstRTSPSession *sess, const GstRTSPUrl *uri,
 
   sess->medias = g_list_prepend (sess->medias, result);
 
-  g_message ("manage new media %p in session %p", media, result);
+  GST_INFO ("manage new media %p in session %p", media, result);
 
   return result;
 }