Dali : MPEG System Streams -- C API

[ Header Files | Types | Constants | Allocations and Deallocations | System Header Manipulations | Pack Header Manipulations | Packet Header Manipulations | Headers Queries | Headers Intializations | MPEG System TOC Manipulation | See Also ]

Header Files

#include <dvmmpeg.h>

Type Definitions

MpegPktHdr

This structure encapsulates a packet header in MPEG system streams. It contains information about a packet (which is part of either a video or audio stream).

	typedef struct MpegPktHdr {
	    int streamId;
	    int packetLength;
	    int bufferSize;
	    double pts;
	    double dts;
	} MpegPktHdr;
    
streamId
The id of the stream this packet belongs to. This value is stored as it is read from the bitstream. So the range is between 192 and 239. To find the actual stream id, substract 192 from this field. If the result is between 0 - 31, it indicates that the stream it belongs to is an audio stream; 32 - 47 indicates that the stream it belongs to is a video stream.
packetLength
The length of this packet in bytes. This includes the rest of the header after the packetLength field.
buffersize
The maximum decoding buffer size in bytes.
pts
The presentation time stamp for this packet. It indicates the intended time of presentation of this decoder. The timestamp is decoded and stored in this header.
dts
The decoding time stamp for this packet. It indicates the intended time of decoding of this packet. The timestamp is decoded and stored in this header.

MpegPckHdr

This structure encapsulates a pack header from a MPEG system stream.

	typedef struct MpegPckHdr {
	    double sysClockRef;
	    int muxRate;
	} MpegPckHdr;
    
sysClockRef
The system clock reference (intended arrival time of the last byte of this field to the decoder).
muxRate
The rate where the decoder should receive the system stream. in bytes/second.

MpegSysHdr

This structure encapsulates the system header from a MPEG system stream.

	typedef struct MpegSysHdr {
	    int rateBound;
	    unsigned char audioBound;
	    unsigned char fixedFlag;
	    unsigned char cspsFlag;
	    unsigned char audioLock;
	    unsigned char videoLock;
	    unsigned char videoBound;
	    unsigned char numOfStreamInfo;
	    unsigned char streamId[48];
	    int bufferSize[48];
	} MpegSysHdr;
    
rateBound
The upper bound for muxRate.
audioBound
This is greater than or equal to the maximum number of simultaneous active audio streams. It must be less than 32.
fixedFlag
This is 1 if the bitrate is fixed.
cspsFlag
This is 1 if the stream is a constrained system parameter stream.
audioLock
This is 1 if there is a constant relationship between the audio sampling rate and the system clock frequency.
videoLock
This is 1 if there is a constant relationship between the video frame rate and the system clock frequency.
videoBound
An upper bound for the maximum number of simultaneous active video streams.
numOfStreamInfo
The number of entries in the streamId array.
streamId
The stream id for the corresponding entry in the bufferSize array.
bufferSize
The decoding buffer size of each stream. For example, if bufferSize[0] = 40960 and streamId[0] = 32, then the buffer size of stream 32 should be 40960.

StreamInfo

This structure maintains the information about a stream, including the number of packets, a filter for this stream and presentation times of packets from this stream.

	typedef struct StreamInfo {
	    int numOfPacket;
	    int max;
	    BitStreamFilter *index;
	    float *time;
	} StreamInfo;
    
numOfPacket
The total number of packets in the stream.
max
The maximum number of allocated elements in the time array.
index
This is a pointer to a BitStreamFilter structure that contains a filter for this stream.
time
This is an array of floats which keep track of the presentation time stamps from the packet header. If a time stamp is not specified, then the corresponding element in the array is set to -1.

MpegSysToc

This structure stores informations about every streams in a system stream.

	typedef struct MpegSysToc {
	    int numOfVideoStreams;
	    int numOfAudioStreams;
	    StreamInfo *streamInfo[48];
	} MpegSysToc;
    
numOfVideoStreams
The total number of video streams in the system stream.
numOfAudioStreams
The total number of audio streams in the system stream.
streamInfo
An array of 48 pointers to StreamInfo structure. If a stream i does not exist in the system stream, element i in this array will be NULL.

Constants



Operators

Allocations and Deallocations

MpegSysHdr *MpegSysHdrNew ()

void MpegSysHdrFree (MpegSysHdr * hdr)

MpegPckHdr *MpegPckHdrNew ()

void MpegPckHdrFree (MpegPckHdr * hdr)

MpegPktHdr *MpegPktHdrNew ()

void MpegPktHdrFree (MpegPktHdr *hdr)

MpegSysToc *MpegSysTocNew ()

void MpegSysTocFree (MpegSysToc * toc)


System Header Manipulations

int MpegSysHdrFind (BitParser * bp)

int MpegSysHdrDump (BitParser *ibp, BitParser *obp)

int MpegSysHdrSkip (BitParser *bp)

int MpegSysHdrParse (BitParser *bp, MpegSysHdr *hdr)

int MpegSysHdrEncode (MpegSysHdr *hdr, BitParser *bp)


Pack Header Manipulations

int MpegPckHdrFind (BitParser * bp)

int MpegPckHdrDump (BitParser *ibp, BitParser *obp)

int MpegPckHdrSkip (BitParser *bp)

int MpegPckHdrParse (BitParser *bp, MpegPckHdr *hdr)

int MpegPckHdrEncode (MpegPckHdr *hdr, BitParser *bp)


Packet Header Manipulations

int MpegPktHdrFind (BitParser * bp)

int MpegPktHdrDump (BitParser *ibp, BitParser *obp)

int MpegPktHdrSkip (BitParser *bp)

int MpegPktHdrParse (BitParser *bp, MpegPckHdr *hdr)

int MpegPktHdrEncode (MpegPckHdr *hdr, BitParser *bp)


Headers Queries

void MpegSysHdrGetAudioBound (MpegSysHdr *hdr)
void MpegSysHdrGetAudioLock (MpegSysHdr *hdr)
void MpegSysHdrGetBufferSize (MpegSysHdr *hdr, int id)
void MpegSysHdrGetCspsFlag (MpegSysHdr *hdr)
void MpegSysHdrGetFixedFlag (MpegSysHdr *hdr)
void MpegSysHdrGetNumOfStreamInfo (MpegSysHdr *hdr)
void MpegSysHdrGetRateBound (MpegSysHdr *hdr)
void MpegSysHdrGetVideoBound (MpegSysHdr *hdr)
void MpegSysHdrGetVideoLock (MpegSysHdr *hdr)

void MpegPckHdrGetSysClockRef (MpegPckHdr *hdr)
void MpegPckHdrGetMuxRate (MpegPckHdr *hdr)

void MpegPktHdrGetStreamId (MpegPktHdr *hdr)
void MpegPktHdrGetLength (MpegPktHdr *hdr)
void MpegPktHdrGetBufferSize (MpegPktHdr *hdr)
void MpegPktHdrGetPts (MpegPktHdr *hdr)
void MpegPktHdrGetDts (MpegPktHdr *hdr)


Headers Intializations

void MpegSysHdrSetAudioBound (MpegSysHdr *hdr, int bound)
void MpegSysHdrSetAudioLock (MpegSysHdr *hdr, int flag)
void MpegSysHdrSetBufferSize (MpegSysHdr *hdr, int id, int size)
void MpegSysHdrSetCspsFlag (MpegSysHdr *hdr, int flag)
void MpegSysHdrSetFixedFlag (MpegSysHdr *hdr, int flag)
void MpegSysHdrSetNumOfStreamInfo (MpegSysHdr *hdr, int num)
void MpegSysHdrSetRateBound (MpegSysHdr *hdr, int bound)
void MpegSysHdrSetVideoBound (MpegSysHdr *hdr, int bound)
void MpegSysHdrSetVideoLock (MpegSysHdr *hdr, int lock)

void MpegPckHdrSetSysClockRef (MpegPckHdr *hdr, float clockRef)
void MpegPckHdrSetMuxRate (MpegPckHdr *hdr, float muxRate)

void MpegPktHdrSetStreamId (MpegPktHdr *hdr, int id)
void MpegPktHdrSetLength (MpegPktHdr *hdr, int len)
void MpegPktHdrSetBufferSize (MpegPktHdr *hdr, int size)
void MpegPktHdrSetPts (MpegPktHdr *hdr, float pts)
void MpegPktHdrSetDts (MpegPktHdr *hdr, float dts)


MPEG System TOC Manipulation

void MpegSysTocAdd (BitParser * bp, MpegSysToc * toc, int offset)

int MpegSysTocGetOffset (MpegSysToc * toc, int id, double time)

BitStreamFilter *MpegSysTocGetFilter (MpegSysToc * toc, int id)


See Also

Streams


Last updated : Saturday, November 14, 1998, 07:50 PM