[Phonehome-commits] r77 - in trunk/client: . src

pamadio at garage.maemo.org pamadio at garage.maemo.org
Sun Oct 19 14:08:57 EEST 2008


Author: pamadio
Date: 2008-10-19 14:08:57 +0300 (Sun, 19 Oct 2008)
New Revision: 77

Modified:
   trunk/client/Makefile
   trunk/client/src/dsk_mgr.c
Log:
less warning

Modified: trunk/client/Makefile
===================================================================
--- trunk/client/Makefile	2008-10-19 10:51:26 UTC (rev 76)
+++ trunk/client/Makefile	2008-10-19 11:08:57 UTC (rev 77)
@@ -1,11 +1,12 @@
 all :
-	gcc -g -o dsk_mgr src/dsk_mgr.c  `pkg-config --cflags --libs dbus-glib-1` \
+	gcc -Wall -g -o dsk_mgr src/dsk_mgr.c  `pkg-config --cflags --libs dbus-glib-1` \
 	`pkg-config --cflags conic --libs conic` \
 	`pkg-config --cflags libosso --libs libosso` \
 	`pkg-config --cflags gdk-pixbuf-2.0 --libs gdk-pixbuf-2.0 ` \
 	`pkg-config --cflags gstreamer-0.10 --libs gstreamer-0.10` \
 	`pkg-config --cflags liblocation --libs liblocation`\
 	`pkg-config --cflags gconf-2.0 --libs gconf-2.0`\
+	`pkg-config --cflags dbus-glib-1 --libs dbus-glib-1`\
 	`pkg-config --cflags libsoup-2.2 --libs libsoup-2.2`
 
 clean:

Modified: trunk/client/src/dsk_mgr.c
===================================================================
--- trunk/client/src/dsk_mgr.c	2008-10-19 10:51:26 UTC (rev 76)
+++ trunk/client/src/dsk_mgr.c	2008-10-19 11:08:57 UTC (rev 77)
@@ -35,6 +35,7 @@
 #include <glib.h> 
 #include <dbus/dbus.h>
 #include <dbus/dbus-glib.h>
+#include <dbus/dbus-glib-lowlevel.h>
 #include <conic.h>
 #include <location/location-gps-device.h>
 #include <sys/time.h>
@@ -84,7 +85,345 @@
     printf("n");
   }
 }
