gstreamer-tips-picture-in-picture-compositing
http://www.oz9aec.net/index.php/gstreamer/347-more-gstreamer-tips-picture-in-picture-compositing
http://blog.sina.com.cn/s/blog_5106eff101018lsu.html
1. RTSP协议建立服务器(该代码是C,但看看我的客户端端代码,看看它如何的API是相当直截了当) 我修改了代码的URL
/* GStreamer
* Copyright (C) 2008 Wim Taymans <wim.taymans at gmail.com>
* Copyright (c) 2012 enthusiasticgeek <enthusiasticgeek@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
//Edited by: enthusiasticgeek (c) 2012 for Stack Overflow Sept 11, 2012
//###########################################################################
//Important
//###########################################################################
//On ubuntu: sudo apt-get install libgstrtspserver-0.10-0 libgstrtspserver-0.10-dev
//Play with VLC
// CodeGo.net
//video decode only: gst-launch -v rtspsrc location=" CodeGo.net ! rtph264depay ! ffdec_h264 ! autovideosink
//audio and video:
//gst-launch -v rtspsrc location=" CodeGo.net name=demux demux. ! queue ! rtph264depay ! ffdec_h264 ! ffmpegcolorspace ! autovideosink sync=false demux. ! queue ! rtppcmadepay ! alawdec ! autoaudiosink
//###########################################################################
#include <gst/gst.h>
#include <gst/rtsp-server/rtsp-server.h>
/* define this if you want the resource to only be available when using
* user/admin as the password */
#undef WITH_AUTH
/* this timeout is periodically run to clean up the expired sessions from the
* pool. This needs to be run explicitly currently but might be done
* automatically as part of the mainloop. */
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;
#ifdef WITH_AUTH
GstRTSPAuth *auth;
gchar *basic;
#endif
gst_init (&argc, &argv);
loop = g_main_loop_new (NULL, FALSE);
/* create a server instance */
server = gst_rtsp_server_new ();
gst_rtsp_server_set_service(server,"8554"); //set the port #
/* get the mapping for this server, every server has a default mapper object
* that be used to map uri mount points to media factories */
mapping = gst_rtsp_server_get_media_mapping (server);
#ifdef WITH_AUTH
/* make a new authentication manager. it can be added to control access to all
* the factories on the server or on individual factories. */
auth = gst_rtsp_auth_new ();
basic = gst_rtsp_auth_make_basic ("user", "admin");
gst_rtsp_auth_set_basic (auth, basic);
g_free (basic);
/* configure in the server */
gst_rtsp_server_set_auth (server, auth);
#endif
/* make a media factory for a test stream. The default media factory can use
* gst-launch syntax to create pipelines.
* any launch line works as long as it contains elements named pay%d. Each
* element with pay%d names will be a stream */
factory = gst_rtsp_media_factory_new ();
gst_rtsp_media_factory_set_launch (factory, "( "
"videotestsrc ! video/x-raw-yuv,width=320,height=240,framerate=10/1 ! "
"x264enc ! queue ! rtph264pay name=pay0 pt=96 ! audiotestsrc ! audio/x-raw-int,rate=8000 ! alawenc ! rtppcmapay name=pay1 pt=97 "")");
/* attach the test factory to the /test url */
gst_rtsp_media_mapping_add_factory (mapping, "/test", factory);
/* don't need the ref to the mapper anymore */
g_object_unref (mapping);
/* attach the server to the default maincontext */
if (gst_rtsp_server_attach (server, NULL) == 0)
goto failed;
/* add a timeout for the session cleanup */
g_timeout_add_seconds (2, (GSourceFunc) timeout, server);
/* start serving, this never stops */
g_main_loop_run (loop);
return 0;
/* ERRORS */
failed:
{
g_print ("failed to attach the server\n");
return -1;
}
}
Makefile文件
# Copyright (c) 2012 enthusiasticgeek
# RTSP demo for Stack Overflow
sample:
gcc -Wall -I/usr/include/gstreamer-0.10 rtsp.c -o rtsp `pkg-config --libs --cflags gstreamer-0.10 gstreamer-rtsp-0.10` -lglib-2.0 -lgstrtspserver-0.10 -lgstreamer-0.10
一旦你建立了二进制,简单来说它./rtsp然后打开另一个选项卡中的终端测试以下的pipeline。 测试解码流水线。它工作得很好!
gst-launch -v rtspsrc location=" CodeGo.net name=demux demux. ! queue ! rtph264depay ! ffdec_h264 ! ffmpegcolorspace ! autovideosink sync=false demux. ! queue ! rtppcmadepay ! alawdec ! autoaudiosink
gst_rtsp_media_factory_set_launch (factory,
"( videotestsrc is-live=1 ! x264enc ! rtph264pay name=pay0 pt=96 )");
gstreamer-tips-picture-in-picture-compositing的更多相关文章
- A Complete Guide to the <Picture> Element
If you’ve ever struggled building responsive websites, this post is for you. It’s part of a series o ...
- 【20190305】CSS-响应式图片:srcset+sizes,picture,svg
响应式图片可以根据不同的设备屏幕大小从而选择加载不同的图片,从而节省带宽.实现响应式图片有三种方法:srcset+sizes属性.picture标签.svg 1. srcset+sizes srcse ...
- error C2011: “Picture”:“struct”类型重定义
今天引用外来库时出现问题,也许是版本问题. 错误如下: .....\oursun\cincludes\quickdraw.h(309): error C2011: “Picture”:“struct” ...
- gstreamer应用笔记
gstreamer官网 https://gstreamer.freedesktop.org/ 应用手册 https://gstreamer.freedesktop.org/documentation/ ...
- iPad 多任务 Spilt View & Size Class
iPad 多任务 Spilt View & Size Class 一.多任务简介 iOS 9 以后iPad新增了多任务的支持,主要形式有三种: Slide Over (侧边快捷打开) Spil ...
- SpringMVC处理multipart请求.
一.简述 multipart格式的数据会将一个表单拆分为多个部分(part),每个部分对应一个输入域.在一般的表单输入域中,它所对应的部分中会放置文本型数据,但是如果上传文件的话,它所对应的部分可以是 ...
- puppeteer(五)chrome启动参数列表API
List of Chromium Command Line Switches https://peter.sh/experiments/chromium-command-line-switches/ ...
- CEF 支持的命令行参数
参考:https://peter.sh/experiments/chromium-command-line-switches/ List of Chromium Command Line Switch ...
- OpenCV 数字验证码识别
更新后代码下载链接在此! !! 点我下载 本文针对OpenCv入门人士.由于我也不是专门做图像的,仅仅是为了完毕一次模式识别的小作业. 主要完毕的功能就是自己主动识别图片中的数字.图片包含正常图片,有 ...
- java web学习笔记-jsp篇
1.java web简介 1.1静态页面与动态页面 表现形式 所需技术 静态网页 网页内容固定,不会更新 html,css 动态网页 网页内容由程序动态显示,自动更新 html,css,DB,ja ...
随机推荐
- RPMforge(Repoforge)源
centos使用rpmforge-release 时间:2017-10-09 09:48:29 阅读:536 评论:0 收藏:0 [点我收藏+] 标签:rpmf ...
- UTF-8和GBK的区别
GBK是在国家标准GB2312基础上扩容后兼容GB2312的标准(好像还不是国家标准).GBK编码专门用来解决中文编码的,是双字节的.不论中英文都是双字节的. UTF-8编码是用以解决国际上字符的一种 ...
- CMake 简介与使用
cross platform make的缩写. 是一个比make更高级的编译配置工具,它可以根据不同平台.不同的编译器,生成相应的Makefile或者vcproj项目文件.通过编写CMakeLists ...
- Cocos2dx 场景切换动画
1.http://www.cnblogs.com/linux-ios/archive/2013/04/09/3009292.html
- 基于 UML 的业务建模举例
简介: 对于管理流程咨询项目.大型信息化建设项目和套装管理软件实施项目,对业务环境的分析和理解对项目的成功至关重要.系统.全面理解 IT 系统所处的业务环境,可以帮助 IT 系统能提供正确系统功能,并 ...
- OpenCV学习笔记十八:opencv_flann模块
一,简介: Fast Library for Approximate Nearest Neighbors (FLANN)算法库.
- IOS 关于取消延迟执行函数的种种。performSelector与cancelPreviousPerformRequestsWithTarget
本文非本人撰写 @interface NSObject (NSDelayedPerforming) - (void)performSelector:(SEL)aSelector withObj ...
- Android开发:《Gradle Recipes for Android》阅读笔记1.4
在android studio下可以使用gradle视图运行gradle. gradle任务被分别组织在不同目录下,如android,build,install. 需要执行特定的任务只要双击任务名称. ...
- Strange Optimization(扩展欧几里得)
Strange Optimization Accepted : 67 Submit : 289 Time Limit : 1000 MS Memory Limit : 65536 KB Str ...
- bat masterNodeRun.bat
C:\> compare C:\> compare C:\>D:\cmd\wphp.bat C:\> compareReq -- :: TODO StartScript -- ...