網頁

2016年3月16日 星期三

VLC 追蹤之五 VoutCreate

載入 avcodec, 並登記 pf_vout_format_update
src/input/decoder.c
input_DecoderNew -> decoder_New -> CreateDecoder
    p_dec->pf_vout_format_update = vout_update_format;
input_DecoderNew -> decoder_New -> CreateDecoder -> LoadDecoder
p_dec->p_module = module_need( p_dec, "decoder", "$codec", false );

載入 avcodec 時, 登記 pf_decode_video, get_format
modules/codec/avcodec/avcodec.c
    set_capability( "decoder", 70 )
    set_callbacks( OpenDecoder, CloseDecoder )

OpenDecoder
    ret = InitVideoDec( p_dec, avctx, p_codec );

modules/codec/avcodec/video.c
InitVideoDec
    p_context->get_format = ffmpeg_GetFormat;
    p_dec->pf_decode_video = DecodeVideo;

透過 pf_decode_video 執行 DecodeVideo
src/input/es_out.c
input_DecoderNew -> decoder_New -> vlc_clone(DecoderThread)
src/input/decoder.c
DecoderThread -> DecoderProcess -> DecoderProcessVideo -> DecoderDecodeVideo
    while( (p_pic = p_dec->pf_decode_video( p_dec, pp_block ) ) )

modules/codec/avcodec/video.c
DecodeVideo -> lavc_UpdateVideoFormat
    return decoder_UpdateVideoFormat(dec);

透過 pf_vout_format_update 執行 vout_update_format
include/vlc_codec.h
decoder_UpdateVideoFormat
    return dec->pf_vout_format_update( dec );

src/input/decoder.c
vout_update_format
    p_vout = input_resource_RequestVout( p_owner->p_resource,

src/input/resource.c
input_resource_RequestVout -> RequestVout
    p_vout = vout_Request( p_resource->p_parent, &cfg );

src/video_output/video_output.c
vout_Request -> VoutCreate
    vout->p->spu = spu_Create(vout);

src/video_output/vout_subpictures.c
spu_Create -> sys->text = SpuRenderCreateAndLoadText
    text->p_module = module_need(text, "text renderer", "$text-renderer", false);
在此載入 freetype
spu_Create -> sys->scale = SpuRenderCreateAndLoadScale
    scale->p_module = module_need(scale, "video filter2", NULL, false);
在此載入 swscale
spu_Create -> sys->scale_yuvp = SpuRenderCreateAndLoadScale
    scale->p_module = module_need(scale, "video filter2", NULL, false);
在此載入 yuvp

src/video_output/video_output.c
vout_Request -> VoutCreate -> vout_display_window_New
src/video_output/window.c
vout_display_window_New -> vout_window_New -> vlc_module_load(vout window)
在此載入 qt4

src/video_output/video_output.c
vout_Request -> VoutCreate -> vlc_clone(Thread)
Thread -> ThreadControl -> ThreadStart -> vout_OpenWrapper
src/video_output/vout_wrapper.c
vout_OpenWrapper -> vout_NewDisplay
src/video_output/display.c
vout_NewDisplay -> DisplayNew -> vout_display_New -> module_need(vout display)
在此載入 direct3d9

src/video_output/video_output.c
vout_Request -> VoutCreate -> spu_Attach
src/video_output/vout_subpictures.c
spu_Attach -> spu->p->text = SpuRenderCreateAndLoadText
    text->p_module = module_need(text, "text renderer", "$text-renderer", false);
在此載入 freetype


沒有留言:

張貼留言