[gst-devel] Help on souphttpsrc

snvd1 lcai at yahoo-inc.com
Tue Jun 16 01:39:52 CEST 2009

Hi ,

I'm creating a video player that can stream video from the internet, and
performs seeking on the stream. Somebody indicates souphttpsrc is the
solution but it doesn't work for me, my code looks like the beloow, when I
call  gst_element_seek_simple(pipeline, GST_FORMAT_TIME,
GST_SEEK_FLAG_FLUSH, 5*GST_SECOND), it always fails, please please help.

Thanks so much,

   pipeline   = gst_pipeline_new("pipeline");
   src = gst_element_factory_make ("souphttpsrc", "mysrc");
   g_object_set(src, "location", "http://", NULL);
    g_object_set (src, "automatic-redirect", TRUE, NULL);

       queue       = gst_element_factory_make("queue", "vqueue");
       flt         = gst_element_factory_make("capsfilter", "vfilter");
       conv        = gst_element_factory_make("ffmpegcolorspace", "vconv");
       scale       = gst_element_factory_make("videoscale", "vscale");
       vsink       = gst_element_factory_make("xvimagesink", "vsink");

   decodebin  = gst_element_factory_make("decodebin", "decoder");
   g_signal_connect(decodebin, "new-decoded-pad",
G_CALLBACK(new_decoded_pad_cb), NULL);

       gst_bin_add_many(GST_BIN(pipeline), src, decodebin, queue, scale,
conv, flt, vsink, NULL);

   gst_element_link(src, decodebin);
   gst_element_link_many(queue, scale, conv, flt, vsink, NULL);

   gst_element_set_state(pipeline, GST_STATE_PLAYING);
   g_timeout_add (1000, (GSourceFunc) cb_print_position, pipeline);


   /* cleanup */
   gst_element_set_state(pipeline, GST_STATE_NULL);

static void
new_decoded_pad_cb(GstElement *decoder, GstPad     *new_pad,
                  gboolean    last,  gpointer    user_data)
   GstCaps *caps;
   gchar   *str;

   caps = gst_pad_get_caps(new_pad);
   str = gst_caps_to_string(caps);

   /* video stream */
   if (g_str_has_prefix(str, "video/")) {
       GstPad             *videopad;
       GstCaps            *filtercaps;
       //videopad = gst_element_get_pad(queue, "sink");
       GstElement *vbin = gst_bin_get_by_name(GST_BIN(pipeline),"vqueue");
       videopad = gst_element_get_pad (vbin, "sink");
       gst_pad_link(new_pad, videopad);

View this message in context: http://www.nabble.com/Help-on-souphttpsrc-tp24042332p24042332.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.

More information about the gstreamer-devel mailing list