关键词不能为空

当前您在: 主页 > 英语 >

一步一步创建GStreamer插件(ZZ)

作者:高考题库网
来源:https://www.bjmy2z.cn/gaokao
2021-02-17 11:11
tags:

-

2021年2月17日发(作者:ron)


一步一步创建


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


、运行


,


产生


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,



函数调用:








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

< p>


blacklist(


黑名单

< br>)









plugin


库中,有些


plugin



license



blacklist


的:














if (strcmp (plugin->e,


0)





















plugin->flags |= GST_PLUGIN_FLAG_BLACKLISTED;






但是< /p>


BLACKLIST


并不是开放给用户设置的,

< br>而是


gstreamer


里面自己使用的。含义是说如果 这个


plugin








加载失败时,那么就加入到


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:









GST_DEBUG=2,GST_PLUGIN_LOADING:5,GST_REGI STR


Y:5


gst-inspect-0.10






上面这些参数是设置


debug


系统:











_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:

-


-


-


-


-


-


-


-



本文更新与2021-02-17 11:11,由作者提供,不代表本网站立场,转载请注明出处:https://www.bjmy2z.cn/gaokao/661726.html

一步一步创建GStreamer插件(ZZ)的相关文章