Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <gst/gst.h>
- static GstPad *audiosrc_blockpad;
- static GstElement *videosrc, *videosink, *pipeline, *audiosrc, *audiosink;
- static GstPadProbeReturn pad_probe_cb (GstPad * pad, GstPadProbeInfo * info, gpointer user_data){
- /* remove audio */
- gst_element_set_state(audiosink, GST_STATE_NULL);
- gst_bin_remove(GST_BIN(pipeline), audiosink);
- return GST_PAD_PROBE_OK;
- }
- static gboolean timeout_cb (gpointer user_data)
- {
- gst_pad_add_probe (audiosrc_blockpad, GST_PAD_PROBE_TYPE_BLOCK_DOWNSTREAM, pad_probe_cb, user_data, NULL);
- return FALSE;
- }
- int main (int argc, char **argv){
- GMainLoop *loop;
- /* init GStreamer */
- gst_init (&argc, &argv);
- loop = g_main_loop_new (NULL, FALSE);
- videosrc = gst_element_factory_make("videotestsrc", NULL);
- videosink = gst_element_factory_make("ximagesink", NULL);
- audiosrc = gst_element_factory_make("audiotestsrc", NULL);
- audiosink = gst_element_factory_make("osxaudiosink", NULL);
- audiosrc_blockpad = gst_element_get_static_pad(audiosrc, "src");
- pipeline = gst_pipeline_new("pipeline");
- gst_bin_add_many(GST_BIN(pipeline), audiosink, audiosrc, videosrc, videosink, NULL);
- gst_element_link_many(videosrc, videosink, NULL);
- gst_element_link_many(audiosrc, audiosink, NULL);
- gst_element_set_state(pipeline, GST_STATE_PLAYING);
- g_timeout_add_seconds (5, timeout_cb, loop);
- g_main_loop_run (loop);
- gst_element_set_state (pipeline, GST_STATE_NULL);
- gst_object_unref (pipeline);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement