Transport stream decoding method and device and storage medium

By directly using the table identification of the transport stream packet in MPEG2-TS stream decoding, the problem of unstandard encoding of TS stream cannot be decoded, and the rapid decoding of any TS stream is achieved. broadcast.

CN119233019APending Publication Date: 2024-12-31ZTE CORP
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310802813.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-06-30
Publication Date
2024-12-31

AI Technical Summary

Technical Problem

The MPEG2-TS stream with irregular encoding cannot be decoded normally during the decoding process, resulting in the problem of inability to play or slow playback speed.

Method used

By obtaining the transport stream packet, determine the target transport stream packet with the table identification equal to the first threshold, and perform format verification according to the preset verification rules, directly use it as a program mapping table, obtain the stream type and audio and video packet identification, and determine whether it is is a recognizable audio and video stream type, so that decoding is performed.

Benefits of technology

It realizes that both the encoding standard and the irregular TS stream can be decoded normally, solves the problem that the non-standard encoding transmission stream cannot be decoded, and achieves the effect of fast broadcasting.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119233019A_ABST
    Figure CN119233019A_ABST
Patent Text Reader

Abstract

The invention provides a transport stream decoding method, a transport stream decoding device and a storage medium. According to the invention, in a transport stream packet identification process, a target transport stream packet is searched directly according to a table identifier in a transport stream packet obtained by parsing a transport stream, and the target transport stream packet conforming to a verification rule is determined as a program mapping table; in other words, the step of searching the program association table first and then searching the program mapping table according to the program association table is omitted, so that the audio and video data are directly acquired according to the stream type and the audio and video packet identifier in the program mapping table for decoding, and therefore, the standard transport stream with standard coding and the transport stream with non-standard coding can be normally decoded, and the decoding efficiency is improved. According to the invention, the problem that the transport stream with nonstandard coding cannot be normally decoded can be solved, and the effect of quickly decoding and playing any transport stream can be achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of multimedia playback technology, and in particular to a method, device and storage medium for decoding a transport stream. Background Art

[0002] MPEG2-TS stream (MPEG2-transport stream, hereinafter referred to as transport stream or TS stream) is a standard audio and video data stream format that can be applied to multimedia playback services such as IPTV and OTT. It can support multiple business forms such as live broadcast, on-demand, time-shift, and playback. It is one of the most widely used data stream formats in the audio and video field.

[0003] The TS stream is composed of transport stream packets (TS package, also referred to as TS packet for short). Each TS packet can store information such as the Program Association Table (PAT or PAT table for short), the Program Map Table (PMT or PMT table for short), audio data or video data (each TS packet stores only one type). The parsing process of the standard TS stream with encoding specifications is: first parse the header of the TS packet, and find the PAT table through the data packet identifier (packet ID, referred to as PID) of the TS packet (the PID of the PAT table is usually fixed to 0x00); parse the PAT table to obtain the PID of the PMT table, and find the PMT table from the TS packet through the PID; parse the PMT table to obtain the PID of the audio and video, and find the audio and video data from the TS packet respectively through the PID of the audio and video; audio and video decoding.

[0004] However, for some TS streams that are not coded in a standard way, there may be no PAT table, or the PAT table intervals are large and the PMT table intervals are normal. If the general parsing process is followed, the video will not be able to be played or will start playing very slowly, affecting the normal transport stream decoding. Summary of the invention

[0005] The embodiments of the present application provide a method, device and storage medium for decoding a transport stream, so as to at least solve the problem in the related art that a transport stream with irregular coding cannot be decoded normally.

[0006] According to an embodiment of the present application, a method for decoding a transport stream is provided, the method comprising:

[0007] Acquire a transport stream, and parse the transport stream to obtain a transport stream packet;

[0008] Determine a target transport stream packet whose table identifier in the transport stream packet is equal to a first threshold;

[0009] Verifying the format of the target transport stream packet according to a preset verification rule, and determining that the target transport stream packet that meets the verification rule is a program mapping table;

