Name
NextPacket -- get next packet from stream (V5.0)
Synopsis
int status = NextPacket(APTR handle, struct VideoPacketStruct *p);
Function
This function must read the next packet from the video stream and return it to Hollywood. NextPacket() is passed a struct VideoPacketStruct pointer that looks like the following:

 
struct VideoPacketStruct
{
    APTR Packet;  // [out]
    int Type;     // [out]
    int Size;     // [out]
    int Pad;      // [unused]
    double PTS;   // [out]
};

You have to fill in the following members of the structure:

Packet:
Must be set to a pointer to the actual packet data. This is an opaque data type only understood by your plugin. The packet pointer you specify here will be passed to your plugin's DecodeVideoFrame() or DecodeAudioFrame() function, depending on the packet type. To free the packet data passed here, Hollywood will call FreePacket() on it.

Type:
This must be set to the type of data that is in the packet. This must be one of the following predefined types:

HWVIDPKTTYPE_VIDEO:
Packet contains video data.

HWVIDPKTTYPE_AUDIO
Packet contains audio data.

Size:
This must be set to the packet's size in bytes.

PTS:
This must be set to the packet data's presentation time stamp, i.e. the time when this packet's data should be presented to the viewer, relative to the beginning of the video stream. You have to specify this time stamp as a floating point number in seconds, i.e. a presentation time stamp of 10.2 means that the packet's data is to be shown 10.2 seconds after the start of the video stream. The value you pass in PTS must be a multiple of the FrameTime fraction specified in OpenVideo().

NextPacket() must return a special status code: 0 means success, -1 means NextPacket() has reached the stream end, and -2 means there was an error.

This function must be implemented in a thread-safe way.

Inputs
handle
handle returned by OpenVideo()
v
pointer to a struct VideoPacketStruct to be filled out by the function
Results
status
status code (see above)

Show TOC