Disclosure of Invention
The embodiment of the invention provides a method and a device for displaying a caption language.
In a first aspect, an embodiment of the present invention provides a method for displaying a subtitle language, including
Analyzing the caption data to obtain a first caption list;
analyzing the image-text data to determine whether the caption of the current page of the image-text is an effective image-text caption;
and if so, adding the effective image-text subtitles to the first subtitle list to generate a second subtitle list for display.
In one possible implementation, the parsing the subtitle data to obtain the first subtitle list includes:
and acquiring subtitle information according to a subtitle descriptor in a program map table PMT to generate a first subtitle list.
In one possible embodiment, the parsing determines whether the caption of the current page is a valid caption, including:
analyzing the header information of the image-text data, and judging whether the current page of the image-text is the caption image-text;
and if so, further determining whether the caption of the image-text current page is an effective image-text caption.
In one possible embodiment, said determining whether the subtitle of the teletext current page is a valid subtitle comprises:
judging whether the caption of the image-text current page is an empty caption;
if not, judging whether the caption of the image-text current page is an updatable caption or not;
if so, further judging whether the caption of the image-text current page is not coincident with the first caption list, and if not, determining that the caption of the image-text current page is an effective image-text caption.
In one possible embodiment, the method further comprises:
analyzing the header information of the image-text data, and judging whether the current page of the image-text is the caption image-text;
if so, judging whether the magazine number, the page number and the sub-page number in the image-text packet header information are consistent with the corresponding contents of the effective image-text subtitles in the second subtitle list; (ii) a
If yes, further judging whether the caption of the image-text current page is an effective image-text caption;
and if not, deleting the effective image-text subtitles with the magazine number, the page number and the sub-page number consistent with the corresponding contents in the image-text header information in the second subtitle list.
In a second aspect, an embodiment of the present invention provides an apparatus for displaying subtitles, including:
the acquisition module is used for analyzing the caption data to acquire a first caption list;
the determining module is used for analyzing the image-text data to determine whether the caption of the current page of the image-text is an effective image-text caption;
and the first processing module is used for adding the effective image-text subtitles to the first subtitle list to generate a second subtitle list for display.
In a possible implementation manner, the obtaining module is configured to obtain the subtitle information according to the subtitle descriptor in the program map table PMT, and generate the first subtitle list.
In a possible implementation manner, the determining module is configured to analyze header information of the teletext data, and determine whether the current page of the teletext is a subtitle teletext; and if so, further determining whether the caption of the image-text current page is an effective image-text caption.
In a possible implementation manner, the determining module is configured to determine whether a subtitle of the teletext current page is an empty subtitle; if not, judging whether the caption of the image-text current page is an updatable caption or not; if so, further judging whether the caption of the image-text current page is not coincident with the first caption list, and if not, determining that the caption of the image-text current page is an effective image-text caption.
In a possible implementation manner, the apparatus further includes a second processing module, configured to analyze header information of the teletext data, and determine whether the current page of teletext is a subtitle teletext; if so, judging whether the magazine number, the page number and the sub-page number information in the image-text packet header information are consistent with the corresponding contents of the effective image-text subtitles in the second subtitle list; if yes, further judging whether the caption of the image-text current page is an effective image-text caption; and if not, deleting the effective image-text subtitles of which the magazine number, the page number and the sub-page number information are consistent with the corresponding contents in the image-text packet header information in the second subtitle list.
In a third aspect, an embodiment of the present application provides a computer storage medium, where instructions are stored, and when the instructions are executed on a computer, the computer is caused to execute the first aspect or the method in any possible implementation manner of the first aspect.
In a fourth aspect, embodiments of the present application provide a computer program product containing instructions that, when executed on a computer, cause the computer to perform the method of the first aspect or any possible implementation manner of the first aspect.
In the embodiment of the invention, a first caption list is obtained by analyzing a program mapping table, the image-text data is analyzed to determine the effective image-text caption, and then the effective image-text caption is added to the first caption list to generate a second caption list for displaying. Language selection of the subtitle list is enriched, and user experience is improved.
Detailed Description
In developed countries and regions in europe, the european DVB subtitling standard is commonly used for subtitles of digital tv broadcasting, and is widely used for satellite tv, cable tv and terrestrial digital tv broadcasting. The DVB subtitle system can select various text subtitle services, and a user can freely select to turn on or off the services.
The Subtitles can only provide limited subtitle language selection for users, and the subtitle language in the text (TTX for short) is added into the subtitle selection by processing at the television end, so that the subtitle language selectable by the users is expanded, and the user experience is improved. The text is mainly used for text information broadcasting including weather forecast and the like, and the subtitle language selection of the text is possibly different from Subtitles.
Fig. 1 is a flowchart of a method for displaying subtitles according to an embodiment of the present invention, as shown in fig. 1, including:
s101, analyzing the caption data to obtain a first caption list.
And S102, analyzing the image-text data to determine whether the caption of the current page of the image-text is an effective image-text caption.
S103, adding the effective image-text subtitles to the first subtitle list to generate a second subtitle list for displaying.
In the embodiment of the invention, a first subtitle list is obtained by analyzing subtitles, whether subtitles of the current page of the image text are effective image text subtitles or not is determined by analyzing the image text, and then the effective image text subtitles are added to the first subtitle list to generate a second subtitle list for displaying. Language selection of the subtitle list is enriched, and user experience is improved.
The details of the method are as follows:
fig. 2 is a schematic flowchart of a first subtitle list obtaining method according to an embodiment of the present invention, as shown in fig. 2, including:
s201, locking the screen of the television and decoding the transmitted signal.
S202, demultiplexing the decoded data stream, and analyzing to obtain a program association table PAT.
S203, further analyzing and obtaining the program map table PMT.
S204, analyzing the subtitle description (subtitle descriptor) in the PMT table, and putting the obtained subtitle into a subtitle list.
Specifically, after obtaining the PMT in step S203, if the stream _ type in the PMT is 0xbd (private _ stream _1), this data stream is text or subtitle data, which is collectively referred to as VBI data. Then, further judging Data _ unit _ id, if the Data _ unit _ id is 0x02, the VBI Data is image-text Data; if it is 0x03, the VBI data is subtitle data. And then analyzing the caption descriptor in the caption data, determining selectable captions and putting the captions into a caption list to generate a first caption list. Illustratively, if the caption description of the PMT indicates that there are two caption languages, one in german and one in french, in the bitstream, there are two options for opening the caption list.
Fig. 3 is a flowchart of a method for determining effective subtitles according to an embodiment of the present invention, as shown in fig. 3, including:
and S301, acquiring the image-text data from the TS data stream.
Specifically, the method comprises the steps of carrying out frequency locking on a television, decoding a transmitted signal, demultiplexing the decoded Data stream, analyzing to obtain a program association table PAT, further analyzing to obtain a program mapping table PMT, reading a stream _ type flag bit of the PMT, further reading a Data _ unit _ id flag bit if the flag bit is 0xbd, and judging that the Data stream is a text Data stream if the flag bit is 0x 02.
S302, judging whether the current page of the image-text is the caption image-text.
SPEC < ETSI EN 300706 > specifies that the first packet X/0 (i.e. the first packet) of teletext is header information, which includes Prefix information and control information, where C6 in the control information indicates whether the current page of teletext is a subtitle or not, and when C6 is set to 1, it indicates that the current page is a subtitle page. C12, C13 and C14 in the control information explain the language information of the current page.
If yes, go to step S303.
S303, judging whether the caption of the image-text current page is an empty caption.
If not, go to step S304.
Specifically, the method for judging whether the caption of the current page of the image-text is an empty caption or not comprises the following steps: the caption which can be displayed by the image-text appears in the 1 st to 24 th lines which are not 0 line, when the image-text data is received, and the current page is judged to be the caption by the packet head (0 line), whether the data exists in the 1 st to 24 th lines can be judged, if yes, the image-text current page is a non-empty caption page, and if not, the image-text current page is an empty caption page.
S304, judging whether the caption of the image text current page can be updated.
If yes, step S305 is further executed.
Specifically, whether the subtitle of the teletext current page is updatable or not can be judged by reading the flag bit of C8, and when the flag bit of C8 is 1, the teletext current page is indicated to be updatable; otherwise, the current page of the graph and text is not updated.
S305, judging whether the caption of the image text current page is not coincident with the first caption list.
If yes, go to step S306.
S306, determining the caption of the image-text current page as an effective image-text caption.
For example, assuming that the caption of the read teletext current page is german, which coincides with german in the first caption list, it is determined that the caption of the teletext current page is not a valid teletext caption; and if the read caption of the image-text current page is English and is not coincident with any language in the first caption list, determining that the caption of the image-text current page is an effective image-text caption.
Optionally, in this step, if it is determined that the subtitle of the current teletext Page does not coincide with the first subtitle list, the "Magazine" number (Magazine), the Page number (Page), and the sub-Page number (subpage) information of the current teletext Page are recorded, so as to perform dynamic subtitle deletion in the following step.
Fig. 4 is a flowchart of a method for dynamically increasing or decreasing a subtitle list according to an embodiment of the present invention, as shown in fig. 4, including:
s401, analyzing the header information of the image-text data, and judging whether the current page of the image-text is the caption image-text.
If yes, go to step S402.
S402, acquiring the information of the magazine number, the page number and the sub-page number in the image-text packet header information.
S403, acquiring the information of the magazine number, the page number and the sub-page number corresponding to the effective image-text subtitle in the first subtitle list.
In this step, the magazine number, the page number, and the sub-page number corresponding to the effective teletext subtitle in the first subtitle list are stored when step S305 is executed.
S404, judging whether the magazine number, the page number and the sub-page number information in the image-text header information are consistent with the corresponding contents of the effective image-text subtitles in the first subtitle list.
If yes, executing steps S405-S406; if not, go to step S407.
S405, judging whether the caption of the image-text current page is an effective image-text caption.
The specific determination method is detailed in steps S303-S305.
If yes, go to step S406.
S406, add the caption of the current teletext page to the second caption list.
And S407, deleting the effective image-text subtitles of which the magazine number, the page number and the sub-page number information are consistent with the corresponding contents in the header information of the image-text in the second subtitle list.
By the dynamic caption increasing and decreasing mode, effective captions in the caption list can be guaranteed all the time, and captions used by a user can be selected normally.
The method provided by the invention is described above, and the following describes the smart television provided by the invention:
referring to fig. 5, a hardware structure diagram of an intelligent television provided in an embodiment of the present invention is shown. The smart television may include aprocessor 501, a machine-readable storage medium 502 storing machine-executable instructions. Theprocessor 501 and the machine-readable storage medium 502 may communicate via a system bus 503. Also, theprocessor 501 may perform the channel switching method described above by reading and executing machine-executable instructions in the machine-readable storage medium 502 corresponding to the channel switching logic.
The machine-readable storage medium 502 referred to herein may be any electronic, magnetic, optical, or other physical storage device that can contain or store information such as executable instructions, data, and the like. For example, the machine-readable storage medium 502 may include at least one of the following storage media: volatile memory, non-volatile memory, other types of storage media. The volatile Memory may be a Random Access Memory (RAM), and the nonvolatile Memory may be a flash Memory, a storage drive (e.g., a hard disk drive), a solid state disk, and a storage disk (e.g., a compact disk, a DVD).
Referring to fig. 6A, functionally, the subtitle display logic may include an obtainingmodule 601, a determiningmodule 602, and afirst processing module 603, where:
the obtainingmodule 601 is configured to parse the subtitle data to obtain a first subtitle list.
A determiningmodule 602 for parsing the teletext data to determine whether a subtitle of the current page of the teletext is a valid teletext subtitle.
Afirst processing module 603, configured to add the effective teletext subtitles to the first subtitle list to generate a second subtitle list for display.
In a possible implementation manner, the obtainingmodule 601 is further configured to obtain the subtitle information according to the subtitle descriptor in the program map table PMT, and generate the first subtitle list.
In a possible implementation manner, the determiningmodule 602 is further configured to analyze header information of the teletext data, and determine whether the current teletext page is a subtitle teletext page; and if so, further determining whether the caption of the image-text current page is an effective image-text caption.
In a possible implementation manner, the determiningmodule 602 is further configured to determine whether a subtitle of the teletext current page is an empty subtitle; if not, judging whether the caption of the image-text current page is an updatable caption or not; if not, further judging whether the caption of the image-text current page is not coincident with the first caption list, and if not, determining that the caption of the image-text current page is an effective image-text caption.
In another possible embodiment, as shown in fig. 6B, the apparatus further includes:
asecond processing module 604, configured to analyze header information of the image-text data, and determine whether the current page of the image-text is a subtitle image-text; if so, judging whether the magazine number, page number and sub-page number information in the header information of the image-text is consistent with the corresponding content of the effective image-text subtitle in the second subtitle list; if yes, further judging whether the caption of the image-text current page is an effective image-text caption; if not, deleting effective image-text subtitles of which the magazine number, the page number and the sub-page number information are consistent with corresponding contents in the header information of the image-text in the second subtitle list; and if so, adding the caption of the image-text current page into the second caption list.
Embodiments of the present invention also provide a machine-readable storage medium, such as the machine-readable storage medium 502 in fig. 5, including machine-executable instructions, which can be executed by theprocessor 501 in the smart television to implement the channel switching method described above.
So far, the description of the smart tv shown in fig. 5 is completed.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents, improvements and the like made within the spirit and principle of the present invention should be included in the scope of the present invention.