简单!
全部博文(366)
分类: 嵌入式
2012-06-10 23:19:45
A packet is the basic unit of data in a transport stream. It consists of a sync byte, whose value is 0x47, followed by three one-bit flags and a 13-bit PID. This is followed by a 4-bit continuity counter, which usually increments with each subsequent packet of a frame, and can be used to detect missing packets. Additional optional transport fields, whose presence may be signalled in the optional adaptation field, may follow. The rest of the packet consists of payload. Packets are most often 188 bytes in length, but some transport streams consist of 204-byte packets which end in 16 bytes of error correction data. The 188-byte packet size was originally chosen for compatibility with ATM systems.
PIDEach table or elementary stream in a transport stream is identified by a 13-bit PID. A extracts elementary streams from the transport stream in part by looking for packets identified by the same PID. In most applications, will be used to decide how often a particular PID appears in the transport stream.
ProgramsTransport stream has a concept of programs, which are groups of one or more PIDs that are related to each other. For instance, a transport stream used in digital television might contain three programs, to represent three television channels. Suppose each channel consists of one video stream, one or two audio streams, and any necessary metadata. A receiver wishing to tune to a particular "channel" merely has to decode the payload of the PIDs associated with its program. It can discard the contents of all other PIDs.
PATPAT stands for Program Association Table. The PAT lists PIDs for all PMTs in the stream. Packets containing PAT information always have PID 0x0.
PMTProgram Map Tables, or PMTs, contain information about programs. For each program, there is a PMT, with the PMT for each program appearing on its own PID. The PMTs describe which PIDs contain data relevant to the program. PMTs also provide metadata about the streams in their constituent PIDs. For example, if a program contains an video stream, the PMT will list this PID, describe it as a video stream, and provide the type of video that it contains (in this case, MPEG-2). The PMT may also contain additional descriptors providing data about its constituent streams.
PCRTo assist the decoder in presenting programs on time, at the right speed, and with synchronization, programs usually periodically provide a Program Clock Reference, or PCR, on one of the PIDs in the program.
Null PacketsSome transmission schemes, such as those in and , impose strict constant bitrate requirements on the transport stream. In order to ensure that the stream maintains a constant bitrate, a may need to insert some additional packets. The PID 0x1FFF is reserved for this purpose. The payload of null packets may contain any data at all, and the receiver is expected to ignore its contents. As it happens, most multiplexers place all 0's or all F's in these packets, but a few have been seen to insert secret messages for the enjoyment of bored engineers.