mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 06:54:49 +00:00
[298/906] Revert "Fix indention"
This reverts commit 96e4ab18c2cf9876f6c031b9aba6282d0bd45a93. You should have asked first. And you would have been told "no", because it causes people on development branches to do a huge amount of extra work.
This commit is contained in:
parent
4525015dc6
commit
ea43a17480
2 changed files with 52 additions and 65 deletions
|
@ -17,11 +17,10 @@ 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,
|
gst_x_overlay_set_xwindow_id (overlay, (gulong)GDK_WINDOW_HWND(widget->window));
|
||||||
(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
|
||||||
|
@ -30,7 +29,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");
|
||||||
|
|
||||||
|
@ -112,10 +111,9 @@ 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);
|
||||||
|
@ -129,23 +127,20 @@ main (gint argc, gchar * argv[])
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
g_option_context_free (context);
|
g_option_context_free (context);
|
||||||
|
|
||||||
if (source_desc_array != NULL) {
|
if (source_desc_array != NULL) {
|
||||||
source_desc = g_strjoinv (" ", source_desc_array);
|
source_desc = g_strjoinv (" ", source_desc_array);
|
||||||
g_strfreev (source_desc_array);
|
g_strfreev (source_desc_array);
|
||||||
}
|
}
|
||||||
if (source_desc == NULL) {
|
if (source_desc == NULL) {
|
||||||
source_desc =
|
source_desc = g_strdup ("videotestsrc ! video/x-raw-rgb, width=352, height=288 ! identity");
|
||||||
g_strdup
|
|
||||||
("videotestsrc ! video/x-raw-rgb, width=352, height=288 ! identity");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sourcebin =
|
sourcebin = gst_parse_bin_from_description (g_strdup (source_desc), TRUE, &error);
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -168,9 +163,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 ();
|
||||||
|
|
||||||
|
|
|
@ -23,38 +23,38 @@ 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,8 +112,9 @@ 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, gpointer data)
|
GtkSelectionData * seldata, guint inf, guint time,
|
||||||
|
gpointer data)
|
||||||
{
|
{
|
||||||
GdkPixbufFormat *format;
|
GdkPixbufFormat *format;
|
||||||
SourceData *userdata = g_new0 (SourceData, 1);
|
SourceData *userdata = g_new0 (SourceData, 1);
|
||||||
|
@ -123,7 +124,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;
|
||||||
|
@ -131,9 +132,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
|
}
|
||||||
g_object_set (G_OBJECT (userdata->data), userdata->nick, userdata->value,
|
else
|
||||||
NULL);
|
g_object_set (G_OBJECT (userdata->data), userdata->nick, userdata->value, NULL);
|
||||||
g_free (filename);
|
g_free (filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -159,17 +160,11 @@ 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" },
|
||||||
{"method", 'm', 0, G_OPTION_ARG_INT, &method,
|
{ "delay", 'd', 0, G_OPTION_ARG_INT, &delay, "Wait N seconds before to send the image to gstreamer (useful with differencematte)", "N" },
|
||||||
"1 for gstdifferencematte, 2 for gstpixbufoverlay", "M"}
|
{ NULL }
|
||||||
,
|
|
||||||
{"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);
|
||||||
|
@ -183,23 +178,20 @@ main (gint argc, gchar * argv[])
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
g_option_context_free (context);
|
g_option_context_free (context);
|
||||||
|
|
||||||
if (source_desc_array != NULL) {
|
if (source_desc_array != NULL) {
|
||||||
source_desc = g_strjoinv (" ", source_desc_array);
|
source_desc = g_strjoinv (" ", source_desc_array);
|
||||||
g_strfreev (source_desc_array);
|
g_strfreev (source_desc_array);
|
||||||
}
|
}
|
||||||
if (source_desc == NULL) {
|
if (source_desc == NULL) {
|
||||||
source_desc =
|
source_desc = g_strdup ("videotestsrc ! video/x-raw-rgb, width=352, height=288 ! identity");
|
||||||
g_strdup
|
|
||||||
("videotestsrc ! video/x-raw-rgb, width=352, height=288 ! identity");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sourcebin =
|
sourcebin = gst_parse_bin_from_description (g_strdup (source_desc), TRUE, &error);
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -226,9 +218,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 ();
|
||||||
|
|
||||||
|
@ -270,7 +262,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);
|
||||||
|
|
Loading…
Reference in a new issue