[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)
{
GstXOverlay *overlay =
GST_X_OVERLAY (gst_bin_get_by_interface (GST_BIN (data),
GST_TYPE_X_OVERLAY));
GST_X_OVERLAY (gst_bin_get_by_interface (GST_BIN (data),
GST_TYPE_X_OVERLAY));
#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
gst_x_overlay_set_xwindow_id (overlay, GDK_WINDOW_XWINDOW (widget->window));
#endif
@ -29,7 +30,7 @@ expose_cb (GtkWidget * widget, GdkEventExpose * event, gpointer data)
}
static void
destroy_cb (GtkWidget *widget, GdkEvent *event, GstElement *pipeline)
destroy_cb (GtkWidget * widget, GdkEvent * event, GstElement * pipeline)
{
g_message ("destroy callback");
@ -111,9 +112,10 @@ main (gint argc, gchar * argv[])
GOptionContext *context;
GOptionEntry options[] = {
{ "source-bin", 's', 0, G_OPTION_ARG_STRING_ARRAY, &source_desc_array,
"Use a custom source bin description (gst-launch style)", NULL },
{ NULL }
{"source-bin", 's', 0, G_OPTION_ARG_STRING_ARRAY, &source_desc_array,
"Use a custom source bin description (gst-launch style)", NULL}
,
{NULL}
};
g_thread_init (NULL);
@ -127,20 +129,23 @@ main (gint argc, gchar * argv[])
return -1;
}
g_option_context_free (context);
if (source_desc_array != NULL) {
source_desc = g_strjoinv (" ", source_desc_array);
g_strfreev (source_desc_array);
}
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);
if (error) {
g_print ("Error while parsing source bin description: %s\n",
GST_STR_NULL (error->message));
g_print ("Error while parsing source bin description: %s\n",
GST_STR_NULL (error->message));
return -1;
}
@ -163,9 +168,9 @@ main (gint argc, gchar * argv[])
}
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_CALLBACK (destroy_cb), pipeline);
G_CALLBACK (destroy_cb), pipeline);
screen = gtk_drawing_area_new ();

View file

@ -23,38 +23,38 @@ struct _SourceData
};
typedef struct _SourceData SourceData;
static GstBusSyncReply
create_window (GstBus *bus, GstMessage *message, GtkWidget *widget)
static GstBusSyncReply
create_window (GstBus * bus, GstMessage * message, GtkWidget * widget)
{
// ignore anything but 'prepare-xwindow-id' element messages
if (GST_MESSAGE_TYPE (message) != GST_MESSAGE_ELEMENT)
return GST_BUS_PASS;
// ignore anything but 'prepare-xwindow-id' element messages
if (GST_MESSAGE_TYPE (message) != GST_MESSAGE_ELEMENT)
return GST_BUS_PASS;
if (!gst_structure_has_name (message->structure, "prepare-xwindow-id"))
return GST_BUS_PASS;
if (!gst_structure_has_name (message->structure, "prepare-xwindow-id"))
return GST_BUS_PASS;
#ifdef WIN32
gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (GST_MESSAGE_SRC (message)),
(gulong)GDK_WINDOW_HWND(widget->window));
gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (GST_MESSAGE_SRC (message)),
(gulong) GDK_WINDOW_HWND (widget->window));
#else
gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (GST_MESSAGE_SRC (message)),
GDK_WINDOW_XWINDOW(widget->window));
gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (GST_MESSAGE_SRC (message)),
GDK_WINDOW_XWINDOW (widget->window));
#endif
gst_message_unref (message);
gst_message_unref (message);
return GST_BUS_DROP;
return GST_BUS_DROP;
}
static gboolean
expose_cb(GtkWidget *widget, GdkEventExpose *event, GstElement *videosink)
static gboolean
expose_cb (GtkWidget * widget, GdkEventExpose * event, GstElement * videosink)
{
gst_x_overlay_expose (GST_X_OVERLAY (videosink));
return FALSE;
gst_x_overlay_expose (GST_X_OVERLAY (videosink));
return FALSE;
}
static void
destroy_cb (GtkWidget *widget, GdkEvent *event, GstElement *pipeline)
destroy_cb (GtkWidget * widget, GdkEvent * event, GstElement * pipeline)
{
g_message ("destroy callback");
@ -112,9 +112,8 @@ set_location_delayed (gpointer data)
static void
on_drag_data_received (GtkWidget * widget,
GdkDragContext * context, int x, int y,
GtkSelectionData * seldata, guint inf, guint time,
gpointer data)
GdkDragContext * context, int x, int y,
GtkSelectionData * seldata, guint inf, guint time, gpointer data)
{
GdkPixbufFormat *format;
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);
g_return_if_fail (format);
g_print ("received %s image: %s\n", filename,
gdk_pixbuf_format_get_name (format));
gdk_pixbuf_format_get_name (format));
userdata->nick = "location";
userdata->value = g_strdup (filename);
userdata->data = data;
@ -132,9 +131,9 @@ on_drag_data_received (GtkWidget * widget,
if (delay > 0) {
g_print ("%d\n", delay);
g_timeout_add_seconds (1, set_location_delayed, userdata);
}
else
g_object_set (G_OBJECT (userdata->data), userdata->nick, userdata->value, NULL);
} else
g_object_set (G_OBJECT (userdata->data), userdata->nick, userdata->value,
NULL);
g_free (filename);
}
@ -160,11 +159,17 @@ main (gint argc, gchar * argv[])
GOptionContext *context;
GOptionEntry options[] = {
{ "source-bin", 's', 0, G_OPTION_ARG_STRING_ARRAY, &source_desc_array,
"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" },
{ NULL }
{"source-bin", 's', 0, G_OPTION_ARG_STRING_ARRAY, &source_desc_array,
"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"}
,
{NULL}
};
g_thread_init (NULL);
@ -178,20 +183,23 @@ main (gint argc, gchar * argv[])
return -1;
}
g_option_context_free (context);
if (source_desc_array != NULL) {
source_desc = g_strjoinv (" ", source_desc_array);
g_strfreev (source_desc_array);
}
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);
if (error) {
g_print ("Error while parsing source bin description: %s\n",
GST_STR_NULL (error->message));
g_print ("Error while parsing source bin description: %s\n",
GST_STR_NULL (error->message));
return -1;
}
@ -218,9 +226,9 @@ main (gint argc, gchar * argv[])
}
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_CALLBACK (destroy_cb), pipeline);
G_CALLBACK (destroy_cb), pipeline);
screen = gtk_drawing_area_new ();
@ -262,7 +270,7 @@ main (gint argc, gchar * argv[])
bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
gst_bus_set_sync_handler (bus, (GstBusSyncHandler) create_window, screen);
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_add_uri_targets (screen);