[gst-devel] GStreamer (HTTP Stream doesn't play)

Alexander Saal alex.saal at gmx.de
Fri Aug 28 15:44:25 CEST 2009


Hi guys,

first thing, thanks for this greate multimedia framework. :)

I have a problem: 
I can't play a URL (URI). I use playbin and decodebin.

The technical description:

I initialize first the gstreamer with gst_init( &argc, &argv ). It works 
fine. 
After this i create a new pipeline with function gstt_pipeline_new( "name" 
);
All ok. Now i create an output binary with convert, resample, volume and 
sink elements. Thats fine. So i add bin, link and add pad to this.

    GstElement *outputConvert   = gst_element_factory_make 
("audioconvert", "audioconvert" );
    GstElement *outputResample  = gst_element_factory_make 
("audioresample", "audioresample" );
    GstElement *outputVolume    = gst_element_factory_make ("volume", 
"volume" );
    GstElement *outputSink      = PSGstHelper::audioSink(); // 
gives me the correct audio from systemx

    gst_bin_add_many( GST_BIN( m_gstBinary[ OUTPUT ] ), outputConvert, 
outputResample, outputVolume, outputSink, NULL );
    gst_element_link_many( outputConvert, outputResample, outputVolume, 
outputSink, NULL );

    GstPad *outputPad = gst_element_get_static_pad( outputConvert, 
"sink" );
    gst_element_add_pad( m_gstBinary[ OUTPUT ], gst_ghost_pad_new( 
"sink", outputPad ) );
    gst_object_unref( outputPad );
    gst_object_ref( m_gstBinary[ OUTPUT ] );
    
After creating this binary, i create a new binary for "filesrc"
      
    GstElement *fileSource    = gst_element_factory_make( "filesrc", 
"filesrc" );
    GstElement *fileDecoder   = gst_element_factory_make( "decodebin", 
"decodebin" );
    GstElement *fileIdentity  = gst_element_factory_make( "identity", 
"identity" );

    if( fileSource && fileDecoder && fileIdentity) {
      gst_bin_add_many( GST_BIN( m_gstBinary[ FILE ] ), fileSource, 
fileDecoder, fileIdentity, NULL );
      gst_element_link_many( fileSource, fileDecoder, NULL );

      g_signal_connect( G_OBJECT(fileDecoder), "new-decoded-pad", 
G_CALLBACK(gstPadLink), fileIdentity );

      GstPad * pad = gst_element_get_static_pad (fileIdentity, "src");
      gst_element_add_pad( m_gstBinary[ FILE ], 
gst_ghost_pad_new("src", pad) );
      gst_object_unref(pad);

      gst_object_ref( m_gstBinary[ FILE ] );
      //g_timeout_add( 200, (GSourceFunc)gstQueryTimePosition, 
fileSource );
    }

After creating this binary, i create a new binary for "playbin"

    GstElement *httpSource    = gst_element_factory_make( "playbin", 
"playbin" );
    GstElement *httpDecoder   = gst_element_factory_make( "decodebin", 
"decodebin" );
    GstElement *httpIdentity  = gst_element_factory_make( "identity", 
"identity" );

    if( httpSource && httpDecoder && httpIdentity ) {
      gst_bin_add_many( GST_BIN( m_gstBinary[ HTTP ] ), httpSource, 
httpDecoder, httpIdentity, NULL );
      gst_element_link_many( httpSource, httpDecoder, httpIdentity, 
NULL );

      g_signal_connect( G_OBJECT(httpDecoder), "new-decoded-pad", 
G_CALLBACK(gstPadLink), httpIdentity );

      GstPad *httpPad = gst_element_get_static_pad( httpIdentity, 
"src" );
      gst_element_add_pad( m_gstBinary[ HTTP ], gst_ghost_pad_new( 
"src", httpPad ) );
      gst_object_unref( httpPad );

      gst_object_ref( m_gstBinary[ HTTP ] );
      g_timeout_add( 200, (GSourceFunc)gstQueryTimePosition, 
httpSource );
    }
 
At end i set the state to ready:

  gst_element_set_state( m_gstPipeline, GST_STATE_READY );
  gst_element_get_state( m_gstPipeline, NULL, NULL, GST_CLOCK_TIME_NONE );

Everything fine, but my problem, if i play with m_gstBinary[ FILE ] works 
ok, but if i play with m_gstBinary[ HTTP ] is not working.
My play function sets the state to GST_STATE_PLAYING on m_gstPipeline but i 
get GST_STATE_CHANGE_ASYNC every time.
Before I play a source I change the m_gstPipeline to the correct 
m_gstBinary but if it is playing I set the state to GST_STATE_NULL:

  m_gstPlayElement = m_gstBinary[ _binaries ];
  gst_bin_add_many( GST_BIN(m_gstPipeline), m_gstPlayElement, m_gstBinary[ 
OUTPUT ], NULL);
  gst_element_link_many( m_gstPlayElement, m_gstBinary[ OUTPUT ], NULL);

  GstStateChangeReturn ret = gst_element_set_state( m_gstPipeline, 
GST_STATE_READY );
  ret = gst_element_get_state( m_gstPipeline, NULL, NULL, 
GST_CLOCK_TIME_NONE );
  
Of course I catch the events from m_gstPipeline such as 
GST_MESSAGE_BUFFERING ... GST_MESSAGE_BUFFERING and so on.

But I can't play the stream!

Regards
ChMaster    
-- 
GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20090828/b9868a6c/attachment.htm>


More information about the gstreamer-devel mailing list