comparison pidgin/gtkprefs.c @ 25738:441492fb6b61

Fix up video preview error handling.
author Mike Ruprecht <maiku@soc.pidgin.im>
date Wed, 27 Aug 2008 06:17:33 +0000
parents 4b8c64deac5e
children 16ce5da4d823
comparison
equal deleted inserted replaced
25737:4b8c64deac5e 25738:441492fb6b61
2067 return TRUE; 2067 return TRUE;
2068 } 2068 }
2069 2069
2070 gst_element_set_state(pipeline, GST_STATE_NULL); 2070 gst_element_set_state(pipeline, GST_STATE_NULL);
2071 gst_object_unref(GST_PIPELINE(pipeline)); 2071 gst_object_unref(GST_PIPELINE(pipeline));
2072 return TRUE; 2072 return FALSE;
2073 } 2073 }
2074 2074
2075 static void 2075 static void
2076 preview_button_clicked(GtkWidget *widget, gpointer *data) 2076 preview_button_clicked(GtkWidget *widget, gpointer *data)
2077 { 2077 {
2079 const char *device = purple_prefs_get_string("/purple/media/video/device"); 2079 const char *device = purple_prefs_get_string("/purple/media/video/device");
2080 GstBus *bus; 2080 GstBus *bus;
2081 2081
2082 /* create a preview window... */ 2082 /* create a preview window... */
2083 GstElement *pipeline = NULL; 2083 GstElement *pipeline = NULL;
2084 GError *p_err; 2084 GError *p_err = NULL;
2085 2085
2086 gchar *test_pipeline_str = NULL; 2086 gchar *test_pipeline_str = NULL;
2087 2087
2088 if (strlen(device) > 0) 2088 if (strlen(device) > 0)
2089 test_pipeline_str = g_strdup_printf("%s device=\"%s\" !" \ 2089 test_pipeline_str = g_strdup_printf("%s device=\"%s\" !" \
2095 " autovideosink", plugin); 2095 " autovideosink", plugin);
2096 2096
2097 pipeline = gst_parse_launch (test_pipeline_str, &p_err); 2097 pipeline = gst_parse_launch (test_pipeline_str, &p_err);
2098 2098
2099 g_free(test_pipeline_str); 2099 g_free(test_pipeline_str);
2100
2101 if (pipeline == NULL) {
2102 purple_debug_error("gtkprefs",
2103 "Error starting preview: %s\n", p_err->message);
2104 g_error_free(p_err);
2105 return;
2106 }
2100 2107
2101 bus = gst_pipeline_get_bus(GST_PIPELINE(pipeline)); 2108 bus = gst_pipeline_get_bus(GST_PIPELINE(pipeline));
2102 gst_bus_add_watch(bus, preview_video_bus_call, pipeline); 2109 gst_bus_add_watch(bus, preview_video_bus_call, pipeline);
2103 gst_object_unref(bus); 2110 gst_object_unref(bus);
2104 2111