[0010] Obtaining the stream type and the audio and video data packet identifier corresponding to the program mapping table, and determining whether the stream type is a recognizable audio and video stream type, and if recognizable, obtaining the audio and video data corresponding to the audio and video data packet identifier;

[0011] Decoding according to the audio and video data;

[0012] Optionally, after acquiring the transport stream and parsing the transport stream to obtain a transport stream packet, and before determining a target transport stream packet whose table identifier in the transport stream packet is equal to the first threshold, the method further includes:

[0013] Determining that the transport stream belongs to a non-standard coded code stream; the type of the non-standard coded code stream at least includes: the transport stream does not include a program association table, or a first interval between program association tables of the transport stream is inconsistent with a second interval between program map tables of the transport stream, and the first interval is greater than the second interval;

[0014] Optionally, obtaining the transport stream includes:

[0015] Get the play command;

[0016] Receiving a transport stream corresponding to the play command;

[0017] Optionally, the determining a target transport stream packet whose table identifier in the transport stream packet is equal to a first threshold comprises:

[0018] Removing the packet header of the transport stream packet and obtaining the table identifier of the transport stream packet;

[0019] Taking the transport stream packet whose table identifier is equal to the first threshold as the target transport stream packet;

[0020] Optionally, before taking the transport stream packet whose table identifier is equal to the first threshold as the target transport stream packet, the method further includes:

[0021] Determining that the data packet identifier of the transport stream packet is not equal to a second threshold;

[0022] Optionally, before taking the transport stream packet whose table identifier is equal to the first threshold as the target transport stream packet, after determining that the data packet identifier of the transport stream packet is not equal to the second threshold, the method further includes:

[0023] Determining that the transport stream packet has not been parsed through a program association table;

[0024] Optionally, the obtaining of the audio and video data corresponding to the audio and video data packet identifier includes: obtaining audio data corresponding to the audio data packet identifier, and / or obtaining video data corresponding to the video data packet identifier;

[0025] Correspondingly, the decoding according to the audio and video data includes: decoding according to the audio data and / or the video data by a decoder.

[0026] According to another embodiment of the present application, a transmission stream decoding device is provided, the device comprising:

[0027] An acquisition and parsing module is used to acquire a transport stream and parse the transport stream to obtain a transport stream packet;

[0028] A determination module, configured to determine a target transport stream packet in the transport stream packet whose table identifier is equal to a first threshold;

[0029] A verification module, used to verify the format of the target transport stream packet according to a preset verification rule, and determine that the target transport stream packet that meets the verification rule is a program mapping table;

[0030] A stream type determination module, used to obtain the stream type and the audio and video data packet identifier corresponding to the program mapping table, and determine whether the stream type is a recognizable audio and video stream type, and if it is recognizable, obtain the audio and video data corresponding to the audio and video data packet identifier;

[0031] A decoding module is used to decode the audio and video data.

[0032] According to another embodiment of the present application, a storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when running.

[0033] According to another embodiment of the present application, an electronic device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.

[0034] The above technical solution provided by the embodiment of the present application has the following advantages compared with the prior art:

[0035] The method provided by the embodiment of the present application obtains a transport stream, and parses the transport stream to obtain a transport stream packet; determines a target transport stream packet in the transport stream packet whose table identifier is equal to a first threshold; verifies the format of the target transport stream packet according to a preset verification rule, and determines that the target transport stream packet that meets the verification rule is a program mapping table; obtains a stream type and an audio and video data packet identifier corresponding to the program mapping table, and determines whether the stream type is a recognizable audio and video stream type, and if recognizable, obtains audio and video data corresponding to the audio and video data packet identifier; and decodes according to the audio and video data.