+gboolean send_jpeg(unsigned char *data)
+{
+  g_print("send_jpg \n");
+  GdkPixbuf *pixbuf = NULL;
+  GError *error = NULL;
+  gchar *buffer=NULL;
+  gsize *buffer_size=NULL;
+  gchar *b_encoded;
+  guint height, width, bpp;
+
+  SoupSession*  soup_session;
+  SoupXmlrpcMessage *msg;
+  SoupXmlrpcResponse *rpc_response;
+  guint rpc_status;
+  SoupXmlrpcValue *value=NULL;
+  char *uri = xmlrpc_server;
+  //soup_session=soup_session_sync_new();
+  if(proxy_mode==CON_IC_PROXY_MODE_NONE) {
+    soup_session=soup_session_sync_new();
+  } else if (proxy_mode==CON_IC_PROXY_MODE_MANUAL){
+    g_print("using a manual proxy:%s\n",soup_proxy_uri_string);
+    soup_session=soup_session_sync_new_with_options(SOUP_SESSION_PROXY_URI,soup_proxy_uri,NULL);
+  } else {
+    g_print("Automatic proxy mode not supported\n");
+    return FALSE;
+  }
+
+  width = 640; height = 480; bpp = 24;
+
+  /* Create a pixbuf object from the data */
+  
+  
+  pixbuf = gdk_pixbuf_new_from_data(data,
+  				    GDK_COLORSPACE_RGB, 
+  				    FALSE, 
+  				    bpp/3, 
+  				    width, height, 
+  				    3*width, 
+  			    NULL, NULL); 
+  
+  
+  /*
+    pixbuf=gdk_pixbuf_new_from_file            ("/home/user/dev/sayhoo/branches/phonehome/out.jpg",
+					      &error);
+  
+  */
+  buffer_size=g_malloc(sizeof(gsize));
+
+  if(!gdk_pixbuf_save_to_buffer(pixbuf,&buffer,buffer_size,"jpeg",&error,NULL))
+    {
+      g_print("Problem saving pic in a buffer:%s\n", error->message);
+      g_error_free(error);
+      gdk_pixbuf_unref(pixbuf);
+      g_free(buffer_size);
+      return FALSE;
+    }
+  
+
+  b_encoded=g_base64_encode(buffer,*buffer_size);
+
+
+  msg = soup_xmlrpc_message_new (uri);
+  if (!msg) {
+    g_print("Could not create web service request to '%s'\n", uri);
+    gdk_pixbuf_unref(pixbuf);
+    g_free(buffer);
+    g_free(buffer_size);
+    g_object_unref (rpc_response);
+    g_free(b_encoded);
+    g_object_unref(msg);
+    return FALSE;
+  }
+
+  soup_xmlrpc_message_start_call(msg,"store_picture");
+  soup_xmlrpc_message_start_param (msg);
+  soup_xmlrpc_message_write_string (msg,xmlrpc_id);
+  soup_xmlrpc_message_end_param (msg);
+
+  soup_xmlrpc_message_start_param (msg);
+  soup_xmlrpc_message_write_string (msg,xmlrpc_password);
+  soup_xmlrpc_message_end_param (msg);
+
+  soup_xmlrpc_message_start_param (msg);
+  soup_xmlrpc_message_write_string (msg,b_encoded);
+  soup_xmlrpc_message_end_param (msg);
+
+  soup_xmlrpc_message_end_call (msg);
+  soup_xmlrpc_message_persist (msg);
+  rpc_status=soup_session_send_message(soup_session, SOUP_MESSAGE(msg));
+
+
+  g_print("rpc_status=%i\n",rpc_status);
+  g_print("a\n");
+  if(rpc_status!=200){
+    g_print("Problem with XMLRPC communication\n");
+    gdk_pixbuf_unref(pixbuf);
+    g_free(buffer);
+    g_free(buffer_size);
+    g_object_unref (rpc_response);
+    g_free(b_encoded);
+    g_object_unref(msg);
+    return FALSE;
+  }
+  g_print("b\n");
+  rpc_response=soup_xmlrpc_message_parse_response (SOUP_XMLRPC_MESSAGE (msg));
+  if (!rpc_response) {
+    g_print("Could not parse XMLRPC response\n");
+    gdk_pixbuf_unref(pixbuf);
+    g_free(buffer);
+    g_free(buffer_size);
+    g_object_unref (rpc_response);
+    g_free(b_encoded);
+    g_object_unref(msg);
+    return FALSE;
+  }
+
+  g_print("c\n");
+  value = soup_xmlrpc_response_get_value (rpc_response);
+  if (!value) {
+    g_print("No response value in XMLRPC response\n");
+    gdk_pixbuf_unref(pixbuf);
+    g_free(buffer);
+    g_free(buffer_size);
+    g_object_unref (rpc_response);
+    g_free(b_encoded);
+    g_object_unref(msg);
+    return FALSE;
+  }
+
+  gboolean *bo;
+  bo=g_malloc(sizeof(gboolean));
+  g_print("type=%i\n",soup_xmlrpc_value_get_type (value));
+
  
+  if(!soup_xmlrpc_value_get_boolean(value,bo)){
+    g_print("not able to get the boolean\n");
+  }
+  g_print("d\n");
+  if(*bo==TRUE){
+    g_print("Send pic:OK\n");
+  } else {
+    g_print("Sending pic: FAILED\n");
+  }
+  g_free(bo);
+
+  g_print("e\n");
+
+  /* Free allocated resources and return TRUE which means
+   * that the operation was succesful */
+  gdk_pixbuf_unref(pixbuf);
+  g_free(buffer);
+  g_free(buffer_size);
+  g_object_unref (rpc_response);
+  g_free(b_encoded);
+  g_object_unref(msg);
+  return TRUE;
+}
+
+/* Callback that gets called whenever pipeline's message bus has
+ * a message */
+static gboolean bus_callback(GstBus *bus, GstMessage *message, gpointer *appdata)
+{
+  //g_print("Gst pipeline bus_callback\n");
+  gchar *message_str;
+  //const gchar *message_name;
+
+  GError *error;
+  //g_print ("Got %s message\n", GST_MESSAGE_TYPE_NAME (message));
+  //g_print("message_type=%i\n",GST_MESSAGE_TYPE(message));
+    
+  /* Report errors to the console */
+  if(GST_MESSAGE_TYPE(message) == GST_MESSAGE_ERROR)
+    {
+      gst_message_parse_error(message, &error, &message_str);
+      g_error("GST error: %s\n", message_str);
+      g_free(error);
+      g_free(message_str);
+    }
+  
+  /* Report warnings to the console */
+  if(GST_MESSAGE_TYPE(message) == GST_MESSAGE_WARNING)
+    {
+      gst_message_parse_warning(message, &error, &message_str);
+      g_warning("GST warning: %s\n", message_str);
+      g_free(error);
+      g_free(message_str);
+    }
+  /*
+  if(GST_MESSAGE_TYPE(message)==GST_MESSAGE_STATE_CHANGED){
+    //g_print("state changed\n");
+    GstState *oldstate;
+    GstState *newstate;
+    GstState *pendingstate;
+    gst_message_parse_state_changed     (message,
+					 oldstate,
+					 newstate,
+					 pendingstate);
+    
+    //g_print("old=%i new=%i pending=%i\n",*oldstate,*newstate,*pendingstate);
+    //g_free(oldstate);
+    //g_free(newstate);
+    //g_free(pendingstate);
+  }
+  */
+  if(GST_MESSAGE_TYPE(message) == GST_MESSAGE_EOS)
+    {
+      g_print("end of stream\n");
+      gst_element_set_state(pipeline, GST_STATE_NULL);
+      gst_object_unref(GST_OBJECT (pipeline));
+    }
+
+  return TRUE;
+}
+
+
+
+gboolean create_pipe(){
+  GstElement  *camera_src, *image_sink;
+  GstElement *image_queue;
+  GstElement *csp_filter, *image_filter;
+  GstBus *bus;
+  GstCaps *caps;
+ 
+  pipeline = gst_pipeline_new("test-camera");
+
+  bus = gst_pipeline_get_bus(GST_PIPELINE(pipeline));
+  gst_bus_add_watch(bus, (GstBusFunc)bus_callback,NULL);
+  gst_object_unref(GST_OBJECT(bus));
+
+
+  camera_src = gst_element_factory_make("v4l2src", "camera_src");
+  csp_filter = gst_element_factory_make("ffmpegcolorspace", "csp_filter");
+  image_queue = gst_element_factory_make("queue", "image_queue");
+  image_filter = gst_element_factory_make("ffmpegcolorspace", "image_filter");
+  image_sink = gst_element_factory_make("fakesink", "image_sink");
+  if(!(pipeline && camera_src && csp_filter 
+       && image_queue && image_filter && image_sink))
+    {
+      g_critical("Couldn't create pipeline elements");
+      return FALSE;
+    }
+
+  g_object_set(G_OBJECT(image_sink),
+	       "signal-handoffs", TRUE, NULL);
+
+  gst_bin_add_many(GST_BIN(pipeline), camera_src, csp_filter,
+		   image_queue,
+		   image_filter, image_sink, NULL);
+  
+  caps = gst_caps_new_simple("video/x-raw-rgb",
+			     "width", G_TYPE_INT, 640,
+			     "height", G_TYPE_INT, 480,
+			     NULL);
+  
+  if(!gst_element_link_filtered(camera_src, csp_filter, caps))
+    {
+      return FALSE;
+    }
+  gst_caps_unref(caps);
+
+  if(!gst_element_link_many(csp_filter, image_queue, NULL))
+    {
+      return FALSE;
+    }
+
+
+  caps = gst_caps_new_simple("video/x-raw-rgb",
+			     "width", G_TYPE_INT, 640,
+			     "height", G_TYPE_INT, 480,
+			     "bpp", G_TYPE_INT, 24,
+			     "depth", G_TYPE_INT, 24,
+			     "framerate", GST_TYPE_FRACTION, 15, 1,
+			     NULL);
+  
+  if(!gst_element_link_many( image_queue, image_filter, NULL)) return FALSE;
+  if(!gst_element_link_filtered(image_filter, image_sink, caps)) return FALSE;
+
+  gst_caps_unref(caps);
+  return TRUE;
+}
+
+void save_positions_to_file(){
+  g_print("Saving stuff to file\n");
+  FILE * fh;
+  GSList* new_head = gps_positions;
+
+  fh=fopen(TMP_POSITIONS_FILE, "a");
+  if(fh==NULL){
+    g_print("Problem appending to a file\n");
+    return;
+  }
+
+  while (new_head != NULL){
+      GSList * next_head=g_slist_next(new_head);
+      gps_info * cur_info=new_head->data;
+      //fprintf(fh,"%f:%f:%u\n",cur_info->lat,cur_info->lon,cur_info->date);
+      gps_positions=g_slist_remove(gps_positions, cur_info);
+      g_free(cur_info);
+      new_head=next_head;
+  }
+  fclose(fh);
+}
+
+void load_positions_from_file(){
+  g_print("Loading data from file\n");
+  FILE * fh;
+  char line [128];
+
+  fh=fopen(TMP_POSITIONS_FILE, "r");
+  if(fh==NULL){
+    g_print("Problem reading file\n");
+    return;
+  }
+  
+  while ( fgets ( line, sizeof line, fh ) != NULL ){
+    float lat=0;
+    float lon=0;
+    time_t date;
+    int nbr_match;
+    nbr_match=sscanf(line,"%f:%f:%u",&lat,&lon,&date);
+    if(nbr_match!=3){
+      g_print("Problem scanning:%s\n",line);
+      continue;
+    }
+
+    gps_info *cur_info;
+    cur_info=g_malloc(sizeof(gps_info));
+    cur_info->lat=lat;
+    cur_info->lon=lon;
+    cur_info->date=date;
+
+    gps_positions=g_slist_prepend(gps_positions,(gpointer) cur_info);
+  }
+  fclose(fh);
+  remove(TMP_POSITIONS_FILE);
+}
+
+
+ 
 void signal_handler(int sig) {
  
   switch(sig) {
@@ -100,7 +439,7 @@
     save_positions_to_file();
     exit(EXIT_SUCCESS);
   default:
-    syslog(LOG_WARNING, "Unhandled signal (%d) %s", strsignal(sig));
+    syslog(LOG_WARNING, "Unhandled signal: %d", sig);
     break;
   }
 }
