如何通过gstreamer rtsp客户端向服务器发送请求?

时间:2015-11-06 13:29:20

标签: android gstreamer rtsp-client

我已经搜索了关于Gstreamer rtsp客户端的问题很长一段时间了。但没有运气。

现在我可以通过Gstreamer(gstreamer-1.0-android-armv7-1.6.0)从Android设备上的服务器显示实时流或录制的流,然后我想发送PLAY / PAUSE /来改变服务器状态记录流。

我的问题:在使用gst-rtsp-stream时,是否有一种获取和访问管道的简单方法?有人可以提供一个例子吗?

11月10日更新:

GstBus *bus;
CustomData *data = (CustomData *)userdata;
GSource *timeout_source;
GSource *bus_source;
GError *error = NULL;
guint flags;

/* Create our own GLib Main Context and make it the default one */
data->context = g_main_context_new ();
g_main_context_push_thread_default(data->context);

/* Build pipeline */
data->pipeline = gst_parse_launch("playbin", &error);
if (error) {
    gchar *message = g_strdup_printf("Unable to build pipeline: %s", error->message);
    g_clear_error (&error);
    set_ui_message(message, data);
    g_free (message);
    return NULL;
}
/* Set latency to 0 ns */
gst_pipeline_set_latency(data->pipeline, 0);

/* Disable subtitles */
g_object_get (data->pipeline, "flags", &flags, NULL);
flags &= ~GST_PLAY_FLAG_TEXT;
g_object_set (data->pipeline, "flags", flags, NULL);

/* Set the pipeline to READY, so it can already accept a window handle, if we have one */
data->target_state = GST_STATE_READY;
gst_element_set_state(data->pipeline, GST_STATE_READY);

/* Instruct the bus to emit signals for each received message, and connect to the interesting signals */
bus = gst_element_get_bus (data->pipeline);

bus_source = gst_bus_create_watch (bus);

g_source_set_callback (bus_source, (GSourceFunc) gst_bus_async_signal_func, NULL, NULL);

g_source_attach (bus_source, data->context);

g_source_unref (bus_source);

g_signal_connect (G_OBJECT (bus), "message::error", (GCallback)error_cb, data);

g_signal_connect (G_OBJECT (bus), "message::state-changed", (GCallback)state_changed_cb, data);

gst_object_unref (bus);

0 个答案:

没有答案