Method and device for extracting program information, computer-readable storage medium, and terminal
By using reverse setting field filtering and asynchronous reporting mechanisms in digital TV terminals, the problem of high terminal overhead in the existing technology is solved, high efficiency and low power consumption in program information extraction are achieved, and system performance is optimized.
Patent Information
- Application Number
- CN202211459336.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-21
- Publication Date
- 2024-10-29
- Estimated Expiration
- 2042-11-21
AI Technical Summary
Existing digital TV terminals have a large overhead when parsing and processing PSI and SI, resulting in high CPU usage and increased power consumption. In addition, there are invalid reports of repeated segments, which affects system performance.
By obtaining the identification information of the current segment, determine whether a reverse setting field is configured, and report the current segment when its data is different from the data of the previous segment, use the reverse setting field for filtering, and dynamically allocate memory only Store when segments change and use an asynchronous reporting mechanism to reduce system congestion.
It reduces CPU occupancy and terminal power consumption, avoids repeated segmentation reporting, optimizes memory utilization, and improves program information extraction efficiency and system performance.
Smart Images

Figure CN115834949B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of television communication technology, and in particular to a method and device for extracting program information, a computer-readable storage medium, and a terminal. Background Art
[0002] Digital TV is the third generation of TV after black and white analog TV and color analog TV. Compared with analog TV, digital TV has higher picture quality, more powerful functions, better sound effects, richer content, and usually has interactive functions.
[0003] In order to meet the needs of viewers to search or select programs, the MPEG-2 standard defines Program Special Information (PSI) and Service Information (SI). PSI can be used to find a specific program from a digital bit stream carrying multiple programs, and SI can be used to form an Electronic Program Guide (EPG).
[0004] PSI and SI are usually encapsulated as a transport stream (TS) and mixed with the TS of audio and video data for transmission. After receiving the TS, the terminal (for example, a digital TV set-top box) can obtain the PSI and SI in the TS by parsing the TS. Further parsing PSI and SI can obtain program information, such as which channels are currently available on the real network, which audio and video streams are available on each channel, the encoding format information corresponding to each stream, and the start and end time of each program.
[0005] Under different operators or networks, the frequency of sending PSI and SI varies greatly. In order to avoid losing some program information, the terminal usually parses and processes each received PSI and SI. With such a solution, the terminal has a large overhead. Summary of the invention
[0006] One of the technical objectives solved by the present application is to provide a more optimized method for extracting program information.
[0007] To solve the above technical problems, an embodiment of the present application provides a method for extracting program information, the method comprising: obtaining a current segment, the current segment having identification information; determining whether a reverse setting field is configured and / or whether the reverse setting field is used, and if the determination result is yes, reading data corresponding to the reverse setting field from the current segment and recording it as current reverse data; if the current reverse data is different from the data corresponding to the reverse setting field in the previous segment corresponding to the identification information, reporting the current segment.
[0008] Optionally, the method further includes: reading data corresponding to a forward setting field in the current segment, recording the data as current forward data; and reporting the current segment if the current forward data is consistent with a set value.
[0009] Optionally, reading the data corresponding to the forward setting field in the current segment includes: if the reverse setting field is not configured and / or the reverse setting field is not used, reading the current forward data.
[0010] Optionally, determining whether a reverse setting field is configured includes: determining whether a reverse setting field corresponding to the identification information is configured.
[0011] Optionally, before reporting the current segment, the method further includes: if the current reverse data is different from the data corresponding to the reverse setting field in the previous segment, storing the current segment in a circular linked list corresponding to the identification information; otherwise, discarding the current segment.
[0012] Optionally, the method further includes: if the current reverse data is different from the data corresponding to the reverse setting field in the previous segment, sending a notification message to an upper layer.
[0013] Optionally, the method further includes: receiving a reporting request from an upper layer, the reporting request carrying identification information; reading and reporting the segment stored in the linked list header from a circular linked list corresponding to the identification information carried by the reporting request.
[0014] Optionally, the method further includes: obtaining an updated reverse setting field from an upper layer, wherein the updated reverse update field depends on the current segment.
[0015] An embodiment of the present application provides a device for extracting program information, the device comprising: an acquisition module, used to acquire a current segment, the current segment having identification information; a filtering module, used to determine whether a reverse setting field is configured and / or whether the reverse setting field is used, and if the determination result is yes, read data corresponding to the reverse setting field from the current segment and record it as current reverse data; a reporting module, used to report the current segment if the current reverse data is different from the data corresponding to the reverse setting field in the previous segment corresponding to the identification information.
[0016] An embodiment of the present application provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of the program information extraction method are executed.
[0017] An embodiment of the present application provides a terminal, including a memory and a processor, wherein the memory stores a computer program that can be run on the processor, and the processor executes the steps of the above-mentioned method for extracting program information when running the computer program.
[0018] In order to solve the above-mentioned technical features, an embodiment of the present application also provides a program information extraction device, which includes: an acquisition module, used to acquire the current segment, and the current segment has identification information; a filtering module, used to determine whether a reverse setting field is configured and / or whether the reverse setting field is used, and if the judgment result is yes, read the data corresponding to the reverse setting field from the current segment and record it as current reverse data; a reporting module, used to report the current segment if the current reverse data is different from the data corresponding to the reverse setting field in the previous segment corresponding to the identification information.
[0019] The embodiment of the present application further provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of the above-mentioned method for extracting program information are executed.
[0020] An embodiment of the present application further provides a terminal, including a memory and a processor, wherein the memory stores a computer program that can be run on the processor, and the processor executes the steps of the above-mentioned program information extraction method when running the computer program.
[0021] Compared with the prior art, the technical solution of the embodiment of the present application has the following beneficial effects:
[0022] In the scheme of the embodiment of the present application, the current segment is obtained, and the current segment has identification information; it is determined whether a reverse setting field is configured and / or whether the reverse setting field is used. If the judgment result is yes, the data corresponding to the reverse setting field is read from the current segment and recorded as the current reverse data; if the current reverse data is different from the data corresponding to the reverse setting field in the previous segment corresponding to the identification information, the current segment is reported. In the scheme of the embodiment of the present application, the reverse setting field is configured, and the current segment is reported when the data corresponding to the reverse setting field changes. That is, duplicate segments are filtered through the reverse setting field to avoid reporting of duplicate segments, thereby avoiding frequent interactions between the upper layer and the bottom layer, which is beneficial to reduce CPU occupancy and terminal power consumption in the scenario of extracting program information.
[0023] Further, in the solution of the embodiment of the present application, if the current reverse data is different from the data corresponding to the reverse setting field in the previous segment, the current segment is stored in the circular linked list corresponding to the identification information, otherwise the current segment is discarded. With such a solution, memory is allocated for storage of the segment only when the segment changes. The method of dynamically allocating memory is conducive to reducing memory usage when extracting program information.
[0024] Further, in the solution of the embodiment of the present application, a reporting request from an upper layer is received, the reporting request carries identification information; the segment stored in the linked list header is read and reported from the circular linked list corresponding to the identification information carried by the reporting request. The above asynchronous reporting solution is conducive to avoiding system blocking. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] Figure 1 This is a schematic diagram of an application scenario of a method for extracting program information in an embodiment of the present application;
[0026] Figure 2 It is a flowchart of a specific implementation method of reporting segmentation in an embodiment of the present application;
[0027] Figure 3 is a flow chart of another method for extracting program information in an embodiment of the present application;
[0028] Figure 4 It is a structural schematic diagram of a device for extracting program information in an embodiment of the present application. DETAILED DESCRIPTION
[0029] As described in the background art, the terminal usually parses and processes the PSI and SI received each time. Using such a solution, the terminal has a large overhead.
[0030] After receiving the table information data (such as PSI and / or SI) packaged as TS, the bottom layer of the terminal filters out different tables according to the packet identifier (PID) and table identifier (table_id) set by the upper layer, and then reports the filtered tables to the upper layer for parsing, so as to extract the program information. It should be noted that the upper layer generally refers to the user space, and the bottom layer generally refers to the driver kernel space. For example, the upper layer referred to in the embodiment of the present application may be the application layer, and the bottom layer may be the driver layer.
[0031] In the embodiment of the present application, the various tables included in PSI and SI are referred to as program information tables. Specifically, PSI may include a program association table (PAT), a program map table (PMT), a conditional access table (CAT), and a network information table (NIT), etc. SI usually includes a service description table (SDT), an event information table (EIT), a time and date table (TDT), and a business group association table (BAT). Among them, various program information tables include one or more sections.
[0032] The inventor of the present application has found through research that how the bottom layer stores and reports the program information table extracted from the TS to the upper layer is related to the performance of the entire system.
[0033] Specifically, if the bottom layer reports the entire program information table to the upper layer each time it is obtained, it will take up more execution time and computing power resources of the central processing unit (CPU), and will also waste a lot of memory. Due to the large number and variety of program information tables, if shared memory is used for storage, there will be a large number of mapping addresses, and the maintenance of virtual address mapping relationships will be complex. Since the current standard specification limits the storage space of most segments to 1KB, this shared memory mapping method cannot significantly balance the system overhead.
[0034] In view of this, an embodiment of the present application provides a method for extracting program information. In the scheme of the embodiment of the present application, the current segment is obtained, and the current segment has identification information; it is determined whether a reverse setting field is configured and / or whether a reverse setting field is used. If the judgment result is yes, the data corresponding to the reverse setting field is read from the current segment and recorded as the current reverse data; if the current reverse data is different from the data corresponding to the reverse setting field in the previous segment corresponding to the identification information, the current segment is reported. In the scheme of the embodiment of the present application, the reverse setting field is configured, and the current segment is reported when the data corresponding to the reverse setting field changes. That is, the repeated segments are filtered by the reverse setting field to avoid reporting of repeated segments, thereby avoiding frequent interactions between the upper layer and the bottom layer, which is conducive to reducing CPU occupancy and terminal power consumption in the scenario of extracting program information. In order to make the above-mentioned purposes, features and beneficial effects of the present application more obvious and easy to understand, the specific embodiments of the present application are described in detail below in conjunction with the accompanying drawings.
[0035] Reference Figure 1 , Figure 1 It is a flowchart of a method for extracting program information in an embodiment of the present application. Figure 1 The method shown can be executed by a terminal. More specifically, the terminal in this embodiment can refer to a digital TV terminal, which refers to a terminal that receives TV signals, such as a digital TV set-top box. More specifically, the terminal can be configured with a chip (such as an embedded chip) or a chip module, and the solution provided in the embodiment of the present application can be executed by the chip or the chip module. Figure 1 The method shown may include steps S11 to S13:
[0036] Step S11, obtaining the current segment, where the current segment has identification information.
[0037] Step S12: determining whether a reverse setting field is configured and / or determining whether the reverse setting field is used. If the determination result is yes, reading data corresponding to the reverse setting field from the current segment and recording it as current reverse data;
[0038] Step S13: If the current reverse data is different from the data corresponding to the reverse setting field in the previous segment corresponding to the identification information, the current segment is reported.
[0039] In the specific implementation of step S11, the terminal can receive TS through the network and parse TS. Among them, TS has identification information, and the identification information may include PID and table identifier (table identifier is usually represented as table_id). In the process of parsing TS, whenever a complete segment is obtained, the segment can be recorded as the current segment.
[0040] It should be noted that, in the solution of the embodiment of the present application, the identification information of the TS to which the current segment belongs is recorded as the identification information of the current segment. Thus, the current segment may have identification information, and the identification information includes PID and table_id. More specifically, the current segment has a unique PID and a unique table_id.
[0041] In a specific implementation, the terminal can determine the program to which the current segment belongs according to the PID of the current segment, and determine the program information table to which the current segment belongs according to the table_id of the current segment. The program information table can be a PSI table or an SI table.
[0042] In the specific implementation of step S12, it can be determined whether a reverse setting field is configured and / or whether the reverse setting field is used. If the determination result is yes, the data corresponding to the reverse setting field can be read from the current segment and recorded as the current reverse data. The reverse setting field can be pre-configured.
[0043] In the first specific example, it can be determined whether a reverse setting field corresponding to the identification information is configured according to the identification information of the current segment. If a reverse setting field corresponding to the identification information of the current segment is configured, the current reverse data can be read from the current segment.
[0044] In a specific implementation, a group of reverse setting fields can be pre-configured for at least one group of identification information, wherein each group of reverse setting fields can include at least one reverse setting field, and the reverse setting fields included in each group of reverse setting fields can be selected from the fields in the program information table corresponding to the table_id in the identification information.
[0045] It should be noted that a group of identification information includes a single PID and a single table_id. If the PID and table_id are the same, it means that they are the same group of identification information. If any one of the PID and table_id is different, it means that they are identification information of different groups. Among them, the reverse setting fields corresponding to the identification information of different groups can be the same, or can be partially the same, or can be completely different, and this embodiment does not limit this.
[0046] See Table 1, which is a partial syntax definition of the PAT table.
[0047] Table 1
[0048]
[0049] It should be noted that the number of the field program number in the PAT table may be multiple, that is, a segment of the PAT table includes multiple program numbers.
[0050] Taking the PAT shown in Table 1 as an example, assuming that the program information table to which the current field belongs is PAT, and the reverse setting field corresponding to the identification information of the current field includes: a transport stream identification field and current_next_indicator, then the current reverse data includes the data corresponding to the transport stream identification field in the current segment and the data corresponding to the current_next_indicator.
[0051] In the second specific example, it can be determined whether to use the reverse setting field. Specifically, it is determined whether to use the reverse setting field corresponding to the identification information. More specifically, the bottom layer can obtain indication information from the upper layer, and determine whether to use the reverse setting field or not to use the reverse setting field according to the indication information. Using the reverse setting field may refer to reading the current reverse data from the current segment according to the reverse setting field, and not using the reverse setting field may refer to ignoring the reverse setting field or not judging whether the reverse setting field is configured. Among them, ignoring the reverse setting field means that even if the reverse setting field is configured, the current reverse data is not read from the current segment.
[0052] In the third specific example, if it is determined that a reverse setting field is configured, it can be further determined whether to use the configured reverse setting field. If a reverse setting field is configured and it is determined to use the configured reverse setting field, the current reverse data can be read. If a reverse setting field is not configured, the current reverse data is not read. If a reverse setting field is configured but the configured reverse setting field is not used, the current reverse data is not read.
[0053] In one embodiment of the present application, if the judgment result of step S12 is no (that is, the reverse setting field is not configured and / or the reverse setting field is not used), it can be directly determined to report the current segment. More specifically, if the reverse setting field corresponding to the identification information of the current segment is not configured, it can be directly determined to report the current segment. For a detailed description of reporting the current segment, please refer to the following about Figure 2 Related description.
[0054] In another embodiment of the present application, data corresponding to the forward setting field in the current segment may also be read and recorded as current forward data, wherein the forward setting field may be pre-configured.
[0055] Similar to the reverse setting field, a group of forward setting fields can be pre-configured for at least one group of identification information, wherein each group of forward setting fields includes at least one forward setting field, and the forward setting fields included in each group of forward setting fields can be selected from the fields in the program information table corresponding to the table_id in the identification information, and each forward setting field in each group of forward setting fields has a pre-configured setting value.
[0056] It should be noted that the reverse setting field and the forward setting field corresponding to the same group of identification information should not overlap. "Non-overlapping" means that among the reverse setting fields and the forward setting fields corresponding to the same group of identification information, there is no field that belongs to both the reverse setting field and the forward setting field. However, in actual applications, it is possible that a field is set as both a reverse setting field and a forward setting field.
[0057] Thus, the forward setting field can be determined according to the identification information of the current segment, and then the current forward data can be read from the current segment. Still taking the PAT in the above text as an example, assuming that the program information table to which the current field belongs is PAT, and the forward setting field corresponding to the identification information of the current field includes the segment length, the data corresponding to the segment length field in the current segment can be obtained as the current forward data.
[0058] In a specific example, the current forward data can be read regardless of whether the current reverse data is read. More specifically, the current reverse data can be read first and then the current forward data, or the current forward data can be read first and then the current reverse data, or the current forward data and the current reverse data can be read simultaneously.
[0059] In another specific example, if the current reverse data is not read, the current forward data can be read. That is, the current forward data is read only when the reverse setting field is not configured and / or the reverse setting field is not used. If the current reverse data is read, the forward data may not be read. With such a scheme, the reverse setting field has a higher priority than the forward setting field, which can avoid the situation in which the judgment results of reporting and not reporting are contradictory in actual applications because a segment is set as both a reverse setting field and a forward setting field.
[0060] In step S13, if the current reverse data and the data corresponding to the reverse setting field in the previous segment corresponding to the identification information are different, the current segment is reported. The previous segment corresponding to the identification information refers to the segment with the same identification information as the current segment that was obtained most recently.
[0061] Further, the current reverse data and the data corresponding to the reverse setting field in the previous segment can be compared to see if they are the same. Further, if the current reverse data and the data corresponding to the reverse setting field in the previous segment are different, it is determined to report the current segment. If the current reverse data and the data corresponding to the reverse setting field in the previous segment are the same, it can be determined not to report the current segment.
[0062] More specifically, if the current reverse data includes data corresponding to multiple reverse setting fields, if the data corresponding to any one of the reverse setting fields changes, it can be determined to report the current segment. The data change means that the data corresponding to a certain reverse setting field in the current segment is different from the data corresponding to the previous segment.
[0063] Furthermore, if the current forward data is also read in step S12, the current forward data and the setting value corresponding to the forward setting field can also be judged. If the current forward data and the setting value are consistent, it can be determined to report the current segment. If the current forward data and the setting value are inconsistent, it can be determined not to report the current segment. More specifically, the current forward data includes data corresponding to multiple forward setting fields. If the data corresponding to each forward setting field in the current segment is the same as the setting value corresponding to the forward setting field, it is determined to report the current segment. If the data corresponding to any one of the forward setting fields in the current segment is different from the setting value, it is determined not to report the current segment.
[0064] It should be noted that, in the solution of this embodiment, if it is determined not to report the current segment, the current segment may be discarded or deleted.
[0065] It should also be noted that if both the reverse setting field and the forward setting field are configured, and the judgment result of whether to report based on the current reverse data is different from the judgment result of whether to report based on the forward field, the judgment result of whether to report based on the current reverse data may be used as the basis. Alternatively, if the judgment results are different, it may be further determined to report the current segment.
[0066] Further, if it is determined to report the current segment, the current segment may be reported to the upper layer, that is, the current segment may be transmitted to the upper layer.
[0067] In one embodiment of the present application, reporting may be performed by combining dynamic memory allocation and asynchronous reporting.
[0068] See also Figure 2 , Figure 2 FIG. 1 is a flowchart of a specific implementation method of reporting segments in an embodiment of the present application. Figure 2 As shown, the segmented reporting may include steps S21 to S25.
[0069] Step S21, the bottom layer dynamically allocates memory for the current segment.
[0070] Specifically, if it is determined to report the current segment, a storage area can be allocated for the current segment, and the current segment can be written into the allocated storage area. In other words, the solution of this embodiment adopts a dynamic memory allocation method to store the segments, and the segments are stored only when it is determined to report. If it is determined not to report the segment, it can be directly discarded or deleted without storage.
[0071] As an example, a unique corresponding circular linked list (cycle chain) can be pre-set for each set of identification information. After determining to report the current segment, memory can be allocated for the current segment (e.g., a page of memory can be allocated for the current segment, and a page of memory is usually 4096 bytes), and then the current segment is stored in the allocated page memory, and the page memory is inserted into the circular linked list corresponding to the identification information of the current segment. More specifically, the page memory storing the current segment is inserted into the tail of the circular linked list.
[0072] Step S22: The bottom layer sends a notification message to the upper layer.
[0073] The notification message may carry identification information of the current segment and may also carry information such as the length of the current segment.
[0074] It should be noted that this embodiment does not limit the execution order of step S21 and step S22. Step S21 can be executed first and then step S22, or step S22 can be executed first and then step S21, or step S21 and step S22 can be executed simultaneously.
[0075] Step S23: The upper layer records the information carried by the notification message.
[0076] Specifically, whenever a notification message is received, the upper layer records the information carried by the notification message.
[0077] Step S24: the upper layer sends a reporting request to the lower layer.
[0078] In the solution of this embodiment, the upper layer sends a reporting request to the lower layer in an asynchronous thread, wherein the reporting request may carry identification information carried in a notification message received before sending the reporting request.
[0079] Step S25: In response to the reporting request, the bottom layer reports the segment.
[0080] Specifically, after receiving the reporting request, the bottom layer can report the unreported segment corresponding to the identification information in response to the reporting request. More specifically, in response to the reporting request, the earliest stored and unreported segment corresponding to the identification information carried in the reporting request can be reported.
[0081] Continuing with the above example, each set of identification information has a unique corresponding circular linked list, and the circular linked list can be determined according to the identification information carried in the reporting request, and then the segment stored in the linked list header is read and reported from the circular linked list. Furthermore, each time a segment is reported, the segment reported this time can be deleted from the circular linked list.
[0082] The above-mentioned solution of dynamically allocating memory and asynchronous reporting is helpful to reduce the memory usage of program information table reporting and can also avoid blocking.
[0083] From the above, the embodiment of the present application provides a top-down program information extraction architecture, which can return the segment to the upper layer only when the segment of a certain program information table of a certain program changes according to flexible reverse settings and signal notification mechanisms, which can reduce the frequent interaction between the upper and lower layers for the program information table of the same program and avoid invalid reporting of duplicate data. In addition, the dynamic memory allocation mechanism can improve the memory utilization, reduce performance loss, and optimize the overall performance during playback and switching.
[0084] Reference Figure 3 , Figure 3 It is a flowchart of another method for extracting program information in an embodiment of the present application.
[0085] Step S31, configuring filters.
[0086] Specifically, the upper layer may send a filter configuration request to the lower layer, wherein the filter configuration request may include identification information. In response to the filter configuration request, the lower layer configures the filter corresponding to the identification information. Thus, each set of identification information has a unique corresponding filter. Further, after the lower layer completes the filter configuration, the filter identification (filter_id) may be reported to the upper layer. Each set of identification information uniquely corresponds to a filter identification.
[0087] Among them, the filter can be used to filter the segments, that is, every time a complete segment is obtained from the TS, the segment can be input into the filter. If the filter filters the segment, it means that the segment does not need to be reported. If the filter does not filter the segment, it means that the segment needs to be reported.
[0088] In a specific implementation, the filter may have the following configuration: a filter identifier, a matching array, a forward mask array, a reverse setting indication identifier, and a reverse mask array.
[0089] Among them, the matching array may include data corresponding to the reverse setting field of the upper layer configuration and data corresponding to the forward setting field. More specifically, the matching array may include the setting value corresponding to the forward setting field, or the matching array may include data corresponding to the reverse setting field in the previous segment. The forward mask array may be used to indicate the forward setting field of the filter (that is, the forward setting field corresponding to the identification information above), and the reverse setting indication identifier is used to indicate whether the filter uses the reverse setting. The reverse mask array may be used to indicate the reverse setting field of the filter. Among them, whether the filter uses the reverse setting may refer to whether the reverse setting field of the filter is used to judge the segment.
[0090] In a non-limiting example, considering that the CRC field is usually located at the last 4 bytes of a segment, and a complete segment is usually hundreds of bytes long, in order to avoid the length of the filter array (such as matching data, reverse mask array) being too long, a check code reverse setting indication flag and a check code mask array can be configured separately for CRC. Among them, the check code reverse setting indication flag is used to indicate whether the CRC field is set to the reverse setting field, and the check code mask array is used to set the CRC value corresponding to the reverse setting field (i.e., CRC field) configured by the upper layer.
[0091] As an example, the filter definition is as follows:
[0092]
[0093] The configuration of the filter is described in more detail below in conjunction with the above examples.
[0094] (1) Filter identification filter_id: The upper layer and the lower layer can determine the PID and table_id corresponding to the filter based on the filter_id.
[0095] (2) Match array match: Since different program information tables include different fields and different numbers of bits in the fields, the definition of the match array match corresponding to each table_id is different. match can be used to store data corresponding to the reverse setting segment or the forward setting field configured by the upper layer. In other words, the data stored in match is data used for comparison with the current reverse data or the current forward data. For example, for the PAT table, it is necessary to filter the segments with table_id 0. Since the table_id of PAT is the first byte in PAT, the value of match[0] is 0x00. For another example, it is necessary to filter the segments with transport_stream_id 0. Since the transport_stream_id of PAT is the third and fourth bytes in PAT, the values of match[3] and match[4] are both 0x00.
[0096] (3) Forward mask array mask: The value of the corresponding position of the forward setting field in the forward mask array is 1, which can be used in conjunction with the match array match. For example, for the PAT table, the forward setting field is table_id, and the corresponding setting value is 0. Since table_id is located at the first byte in the segment of the PAT table, mask[0] can be set to 0xFF, and the data of the first byte in the current segment is then ANDed with mask[0] to read the data corresponding to table_id in the current segment. Then the read data can be further matched with match[0]. If the read data has the same value as match[0], it means that the forward setting condition is met and reported.
[0097] (4) Reverse setting indicator: whether to use reverse setting.
[0098] (5) Reverse mask array: The value of the position corresponding to the reverse setting field in the reverse mask array is 1, which can be used in conjunction with the match array match. For example, for the PAT table, it is necessary to report only when the transport_stream_id changes. Since the transport_stream_id in the segment of the PAT table is located at the 3rd byte and the 4th byte, negmask[3] and negmask[4] can be set to 0xFF, and then the data of the 3rd byte and the 4th byte in the current segment are ANDed with negmask[3] and negmask[4] to read the data corresponding to the transport_stream_id in the current segment, and then match the read data with the values of match[3] and match[4]. If the read data is different from the values of match[3] and match[4] (that is, they do not match), it means that the reverse setting condition is met and reported. (6) Checksum reverse setting indicator bnegmask_crc: Whether to reverse set the crc cyclic redundancy check. In other words, whether to use the crc field as a reverse setting field.
[0099] (7) Check code mask array negmask_crc: used to store the CRC value indicated by the upper layer, so as to determine whether the CRC in the segment has changed and decide whether to discard or report it.
[0100] Step S32, start the filter.
[0101] In a specific implementation, the filter may be started by triggering an upper layer.
[0102] Step S33, determine whether a complete segment is obtained. If the determination result is yes, execute step S34. If the determination result is no, return to step S33.
[0103] If it is determined that a complete segment is obtained, the complete segment obtained this time can be recorded as the current segment. It should be noted that if the current segment is the complete segment obtained by the filter for the first time, it can jump directly to step S37. That is, the segment obtained by the filter for the first time must be stored and reported.
[0104] Step S34, determine whether to use the reverse setting. If the determination result is yes, execute step S35, if the determination result is no, execute step S36.
[0105] In a specific implementation, whether to use the reverse setting can be determined according to the reverse setting indicator. For example, if the value of the reverse setting indicator is 1, it indicates that the reverse setting is used, and if the value of the reverse setting indicator is 0, it indicates that the reverse setting is not used.
[0106] Step S35, determine whether the data corresponding to the reverse setting field has changed. If the determination result is yes, proceed to step S37. If the determination result is no, return to step S33.
[0107] Step S36, determine whether the current forward data is consistent with the set value. If the determination result is yes, continue to step S37. If the determination result is no, return to step S33.
[0108] Among them, judging whether the data corresponding to the reverse setting field has changed may refer to whether the data corresponding to the reverse setting field in the current segment is different from the data corresponding to the reverse setting field in the previous segment. Judging whether the current forward data is consistent with the set value may refer to whether the data corresponding to the forward setting field in the current segment is the same as the set value. For more information about step S35 and step S36, please refer to the above description of step S12 and step S13.
[0109] Step S37, allocate memory for the current segment to store the current segment, and send a notification message to the upper layer.
[0110] After step S37 is completed, the process may return to step S33, and steps S38 to S39 may be executed in the asynchronous thread.
[0111] Step S38: sending the segment to the upper layer in response to the reporting request of the upper layer.
[0112] For details about steps S37 and S38, please refer to the above Figure 2 Related description.
[0113] Step S39, updating the reverse setting field and / or the forward setting field.
[0114] Specifically, after receiving the segmentation, the upper layer can update the current reverse setting field and / or the forward setting field, and send the updated reverse setting field and / or the updated forward setting field to the lower layer. For example, the upper layer can configure the updated reverse setting field and / or the updated forward setting field to the lower layer through the ioctl command. The lower layer obtains the updated reverse setting field and / or the forward setting field from the upper layer, and updates the configuration of the filter according to the updated reverse setting field and / or the forward setting field. For example, for the PAT table, the reverse setting field before the update can be table_id, and the reverse setting field after the update can be section_length.
[0115] It is understandable that, in a specific implementation, the method can be implemented in the form of a software program, which runs in a processor integrated inside a chip or a chip module; or, the method can be implemented in the form of hardware or a combination of hardware and software.
[0116] Reference Figure 4 , Figure 4 is a schematic diagram of the structure of a device for extracting program information in an embodiment of the present application. Figure 4 The apparatus shown may include:
[0117] An acquisition module 41 is used to acquire a current segment, where the current segment has identification information;
[0118] A filtering module 42, configured to determine whether a reverse setting field is configured and / or whether the reverse setting field is used, and if the determination result is yes, read data corresponding to the reverse setting field from the current segment and record it as current reverse data;
[0119] The reporting module 43 is configured to report the current segment if the current reverse data is different from the data corresponding to the reverse setting field in the previous segment corresponding to the identification information.
[0120] For more information about the working principle, working method, beneficial effects, etc. of the device in the embodiment of the present application, please refer to the above description of the method for extracting program information, which will not be repeated here.
[0121] The embodiment of the present application also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the program information extraction method described above are executed. The storage medium may include ROM, RAM, a magnetic disk or an optical disk, etc. The storage medium may also include a non-volatile memory or a non-transitory memory, etc.
[0122] The embodiment of the present application also provides a terminal, including a memory and a processor, wherein the memory stores a computer program that can be run on the processor, and the processor executes the steps of the above-mentioned method for extracting program information when running the computer program. The terminal includes but is not limited to a terminal device of a digital television system such as a digital television set-top box.
[0123] It should be understood that in the embodiments of the present application, the processor may be a central processing unit (CPU), and the processor may also be other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0124] It should also be understood that the memory in the embodiments of the present application may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of random access memory (RAM) are available, such as static RAM (SRAM), dynamic random access memory (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), and direct rambus RAM (DR RAM).
[0125] The above embodiments may be implemented in whole or in part by software, hardware, firmware or any other combination thereof. When implemented using software, the above embodiments may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions or computer programs. When the computer instructions or computer programs are loaded or executed on a computer, the processes or functions described in the embodiments of the present application are generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer program may be stored in a computer-readable storage medium, or may be transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer program may be transmitted from one website, computer, server or data center to another website, computer, server or data center by wired or wireless means.
[0126] In the several embodiments provided in the present application, it should be understood that the disclosed methods, devices and systems can be implemented in other ways. For example, the device embodiments described above are merely schematic; for example, the division of the units is only a logical function division, and there may be other division methods in actual implementation; for example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the scheme of this embodiment.
[0127] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may be physically included separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional units. For example, for each device or product applied to or integrated in a chip, each module / unit contained therein may be implemented in the form of hardware such as circuits, or at least some of the modules / units may be implemented in the form of software programs, which run on a processor integrated inside the chip, and the remaining (if any) modules / units may be implemented in the form of hardware such as circuits; for each device or product applied to or integrated in a chip module, each module / unit contained therein may be implemented in the form of hardware such as circuits, and different modules / units may be located in the same component (such as a chip, circuit module, etc.) or different components of the chip module, or at least some of the modules / units may be implemented in the form of software programs. The software programs may run on a processor integrated inside the chip, and the remaining (if any) modules / units may be implemented in the form of hardware such as circuits. The element can be implemented in the form of a software program, which runs on a processor integrated inside the chip module, and the remaining (if any) modules / units can be implemented in the form of hardware such as circuits; for various devices and products applied to or integrated in the terminal, the various modules / units contained therein can be implemented in the form of hardware such as circuits, and different modules / units can be located in the same component (for example, chip, circuit module, etc.) or in different components in the terminal, or, at least some modules / units can be implemented in the form of a software program, which runs on a processor integrated inside the terminal, and the remaining (if any) modules / units can be implemented in the form of hardware such as circuits.
[0128] It should be understood that the term "and / or" in this article is only a description of the association relationship of the associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article indicates that the associated objects before and after are in an "or" relationship.
[0129] The "multiple" appearing in the embodiments of the present application refers to two or more. The first, second, etc. descriptions appearing in the embodiments of the present application are only used for illustration and distinction of the description objects. There is no order, nor does it represent a special limitation on the number of devices in the embodiments of the present application, and cannot constitute any limitation on the embodiments of the present application. Although the present application is disclosed as above, the present application is not limited to this. Any person skilled in the art may make various changes and modifications without departing from the spirit and scope of the present application. Therefore, the scope of protection of the present application shall be based on the scope defined by the claims.
[0130] Although the present application is disclosed as above, the present application is not limited thereto. Any person skilled in the art can make various changes and modifications without departing from the spirit and scope of the present application. Therefore, the protection scope of the present application shall be subject to the scope defined by the claims.
Claims
1. A method for extracting program information, characterized in that: The method comprises: Obtaining a current segment, wherein the current segment has identification information; Determine whether a reverse setting field is configured and / or whether the reverse setting field is used, and if the determination result is yes, read data corresponding to the reverse setting field from the current segment and record it as current reverse data, wherein the reverse setting field is selected from a field in the program information table corresponding to the table identifier in the identification information, and the reverse setting field is pre-configured; If the current reverse data is different from the data corresponding to the reverse setting field in the previous segment corresponding to the identification information, reporting the current segment; The obtaining of the current segment includes parsing the transport stream TS, and whenever a complete segment is obtained, recording the segment as the current segment; The reporting of the current segment includes: the bottom layer reporting the current segment to the upper layer, the upper layer represents the user space, and the bottom layer represents the driver kernel space.
2. The method for extracting program information according to claim 1, characterized in that: The method further comprises: Reading data corresponding to a forward setting field in the current segment, recorded as current forward data, wherein the forward setting field is selected from a field in a program information table corresponding to a table identifier in the identification information, and the forward setting field does not overlap with the reverse setting field; If the current forward data is consistent with the set value, the current segment is reported.
3. The method for extracting program information according to claim 2, characterized in that: Reading data corresponding to the forward setting field in the current segment includes: If the reverse setting field is not configured and / or is not used, the current forward data is read.
4. The method for extracting program information according to claim 1, characterized in that: Determining whether a reverse setting field is configured includes: Determine whether a reverse setting field corresponding to the identification information is configured.
5. The method for extracting program information according to claim 1, characterized in that: Before reporting the current segment, the method further includes: If the current reverse data is different from the data corresponding to the reverse setting field in the previous segment, the current segment is stored in the circular linked list corresponding to the identification information; otherwise, the current segment is discarded.
6. The method for extracting program information according to claim 5, characterized in that: The method further comprises: If the current reverse data is different from the data corresponding to the reverse setting field in the previous segment, a notification message is sent to an upper layer.
7. The method for extracting program information according to claim 6, characterized in that: The method further comprises: receiving a reporting request from an upper layer, wherein the reporting request carries identification information; The segment stored in the linked list header is read from the circular linked list corresponding to the identification information carried in the reporting request and reported.
8. The method for extracting program information according to claim 1, characterized in that: The method further comprises: An updated reverse setting field is obtained from an upper layer, wherein the updated reverse update field depends on the current segment.
9. A device for extracting program information, characterized in that: The device comprises: An acquisition module, used for acquiring a current segment, wherein the current segment has identification information; a filtering module, used for judging whether a reverse setting field is configured, and if the judgment result is yes, reading data corresponding to the reverse setting field from the current segment and recording it as current reverse data, wherein the reverse setting field is selected from a field in the program information table corresponding to the table identifier in the identification information, and the reverse setting field is pre-configured; A reporting module, configured to report the current segment if the current reverse data is different from the data corresponding to the reverse setting field in the previous segment corresponding to the identification information; The acquisition module parses the transport stream TS, and whenever a complete segment is obtained, the segment is recorded as the current segment; The bottom layer reporting module reports the current segment to the upper layer, the upper layer represents the user space, and the bottom layer represents the driver kernel space.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method for extracting program information according to any one of claims 1 to 8 are executed.
11. A terminal comprising a memory and a processor, wherein the memory stores a computer program that can be run on the processor, characterized in that: When the processor runs the computer program, the processor performs the steps of the method for extracting program information according to any one of claims 1 to 8.
Citation Information
Patent Citations
Transmission method for broadcast service, reception method therefor, and reception apparatus therefor
CN103535046A
Broadcasting signal transmission apparatus, broadcasting signal reception apparatus, broadcasting signal transmission method, and broadcasting signal reception method
CN105830459A
