添加VLC模块

64 How to add a module 
65 ------------------- 
66  
67 To add a module to the repository, just add its sources to a Modules.am 
68 file. If you add a new directory you will need to create a new Modules.am, 
69 inside that directory. Do not forget to add a corresponding 
70 Makefile line at the end of configure.ac for this new Modules.am file. 
71  
72 To have the module built, you need to add a call to VLC_ADD_PLUGIN or 
73 VLC_ADD_BUILTINS to configure.ac with your new module name as argument. 
74 Look at other modules for guidelines on how to add build and linkage options. 
75  
76 After changing configure.ac you will always need to rerun bootstrap and  
77 configure. 
78  
79 VLC keeps a cache of its modules (in ~/.cache/vlc/ on Linux), so you'll have to 
80 delete it (or use vlc --reset-plugins-cache). Then use vlc -vvv --color --list 
81 to check that your plugin is seen by VLC.
 
VLC提供的模块说明如上图。下面分别讲解了如何添加模块目录和添加模块,源代码见最后。
 
一、添加“模块目录。
(1) 在Modules目录下新建MyModules子目录,加入“模块源代码”mymdule1.c
 
(2) 添加Modules.am文件
    
SOURCES_mymodule1 = mymodule1.c
libvlc_LTLIBRARIES += \ 
  $(NULL)
(3) 修改Modules/Makefile.am文件,添加MyModules子目录
BASE_SUBDIRS = \ 
     .... 
     MyModules
(4) 修改根目录下的configure.ac文件,添加模块,支持编译
dnl 
dnl    mymodules 
dnl 
VLC_ADD_PLUGIN([mymodule1])
(4) 运行./bootstrap 
        ./configure**.sh  (自己定义的configure文件)
 
二、添加“模块”
例如:在Demux目录下添加MyModule1模块
(1)  修改Demux目录下的Modules.am文件,增加1行
    
SOURCES_mymodule1 = mymodule1.c

(2) 复制MyModule1.c到Demux目录
 
(3) 修改根目录下的configure.ac文件,添加模块,支持编译
dnl 
dnl    mymodules 
dnl 
VLC_ADD_PLUGIN([mymodule1])
(4) 运行./bootstrap 
        ./configure**.sh  (自己定义的configure文件)
  
  
  
附:MyModule1.c源代码:
复制代码
            
            
#ifdef HAVE_CONFIG_H # include " config.h " #endif #include < vlc_common.h > #include < vlc_plugin.h > /* **************************************************************************** * Local prototypes. **************************************************************************** */ static int Open ( vlc_object_t * ); static void Close ( vlc_object_t * ); /* **************************************************************************** * Module descriptor **************************************************************************** */ vlc_module_begin() add_shortcut( " testmodule " ) set_description( " testmodle plug-in " ) set_callbacks( Open, Close ) set_capability( " testing " , 0 ) set_category( CAT_INPUT ) vlc_module_end () /* **************************************************************************** * Open: initialize interface **************************************************************************** */ static int Open( vlc_object_t * p_this ) { msg_Dbg(p_this, " Using test module...\n " ); return VLC_SUCCESS; } /* **************************************************************************** * Close: destroy interface **************************************************************************** */ static void Close( vlc_object_t * p_this ) { msg_Dbg(p_this, " Close test module!\n " ); }
复制代码
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值