添加VLC模块

来源:互联网 发布:单片机音乐代码生成器 编辑:程序博客网 时间:2024/05/21 22:22

转自:http://tianxiaoma.blog.51cto.com/1501174/303430

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