[0036] Through the present application, in the process of identifying the transport stream packet, the target transport stream packet is directly searched according to the table identifier in the transport stream packet obtained by parsing the transport stream, and the target transport stream packet that meets the verification rule is determined to be the program mapping table, that is to say, the steps of first finding the program association table and then searching the program mapping table according to the program association table are omitted, so that the audio and video data are directly obtained and decoded according to the stream type and audio and video packet identifier in the program mapping table. Therefore, both the standard TS stream with coding specifications and the TS stream with non-standard coding can be decoded normally, which can solve the problem that the transport stream with non-standard coding cannot be decoded normally, and achieve the effect of quickly decoding and starting any TS stream. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0038] Figure 1 is a schematic diagram of the structure of an electronic device provided by an embodiment of the present application;

[0039] Figure 2 It is a flowchart of a method for decoding a transport stream provided by an embodiment of the present application;

[0040] Figure 3 is a schematic diagram of a different code stream provided by an embodiment of the present application;

[0041] Figure 4 This is a schematic diagram of the format of a PMT table provided by an embodiment of the present application;

[0042] Figure 5 is a flowchart of a method for decoding a transport stream provided by another embodiment of the present application;

[0043] Figure 6 is a flowchart of a method for decoding a transport stream provided by another embodiment of the present application;

[0044] Figure 7It is a structural diagram of a transmission stream decoding device provided by an embodiment of the present application. DETAILED DESCRIPTION

[0045] The present application will be described in detail below with reference to the accompanying drawings and in combination with embodiments. It should be noted that the embodiments and features in the embodiments of the present application can be combined with each other without conflict.

[0046] It should be noted that the terms "first", "second", etc. in the specification and claims of this application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.

[0047] Example 1

[0048] The method embodiment provided in the first embodiment of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device, such as a set-top box, a mobile phone or a computer. Taking running on a mobile terminal as an example, Figure 1 FIG. 1 is a hardware structure block diagram of a mobile terminal of a method for decoding a transport stream according to an embodiment of the present application. Figure 1 As shown, the mobile terminal 10 may include one or more ( Figure 1 Only one is shown in the figure) a processor 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data. Optionally, the mobile terminal may also include a transmission device 106 and an input / output device 108 for communication functions. It can be understood by those skilled in the art that Figure 1 The structure shown is for illustration only and does not limit the structure of the mobile terminal. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations shown.

[0049] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the method for decoding the transport stream in the embodiment of the present application. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, to implement the above method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the mobile terminal 10 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0050] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the mobile terminal 10. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0051] In this embodiment, a method for decoding a transport stream running on the above mobile terminal is provided. Figure 2 is a flowchart of a method for decoding a transport stream according to an embodiment of the present application, such as Figure 2 As shown, the process includes the following steps:

[0052] Step S202: acquiring a transport stream and parsing the transport stream to obtain transport stream packets.

[0053] In one embodiment, obtaining the transport stream includes: obtaining a play command, and receiving the transport stream corresponding to the play command.

[0054] In this embodiment, the corresponding TS stream can be received according to the play command, and after receiving the TS stream, it can be parsed to obtain multiple TS packets. The TS packet can store PAT table, PMT table, audio data or video data, etc. Of course, each TS packet can only store one kind of data information.

[0055] It should be noted that the method of the present application is compatible with standard TS streams with coding specifications and TS streams with non-standard coding. For standard TS streams with coding specifications, the PAT table may be ignored, but the PMT table therein may be directly determined according to the parsed TS packets according to the present method, and then the audio and video data may be obtained for decoding according to the stream type and the audio and video packet identifier in the PMT table. Of course, for standard TS streams with coding specifications, decoding may also be performed according to the original process after determining its coding specifications without restriction. Therefore, after parsing the TS stream to obtain the TS packet, it may be first determined whether the TS packet belongs to a standard TS stream with coding specifications or a non-standard coding code stream.

[0056] In one embodiment, after acquiring a transport stream and parsing the transport stream to obtain a transport stream packet, the method further includes: determining that the transport stream belongs to a non-standard coded code stream, and the type of the non-standard coded code stream includes at least: the transport stream does not include a program association table, or the first interval between the program association tables of the transport stream is inconsistent with the second interval between the program mapping tables of the transport stream, and the first interval is greater than the second interval.

