CN1988656A - Soft multiplexing method and device for multiple path transmission flow - Google Patents

Soft multiplexing method and device for multiple path transmission flow Download PDF

Info

Publication number
CN1988656A
CN1988656A CN 200510111939 CN200510111939A CN1988656A CN 1988656 A CN1988656 A CN 1988656A CN 200510111939 CN200510111939 CN 200510111939 CN 200510111939 A CN200510111939 A CN 200510111939A CN 1988656 A CN1988656 A CN 1988656A
Authority
CN
China
Prior art keywords
buffer pool
data
data block
thread
unit
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN 200510111939
Other languages
Chinese (zh)
Other versions
CN100579219C (en
Inventor
顾亚平
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
SHANGHAI DIGIVISION TECHNOLOGY Co Ltd
Original Assignee
SHANGHAI DIGIVISION TECHNOLOGY Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by SHANGHAI DIGIVISION TECHNOLOGY Co Ltd filed Critical SHANGHAI DIGIVISION TECHNOLOGY Co Ltd
Priority to CN200510111939A priority Critical patent/CN100579219C/en
Publication of CN1988656A publication Critical patent/CN1988656A/en
Application granted granted Critical
Publication of CN100579219C publication Critical patent/CN100579219C/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Time-Division Multiplex Systems (AREA)

Abstract

The invention discloses a method and unit for one kind of multiplex transport streams, which is fully realized based on software coding and to be embedded in a chip. Its technology program includes: it transfers all the input TS to the transmission-card, including: it designs a buffer pool for the temporary input of TS data, and it designs the first thread which is used for reading all the data of TS streams and inputting them into the buffer pool, and it designs the second thread which is used for reading the data of the buffer pool and sending them to the sending card.

Description

A kind of soft multiplexing method of multiple path transmission flow and device
Technical field
The present invention relates to the multiplexing method and the device of multiple signals in the Digital Television, relate in particular to method and the device of realizing multi-way signal multiplexing in the Digital Television with software.
Background technology
Digital TV field is especially in its head-end system, with the process that sends the card exchanges data in often need in same transmission medium, transmit multiple signals simultaneously, in the communication technology, be called " multiplexing ".Multiplex technique can be used for improving the utilance of communication line.More common multiplex mode has frequency division multiplexing, time division multiplexing and code division multiplexing etc.Frequency division multiplexing is to utilize different frequencies that different signals is transmitted simultaneously and do not disturb mutually; Time division multiplexing is to utilize different time slots that different signals is transmitted simultaneously and do not disturb mutually; Code division multiplexing is to utilize the code of various signals mutually orthogonal and realize not disturbing mutually.
And in current digital TV field, often adopt the mode of statistic multiplexing to realize.It belongs to time-multiplexed a kind of.Fig. 1 shows the principle of this multiplex mode.As shown in the figure, after these multiplexing characteristics are analyzed each input transport stream (Transport Stream stream) exactly, obtain elementary streams (Elementary Stream) image composition, and in view of the above the data in the transport stream (TS stream) are handled, make the low rate composition take lower bit rate, and the two-forty composition takies high bit rate, and its total bit rate output is fixed.The TS of these multichannels stream 10 is after multiplexer 11 is handled by statistics, is merged into one road signal and is transferred to and sends in the card 12.
But this multiplex technique needs special statistical multiplexer hardware, and just we are referred to as multiplexingly firmly, and its cost of manufacture is very high.
Summary of the invention
The objective of the invention is to solve the above problems, a kind of soft multiplexing method and device of multiple path transmission flow are provided, adopt software coding to realize and it is embedded in the chip fully, well satisfied the requirement of Digital Television head-end system, and greatly reduced system cost.
Technical scheme of the present invention is: a kind of soft multiplexing method of multiple path transmission flow, each input transport stream is transferred in the transmission card, comprising: a) design a Buffer Pool, be used for the data of temporary described each input transport stream; B) design first thread is used for reading the data of described each input transport stream and being written in the described Buffer Pool; C) design second thread is used for reading the data of described Buffer Pool and is transferred in the described transmission card.
In the above-mentioned method, comprise the parameter that synchronization mechanism is provided, the parameter of distribute data piece and the information of the piece that reads and writes data in the described Buffer Pool.
In the above-mentioned method, the parameter of described distribute data piece comprises the number and the size of the position of data block, data block.
In the above-mentioned method, the information of the described piece that reads and writes data comprises the data block number of data block sequence number that described first thread should write, described Buffer Pool that described second thread has been read and the data block number that described second thread can be read from described Buffer Pool.
In the above-mentioned method, described first thread reads the data of each transport stream and is written to Buffer Pool and may further comprise the steps: judge that a) whether described Buffer Pool fills up, and if not, forwards step c) to; B) wait for that described second thread reads the data block in the described Buffer Pool, does not forward step a) to if wait is overtime, if the overtime step h that forwards to); C) read the data of described transmission inlet flow and be written into current being designated as in the data block that should write in the described Buffer Pool; D) the next data block with current writing data blocks is labeled as and should writes; E) judge that whether described Buffer Pool is full, if not, forwards step g) to; F) first data block in the described Buffer Pool is labeled as and should writes, restart to write data; G) the data block number that can read of described second thread increases by one; H) finish.
In the above-mentioned method, described second thread reads the data in the Buffer Pool and is transferred to the step that sends card and comprises: judge that a) that whether data block is arranged in the described Buffer Pool is readable; If forward step c) to; B) wait for that first thread is written to described transmit flow data in the data block of described Buffer Pool, do not forward step a) to if wait is overtime) if the overtime step h that just forwards to; C) read current data block in the described Buffer Pool; D) the data block number that has read increases by one; E) judge that whether the data block in the described Buffer Pool runs through, and if not, forwards step g) to; The data block number that f) will read resets to zero, restarts to read; G) read data block in the next described Buffer Pool; H) finish.
A kind of soft multiplexing device of multichannel TS stream is one and each can be imported the chip that transmit flow data is transferred to the transmission card, and wherein, described chip comprises following three unit: the Buffer Pool unit is used for temporary described each and imports the data of transport stream; The first thread process unit is used for reading the data of described each input transport stream and being written in the described Buffer Pool unit; The second thread process unit is used for reading the data of described Buffer Pool unit and is transferred in the described transmission card.
In the above-mentioned device, described Buffer Pool has data block in the unit, described data block comprises the parameter of synchronization mechanism, the position of described data block, number and size, the data block sequence number that described first thread should write, the data block number that the data block number of the described Buffer Pool that described second thread has been read and described second thread can be read from described Buffer Pool.
In the above-mentioned device, the described first thread process unit comprises: first judging unit is used to judge whether described Buffer Pool unit is full; First reading unit is used for reading the data of described each transport stream and it is write in the data block of described Buffer Pool unit; Indexing unit is used for the data block that described Buffer Pool unit is idle and is labeled as write state; First counting unit is used for the writing data blocks counting to described Buffer Pool unit.
In the above-mentioned device, the described second thread process unit comprises: second judging unit is used for judging whether described Buffer Pool unit also has data block readable; Second reading unit is used for reading the data block of described Buffer Pool unit; Second counting unit is used for the reading of data block count to described Buffer Pool unit.
The present invention has following beneficial effect: the present invention realizes hard multiplexing function with the method for software embedding chip fully, reduces cost greatly.And a classical producer consumer pattern is applied in the coding, promptly provide two threads to be responsible for read-write respectively, avoided too much waiting in the single-threaded alternately read-write that the input and output of hardware handle.The present invention comes the application of loop-around data piece array also in design 3 parameters of having applied in a flexible way in the Buffer Pool, than only using a buffering area, will improve the stability of system data transmission greatly.
Description of drawings
Fig. 1 is the schematic diagram of available technology adopting statistical multiplexer.
Fig. 2 is the schematic diagram of soft multiplexing method of the present invention.
Fig. 3 shows a data structure embodiment of Buffer Pool of the present invention.
Fig. 4 is the flow chart of producer thread in the soft multiplexing method of the present invention.
Fig. 5 is the flow chart of consumer's thread in the soft multiplexing method of the present invention.
Fig. 6 is the theory diagram of the soft multiplexer of the present invention.
Fig. 7 is the theory diagram of producer thread unit in the soft multiplexer of the present invention.
Fig. 8 is the theory diagram of consumer's process unit in the soft multiplexer of the present invention.
Embodiment
The present invention will be further elaborated below in conjunction with drawings and Examples.
Fig. 2 shows the principle of soft multiplexing method of the present invention.Send card and be responsible for the transmission of network data, stick in the process of line data exchange, the design of producers and consumers's thread is introduced in head-end system and transmission.As shown in Figure 2, TS is flowed 121A and TS stream 221B and be defined as the Stream object.In case the Stream object enters broadcast state, will produce two threads: producer thread 22 and consumer's thread 24.The present invention has also designed a Buffer Pool 23, is used for the data of temporary each TS stream.Producer thread 22 reads data wherein by the ByteStream abstraction interface in the Stream object (buffer object of definition), and these data is written in the buffering area of Buffer Pool 23.Consumer's process 24 will read the data in the Buffer Pool 23 and it be submitted to transmission card 25 carry out transfer of data.
In head-end system, the programme content of Digital Television is finished by the program making module, and just when playing, the content of each TS stream exists.This just means the acquisition data that producer thread 22 can be enough fast and is filled in the Buffer Pool 23.Adopting the producer consumer thread to finish the such model of read-write is respectively handling with the input and output of avoiding too much wait hardware than the advantage of single-threaded alternately read-write.
In order to improve the stability of system data transmission, the Data Structure Design of Buffer Pool as shown in Figure 3 simultaneously.This data structure comprises the data block number 37 that the sequence number 35 of the size 34 of actual number 33, each data block of parameter 31 that synchronization mechanism is provided, data block array 32, data block, current data block that producer thread is writing, data block number 36 that consumer's thread has read and consumer's thread can be read.The false code of this data structure is as follows.
The false code of data block is:
typedef?struct?DyMemHandle_s
{ size_t?size;?//?Size?of?bytes.
void*ptr; //?Pointer?to?memory.
} DyMemHandle;
The false code of Buffer Pool data structure is:
typedef?struct?DriverBuffs_s
{ myCriticalSection sync;
DyMemHandle hBuffer[32]; //handle?to?buffer
int count; //allocate?memory?count
int size; //each?memory?size
int req; //number?can?write?in
int rel; //count?user?have?written
int ownedByUser;//count?user?can?read
//out
}DriverBuffs_t;
Parameter s ync can provide synchronization mechanism for system.Parameter hBuffer is exactly the memory buffer pond, specifies here and distributes 32 memory blocks at most.Parameter c ount is the number according to the memory block of different TS flow distribution, and this also is a number of distributing to the hBuffer memory block in the practical application, is respectively hBuffer[0], hBuffer[1] hBuffer[count-1].Parameter s ize is expressed as the size of each memory block storage allocation.Next 3 parametric joints have determined the hBuffer piece that producer thread and consumer's thread write respectively and read.Parameter req represents the producer thread data block hBuffer that should write this moment, and parameter rel represents the number that consumer's thread has read, and parameter ownedByUser represents the data block number that consumer's thread can be read.
Producer thread read the data in the TS stream and be written in the Buffer Pool flow process as shown in Figure 4.Judge at first whether Buffer Pool has been filled 41,, wait for that then consumer's thread reads the data block 42 in the Buffer Pool, enters 49 then if fill up, judge whether wait is overtime, if do not have, then returns state 41, if wait timeout, producer thread goes wrong, and thread finishes; If state 41 is not filled, then reads the data of TS stream and be written in the current data block that should write in the Buffer Pool 43.Then, the next data block of the current data block that is writing is marked as answers write state 44.Judge once more whether Buffer Pool is full, if less than, the data block number that consumer's thread can be read adds 1; If full, then before step 47, earlier first data block in the Buffer Pool is labeled as and should writes, writing data blocks 46 again.After step 47 was finished, producer thread finished.
Its false code is as follows:
void?WriteIntoBuffer(Stream*stream)
{
If (ownedByUser==count) // expression Buffer Pool this moment has been filled and has been finished
Wait (...); // at this moment producer thread must be waited for consumer's sense data
else
{
Write (hBuffer[req]); // write data to hBuffer[req]
req++;
if(req==count)
Req=0; If // req equals count, data then start anew to write
OwnedByUser++; // add 1 accordingly
}
}
Consumer's thread read in the Buffer Pool data block and with its be transferred to send card flow process as shown in Figure 5.At first, judge whether buffering area has data readable 51, if no readable data, wait for that then producer thread writes data in the Buffer Pool 52, enter 59 then,, then return state 51 if wait is not overtime, if wait timeout, then consumer's thread goes wrong, and thread finishes 58; State 51 is if there is readable data, and then consumer's thread reads current data block 53.Then, the data block number that has read adds 1.Whether the judgment data piece has run through 55 once more, if do not run through, then reads next data block 57; Otherwise the data block number that will read before step 57 resets to 0 56.Behind the completing steps 57, thread finishes 58.
The false code of consumer's thread is as follows:
void?ReadOutBuffer()
{
There are not data readable in if (ownedByUser==0) // expression Buffer Pool,
Wait (...); // this moment, the consumer must wait for that producer thread carries out data and write
else?{
Read(hBuffer[req-ownedByUser]);
rel++;
if(rel==count)
rel=0;
ownedByUser--;
}
}
It should be noted that and at consumer's thread end, send data to the transmission card by particular time interval in order to control the bit rate of contained programme information in each TS stream.Because programme content is already present, the padding data that producer thread can be enough fast is in Buffer Pool, and this also just represents always to have in the Buffer Pool data block that data can be provided, and the ownedByUser==0 condition in the just top false code can not exist.Like this, set a timer for each TS stream in realization, according to the bit rate setting-up time interval of this TS stream, regularly the person's of expanding consumption thread reading of data is to sending in the card.As long as when timer starts, always there are data to be read in the Buffer Pool and send in the card for consumer's thread, also just guaranteed the bit rate of each TS stream.
Because all corresponding such producer thread of each TS stream, finally the data that transmit in sending card are exactly that the information of a plurality of TS streams gathers the higher TS stream output of a bit rate that forms, and can not change the bit rate of contained programme information in each TS stream.
Designed a kind of chip according to above-mentioned soft multiplexing method, above-mentioned soft multiplexing method has been weaved into software be embedded in this chip.As shown in Figure 6, producer thread unit 62, Buffer Pool unit 63 and consumer's thread units 64 are connected successively by data wire.Producer thread unit 62 reads the data among each TS stream 61A, the 61B and is written in the Buffer Pool unit 63.The data of Buffer Pool unit 63 temporary each input TS streams.Consumer's process unit 64 reads the data in the Buffer Pool unit 63 and is transferred to and sends in the card 65.
Inside, producer thread unit comprises judging unit 71, reading unit 72, indexing unit 73 and counting unit 74 as shown in Figure 7.Judging unit 71 judges whether the Buffer Pool unit is full; Reading unit 72 reads the data in each TS stream and it is write in the data block of Buffer Pool unit; Indexing unit 73 is labeled as write state with data block idle in the Buffer Pool unit; Writing data blocks in 74 pairs of Buffer Pool unit of counting unit is counted.The operating procedure of these unit is identical with above-mentioned producer thread operating procedure, no longer is repeated in this description at this.
Consumer's thread units inside comprises judging unit 81, reading unit 82 and counting unit 83 as shown in Figure 8.Judging unit 81 judges whether data block is readable in addition in the Buffer Pool unit; Reading unit 82 reads the data block in the Buffer Pool unit; Read block in 83 pairs of Buffer Pool unit of counting unit is counted.The operating procedure of these unit is identical with above-mentioned consumer's threading operation step, also no longer is repeated in this description at this.
The foregoing description provides to those of ordinary skill in the art and realizes or use of the present invention; those of ordinary skill in the art can be under the situation that does not break away from invention thought of the present invention; the foregoing description is made various modifications or variation; thereby protection scope of the present invention do not limit by the foregoing description, and should be the maximum magnitude that meets the inventive features that claims mention.

