我正在尝试创建一个从uri接收流的管道,添加一个textoverlay并创建一个新流。
当我尝试这个时:
str ="videotestsrc !"
"textoverlay text=\"It Works!!!!\" color=4 valign=top halign=right !"
"video/x-raw-yuv,width=640,height=480,framerate=10/1 ! "
"x264enc ! queue ! rtph264pay name=pay0 pt=96 !"
它完美无缺,但是当我从uri尝试时:
str = "uridecodebin uri=http://otp1.rtp.pt:80/liverepeater/smil:rtp1.smil/playlist.m3u8 !"
"textoverlay text=\"It Works!!!!\" color=4 valign=top halign=right !"
"video/x-raw-yuv,width=640,height=480,framerate=10/1 ! "
"x264enc ! queue ! rtph264pay name=pay0 pt=96 !"
它不起作用..
有人知道为什么它不起作用?
我的完整代码:
#include <gst/rtsp-server/rtsp-server.h>
#include <gst/gst.h>
static gboolean timeout (GstRTSPServer * server, gboolean ignored){
GstRTSPSessionPool *pool;
pool = gst_rtsp_server_get_session_pool (server);
gst_rtsp_session_pool_cleanup (pool);
g_object_unref (pool);
return TRUE;
}
int main (int argc, char *argv[]){
GMainLoop *loop;
GstRTSPServer *server;
GstRTSPMediaMapping *mapping;
GstRTSPMediaFactory *factory;
gst_init (&argc, &argv);
loop = g_main_loop_new (NULL, FALSE);
server = gst_rtsp_server_new ();
mapping = gst_rtsp_server_get_media_mapping (server);
factory = gst_rtsp_media_factory_new ();
gchar *str= "( "
"uridecodebin uri=http://otp1.rtp.pt:80/liverepeater/smil:rtp1.smil/playlist.m3u8 !"
"textoverlay text=\"It Works!!!!\" color=4 valign=top halign=right !"
"video/x-raw-yuv,width=640,height=480,framerate=10/1 ! "
"x264enc ! queue ! rtph264pay name=pay0 pt=96 !"
")";
gst_rtsp_media_factory_set_launch (factory, str);
gst_rtsp_media_mapping_add_factory (mapping, "/test", factory);
g_object_unref (mapping);
if (gst_rtsp_server_attach (server, NULL) == 0)
goto failed;
g_timeout_add_seconds (2, (GSourceFunc) timeout, server);
g_main_loop_run (loop);
return 0;
failed:
{
g_print ("failed to attach the server\n");
return -1;
}
}
此致 亚历