[0057] In this embodiment, Figure 3As shown, the PAT table in the standard TS stream (also called normal bitstream) of the coding specification is normal, and the intervals between the PAT tables are consistent with the intervals between the PMT tables. The audio and video data can be decoded after rapid parsing according to the PAT table. Non-standard coded bitstreams include bitstreams without PAT tables and bitstreams with large PAT table intervals and normal PMT table intervals. Among them, the bitstream without PAT table cannot find the PMT table according to conventional means because there is no PAT table, and it is also impossible to find the audio and video data, and cannot be decoded and played normally. For bitstreams with large PAT table intervals and normal PMT table intervals, it takes a long time to wait before finding the PAT table, and then gradually complete the decoding and playback, resulting in a very slow start.

[0058] In this embodiment, after determining that the TS stream belongs to a non-standard coded code stream, the target transport stream packet can be directly searched according to the table identifier in the transport stream packet obtained by parsing the transport stream, and the target transport stream packet that meets the verification rule is determined to be the program mapping table, so that the audio and video data are directly obtained and decoded according to the stream type and audio and video packet identifier in the program mapping table, which can solve the problem that the non-standard coded transport stream cannot be decoded and played normally, has stronger compatibility, and meets the user's needs for playing any coded code stream.

[0059] Step S204: determining a target transport stream packet whose table identifier is equal to a first threshold in the transport stream packet.

[0060] In one embodiment, determining a target transport stream packet whose table identifier is equal to a first threshold in a transport stream packet includes: removing a packet header of the transport stream packet, obtaining a table identifier of the transport stream packet, and taking the transport stream packet whose table identifier is equal to the first threshold as the target transport stream packet.

[0061] In this embodiment, the header of the TS packet is removed and the table identifier (table_id) of the TS packet is obtained. Since the table_id of the PMT table is usually fixed to 0x02, the first threshold can be set to 0x02, and the TS packet with table_id of 0x02 is used as the target TS packet. Since the TS packets with table_id of 0x02 are not necessarily all PMT tables, in order to prevent mismatching, it is necessary to determine whether the content of the target TS packet meets the verification rules. The verification method is described in detail in the following embodiments.

[0062] In one embodiment, before taking the transport stream packet whose table identifier is equal to the first threshold as the target transport stream packet, the method further comprises: determining that the data packet identifier of the transport stream packet is not equal to the second threshold.

[0063] When the data packet identifier (PID) of the TS packet is the second threshold, it indicates that the TS packet is a PAT table. The second threshold may be set to 0x00. In this embodiment, in order to further improve the speed of TS packet recognition, it may be determined first that the PID of the TS packet is not equal to 0x00. The TS packets whose PID is equal to 0x00 are not considered to reduce the computational complexity of parsing the TS packets.

[0064] In one embodiment, in order to further improve the efficiency and speed of TS packet identification, before taking the transport stream packet with a table identifier equal to the first threshold as the target transport stream packet, it can be determined that the transport stream packet has not been parsed through the program association table after determining that the data packet identifier of the transport stream packet is not equal to the second threshold.

[0065] In this embodiment, only the TS packets whose PAT table has not been parsed are judged to determine whether their table_id is 0x02, thereby reducing the amount of calculation for parsing the TS packets, improving the recognition efficiency, and further improving the speed of decoding and starting.

[0066] It should be noted that, in the embodiments of the present application, the first threshold is 0x02 and the second threshold is 0x00 for illustrative purposes only. In practice, the specific values ​​of the first threshold and the second threshold can be set as needed without limitation.

[0067] Step S206: Verify the format of the target transport stream packet according to a preset verification rule, and determine that the target transport stream packet that meets the verification rule is a program map table.

[0068] The validation rule can be the format syntax of the PMT table. The format of the PMT table can be as follows: Figure 4 As shown, the verification method can be verified from top to bottom. For example, only when all the verifications are passed can it be considered that the PMT table format syntax is met. If any of the verifications fail, it is considered not to be compliant. It can also be verified for part of the content. Of course, if a partial verification is performed, it is necessary to ensure that the content of the partial verification is sufficient to verify whether the target TS packet is a PMT table to ensure the accuracy of the verification.

