IPTV, or IPTV, is an emerging network application that uses the infrastructure of broadband Internet to provide home TV as the main terminal and provides various digital media services including TV programs through Internet Protocol (IP). Its value-added business technology. The biggest advantage of IPTV is "interactive" and "on-demand viewing", which completely changed the characteristics of traditional TV one-way broadcasting  . Its appearance has greatly satisfied the needs of users (the users in the text refer to the consumers who installed the IPTV client, and the customers refer to the IPTV service providers and operators) to enjoy online video. The development of IPTV is very rapid. Internationally, UTStarcom, Microsoft, Siemens, Alcatel, Hewlett-Packard, etc., domestic manufacturers such as Huawei, ZTE and Shanda have invested in the development and research of IPTV. Foreign countries already have IPTV commercial operation systems, and Video Networks of the United Kingdom launched the IPTV service as early as 1999. Up to now, the first IPTV has been put into commercial application in Shanghai, and China Telecom has conducted IPTV pilots in five provinces and cities. IPTV has broad development prospects both at home and abroad.
In order to provide "interactive" and "on-demand viewing", the system needs to provide an interface for interacting with the user for the user to browse the program information provided by the system and select the program to be enjoyed. This interface is provided by the EPG (Electronic Program Guide) server in the IPTV system. The EPG is an interactive programming schedule of current and future program information that the user navigates by operating the remote control  . The EPG module is critical throughout the IPTV system and is the gateway to the entire IPTV system. EPG provides users with an easy-to-use, user-friendly way to quickly access programs. Therefore, the user's evaluation of the entire IPTV system depends to a large extent on the EPG. Providing an easy-to-use, fast, stable, and aesthetically pleasing interface is the primary goal of the EPG.
2 IPTV system structure model
Figure 1 is a structural model of an IPTV system. This model has been put into practical use in some cities in China. In this model structure diagram, the entire IPTV system is divided into two parts: the background part and the user access part. The background part mainly provides management of media content, user management, server management of the entire system, user authentication and billing management, and the like. The user access part provides video services and other services for users. It can be divided into multiple areas according to the size of the city. Each area mainly has regional media base stations and EPG servers. The user uses the set-top box    plus the TV or PC as the terminal, and the program or live TV program stored by the ADSL or the cell broadband viewing system. The set-top box is a simple computer with CPU, memory, network connection device, decoder and other hardware and operating system and application software. It receives the video signal transmitted through the broadband IP network. The signal is processed and displayed on the TV. come out. The user uses the functions provided by the set top box by manipulating the remote control.
The user is divided into multiple areas, each of which is deployed with multiple regional media servers and EPG servers. The video service and interaction interface of the user are provided by the media server and the EPG server in the area where the user is located. This deployment method is easy to expand and is suitable for large-scale deployment. Adding an area only requires adding regional media base stations and EPG servers, which will not affect the background and other areas. At the same time, most of the user's data traffic is concentrated in their own area, reducing the burden on the backbone network, and the collapse of a single regional system will not affect other areas.
The working process of the system is roughly as follows: 1 The media source is processed by the media processing module into a format defined by the system, stored on the primary media base station, and the media distribution management module in the background is responsible for distributing the programs to each of the following areas. In the media base station. 2 At the same time, the information about the program is also sent to the EPG server for the EPG to display to the user. 3 After the user is booted and authenticated in the background, log in to the EPG server and start browsing the program information of the system. 4 When the user selects a program to view, the EPG sends the program information and the user's information to the background portion, and the user management portion of the background determines whether the user can enjoy the program. If so, the user's set top box sends the media set to the local base station. A request to play a program. 5 After the playback is completed, the set-top box sends a request for deducting the corresponding charge to the background, and at the same time redirects to the EPG server, and the user can continue to browse the program and enjoy the program.
Considering that IPTV is still in the development stage at home, there are not many users in one region. At present, the system is designed to support up to 3000 users in one area, and the number of users accessing the EPG server at the same time does not exceed 500. When the number of users increases, an EPG server cluster can be used. In Figure 1, a primary EPG server is deployed in each zone. For system stability, a standby EPG server is also deployed.
3 EPG module design
From the deployment application of IPTV system in China, EPG module is the module with the largest and fastest change in demand in the whole system, and it is a module directly displayed to customers, which largely determines whether the customer adopts our system. When designing the overall frame, the module mainly considers the following principles:
(1) Clear structure and rapid development. The customer's demand changes are very fast. In design, we must first consider the ability to develop a new interface in the shortest time according to the customer's requirements. The clear structure design is conducive to rapid development.
(2) Easy to maintain. It allows customers to modify some of the EPG code or modify some configurations without a good understanding of the EPG code and implementation, without affecting the operation of the EPG.
(3) Convenient for customer customization. Customers may request to make their own EPG. Therefore, the design should take into account the ability to quickly and easily make the customer understand the EPG production process, and master the production of EPG in a short period of time.
(4) Performance meets design requirements. To meet the design performance requirements, mainly consider server optimization, database optimization.
(5) The interface is simple and beautiful, with good scalability and openness. Easy to support new business, compatible with set-top boxes from different manufacturers.
There are two main options for EPG implementation, local application and interactive implementation  . At present, domestic and foreign EPG designs are basically for digital TV, and their EPG implementation generally adopts local application solutions. The local solution has higher hardware requirements for the set-top box and does not do well in terms of interactivity with the user. IPTV is a system that is highly interactive with users and is designed and implemented to fit the second option.
In this model, the EPG implementation selects an interactive solution that uses an EPG server to provide an HTML page to the set-top box. The program information of the system is stored in the database, and the server retrieves the program information from the database, and provides the set-top box in the form of an HTML page, and the set-top box parses the page and presents it to the user. In this way, for the PC user, the browser that comes with the user can browse. For users using set-top boxes, the set-top box is required to implement the ability to parse HTML pages.
In this article, focus on the EPG design of the set-top box, the specific implementation of Linux + Apache + MySQL + PHP, the entire framework of the program design based on the idea of â€‹â€‹the MVC model.
3.1 MVC design pattern
Model-View-Controller is a classic software design pattern. It uses the idea of â€‹â€‹divide and conquer to divide the system into three modules, each of which bears its responsibility. The relationship is shown in Figure 2.
(1) Model. Responsible for maintaining data and providing data access methods. The model has only a purely functional interface, which is a series of open methods. Through these public methods, all the functions of the model can be obtained.
(2) View. The data used to display the model. There can be multiple views in an MVC model.
(3) Controller. The user can change the state of the model through the view, which is done by the controller. The controller is responsible for invoking the model's value-added method to change the state of the model. At the same time, the controller notifies all registered views to refresh the data display.
The MVC system effectively realizes the separation of presentation and data, and can conveniently display multiple sets of data in multiple views, so that the system can easily support other new client types, and can well express user interaction. From the domestic application situation, most customers have different requirements for the display interface, and there are a few differences in the processing logic of the program. With the MVC mode, it is very convenient to respond to changes in customer needs, and it is easy to provide different display interfaces for customers to choose.
3.2 concrete implementation
According to the design purpose and the MVC mode, considering that the terminal device used by the user is a set top box, the client needs some special processing related to the set top box, and the implementation process of the server processing request is divided into five levels, as shown in FIG.
(1) Page display layer. Responsible for the display of system program information.
(2) Client processing layer. Responsible for some special processing before the request is sent and after the request processing result is returned. The user-side processing layer is added here because the current user's terminal is a set-top box, and the function of the set-top box browser is not very strong. EPG is required to do some processing when the user turns to another page or returns to the original page, such as recording the position of the cursor and initializing the cursor position.
(3) Request and response layers. Responsible for some processing after the request arrives at the server and before the processing result is returned to the client.
(4) Logic processing layer. Responsible for processing customer requests.
(5) Data access layer. Responsible for providing an interface to get data from the database.
We illustrate the process of processing a request using the idea of â€‹â€‹the MVC pattern with an example showing a popular movie. The process of processing a display of a popular movie request is shown in Figure 4.
The process is as follows:
(1) The user clicks â€œLatest Movieâ€ on the homepage, and after the client control layer processes (closes the advertisement video played on the homepage), the request is submitted to the server for processing.
(2) The request and response layer starts processing the request, saves the state related to the previous page, and initializes some variables (such as the class that takes the data, and the variable that holds all the information of the page).
(3) The logical processing layer calculates the starting position and number of popular movies to be taken in the database.
(4) Call the interface of the data access layer to start to retrieve the information of the popular movie (program name, price, introduction, poster picture name, etc.) from the database.
(5) The logic processing layer converts the retrieved data, and all the converted data is stored in a variable, and this variable is passed to the page displaying the result.
(6) The request and response layer calls the page displaying the result and the control code of the client to generate the HTML code.
(7) The set-top box parses the passed HTML page, initializes the cursor position, and displays the popular movie information to the user.
Prior to development, the interfaces defining the pre-defined page display layer and the logical processing layer, the logical processing layer, and the data access layer were defined in the design document. Each part of the developer only has to care about what they are doing, and use the interfaces provided by other layers to call the functions of other layers. In this way, the development of each part can work in parallel, greatly improving the development speed.
The data access layer and the logical processing layer make it easy to write unit tests to test your own code, independent of the code of other layers, which greatly improves the quality of the software. At the same time, the maintenance is also very convenient. If the requirements change, you only need to change the code of the level where the requirements change, and don't care if other layers of code need to be changed.
3.3 EPG performance test
In order to test whether the EPG performance meets the original design requirements, the performance of the EPG server is tested using the LoadRunner test tool. The most important indicator is the transaction response time when the number of concurrent users is different. It is the most important indicator of server performance.
The tested hardware environment is: CPU Intel (R) Pentium (R) 4 2.40 GHz, 1 GB of memory, 1 GB / s of network card. The software environment is: operating system RedHat 9.0, Apache 2.0.50, MySQL 4.0.21, PHP 4.3.9RC3-dev, Squid 2.5 STABLE1.
LoadRunner simulates testing the number of concurrent users to 220, 500, testing the EPG server's transaction response time and transaction completion. Server response time and transaction completion test data are shown in Table 1 and Table 2. From the test data, when the number of concurrent users is 500, there is no transaction failure, and the average response time does not exceed 3 seconds. This time is acceptable to the user. Explain that the EPG is developed using this design method, and the performance of the server has reached the pre-required requirements.
As can be seen from the above tests and analysis, the development of the EPG using the design method described above generally achieves the pre-design principles.
This paper describes the design and implementation of an IPTV system model and its EPG module. It also proves that our design method is correct and feasible for the rapid development of easy-to-maintain and easy-to-expand EPG. With the development of IPTV and the increase in the number of users, it is necessary to conduct more in-depth research on the performance of the server and the personalization of the EPG in the future.
 Pay attention to IPTV attention to network development [EB/OL]. http:// ?newsid=200563111314246&classid=112111 2005.12.16
 Electronic Program Guide (EPG) [EB/OL]. http:// 2005.12.16
 Ciciora W S. Inside the Set-Top Box. In IEEE Spectrum [C]. 1995, (4): 70~75
 Perkowsky S, Jaeger R. The Set-Top Box as MultiMedia Terminal [C]. In IEEE Transaction on Consmer Electronic, 1998, 44(3): 833~840
 Lin Sheng, Lin Guohui, Quan Ziyi. A NIU Implementation of ATM Network Set Top Box[J]. Television Technology, 2000, 6(216): 40~42
 A lur D. J2EE core model [M]. Niu Zhiqi translation. Beijing: Mechanical Industry Press, 2002.
 Wang Zhiming, Zou Daowen, Zhou Yuanhua. Research on Electronic Program Guide System in Digital Television[J]. Digital Television and Digital Video, 2002, 11(245): (4~6)