網頁

2016年2月16日 星期二

VLC 追蹤

vlc.exe rtsp://169.254.1.168:554/live2.sdp --sout 'rtp{dst=127.0.0.1,port=1234,sdp=rtsp://localhost:8080/test.sdp}' --verbose=2 --file-logging --logfile=vlc-log.txt

VLC 進入點
bin/winvlc.c -> WinMain
    libvlc_instance_t *vlc;
    vlc = libvlc_new (argc, (const char **)argv);
    if (vlc != NULL)
    {
        libvlc_set_app_id (vlc, "org.VideoLAN.VLC", PACKAGE_VERSION,
                           PACKAGE_NAME);
        libvlc_set_user_agent (vlc, "VLC media player", "VLC/"PACKAGE_VERSION);
        libvlc_add_intf (vlc, "hotkeys,none");
        libvlc_add_intf (vlc, "globalhotkeys,none");
        libvlc_add_intf (vlc, NULL);
        libvlc_playlist_play (vlc, -1, 0, NULL);
        libvlc_wait (vlc);
        libvlc_release (vlc);
    }


lib/core.c -> libvlc_new
    libvlc_int_t *p_libvlc_int = libvlc_InternalCreate();
    if (libvlc_InternalInit( p_libvlc_int, argc + 1, my_argv ))
    {
        libvlc_InternalDestroy( p_libvlc_int );
        goto error;
    }

src/libvlc.c -> libvlc_InternalCreate
src/libvlc.c -> libvlc_InternalInit
    vlc_LogPreinit(p_libvlc); // 除錯資料先放記憶體
    vlc_LogInit(p_libvlc); // 除錯 從此開始
    GetFilenames( p_libvlc, i_argc - vlc_optind, ppsz_argv + vlc_optind );

src/misc/messages.c -> vlc_LogPreinit
src/misc/messages.c -> vlc_LogInit -> vlc_module_load(logger, "logger"...)

src/libvlc.c -> GetFilenames -> intf_InsertItem
src/interface/interface.c -> intf_InsertItem -> playlist_AddExt -> intf_GetPlaylist  -> playlist_Create
src/playlist/engine.c -> playlist_Create -> playlist_MLLoad
src/playlist/loadsave.c -> playlist_MLLoad -> input_Read
src/input/input.c -> input_Read -> Create
src/input/input.c -> input_Read -> Init -> InputSourceNew -> input_DemuxNew
src/input/demux.c -> input_DemuxNew -> demux_NewAdvanced -> module_need(access_demux)
src/input/demux.c -> input_DemuxNew -> stream_AccessNew
src/input/access.c -> stream_AccessNew -> access_New -> module_need(access)
src/input/access.c -> stream_AccessNew -> stream_FilterChainNew
src/input/stream_filter.c -> stream_FilterChainNew -> stream_FilterNew -> module_need(stream_filter)
src/input/demux.c -> input_DemuxNew -> stream_FilterAutoNew
src/input/stream_filter.c -> stream_FilterAutoNew -> stream_FilterNew
src/input/input.c -> input_Read -> Init -> InputSourceMeta -> module_need(meta reader)
src/input/input.c -> input_Read -> MainLoop ->MainLoopDemux -> demux_Demux
modules/demux/playlist/xspf.c -> Demux -> xml_ReaderCreate
src/misc/xml.c -> xml_ReaderCreate -> module_need(xml reader)
src/playlist/engine.c -> playlist_Create -> input_resource_GetAout
src/input/resource.c -> input_resource_GetAout -> aout_New
src/audio_output/output.c -> aout_New -> module_need(audio output)
src/playlist/engine.c -> playlist_Create -> playlist_Activate
src/playlist/thread.c -> playlist_Activate -> vlc_clone(Thread)
// 建立新 thread,往下執行
// 舊 thread 返回 playlist_Activate -> playlist_Create
src/playlist/thread.c -> Thread
        vlc_cond_wait( &p_sys->signal, &p_sys->lock );
        // 這個 thread 會等到 libvlc_playlist_play 送出 vlc_cond_signal, 才執行
        while( !p_sys->killed && Next( p_playlist ) )
        {   /* Playlist in running state */
            assert(p_sys->p_input != NULL);

            do
                LoopInput( p_playlist );
            while( p_sys->p_input != NULL );
        }

