diff options
-rw-r--r-- | configure.ac | 1 | ||||
-rw-r--r-- | gst/aacparse/gstbaseparse.c | 10 | ||||
-rw-r--r-- | gst/amrparse/gstbaseparse.c | 10 | ||||
-rw-r--r-- | gst/camerabin/Makefile.am | 2 | ||||
-rw-r--r-- | gst/camerabin/gstcamerabin-marshal.list | 2 | ||||
-rw-r--r-- | gst/camerabin/gstcamerabin.c | 11 | ||||
-rw-r--r-- | gst/flacparse/gstbaseparse.c | 10 | ||||
-rw-r--r-- | gst/rawparse/gstvideoparse.c | 15 | ||||
-rw-r--r-- | gst/rtpmanager/gstrtpsession.c | 4 | ||||
-rw-r--r-- | sys/qtwrapper/qtutils.c | 2 | ||||
-rw-r--r-- | tests/check/elements/camerabin.c | 2 | ||||
-rw-r--r-- | tests/examples/mxf/.gitignore | 1 | ||||
-rw-r--r-- | tests/examples/mxf/Makefile.am | 8 | ||||
-rw-r--r-- | tests/examples/mxf/mxfdemux-structure.c | 241 |
14 files changed, 286 insertions, 33 deletions
diff --git a/configure.ac b/configure.ac index 12633c64..b7542fbf 100644 --- a/configure.ac +++ b/configure.ac @@ -1497,6 +1497,7 @@ sys/winks/Makefile sys/winscreencap/Makefile tests/examples/Makefile tests/examples/directfb/Makefile +tests/examples/mxf/Makefile tests/examples/scaletempo/Makefile tests/examples/switch/Makefile ext/amrwb/Makefile diff --git a/gst/aacparse/gstbaseparse.c b/gst/aacparse/gstbaseparse.c index baa56826..6d0e7f8d 100644 --- a/gst/aacparse/gstbaseparse.c +++ b/gst/aacparse/gstbaseparse.c @@ -838,7 +838,7 @@ gst_base_parse_chain (GstPad * pad, GstBuffer * buffer) parse = GST_BASE_PARSE (GST_OBJECT_PARENT (pad)); bclass = GST_BASE_PARSE_GET_CLASS (parse); - if (parse->pending_segment) { + if (G_UNLIKELY (parse->pending_segment)) { GST_DEBUG_OBJECT (parse, "chain pushing a pending segment"); gst_pad_push_event (parse->srcpad, parse->pending_segment); parse->pending_segment = NULL; @@ -854,7 +854,7 @@ gst_base_parse_chain (GstPad * pad, GstBuffer * buffer) gst_adapter_clear (parse->adapter); } - if (parse->priv->pending_events) { + if (G_UNLIKELY (parse->priv->pending_events)) { GList *l; for (l = parse->priv->pending_events; l != NULL; l = l->next) { @@ -864,11 +864,9 @@ gst_base_parse_chain (GstPad * pad, GstBuffer * buffer) parse->priv->pending_events = NULL; } - if (buffer) { + if (G_LIKELY (buffer)) { GST_LOG_OBJECT (parse, "buffer size: %d, offset = %lld", GST_BUFFER_SIZE (buffer), GST_BUFFER_OFFSET (buffer)); - - gst_adapter_push (parse->adapter, buffer); } @@ -899,7 +897,7 @@ gst_base_parse_chain (GstPad * pad, GstBuffer * buffer) if (parse->priv->discont) { GST_DEBUG_OBJECT (parse, "marking DISCONT"); - GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_DISCONT); + GST_BUFFER_FLAG_SET (tmpbuf, GST_BUFFER_FLAG_DISCONT); } skip = -1; diff --git a/gst/amrparse/gstbaseparse.c b/gst/amrparse/gstbaseparse.c index dc82472d..673f7169 100644 --- a/gst/amrparse/gstbaseparse.c +++ b/gst/amrparse/gstbaseparse.c @@ -838,7 +838,7 @@ gst_base_parse_chain (GstPad * pad, GstBuffer * buffer) parse = GST_BASE_PARSE (GST_OBJECT_PARENT (pad)); bclass = GST_BASE_PARSE_GET_CLASS (parse); - if (parse->pending_segment) { + if (G_UNLIKELY (parse->pending_segment)) { GST_DEBUG_OBJECT (parse, "chain pushing a pending segment"); gst_pad_push_event (parse->srcpad, parse->pending_segment); parse->pending_segment = NULL; @@ -854,7 +854,7 @@ gst_base_parse_chain (GstPad * pad, GstBuffer * buffer) gst_adapter_clear (parse->adapter); } - if (parse->priv->pending_events) { + if (G_UNLIKELY (parse->priv->pending_events)) { GList *l; for (l = parse->priv->pending_events; l != NULL; l = l->next) { @@ -864,11 +864,9 @@ gst_base_parse_chain (GstPad * pad, GstBuffer * buffer) parse->priv->pending_events = NULL; } - if (buffer) { + if (G_LIKELY (buffer)) { GST_LOG_OBJECT (parse, "buffer size: %d, offset = %lld", GST_BUFFER_SIZE (buffer), GST_BUFFER_OFFSET (buffer)); - - gst_adapter_push (parse->adapter, buffer); } @@ -899,7 +897,7 @@ gst_base_parse_chain (GstPad * pad, GstBuffer * buffer) if (parse->priv->discont) { GST_DEBUG_OBJECT (parse, "marking DISCONT"); - GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_DISCONT); + GST_BUFFER_FLAG_SET (tmpbuf, GST_BUFFER_FLAG_DISCONT); } skip = -1; diff --git a/gst/camerabin/Makefile.am b/gst/camerabin/Makefile.am index 583b2c55..376d6787 100644 --- a/gst/camerabin/Makefile.am +++ b/gst/camerabin/Makefile.am @@ -1,4 +1,4 @@ -glib_enum_prefix = gst_camerabin +glib_enum_prefix = __gst_camerabin include $(top_srcdir)/common/glib-gen.mak diff --git a/gst/camerabin/gstcamerabin-marshal.list b/gst/camerabin/gstcamerabin-marshal.list index 40829e54..4c1670ef 100644 --- a/gst/camerabin/gstcamerabin-marshal.list +++ b/gst/camerabin/gstcamerabin-marshal.list @@ -3,4 +3,4 @@ VOID:INT,INT,INT,INT VOID:INT,INT -BOOLEAN:STRING +BOOLEAN:POINTER diff --git a/gst/camerabin/gstcamerabin.c b/gst/camerabin/gstcamerabin.c index 5dbd386f..905a8c9c 100644 --- a/gst/camerabin/gstcamerabin.c +++ b/gst/camerabin/gstcamerabin.c @@ -882,7 +882,7 @@ gst_camerabin_image_capture_continue (GstCameraBin * camera, GString * filename, g_signal_emit (G_OBJECT (camera), camerabin_signals[IMG_DONE_SIGNAL], 0, filename, cont); - GST_DEBUG_OBJECT (camera, "emitted img_done, new filename:%s, continue:%d", + GST_DEBUG_OBJECT (camera, "emitted img_done, new filename: %s, continue: %d", filename->str, *cont); } @@ -2265,7 +2265,7 @@ gst_camerabin_class_init (GstCameraBinClass * klass) G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET (GstCameraBinClass, user_res_fps), - NULL, NULL, gst_camerabin_marshal_VOID__INT_INT_INT_INT, G_TYPE_NONE, 4, + NULL, NULL, __gst_camerabin_marshal_VOID__INT_INT_INT_INT, G_TYPE_NONE, 4, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT); /** @@ -2284,13 +2284,13 @@ gst_camerabin_class_init (GstCameraBinClass * klass) G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET (GstCameraBinClass, user_image_res), - NULL, NULL, gst_camerabin_marshal_VOID__INT_INT, G_TYPE_NONE, 2, + NULL, NULL, __gst_camerabin_marshal_VOID__INT_INT, G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT); /** * GstCameraBin::img-done: * @camera: the camera bin element - * @filename: the name of the file just saved + * @filename: the name of the file just saved as a GString* * * Signal emited when the file has just been saved. To continue taking * pictures just update @filename and return TRUE, otherwise return FALSE. @@ -2303,7 +2303,8 @@ gst_camerabin_class_init (GstCameraBinClass * klass) g_signal_new ("img-done", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstCameraBinClass, img_done), g_signal_accumulator_true_handled, NULL, - gst_camerabin_marshal_BOOLEAN__STRING, G_TYPE_BOOLEAN, 1, G_TYPE_GSTRING); + __gst_camerabin_marshal_BOOLEAN__POINTER, G_TYPE_BOOLEAN, 1, + G_TYPE_POINTER); klass->user_start = gst_camerabin_user_start; klass->user_stop = gst_camerabin_user_stop; diff --git a/gst/flacparse/gstbaseparse.c b/gst/flacparse/gstbaseparse.c index 9b4a9f13..ea06474e 100644 --- a/gst/flacparse/gstbaseparse.c +++ b/gst/flacparse/gstbaseparse.c @@ -982,18 +982,16 @@ gst_base_parse_chain (GstPad * pad, GstBuffer * buffer) /* Make sure that adapter doesn't have any old data after newsegment has been received and update our offset */ - if (parse->pending_segment) { - gst_adapter_clear (parse->priv->adapter); + if (G_UNLIKELY (parse->pending_segment)) { parse->priv->offset = parse->priv->pending_offset; + gst_adapter_clear (parse->priv->adapter); } gst_base_parse_update_upstream_durations (parse); - if (buffer) { + if (G_LIKELY (buffer)) { GST_LOG_OBJECT (parse, "buffer size: %d, offset = %lld", GST_BUFFER_SIZE (buffer), GST_BUFFER_OFFSET (buffer)); - - gst_adapter_push (parse->priv->adapter, buffer); } @@ -1025,7 +1023,7 @@ gst_base_parse_chain (GstPad * pad, GstBuffer * buffer) if (parse->priv->discont) { GST_DEBUG_OBJECT (parse, "marking DISCONT"); - GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_DISCONT); + GST_BUFFER_FLAG_SET (tmpbuf, GST_BUFFER_FLAG_DISCONT); } skip = -1; diff --git a/gst/rawparse/gstvideoparse.c b/gst/rawparse/gstvideoparse.c index e3b4b780..ac520160 100644 --- a/gst/rawparse/gstvideoparse.c +++ b/gst/rawparse/gstvideoparse.c @@ -37,6 +37,7 @@ typedef enum GST_VIDEO_PARSE_FORMAT_YV12, GST_VIDEO_PARSE_FORMAT_YUY2, GST_VIDEO_PARSE_FORMAT_UYVY, + GST_VIDEO_PARSE_FORMAT_v210, GST_VIDEO_PARSE_FORMAT_RGB = 10, GST_VIDEO_PARSE_FORMAT_GRAY } GstVideoParseFormat; @@ -94,6 +95,7 @@ gst_video_parse_format_get_type (void) {GST_VIDEO_PARSE_FORMAT_YV12, "YV12", "YV12"}, {GST_VIDEO_PARSE_FORMAT_YUY2, "YUY2", "YUY2"}, {GST_VIDEO_PARSE_FORMAT_UYVY, "UYVY", "UYVY"}, + {GST_VIDEO_PARSE_FORMAT_v210, "v210", "v210"}, {GST_VIDEO_PARSE_FORMAT_RGB, "RGB", "RGB"}, {GST_VIDEO_PARSE_FORMAT_GRAY, "GRAY", "GRAY"}, {0, NULL, NULL} @@ -143,7 +145,8 @@ gst_video_parse_base_init (gpointer g_class) caps = gst_caps_from_string (GST_VIDEO_CAPS_YUV - ("{ I420, YV12, YUY2, UYVY }") ";" "video/x-raw-rgb; video/x-raw-gray"); + ("{ I420, YV12, YUY2, UYVY, v210 }") ";" + "video/x-raw-rgb; video/x-raw-gray"); gst_raw_parse_class_set_src_pad_template (rp_class, caps); gst_raw_parse_class_set_multiple_frames_per_buffer (rp_class, FALSE); @@ -348,6 +351,8 @@ gst_video_parse_format_to_fourcc (GstVideoParseFormat format) return GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'); case GST_VIDEO_PARSE_FORMAT_UYVY: return GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y'); + case GST_VIDEO_PARSE_FORMAT_v210: + return GST_MAKE_FOURCC ('v', '2', '1', '0'); default: g_assert_not_reached (); } @@ -368,6 +373,8 @@ gst_video_parse_update_frame_size (GstVideoParse * vp) } else if (vp->format == GST_VIDEO_PARSE_FORMAT_YUY2 || vp->format == GST_VIDEO_PARSE_FORMAT_UYVY) { framesize = GST_ROUND_UP_4 (vp->width * 2) * vp->height; + } else if (vp->format == GST_VIDEO_PARSE_FORMAT_v210) { + framesize = ((vp->width + 47) / 48) * 128 * vp->height; } else if (vp->format == GST_VIDEO_PARSE_FORMAT_RGB) { framesize = GST_ROUND_UP_4 (vp->width * vp->bpp / 8) * vp->height; } else { @@ -393,7 +400,7 @@ gst_video_parse_get_caps (GstRawParse * rp) "height", G_TYPE_INT, vp->height, "format", GST_TYPE_FOURCC, gst_video_parse_format_to_fourcc (vp->format), "framerate", - GST_TYPE_FRACTION, fps_n, fps_d, "pixel_aspect_ratio", + GST_TYPE_FRACTION, fps_n, fps_d, "pixel-aspect-ratio", GST_TYPE_FRACTION, vp->par_n, vp->par_d, NULL); } else if (vp->format == GST_VIDEO_PARSE_FORMAT_RGB) { caps = gst_caps_new_simple ("video/x-raw-rgb", @@ -402,7 +409,7 @@ gst_video_parse_get_caps (GstRawParse * rp) "bpp", G_TYPE_INT, vp->bpp, "depth", G_TYPE_INT, vp->depth, "framerate", GST_TYPE_FRACTION, fps_n, fps_d, - "pixel_aspect_ratio", GST_TYPE_FRACTION, vp->par_n, vp->par_d, + "pixel-aspect-ratio", GST_TYPE_FRACTION, vp->par_n, vp->par_d, "red_mask", G_TYPE_INT, vp->red_mask, "green_mask", G_TYPE_INT, vp->green_mask, "blue_mask", G_TYPE_INT, vp->blue_mask, @@ -415,7 +422,7 @@ gst_video_parse_get_caps (GstRawParse * rp) "bpp", G_TYPE_INT, vp->bpp, "depth", G_TYPE_INT, vp->depth, "framerate", GST_TYPE_FRACTION, fps_n, fps_d, - "pixel_aspect_ratio", GST_TYPE_FRACTION, vp->par_n, vp->par_d, NULL); + "pixel-aspect-ratio", GST_TYPE_FRACTION, vp->par_n, vp->par_d, NULL); } return caps; } diff --git a/gst/rtpmanager/gstrtpsession.c b/gst/rtpmanager/gstrtpsession.c index 615dc15a..06d64a45 100644 --- a/gst/rtpmanager/gstrtpsession.c +++ b/gst/rtpmanager/gstrtpsession.c @@ -1483,10 +1483,6 @@ gst_rtp_session_event_recv_rtcp_sink (GstPad * pad, GstEvent * event) switch (GST_EVENT_TYPE (event)) { default: - if (rtpsession->send_rtcp_src) { - gst_event_ref (event); - ret = gst_pad_push_event (rtpsession->send_rtcp_src, event); - } ret = gst_pad_push_event (rtpsession->sync_src, event); break; } diff --git a/sys/qtwrapper/qtutils.c b/sys/qtwrapper/qtutils.c index 9b71bd06..60d89445 100644 --- a/sys/qtwrapper/qtutils.c +++ b/sys/qtwrapper/qtutils.c @@ -387,7 +387,9 @@ dump_codec_decompress_params (CodecDecompressParams * params) GST_LOG ("capabilities:%p", params->capabilities); GST_LOG ("port:%p", params->port); GST_LOG ("dstPixMap"); +#if DEBUG_DUMP gst_util_dump_mem ((const guchar *) ¶ms->dstPixMap, sizeof (PixMap)); +#endif GST_LOG ("maskBits:%p", params->maskBits); GST_LOG ("mattePixMap:%p", params->mattePixMap); diff --git a/tests/check/elements/camerabin.c b/tests/check/elements/camerabin.c index 82b218b9..53e0e5fa 100644 --- a/tests/check/elements/camerabin.c +++ b/tests/check/elements/camerabin.c @@ -82,6 +82,7 @@ capture_done (GstElement * elem, GString * filename, gpointer user_data) if (captured_images >= MAX_BURST_IMAGES) { /* release the shutter button */ + GST_DEBUG ("signal for img-done"); g_mutex_lock (cam_mutex); g_cond_signal (cam_cond); g_mutex_unlock (cam_mutex); @@ -334,6 +335,7 @@ GST_START_TEST (test_burst_image_capture) g_mutex_lock (cam_mutex); g_cond_wait (cam_cond, cam_mutex); g_mutex_unlock (cam_mutex); + GST_DEBUG ("received img-done"); g_signal_emit_by_name (camera, "user-stop", 0); } diff --git a/tests/examples/mxf/.gitignore b/tests/examples/mxf/.gitignore new file mode 100644 index 00000000..3246be4d --- /dev/null +++ b/tests/examples/mxf/.gitignore @@ -0,0 +1 @@ +mxfdemux-structure diff --git a/tests/examples/mxf/Makefile.am b/tests/examples/mxf/Makefile.am new file mode 100644 index 00000000..f3099ee2 --- /dev/null +++ b/tests/examples/mxf/Makefile.am @@ -0,0 +1,8 @@ +noinst_PROGRAMS = mxfdemux-structure + +mxfdemux_structure_SOURCES = mxfdemux-structure.c +mxfdemux_structure_CFLAGS = $(GST_CFLAGS) $(GTK_CFLAGS) +mxfdemux_structure_LDFLAGS = $(GST_LIBS) $(GTK_LIBS) + +noinst_HEADERS = + diff --git a/tests/examples/mxf/mxfdemux-structure.c b/tests/examples/mxf/mxfdemux-structure.c new file mode 100644 index 00000000..0678ad54 --- /dev/null +++ b/tests/examples/mxf/mxfdemux-structure.c @@ -0,0 +1,241 @@ +/* GStreamer + * Copyright (C) <2008> Sebastian Dröge <sebastian.droege@collabora.co.uk> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <gst/gst.h> +#include <gtk/gtk.h> + +static GtkWidget *window = NULL; +static GtkTreeStore *treestore = NULL; + +static gchar * +g_value_to_string (const GValue * val) +{ + if (G_VALUE_TYPE (val) == GST_TYPE_BUFFER) { + const GstBuffer *buf = gst_value_get_buffer (val); + gchar *ret = g_base64_encode (GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf)); + + return ret; + } else { + GValue s = { 0, }; + gchar *ret; + + g_value_init (&s, G_TYPE_STRING); + + if (!g_value_transform (val, &s)) { + return NULL; + } + + ret = g_value_dup_string (&s); + g_value_unset (&s); + + return ret; + } +} + +static gboolean +insert_field (GQuark field_id, const GValue * val, gpointer user_data) +{ + GtkTreeIter *parent_iter = user_data; + GtkTreeIter iter; + const gchar *f = g_quark_to_string (field_id); + + gtk_tree_store_append (treestore, &iter, parent_iter); + + if (G_VALUE_TYPE (val) == GST_TYPE_ARRAY) { + guint n = gst_value_array_get_size (val); + guint i; + GtkTreeIter child_iter; + + gtk_tree_store_set (treestore, &iter, 0, f, -1); + + for (i = 0; i < n; i++) { + const GValue *ve = gst_value_array_get_value (val, i); + + gtk_tree_store_append (treestore, &child_iter, &iter); + + if (G_VALUE_TYPE (ve) == GST_TYPE_STRUCTURE) { + const GstStructure *s = gst_value_get_structure (ve); + + gtk_tree_store_set (treestore, &child_iter, 0, + gst_structure_get_name (s), -1); + + gst_structure_foreach (s, insert_field, &child_iter); + } else { + gchar *v = g_value_to_string (ve); + + gtk_tree_store_set (treestore, &child_iter, 0, v, -1); + + g_free (v); + } + } + } else if (G_VALUE_TYPE (val) == GST_TYPE_STRUCTURE) { + const GstStructure *s = gst_value_get_structure (val); + gchar *entry = g_strdup_printf ("%s: %s", f, gst_structure_get_name (s)); + + gtk_tree_store_set (treestore, &iter, 0, entry, -1); + + g_free (entry); + + gst_structure_foreach (s, insert_field, &iter); + } else { + gchar *v = g_value_to_string (val); + gchar *entry = g_strdup_printf ("%s: %s", f, v); + + gtk_tree_store_set (treestore, &iter, 0, entry, -1); + + g_free (v); + g_free (entry); + } + + return TRUE; +} + +static void +insert_structure (const GstStructure * s, GtkTreeIter * iter) +{ + const gchar *name = gst_structure_get_name (s); + + gtk_tree_store_set (treestore, iter, 0, name, -1); + + gst_structure_foreach (s, insert_field, iter); +} + +static void +on_message (GstBus * bus, GstMessage * message, gpointer data) +{ + switch (GST_MESSAGE_TYPE (message)) { + case GST_MESSAGE_WARNING: + case GST_MESSAGE_ERROR: + g_error ("Got error"); + gtk_main_quit (); + break; + case GST_MESSAGE_TAG:{ + GstTagList *tags; + GValue v = { 0, }; + + g_print ("Got tags\n"); + gst_message_parse_tag (message, &tags); + + if (gst_tag_list_copy_value (&v, tags, "mxf-structure")) { + const GstStructure *s; + GtkTreeIter iter; + + s = gst_value_get_structure (&v); + + gtk_tree_store_append (treestore, &iter, NULL); + insert_structure (s, &iter); + + gtk_widget_show_all (window); + + g_value_unset (&v); + } + + gst_tag_list_free (tags); + break; + default: + break; + } + } +} + +static void +on_pad_added (GstElement * src, GstPad * pad, gpointer data) +{ + GstElement *fakesink = gst_element_factory_make ("fakesink", NULL); + GstPad *sinkpad = gst_element_get_static_pad (fakesink, "sink"); + GstElement *bin = (GstElement *) gst_element_get_parent (src); + + gst_bin_add (GST_BIN (bin), fakesink); + + gst_pad_link (pad, sinkpad); + + gst_object_unref (sinkpad); + gst_object_unref (bin); +} + +gint +main (gint argc, gchar ** argv) +{ + GstElement *pipeline, *src, *mxfdemux; + GstBus *bus; + GtkWidget *scrolled_window, *treeview; + + if (argc < 2) { + g_print ("usage: %s MXF-FILE\n", argv[0]); + return -1; + } + + if (!g_thread_supported ()) + g_thread_init (NULL); + + gst_init (NULL, NULL); + gtk_init (NULL, NULL); + + pipeline = gst_pipeline_new ("pipeline"); + + src = gst_element_factory_make ("filesrc", "src"); + g_object_set (G_OBJECT (src), "location", argv[1], NULL); + + mxfdemux = gst_element_factory_make ("mxfdemux", "mxfdemux"); + g_signal_connect (mxfdemux, "pad-added", G_CALLBACK (on_pad_added), NULL); + + if (!src || !mxfdemux) { + g_error ("Unable to create all elements"); + return -2; + } + + gst_bin_add_many (GST_BIN (pipeline), src, mxfdemux, NULL); + if (!gst_element_link_many (src, mxfdemux, NULL)) { + g_error ("Failed to link elements"); + return -3; + } + + bus = gst_element_get_bus (pipeline); + gst_bus_add_signal_watch (bus); + g_signal_connect (bus, "message", G_CALLBACK (on_message), NULL); + gst_object_unref (bus); + + window = gtk_window_new (GTK_WINDOW_TOPLEVEL); + gtk_window_set_default_size (GTK_WINDOW (window), 640, 480); + g_signal_connect (window, "delete-event", gtk_main_quit, NULL); + + scrolled_window = gtk_scrolled_window_new (NULL, NULL); + + treestore = gtk_tree_store_new (1, G_TYPE_STRING, NULL); + treeview = gtk_tree_view_new_with_model (GTK_TREE_MODEL (treestore)); + + gtk_tree_view_append_column (GTK_TREE_VIEW (treeview), + gtk_tree_view_column_new_with_attributes ("Element", + gtk_cell_renderer_text_new (), "text", 0, NULL)); + + gtk_container_add (GTK_CONTAINER (scrolled_window), treeview); + gtk_container_add (GTK_CONTAINER (window), scrolled_window); + + gst_element_set_state (pipeline, GST_STATE_PLAYING); + + gtk_main (); + + gst_element_set_state (pipeline, GST_STATE_NULL); + gst_object_unref (pipeline); + + return 0; +} |