Undefined reference to "gst_base_sink_get_last_sample"

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Undefined reference to "gst_base_sink_get_last_sample"

Ajay Garg
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
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Undefined reference to "gst_base_sink_get_last_sample"

Mathieu Duponchelle
This is missing gstreamer-base-1.0, and you shouldn't have to add -lgstapp-1.0:

gcc basic-tutorial-1.c -o basic-tutorial-1 `pkg-config --cflags --libs gstreamer-1.0 gstreamer-base-1.0`

should work better.

On 2/27/19 6:38 AM, Ajay Garg wrote:
> gcc basic-tutorial-1.c -o basic-tutorial-1 `pkg-config --cflags --libs
> gstreamer-1.0 glib-2.0` -lgstapp-1.0
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Undefined reference to "gst_base_sink_get_last_sample"

Ajay Garg
Thanks a ton Mathieu, that worked !!

Thanks and Regards,
Ajay

On Wed, Feb 27, 2019 at 2:11 PM Mathieu Duponchelle
<[hidden email]> wrote:

>
> This is missing gstreamer-base-1.0, and you shouldn't have to add -lgstapp-1.0:
>
> gcc basic-tutorial-1.c -o basic-tutorial-1 `pkg-config --cflags --libs gstreamer-1.0 gstreamer-base-1.0`
>
> should work better.
>
> On 2/27/19 6:38 AM, Ajay Garg wrote:
> > gcc basic-tutorial-1.c -o basic-tutorial-1 `pkg-config --cflags --libs
> > gstreamer-1.0 glib-2.0` -lgstapp-1.0
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel