Implementation of Web Services on TM1300

Source: Internet
Author: User
Implementation of Web Services on TM1300
[Date:2008-8-4] Source:Electronic Technology ApplicationAuthor:Su Yujie Li xueming [Font:Large Medium Small]

TM1300 is a multimedia processor specially designed by Philips for audio, video, and other multimedia applications. In addition to the basic functions of DSP, This processor is also optimized for audio and video applications, the integration of video input/output, audio input/output, and high-speed synchronous serial communication interfaces is widely used in multimedia information processing. Figure 1 shows the system structure of the multimedia processing platform designed by the author.

 

The core of the system is the TM1300 chip that runs the PSOs operating system. The Video Input and Output interfaces use the video input/output units provided by TM1300, combined with peripheral video A/D and D/A chips. Among them, video A/D uses Philips SAA7111, while D/A uses saa7121. They can be seamlessly connected to TM1300. In fact, all video A/D and D/A chips compatible with ccir656/ccir601 can be directly connected to the input/output unit of TM1300.
The A/D and D/A chips on the audio input/output interfaces use the ad1849 stereo processing chip of Analog Devices. Ad1849 is a 16-bit serial interface stereo signal decoder. It has multiple input channels and output channels, and supports four encoding modes: μ-rate PCM, A-rate PCM, 16-bit linear PCM, and 8-bit unsigned PCM.

