-
一步一步创建
GStreamer
插件
(ZZ)
$$git clone
git:///gstreamer/2
、进入
目录
gst-template/gst-plugin/src
$$cd
gst-
template/gst-plugin/src
$$../tools/make_element
ExampleFilter
产生文件
gstexamplefilter.c gstexamp
lefilter.h3
、修改
文件<
/p>
(注意:是
src
目录下的
)
$$sudo gedit
in_LTLIBRARIES =
stexamplefilter_la_SOURCES =
texamplefilter_la_CFLAGS =
$$(GST_CFLAGS)
libgstexamplefilter_la_LIBADD =
$$(GST_LIBS)
libgstexamplefilter_la_LDFLAGS =
$$(GST_PLUGIN_LDFLAGS)
libgstexamplefilter_la_LIBTOOLFLAGS =
--tag=disable-staticnoinst_HEADERS = gs
texamplefilter.h
总共
有七行
4
、
导入
PKG_CONFI
G_PATH
环境变量,
在命令行输
入
:
$$export
PKG_CONFIG_PATH=/us
r/lib/pkgconfig5
、进入目录
gst-
template/gst-plugin,
修改文件
进入上一层目录
$$cd..
编辑
文件:
$$sudo gedit
如果是通过
CVS
获取的模板,则修改原来的<
/p>
srcfile=src/main.c
为新的:
srcfile=src/gstexamplefilter.c
如果是通过
GIT
获取的模板,则
在
的开始添加:
< br>srcfile=src/gstexamplefilter.c6
、运行
p>
,
产生
Makefile
< br>文件
$$./7
、开始安装:
$$./configure
$$make
$$sudo make
install
再进入
src
子目录中
$$cd
src
用
ls -a
查询会有
.libs
目录产生
(注意:
.libs
为隐藏目录)
进入
.libs
$$cd .libs
$$ls -a
会发现里面产生了
8
、将插件加入到
gstreamer
库中
把
这两个文件拷贝到系统目录中:
/usr/lib/gstreamer-0.10$$sudo
cp
/usr/lib/gstreamer-0.10/
$$sudo cp
/usr/lib/gstreamer
-0.10/
如果
gstreamer
无
法扫描到新加入的
plugin
,可
能是因为路径设置不正确
(GST_PLUGIN_PATH
环
境变量
)
用
gst-inspect
命令来查看
plugin
时,
< br>会建立一个
cache
文件:
如
在
X86
上是
$$HOME/.gstreamer-0.10/registry.x86_
如果有
新的
plugin
加入,可能需要先删除这个
< br>cache
文件,
再重新运行
g
st-inspect,
否则不会把新的
plugin
扫描到
cache
中。
几个重要的环境变量:
1:GST_PLUGIN_SCANNER
env = g_getenv
(
//
设置
gst-
plugin_scanner
这个命令的路径
2.
GST_PLUGIN_PATH
plugin_path = g_getenv
(
//plugin
的搜索路径
g_warning (
most likely means
that
run.
need
GST_PLUGIN_SYSTEM_PATH specifies a list
of
plugins that are always
loaded by
default.
If not set, this
defaults to
the system-installed
path,
and the plugins
installed in the user's home directory
plugin_path = g_getenv
(
如果这个变量没有设
置,
default:
plugin_path = g_getenv
(
if (plugin_path == NULL)
{
home_plugins
= g_build_filename (g_get_home_dir (),
} 4.
GST_REGISTRY_UPDATE(yes or no)
,是否重新扫描去
更新
cache
内容
update_env = g_getenv
(
do_update =
(strcmp (update_env,
函数调用:
p>
init_post()->gst_update_registry()->
;ensure_current_regist
ry()->gst_regi
stry_binary_read_cache
->scan_and_update_registry()
->
读环境变量
GST_PLUGIN_PATH->gst_registry_scan_path_in
ternal()
->
读环境变量
GST_PLUGIN_SYSTEM_PATH->
gst_registry_scan_path_internal()
(从目录下去读文件
)
检查插件:
$$gst-inspect examplefilter<
/p>
如果显示了插件的信息,那么插件
就创建好了
(2) Gst good/ugly/bad
库中的
p
lugin
的列表
/documentation/
关于
whitelist
和
blacklist(
黑名单
< br>)
在
p>
plugin
库中,有些
plugin
p>
的
license
是
blacklist
的:
if (strcmp
(plugin->e,
0)
plugin->flags |=
GST_PLUGIN_FLAG_BLACKLISTED;
但是<
/p>
BLACKLIST
并不是开放给用户设置的,
< br>而是
gstreamer
里面自己使用的。含义是说如果
这个
plugin
p>
加载失败时,那么就加入到
blacklist
中,下次不需要去扫描
了,用户也不能去使用。
这种
pl
ugin
在
scan
时会进入
blacklist
的
plugin
list
中,在下次扫描时不会去扫描这些
bl
acklist
。
exc
hange_packets()->read_one
()
->
handle_rx_packet(payloadLength)
->plugin_loader_create_bl
acklist_plu
gin
()
代码:
if (entry != NULL) {
plugin_loader_create_blacklist_plugin
(l,
entry);//plugin->e =
l->got_plugin_details = TRUE;
}
如果要
查看为什么加载
plugin
会失败:
/show_?id=627102
plugins are blacklisted
when there's an error loading them. You
can
check what went wrong by
removing your registry
(~/.gstreamer-0.10/registry*) and then
running:
p>
GST_DEBUG=2,GST_PLUGIN_LOADING:5,GST_REGI
STR
Y:5
gst-inspect-0.10
p>
上面这些参数是设置
debug
系统:
p>
_gst_debug_init()(3)
Gstreamer
中的几个命令使用
/library/cmd/blcmdl1_
/man/man1/
gst-inspect:
gst-inspect prints
information about available
GStreamer
plugins, information about a particular
plugin, or information
about a
particular element.
If no element or
plugin argument is specified,
gst-
inspect prints a list of all plugins and elements.
If an
element or plugin argument is
specified,
gst-inspect prints
information about that element or
plug-
in. If a given argument is valid as either an
element or a
plugin, gst-inspect treats
the argument as an element, by
default.
OPTIONS
The following options are supported by
gst-inspect:
-a, --print-all Print all
elements.
--version Print GStreamer
version number.
gst-std-options
Standard options available for use with
most GStreamer applications. See gst-
std-options(5) for more
information.
OPERANDS
The following operands are supported:
element Name of an element.
plugin Name of a plugin.
EXAMPLES
Example
1: Displaying Information About a Plugin:
example% gst-inspect alaw
Plugin Details:
Name:
alaw
Description:
ALaw audio conversion routines
Filename:
/usr/lib/gstreamer-0.10/
Version:
0.10.3
License:
LGPL
Source module:
gst-plugins-good
Binary package:
GStreamer Good Plug-ins
source
release
Origin URL:
Unknown package origin alawdec: A
Law audio decoder
alawenc: A Law audio encoder 2
features:
+-- 2 elements
gst-launch:
-
-
-
-
-
-
-
-
-
上一篇:多音字和四字词语
下一篇:Mjpeg-streamer代码分析