How to Implement EPG on STB

Source: Internet
Author: User

Reprinted: http://blog.chinaunix.net/uid-22028680-id-3208043.html

 

1. The channel is locked by the input frequency, symbol rate, and modulation method.

2. Receive the Pat table on the current channel. If it is known that the PID of Pat is fixed to 0, the Pat table will be parsed and saved.

3. Obtain the NIT table pid from pat:

If program_number is 0, network_pid is obtained. Of course, the NIT table PID is fixed as 0x0010 is also a solution, but this solution is not the most basic method.

Note: If the nit pid cannot be found from the Pat table, the nit pid is 0x0010 by default.

4. Obtain, parse, and save the NIT table based on the NIT table PID.

5. Obtain network_name_descriptor from the first Descriptor () in the NIT table to obtain the network name. This generally describes the name of the network carrier, which can be displayed on the screen and displayed as needed, not Required

6. Obtain the Channel Resource Information table cable_delivery_system_descriptor () managed by the current network from the second Descriptor () loop in the NIT table (), we can obtain the key field values frequency (frequency), modulation (modulation method), and symbol_rate (symbol rate) of all the channels ). So far, all network information resources have been obtained, which is a critical step.

7. Create a loop based on the above network information and lock different channels respectively.

8. Receive the current Pat table (pid = 0) on the locked channel ). By analyzing the program_number field, you can know the total number of programs (services) played on the current channel, record the PMT table of each service, parse and save it.

9. The PID of a pmt table can receive the PMT table of the program, parse and save it.

10. Obtain the following key fields in the PMT table: pcr_pid, and obtain the basic PID (elementary_pid) of the stream corresponding to stream_type, for example, when stream_type = 0x02, if the video stream is used, elementary_pid indicates video_pid. When stream_type = 0x04, elementary_pid indicates the audio stream. At this time, elementary_pid indicates audio_pid ..

Here, we should pay attention to the situation where a video is equipped with multiple audio PIDs. Note: At this step, you can play a program. Note: In the first Descriptor () loop of the PMT table, check whether there is a ca_descriptor () description. If so, obtain the ca_system_id and ca_pid. The two PIDs can be used to obtain more detailed information about the ca. No more detailed explanation and description about the CA is provided here.

11. When receiving SDT tables, the PID is fixed to 0x0011. Note: Because SDT and BAT have the same PID, table_id should be used to distinguish between them, table_id = 0x4a indicates the bat table. table_id = 0x42 indicates the SDT table of the current service description, which is parsed and saved.

Description: table_id = 0x46 indicates the service description SDT table on other channels.

12. Through service_id (corresponding to program_number In the PMT table) find the name of the respective service (program name, such as: CCTV-1, etc ). Find service_descriptor () in service_id In the SDT table, from which SERVICE_NAME (such as: CCTV-1) can be obtained ).

Note: free_ca_mode cannot be used as a flag to determine whether the program is encrypted, because this field is not modified in some disturbing devices, such as The Barco disturbing device. Note two special fields: eit_schedule_flag. When this value is 1, a schedule is displayed on the current channel (used to report the one-day or even one-month program announcements contained in a service ). When eit_present_following_flag = 1, The/follow event information table (current time/next time) appears on the current channel ).

13. Collect program information from Step 8:

Note: At this point, except for the program time and content information, other program information has been collected, including the following:

1. Total number of channels.

2. How many sets of programs can be played on each channel.

3. The name of each program, such as pcr_pid, v_pid, and a_pid.

Based on the above information, you can organize menus to play the program.

Note: To obtain the program name in multiple languages, use the country_availability_descriptor () field in the SDT table as country_code = "CHN" to indicate Chinese characters, and "eng" to indicate English letters ", but you must know that country_availability_descriptor () is not necessarily broadcast, that is, this table may not exist.



How to obtain program content and time information

I. Receiving TDT tables

The PID of the TDT table is fixed to 0x0014, which is available on all channels and the field is otc_time. For example, 0xc079124500 represents: 1993/10/13, 12:45:00. After obtaining the time, the STB timer automatically calculates the later time.

Ii. Receiving EIT tables:

You can obtain all the EIT tables on any channel. The PID of the EIT table is fixed to 0x0012.

When table_id = 0x4e, it indicates the actual occurrence/follow event information on the current channel.

When table_id = 0x4f, it indicates the occurrence/follow event information on other channels.

When table_id = 0x50-0x5f, it indicates the program schedule on the current channel.

When table_id = 0x60-0x6f, it indicates the program schedule on other channels.

When table_id = 0x4e or 0x4f, how does one distinguish between the current time and the following time? Section_number indicates the current time. When section_number = 0x00, it indicates the current time. When section_number = 0x01, it indicates the next time. There are several key fields in the EIT table. One is transport_stream_id indicating the channel, which corresponds to the SDT table. service_id indicates the service number (program number) and corresponds to program_number In the PMT table, how can we get the event information of a program?

First, locate the channel: transport_stream_id and find the program service_id to be detected under this channel.

When table_id = 0x4e, it indicates the current channel. If the transport_stream_id of the current channel in the current hand matches the transport_stream_id in the EIT table under this condition, the description is correct.

Next, obtain the current information. The method is to determine the segment of section_number = 0x00 and find start_time. the start time of the event, duration, and duration + start_time are the end time of the event (Program. The short_event_descriptor () in Descriptor () can be used to obtain the program name and program description information in multiple languages. The key is iso_639_language_code (such as "CHN") and event_name_char (such as "news broadcast "), text_char (Program Introduction ).

In digital TV, the introduction section does not take (text_char ).

Note: When table_id = "0x4e" or "0x4f", only one event is described in. Only when table_id = 0x50-0x5f or 0x60-0x6f is available. Similarly, when the information at a time is removed, the condition to be judged is section_number = 0x01.

Here is a special case that needs to be handled. When running_status = 0, it indicates the NVOD reference event description. Duration, start_time, event_name_char, and text_char are not in the EPG category of DTV, in this case, you need to block it.

Through the loop of the above conditions, you can obtain all the program schedules and content on a physical channel, including one day or one week, one month or two months of program previews. So far, a complete EPG can be formed.

Note:

1. After receiving a table, you must save version_number. When receiving the table for the second time, if version_number is changed, you must begin to receive all associated tables again.

2. An optional mechanism is to receive the RST table, which is used to describe the status changes of the EIT table. The broadcast of an rst table is not mandatory and cannot be used as a necessary condition for receiving an EIT table.

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.