int more = DecodeVideoFrame(APTR handle, APTR packet,
struct DecodeVideoFrameCtrl *ctrl);
True here. This indicates that DecodeVideoFrame()
wants to be fed more packets before handing out a decoded frame.
Hollywood will pass a pointer to a struct DecodeVideoFrameCtrl structure
to this function. This structure looks like the following:
struct DecodeVideoFrameCtrl
{
UBYTE **Buffer; // [in/out]
int *BufferWidth; // [in/out]
int Delay; // [out]
ULONG Offset; // [out]
double PTS; // [out]
double DTS; // [out]
};
|
If you return True to indicate that you are not able to decode a full frame
just yet, you don't have to write anything to the struct DecodeVideoFrameCtrl
pointer passed to you by Hollywood. Otherwise you have to set the following
members:
Buffer:UBYTE* pointers.
You need to set these pointers to the chunks of memory containing the actual
pixel data of the decoded frame. If you have set the PixFmt member
in OpenVideo() to HWVIDPIXFMT_ARGB32, you only
need to set the first pointer because ARGB32 frames are stored as chunky
pixels. If you use HWVIDPIXFMT_YUV420P, though, you need to set
all three pointers to point to the individual YUV planes, i.e.
ctrl->Buffer[0] = y_plane; ctrl->Buffer[1] = u_plane; ctrl->Buffer[2] = v_plane; |
Make sure that you do not modify the base Buffer pointer! You must
only write to the individual three pointers already allocated for you by Hollywood.
BufferWidth:PixFmt member in OpenVideo()
to HWVIDPIXFMT_ARGB32, you only need to set the first integer
to the byte width of a single row of ARGB32 pixel data because ARGB32
frames are stored as chunky pixels. If you use HWVIDPIXFMT_YUV420P,
though, you need to set all three integers to point to the byte width
of a single row in each of the three individual YUV planes, i.e.
ctrl->BufferWidth[0] = y_plane_bytewidth; ctrl->BufferWidth[1] = u_plane_bytewidth; ctrl->BufferWidth[2] = v_plane_bytewidth; |
Make sure that you do not modify the base BufferWidth pointer!
You must only write to the individual integer array items already allocated
for you by Hollywood.
Delay:FrameTime specified
in OpenVideo() divided by two. So to delay the current
frame for one FrameTime unit, you'd have to set this member to 2.
This should normally be set to 0.
Offset:SeekMode in OpenVideo() has
been set to HWVIDSEEKMODE_BYTE. If that is not the case, you can
set this member to 0.
PTS:PTS must be a multiple of the FrameTime fraction
specified in OpenVideo().
DTS:PTS
also needs to be specified as a floating point number in seconds.
This function must be implemented in a thread-safe way.
struct DecodeVideoFrameCtrl to be filled out by the functionTrue if function needs more packets to decode a frame, False
if it has successfully decoded a frame