简体   繁体   English

将Gstreamer SDK教程(gstreamer 0.1)移植到gstreamer 1.0

[英]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? 有没有人试图将http://docs.gstreamer.com/display/GstSDK/Tutorials中的 Gstreamer SDK教程移植到gstreamer 1.0?

I tried to port basic-tutorial-8.c from GstSDK to gstreamer 1.0. 我试图将Basic-tutorial-8.c从GstSDK移植到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 我的主要帮助来源如下: 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 用audio / x-raw替换了audio / x-raw-int

  2. Replaced data.app_sink, "new-buffer" with data.app_sink, "new-sample" 用data.app_sink替换了data.app_sink,“new-buffer”,“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" 5-用“videoconvert”替换“ffmpegcolorspace”

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. 在上述更改之后,我可以构建并运行该程序,但它会在一段时间后出现以下错误:从元素audio_source收到错误:内部数据流错误。 Debugging information: gstbasesrc.c(2865): gst_base_src_loop (): /GstPipeline:test-pipeline/GstAppSrc:audio_source: streaming task paused, reason not-negotiated (-4) 调试信息:gstbasesrc.c(2865):gst_base_src_loop():/ GstPipeline:test-pipeline / GstAppSrc:audio_source:流任务暂停,原因未协商(-4)

I think I have to work more on new_buffer and push_data functions of this tutorial. 我想我必须更多地学习本教程的new_buffer和push_data函数。

Thank you in advance for your help. 预先感谢您的帮助。

The SDK tutorials are already ported here (by one of the GStreamer developers): SDK教程已经在这里移植(由GStreamer开发人员之一):

http://cgit.freedesktop.org/~slomo/gst-sdk-tutorials/ 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'. 但错误来自appsrc并且是“未经协商的”。 One major change from 0.10 to 1.0 is that buffers have no caps anymore. 从0.10到1.0的一个主要变化是缓冲区不再具有上限。

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. 在0.10中,当您向appsrc发送GstBuffer时,它将携带GstCaps,并且在推送第一个缓冲区时将设置并协商。 In 1.0 you should explicitly set a caps to appsrc before pushing buffers to it. 在1.0中,你应该在向缓冲区推送缓冲区之前明确设置一个上限。

Additionally, audio/x-raw-int isn't exactly equivalent to audio/x-raw as audio/x-raw can also mean float represented audio. 另外,audio / x-raw-int并不完全等同于audio / x-raw,因为audio / x-raw也可以表示浮动表示的音频。 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. 您可能需要查看http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-gstaudio.html#GstAudioFormat ,看看你是否想要设置更严格的音频上限。

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. 另外,GstSample( http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstreamer-GstSample.html )是一个包含GstBuffer和GstCaps的小对象,可能很有用仔细检查你是否正确使用它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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