Question regarding gst_parse_launch function

philippe renon philippe_renon at yahoo.fr
Wed Nov 29 07:42:17 UTC 2017


The -e option is valid when using gst-launch from the command line.Remove it from your pipeline as it is causing the syntax error.
 

    Le Mercredi 29 novembre 2017 2h08, qjqj <quanjie at live.com> a écrit :
 

 Hi,

I tried both with -e and without -e, the error I got was this:

[gstreamer] initialized gstreamer, version 1.8.3.0
[gstreamer] gstreamer decoder failed to create pipeline
[gstreamer]    (syntax error)
[gstreamer] failed to init gstCamera

gst-camera:  failed to initialize video device

Which is from parser, and here is my source code:

bool gstCamera::buildLaunchStr()
{
    std::ostringstream ss;
    
    //open ip camera
    ss << " udpsrc port=15004 !";
    ss << " application/x-rtp,encoding-name=H264,payload=96 ! rtph264depay !
h264parse !"; 
    ss << " queue ! avdec_h264 ! xvimagesink sync=false async=false -e";
    
    mLaunchStr = ss.str();

    printf(LOG_GSTREAMER "gstreamer decoder pipeline string:\n");
    printf("%s\n", mLaunchStr.c_str());
    return true;
}

bool gstCamera::init()
{
    GError* err = NULL;

    // build pipeline string
    if( !buildLaunchStr() )
    {
        printf(LOG_GSTREAMER "gstreamer decoder failed to build pipeline
string\n");
        return false;
    }

    // launch pipeline
    mPipeline = gst_parse_launch(mLaunchStr.c_str(), &err);

    if( err != NULL )
    {
        printf(LOG_GSTREAMER "gstreamer decoder failed to create pipeline\n");
        printf(LOG_GSTREAMER "  (%s)\n", err->message);
        g_error_free(err);
        return false;
    }

    // get the appsrc
    GstElement* appsinkElement = gst_bin_get_by_name(GST_BIN(pipeline),
"mysink");
    GstAppSink* appsink = GST_APP_SINK(appsinkElement);

    if( !appsinkElement || !appsink)
    {
        printf(LOG_GSTREAMER "gstreamer failed to retrieve AppSink element from
pipeline\n");
        return false;
    }
    
    mAppSink = appsink;
    
    // setup callbacks
    GstAppSinkCallbacks cb;
    memset(&cb, 0, sizeof(GstAppSinkCallbacks));
    
    cb.eos        = onEOS;
    cb.new_preroll = onPreroll;
    cb.new_sample  = onBuffer;
    
    gst_app_sink_set_callbacks(mAppSink, &cb, (void*)this, NULL);
    
    return true;
}



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
gstreamer-devel at lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel


   
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20171129/8a8ab981/attachment.html>


More information about the gstreamer-devel mailing list