简体   繁体   中英

Porting Gstreamer SDK Tutorials (gstreamer 0.1) to gstreamer 1.0

Has anybody tried to port Gstreamer SDK Tutorials available in http://docs.gstreamer.com/display/GstSDK/Tutorials to gstreamer 1.0?

I tried to port basic-tutorial-8.c from GstSDK to gstreamer 1.0. The final result does not work and at run-time exits with an error.

Here is what I did so far. My main source of help was the following page: http://gstreamer.freedesktop.org/data/doc/gstreamer/head/manual/html/chapter-porting-1.0.html#section-porting-objects-1.0

  1. Replaced audio/x-raw-int with audio/x-raw

  2. Replaced data.app_sink, "new-buffer" with data.app_sink, "new-sample"

  3. Replaced

     tee_src_pad_template = gst_element_class_get_pad_template (GST_ELEMENT_GET_CLASS (data.tee), "src%d"); 

    with

     tee_src_pad_template = gst_element_class_get_pad_template( GST_ELEMENT_GET_CLASS( data.tee ), "src_%u" ); 
  4. Replaced

     raw = (gint16 *)GST_BUFFER_DATA (buffer); 

with

GstMapInfo stGstMapInfo1;
gst_buffer_map( buffer, &stGstMapInfo1, (GstMapFlags)( GST_MAP_READ | GST_MAP_WRITE ) );
raw = (gint16 *)stGstMapInfo1.data;

. . .

/* Free the buffer now that we are done with it */
gst_buffer_unmap( buffer, &stGstMapInfo1 );
  • 5- Replaced "ffmpegcolorspace" with "videoconvert"

After the above changes I can build and run the program, but it gives the following error after a few moments: Error received from element audio_source: Internal data flow error. Debugging information: gstbasesrc.c(2865): gst_base_src_loop (): /GstPipeline:test-pipeline/GstAppSrc:audio_source: streaming task paused, reason not-negotiated (-4)

I think I have to work more on new_buffer and push_data functions of this tutorial.

Thank you in advance for your help.

The SDK tutorials are already ported here (by one of the GStreamer developers):

http://cgit.freedesktop.org/~slomo/gst-sdk-tutorials/

It is hard to guess without looking at your final code. But the error is coming from appsrc and is a 'not-negotiated'. One major change from 0.10 to 1.0 is that buffers have no caps anymore.

In 0.10 when you send a GstBuffer to appsrc it would carry a GstCaps and that would be set and negotiated when the first buffer was pushed. In 1.0 you should explicitly set a caps to appsrc before pushing buffers to it.

Additionally, audio/x-raw-int isn't exactly equivalent to audio/x-raw as audio/x-raw can also mean float represented audio. You might want to check http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-gstaudio.html#GstAudioFormat to see if you want to set a more strict audio caps.

And another thing, a GstSample( http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstreamer-GstSample.html ) is a small object that contains a GstBuffer and a GstCaps, might be useful to double check that you are using it correctly.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM