0 Introduction
Mobile multimedia broadcasting has become a hot development hotspot. Mobile multimedia broadcasting service refers to the reception of radio and television programs and information services anytime and anywhere on mobile portable terminals with small screens of less than 7 inches through satellite and terrestrial wireless broadcasting.
In 2006, China proposed the China Mobile Multimedia Broadcasting (CMMB) system with independent intellectual property rights, which can support a variety of small-sized, small-screen, mobile and portable terminals such as mobile phones, PDAs, MP3, MP4, digital cameras, and notebook computers, and provide radio and television programs and information services anytime and anywhere to meet the needs of "information everywhere" in contemporary society. In order to achieve high-quality TV program reception and playback, the performance of the terminal plays an important role, among which the audio and video decoding capability of the terminal is the main factor. At the same time, considering the cost of the terminal, it is critical to choose a suitable software and hardware platform. Therefore, this design takes into account both the performance requirements and cost of digital mobile TV.
l Introduction to CMMB system architecture and terminal structure On
October 24, 2006, the State Administration of Radio, Film and Television officially promulgated the broadcast channel industry standard of China Mobile Multimedia Broadcasting CMMB system "GY/T 220.1-2006 Mobile Multimedia Broadcasting Part 1: Broadcast Channel Frame Structure, Channel Coding and Modulation", which determined the use of China's independently developed mobile multimedia broadcasting transmission technology standard (Satellite-Terrestrial Interactive Multi-service Infrastructure. STiMi). At present, there is no unified mobile multimedia broadcasting technology standard in the world, and it is still in the early stage of large-scale application. Therefore, the timely release of this standard has an important role in promoting the development of China's mobile multimedia broadcasting and related national industries. The
CMMB technology system uses high-power S-band satellite signals to cover the whole country, uses ground-based additional transponders to forward satellite signals at the same frequency, at the same time and with the same content to fill in the gaps in satellite signal blind spots, and uses wireless mobile communication networks to build return channels, thereby forming a mobile multimedia broadcasting network that combines one-way broadcasting and two-way interaction. The CMMB system architecture is shown in Figure 1.
The hardware part of the digital mobile TV terminal is mainly divided into two parts: the TV receiving module and the playback and display module. The former is responsible for controlling the CMMB signal, and the latter is responsible for playing audio and video data. The receiving module of the digital mobile TV adopts the module produced by Taihe Zhiheng Company. The main functions of the receiving module include: initialization of the TV chip, setting the frequency, scanning the frequency; obtaining channel information, setting the channel; receiving and stopping audio and video data; testing the strength of the TV signal. The playback and display module is an embedded system with Samsung's ARMll processor S3C6400 as the core.
The software part of the terminal is based on the Linux operating system platform, and the TV player software combined with the SDK of the Taihe Zhiheng TV receiving module can realize the control and playback of digital TV.
2 Digital TV System Software Design
The system structure of digital TV consists of three parts: main interface, TV receiving module SDK and audio and video playback module, as shown in Figure 2.
The main functions of the three modules are as follows:
Main interface: provides the user interface of digital mobile TV, interacts with users, and provides functions such as playing TV, selecting channels, setting volume, and setting mute. TV receiving module SDK: digital TV control engine, encapsulates SPI driver, provides an interface to receive digital TV signals, provide audio and video data, control information, etc. Audio and video playback module: used to play audio and video data. [page]
2.1 Main interface
The specific work completed by the main interface includes: searching for available TV points; selecting TV channels to watch; detecting the current signal strength; reading received audio and video data; decoding received audio and video data; playing decoded audio and video data; recording the currently playing program; adjusting the volume; mute function.
The main interface uses the call to the Taihe TV receiving module SDK to read and write data through the SPI driver, and parses the received CMMB multiplexed subframe into H. 264 format video data, AAC format audio data and other data. Then call the player module to decode and play the H. 264 format video data and AAC format audio data.
2.2 TV receiving module SDK
The TV receiving module SDK provides control over CMMB TV signals, including: initialization of the TV chip, setting the frequency, scanning the frequency; obtaining channel information, setting the channel; receiving and stopping audio and video data; testing the strength of the TV signal.
This module is mainly composed of two submodules: the data processing module and the signal control module.
When the data processing submodule opens the engine, it will generate a thread, which is used to read the CMMB signal and analyze and process it. The process is shown in Figure 3.
This submodule is an infinite loop. In the loop, a flag is used to judge. If data needs to be processed, a frame of data is read first. If there is no data, it is blocked here. Then the frame of data is analyzed and put into the buffer of audio, video and other data respectively. Finally, the callback function is called to process various data and send the audio and video data to the audio and video playback module for playback.
Another submodule, the signal control module, mainly provides a control interface for the upper layer to call to complete the processing of CMMB signals. This submodule mainly includes the following functional interface functions: engine initialization: create a data reading thread and start initialization; engine opening: initialize the TV chip; set the frequency: set the current frequency; get ESG information: extract ESG information from the signal and analyze it; shut down the engine: clear the used resources and reset the hardware; get the channel information list: send a request and analyze the channel signal; set the channel: set the current channel; get parameters: can get signal strength, current channel and other parameters.
2.3 Audio and video playback module
Audio and video playback is completed by 3 threads. These 3 threads are video processing thread, audio processing thread and data receiving thread.
Video processing thread:
(1) First determine whether there is video data in the buffer queue. If not, sleep for 10 ms.
(2) If there is data, because the video data is queued in the buffer according to the timestamp order, take out the first frame and determine whether it is outdated. If it is very old data and has missed the playback time, determine the frame type. If it is a key frame, decode and display it. Otherwise, discard this frame and go to step (1).
(3) Otherwise, determine whether the playback time has arrived for this frame. If so, decode and display this frame data and then go to step (1).
(4) If the playback time has not arrived, sleep for 10 ms. Then go to step (1).
Audio processing thread:
(1) First determine whether there is audio data in the buffer queue. If not, sleep for 10 ms;
(2) If there is data, because the audio data is queued in the buffer according to the timestamp order, take out the first frame and determine whether it is outdated. If it is very old data and has missed the playback time, discard it and go to step (1);
(3) Otherwise, determine whether the playback time has arrived. If so, decode and play this frame of data, and then go to step (1);
(4) If the playback time has not arrived, sleep for 10 ms. Then go to step (1).
Data receiving thread: The data receiving thread does not belong to the player module, it is part of the TV receiving module.
(1) If there is data arriving, determine whether there is video data. If so, insert them all into the video buffer;
(3) Block and wait for data to arrive;
(4) When data arrives, go to step (1).
The audio and video player module has a total of 4 submodules: buffer management, audio and video synchronization, audio and video decoding, and video display.
2.3.1 Buffer management
A total of 2 queues are designed, the audio buffer queue and the video buffer queue. Each frame of data is put into the buffer, and the members are frame length, frame type (video has, audio does not), timestamp, and data pointer. The frame length indicates the length of the frame data. In the frame type, 1 indicates a key frame and 0 indicates a non-key frame. The timestamp indicates the time when the frame data is played, and the data pointer points to the frame data buffer. When new data arrives, construct a frame member, fill in various parameters, and then insert it into the buffer queue according to the timestamp, with the one with the latest playback time placed in front. The process is as follows:
(1) First construct a frame buffer member;
(2) Fill the frame buffer according to the content of the frame data;
(3) According to the timestamp, put it into the buffer queue according to the principle of the latest one in front.
2.3.2 Audio and Video Synchronization
Audio and video data are always synchronized with the system time. When initialized, 1 s of data is first stored in the buffer. Because the system time and the timestamp of the sent data are not necessarily the same, the absolute time is not used. Instead, the timestamp of the first frame in the buffer is used as the start time, and the subsequent data is based on the relative time difference with this frame of data.
The process of video and system time synchronization is as follows:
(1) Determine whether the buffer queue is empty. If it is empty, sleep for 10 ms;
(2) If it is not empty, take a frame from the buffer queue and determine whether the frame data is outdated. If it exceeds the playback time by more than 100 ms, determine the frame type. If it is a non-key frame, discard the frame data. Otherwise, process the frame data and jump to step (1);
(3) If the frame data has just exceeded the playback time and the exceeding time does not exceed 100 ms, process the frame data and jump to step (1). [page]
The processing flow of audio and system time synchronization is as follows:
(1) Determine whether the audio buffer is empty. If so, sleep for 10 ms;
(2) If not, take out a frame of data and determine whether the playback time has exceeded 100 ms. If so, discard this frame of data and jump to step (1);
(3) Otherwise, process this frame of data and jump to step (1).
2.3.3 Audio and video decoding
The audio of digital mobile TV signals is currently encoded with AAC, which is decoded using the open source decoding library libfaad2. The usage flow of libfaad2 is as follows:
(1) First configure the decoder and set some decoding parameters, such as sampling rate, number of channels, etc.;
(2) Then initialize the decoder;
(3) If there are audio frames that need to be decoded, call NeAAC-DecDecode in sequence to decode;
(4) When all audio frames are decoded, the decoder needs to be closed.
Samsung's S3C6400 chip provides a hardware codec for multiple video formats, referred to as MFC (Multi-format Video Codec), which supports the following functions: MPEG-4 Simple Profile codec; H. 264/AVC Baseline Profile codec; H. 263 P3 codec; VC-1 (WMV9) Main Profile codec; supports multi-tasking, such as completing 1-way encoding and 3-way decoding at the same time; supports multiple formats, such as MPEG-4 encoding and H. 264 decoding at the same time. Theoretically, MFC performance can achieve full-duplex 720*480 30 frames/s (or 720*576 25 frames/s) encoding and decoding. The
MFC driver is responsible for directly controlling the MFC hardware to complete the actual encoding and decoding operations, and provides an interface similar to a character device; the MFC API encapsulates the control interface of the underlying driver and provides the upper layer with an interface method for function calls. The decoder call process is shown in Figure 4.
2.3.4 Video Display
For the decoded data, the YUV format must first be converted to RGB format, and the conversion can be performed using hardware. The PostProcessor (hereinafter referred to as Post or PP) provided by Samsung's S3C6400 chip supports the following functions: video/image scaling; video format conversion; color space conversion (RGB<一>YUV); video input supports 420, 422 formats, and output supports YCbCr420, YCbCr422 formats; image format supports 16-bit RGB (565 format) and 24-bit RGB; the maximum resolution supports 2 048×2 048; supports single frame mode (Per Frame Run Mode) and automatic mode (Free Run Mode).
3 Conclusion
This digital TV system can realize stable and reliable control of CMMB signals and has a complete normal or abnormal exit mechanism. When receiving audio and video data of CMMB standard (H.264 320*240/AAC), the playback rate reaches 25 frames/s. The picture is smooth, with little pause and no obvious mosaic. It has a friendly interface, simple operation, stable functions and high real-time performance.
Previous article:Research on fall protection device based on STM32
Next article:Design and implementation of digital signal source based on LPC2132
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- An SI engineer who does not understand processing cannot be called Mr. High Speed
- EEWORLD University Hall----Live Replay: Use ModusToolbox? to build a system to flexibly respond to IoT design challenges
- Why is the square wave voltage generated by the inverter circuit measured using the AC voltage range of a digital multimeter much smaller than the theoretical value?
- Design of three-coordinated distributed control system based on TMS320F2812 DSP
- Several ways to accurately delay the microcontroller
- Bluetooth tester function details!
- Electric heater - "silent" transformation
- Application Development Notes | Mir MYD-YA15XC-T LoRa Wireless Communication Example
- Advanced Driver Assistance System Solution Series Introduction—Digital Camera
- Prize-winning quiz | ADI application tour - water quality and gas monitoring