GSTREAMER-将命令行转换为C代码

GSTREAMER-将命令行转换为C代码,stream,video-streaming,converter,gstreamer,pipeline,Stream,Video Streaming,Converter,Gstreamer,Pipeline,我有以下工作正常的管道: gst-launch-1.0 -v tcpclientsrc host=192.168.1.132 port=5000 ! gdpdepay ! rtph264depay ! avdec_h264 ! videoconvert ! autovideosink 我想写一个C程序来做同样的事情 我将前面的管道转换为以下代码,但视频没有启动(帮助我) //等待错误或EOS bus = gst_element_get_bus (pipeline); msg

我有以下工作正常的管道:

gst-launch-1.0 -v tcpclientsrc host=192.168.1.132 port=5000  ! gdpdepay !  rtph264depay ! avdec_h264 ! videoconvert ! autovideosink
我想写一个C程序来做同样的事情

我将前面的管道转换为以下代码,但视频没有启动(帮助我)

//等待错误或EOS

    bus = gst_element_get_bus (pipeline);
    msg = gst_bus_timed_pop_filtered (bus, GST_CLOCK_TIME_NONE, GST_MESSAGE_ERROR | GST_MESSAGE_EOS);

    // Parse message
    if (msg != NULL) {
        GError *err;
        gchar *debug_info;

        switch (GST_MESSAGE_TYPE (msg)) {
            case GST_MESSAGE_ERROR:
                gst_message_parse_error (msg, &err, &debug_info);
                g_printerr ("Error received from element %s: %s\n", GST_OBJECT_NAME (msg->src), err->message);
                g_printerr ("Debugging information: %s\n", debug_info ? debug_info : "none");
                g_clear_error (&err);
                g_free (debug_info);
                break;
            case GST_MESSAGE_EOS:
                g_print ("End-Of-Stream reached.\n");
                break;
            default:
                // We should not reach here because we only asked for ERRORs and EOS
                g_printerr ("Unexpected message received.\n");
                break;
            }
        gst_message_unref (msg);
    }
//免费资源

    gst_object_unref (bus);
    gst_element_set_state (pipeline, GST_STATE_NULL);
    gst_object_unref (pipeline);
    return 0;
}

我看不到任何明显的东西。您是否尝试运行GST_DEBUG=“*:2”。/myapp以查看是否存在一些警告

gdppay/gdpdepay当前未移植到ios 1.2库中。我已经读到它应该包含在1.3-1.4版本中。我猜这就是问题所在

    bus = gst_element_get_bus (pipeline);
    msg = gst_bus_timed_pop_filtered (bus, GST_CLOCK_TIME_NONE, GST_MESSAGE_ERROR | GST_MESSAGE_EOS);

    // Parse message
    if (msg != NULL) {
        GError *err;
        gchar *debug_info;

        switch (GST_MESSAGE_TYPE (msg)) {
            case GST_MESSAGE_ERROR:
                gst_message_parse_error (msg, &err, &debug_info);
                g_printerr ("Error received from element %s: %s\n", GST_OBJECT_NAME (msg->src), err->message);
                g_printerr ("Debugging information: %s\n", debug_info ? debug_info : "none");
                g_clear_error (&err);
                g_free (debug_info);
                break;
            case GST_MESSAGE_EOS:
                g_print ("End-Of-Stream reached.\n");
                break;
            default:
                // We should not reach here because we only asked for ERRORs and EOS
                g_printerr ("Unexpected message received.\n");
                break;
            }
        gst_message_unref (msg);
    }
    gst_object_unref (bus);
    gst_element_set_state (pipeline, GST_STATE_NULL);
    gst_object_unref (pipeline);
    return 0;
}