APTR handle = OpenVideo(STRPTR filename, struct OpenVideoCtrl *ctrl);
NULL
. The handle returned by OpenVideo()
is
an opaque datatype that only your plugin knows about. Hollywood will simply pass
this handle back to your NextPacket() function when it wants to
have the individual packets of the video file.
This function also has to provide certain information about the video file it
has just opened. This information has to be written to the struct OpenVideoCtrl
that is passed in the second parameter. This structure looks like this:
struct OpenVideoCtrl { int Width; // [out] int Height; // [out] ULONG Duration; // [out] int Frequency; // [out] int Channels; // [out] int SeekMode; // [out] int BitRate; // [out] int PixFmt; // [out] ULONG Flags; // [out] int Pad; // [unused] double FrameTime; // [out] DOSINT64 FileSize; // [out] -- V6.0 STRPTR Adapter; // [in] -- V6.0 struct hwUserTagList *UserTags; // [in] -- V10.0 }; |
The following information has to be written to the struct OpenVideoCtrl
pointer
by OpenVideo()
:
Width:
Height:
Duration:
Frequency:
Channels:
SeekMode:
HWVIDSEEKMODE_TIME:
HWVIDSEEKMODE_BYTE:
BitRate
parameter of this structure
with the target time stamp. This will obviously only work with video streams
that use a constant bit rate. If you choose this mode, make sure to set BitRate
to the correct video bit rate.
Note that this member doesn't have any effect if the HWVIDFLAGS_CANSEEK
flag isn't set.
BitRate:
SeekMode
to HWVIDSEEKMODE_BYTE
. Otherwise this information is not needed. Please
note that in contrast to its name, this member actually needs to be set to a value
in bytes, not in bits!
PixFmt:
HWVIDPIXFMT_YUV420P:
HWVIDPIXFMT_ARGB32:
Flags:
HWVIDFLAGS_CANSEEK
SeekMode
. Note that even if this flag isn't set, your plugin
still needs to be able to rewind the video stream, i.e. seek it back to the very beginning
in case 0 is passed to SeekVideo(). See SeekVideo for details.
FrameTime:
FrameTime
of 0.04 means that
the video is meant to play at 25 frames per second.
FileSize:
Adapter:
NULL
, Hollywood wants your plugin to
use the file adapter specified in Adapter
to open the video file. This means that you
have to use hw_FOpenExt() instead of hw_FOpen()
to open the video file. Make sure to check for Hollywood 6.0 before trying to access
this member because it isn't there in previous versions. See hw_FOpenExt for details. (V6.0)
UserTags:
UserTags
could
also be intended for another plugin, namely the file adapter plugin passed
in Adapter
. See User tags for details. Make sure to check for Hollywood 10.0
before trying to access this member because it isn't there in previous versions.
(V10.0)
Please note that you should not use ANSI C functions like fopen()
to
open the file that is passed to this function because the filename that is passed
to this function can also be a specially formatted filename specification that
Hollywood uses to load files that have been linked to applets or executables. In
order to be able to load these files correctly, you have to use special IO functions
provided by Hollywood. See File IO information for details.
struct OpenVideoCtrl
for storing information
about the video fileNULL
if plugin doesn't
want to handle this video file