[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

@ -17,10 +17,11 @@ static gboolean
expose_cb (GtkWidget * widget, GdkEventExpose * event, gpointer data) expose_cb (GtkWidget * widget, GdkEventExpose * event, gpointer data)
{ {
GstXOverlay *overlay = GstXOverlay *overlay =
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,14 +135,17 @@ 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",
GST_STR_NULL (error->message)); GST_STR_NULL (error->message));
return -1; return -1;
} }
@ -163,9 +168,9 @@ main (gint argc, gchar * argv[])
} }
g_signal_connect (G_OBJECT (window), "delete-event", g_signal_connect (G_OBJECT (window), "delete-event",
G_CALLBACK (destroy_cb), pipeline); G_CALLBACK (destroy_cb), pipeline);
g_signal_connect (G_OBJECT (window), "destroy-event", g_signal_connect (G_OBJECT (window), "destroy-event",
G_CALLBACK (destroy_cb), pipeline); G_CALLBACK (destroy_cb), pipeline);
screen = gtk_drawing_area_new (); screen = gtk_drawing_area_new ();

View file

@ -24,37 +24,37 @@ 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)
return GST_BUS_PASS; return GST_BUS_PASS;
if (!gst_structure_has_name (message->structure, "prepare-xwindow-id")) if (!gst_structure_has_name (message->structure, "prepare-xwindow-id"))
return GST_BUS_PASS; return GST_BUS_PASS;
#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);
return GST_BUS_DROP; return GST_BUS_DROP;
} }
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");
@ -112,9 +112,8 @@ 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);
@ -124,7 +123,7 @@ on_drag_data_received (GtkWidget * widget,
format = gdk_pixbuf_get_file_info (filename, NULL, NULL); format = gdk_pixbuf_get_file_info (filename, NULL, NULL);
g_return_if_fail (format); g_return_if_fail (format);
g_print ("received %s image: %s\n", filename, g_print ("received %s image: %s\n", filename,
gdk_pixbuf_format_get_name (format)); gdk_pixbuf_format_get_name (format));
userdata->nick = "location"; userdata->nick = "location";
userdata->value = g_strdup (filename); userdata->value = g_strdup (filename);
userdata->data = data; userdata->data = data;
@ -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,14 +189,17 @@ 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",
GST_STR_NULL (error->message)); GST_STR_NULL (error->message));
return -1; return -1;
} }
@ -218,9 +226,9 @@ main (gint argc, gchar * argv[])
} }
g_signal_connect (G_OBJECT (window), "delete-event", g_signal_connect (G_OBJECT (window), "delete-event",
G_CALLBACK (destroy_cb), pipeline); G_CALLBACK (destroy_cb), pipeline);
g_signal_connect (G_OBJECT (window), "destroy-event", g_signal_connect (G_OBJECT (window), "destroy-event",
G_CALLBACK (destroy_cb), pipeline); G_CALLBACK (destroy_cb), pipeline);
screen = gtk_drawing_area_new (); screen = gtk_drawing_area_new ();
@ -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);