Claims (10)

  1. The soft multiplexing method of 1 one kinds of multiple path transmission flows is transferred to each input transport stream in the transmission card, it is characterized in that, comprising:
    A) Buffer Pool of design is used for temporary described each and imports the data of transport stream;
    B) design first thread is used for reading the data of described each input transport stream and being written in the described Buffer Pool;
    C) design second thread is used for reading the data of described Buffer Pool and is transferred in the described transmission card.
  2. 2 methods according to claim 1 is characterized in that, comprise the parameter that synchronization mechanism is provided, the parameter of distribute data piece and the information of the piece that reads and writes data in the described Buffer Pool.
  3. 3 methods according to claim 2 is characterized in that, the parameter of described distribute data piece comprises the number and the size of the position of data block, data block.
  4. 4 methods according to claim 3, it is characterized in that the information of the described piece that reads and writes data comprises the data block number of data block sequence number that described first thread should write, described Buffer Pool that described second thread has been read and the data block number that described second thread can be read from described Buffer Pool.
  5. 5 according to claim 1 or 4 described methods, it is characterized in that described first thread reads the data of each transport stream and is written to Buffer Pool and may further comprise the steps:
    A) judge that whether described Buffer Pool fills up, and if not, forwards step c) to;
    B) wait for that described second thread reads the data block in the described Buffer Pool, does not forward step a) to if wait is overtime, if the overtime step h that forwards to);
    C) read the data of described TS inlet flow and be written into current being designated as in the data block that should write in the described Buffer Pool;
    D) the next data block with current writing data blocks is labeled as and should writes;
    E) judge that whether described Buffer Pool is full, if not, forwards step g) to;
    F) first data block in the described Buffer Pool is labeled as and should writes, restart to write data;
    G) the data block number that can read of described second thread increases by one;
    H) finish.
  6. 6 methods according to claim 5 is characterized in that, described second thread reads the data in the Buffer Pool and is transferred to the step that sends card and comprises:
    A) judge that whether data block is arranged in the described Buffer Pool is readable; If forward step c) to;
    B) wait for that first thread is written to described transmit flow data in the data block of described Buffer Pool, do not forward step a) to if wait is overtime) if the overtime step h that just forwards to;
    C) read current data block in the described Buffer Pool;
    D) the data block number that has read increases by one;
    E) judge that whether the data block in the described Buffer Pool runs through, and if not, forwards step g) to;
    The data block number that f) will read resets to zero, restarts to read;
    G) read data block in the next described Buffer Pool;
    H) finish.
  7. The soft multiplexing device of 7 one kinds of multiple path transmission flows is one and each can be imported the chip that transmit flow data is transferred to the transmission card, it is characterized in that described chip comprises following three unit:
    The Buffer Pool unit is used for temporary described each and imports the data of transport stream;
    The first thread process unit is used for reading the data of described each input transport stream and being written in the described Buffer Pool unit;
    The second thread process unit is used for reading the data of described Buffer Pool unit and is transferred in the described transmission card.
  8. 8 devices according to claim 7, it is characterized in that, described Buffer Pool has data block in the unit, described data block comprises the parameter of synchronization mechanism, the position of described data block, number and size, the data block sequence number that described first thread should write, the data block number that the data block number of the described Buffer Pool that described second thread has been read and described second thread can be read from described Buffer Pool.
  9. 9 devices according to claim 8 is characterized in that, the described first thread process unit comprises:
    First judging unit is used to judge whether described Buffer Pool unit is full;
    First reading unit is used for reading the data of described each transport stream and it is write in the data block of described Buffer Pool unit;
    Indexing unit is used for the data block that described Buffer Pool unit is idle and is labeled as write state;
    First counting unit is used for the writing data blocks counting to described Buffer Pool unit.
  10. 10 devices according to claim 9 is characterized in that, the described second thread process unit comprises:
    Second judging unit is used for judging whether described Buffer Pool unit also has data block readable;
    Second reading unit is used for reading the data block of described Buffer Pool unit;
    Second counting unit is used for the reading of data block count to described Buffer Pool unit.
