diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/dynparams/filter.c | 2 | ||||
-rw-r--r-- | examples/seeking/cdparanoia.c | 23 | ||||
-rw-r--r-- | examples/seeking/seek.c | 93 | ||||
-rw-r--r-- | examples/seeking/spider_seek.c | 10 | ||||
-rw-r--r-- | examples/seeking/vorbisfile.c | 36 |
5 files changed, 81 insertions, 83 deletions
diff --git a/examples/dynparams/filter.c b/examples/dynparams/filter.c index 39240500..7554101f 100644 --- a/examples/dynparams/filter.c +++ b/examples/dynparams/filter.c @@ -383,7 +383,7 @@ cb_parse_clicked (GtkButton *button, gpointer *user_data) gst_element_add_pad (fd->input, src_pad); gst_element_add_pad (fd->output, sink_pad); - gst_element_connect_many (fd->input, fd->filter, fd->output, NULL); + gst_element_link_many (fd->input, fd->filter, fd->output, NULL); if (fd->pipe_string) g_free (fd->pipe_string); fd->pipe_string = g_strdup_printf ("%s ! %s ! %s", fd->input_pipe, diff --git a/examples/seeking/cdparanoia.c b/examples/seeking/cdparanoia.c index db7223ff..f0e1fe1e 100644 --- a/examples/seeking/cdparanoia.c +++ b/examples/seeking/cdparanoia.c @@ -112,15 +112,16 @@ get_track_info (GstElement *cdparanoia) } if (res) { - /* for the first track (i==0) we wait until we have the + /* for the first track (i==0) we wait until we have the * time of the next track */ if (i > 0) { gint64 length = time - time_count; - g_print ("track %d: %lld:%02lld -> %lld:%02lld, length: %lld:%02lld\n", i-1, - time_count/60, time_count%60, - time/60, time%60, - length/60, length%60); + g_print ("track %d: %lld:%02lld -> %lld:%02lld, length: %lld:%02lld\n", + i-1, + time_count / 60, time_count % 60, + time / 60, time % 60, + length / 60, length % 60); } } else { @@ -142,7 +143,7 @@ main (int argc, char **argv) GstEvent *event; gint count; gboolean res; - + gst_init (&argc, &argv); pipeline = gst_pipeline_new ("pipeline"); @@ -157,11 +158,11 @@ main (int argc, char **argv) gst_bin_add (GST_BIN (pipeline), cdparanoia); gst_bin_add (GST_BIN (pipeline), osssink); - gst_element_connect_pads (cdparanoia, "src", osssink, "sink"); + gst_element_link_pads (cdparanoia, "src", osssink, "sink"); - g_signal_connect (G_OBJECT (pipeline), "deep_notify", + g_signal_connect (G_OBJECT (pipeline), "deep_notify", G_CALLBACK (gst_element_default_deep_notify), NULL); - + gst_element_set_state (pipeline, GST_STATE_PAUSED); /* now we go into probe mode */ @@ -177,7 +178,7 @@ main (int argc, char **argv) /* seek to track3 */ event = gst_event_new_seek (track_format | GST_SEEK_METHOD_SET | - GST_SEEK_FLAG_FLUSH, + GST_SEEK_FLAG_FLUSH, 3); res = gst_pad_send_event (pad, event); @@ -198,7 +199,7 @@ main (int argc, char **argv) /* seek to some seconds */ event = gst_event_new_segment_seek (GST_FORMAT_TIME | GST_SEEK_METHOD_SET | - GST_SEEK_FLAG_FLUSH, + GST_SEEK_FLAG_FLUSH, 25 * GST_SECOND, 29 * GST_SECOND); res = gst_pad_send_event (pad, event); if (!res) diff --git a/examples/seeking/seek.c b/examples/seeking/seek.c index b8fcad77..b9055fbe 100644 --- a/examples/seeking/seek.c +++ b/examples/seeking/seek.c @@ -28,17 +28,17 @@ typedef struct const gchar *padname; GstPad *target; GstElement *bin; -} dyn_connect; +} dyn_link; static void -dynamic_connect (GstPadTemplate *templ, GstPad *newpad, gpointer data) +dynamic_link (GstPadTemplate *templ, GstPad *newpad, gpointer data) { - dyn_connect *connect = (dyn_connect *) data; + dyn_link *connect = (dyn_link *) data; if (!strcmp (gst_pad_get_name (newpad), connect->padname)) { gst_element_set_state (pipeline, GST_STATE_PAUSED); gst_bin_add (GST_BIN (pipeline), connect->bin); - gst_pad_connect (newpad, connect->target); + gst_pad_link (newpad, connect->target); gst_element_set_state (pipeline, GST_STATE_PLAYING); seekable_pads = g_list_prepend (seekable_pads, newpad); @@ -47,16 +47,16 @@ dynamic_connect (GstPadTemplate *templ, GstPad *newpad, gpointer data) } static void -setup_dynamic_connection (GstElement *element, const gchar *padname, GstPad *target, GstElement *bin) +setup_dynamic_linkion (GstElement *element, const gchar *padname, GstPad *target, GstElement *bin) { - dyn_connect *connect; + dyn_link *connect; - connect = g_new0 (dyn_connect, 1); + connect = g_new0 (dyn_link, 1); connect->padname = g_strdup (padname); connect->target = target; connect->bin = bin; - g_signal_connect (G_OBJECT (element), "new_pad", G_CALLBACK (dynamic_connect), connect); + g_signal_connect (G_OBJECT (element), "new_pad", G_CALLBACK (dynamic_link), connect); } static GstElement* @@ -79,8 +79,8 @@ make_mod_pipeline (const gchar *location) gst_bin_add (GST_BIN (pipeline), decoder); gst_bin_add (GST_BIN (pipeline), audiosink); - gst_element_connect (src, decoder); - gst_element_connect (decoder, audiosink); + gst_element_link (src, decoder); + gst_element_link (decoder, audiosink); seekable = gst_element_get_pad (decoder, "src"); seekable_pads = g_list_prepend (seekable_pads, seekable); @@ -112,9 +112,9 @@ make_dv_pipeline (const gchar *location) gst_bin_add (GST_BIN (pipeline), audiosink); gst_bin_add (GST_BIN (pipeline), videosink); - gst_element_connect (src, decoder); - gst_element_connect (decoder, audiosink); - gst_element_connect (decoder, videosink); + gst_element_link (src, decoder); + gst_element_link (decoder, audiosink); + gst_element_link (decoder, videosink); seekable = gst_element_get_pad (decoder, "video"); seekable_pads = g_list_prepend (seekable_pads, seekable); @@ -147,8 +147,8 @@ make_wav_pipeline (const gchar *location) gst_bin_add (GST_BIN (pipeline), decoder); gst_bin_add (GST_BIN (pipeline), audiosink); - gst_element_connect (src, decoder); - gst_element_connect (decoder, audiosink); + gst_element_link (src, decoder); + gst_element_link (decoder, audiosink); seekable = gst_element_get_pad (decoder, "src"); seekable_pads = g_list_prepend (seekable_pads, seekable); @@ -178,8 +178,8 @@ make_flac_pipeline (const gchar *location) gst_bin_add (GST_BIN (pipeline), decoder); gst_bin_add (GST_BIN (pipeline), audiosink); - gst_element_connect (src, decoder); - gst_element_connect (decoder, audiosink); + gst_element_link (src, decoder); + gst_element_link (decoder, audiosink); seekable = gst_element_get_pad (decoder, "src"); seekable_pads = g_list_prepend (seekable_pads, seekable); @@ -209,8 +209,8 @@ make_sid_pipeline (const gchar *location) gst_bin_add (GST_BIN (pipeline), decoder); gst_bin_add (GST_BIN (pipeline), audiosink); - gst_element_connect (src, decoder); - gst_element_connect (decoder, audiosink); + gst_element_link (src, decoder); + gst_element_link (decoder, audiosink); seekable = gst_element_get_pad (decoder, "src"); seekable_pads = g_list_prepend (seekable_pads, seekable); @@ -241,8 +241,8 @@ make_parse_pipeline (const gchar *location) gst_bin_add (GST_BIN (pipeline), parser); gst_bin_add (GST_BIN (pipeline), fakesink); - gst_element_connect (src, parser); - gst_element_connect (parser, fakesink); + gst_element_link (src, parser); + gst_element_link (parser, fakesink); seekable = gst_element_get_pad (parser, "src"); seekable_pads = g_list_prepend (seekable_pads, seekable); @@ -272,8 +272,8 @@ make_vorbis_pipeline (const gchar *location) gst_bin_add (GST_BIN (pipeline), decoder); gst_bin_add (GST_BIN (pipeline), audiosink); - gst_element_connect (src, decoder); - gst_element_connect (decoder, audiosink); + gst_element_link (src, decoder); + gst_element_link (decoder, audiosink); seekable = gst_element_get_pad (decoder, "src"); seekable_pads = g_list_prepend (seekable_pads, seekable); @@ -310,9 +310,9 @@ make_mp3_pipeline (const gchar *location) gst_bin_add (GST_BIN (audio_thread), osssink); gst_bin_add (GST_BIN (pipeline), audio_thread); - gst_element_connect (src, decoder); - gst_element_connect (decoder, queue); - gst_element_connect (queue, osssink); + gst_element_link (src, decoder); + gst_element_link (decoder, queue); + gst_element_link (queue, osssink); seekable = gst_element_get_pad (queue, "src"); seekable_pads = g_list_prepend (seekable_pads, seekable); @@ -340,7 +340,7 @@ make_avi_pipeline (const gchar *location) gst_bin_add (GST_BIN (pipeline), src); gst_bin_add (GST_BIN (pipeline), demux); - gst_element_connect (src, demux); + gst_element_link (src, demux); audio_bin = gst_bin_new ("a_decoder_bin"); a_decoder = gst_element_factory_make_or_warn ("mad", "a_dec"); @@ -348,15 +348,15 @@ make_avi_pipeline (const gchar *location) audiosink = gst_element_factory_make_or_warn ("osssink", "a_sink"); //g_object_set (G_OBJECT (audiosink), "fragment", 0x00180008, NULL); a_queue = gst_element_factory_make_or_warn ("queue", "a_queue"); - gst_element_connect (a_decoder, a_queue); - gst_element_connect (a_queue, audiosink); + gst_element_link (a_decoder, a_queue); + gst_element_link (a_queue, audiosink); gst_bin_add (GST_BIN (audio_bin), a_decoder); gst_bin_add (GST_BIN (audio_bin), audio_thread); gst_bin_add (GST_BIN (audio_thread), a_queue); gst_bin_add (GST_BIN (audio_thread), audiosink); gst_element_set_state (audio_bin, GST_STATE_PAUSED); - setup_dynamic_connection (demux, "audio_00", gst_element_get_pad (a_decoder, "sink"), audio_bin); + setup_dynamic_linkion (demux, "audio_00", gst_element_get_pad (a_decoder, "sink"), audio_bin); seekable = gst_element_get_pad (a_queue, "src"); seekable_pads = g_list_prepend (seekable_pads, seekable); @@ -373,8 +373,8 @@ make_avi_pipeline (const gchar *location) //g_object_set (G_OBJECT (videosink), "sync", TRUE, NULL); v_queue = gst_element_factory_make_or_warn ("queue", "v_queue"); //g_object_set (G_OBJECT (v_queue), "max_level", 10, NULL); - gst_element_connect (v_decoder, v_queue); - gst_element_connect (v_queue, videosink); + gst_element_link (v_decoder, v_queue); + gst_element_link (v_queue, videosink); gst_bin_add (GST_BIN (video_bin), v_decoder); gst_bin_add (GST_BIN (video_bin), video_thread); gst_bin_add (GST_BIN (video_thread), v_queue); @@ -382,7 +382,7 @@ make_avi_pipeline (const gchar *location) gst_element_set_state (video_bin, GST_STATE_PAUSED); - setup_dynamic_connection (demux, "video_00", gst_element_get_pad (v_decoder, "sink"), video_bin); + setup_dynamic_linkion (demux, "video_00", gst_element_get_pad (v_decoder, "sink"), video_bin); seekable = gst_element_get_pad (v_queue, "src"); seekable_pads = g_list_prepend (seekable_pads, seekable); @@ -413,7 +413,7 @@ make_mpeg_pipeline (const gchar *location) gst_bin_add (GST_BIN (pipeline), src); gst_bin_add (GST_BIN (pipeline), demux); - gst_element_connect (src, demux); + gst_element_link (src, demux); audio_bin = gst_bin_new ("a_decoder_bin"); a_decoder = gst_element_factory_make_or_warn ("mad", "a_dec"); @@ -421,14 +421,14 @@ make_mpeg_pipeline (const gchar *location) a_queue = gst_element_factory_make_or_warn ("queue", "a_queue"); audiosink = gst_element_factory_make_or_warn ("osssink", "a_sink"); g_object_set (G_OBJECT (audiosink), "fragment", 0x00180008, NULL); - gst_element_connect (a_decoder, a_queue); - gst_element_connect (a_queue, audiosink); + gst_element_link (a_decoder, a_queue); + gst_element_link (a_queue, audiosink); gst_bin_add (GST_BIN (audio_bin), a_decoder); gst_bin_add (GST_BIN (audio_bin), audio_thread); gst_bin_add (GST_BIN (audio_thread), a_queue); gst_bin_add (GST_BIN (audio_thread), audiosink); - setup_dynamic_connection (demux, "audio_00", gst_element_get_pad (a_decoder, "sink"), audio_bin); + setup_dynamic_linkion (demux, "audio_00", gst_element_get_pad (a_decoder, "sink"), audio_bin); seekable = gst_element_get_pad (a_queue, "src"); seekable_pads = g_list_prepend (seekable_pads, seekable); @@ -442,13 +442,13 @@ make_mpeg_pipeline (const gchar *location) v_queue = gst_element_factory_make_or_warn ("queue", "v_queue"); v_filter = gst_element_factory_make_or_warn ("colorspace", "v_filter"); videosink = gst_element_factory_make_or_warn ("xvideosink", "v_sink"); - gst_element_connect_many (v_decoder, v_queue, v_filter, NULL); + gst_element_link_many (v_decoder, v_queue, v_filter, NULL); - gst_element_connect_pads (v_filter, "src", videosink, "sink"); + gst_element_link (v_filter, videosink); gst_bin_add_many (GST_BIN (video_bin), v_decoder, video_thread, NULL); gst_bin_add_many (GST_BIN (video_thread), v_queue, v_filter, videosink, NULL); - setup_dynamic_connection (demux, "video_00", gst_element_get_pad (v_decoder, "sink"), video_bin); + setup_dynamic_linkion (demux, "video_00", gst_element_get_pad (v_decoder, "sink"), video_bin); seekable = gst_element_get_pad (v_queue, "src"); seekable_pads = g_list_prepend (seekable_pads, seekable); @@ -479,7 +479,7 @@ make_mpegnt_pipeline (const gchar *location) gst_bin_add (GST_BIN (pipeline), src); gst_bin_add (GST_BIN (pipeline), demux); - gst_element_connect (src, demux); + gst_element_link (src, demux); audio_bin = gst_bin_new ("a_decoder_bin"); a_decoder = gst_element_factory_make_or_warn ("mad", "a_dec"); @@ -488,14 +488,14 @@ make_mpegnt_pipeline (const gchar *location) audiosink = gst_element_factory_make_or_warn ("osssink", "a_sink"); //g_object_set (G_OBJECT (audiosink), "fragment", 0x00180008, NULL); g_object_set (G_OBJECT (audiosink), "sync", FALSE, NULL); - gst_element_connect (a_decoder, a_queue); - gst_element_connect (a_queue, audiosink); + gst_element_link (a_decoder, a_queue); + gst_element_link (a_queue, audiosink); gst_bin_add (GST_BIN (audio_bin), a_decoder); gst_bin_add (GST_BIN (audio_bin), audio_thread); gst_bin_add (GST_BIN (audio_thread), a_queue); gst_bin_add (GST_BIN (audio_thread), audiosink); - setup_dynamic_connection (demux, "audio_00", gst_element_get_pad (a_decoder, "sink"), audio_bin); + setup_dynamic_linkion (demux, "audio_00", gst_element_get_pad (a_decoder, "sink"), audio_bin); seekable = gst_element_get_pad (a_queue, "src"); seekable_pads = g_list_prepend (seekable_pads, seekable); @@ -506,12 +506,11 @@ make_mpegnt_pipeline (const gchar *location) v_decoder = gst_element_factory_make_or_warn ("mpeg2dec", "v_dec"); v_filter = gst_element_factory_make_or_warn ("colorspace", "v_filter"); videosink = gst_element_factory_make_or_warn ("xvideosink", "v_sink"); - gst_element_connect_many (v_decoder, v_filter, NULL); + gst_element_link_many (v_decoder, v_filter, videosink, NULL); - gst_element_connect_pads (v_filter, "src", videosink, "sink"); gst_bin_add_many (GST_BIN (video_bin), v_decoder, v_filter, videosink, NULL); - setup_dynamic_connection (demux, "video_00", gst_element_get_pad (v_decoder, "sink"), video_bin); + setup_dynamic_linkion (demux, "video_00", gst_element_get_pad (v_decoder, "sink"), video_bin); seekable = gst_element_get_pad (v_decoder, "src"); seekable_pads = g_list_prepend (seekable_pads, seekable); diff --git a/examples/seeking/spider_seek.c b/examples/seeking/spider_seek.c index 6c88ae44..3b155cde 100644 --- a/examples/seeking/spider_seek.c +++ b/examples/seeking/spider_seek.c @@ -56,11 +56,11 @@ make_spider_pipeline (const gchar *location, gboolean thread) gst_bin_add (GST_BIN (pipeline), a_thread); gst_bin_add (GST_BIN (pipeline), v_thread); - gst_element_connect (src, decoder); - gst_element_connect (v_queue, videosink); - gst_element_connect (decoder, v_queue); - gst_element_connect (a_queue, audiosink); - gst_element_connect (decoder, a_queue); + gst_element_link (src, decoder); + gst_element_link (v_queue, videosink); + gst_element_link (decoder, v_queue); + gst_element_link (a_queue, audiosink); + gst_element_link (decoder, a_queue); seekable_elements = g_list_prepend (seekable_elements, videosink); seekable_elements = g_list_prepend (seekable_elements, audiosink); diff --git a/examples/seeking/vorbisfile.c b/examples/seeking/vorbisfile.c index 304c1851..9bc4adfc 100644 --- a/examples/seeking/vorbisfile.c +++ b/examples/seeking/vorbisfile.c @@ -55,14 +55,12 @@ print_caps (GstCaps *caps) default: break; } - walk = g_list_next (walk); } } else { g_print (" unkown caps type\n"); } - } static void @@ -92,7 +90,7 @@ static void print_lbs_info (struct probe_context *context, gint stream) { const GstFormat *formats; - + /* FIXME: need a better name here */ g_print (" stream info:\n"); @@ -114,10 +112,10 @@ print_lbs_info (struct probe_context *context, gint stream) definition = gst_format_get_details (format); /* get start and end position of this stream */ - res = gst_pad_convert (context->pad, + res = gst_pad_convert (context->pad, context->ls_format, stream, &format, &value_start); - res &= gst_pad_convert (context->pad, + res &= gst_pad_convert (context->pad, context->ls_format, stream + 1, &format, &value_end); @@ -127,7 +125,7 @@ print_lbs_info (struct probe_context *context, gint stream) if (format == GST_FORMAT_TIME) { value_end /= (GST_SECOND/100); - g_print (" %s: %lld:%02lld.%02lld\n", definition->nick, + g_print (" %s: %lld:%02lld.%02lld\n", definition->nick, value_end/6000, (value_end/100)%60, (value_end%100)); } else { @@ -148,13 +146,13 @@ deep_notify (GObject *object, GstObject *origin, GValue value = { 0, }; if (!strcmp (pspec->name, "metadata")) { - + g_value_init (&value, pspec->value_type); g_object_get_property (G_OBJECT (origin), pspec->name, &value); context->metadata = g_value_peek_pointer (&value); } else if (!strcmp (pspec->name, "streaminfo")) { - + g_value_init (&value, pspec->value_type); g_object_get_property (G_OBJECT (origin), pspec->name, &value); context->streaminfo = g_value_peek_pointer (&value); @@ -175,7 +173,7 @@ collect_logical_stream_properties (struct probe_context *context, gint stream) GstEvent *event; gboolean res; gint count; - + g_print ("info for logical stream %d:\n", stream); /* seek to stream */ @@ -196,14 +194,14 @@ collect_logical_stream_properties (struct probe_context *context, gint stream) count++; if (count > 10) break; } - + print_caps (context->metadata); print_caps (context->streaminfo); print_format (context->caps); print_lbs_info (context, stream); g_print ("\n"); - + return TRUE; } @@ -226,11 +224,11 @@ collect_stream_properties (struct probe_context *context) gint64 value; gboolean res; GstFormat format; - + format = *formats; formats++; - res = gst_pad_query (context->pad, GST_QUERY_TOTAL, + res = gst_pad_query (context->pad, GST_QUERY_TOTAL, &format, &value); definition = gst_format_get_details (format); @@ -238,7 +236,7 @@ collect_stream_properties (struct probe_context *context) if (res) { if (format == GST_FORMAT_TIME) { value /= (GST_SECOND/100); - g_print (" total %s: %lld:%02lld.%02lld\n", definition->nick, + g_print (" total %s: %lld:%02lld.%02lld\n", definition->nick, value/6000, (value/100)%60, (value%100)); } else { @@ -265,7 +263,7 @@ main (int argc, char **argv) GstFormat logical_stream_format; struct probe_context *context; gint stream; - + gst_init (&argc, &argv); if (argc < 2) { @@ -286,7 +284,7 @@ main (int argc, char **argv) gst_bin_add (GST_BIN (pipeline), filesrc); gst_bin_add (GST_BIN (pipeline), vorbisfile); - gst_element_connect_pads (filesrc, "src", vorbisfile, "sink"); + gst_element_link_pads (filesrc, "src", vorbisfile, "sink"); pad = gst_element_get_pad (vorbisfile, "src"); g_assert (pad); @@ -300,9 +298,9 @@ main (int argc, char **argv) context->pad = pad; context->ls_format = logical_stream_format; - g_signal_connect (G_OBJECT (pipeline), "deep_notify", + g_signal_connect (G_OBJECT (pipeline), "deep_notify", G_CALLBACK (deep_notify), context); - + gst_element_set_state (pipeline, GST_STATE_PLAYING); /* at this point we can inspect the stream */ @@ -314,7 +312,7 @@ main (int argc, char **argv) collect_logical_stream_properties (context, stream); stream++; } - + /* stop probe */ gst_element_set_state (pipeline, GST_STATE_NULL); |