VLC Learning Program (6) - Analysis of Network Data Stream Receive Processing Process

xiaoxiao2021-03-06  36

Network data stream receiving processing analysis

1. Main thread cycle in the Input.c / Input file

Thread in Charge of Processing The Network Packets and DemultiPlexing

Runthread (Input_thread_t * p_input)

{

INITTHREAD (P_INPUT);

.........................................................

INPUT_SELECTES (p_input, p_input-> stream.p_newly_selected_es);

.........................................................

/ * Read and Demultiplex some data. * /

i_count = p_input-> pf_demux (p_input);

}

2, in the following functions:

Separate Access, Demux, Name string; find the Acess pointer module by the module_need function according to the separate Access string; find the Demux pointer module by the Module_Need function according to the descended Demux string;

Static int initithread (Input_thread_t * p_input)

{

Msg_dbg (p_input, "access`% s', Demux `% s', Name`% s' ",

P_INPUT-> PSZ_Access, P_INPUT-> PSZ_DEMUX, P_INPUT-> PSZ_NAME);

/ * Find and open appropriate Access Module * /

p_input-> p_access = module_need (p_INPUT, "Access",

P_INPUT-> PSZ_Access, VLC_TRUE;

.........................................................

While (! Input_fillbuffer (p_INPUT))

.........................................................

/ * Find and open appropriate Demux Module * /

P_INPUT-> p_demux =

Module_need (p_input, "demux",

(p_INPUT-> PSZ_DEMUX && * P_INPUT-> PSZ_DEMUX)?

P_INPUT-> PSZ_DEMUX: "$ DEMUX",

(p_INPUT-> PSZ_DEMUX && * P_INPUT-> PSZ_DEMUX)?

VLC_TRUE: VLC_FALSE);

.........................................................

}

3, in the PS.c (Module / Demux / MPEG) file

a. Bright function activate by message mapping macro;

b. By function ACTIVATE assignment P_INPUT-> PF_DEMUX = DEMUX;

c. Activate p_INPUT-> P_DEMUX_DATA-> MPEG.PF_READ_PS (PF_READ_PS) function (P_INPUT, & P_DATA) function (P_INPUT, & P_DATA) function (P_INPUT, & P_DATA) function (P_INPUT, & P_DATA) function (P_INPUT, & P_DATA) function (P_INPUT, & P_DATA) function (P_INPUT, & P_DATA) function (P_Input, & p_data) function (p_INPUT, & P_DATA).

d. Activated in the initThread function;

Static Int Activate (VLC_Object_t * p_this)

{

/ * Set the demux function * /

P_INPUT-> PF_DEMUX = DEMUX;

P_INPUT-> p_private = (void *) & p_demux-> mpeg;

P_Demux-> p_module = module_need (p_input, "mpeg-system", null, 0);

}

4, in the System.c (Module / Demux / MPEG) file

Assignment Decoding Module MPEG_DEMUX_T member function;

Static Int Activate (VLC_Object_t * p_this)

{

Static MPEG_DEMUX_T MPEG_DEMUX =

{NULL, READPS, PARSEPS, DEMUXPS, READTS, DEMUXTS}

MPEG_DEMUX.CUR_SCR_TIME = -1;

Memcpy (p_this-> p_private, & mpeg_demux, sizeof (mpeg_demux));

Return VLC_Success;

}

And the function static size_t readps (Input_thread_t * p_input, data_packet_t ** pp_data);

5, in the PS.c (Module / Demux / MPEG) file

DEMUX (Input_thread_t * p_input)

{

I_RESULT = p_input-> p_demux_data-> mpeg.pf_read_ps (p_input, & p_data);

P_INPUT-> P_DEMUX_DATA-> MPEG.PF_DEMUX_PS (P_INPUT, P_DATA);

}

Read data and separation;

6, in the System.c (Module / Demux / MPEG) file

Data walking charts are as follows

Readps-> Peek-> Input_peek (src / input / input_ext-plugins.c) -> Input_fillbuffert via i_ret = p_input-> pf_read (p_input,

(BYTE_T *) P_BUF SIZEOF (Data_Buffer_t)

I_REMAINS,

p_INPUT-> i_bufsize);

The PF_READ function member of the input_thread_t structure If it is a RTPCHOOSE function for udp.c (modules / access)

Then activate by module_need when the Access (UDP module) is turned on;

Activate network read data module RTPCHOOSE (Modules / Access / udp.c) -> read-> net_read (src / misc / net.c);

7, in the Input_Programs.c (SRC / INPUT) file

Run the decoder to the ES stream

INT INPUT_SELECTES (INPUT_THREAD_T * P_INPUT, ES_DESCRIPTOR_T * P_ES)

{

P_ES-> p_dec = INPUT_RUNDECODER (p_input, p_es);

}

INPUT_SELECTES

SRC / INPUT / INPUT_PROGRAMS.C

)

-> Input_Rundecoder

(

SRC / INPUT / INPUT_DEC.C

)

-> DecodeRThread-> DecoderDecode -> Vout_DisplayPicture

转载请注明原文地址:https://www.9cbs.com/read-57229.html

New Post(0)