CN200510111939A 2005-12-23 2005-12-23 Soft multiplexing method and device for multiple path transmission flow Expired - Fee Related CN100579219C (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN200510111939A CN100579219C (en) 2005-12-23 2005-12-23 Soft multiplexing method and device for multiple path transmission flow

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN200510111939A CN100579219C (en) 2005-12-23 2005-12-23 Soft multiplexing method and device for multiple path transmission flow

Publications (2)

Publication Number Publication Date
CN1988656A true CN1988656A (en) 2007-06-27
CN100579219C CN100579219C (en) 2010-01-06

Family

ID=38185258

Family Applications (1)

Application Number Title Priority Date Filing Date
CN200510111939A Expired - Fee Related CN100579219C (en) 2005-12-23 2005-12-23 Soft multiplexing method and device for multiple path transmission flow

Country Status (1)

Country Link
CN (1) CN100579219C (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101924865A (en) * 2010-08-10 2010-12-22 福建新大陆通信科技股份有限公司 Method for quickly obtaining data of set top box

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101924865A (en) * 2010-08-10 2010-12-22 福建新大陆通信科技股份有限公司 Method for quickly obtaining data of set top box

Also Published As

Publication number Publication date
CN100579219C (en) 2010-01-06

Similar Documents

Publication Publication Date Title
CN1842160B (en) Rapid media channel changing mechanism and access network node comprising same
CN100431354C (en) Method and apparatus for editing digital video recordings, and recordingds made by such methods
KR100929073B1 (en) Apparatus and method for receiving multiple streams in portable broadcasting system
CN101331772B (en) Method, apparatus and system for controlling a scene structure of multiple channels to be displayed on a mobile terminal in a mobile broadcast system
CN101534406B (en) Video recording device for recording variable frame rate
CN103929657B (en) Video multiplexing apparatus, video multiplexing method, multiplexed video decoding apparatus, and multiplexed video decoding method
CN102802039B (en) Multi-channel video hybrid decoding output method and device
CN108924600A (en) Sending and receiving methods, device and the electronic equipment of live data
KR20030071481A (en) System and methods for providing video-on-demand services for broadcasting systems
CN103686307A (en) Digital signal processor based multi-screen splicing display device
CN103686312B (en) DVR multipath audio and video recording method
CN103260052A (en) Self-adapting display flows
CN103038783A (en) Adaptive video decoding circuitry and techniques
CN102130886A (en) Network video streaming media system, transmission processing method, transmitting end and receiving end
CN103841359A (en) Video multi-image synthesizing method, device and system
CN206472189U (en) A kind of ultra high-definition VR solid time delayers based on fpga chip module
CN104125461A (en) Large-size image compression processing system and method
CN100579219C (en) Soft multiplexing method and device for multiple path transmission flow
CN101534402A (en) Digital video apparatus and related method for generating index information
CN104954748B (en) A kind of video processing architecture
CN103428544A (en) Transmitting apparatus, transmitting method, receiving apparatus, receiving method, and electronic apparatus
US6801536B1 (en) Remultiplexing audio/video PES streams from an MPEG transport system
CN101296323A (en) Lossless time-delay broadcasting system
CN101529381B (en) System and method for object oriented hardware
CN111970552A (en) Method and system for playing DVB panoramic video stream in real time based on set top box

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20100106

Termination date: 20171223

CF01 Termination of patent right due to non-payment of annual fee