[295/906] Fix indention

This commit is contained in:
Sebastian Dröge 2009-02-03 18:33:36 +01:00 committed by Matthew Waters
parent 532ea881fb
commit 4525015dc6
2 changed files with 65 additions and 52 deletions

View file

@ -20,7 +20,8 @@ expose_cb (GtkWidget * widget, GdkEventExpose * event, gpointer data)
GST_X_OVERLAY (gst_bin_get_by_interface (GST_BIN (data), GST_X_OVERLAY (gst_bin_get_by_interface (GST_BIN (data),
GST_TYPE_X_OVERLAY)); GST_TYPE_X_OVERLAY));
#ifdef WIN32 #ifdef WIN32
gst_x_overlay_set_xwindow_id (overlay, (gulong)GDK_WINDOW_HWND(widget->window)); gst_x_overlay_set_xwindow_id (overlay,
(gulong) GDK_WINDOW_HWND (widget->window));
#else #else
gst_x_overlay_set_xwindow_id (overlay, GDK_WINDOW_XWINDOW (widget->window)); gst_x_overlay_set_xwindow_id (overlay, GDK_WINDOW_XWINDOW (widget->window));
#endif #endif
@ -29,7 +30,7 @@ expose_cb (GtkWidget * widget, GdkEventExpose * event, gpointer data)
} }
static void static void
destroy_cb (GtkWidget *widget, GdkEvent *event, GstElement *pipeline) destroy_cb (GtkWidget * widget, GdkEvent * event, GstElement * pipeline)
{ {
g_message ("destroy callback"); g_message ("destroy callback");
@ -111,9 +112,10 @@ main (gint argc, gchar * argv[])
GOptionContext *context; GOptionContext *context;
GOptionEntry options[] = { GOptionEntry options[] = {
{ "source-bin", 's', 0, G_OPTION_ARG_STRING_ARRAY, &source_desc_array, {"source-bin", 's', 0, G_OPTION_ARG_STRING_ARRAY, &source_desc_array,
"Use a custom source bin description (gst-launch style)", NULL }, "Use a custom source bin description (gst-launch style)", NULL}
{ NULL } ,
{NULL}
}; };
g_thread_init (NULL); g_thread_init (NULL);
@ -133,10 +135,13 @@ main (gint argc, gchar * argv[])
g_strfreev (source_desc_array); g_strfreev (source_desc_array);
} }
if (source_desc == NULL) { if (source_desc == NULL) {
source_desc = g_strdup ("videotestsrc ! video/x-raw-rgb, width=352, height=288 ! identity"); source_desc =
g_strdup
("videotestsrc ! video/x-raw-rgb, width=352, height=288 ! identity");
} }
sourcebin = gst_parse_bin_from_description (g_strdup (source_desc), TRUE, &error); sourcebin =
gst_parse_bin_from_description (g_strdup (source_desc), TRUE, &error);
g_free (source_desc); g_free (source_desc);
if (error) { if (error) {
g_print ("Error while parsing source bin description: %s\n", g_print ("Error while parsing source bin description: %s\n",

View file

@ -24,7 +24,7 @@ struct _SourceData
typedef struct _SourceData SourceData; typedef struct _SourceData SourceData;
static GstBusSyncReply static GstBusSyncReply
create_window (GstBus *bus, GstMessage *message, GtkWidget *widget) create_window (GstBus * bus, GstMessage * message, GtkWidget * widget)
{ {
// ignore anything but 'prepare-xwindow-id' element messages // ignore anything but 'prepare-xwindow-id' element messages
if (GST_MESSAGE_TYPE (message) != GST_MESSAGE_ELEMENT) if (GST_MESSAGE_TYPE (message) != GST_MESSAGE_ELEMENT)
@ -35,10 +35,10 @@ create_window (GstBus *bus, GstMessage *message, GtkWidget *widget)
#ifdef WIN32 #ifdef WIN32
gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (GST_MESSAGE_SRC (message)), gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (GST_MESSAGE_SRC (message)),
(gulong)GDK_WINDOW_HWND(widget->window)); (gulong) GDK_WINDOW_HWND (widget->window));
#else #else
gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (GST_MESSAGE_SRC (message)), gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (GST_MESSAGE_SRC (message)),
GDK_WINDOW_XWINDOW(widget->window)); GDK_WINDOW_XWINDOW (widget->window));
#endif #endif
gst_message_unref (message); gst_message_unref (message);
@ -47,14 +47,14 @@ create_window (GstBus *bus, GstMessage *message, GtkWidget *widget)
} }
static gboolean static gboolean
expose_cb(GtkWidget *widget, GdkEventExpose *event, GstElement *videosink) expose_cb (GtkWidget * widget, GdkEventExpose * event, GstElement * videosink)
{ {
gst_x_overlay_expose (GST_X_OVERLAY (videosink)); gst_x_overlay_expose (GST_X_OVERLAY (videosink));
return FALSE; return FALSE;
} }
static void static void
destroy_cb (GtkWidget *widget, GdkEvent *event, GstElement *pipeline) destroy_cb (GtkWidget * widget, GdkEvent * event, GstElement * pipeline)
{ {
g_message ("destroy callback"); g_message ("destroy callback");
@ -113,8 +113,7 @@ set_location_delayed (gpointer data)
static void static void
on_drag_data_received (GtkWidget * widget, on_drag_data_received (GtkWidget * widget,
GdkDragContext * context, int x, int y, GdkDragContext * context, int x, int y,
GtkSelectionData * seldata, guint inf, guint time, GtkSelectionData * seldata, guint inf, guint time, gpointer data)
gpointer data)
{ {
GdkPixbufFormat *format; GdkPixbufFormat *format;
SourceData *userdata = g_new0 (SourceData, 1); SourceData *userdata = g_new0 (SourceData, 1);
@ -132,9 +131,9 @@ on_drag_data_received (GtkWidget * widget,
if (delay > 0) { if (delay > 0) {
g_print ("%d\n", delay); g_print ("%d\n", delay);
g_timeout_add_seconds (1, set_location_delayed, userdata); g_timeout_add_seconds (1, set_location_delayed, userdata);
} } else
else g_object_set (G_OBJECT (userdata->data), userdata->nick, userdata->value,
g_object_set (G_OBJECT (userdata->data), userdata->nick, userdata->value, NULL); NULL);
g_free (filename); g_free (filename);
} }
@ -160,11 +159,17 @@ main (gint argc, gchar * argv[])
GOptionContext *context; GOptionContext *context;
GOptionEntry options[] = { GOptionEntry options[] = {
{ "source-bin", 's', 0, G_OPTION_ARG_STRING_ARRAY, &source_desc_array, {"source-bin", 's', 0, G_OPTION_ARG_STRING_ARRAY, &source_desc_array,
"Use a custom source bin description (gst-launch style)", NULL }, "Use a custom source bin description (gst-launch style)", NULL}
{ "method", 'm', 0, G_OPTION_ARG_INT, &method, "1 for gstdifferencematte, 2 for gstpixbufoverlay", "M" }, ,
{ "delay", 'd', 0, G_OPTION_ARG_INT, &delay, "Wait N seconds before to send the image to gstreamer (useful with differencematte)", "N" }, {"method", 'm', 0, G_OPTION_ARG_INT, &method,
{ NULL } "1 for gstdifferencematte, 2 for gstpixbufoverlay", "M"}
,
{"delay", 'd', 0, G_OPTION_ARG_INT, &delay,
"Wait N seconds before to send the image to gstreamer (useful with differencematte)",
"N"}
,
{NULL}
}; };
g_thread_init (NULL); g_thread_init (NULL);
@ -184,10 +189,13 @@ main (gint argc, gchar * argv[])
g_strfreev (source_desc_array); g_strfreev (source_desc_array);
} }
if (source_desc == NULL) { if (source_desc == NULL) {
source_desc = g_strdup ("videotestsrc ! video/x-raw-rgb, width=352, height=288 ! identity"); source_desc =
g_strdup
("videotestsrc ! video/x-raw-rgb, width=352, height=288 ! identity");
} }
sourcebin = gst_parse_bin_from_description (g_strdup (source_desc), TRUE, &error); sourcebin =
gst_parse_bin_from_description (g_strdup (source_desc), TRUE, &error);
g_free (source_desc); g_free (source_desc);
if (error) { if (error) {
g_print ("Error while parsing source bin description: %s\n", g_print ("Error while parsing source bin description: %s\n",
@ -262,7 +270,7 @@ main (gint argc, gchar * argv[])
bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline)); bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
gst_bus_set_sync_handler (bus, (GstBusSyncHandler) create_window, screen); gst_bus_set_sync_handler (bus, (GstBusSyncHandler) create_window, screen);
gst_object_unref (bus); gst_object_unref (bus);
g_signal_connect(screen, "expose-event", G_CALLBACK(expose_cb), sink); g_signal_connect (screen, "expose-event", G_CALLBACK (expose_cb), sink);
gtk_drag_dest_set (screen, GTK_DEST_DEFAULT_ALL, NULL, 0, GDK_ACTION_COPY); gtk_drag_dest_set (screen, GTK_DEST_DEFAULT_ALL, NULL, 0, GDK_ACTION_COPY);
gtk_drag_dest_add_uri_targets (screen); gtk_drag_dest_add_uri_targets (screen);