網頁

2016年3月10日 星期四

VLC 追蹤之二 modules

src/input/demux.c -> demux_NewAdvanced
            module_need( p_demux, "demux", psz_module, !strcmp( psz_module, p_demux->psz_demux ) );

modules/demux/playlist/playlist.c
    add_submodule ()
        set_description( N_("XSPF playlist import") )
        add_shortcut( "playlist", "xspf-open" )
        set_capability( "demux", 10 )
        set_callbacks( Import_xspf, Close_xspf )

modules/demux/playlist/xspf.c
int Import_xspf(vlc_object_t *p_this)
{
    STANDARD_DEMUX_INIT_MSG("using XSPF playlist reader");
}

modules/demux/playlist/playlist.h
#define STANDARD_DEMUX_INIT_MSG( msg ) do { \
    DEMUX_INIT_COMMON();                    \
    msg_Dbg( p_demux, "%s", msg ); } while(0)

include/vlc_demux.h
#define DEMUX_INIT_COMMON() do {            \
    p_demux->pf_control = Control;          \
    p_demux->pf_demux = Demux;              \
    p_demux->p_sys = calloc( 1, sizeof( demux_sys_t ) ); \
    if( !p_demux->p_sys ) return VLC_ENOMEM;\
    } while(0)
以上定義了 p_demux->pf_demux

之後執行時
src/input/input.c -> input_Read -> MainLoop -> MainLoopDemux -> demux_Demux

include/vlc_demux.h -> demux_Demux
VLC_USED static inline int demux_Demux( demux_t *p_demux )
{
    if( !p_demux->pf_demux )
        return 1;

    return p_demux->pf_demux( p_demux );
}

以下又載入了 xml reader module
modules/demux/playlist/xspf.c -> Demux -> xml_ReaderCreate
src/misc/xml.c -> xml_ReaderCreate -> module_need(xml reader)


沒有留言:

張貼留言