camerabin: add debug including dot graph writing
authorLasse Laukkanen <ext-lasse.2.laukkanen@nokia.com>
Tue, 12 May 2009 09:49:33 +0000 (12:49 +0300)
committerStefan Kost <ensonic@users.sf.net>
Fri, 5 Jun 2009 12:51:31 +0000 (15:51 +0300)
gst/camerabin/camerabingeneral.c
gst/camerabin/camerabinimage.c
gst/camerabin/camerabinvideo.c

index 627e032..d9d9a20 100644 (file)
@@ -150,9 +150,9 @@ gst_camerabin_try_add_element (GstBin * bin, GstElement * new_elem)
   }
 
   /* Get pads for linking */
-  GST_DEBUG ("finding unconnected src pad");
   bin_pad = gst_bin_find_unlinked_pad (bin, GST_PAD_SRC);
-  GST_DEBUG ("unconnected pad %s:%s", GST_DEBUG_PAD_NAME (bin_pad));
+  GST_DEBUG ("adding %" GST_PTR_FORMAT " to %s:%s", new_elem,
+      GST_DEBUG_PAD_NAME (bin_pad));
   /* Add to bin */
   gst_bin_add (GST_BIN (bin), new_elem);
   /* Link, if unconnected pad was found, otherwise just add it to bin */
@@ -185,7 +185,6 @@ gst_camerabin_create_and_add_element (GstBin * bin, const gchar * elem_name)
 {
   GstElement *new_elem = NULL;
 
-  GST_DEBUG ("adding %s", elem_name);
   new_elem = gst_element_factory_make (elem_name, NULL);
   if (!new_elem) {
     GST_ELEMENT_ERROR (bin, CORE, MISSING_PLUGIN, (NULL),
index e4ff6b8..7c29922 100644 (file)
@@ -196,6 +196,7 @@ gst_camerabin_image_change_state (GstElement * element,
 {
   GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
   GstCameraBinImage *img = GST_CAMERABIN_IMAGE (element);
+  GstObject *camerabin = NULL;
 
   switch (transition) {
     case GST_STATE_CHANGE_NULL_TO_READY:
@@ -221,6 +222,14 @@ gst_camerabin_image_change_state (GstElement * element,
   ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
 
   switch (transition) {
+    case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
+      camerabin = gst_element_get_parent (img);
+      /* Write debug graph to file */
+      GST_DEBUG_BIN_TO_DOT_FILE_WITH_TS (GST_BIN (camerabin),
+          GST_DEBUG_GRAPH_SHOW_MEDIA_TYPE |
+          GST_DEBUG_GRAPH_SHOW_NON_DEFAULT_PARAMS, "imagebin.playing");
+      gst_object_unref (camerabin);
+      break;
     case GST_STATE_CHANGE_READY_TO_NULL:
       gst_camerabin_image_destroy_elements (img);
       break;
@@ -530,6 +539,7 @@ gst_camerabin_image_destroy_elements (GstCameraBinImage * img)
 void
 gst_camerabin_image_set_encoder (GstCameraBinImage * img, GstElement * encoder)
 {
+  GST_DEBUG ("setting encoder %" GST_PTR_FORMAT, encoder);
   if (img->user_enc)
     gst_object_unref (img->user_enc);
   if (encoder)
@@ -542,6 +552,7 @@ void
 gst_camerabin_image_set_postproc (GstCameraBinImage * img,
     GstElement * postproc)
 {
+  GST_DEBUG ("setting post processing element %" GST_PTR_FORMAT, postproc);
   if (img->post)
     gst_object_unref (img->post);
   if (postproc)
index 4729d1e..fef9ac2 100644 (file)
@@ -290,6 +290,7 @@ gst_camerabin_video_change_state (GstElement * element,
 {
   GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
   GstCameraBinVideo *vid = GST_CAMERABIN_VIDEO (element);
+  GstObject *camerabin = NULL;
 
   switch (transition) {
     case GST_STATE_CHANGE_NULL_TO_READY:
@@ -325,6 +326,13 @@ gst_camerabin_video_change_state (GstElement * element,
 
   switch (transition) {
     case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
+      camerabin = gst_element_get_parent (vid);
+      /* Write debug graph to file */
+      GST_DEBUG_BIN_TO_DOT_FILE_WITH_TS (GST_BIN (camerabin),
+          GST_DEBUG_GRAPH_SHOW_MEDIA_TYPE |
+          GST_DEBUG_GRAPH_SHOW_NON_DEFAULT_PARAMS, "videobin.playing");
+      gst_object_unref (camerabin);
+
       if (vid->pending_eos) {
         /* Video bin is still paused, so push eos directly to video queue */
         GST_DEBUG_OBJECT (vid, "pushing pending eos");