src/interface/interface.c -> intf_InsertItem -> playlist_AddExt
src/playlist/item.c -> playlist_AddExt -> playlist_AddInput -> GoAndPreparse -> playlist_preparser_Push
src/playlist/preparser.c -> playlist_preparser_Push -> vlc_clone_detach(Thread)
src/playlist/preparser.c -> Thread -> Art -> playlist_fetcher_Push
src/playlist/fetcher.c -> playlist_fetcher_Push -> vlc_clone_detach(Thread)
src/playlist/fetcher.c -> Thread -> FetchMeta -> module_need("meta fetcher")
src/playlist/fetcher.c -> Thread -> FindArt


lib/playlist.c -> libvlc_add_intf -> libvlc_InternalAddIntf
src/interface/interface.c -> libvlc_InternalAddIntf -> intf_Create -> module_need(interface)
modules/gui/qt4/gt4.cpp -> OpenIntf -> Open -> Thread -> MainInterface
modules/gui/qt4/main_interface.cpp -> MainInterface -> VLCMenuBar::createMenuBar
modules/gui/qt4/menus.cpp -> VLCMenuBar::createMenuBar -> ViewMenu -> ExtensionsMenu -> ExtensionsManager::loadExtensions
modules/gui/qt4/extensions_manager.cpp -> ExtensionsManager::loadExtensions -> module_need(extension)



lib/playlist.c -> libvlc_playlist_play -> libvlc_InternalPlay
src/interface/interface.c -> libvlc_InternalPlay -> playlist_Control
src/playlist/control.c -> playlist_Control -> playlist_vaControl -> vlc_cond_signal
src/win32/thread.c -> vlc_cond_signal

// 之前暫停的 thread 繼續執行
src/playlist/thread.c -> Thread -> Next -> NextItem -> ResetCurrentlyPlaying
src/playlist/thread.c -> Thread -> Next -> ResyncCurrentIndex
src/playlist/thread.c -> Thread -> Next -> PlayItem -> input_Create
src/playlist/thread.c -> Thread -> Next -> PlayItem -> var_AddCallback(... "intf-event", InputEvent..)
src/playlist/thread.c -> Thread -> Next -> PlayItem -> input_Start
src/input/input.c -> input_Create -> Create
src/input/input.c -> input_CreatePreparser -> Create
src/input/input.c -> Create -> input_SendEventMeta

src/input/input.c -> input_Start -> vlc_clone(Run)
src/input/input.c -> input_Start -> Run -> Init -> input_EsOutTimeshiftNew
src/input/es_out_timeshift.c -> input_EsOutTimeshiftNew
src/input/input.c -> input_Start -> Run -> Init -> input_SendEventCache
src/input/input.c -> input_Start -> Run -> Init -> InputSourceNew
src/input/input.c -> input_Start -> Run -> Init -> input_SendEventLength
src/input/input.c -> input_Start -> Run -> Init -> input_SendEventPosition
src/input/event.c -> input_SendEvent???? -> Trigger
    var_SetInteger( p_input, "intf-event", i_type );
src/playlist/thread.c -> InputEvent -> vlc_cond_signal
src/input/input.c -> input_Start -> Run -> Init -> IintPrograms
src/input/input.c -> input_Start -> Run -> MainLoop
src/playlist/thread.c -> Thread -> LoopInput -> vlc_cond_wait

src/input/resource.c -> input_resource_RequestSout -> RequestSout -> sout_NewInstance
src/stream_output/stream_output.c -> sout_NewInstance



沒有留言:

張貼留言