Undefined reference to "gst_base_sink_get_last_sample"
Ajay Garg
ajaygargnsit at gmail.com
Wed Feb 27 05:38:10 UTC 2019
Hi All.
It definitely seems I am missing something basic, will be grateful for help.
== Code ==
###############################################################
#include <unistd.h>
#include <stdio.h>
#include <gst/gst.h>
#include <gst/base/gstbasesink.h>
#define SINK "xvimagesink"
static GstElement *sink = NULL;
void *start_playing_video(void *arg)
{
GstElement *pipeline = NULL;
GstBus *bus;
GstMessage *msg;
/* Build the pipeline */
pipeline = gst_parse_launch ("v4l2src ! " SINK, NULL);
sink = gst_element_factory_make ("fakesrc", SINK);
if(sink != NULL)
{
printf("Sink element created successfully.\n");
}
/* Start playing */
gst_element_set_state (pipeline, GST_STATE_PLAYING);
/* Wait until error or EOS */
bus = gst_element_get_bus (pipeline);
msg = gst_bus_timed_pop_filtered (bus, GST_CLOCK_TIME_NONE,
GST_MESSAGE_ERROR | GST_MESSAGE_EOS);
/* Free resources */
if (msg != NULL)
{
gst_message_unref (msg);
}
gst_object_unref (bus);
gst_element_set_state (pipeline, GST_STATE_NULL);
gst_object_unref (pipeline);
}
int main(int argc, char *argv[])
{
pthread_t tid;
/* Initialize GStreamer */
gst_init (&argc, &argv);
pthread_create(&tid, NULL, start_playing_video, NULL);
while(1)
{
sleep(1);
if(sink != NULL)
{
if(gst_base_sink_get_last_sample((GstBaseSink*) sink) != NULL)
{
printf("Sample collected successfully.\n");
}
}
}
return 0;
}
###############################################################
== Compilation-Command ==
###############################################################
gcc basic-tutorial-1.c -o basic-tutorial-1 `pkg-config --cflags --libs
gstreamer-1.0 glib-2.0` -lgstapp-1.0
###############################################################
== Error ==
###############################################################
/tmp/ccdXyB2j.o: In function `main':
basic-tutorial-1.c:(.text+0x157): undefined reference to
`gst_base_sink_get_last_sample'
collect2: error: ld returned 1 exit status
###############################################################
Will be grateful for pointers from experts !!
Thanks and Regards,
Ajay
More information about the gstreamer-devel
mailing list