Summary of the invention
The technical problem to be solved in the present invention provide a kind of Polymera transmit flow point from method and device, can isolate a plurality of programs, and keep the integrality of each program transmission stream.
For solving the problems of the technologies described above, embodiments of the invention provide technical scheme as follows:
On the one hand, provide a kind of Polymera transmit flow point from method, comprising:
Receive and transmit stream TS, include the information of at least one program among the described TS;
From described TS, obtain transmission package identity code PID corresponding to each program, and the corresponding relation between storage PID and each program;
According to described corresponding relation the packet among the described TS is separated, obtain independent TS corresponding to each program, described independent TS is stored in buffering area corresponding to program, comprises packets of audio data corresponding to program, video packets of data, timer reference of programs PCR, Program Association Table PAT and Program Map Table PMT.
Wherein, described PID corresponding to each program that obtain from described TS comprises:
PAT among the described TS is analyzed, obtain PMT corresponding to each program according to the PMT PID among the described PAT;
The PMT corresponding to each program analyzes, and obtains each program corresponding PCR PID, video packets of data PID and packets of audio data PID.
Wherein, comprise before described packet among the described TS separation according to described corresponding relation:
The PAT that each program of reconstruct is corresponding;
When the PMT of n program PID is consistent, be described n program reconstruct PMT.
Wherein, describedly according to described corresponding relation the packet among the described TS is separated, obtains independent TS corresponding to each program and comprise:
The PID that stores in the PID of the packet among the described TS and the described corresponding relation is mated one by one;
According to matching result, in the buffering area of the program that the PID that stores PAT and the PMT of described packet or reconstruct into packet is corresponding.
Wherein, described according to matching result, comprise in the buffering area of the program that the PID that stores PAT and the PMT of described packet or reconstruct into packet is corresponding:
When the PID of described packet is PAT PID, the PAT of reconstruct is stored in the buffering area of program corresponding to the PID of packet;
When the PID of described packet is PMT PID corresponding to n program, the PMT of reconstruct is stored in the buffering area of a described n program;
When the PID of described packet only is PMT PID corresponding to 1 program, described packet is stored in the buffering area of described program;
When described PID is PCR PID, described packet is stored in the buffering area of program corresponding to the PID of packet;
When described PID is video packets of data PID or packets of audio data PID, described packet is stored in the buffering area of program corresponding to the PID of packet.
The embodiment of the invention also provide a kind of Polymera transmit flow point from device, comprising:
Receiver module is used for receiving and transmits stream TS, includes the information of at least one program among the described TS;
Memory module is used for obtaining transmission package identity code PID corresponding to each program from described TS, and the corresponding relation between storage PID and each program;
Separation module, be used for separating according to the packet of described corresponding relation to described TS, obtain independent TS corresponding to each program, described independent TS is stored in buffering area corresponding to program, comprises packets of audio data corresponding to program, video packets of data, timer reference of programs PCR, Program Association Table PAT and Program Map Table PMT.
Wherein, described memory module specifically is used for the PAT of described TS is analyzed, and obtains PMT corresponding to each program according to the PMT PID among the described PAT; The PMT corresponding to each program analyzes, and obtains each program corresponding PCR PID, video packets of data PID and packets of audio data PID.
Wherein, described device also comprises:
Reconstructed module is used for PAT corresponding to each program of reconstruct; When the PMT of n program PID is consistent, be described n program reconstruct PMT.
Wherein, described separation module comprises:
Matched sub-block, the PID that is used for storing in the PID of the packet of described TS and the described corresponding relation mates one by one;
Sub module stored is used for according to matching result, in the buffering area of the program that the PID that stores PAT and the PMT of described packet or reconstruct into packet is corresponding.
Wherein, described sub module stored specifically is used for when the PID of described packet is PAT PID, the PAT of reconstruct is stored in the buffering area of program corresponding to the PID of packet;
When the PID of described packet is PMT PID corresponding to n program, the PMT of reconstruct is stored in the buffering area of a described n program;
When the PID of described packet only is PMT PID corresponding to 1 program, described packet is stored in the buffering area of described program;
When described PID is PCR PID, described packet is stored in the buffering area of program corresponding to the PID of packet;
When described PID is video packets of data PID or packets of audio data PID, described packet is stored in the buffering area of program corresponding to the PID of packet.
Embodiments of the invention have following beneficial effect:
In the such scheme, from the TS of input, obtain PID corresponding to each program, and the corresponding relation between storage PID and each program; According to this corresponding relation the packet among the TS is separated afterwards, obtain independent TS corresponding to each program, comprise packets of audio data corresponding to program, video packets of data, timer reference of programs, Program Association Table and Program Map Table among independent TS corresponding to each program.The embodiment of the invention not only can be isolated each program that needs efficiently, and isolated each program is the complete TS stream of information, is suitable for the equipment that all support that TS spread and put.
Embodiment
For technical problem, technical scheme and advantage that embodiments of the invention will be solved is clearer, be described in detail below in conjunction with the accompanying drawings and the specific embodiments.
Isolated program from Polymera TS is not the problem of the TS of information completely to embodiments of the invention for STB in the prior art and portable multimedia playback equipment, provide a kind of Polymera transmit flow point from method and device, can isolate a plurality of programs, and keep the integrality of each program transmission stream.
Fig. 1 be the Polymera of the embodiment of the invention transmit flow point from the schematic flow sheet of method, as shown in Figure 1, the present embodiment comprises:
Step 101: receive and transmit stream;
The information that includes at least one program among this TS;
Step 102: from transmit stream, obtain transmission package identity code corresponding to each program, and the corresponding relation between storage transmission package identity code and each program;
Step 103: the packet that transmits in the stream is separated according to corresponding relation, obtain the independent stream that transmits corresponding to each program, the independent stream that transmits is stored in buffering area corresponding to program, comprises packets of audio data corresponding to program, video packets of data, timer reference of programs, Program Association Table and Program Map Table.
Further, the independent private data bag that also comprises other type of program in the stream that transmits.
In the such scheme, from the TS of input, obtain transmission package identity code corresponding to each program, and the corresponding relation between storage transmission package identity code and each program; According to this corresponding relation the packet among the TS is separated afterwards, obtain independent TS corresponding to each program, comprise the private data bag of packets of audio data corresponding to program, video packets of data, timer reference of programs, Program Association Table and Program Map Table and other type of program among independent TS corresponding to each program.The embodiment of the invention not only can be isolated each program that needs efficiently, and isolated each program is the complete TS stream of information, is suitable for the equipment that all support that TS spread and put.
Fig. 2 be the Polymera of the embodiment of the invention transmit flow point from the structural representation of device, as shown in Figure 2, the present embodiment comprises:
Receiver module 20 is used for receiving and transmits stream TS, includes the information of at least one program among the TS;
Memory module 22 is used for obtaining transmission package identity code PID corresponding to each program from TS, and the corresponding relation between storage PID and each program;
Separation module 24, be used for separating according to the packet of corresponding relation to TS, obtain independent TS corresponding to each program, independent TS is stored in buffering area corresponding to program, comprise packets of audio data corresponding to program, video packets of data, timer reference of programs PCR, Program Association Table PAT and Program Map Table PMT, further, the private data bag that also comprises other type of program among the separation module 24 isolated independent TS.
Wherein, memory module 22 specifically is used for the PAT of TS is analyzed, and obtains PMT corresponding to each program according to the PMTPID among the PAT; The PMT corresponding to each program analyzes, and obtains the private data bag PID of each program corresponding PCR PID, video packets of data PID and packets of audio data PID and other type.
Wherein, this Polymera transmit flow point from device also comprise:
Reconstructed module 26 is used for PAT corresponding to each program of reconstruct; When the PMT of n program PID is consistent, be n program reconstruct PMT.
Separation module 24 comprises:
Matched sub-block 25, the PID that is used for storing in the PID of the packet of TS and the corresponding relation mates one by one;
Sub module stored 27 is used for according to matching result, in the buffering area of the program that the PID that stores PAT and the PMT of packet or reconstruct into packet is corresponding.
Sub module stored 27 is concrete to be used for when the PID of packet is PAT PID, the PAT of reconstruct is stored in the buffering area of program corresponding to the PID of packet;
When the PID of packet is PMT PID corresponding to n program, the PMT of reconstruct is stored in the buffering area of n program;
When the PID of packet only is PMT PID corresponding to 1 program, packet is stored in the buffering area of this program;
When PID is PCR PID, packet is stored in the buffering area of program corresponding to the PID of packet;
When PID is the private data bag PID of video packets of data PID or packets of audio data PID or other type, packet is stored in the buffering area of program corresponding to the PID of packet.
In the such scheme, from the TS of input, obtain PID corresponding to each program, and the corresponding relation between storage PID and each program; According to this corresponding relation the packet among the TS is separated afterwards, obtain independent TS corresponding to each program, comprise the private data bag of packets of audio data corresponding to program, video packets of data, timer reference of programs, Program Association Table and Program Map Table and other type of program among independent TS corresponding to each program.The embodiment of the invention not only can be isolated each program that needs efficiently, and isolated each program is the complete TS stream of information, is suitable for the equipment that all support that TS spread and put.
Below in conjunction with accompanying drawing to Polymera of the present invention transmit flow point from method further introduce:
Be illustrated in figure 3 as Polymera of the present invention transmit flow point from the FB(flow block) of method, at first obtain PID (the Packet ID dentifier of each program under each frequency, the transmission package identity code) information, and the PID that each program is corresponding deposits in the program information file; And configure the PID of each required SECTION (part), for tuning, event-monitoring etc., TS is separated with SECTIONPID according to PID corresponding to each program afterwards, exist in the buffering area of corresponding program through isolated packet, just can play, record or distribute TS corresponding to isolated program afterwards.
Among the present invention, the TS source that separate can be: DVB (Digital Video Broadcasting, digital video broadcasting)-C, DVB-T, the parallel or serial TS data of DVB-S and other Digital Television demodulation output; The digital television program of IP network transmission; The TS file; The Polymera TS stream that meets MPEG (Moving Pictures Experts Group/Motin Pictures Experts Group, dynamic image expert group)-2 system layer standards in other medium.
Polymera of the present invention transmit flow point from method mainly may further comprise the steps:
A, obtain all information of each program under each frequency, and deposit in the program information file;
Lock successively each frequency according to frequency meter, by processes such as tuning-demodulation-TS obtain, obtain TS.From TS, leach again PAT (Program Association Table, Program Association Table), PAT is analyzed, obtain PMT (the Program Map Table of each program under this frequency, Program Map Table) PID, and search video packets of data PID, packets of audio data PID, PCR (the program clock reference that PMT obtains each program according to PMT PID, timer reference of programs) PID, and the private data bag PID of other type, deposit program information file in, obtain the process of programme information as shown in Figure 4.
Program information file has all necessary informations of each program under all frequencies, and the information of each program is comprised of following components:
PAT_PID;-----Program Association Table PID;
PMT_PID;----Program Map Table PID;
PCR_PID;---program clock reference PID;
PMT_PID_REPEAT_FLAG;---repeat to indicate; 1, repeat; 0, without repeating
STREAM_NUMBER;---flow amount among the PMT;
STREAM_TYPE1;---stream 1 type among the PMT;
SRTEAM_PID1;---the PID of stream 1 among the PMT;
STREAM_TYPE2;---stream 2 types among the PMT;
SRTEAM_PID2;---the PID of stream 2 among the PMT;
......
STREAM_TYPE15;---the type of stream n among the PMT;
SRTEAM_PID15;---the PID of stream n among the PMT;
Wherein PMT_PID_REPEAT_FLAG is in order to solve special TS problem, sometimes the PMT PID of a plurality of programs is the same among some TS, when TS is separated, if do not resolve PMT then can't correctly identify this PMT and belong to that programs, this PMT_PID_REPEAT_FLAG is set the PMT with repetition PID is indicated, in order to when program parameter is set, the PMT with repetition PID is reconstructed;
B, configure the PID of each program and required SECTION;
The concrete configuration process as shown in Figure 5, wherein SECTION PID arranges, and directly gets final product by the setting of DEMUX (data distributor) equipment, is mainly used in filtering out from TS useful SECTION.
In order to reduce the overhead in the TS separation process, need in advance reconstruct PAT and necessary PMT.PAT among the TS of Polymera includes the PMT pid data of all programs in this frequency, and after TS separated each program independently the PAT among the TS only contain the PMT pid data of this program, so the PAT of input among the TS can not directly use, need to re-construct the independently PAT among the TS of each program according to mpeg standard.
For some special PMT, all use a value such as the PMT PID of many programs of some TS, in a table, multiple programs information is explained the public table of Polymera.In order in separation process, no longer this table to be resolved to save overhead, can re-construct the independently PMT among the TS of each program according to mpeg standard according to the programme information that obtains in the steps A;
C, according to the configuration PID TS is separated, obtain independent TS corresponding to each program.
According to the PID of each set program and the PID of required SECTION, the TS Traffic Decomposition of inputting is become the independent TS of each program and required SECTION, particular flow sheet may further comprise the steps referring to Fig. 6:
The program number of 1) being separated as can be known by the program PID that arranges is N, by the SECTION PID that arranges as can be known required SECTION number be M;
2) according to the total program number N and the SECTION number M that obtain, and corresponding PID, configure filter, prepare the TS of input is filtered.
3) get the packet of TS, this packet is 188 bytes or 204 bytes;
4) take out the PID of this TS packet, according to this PID each PID of SECTION is mated, if coupling then write corresponding buffering area, until all SECTION PID would mate once; If do not mate, turn to 5);
5) at first this packet is carried out the PAT coupling, if this packet is PAT, then the PAT with reconstruct outputs in the buffering area of corresponding program; If this packet is not PAT, turn to 6);
6) according to this PID each PMT PID is mated one by one, if this packet is PMT, also need to judge according to the value of PMT_PID_REPEAT_FLAG whether the PMTPID of this PMT PID and other program repeats, if do not repeat, directly this PMT outputed in the buffering area of the program corresponding with this PID after then the match is successful; If repeat, mate successively the PMT PID of other program after then the match is successful with this PID, until every suit program all mates once, and the PMT of reconstruct is input in the buffering area of program that correspondence has repetition PMT PID; If this packet is not PMT, turn to 7);
7) according to this PID PCR PID being mated, also is that every suit program all mates once; If this packet is PCR, then this packet is outputed in the buffering area of the program corresponding with this PID; If this packet is not PCR, turn to 8);
8) according to this PID all STREAM PID of every programs are mated one by one; If the match is successful then export this packet in the buffering area of the program corresponding with this PID; If mate unsuccessful then abandon this packet;
Wherein, STREAM PID comprises the private data bag PID of video packets of data PID, packets of audio data PID and other type.
9) obtain next TS bag, repeat 3)-9).
As shown in Figure 7, a TS who contains two programs, through Polymera of the present invention transmit flow point from method generate two after separating and overlap independently program, deposit buffering area separately in, wherein, AUDIO is packets of audio data, VIDEO is video packets of data.In the process of separating, the position and the frequency that keep PAT to occur in the TS of each program are constant, insert respectively among the TS of each program; In order to reduce transmission bandwidth and storage data volume, originally the sky bag among the TS and some other useless SECTION are coated abandons, and has only kept the necessary all the elements of TS identification.
The independent TS of the program that technical scheme of the present invention obtains after the TS that inputs is separated can be supported the broadcast that player is identified of TS through Internet Transmission or after preserving into file.
Many functional parts described in this specification all are called as module, in order to emphasize more especially the independence of its implementation.
In the embodiment of the invention, module can realize with software, in order to carried out by various types of processors.For instance, the executable code module of a sign can comprise one or more physics or the logical block of computer instruction, and for instance, it can be built as object, process or function.However, the executable code of institute's identification module need not to be physically located in together, but can comprise the different instruction on being stored in the coordination not, when combining on these command logics, and its composition module and realize the regulation purpose of this module.
In fact, executable code module can be individual instructions or many instructions, and even can be distributed on a plurality of different code segments, be distributed in the middle of the distinct program, and cross over a plurality of memory devices and distribute.Similarly, operating data can be identified in module, and can realize and be organized in the data structure of any suitable type according to any suitable form.Described operating data can be used as the individual data collection and is collected, and perhaps can be distributed on the diverse location (to be included on the different storage device), and can only be present on system or the network as electronic signal at least in part.
When module can utilize software to realize, consider the level of existing hardware technique, so can be with the module of software realization, in the situation that do not consider cost, those skilled in the art can build corresponding hardware circuit and realize corresponding function, and described hardware circuit comprises conventional ultra-large integrated (VLSI) circuit or gate array and the existing semiconductor such as logic chip, transistor or other discrete element.Module can also be used programmable hardware device, realizations such as field programmable gate array, programmable logic array, programmable logic device.
In each embodiment of the method for the present invention; the sequence number of described each step can not be used for limiting the sequencing of each step; for those of ordinary skills, under the prerequisite of not paying creative work, the priority of each step is changed also within protection scope of the present invention.
The above is preferred implementation of the present invention; should be pointed out that for those skilled in the art, under the prerequisite that does not break away from principle of the present invention; can also make some improvements and modifications, these improvements and modifications also should be considered as protection scope of the present invention.