[0069] Step S208, obtaining the stream type and audio / video data packet identifier corresponding to the program mapping table, and determining whether the stream type is a recognizable audio / video stream type. If recognizable, obtaining the audio / video data corresponding to the audio / video data packet identifier.

[0070] The parsed PMT table includes: Figure 4 The various parameters shown, such as table_id, stream type (stream_type), audio and video data packet identifier (PID), etc., are no longer listed one by one.

[0071] The valid values ​​and meanings of stream_type are shown in Table 1.

[0072] Table 1

[0073]

[0074]

[0075] For example, when the stream_type value is 0x1B, it means "AVC video stream as defined in ITU-T Rec.H.164|ISO / IEC 14496-10Video", which means it is an AVC video stream defined in the relevant protocol. In layman's terms, the stream_type value of 0x1B indicates the corresponding video. If the stream type stream_type is a recognizable audio and video stream type, the TS packet corresponding to the audio and video PID is obtained. Here, the TS packet corresponding to the audio and video PID is the audio and video data.

[0076] The audio and video data packet identifier here may include an audio data packet identifier (audio PID) or a video data packet identifier (video PID), and of course it may include both. Obtaining the audio and video data corresponding to the audio and video data packet identifier includes: obtaining the audio data corresponding to the audio data packet identifier, and obtaining the video data corresponding to the video data packet identifier.

[0077] Step S210, decoding is performed according to the audio and video data.

[0078] The audio and video data may be decoded by a decoder, such as decoding the audio data and decoding the video data.

[0079] The method directly searches for the target transport stream packet according to the table identifier in the transport stream packet obtained by parsing the transport stream, and determines that the target transport stream packet that meets the verification rule is the program mapping table, that is, the steps of first finding the program association table and then searching the program mapping table according to the program association table are omitted, so that the audio and video data are directly obtained according to the stream type and the audio and video packet identifier in the program mapping table for decoding. Therefore, both the standard TS stream with coding specifications and the TS stream with non-standard coding can be decoded normally, which can solve the problem that the transport stream with non-standard coding cannot be decoded normally, and achieve the effect of quickly decoding and starting any TS stream.

[0080] In a specific embodiment, the first threshold is 0x02 for example, and the decoding method of the TS code stream without the PAT table is as follows: Figure 5 ,include:

[0081] Step 501, receiving a play command;

[0082] Step 502, receiving and parsing the TS code stream;

[0083] Step 503, find the TS packet whose table_id is 0x02;

[0084] Step 504, checking from top to bottom according to the PMT table format to determine whether the TS packet content conforms to the PMT table format, if it conforms, then execute step 505 in sequence, otherwise return to execute step 502;

[0085] Step 505, determine whether stream_type (obtained by parsing the PMT table in step 504) is a recognizable audio and video stream type, if it is, execute step 506 in sequence, otherwise return to execute step 502;

[0086] Step 506, obtaining the audio and video TS packets through the audio and video PID (obtained by parsing the PMT table in step 504);

[0087] Step 507, injecting audio and video TS packets into the decoder;

[0088] Step 508, decoding.

[0089] This method can skip the PAT table and directly parse the PMT table. For TS code streams without a PAT table, the problem of being unable to play in this case can be solved, and the effect of fast start of playback can be achieved.

[0090] In another specific embodiment, the first threshold is 0x02 and the second threshold is 0x00 for example. The PAT table interval is large and the PMT table interval is normal. The decoding method is as follows: Figure 6 ,include:

[0091] Step 601, receiving a play command;

[0092] Step 602, receiving and parsing the TS code stream;

[0093] Step 603, determine whether PID is equal to 0x00, if yes, execute step 604, otherwise execute step 605;

[0094] Step 604, parse the PAT table, obtain the PID of the PMT table, and continue to execute step 610;

[0095] Step 605, determine whether the PAT table has been parsed, if yes, execute step 610, otherwise, execute step 606 in sequence;