@@ -185,6 +524,7 @@
     close(STDOUT_FILENO);
     close(STDERR_FILENO);
   }
+  return 0;
 }
 
 static void show_locations(gpointer gps_data, gpointer user_data){
@@ -233,121 +573,9 @@
 
 }
 
-void save_positions_to_file(){
-  g_print("Saving stuff to file\n");
-  FILE * fh;
-  GSList* new_head = gps_positions;
 
-  fh=fopen(TMP_POSITIONS_FILE, "a");
-  if(fh==NULL){
-    g_print("Problem appending to a file\n");
-    return;
-  }
 
-  while (new_head != NULL){
-      GSList * next_head=g_slist_next(new_head);
-      gps_info * cur_info=new_head->data;
-      fprintf(fh,"%f:%f:%u\n",cur_info->lat,cur_info->lon,cur_info->date);
-      gps_positions=g_slist_remove(gps_positions, cur_info);
-      g_free(cur_info);
-      new_head=next_head;
-  }
-  fclose(fh);
-}
 
-void load_positions_from_file(){
-  g_print("Loading data from file\n");
-  FILE * fh;
-  char line [128];
-
-  fh=fopen(TMP_POSITIONS_FILE, "r");
-  if(fh==NULL){
-    g_print("Problem reading file\n");
-    return;
-  }
-  
-  while ( fgets ( line, sizeof line, fh ) != NULL ){
-    float lat=0;
-    float lon=0;
-    time_t date;
-    int nbr_match;
-    nbr_match=sscanf(line,"%f:%f:%u",&lat,&lon,&date);
-    if(nbr_match!=3){
-      g_print("Problem scanning:%s\n",line);
-      continue;
-    }
-
-    gps_info *cur_info;
-    cur_info=g_malloc(sizeof(gps_info));
-    cur_info->lat=lat;
-    cur_info->lon=lon;
-    cur_info->date=date;
-
-    gps_positions=g_slist_prepend(gps_positions,(gpointer) cur_info);
-  }
-  fclose(fh);
-  remove(TMP_POSITIONS_FILE);
-}
-
-
-
-/* Callback that gets called whenever pipeline's message bus has
- * a message */
-static gboolean bus_callback(GstBus *bus, GstMessage *message, gpointer *appdata)
-{
-  //g_print("Gst pipeline bus_callback\n");
-  gchar *message_str;
-  const gchar *message_name;
-
-  GError *error;
-  //g_print ("Got %s message\n", GST_MESSAGE_TYPE_NAME (message));
-  //g_print("message_type=%i\n",GST_MESSAGE_TYPE(message));
-    
-  /* Report errors to the console */
-  if(GST_MESSAGE_TYPE(message) == GST_MESSAGE_ERROR)
-    {
-      gst_message_parse_error(message, &error, &message_str);
-      g_error("GST error: %s\n", message_str);
-      g_free(error);
-      g_free(message_str);
-    }
-  
-  /* Report warnings to the console */
-  if(GST_MESSAGE_TYPE(message) == GST_MESSAGE_WARNING)
-    {
-      gst_message_parse_warning(message, &error, &message_str);
-      g_warning("GST warning: %s\n", message_str);
-      g_free(error);
-      g_free(message_str);
-    }
-  /*
-  if(GST_MESSAGE_TYPE(message)==GST_MESSAGE_STATE_CHANGED){
-    //g_print("state changed\n");
-    GstState *oldstate;
-    GstState *newstate;
-    GstState *pendingstate;
-    gst_message_parse_state_changed     (message,
-					 oldstate,
-					 newstate,
-					 pendingstate);
-    
-    //g_print("old=%i new=%i pending=%i\n",*oldstate,*newstate,*pendingstate);
-    //g_free(oldstate);
-    //g_free(newstate);
-    //g_free(pendingstate);
-  }
-  */
-  if(GST_MESSAGE_TYPE(message) == GST_MESSAGE_EOS)
-    {
-      g_print("end of stream\n");
-      gst_element_set_state(pipeline, GST_STATE_NULL);
-      gst_object_unref(GST_OBJECT (pipeline));
-    }
-
-  return TRUE;
-}
-
-
 static gboolean buffer_probe_callback(
 				      GstElement *image_sink,
 				      GstBuffer *buffer, GstPad *pad, gpointer *appdata){
@@ -420,7 +648,7 @@
     soup_session=soup_session_sync_new_with_options(SOUP_SESSION_PROXY_URI,soup_proxy_uri,NULL);
   } else {
     g_print("Automatic proxy mode not supported\n");
-    return FALSE;
+    return;
   }
 
   while (new_head != NULL)
