VLC Learning Program (7) - Process Analysis from the reception of data to play video

xiaoxiao2021-03-06  41

Process analysis from receiving data to playing video Receive streams from the network -> Video and audio separation of data streams -> Decoding video decoder -> Show decoded video stream

Video Display Partial Tropline: Separation -> Decoding -> New VOUT Buffer -> Vout Thread

Demux (modules / demux / mpeg / ps.c) -> DemuxPs (modules / demux / mpeg / system.c) -> ParsePS-> input_SelectES (src / input / input_programs.c) -> input_RunDecoder (src / input / input_dec .c) -> CREATEDECODER->

VOUT_NEW_BUFFER-> Vout_Request (src / video_output / video_output.c) -> Vout_create-> runthread-> vout_renderpicture (src / video_output / vout_pictures.c) -> PF_DISPLAY

Note: p_dec-> pf_vout_buffer_new = VOUT_NEW_BUFFER PF_VOUT_BUFFER_NEW is activated in ffmpeg_newpictbuf (modules / codec / ffmpeg / video) function

Decoded part of the trend line:

Demux (modules / demux / mpeg / ps.c) -> DemuxPs (modules / demux / mpeg / system.c) -> ParsePS-> input_SelectES (src / input / input_programs.c) -> input_RunDecoder (src / input / input_dec .c) -> CREATEDECODER->

Decoderthread

Note: Decoding data streams (Audio or Video) in decoding threads

Details

http://developers.videolan.org/vlc/

VLC API Documentation or VLC Developer Documentation

Chapter 5. The Video Output Layer

Data Structures and main loop

Important data structures are defined in include / video.h and include / video_output.h. The main data structure is picture_t, which describes everything a video decoder thread needs. Please refer to this file for more information. Typically, p_data will be a pointer TO YUV Planar Picture.

Note also the subpicture_t structure. In fact the VLC SPU decoder only parses the SPU header, and converts the SPU graphical data to an internal format which can be rendered much faster. So a part of the "real" SPU decoder lies in src / video_output /Video_spu.c.

The vout_thread_t structure is much more complex, but you need not understand everything. Basically the video output thread manages a heap of pictures and subpictures (5 by default). Every picture has a status (displayed, destroyed, empty ...) and eventually a presentation time The main job of the video output is an infinite loop to:. [this is subject to change in the near future] Find the next picture to display in the heap Find the current subpicture to display Render the picture (.. if the video output plug-in does not support YUV overlay). Rendering will call an optimized YUV plug-in, which will also do the scaling, add subtitles and an optional picture information field. Sleep until the specified date. Display the picture (plug-in function). For outputs which display RGB data, it is often accomplished with a buffer switching. p_vout-> p_buffer is an array of two buffers where the YUV transform takes place, and p_vout-> i_buffer_index indicates the currently displayed buffer MANAGE Events.

Methods Used by Video Decoders

The video output exports a bunch of functions so that decoders can send their decoded data. The most important function is vout_CreatePicture which allocates the picture buffer to the size indicated by the video decoder. It then just needs to feed (void *) p_picture-> P_Data with the decoded data, and call vout_displaypicture and vout_datepicture upon necessary.

picture_t * vout_CreatePicture (vout_thread_t * p_vout, int i_type, int i_width, int i_height):. Returns an allocated picture buffer i_type will be for instance YUV_420_PICTURE, and i_width and i_height are in pixels.

Warning

IF No Picture Is Available In The Heap, Vout_createPicture Will Return Null.

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

New Post(0)