[0096] Step 606, determine whether table_id is 0x02, if yes, execute step 607, otherwise return to execute step 602;

[0097] Step 607, check from top to bottom according to the PMT table format to determine whether the TS packet content conforms to the PMT table format. If it conforms, execute step 608 in sequence, otherwise return to execute step 602;

[0098] Step 608, determine whether stream_type (obtained by parsing the PMT table in step 607) is a recognizable audio and video stream type, if it is, execute step 609 in sequence, otherwise return to execute step 602;

[0099] Step 609, obtain the audio and video TS packets through the audio and video PID (obtained by parsing the PMT table in step 607). If the audio and video TS packets can be obtained normally, it means that the entire parsing process is completed, and continue to step 611; otherwise, return to step 602;

[0100] Step 610, parse the PMT table to obtain the audio and video PID, and execute step 611 in sequence;

[0101] Step 611, inject the audio and video TS packets into the decoder, and then execute step 612 in sequence;

[0102] Step 612, decoding.

[0103] This method can skip the PAT table and directly parse the PMT table. For TS code streams with large PAT table intervals and normal PMT table intervals, the problem of slow start speed in this case can be solved, and the effect of fast start speed can be achieved.

[0104] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in each embodiment of the present application.

[0105] Example 2

[0106] In this embodiment, a decoding device for a transport stream is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.

[0107] Figure 7 is a structural block diagram of a transmission stream decoding device according to an embodiment of the present application, such as Figure 7 As shown, the device comprises:

[0108] An acquisition and parsing module 702 is used to acquire a transport stream and parse the transport stream to obtain a transport stream packet;

[0109] A determination module 704, configured to determine a target transport stream packet in the transport stream packet whose table identifier is equal to a first threshold;

[0110] A verification module 706, configured to verify the format of the target transport stream packet according to a preset verification rule, and determine that the target transport stream packet that meets the verification rule is a program mapping table;

[0111] The stream type determination module 708 is used to obtain the stream type and the audio and video data packet identifier corresponding to the program mapping table, and determine whether the stream type is a recognizable audio and video stream type. If it is recognizable, the audio and video data corresponding to the audio and video data packet identifier is obtained;

[0112] The decoding module 710 is used to decode the audio and video data.

[0113] In the process of identifying the transport stream packet, the device directly searches for the target transport stream packet according to the table identifier in the transport stream packet obtained by parsing the transport stream, and determines that the target transport stream packet that meets the verification rule is the program mapping table, that is, the steps of first finding the program association table and then searching the program mapping table according to the program association table are omitted, so that the audio and video data are directly obtained according to the stream type and the audio and video packet identifier in the program mapping table for decoding. Therefore, both the standard TS stream with coding specifications and the TS stream with non-standard coding can be decoded normally, which can solve the problem that the transport stream with non-standard coding cannot be decoded normally, and achieve the effect of quickly decoding and starting any TS stream.

[0114] Example 3

[0115] An embodiment of the present application further provides a storage medium, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when running.

[0116] Optionally, in this embodiment, the storage medium may be configured to store a computer program for performing the following steps:

[0117] Acquire a transport stream, and parse the transport stream to obtain a transport stream packet;

[0118] Determine a target transport stream packet whose table identifier is equal to a first threshold in the transport stream packet;

[0119] Verifying the format of the target transport stream packet according to a preset verification rule, and determining that the target transport stream packet that meets the verification rule is a program mapping table;

[0120] Obtaining the stream type and the audio and video data packet identifier corresponding to the program mapping table, and determining whether the stream type is a recognizable audio and video stream type, and if recognizable, obtaining the audio and video data corresponding to the audio and video data packet identifier;

[0121] Decoding is performed according to the audio and video data.

[0122] Optionally, in this embodiment, the above-mentioned storage medium may include but is not limited to: a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and other media that can store computer programs.

[0123] Example 4

[0124] The embodiment of the present application further provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any of the above method embodiments. Figure 1 The memory 104 in is taken as an example of a memory in the electronic device.

