運行時架構(gòu):步驟
1.main負(fù)責(zé)初始化所有結(jié)構(gòu)體,全局資源,派生出:
---> 2.playlist,初始化和管理播放器的播放列表。
---> 3.一個中間線程,
---> 4.SigThread控制播放器的播放暫停等,管理最終的程序退出,在接到信號(待定)后執(zhí)行l(wèi)ibvlc_Quit()銷毀所有與libvlc相關(guān)的線程和資源.。播放完畢后,音視頻的輸出線程先退出(可能由他們自己管理自己,完成后自動退出 )
接著渲染(或者驅(qū)動)線程退出。2個視頻解碼渲染,1個音頻解碼渲染。
( 7-Vout, 9-video_output, 10-xcb.c/Thread()
11-xdg.c/Thread()
8-Aout, 12-audio_output/alsa.c/ALSAThread()循環(huán)調(diào)用ALSAFill(p_aout))
---> 5.RunInterface: setups necessary data and give control to the interface
執(zhí)行Run(),控制所有線程開始,其他線程得到消息之后并行運行。 Run()函數(shù)中ReadCommand( p_intf, p_buffer, &i_size );解析外部命令。這里是一個命令模式
線程2 派生出
線程6.input/Run(),該線程阻塞在while( !LoopInput( p_playlist ) ) vlc_cond_wait( &p_sys->signal, &p_sys->lock ); 上。并且通過 LoopRequest( p_playlist );循環(huán)解析播放列表,播放所有的資源。
線程6派生出:
線程7.input/DecoderThread(),這個線程被VoutCreate函數(shù)創(chuàng)建,使用Ffmpeg作為解碼庫
線程8.input/DecoderThread(),這個線程被audio_output/alsa.c/Open()函數(shù)創(chuàng)建
線程7是Video的解碼線程,它派生出:
線程9.video_output/RunThread(),這個線程作為視頻解碼器使用,這是它的調(diào)用棧的回溯表:
FT_Get_Glyph () from /usr/lib/i386-linux-gnu/libfreetype.so.6
RenderText () at freetype.c:1212
SpuRenderText () at video_output/vout_subpictures.c:1093
SpuRenderRegion () at video_output/vout_subpictures.c:1361
spu_RenderSubpictures () at video_output/vout_subpictures.c:507
vout_RenderPicture () at video_output/vout_pictures.c:383
RunThread () at video_output/video_output.c:1148
線程9派生出兩個渲染器線程線程分別為:
---> 線程10.video_output/xcb/Thread()
---> 線程11.modules/misc/inhibit/xdg.c/Thread()
線程8.是音頻解碼線程,通過aout_outputNew創(chuàng)建,它派生出線程12.audio_output/alsa.c/ALSAThreade()作為音頻的渲染。