diff -rN -u old-cheese/src/cheese-pipeline-photo.c new-cheese/src/cheese-pipeline-photo.c --- old-cheese/src/cheese-pipeline-photo.c 2007-08-06 12:08:15.000000000 +0200 +++ new-cheese/src/cheese-pipeline-photo.c 2007-08-06 12:08:15.000000000 +0200 @@ -178,30 +178,62 @@ PipelinePrivate *priv = PIPELINE_GET_PRIVATE(self); + source_pipeline = "videotestsrc"; if (test_pipeline("v4l2src ! fakesink", self)) { //source_pipeline = g_strdup_printf ("%s", v4l2src); source_pipeline = "v4l2src"; - } else if (test_pipeline("v4lsrc ! video/x-raw-rgb,width=640,height=480 ! fakesink", self)) { - source_pipeline = "v4lsrc ! video/x-raw-rgb,width=640,height=480"; - } else if (test_pipeline("v4lsrc ! video/x-raw-rgb,width=320,height=240 ! fakesink", self)) { - source_pipeline = "v4lsrc ! video/x-raw-rgb,width=320,height=240"; - } else if (test_pipeline("v4lsrc ! video/x-raw-rgb,width=1280,height=960 ! fakesink", self)) { - source_pipeline = "v4lsrc ! video/x-raw-rgb,width=1280,height=960"; - } else if (test_pipeline("v4lsrc ! video/x-raw-rgb,width=160,height=120 ! fakesink", self)) { - source_pipeline = "v4lsrc ! video/x-raw-rgb,width=160,height=120"; - } else if (test_pipeline("v4lsrc ! fakesink", self)) { - source_pipeline = "v4lsrc"; } else { - GtkWidget *dialog; - - dialog = gtk_message_dialog_new(GTK_WINDOW(cheese_window.window), - GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, - _("Unable to find a webcam, SORRY!")); - - gtk_dialog_run(GTK_DIALOG (dialog)); - gtk_widget_destroy(dialog); - source_pipeline = "videotestsrc"; + GstStructure *scopy; + GstElement *f = gst_element_factory_make("v4lsrc", "v4lsrc"); + GstPad *pad = gst_element_get_pad (f, "src"); + priv->filter = gst_pad_get_caps(pad); + scopy = gst_caps_get_structure (priv->filter, 0); + if (gst_structure_has_name(scopy, "video/x-raw-yuv")) { + if (test_pipeline("v4lsrc ! video/x-raw-yuv,width=640,height=480 ! fakesink", self)) { + source_pipeline = "v4lsrc ! video/x-raw-yuv,width=640,height=480"; + } else if (test_pipeline("v4lsrc ! video/x-raw-yuv,width=320,height=240 ! fakesink", self)) { + source_pipeline = "v4lsrc ! video/x-raw-yuv,width=320,height=240"; + } else if (test_pipeline("v4lsrc ! video/x-raw-yuv,width=1280,height=960 ! fakesink", self)) { + source_pipeline = "v4lsrc ! video/x-raw-yuv,width=1280,height=960"; + } else if (test_pipeline("v4lsrc ! video/x-raw-yuv,width=160,height=120 ! fakesink", self)) { + source_pipeline = "v4lsrc ! video/x-raw-yuv,width=160,height=120"; + } else if (test_pipeline("v4lsrc ! fakesink", self)) { + source_pipeline = "v4lsrc"; + } else { + GtkWidget *dialog; + + dialog = gtk_message_dialog_new(GTK_WINDOW(cheese_window.window), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, + _("Unable to find a webcam, SORRY!")); + + gtk_dialog_run(GTK_DIALOG (dialog)); + gtk_widget_destroy(dialog); + } + } + if (gst_structure_has_name(scopy, "video/x-raw-rgb")) { + if (test_pipeline("v4lsrc ! video/x-raw-rgb,width=640,height=480 ! fakesink", self)) { + source_pipeline = "v4lsrc ! video/x-raw-rgb,width=640,height=480"; + } else if (test_pipeline("v4lsrc ! video/x-raw-rgb,width=320,height=240 ! fakesink", self)) { + source_pipeline = "v4lsrc ! video/x-raw-rgb,width=320,height=240"; + } else if (test_pipeline("v4lsrc ! video/x-raw-rgb,width=1280,height=960 ! fakesink", self)) { + source_pipeline = "v4lsrc ! video/x-raw-rgb,width=1280,height=960"; + } else if (test_pipeline("v4lsrc ! video/x-raw-rgb,width=160,height=120 ! fakesink", self)) { + source_pipeline = "v4lsrc ! video/x-raw-rgb,width=160,height=120"; + } else if (test_pipeline("v4lsrc ! fakesink", self)) { + source_pipeline = "v4lsrc"; + } else { + GtkWidget *dialog; + + dialog = gtk_message_dialog_new(GTK_WINDOW(cheese_window.window), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, + _("Unable to find a webcam, SORRY!")); + + gtk_dialog_run(GTK_DIALOG (dialog)); + gtk_widget_destroy(dialog); + } + } } g_print("using source: %s\n", source_pipeline);