[0125] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.

[0126] Optionally, in this embodiment, the processor may be configured to execute the steps in the method embodiment through a computer program.

[0127] Optionally, the electronic device may be a terminal such as a set-top box, a mobile phone or a computer.

[0128] Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments and optional implementation modes, and this embodiment will not be described in detail here.

[0129] Obviously, those skilled in the art should understand that the above modules or steps of the present application can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, and optionally, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order from that herein, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present application is not limited to any specific combination of hardware and software.

[0130] The above description is only the preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the principles of the present application shall be included in the protection scope of the present application.

Claims

1. A method for decoding a transport stream, characterized in that: The method comprises: Acquire a transport stream, and parse the transport stream to obtain a transport stream packet; Determine a target transport stream packet whose table identifier is equal to a first threshold in the transport stream packet; Verifying the format of the target transport stream packet according to a preset verification rule, and determining that the target transport stream packet that meets the verification rule is a program mapping table; Obtaining the stream type and the audio and video data packet identifier corresponding to the program mapping table, and determining whether the stream type is a recognizable audio and video stream type, and if recognizable, obtaining the audio and video data corresponding to the audio and video data packet identifier; Decoding is performed according to the audio and video data.

2. The method according to claim 1, characterized in that After acquiring the transport stream and parsing the transport stream to obtain the transport stream packet, and before determining the target transport stream packet whose table identifier in the transport stream packet is equal to the first threshold, the method further includes: Determine that the transport stream belongs to a non-standard encoded code stream; the type of the non-standard encoded code stream includes at least: the transport stream does not include a program association table, or the first interval between the program association tables of the transport stream is inconsistent with the second interval between the program mapping tables of the transport stream, and the first interval is greater than the second interval.

3. The method according to claim 1, characterized in that: The obtaining of the transport stream comprises: Get the play command; Receive a transport stream corresponding to the play command.

4. The method according to claim 1, characterized in that: The step of determining a target transport stream packet in the transport stream packet whose table identifier is equal to a first threshold comprises: Removing the packet header of the transport stream packet and obtaining the table identifier of the transport stream packet; The transport stream packet whose table identifier is equal to the first threshold is used as the target transport stream packet.

5. The method according to claim 4, characterized in that Before taking the transport stream packet whose table identifier is equal to the first threshold as the target transport stream packet, the method further comprises: It is determined that the data packet identifier of the transport stream packet is not equal to a second threshold.

6. The method according to claim 5, characterized in that Before taking the transport stream packet whose table identifier is equal to the first threshold as the target transport stream packet, after determining that the data packet identifier of the transport stream packet is not equal to the second threshold, the method further includes: It is determined that the transport stream packet has not been parsed through a program association table.

7. The method according to claim 1, characterized in that The obtaining of the audio and video data corresponding to the audio and video data packet identifier includes: obtaining audio data corresponding to the audio data packet identifier, and / or obtaining video data corresponding to the video data packet identifier; Correspondingly, the decoding according to the audio and video data includes: decoding according to the audio data and / or the video data by a decoder.

8. A transport stream decoding device, characterized in that: The device comprises: An acquisition and parsing module is used to acquire a transport stream and parse the transport stream to obtain a transport stream packet; A determination module, configured to determine a target transport stream packet in the transport stream packet whose table identifier is equal to a first threshold; A verification module, used to verify the format of the target transport stream packet according to a preset verification rule, and determine that the target transport stream packet that meets the verification rule is a program mapping table; A stream type determination module, used to obtain the stream type and the audio and video data packet identifier corresponding to the program mapping table, and determine whether the stream type is a recognizable audio and video stream type, and if it is recognizable, obtain the audio and video data corresponding to the audio and video data packet identifier; A decoding module is used to decode the audio and video data.

9. A storage medium, characterized in that: The storage medium stores a computer program, wherein the computer program is configured to execute the method according to any one of claims 1 to 7 when executed.

10. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to run the computer program to perform the method according to any one of claims 1 to 7.