網頁

2016年3月14日 星期一

VLC 追蹤之三 packetizer

設定 p_es_out_display->pf_control = EsOutControl
../src/input/input.c -> Create -> input_EsOutNew
    p_input->p->p_es_out_display = input_EsOutNew( p_input, p_input->p->i_rate );

../src/input/es_out.c
es_out_t *input_EsOutNew( input_thread_t *p_input, int i_rate )
    out->pf_control = EsOutControl;

設定 
    p_es_out->pf_control = Control
    p_es_out->p_out = p_es_out_display
../src/input/input.c -> Init
    p_input->p->p_es_out = input_EsOutTimeshiftNew( p_input, p_input->p->p_es_out_display, p_input->p->i_rate );

../src/input/es_out_timeshift.c
es_out_t *input_EsOutTimeshiftNew( input_thread_t *p_input, es_out_t *p_next_out, int i_rate )
    p_out->pf_control = Control;
    p_out->p_sys      = p_sys;
    p_sys->p_out = p_next_out;

觸發 pf_control, 此時是 es_out_timeshift.c 內的 Control
../src/input/input.c
Init -> InitPrograms -> es_out_SetMode
    es_out_SetMode( p_input->p->p_es_out, i_es_out_mode );
../src/input/es_out.h
static inline void es_out_SetMode( es_out_t *p_out, int i_mode )
{
    int i_ret = es_out_Control( p_out, ES_OUT_SET_MODE, i_mode );
    assert( !i_ret );
}
../include/vlc_es_out.h
es_out_Control -> es_out_vaControl( out, i_query, args );
static inline int es_out_vaControl( es_out_t *out, int i_query, va_list args )
{
    return out->pf_control( out, i_query, args );
}


一樣透過 es_out_Control 觸發 pf_control, 此時是 es_out.c 內的 EsOutControl
../src/input/es_out_timeshift.c
static int Control( es_out_t *p_out, int i_query, va_list args )
    i_ret = ControlLocked( p_out, i_query, args );
static int ControlLocked( es_out_t *p_out, int i_query, va_list args )
    es_out_sys_t *p_sys = p_out->p_sys;
    int rt =  CmdExecuteControl( p_sys->p_out, &cmd );
static int CmdExecuteControl( es_out_t *p_out, ts_cmd_t *p_cmd )
    int rt = es_out_Control( p_out, i_query, p_cmd->u.control.u.i_int );

../src/input/es_out.c
EsOutControl -> EsOutControlLocked -> EsSelect -> EsCreateDecoder -> input_DecoderNew
../src/input/decoder.c
input_DecoderNew -> decoder_New -> CreateDecoder -> LoadDecoder
    p_dec->p_module = module_need( p_dec, "packetizer", "$packetizer", false );

最後帶入 packetizer

沒有留言:

張貼留言