gstreamer sample documentation code not running

2019-08-17 19:09发布

问题:

Trying to compile and run a sample appsrc code after having successfully executed several tutorials. This is a documentation code, supposed it to run but ...

The command used to compile

gcc appGuideAppSrc.c -o appGuide `pkg-config --cflags --libs gstreamer-0.10 gstreamer-app-0.10`  

Got the following error after

appGuideAppSrc.c: In function ‘cb_need_data’:  
appGuideAppSrc.c:14:8: warning: assignment makes pointer from integer without a cast [enabled by default]  
appGuideAppSrc.c:18:25: error: lvalue required as left operand of assignment  

Ok, the warning is fine but the line where it throws error is which seems to be ok

   GST_BUFFER_PTS (buffer) = timestamp;

Based on answer below from @Michal, changed it to TIMESTAMP and got the following error

(appGuide:11043): GLib-GObject-CRITICAL **: g_object_set: assertion `G_IS_OBJECT (object)' failed

(appGuide:11043): GStreamer-CRITICAL **: gst_bin_add_many: assertion `GST_IS_ELEMENT (element_1)' failed  

(appGuide:11043): GStreamer-CRITICAL **: gst_element_link_many: assertion `GST_IS_ELEMENT (element_1)' failed  

(appGuide:11043): GLib-GObject-CRITICAL **: g_object_set: assertion `G_IS_OBJECT (object)' failed  

(appGuide:11043): GLib-GObject-WARNING **: invalid (NULL) pointer instance  

(appGuide:11043): GLib-GObject-CRITICAL **: g_signal_connect_data: assertion  `G_TYPE_CHECK_INSTANCE (instance)' failed  

Any inputs ?

References:
The whole appsrc sample code

回答1:

It appears that you're trying to compile a gstreamer-1.0 example with an older version of gstreamer: 0.10.

GST_BUFFER_PTS and GST_BUFFER_DTS were introduced in gstreamer-0.11 and replaced GST_BUFFER_TIMESTAMP available up to gstreamer-0.10.

Either use a newer gstreamer version or change GST_BUFFER_PTS to GST_BUFFER_TIMESTAMP.