TS stream processing design based on AU 1 200

The enforcement of China's terrestrial TV transmission standard and the opening of the live broadcast star will greatly promote the development of digital TV. Nowadays, there are already many provinces and cities in China that have launched mobile digital TV. For the terminal receiving device software, the processing of the digital television mainly analyzes and parses the decoded TS stream.

This article refers to the address: http://

1 TS flow and general processing flow
1.1 TS stream TS stream, ie transport stream (Transport Stream), is based on ITU-TRec. H. 222. O | A data stream defined by the ISO/IEC 13818-2 and ISO/IEC 13818-3 protocols. It consists of one or more programs, each program consisting of one or more original streams combined with other streams, including video streams, audio streams, program specific information streams (PSI), and other data packets. What is transmitted in digital television broadcasting is the TS stream. A TS stream can carry multiple information streams, such as audio and video streams, data streams, control streams, and the like in actual applications. The length of a TS packet is fixed, starting with a sync byte (sync_byte) Ox47, followed by a packet identification number PID and packet load data, for a total length of 188 bytes. From the PID, it can be judged whether the data type of the load behind it is a video stream, an audio stream, a PSI, or other data packets. The Program Specific Information Stream (PSI) is used to describe the composition of the transport stream, and is composed of a specific PID, the most important of which is the PAT table and the PMT table.
1.2 TS stream processing The general processing flow of the digital TV receiving device after receiving the TS stream is shown in Figure 1. TS-Reader is a TS stream reading module for detecting and reading TS streams; TS-Demux module is a TS stream splitting module for sorting audio and video data in TS streams for later module processing; Video- The Decoder module is a video decoding module that performs corresponding decoding work according to the video data compression format carried by the TS stream, and then sends the decoded video data to the display device output; the Audio-Decoder module is an audio decoding module that converts the audio in the TS stream. Stream decoding, output to an audio device.

2 AU1200-based TS stream processing system components The hardware of the digital TV receiver equipment of this design uses AU1200 as the main chip. The AU1200 is a high-performance, low-power, high-integration embedded processor from MMI architecture from RMI. The AU1200's Media Acceleration Engine (MAE) can stream multiple streams of MPEG-1, MPEG-2, DivX and Xvid without DSP, without the need for PCs (or other devices). Transcoding of content. Using AU1200 as the main chip of embedded digital TV playback equipment, it can fully utilize its low cost, low power consumption and high performance in media playback performance.
The MAE is an on-chip hardware built into the AU1200 processor that takes on video decoding, scaling, color space conversion, and filtering. The MAE hardware is divided into a front end and a back end, each performing a specific task. The front end of the MAE performs the most complex and cumbersome decoding tasks independently, including inverse quantization, inverse cosine conversion, motion compensation, and Windows Media Video 9 overlay smoothing. The MAE backend performs scaling, color space conversion, and filtering. Efficient use of the front and back of the MAE can reduce the load on the CPU and provide more friendly human-computer interaction.
Taking the Linux system as the platform and utilizing the advantages of multi-thread processing, the digital TV broadcasting system composed of AU1200 hardware can conveniently realize the playback of digital TV TS stream. The structure of the digital TV broadcasting system is shown in Figure 2.

3 Digital TV broadcasting software design The playback software adopts modular design and multi-thread parallel processing. Each module performs data transmission and synchronization with each other through the MAI (Media Application Interface) Engine. The software requires the ability to play digital TV while maintaining smooth playback of multimedia files in formats such as MPEG (1, 2, 4), DivX, WMV and XviD.
3.1 Structure of existing playback software Structure of existing media playback software: Each module in the playback software assembles the corresponding modules through MAI Engine to complete the playback or format conversion of media files in a specific format.
The module types are divided into: File Reader module, Demux module, De-coder module, Render module and File Writer module. Whether the module needs to be manned and how to make the link is determined by the MAI Engine according to the media format being played. After the module is loaded, it runs independently as a thread. The modules exchange data through the data buffer and are coordinated by the MAI Engine to ensure that the module runs normally.
3.2 TS stream processing in the playback software To realize the playback of the digital TV TS stream in the playback software, it is necessary to add the Reader, Demux and Decoder modules of the TS stream to the original playback system. Since the audio and video encoding formats of digital television are public and determined, the corresponding Decoder module is required for processing. The MAE-based TS stream processing module structure is shown in Figure 3.

(1) TS-Reader module The TS-Reader module is a module that reads a TS stream. It acquires the TS stream data from the hardware device and writes it to the buffer according to the data buffer size requirement of TS-Demux. It mainly implements three functions of opening TS stream data interface, closing interface and reading TS stream data, corresponding to three main functions one TSstreamopen(), _TSstreamclose() and _TSstreamread(). Since digital TV does not support playback, it does not have the function of positioning search (ie Seek).
(2) TS-Demux module The TS-Demux module is a module for TS stream analysis, which is the key to processing digital TV TS streams. After TS-Demux retrieves the data from the buffer, it needs to parse the TS stream, and then return the program information of the current TS stream of the MAI, and the application program selects. After determining the program stream PID, TS-Demux will sort the TS stream according to the audio and video PID, and obtain Video and Audio data for decoding by the corresponding Decoder.
(3) Audio-Decoder module The decoding format of the audio and video has been determined when the MAI starts to link each module, so the decoding module of the audio and video is determined at the time of linking. At this time, the audio decoding Audio-Decoder module is a module for processing audio decoding. According to different digital television formats, the audio decoding format may be mp3 or ac3. After the audio is decoded, the audio data is sent to the Audio-Render module driver hardware to make a sound.
(4) Video-Decoder module Video decoding Video-Decoder module is also the decoding work to determine the encoding format. For the MPEG2 encoding format, Video-Decoder passes the data to the front end of the MAE for processing, which is sent to the display by the MAE. For other video formats that cannot be processed using the MAE front end (such as H264), it must be decoded by the software to form YUV data, and then the YUV data is input to the backend processing of the MAE.
3.3 Digital TV Playback Effect The built digital TV broadcast system needs to be tested. Through testing, the data buffer of the digital TV device interface needs to be set to 256KB, if the storage capacity allows 512 KB to 1 MB better. When the digital TV module is played by the USB interface, the playback is smooth, the audio and video are synchronized, and the actual playback of the digital TV achieves the expected effect.
3.4 Adding support for other media formats For other common media file formats, such as flv and rmvb, you can also play it by adding Demux and Decoder in this format. Since the video Decoder is decoded and the YUV data is obtained, the data is directly sent to the MAE-BE end for processing. In terms of audio and video synchronization, when the YUV data is submitted to the MAE-BE, the timestamp of the current frame is submitted to the MAE, and the audio and video synchronization can be realized internally by the MAE. Of course, you can also synchronize the audio and video in the program yourself. This requires obtaining the time stamp of the audio playback from the MAE before submitting the YUV, and then comparing with the time stamp of the current video frame to perform the necessary delay operation.

Conclusion This article details the process of establishing a digital TV playback system. The system is based on the AU1200 chip, combined with the advantages of software and hardware, to achieve the playback function of digital TV TS stream. Through the expansion of the media player, decoding and playback of various media formats such as flv and rmvb can also be realized.

Waterproof Bluetooth Speakers

Waterproof Speakers,20W Waterproof Bluetooth Speaker,Waterproof Ipx7 Bluetooth Speaker,Portable Waterproof Bluetooth Speaker

Comcn Electronics Limited , https://www.comcnspeaker.com

This entry was posted in on