In addition to audio and video interfaces, CS8900-based Ethernet interfaces are also designed to directly send multimedia processing results to Ethernet. RS-232 interface is another universal interface of this design, the computer can control the operation of the system through this interface, and obtain the system running status.
In the actual application process, the parameters of the multimedia processing platform need to be adjusted frequently because the user requirements are different and change frequently. In some cases, the parameters must be adjusted in real time. Although these functions can be achieved through the RS-232 interface, but this requires the operator to go to the scene to use a computer to control the multimedia processing platform, it is very inconvenient. Therefore, it is an inevitable choice to design an embedded web server and control the entire platform using the network. On the one hand, it can provide users with a visual graphical interface to facilitate various parameter control; on the other hand, users can adjust parameters at any time to meet their own needs.
1. Difficulties in Embedded Web Server Development
When talking about Web servers, people will naturally think of common Web servers, such as Windows IIS, Apache, CERN server, and Netscape.
Enterprise Server. Because these servers Program Is very powerful, usually need to run on high-performance computers, in order to provide users with high-speed, concurrent access.
Compared with Web service programs running on computers, Web services running on TM1300 have many unique features:
First of all, although the operational processing capability of TM1300 is very powerful, because its main function is to complete multimedia information processing, the system resources available for Web services are very limited. This means that traditional Web service programs cannot be directly transplanted to TM1300, but their functions must be reduced to remove unnecessary functions and reduce their resource requirements, improve operation efficiency.
Secondly, TM1300 does not have its own file system. This means that you cannot rely on the file system to store webpages. Instead, the web server must maintain and provide web pages with different functions.
In addition, because the Web Service is mainly used to control the operation parameters of the multimedia platform, there is usually no large external access traffic. Therefore, the functions of web servers are relatively simple.
Based on the above features, I designed a web server program running on TM1300. The program first parses the received HTTP message, then calls different processing programs for processing, and finally sends the processing result back to the browser as an HTTP message.
2. Implementation of Web Services on TM1300
This Web service program is mainly responsible for receiving requests sent by the IE browser, analyzing and processing the requests, and returning the processing results to the browser in HTML format. The core is to analyze HTTP requests. The following describes how to modify the image encoding size.
Assume that you want to modify the size of the image processed by the multimedia platform at a certain time. Then, access the designed web server through the IE browser and obtain the interface shown in Figure 2 (. After you enter an appropriate value in the text box, click "OK". ie will send the HTTP message shown in Figure 2 (B) to the web server.

 

The most important is the first line and the last line. In the first line,/changimagesize tells the server program user to modify the image size. Xsize = 352 and ysize = 288 in the last line indicate the new image size. Because HTTP packets are in plain text format [1], the Web service program needs to analyze the first line of text, obtain the string between the string "Post" and "HTTP" to determine the type of user operation.
Next, you need to find the Content-Length line from the HTTP header information [2. If Content-Length = 0, there is no parameter after it. Otherwise, the HTTP data package contains information submitted by the user, and the length value of the information is the value of Content-Length.
Assume that the user has a message body in the HTTP message, first you need to find a blank line (that is, a line after cache-control: No-Cache ), because it is the line between message body and HTTP header information. Next we need to analyze the content of the message body. This work is very simple, that is, the text string is divided into three parts according to the character '&', namely: xsize = 352, ysize = 288, submit = % CC % E1 % BD % BB. Then, the parameter name and corresponding value are further distinguished based on the character '=. The analysis shows that the xsize value is 352, And the ysize value is 288.
By parsing HTTP messages, you can determine the parameters required for the operations and operations you need to complete, and then control the underlying hardware or software to complete your requests.
It can be seen that the core work of the server program is to parse the HTTP data packet and decide the next step. For the preceding example, the web service program must first control the video input/output interface to change the size of the input/output image. Then, it must output the HTTP packet to the IE browser, figure 3 shows the HTTP data packets generated by the Web Service Program and the interface displayed by the user.

 

Figure 3 (a) is the HTTP message sent back from the server to IE browser. The first line of HTTP/1.1 200 OK notifies IE browser that the request has been processed by the server. The following line shows the processing time of the server. Content-Type: text/html this line notifies IE browser that the content transmitted by the HTTP message body is an HTML webpage in plain text format. The blank lines below are the boundary between the HTTP header information and the HTTP message body. After the IE browser obtains the HTTP header information, it can call the corresponding HTML Parser to parse the content according to the format of the message body, and display the resolution result in the browser window.
3. Communication between Web service processes and other processes
The multimedia processing platform needs to process audio, video, and network communication at the same time, that is, multiple tasks must run simultaneously at the same time, and communication between these tasks is required. For example: after the user changes the system encoding parameters, the web server needs to notify the video encoding process so that they can adopt new parameters in the subsequent encoding process. Since TM1300 runs the PSOs system, while PSOs only has processes and no threads, the Web service program runs as a separate process. When you need to communicate with other tasks, the semaphore method is used. Figure 4 shows the process of inter-process communication between Web service processes and video encoding processes.

 

first, an area is opened in flash to store the parameters to be modified. When the Web server receives a request for modifying parameters submitted by the client, the following steps are taken: (1) the Web service process locks the semaphore; (2) the Web service process writes user-submitted parameters to the parameter zone; (3) the Web server process releases the semaphore; (4) the Web service process sends signals to the video processing process. [3], notify the video encoding process to read parameters. (5) The video processing process locks the semaphore. (6) The video processing process reads parameters. (7) The video processing signal releases the semaphore. After a series of operations, the communication between the Web server process and the video encoding process ends, and a parameter modification is completed. Communication between Web service processes and Audio Encoding processes is similar to the preceding process.
This article focuses on the methods and specific implementation of Embedded Web servers on TM1300. By adding web services to the existing multimedia processing platform, you can use web pages to monitor the running status of hardware and modify system running parameters online, this reduces the difficulty of using the system, increases the friendliness of interaction, and enhances the functions and availability of the system. At present, the Web Service developed by the author has been running stably on TM1300. The next step is to expand its functions and provide the network management function.
references
1 RFC 822. standard for ARPA Internet text messages [s]. 1982
2 rfc2616.hypertext transfer protocol ---- HTTP/1.1 [s]. 1999
3 W. richard Steven S, translated by Yu jinyuan. advanced Programming in UNIX environment. beijing: Machinery Industry Press, 2000

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.