@@ -750,231 +978,7 @@
 }
 
 
-gboolean send_jpeg(unsigned char *data)
-{
-  g_print("send_jpg \n");
-  GdkPixbuf *pixbuf = NULL;
-  GError *error = NULL;
-  gchar *buffer=NULL;
-  gsize *buffer_size=NULL;
-  gchar *b_encoded;
-  guint height, width, bpp;
 
-  SoupSession*  soup_session;
-  SoupXmlrpcMessage *msg;
-  SoupXmlrpcResponse *rpc_response;
-  guint rpc_status;
-  SoupXmlrpcValue *value=NULL;
-  char *uri = xmlrpc_server;
-  //soup_session=soup_session_sync_new();
-  if(proxy_mode==CON_IC_PROXY_MODE_NONE) {
-    soup_session=soup_session_sync_new();
-  } else if (proxy_mode==CON_IC_PROXY_MODE_MANUAL){
-    g_print("using a manual proxy:%s\n",soup_proxy_uri_string);
-    soup_session=soup_session_sync_new_with_options(SOUP_SESSION_PROXY_URI,soup_proxy_uri,NULL);
-  } else {
-    g_print("Automatic proxy mode not supported\n");
-    return FALSE;
-  }
-
-  width = 640; height = 480; bpp = 24;
-
-  /* Create a pixbuf object from the data */
-  
-  
-  pixbuf = gdk_pixbuf_new_from_data(data,
-  				    GDK_COLORSPACE_RGB, 
-  				    FALSE, 
-  				    bpp/3, 
-  				    width, height, 
-  				    3*width, 
-  			    NULL, NULL); 
-  
-  
-  /*
-    pixbuf=gdk_pixbuf_new_from_file            ("/home/user/dev/sayhoo/branches/phonehome/out.jpg",
-					      &error);
-  
-  */
-  buffer_size=g_malloc(sizeof(gsize));
-
-  if(!gdk_pixbuf_save_to_buffer(pixbuf,&buffer,buffer_size,"jpeg",&error,NULL))
-    {
-      g_print("Problem saving pic in a buffer:%s\n", error->message);
-      g_error_free(error);
-      gdk_pixbuf_unref(pixbuf);
-      g_free(buffer_size);
-      return FALSE;
-    }
-  
-
-  b_encoded=g_base64_encode(buffer,*buffer_size);
-
-
-  msg = soup_xmlrpc_message_new (uri);
-  if (!msg) {
-    g_print("Could not create web service request to '%s'\n", uri);
-    gdk_pixbuf_unref(pixbuf);
-    g_free(buffer);
-    g_free(buffer_size);
-    g_object_unref (rpc_response);
-    g_free(b_encoded);
-    g_object_unref(msg);
-    return FALSE;
-  }
-
-  soup_xmlrpc_message_start_call(msg,"store_picture");
-  soup_xmlrpc_message_start_param (msg);
-  soup_xmlrpc_message_write_string (msg,xmlrpc_id);
-  soup_xmlrpc_message_end_param (msg);
-
-  soup_xmlrpc_message_start_param (msg);
-  soup_xmlrpc_message_write_string (msg,xmlrpc_password);
-  soup_xmlrpc_message_end_param (msg);
-
-  soup_xmlrpc_message_start_param (msg);
-  soup_xmlrpc_message_write_string (msg,b_encoded);
-  soup_xmlrpc_message_end_param (msg);
-
-  soup_xmlrpc_message_end_call (msg);
-  soup_xmlrpc_message_persist (msg);
-  rpc_status=soup_session_send_message(soup_session, SOUP_MESSAGE(msg));
-
-
-  g_print("rpc_status=%i\n",rpc_status);
-  g_print("a\n");
-  if(rpc_status!=200){
-    g_print("Problem with XMLRPC communication\n");
-    gdk_pixbuf_unref(pixbuf);
-    g_free(buffer);
-    g_free(buffer_size);
-    g_object_unref (rpc_response);
-    g_free(b_encoded);
-    g_object_unref(msg);
-    return FALSE;
-  }
-  g_print("b\n");
-  rpc_response=soup_xmlrpc_message_parse_response (SOUP_XMLRPC_MESSAGE (msg));
-  if (!rpc_response) {
-    g_print("Could not parse XMLRPC response\n");
-    gdk_pixbuf_unref(pixbuf);
-    g_free(buffer);
-    g_free(buffer_size);
-    g_object_unref (rpc_response);
-    g_free(b_encoded);
-    g_object_unref(msg);
-    return FALSE;
-  }
-
-  g_print("c\n");
-  value = soup_xmlrpc_response_get_value (rpc_response);
-  if (!value) {
-    g_print("No response value in XMLRPC response\n");
-    gdk_pixbuf_unref(pixbuf);
-    g_free(buffer);
-    g_free(buffer_size);
-    g_object_unref (rpc_response);
-    g_free(b_encoded);
-    g_object_unref(msg);
-    return FALSE;
-  }
-
-  gboolean *bo;
-  bo=g_malloc(sizeof(gboolean));
-  g_print("type=%i\n",soup_xmlrpc_value_get_type (value));
-
- 
-  if(!soup_xmlrpc_value_get_boolean(value,bo)){
-    g_print("not able to get the boolean\n");
-  }
-  g_print("d\n");
-  if(*bo==TRUE){
-    g_print("Send pic:OK\n");
-  } else {
-    g_print("Sending pic: FAILED\n");
-  }
-  g_free(bo);
-
-  g_print("e\n");
-
-  /* Free allocated resources and return TRUE which means
-   * that the operation was succesful */
-  gdk_pixbuf_unref(pixbuf);
-  g_free(buffer);
-  g_free(buffer_size);
-  g_object_unref (rpc_response);
-  g_free(b_encoded);
-  g_object_unref(msg);
-  return TRUE;
-}
-
-
-
-gboolean create_pipe(){
-  GstElement  *camera_src, *image_sink;
-  GstElement *image_queue;
-  GstElement *csp_filter, *image_filter;
-  GstBus *bus;
-  GstCaps *caps;
- 
-  pipeline = gst_pipeline_new("test-camera");
-
-  bus = gst_pipeline_get_bus(GST_PIPELINE(pipeline));
-  gst_bus_add_watch(bus, (GstBusFunc)bus_callback,NULL);
-  gst_object_unref(GST_OBJECT(bus));
-
-
-  camera_src = gst_element_factory_make("v4l2src", "camera_src");
-  csp_filter = gst_element_factory_make("ffmpegcolorspace", "csp_filter");
-  image_queue = gst_element_factory_make("queue", "image_queue");
-  image_filter = gst_element_factory_make("ffmpegcolorspace", "image_filter");
-  image_sink = gst_element_factory_make("fakesink", "image_sink");
-  if(!(pipeline && camera_src && csp_filter 
-       && image_queue && image_filter && image_sink))
-    {
-      g_critical("Couldn't create pipeline elements");
-      return FALSE;
-    }
-
-  g_object_set(G_OBJECT(image_sink),
-	       "signal-handoffs", TRUE, NULL);
-
-  gst_bin_add_many(GST_BIN(pipeline), camera_src, csp_filter,
-		   image_queue,
-		   image_filter, image_sink, NULL);
-  
-  caps = gst_caps_new_simple("video/x-raw-rgb",
-			     "width", G_TYPE_INT, 640,
-			     "height", G_TYPE_INT, 480,
-			     NULL);
-  
-  if(!gst_element_link_filtered(camera_src, csp_filter, caps))
-    {
-      return FALSE;
-    }
-  gst_caps_unref(caps);
-
-  if(!gst_element_link_many(csp_filter, image_queue, NULL))
-    {
-      return FALSE;
-    }
-
-
-  caps = gst_caps_new_simple("video/x-raw-rgb",
-			     "width", G_TYPE_INT, 640,
-			     "height", G_TYPE_INT, 480,
-			     "bpp", G_TYPE_INT, 24,
-			     "depth", G_TYPE_INT, 24,
-			     "framerate", GST_TYPE_FRACTION, 15, 1,
-			     NULL);
-  
-  if(!gst_element_link_many( image_queue, image_filter, NULL)) return FALSE;
-  if(!gst_element_link_filtered(image_filter, image_sink, caps)) return FALSE;
-
-  gst_caps_unref(caps);
-  return TRUE;
-}
-
 gboolean init_gstreamer_stuff(int * argc, char **argv[]){
   //https://garage.maemo.org/svn/maemoexamples/tags/maemo_4.1/maemo-examples/example_camera.c
   g_print("init g_streamer\n");
@@ -1061,7 +1065,7 @@
   mainloop = g_main_loop_new(NULL, FALSE);
   if (mainloop == NULL) {
     /* Print error and terminate. */
-    g_print("Couldn't create GMainLoop", "Unknown(OOM?)", TRUE);
+    g_print("Couldn't create GMainLoop");
     exit(EXIT_FAILURE);
   }  
 



More information about the Phonehome-commits mailing list