Software Developer Program
2002-1-1
INSTALLATION 3
WINDOWS NT 3
WINDOWS 95 3
USE GUIDELINES 4
STREAMS 5
BASIC STREAMS - AUDIO AND VIDEO STREAMS. 5
GROUP STREAMS 5
SOURCE OF THE STREAM DATA 6
BUFFERED STREAMS 6
BROADCASTED STREAMS 7
AUTOMATIC FLOW CONTROL - CLIENT/SERVER SYNCHRONIZATION. 7
FILE TYPE ANALYSIS 8
THE FRAME BUFFER - SOURCE AND DESTINATION WINDOWS 10
CALLBACK FUNCTIONS 11
TROUBLESHOOTING 13
WHAT’S NEW 14
VERSION 4.00B2: 14
COMMAND SET 15
FMPCALLBACK 16
FMPCAPTURE 17
FMPCLOSE 18
FMPCLOSEDRIVER 19
FMPCOMMAND 20
FMPFREEZE 21
FMPGET 22
FMPGETLASTERROR 23
FMPGROUP 24
FMPOPEN 25
FMPOPENDRIVER 27
FMPPAUSE 28
FMPPLAY 29
FMPSEEK 30
FMPSET 32
FMPSIGNAL 33
FMPSTEP 34
FMPSTOP 35
USING FMP COMMANDS FROM WINDOWS NT™
&
WINDOWS 95™ 41
APPENDIX A - SYMBOLS 43
FMPMACS.H 43
FMPDRV.H 45
FMPFCTW.C 52
Installation
WINDOWS NT
The driver is registered as :
/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Drivers32
ReelDrv ‘’IMPEG32.DLL’’
To load it use the function FMPOpenDriver().
This function opens the 32-bit MPEG driver (IMPEG32.DLL) under Windows NT and prepares it to receive other FMP commands.
This function is implemented in FMPFCTW.C.
then
, you can get information about the driver (name, version) and the state of the hardware with the FMP_GET command.
WINDOWS 95
In SYSTEM.INI add
ReelDrv=C :/REALMAGC/IMPGE32.DLL
in the [drivers32] section.
To load it use the function FMPOpenDriver().
This function opens the 32-bit MPEG driver (IMPEG32.DLL) under Windows NT and prepares it to receive other FMP commands.
This function is implemented in FMPFCTW.C.
Use Guidelines
1. Programming Notes
Stream manipulations
The stream formats supported by this version are :
n MPEG1 and MPEG2 Video
n MPEG1 Audio Layer I and II, MPEG2 Audio Layer I and II,do
lby AC3
n MPEG1 System streams
n MPEG2 Program streams
n MPEG2 Transport streams
When a stream is opened, the driver will try to recognize its format and extract information from it. The file extension is not considered during the identification process.
Samples
Some samples in C are included with the driver. Please, refer to them for more information on how to use the driver.
2. Technical support
If you need additional information, if you encounter problems or if you have any suggestions, please contact REALmagic developer support at:
Fax : 510-770-2640
Streams
Independent of the hardware resources (you will generally be able to play only one video sequence and one audio sequence at a time) this driver provides the capability to manage several streams.
Basic streams - Audio and video streams.
The two basic streams are streams containing only a video channel or an audio channel.
The driver can open up to 255 streams. Each of them can have its own characteristics of speed, window, volume, time format, ... depending on its type (video or audio).
A stream can be in one of these five modes :
* stop mode : the stream is stopped, no display for video streams
* pause mode : the stream is paused. For audio streams it's the same as a stop mode. For video streams, the last frame is frozen in the frame window.
* play mode : the stream is playing. Audio and video.
* seek mode : the stream is reaching a given position. Audio and video
* step mode : the stream is stepping. Video only.
The ready modes are the pause and the stop modes. While initiating a play, seek or step mode, you can specify the mode to enter when the command will be completed : pause, stop, or the ready mode before the command.
If you send a command and the stream is not in a ready mode, the current command is canceled and you will receive a message indicating the cancel.
When initiating a command, control will be returned to you as soon as possible, usually before the command is completed. You can get the current mode of the stream with the FMP_GET-FMPI_STM_MODE command and wait for it to be completed.
When a command is completed, you will receive a FMPM_COMPLETED message (see callback functions pg.Error! Bookmark not defined.).
If a stream is currently playing and you want to play another stream and the hardware is unable todo
so, the new play command has the priority and the play mode of the first stream will be canceled and this stream will enter the mode it would have normally entered after the play.
You can program signals to know for example when a stream has reached a position or at every period you specify. You have only one signal at a time per stream.
Group Streams
Group streams are specials streams containing basic streams. A group stream, like any other stream can be played, stepped, or seeked and commands will apply to all streams contained in the Group.
When you open an interleaved stream, for example an MPEG1 system stream file or an MPEG2 program stream file, it will be opened as a group stream. If you then
play it, video and audio will be played and synchronized together.
You can select or deselect streams in a group. If a file is not selected, it will not be played.
This is useful , for example, when you have several audio tracks, you can select the one you want.
You can create your own group stream . You use open command (FMP_OPEN, pg. Error! Bookmark not defined.) to open a new empty group. then
you can use the group command (FMP_GROUP, pg.Error! Bookmark not defined.) to add, remove, select, deselect streams in it.
Source of the stream data
Basic stream data can be provided in three ways:
- from a file : the driver directly processes the file format and buffers. We call them file streams.
- from pull model buffers (buffered streams) : the calling application provides the stream data.
- from push model buffers (broadcasted streams) : the network provides the stream data.
Buffered streams
On-Demand application are generally pull implementations.
· Standard Pull Model (exists in previous version of the driver) - Driver asks for data when it is needed. When no data is available, the drivers just wait until the application gives a new buffer.
In the case of buffered streams, the user is responsible for providing valid data.
Use the open command (FMP_OPEN with the flag FMPF_BUFFERS, pg.Error! Bookmark not defined.) to open a buffered stream.
If a callback function is installed for the driver, it will be called with the FMPF_BUF_CREATE message with the parameter you gave with FMP_OPEN. (If no callback function is defined for the stream initially, then
FMPF_BUF_CREATE message will be sent once the callback function is installed .)
A buffered stream will use a buffer in user’s application. No copy of buffer data will be made, so user should be careful not to overwrite data not yet read from the buffer. A buffer is a segment of linear memory anywhere in the physical memory space. You give the driver the address, the size, the mode of access of your buffer, by using FMP_SET command. You can use the FMP_GET command to get status as to how many bytes are left (or have not been read) in the buffer. The driver uses a message (see callback function) to tell the user when all of his buffer has been read (FMPM_BUF_EMPTY). At this time, you can use the FMP_SET command to give new buffer parameters to the driver. If the user decides to ignore the callback message, the buffer will be read again from the start if the flag FMPF_BUF_LOOP is set in FMPI_BUF_MODE.
You can specify a position that will generate a FMPM_BUF_POS message. This can be used to implement a FIFO or to begin
preparing data for a ping pong buffer. For example, your buffer has a size of 10kb. You can tell the driver to signal when there are less than 1kb left in the buffer ( pos=1024 ). The message FMPM_BUF_POS will be issued when the position is r7eached. (see Callback functions).
If you write a zero value for the size, the driver will assume the stream has ended and will then
set the size of the stream.
The callback function can receive the message FMPM_BUF_SEEK indicating that your next packet of data will have to start at the given offset (specified in bytes) within your stream file.
Youdo
n't need to pre-fill your buffers, because at the begin
ning, the FMPM_BUF_POS message (when you normally prepare the next buffer) will be sent before the FMPM_BUF_EMPTY (where you give a prepared buffer).
With the messages defined, you can manage your buffers inside the callback function, without external initialization or destruction or pre-fill.
Moreover, streams have a user information field FMPI_STM_USER that you can use to store information about the streams buffers, so you can use this and a single callback function for all your streams.
Broadcasted streams
In broadcast applications, the server drives the bitrate of the stream and pushes the data to the client. We can make the job of the programmer easier by providing an API that allow the user to push data to our driver rather than its native pull.
· User supplies data at the rate that the user defines. A FIFO is maintained by the driver and it tries to maintain half-fullness with it. Playback is triggered when it reaches a start threshold. Callbacks signal the application when data overflows or underflows.
· User defines a start threshold, a low threshold and a high threshold via and API call. User will receive callback to the application if the start, low or high threshold is traversed, allowing the user to take necessary action.
· Another API call allows the user to pass buffer pointers to the driver.
· Buffering algorithm implements flow control. (see below)
In the case of buffered streams, the user is responsible for providing valid data.
Use the open command (FMP_OPEN with the flag FMPF_BROADCAST, pg.Error! Bookmark not defined.) to open a broadcasted stream.
You can push buffers to the driver by using FMP_SET command with two different settings:
· FMPI_PUSH_SYNC The driver copy the buffer before returning, so you can use it immediately
· FMPI_PUSH_ASYNC No copy of buffer data will be made, so user should be careful not to overwrite data not yet read from the buffer. When the driver has read the buffer, it sends a FMPM_PUSH_READ message to the callback routine (value is a pointer to the FMP_PUSH_BUF read).
In both cases, the third value of FMPSet is a pointer to a FMP_PUSH_BUF structure.
If the FMPSet returns FMPE_REFUSE :
1. The stream is not in play mode but you are feeding the FIFO.
2. The FiFo is full : in this case you should send a stop and a play or the driver will refuse data until it has emptied the FiFo.
Youdo
n't need to pre-fill your buffers before opening the stream : the driver will open by default a Group Stream and as soon as you push data, the driver will analyze them to find the type of the stream and will begin
to play.
Automatic Flow Control - Client/Server Synchronization.
The synchronization may become an issue in the broadcast case if the client and server clocks are slightly out of sync. Although the server always sends the MPEG stream over the network at the bitrate that the stream is encoded for, if the client clock is only slightly faster than that of the server, the MPEG decoder will consume data slightly faster than the broadcast rate. This would eventually result in buffer underflow. On the other hand, if the client clock is slightly slower than the server clock, the decoder will not consume data fast enough and data overflow will eventually occur.
Buffered API implementation implements some sort of flow control mechanism for passing data to the decoder. The flow control mechanism maintains that data is always available to the decoder. That’s the way the decoder likes it.
One method of flow control is implemented: Auto Start/Stop :
· Start/Stop - The driver automatically pauses streaming when it detects underflow condition in FIFO. When a start threshold is met, it will automatically start. Overflow will be managed by dropping video packets. Audio to remain in sync.
User can set start, low and high threshold by using FMPSet command.
File type analysis
The following rules are only information on reader’s discretion and are subject to changes:
· The extension is not used to determine the file type.
· After opening the input file and reading MPEG data, the FMP driver will search for a MPEG pack header (0x000001BA), for a MPEG2 transport syncbyte (0x47), for a sequence header (0x000001B3) or for an audio syncword (0xFFF). The driver will consider immediately the file as a MPEG1 system file or a MPEG2 program file when a pack header is found. In the case of a MPEG2 transport stream, the driver will try to find at least 10 MPEG2 transport packets (188 bytes length, begin
ning with 0x47). In the last two cases, the diver will keep on searching for a header in order to verify the sequence header or the audio syncword is not inside a packet. When a minimum number of bytes has been looked (around 3000 bytes), the driver will decide whether the file is a video file (first choice) or an audio file (no sequence header has been found).
· When the file is considered as a MPEG1 system file or MPEG2 program system , the driver will start searching for information on the different video and audio streams. When a sequence header is found (there can be more than one to describe the streams), the driver will use it to calculate the number of video and audio streams. then
, the driver will try to retrieve information for those streams in the first 20 packets. If some streams remain not initialized (i.e. declare inside a sequence header, but no matching packets) the driver will keep on looking in the next 80 packets or until the first matching packet is found. If some streams are unknown (i.e. not declare in a sequence header), they will be treated the same way. Note that the driver will stop searching for streams when an invalid packet is found (i.e. the next packet headerdo
es not match with the previous packet header after adding the position of the previous packet and its size).
· When the file is considered as a MPEG2 transport stream, the driver will start searching for a program association table, then
for the program map tables to get the elementary streams. The, the driver will try to retrieve information for the elementary streams by using the random_access_indicator bit.
· When the file is considered as an audio file, the first audio syncword found will be considered as the begin
ning of an audio frame (which may not be true: audio syncword are allowed inside audio data).
· The first packet of a stream is used to determine some of its characteristics. Thus, the first video packet needs to have a sequence header fully contained inside the packet (itdo
es not have to be at the begin
ning of the packet). Same thing for the audio: the first audio syncword found in the packet - there must be at least one - will be considered as the begin
ning of a valid audio frame.
The Frame Buffer - Source and destination windows
This concerns video streams.
* The frame buffer is a hardware buffer containing an entire decompressed picture.
* The source window is the area in the buffer that will be effectively displayed.
* The destination window is the area in the VGA display where the piece of picture will be placed.
* The visual content of the source window is scaled to fit in the destination window.
* The video window uses RGB pixels and so can display 16 million colors.
There are several ways to control the way VGA pixels are replaced by video pixels in the destination window. This is the keying mode (FMPI_VID_KEY_MODE)
* FMPF_ALL_VGA : The destination window is hidden.
* FMPF_ALL_VID: Video is always displayed in the destination window.
* FMPF_KEY_VGA (default): All the pixels in the VGA destination window matching the key color (FMPI_VID_KEY_COL, color 0 - usually black - is default) after the key mask (FMPI_VID_KEY_MASK, default mask=0xFFFF) are transparent and replaced by video. This is useful to keep the mouse visible over the video window. Todo
this, you paint the destination window area with a color not used by the mouse pointer or other objects you want to keep visible and you specify this color as the key color. The key color is an index in the palette or an RGB color, depending of the current VGA mode. With the mask, you can select more colors because the mask is applied on the VGA pixel before being compared to the key color. The equation is (in C syntax) :
if ( (VGAPixelColor &
VGAKeyMask) == (VGAKeyColor &
VGAKeyMask) ) Show the video pixel
* FMPF_KEY_VID : All the pixels in the video destination window are compared to a min. and a max. R8G8B8 color. If they are inside the range, they are not shown. This can be used for example to display an animated object over the VGA. Todo
this, the video animation can have an object moving on a background whose colors is between the two values. So, the background will not be displayed and the object will move over the VGA display. The equation for this mode is (in C syntax) :
if (VideoPixelColor >= FMPI_VID_KEY_MIN) &&
VideoPixelColor <= FMPI_VID_KEY_MAX)) Show the VGA pixel
The RGB comparison is made on each R, G and B value. The previous equation must be true for each component.
* FMPF_KEY_MIX : a combination of VGA Key and Video Key.
Callback Functions
A callback function is a function of your application called by the driver in some situations.
You use the FMP_CALLBACK command to define callback functions. You can define a callback function per stream. If a stream has no callback function defined, the default driver callback function will be called (defined with the FMP_CALLBACK command with a zero handle for the stream).
Depending on the flags specified when declaring your function, the return status is passed in DWORD ’Value’
Your function should look like this:
DWORD MyCallBack(BYTE bMsg, BYTE hStream, DWORD dwValue);
You should return a zero value if successful.
The CallBack is called asynchronously from the driver, so you can use any command to re-enter the driver (Asynchronous messages are not re-entrant in the callback : you need to finish to treat a message before receiving a new one)..
For optimal performance, all FMPM_BUF_* messages are sent to the callback synchronously (the driver waits for the callback to finish before continuing). You can only use FMPGet and FMPSet from these messages.
The defined messages are :
FMPM_ERROR [async]
Specifies that an error occurred while executing a command. The error in Value may be one of the following:
FMPE_ERROR System error occurred while reading the stream
FMPE_INVALID_FLAG Flag in command is invalid
FMPE_HANDLE Handle in command is invalid
FMPE_NOT_IMPLEMENT Command not implemented
FMPE_INVALID_CMD Command is invalid
FMPE_OUT_OF_MEM Not enough memory to execute the command
FMPE_INDEX Index is invalid (in FMPGroup command)
FMPE_TYPE Invalid command for this type of stream
FMPE_TOO_MANY Too many open streams
FMPE_POS No more data to execute the command
FMPE_HARDWARE Problem occurred with the hardware
FMPE_STREAM_DATA The stream contains invalid data
FMPM_SIGNAL [async]
Message issued when the stream has reached the specified position with the (FMP_SIGNAL) command or when a period has completed (see FMP_SIGNAL). Value is the current stream position in frames.
FMPM_COMPLETED [async]
Message issued when a command has completed, for example when a play command is ended.
The stream is in a ready mode (paused or stopped) . Value is the completed command
FMPM_CANCELED [async]
Message issued when a new command is sent before a previous one has completed. Value is the
canceled command.
FMPM_BUF_CREATE (Buffered streams) [sync]
This message is sent when a buffered stream is opened. You can allocate your buffers and initialize the stream parameters when receiving this message. Value is the value passed in the
FMP_OPEN command. (Pointer to a FMP_OPEN_STRUCT structure
FMPM_BUF_CLOSE (Buffered streams) [sync]
This message is sent when the stream is about to be closed. This is the point where you can release stream resources (memory etc.)
FMPM_BUF_SEEK (Buffered streams) [sync]
This message is sent to ask you to seek to a given position in bytes. Value is the position to reach in bytes.
FMPM_BUF_EMPTY (Buffered streams) [sync]
This message is sent when a buffered stream's buffer is empty and more data is needed to complete the actual command. You can specify a new buffer with the FMP_SET-FMPI_BUF_ADDRESS command. If not then
the stream is stopped unless FMPF_BUF_LOOP flag is set In which case current buffer is scanned again. Value is the current position of the stream in bytes.
FMPM_BUF_POS (Buffered streams) [sync]
This message is sent when a buffered stream's buffer has reached the position specified with FMPI_BUF_POS.
Note: when the stream begin
s to play, you will receive this message before FMPF_BUF_EMPTY, so youdo
n't have to prepare the first buffer when opening the stream.
FMPM_FIFO_START [async]
This message is sent when the flow control is enabled and when FiFo has reached FMPI_FIFO_START position. The stream starts to play.
FMPM_FIFO_LOW [async]
This message is sent when the flow control is enabled and when FiFo is below FMPI_FIFO_LOW threshold. If FiFo reaches 0, it will pause untill it reaches FMPI_FIFO_START position.
dwValue is FMPF_AUDIO if the Audio FiFo is below low threshold, FMPF_VIDEO if it is the Video FiFo.
FMPM_FIFO_HIGH [async]
This message is sent when the flow control is enabled and when FiFo is over FMPI_FIFO_HIGH threshold. If FiFo reaches maximum size and FMPI_FIFO_DROP is enabled, the driver will drop packets to reduce the flow. If not, the FiFo will grow indefinitely and you will receive FMPM_BUF_HIGH message every time FiFo reaches a multiple of the maximum size.
dwValue is FMPF_AUDIO if the Audio FiFo has reached high threshold, FMPF_VIDEO if it is the Video FiFo.
FMPM_FIFO_DROP [async]
This message is sent when the driver has to drop packets to prevent overflow.(Flow Control and Drop Packets must be enabled)
dwValue is the number of dropped packets
FMPM_PUSH_INIT (broadcasted streams) [async]
This message is sent when a broadcasted stream has been opened and enough packets have been sent to the driver to determine all the parameters of the streams. You can initialize the stream parameters when receiving this message. Value is the value passed in the FMP_OPEN command. (Pointer to a FMP_OPEN_STRUCT structure)
FMPM_PUSH_READ (broadcasted streams) [sync]
This message is sent when the driver has read a broadcasted stream buffer.
DwValue is a pointer to the FMP_BROADCAST_BUF that has been read.
FMPM_PUSH_SEEK (broadcasted streams) [async]
This message is sent to ask you to seek to a given position in bytes. Value is the position to reach in bytes. (broadcasted streams)
FMPM_PUSH_CLOSE (Buffered streams) [async]
This message is sent when the stream is about to be closed. This is the point where you can release stream resources (memory etc.)
Troubleshooting
If you experience troubles using the callback functions, here are a few tips:
1. The first message you have to treat is FMPE_ERROR. If not, you can overflow the stack if you generate an error in the callback.
2. Your callback is called using the C calling convention. Make sure your callback uses this convention (if not, you can experience stack problems or reverse order arguments).
3. Verify youdo
n’t erase or rewrite memory blocks the driver has not finished to read.
4. If the callback receives FMPM_BUF_* or some FMPM_PUSH_* messages, you can only execute FMPGet or FMPSet from the callback. (You cando
what you want from others messages).
5. You should treat fastly any message you receive: if you lock the callback in a synchronous message, you also lock the driver (which waits the callback to return). If you lock the callback in an asynchronous message, you won’t receive any other asynchronous messages (but you can receive synchronous messages).
6. After opening a Broadcasted stream, since no information is available for the driver, it is possible that some settings related to video or audio streams will fail (FMPSet will fail). You need to send some packets to the decoder. You can only initialize the Stream Parameters only after receiving the FMP_PUSH_INIT message.
What’s New
Version 4.00b2:
· FMPM_PUSH_INIT and FMPM_PUSH_CLOSE have been added for broadcasted streams support.
· Improved Flow Control of the Fifos (no more division by zero).
· The driver should not hang when closing a broadcast stream.
· FMPI_STM_NOCACHE added : Useful if you want to receive FMPM_BUF_SEEK or FMPM_PUSH_SEEK messages even if data are in the internal cache of the driver
· Better handling of still pictures and slide shows for Video-CD 2.0.
· Support for Hollywood MPEG2 board.
Version 4.00b3:
· FMPI_FIFO_VID_LEFT and FMI_FIFO_AUD_LEFT added : number of left bytes in each FiFo.
· STOP (MULTIPLE_IRP_COMPLETION) (Blue Screen) in MPEG1 drivers for Windows NT when using FMPSignal.
Version 4.00RC1
· FMPI_STM_DEV_POS added to differenciate last played position from last read position :
FMPI_STM_POSITION is the actual position of the stream in the stream time format (last played data)
FMPI_STM_DEV_POS is the actual position of the device (file, buffer) in the stream format. (last read data)
· When seek pass the end of the file, FMPE_POS instead of FMPE_STREAM_DATA will be send to the callback.
Command Set
Following are the different commands you can use to access the driver.
Here is a summary of the commands classed by function.
* To open and close streams:
FMP_OPEN opens a stream
FMP_CLOSE closes a stream
* To play the stream
FMP_FREEZE pauses video without pausing audio
FMP_PLAY plays a stream
FMP_PAUSE pauses a stream
FMP_STOP stops a stream
FMP_SEEK seek at a position in a stream
FMP_STEP step frames for video streams
* To manage group streams
FMP_GROUP
* To set and get params about the driver and streams
FMP_SET sets a parameter
FMP_GET gets a parameter
* Todo
specials functions on streams
FMP_CAPTURE captures a frame of video into a bitmap
FMP_CALLBACK installs a callback function for a stream
FMP_SIGNAL installs a signal for a stream
FMPCallback
Description registers a callback function for buffered stream mode
DWORD FMPCallback (stream, callback);
BYTE stream MPEG stream handle
DWORD callback Pointer to the callback routine.
Return Value
Zero if successful or returns an error code
FMPGetLastError may be used to retrieve the last error code. The following are valid error codes from FMPGetLastError:
FMPE_HANDLE The handle of the stream is not valid.
Remarks
The FMPCallback command allows you to install callback functions. These functions are called when a command is completed, when an error occurs, or when driver needs data for a buffered stream. If a NULL callback handle is specified, the callback messages are sent to the driver. You can specify a null pointer if youdo
n't want a callback function for a stream or for all the streams.
See Also
Callback Functions
MCI Equivalent
MMIO install IO procedure.
FMPCapture
Description: Captures a video frame into a bitmap
DWORD FMPCapture (stream, flags, position);
BYTE stream Handle of the stream to capture.
WORD flags Bitmap type:
FMPF_PIC_BMP - Capture into 24-bit Windows BMP format.
FMPF_PIC_DIB24 - Capture into 24-bit DIB bitmap.
DWORD position Pointer to the buffer where the driver should store the bitmap. If this Pointer is 0, the driver will return the size necessary to store the image. then
you can allocate a buffer of this size and call FMPCapture with the pointer.
Return Value
Zero if successful. Otherwise, returns an error code.
Remarks
The FMPCapture command allows you to capture the currently displayed frame into a still image file.
See Also
MCI Equivalent
MCI_CAPTURE
FMPClose
Description: This function closes the specified stream
DWORD FMPClose (stream);
BYTE stream Handle of the stream to close.
Return Value
Zero if successful. Otherwise returns an error code.
Remarks
The FMPClose command closes a previously opened stream. All buffers are released, the file is closed and the handle becomes invalid until attributed to another stream. If the stream is not in the stop mode, a stop command is issued before closing.
See Also
FMPOpen
MCI Equivalent
MCI_CLOSE
FMPCloseDriver
Description: This function closes the MPEG driver.
.
DWORD FMPCloseDriver (void)
Return Value
None
Remarks
This function closes the 32-bit MPEG driver (IMPEG32.DLL) under Windows. No FMP functions should be called after the driver is closed.
This function is implemented in FMPFCTW.C.
See Also
FMPOpenDriver
Application Startup / Exit
MCI Equivalent
None
FMPCommand
Description: This command can be used to send a generic command to the driver.
DWORD FMPCommand (command, stream, flags, value);
BYTE command Command code.
BYTE stream Stream ID.
WORD flags Command flags.
DWORD value Command value.
Return Value
Return value of the command.
Remarks
This command sends a generic command to the driver. Most other commands are macros that map to this function.
In Win32, this function is implemented in FMPFCTW.C.
See Also
None
MCI Equivalent
None
FMPFreeze
Description: This command freezes Video frame, but continues to play Audio
DWORD FMPFreeze (stream);
BYTE stream Handle of the stream to pause.
Return Value
Zero if successful. Otherwise, returns one of the following error codes:
FMPE_HANDLE The handle of the stream is not valid.
Remarks
The FMPFreeze command freezes the video of an MPEG stream, but audio continues to play.
See Also
FMPPause, FMPStop
MCI Equivalent
MCI_FREEZE
FMPGet
Description: This command returns a value of specified setting for specified stream
DWORD FMPGet (stream, index);
BYTE stream Handle to the stream.
WORD index Index of the value to get.
Return Value
Value of the setting. Or 0xFFFFFFFF in case of error.
FMPGetLastError can be used to obtain error information about the command.
Error codes returned from FMPGetLastError:
FMPE_HANDLE The handle of the stream is not valid.
FMPE_INDEX The index is invalid.
FMPE_TYPE The index represents a value meaningless for the stream (for example, a volume setting for a video stream).
Remarks
The FMPGet command allows you to get a stream setting.
A NULL handle allows retrieval of a non-stream setting. The driver settings include information, status and default settings.
See Also
Settings
FMPSet
MCI Equivalent
MCI_INFO,
MCI_STATUS
FMPGetLastError
Description: This command returns the error code for last command executed by the driver.
DWORD FMPGetLastError ();
Return Value
Returns the error code for the last command executed.
Remarks
See Also
Error Codes
FMPGroup
Description: This command is general-purpose command for group stream. The user should use this command to manipulate group streams.
DWORD FMPGroup (stream, flags, value)
BYTE stream Stream handle
WORD flags Sub-command:
FMPF_INSERT Inserts a stream in the group (handle).
FMPF_REMOVE Remove a stream from the group (handle or index).
FMPF_GET Returns a stream handle given an index in the group list.
FMPF_SELECT Selects a stream in the group (handle or index) for playing.
FMPF_UNSELECT Unselects a stream in the group (handle or index) from playing.
Combined with the flags:
FMPF_HANDLE (Default) The element is given by its handle.
FMPF_INDEX The element is given by its index in the group list.
DWORD value Index or handle of the element. If NULL then
remove, select and deselect commands will apply to all streams in the group.
Return Value
Zero if successful. Otherwise FMPGetLastError can be used to obtain the last error code.
FMPE_HANDLE The handle of the group stream is not valid.
FMPE_FLAGS Invalid or incoherent flags (FMPF_INSERT with FMPF_INDEX for example).
FMPE_TOO_MANY There are too many streams in the group.
FMPE_ITEM_INDEX The index is invalid.
FMPE_ITEM_HANDLE The item handle is not valid.
Remarks
The FMPGroup command allows you to manipulate group streams.
If you try to add an already inserted stream in the group, there will be no error but the stream will not be inserted twice. The streams inserted in a groupdo
not have child/parent relationship. If the group is closed, the streams inserted in the group are not closed automatically. When a stream is inserted in the group, it is automatically selected.
MCI Equivalent
MCI_SETAUDIO/MCI_DGV_SETAUDIO_STREAM
MCI_SETVIDEO/MCI_DGV_SETVIDEO_STREAM
FMPOpen
Description: This command opens an MPEG stream.
DWORD FMPOpen (flags, value);
WORD flags Specifies initial Stream mode on Open
FMPF_FILE (Default) Stream data is read from a file.
FMPF_BUFFERS Stream provided by application. Cannot be used with FMPF_NOACCESS. (Pull buffers)
FMPF_GROUP Group of streams.
FMPF_BROADCAST Stream provided by application.(Push buffers)
DWORD value
· pointer to a null terminated string for FMPF_FILE.
that contains the file name to be opened
· pointer to a FMP_OPEN_STRUCT struct for FMPF_BUFFERS.
· NULL for FMPF_GROUP.
· pointer to a FMP_OPEN_STRUCT struct for FMPF_BROADCAST
The FMP_OPEN_STRUCT is defined as follows:
typedef struct {
LPTSTR lpFileName;
DWORD dwCallBack;
BYTE Reserved[8];
} FMP_OPEN_STRUCT;
lpFileName Pointer to a null terminated string that contains the file name to be opened. In buffered mode and broadcast mode, lpFileName is ignored.
dwCallBack Pointer to the callback routine (for buffered stream mode).
Return Value
If successful, this command will return a handle to a stream. or NULL if an error occurs.
The FMPGetLastError command may be used to determine the last error that occurred. Valid error
codes are:
FMPE_TOO_MANY Too many streams are actually opened and the driver refuses to open another one.
FMPE_OUT_OF_MEM The driver can't allocate buffers for the stream.
FMPE_INVALID_FLAGS Flags are invalid or incoherent.
Remarks
The FMPOpen command opens and prepares a new stream. The handle returned uniquely identifies the stream and will be required for all the commands that manipulate it.
If you are using buffered streams, your callback function may receive numerous messages from FMPOpen in order to determine type of stream being opened. The first message in this case is FMPM_BUF_CREATE. This allows you to allocate your buffers, provide pointers to existing buffers, or attach identifying structures or values via the FMPI_STM_USER field. The handle send to the callback function is the one returned by FMPOpen.
If the operation is successful, the stream is initialized, seeked to start and put in the stop mode. The stream settings are initialized to the default settings of the driver.
If the stream source is a file or user defined buffers, and if it contains more than a video or audio stream it will be considered a Group Stream.
In case of a broadcasted stream, the stream begin
s to play as soon as you push data But youdo
n’t need to pre-fill the buffers before opening the stream.
See Also
FMPClose, FMPGroup, FMPCallback
Callback Functions
MCI Equivalent
MCI_OPEN
FMPOpenDriver
Description This call will open the Realmagic MPEG driver
.
int FMPOpenDriver(void)
Return Value
Returns a non-zero value if the driver was successfully opened. Otherwise, it returns zero.
Remarks
This function opens the 32-bit MPEG driver (IMPEG32.DLL) under Win32 and prepares it to receive other FMP commands.
This function is implemented in FMPFCTW.C.
When an application terminates, it should execute and FMPCloseDriver to close the MPEG driver.
See Also
FMPCloseDriver, FMPFindDriver
Application Startup / Exit
MCI Equivalent
None
FMPPause
Description: This command will PAUSE currently playing stream. During PAUSE, last frame will be displayed in the mpeg window.
DWORD FMPPause(stream);
BYTE stream Handle of the stream to pause.
Return Value
Zero if successful. Otherwise, returns the following error code:
FMPE_HANDLE Invalid Stream handle.
Remarks
The FMPPause command pauses a stream. For audio streams, FMPPause AND FMPStop have the same effect, audio is stopped. FMPPause for video streams, freezes the last frame and keeps the window open.
See Also
FMPFreeze, FMPStop
MCI Equivalent
MCI_PAUSE
FMPPlay
Description: This command starts playing the specified Stream.
DWORD FMPPlay (stream, flags, position);
BYTE stream Handle of the stream to play
WORD flags One or more combination of following flags:
FMPF_POS_START Play to the start.
FMPF_POS_SET Play to an absolute position.
FMPF_POS_END (Default) Play to the end.
FMPF_POS_CUR Play to a relative position from the current one
FMPF_END_PAUSE After playing, the stream enters paused stream mode on the last frame.
FMPF_END_STOP (Default) After playing, the stream enters stop stream mode.
FMPF_END_KEEP After playing, the stream returns to the stream mode it was before FMPPlay command was issued.
FMPF_END_REPEAT After playing, the stream will restart at the begin
ning of the file.
DWORD position Position to play to in the current stream time format (if required by FMPF_POS_SET or FMPF_POS_CUR)
Return Value
Zero if successful. Otherwise, returns one of the following error codes:
FMPE_HANDLE The handle of the stream is not valid.
FMPE_POS The position given is out of the stream limits.
FMPE_STREAM The stream contains invalid data.
FMPE_TOO_MANY If the stream is a group, there are too many streams selected in it for the hardware.
FMPE_INVALID_FLAGS Flags are invalid or incoherent.
Remarks
The FMPPlay command plays a stream from its current position to another position given in the stream time format and with the stream speed.
The stream selected for playing has the priority on the hardware resources so if there are other streams playing, the most recent FMPPlay command will cause the other to enter pause or stop mode.
See Also
FMPPause, FMPStop
MCI Equivalent
MCI_PLAY
FMPSeek
Description: This command will seek to specified position in the stream.
DWORD FMPSeek(stream, flags, position);
BYTE stream Handle of the stream to seek
WORD flags One or more combination of following flags:
FMPF_POS_START Seek to the start.
FMPF_POS_SET Seek to an absolute position.
FMPF_POS_END Seek to the end.
FMPF_POS_CUR Relative seek from the current position.
FMPF_END_PAUSE After seeking, the stream enters pause mode on the new frame.
FMPF_END_STOP (Default) After seeking, the stream enters stop mode.
FMPF_END_KEEP After seeking, the stream returns to the stream mode it was before the FMPSeek function. If it was in paused stream mode, the display is not modified and the stream returns to paused mode. If it was in stopped stream mode, it returns to stop mode.
DWORD position Position to seek at in current time format (if required by FMPF_POS_SET or FMPF_POS_CUR)
Return Value
Zero if successful. Otherwise, the function returns one of the following error codes:
FMPE_HANDLE The handle of the stream is not valid.
FMPE_POS The position given is out of the stream limits.
FMPE_STREAM The stream contains invalid data.
FMPE_INVALID_CMD The command is not supported by the driver or by the hardware for this type of stream.
FMPE_INVALID_FLAGS Flags are invalid or incoherent.
Remarks
The FMPSeek command seeks to a position in a stream. The position is given in the current time
format. If a video stream is in pause mode, the last picture is still displayed during and after the seek.
See Also
Seeking
MCI Equivalent
MCI_SEEK
FMPSet
Description: This command will initialize the stream or the driver with specified setting.
DWORD FMPSet (stream, index, value);
BYTE stream Handle of the stream or zero for the driver settings
WORD index Index of the value to set or zero for nothing that can be combined with a flag:
DWORD value New value for the setting
Return Value
Returns the previous value of the given setting if successful otherwise returns 0xFFFFFFFF in case of error.
FMPGetLastError may be used to obtain the last error
code which may be one of the following:
FMPE_HANDLE The handle of the stream is not valid.
FMPE_INDEX The index is invalid.
FMPE_ITEM_INDEX The index represents a invalid value for this stream (for example a volume setting for a video stream).
FMPE_VALUE The value is invalid.
FMPE_WRITE The value cannot be written but only read.
FMPE_INVALID_FLAGS Flags are invalid or incoherent.
Remarks
The FMPSet command allows you to set a parameter of a stream or the driver if you specify a null handle. The driver settings include information, status and default settings.
You can specify audio or video settings for the driver. In this case, the values set in the driver will be the default values, for any future opened streams.
See Also
FMPGet,
Settings
MCI Equivalent
MCI_SET,MCI_SETVIDEO,MCI_SETAUDIO
FMPSignal
Description: This command is designed to notify the user for any Event for a stream
DWORD FMPSignal(stream, flags, position);
BYTE stream Handle of the stream
WORD flags Options:
FMPF_SIG_REMOVE Removes a signal (signal number given in position parameter).
FMPF_SIG_REMOVE_AT Removes all the signals at the given position.
FMPF_SIG_REMOVE_ALL Removes all the signals.
FMPF_SIG_AT A signal will occur at the given position.
FMPF_SIG_EVERY Signals will occur at the period in the position parameter.
DWORD position Position (for FMPF_SIG_AT and FMPF_SIG_REMOVE_AT).
Period (for FMPF_SIG_EVERY).
Signal number (for FMPF_SIG_REMOVE).
Return Value
The driver will return Signal number when FMP_SIGNAL_AT or FMP_SIGNAL_EVERY
is specified.
FMPGetLastError can be used to determine the last error code which may be one of the following:
FMPE_HANDLE The handle of the stream is not valid.
FMPE_VALUE The value is invalid.
FMPE_INVALID_FLAGS Flags are invalid or incoherent.
Remarks
The FMPSignal command lets you specify a signals when the stream reaches a position or periodic signals given in frame time format (signals in bytes will be supported in a future version). Signals will be sent to the callback function of the stream or the default callback function.
You cannot signal an audio stream.
See Also
FMPCallback
Callback Functions
MCI Equivalent
MCI_SIGNAL
FMPStep
Description: This command moves the video stream specified number of frames.
.
DWORD FMPStep(stream, flags, frames);
BYTE stream Handle of the stream.
WORD flags Valid flags:
FMPF_END_PAUSE After the operation, the stream will enter pause mode on the last frame.
FMPF_END_STOP (Default) After the operation, the stream will stop.
FMPF_END_KEEP After the operation , the stream returns to the mode it was in before.
DWORD frames Number of frames to step.
Return Value
Returns zero if successful. Otherwise, returns one of the following error codes:
FMPE_HANDLE The handle of the stream is not valid.
FMPE_STREAM_DATA The stream contains invalid data.
FMPE_INVALID_FLAGS Flags are invalid or incoherent.
Remarks
The FMPStep command steps a video stream one or more frames forward. If the number specified is 1, the stream advances to the next frame.
MCI Equivalent
MCI_STEP
FMPStop
Description: This command stops specified MPEG Stream
FMPStop(stream);
BYTE stream Handle of the stream to close.
Return Value
Zero if successful. Otherwise, returns one of the following error codes:
FMPE_HANDLE The handle of the stream is not valid.
Remarks
The FMPStop command stops a stream and closes its window if it is a video stream. The stream pointer is reset and next play command will start playing from begin
ning of the stream.
See Also
FMPPlay, FMPPause, FMPFreeze
MCI Equivalent
MCI_STOP
Settings
Following are the different settings and status for streams.
They can be read with the FMPGet command (see pg. Error! Bookmark not defined.) and written with the FMPSet command (see pg.Error! Bookmark not defined.) using the FMPI_xxx index.
The driver settings are considered as default settings future opened streams.
Some settings are read only and are marked as 'r', others can be written and are marked 'r/w'.
When it is 'r/s' it means that you can write the value only if it is not yet determined. To be used carefully.
All the writeable settings can be used as driver settings.
If you specify audio or video settings for a group stream, the values will be passed to all the corresponding audio and video streams of the group.
The FMPGet and FMPSet commands always use 32 bits values. When a value is less than 32 bits long, the unused bits are zero.
Driver specific settings
FMPI_DRV_PRODUCT r pointer on the driver name
FMPI_DRV_VERSION r version number r Lo-word : majorr Hi-word : minor
FMPI_DRV_MAX_CHAN r number of video and audio channels (streams) that can be played simultaneously.r Lo-word : maximum number of video channelsr Hi-word : maximum number of audio channels
FMPI_DRV_HDR_STAT r State of the hardware. Zero for OK or a combination of this flags:r FMPF_HRD_NO_DMA &eth;
no DMA channel availableor FMPF_HRD_NO_INTS &eth;
no interrupt availableor FMPF_HRD_NO_PORT &eth;
no port availableor FMPF_HRD_NOT_FOUND &eth;
board not foundor FMPF_HRD_UNKNOWN &eth;
hardware problem (not yet specified)
FMPI_DRV_VID_SUP r (DWORD) mask containing all the video formats supported (up to 32). See FMPI_VID_TYPE for the different formats
FMPI_DRV_AUD_SUP r (DWORD_ mask containing all the audio formats supported (up to 32). See FMPI_AUD_TYPE for the different formats
FMPI_DRV_GRP_SUP r (DWORD) mask containing all the interlaced formats supported (up to 32). See FMPI_GRP_TYPE for the different formats
FiFo settings
FMPI_FIFO_FCNTRL r/w (BOOL) Enable or disable the flow control (should be used with buffered or broadcast streams).
FMPI_FIFO_SIZE r (DWORD) Size of the FiFo (Video + Audio) in bytes
FMPI_FIFO_VID_LEFT r (DWORD) Number of bytes left in the Video FiFo
FMPI_FIFO_AUD_LEFT r (DWORD) Number of bytes left in the Audio FiFo
FMPI_FIFO_MAX r/w Action taken by the driver when the FiFo is full :r FMPF_IGNORE : Ignore the maximum : FiFo will grow indefinitely in case of overflow.or FMPF_REFUSE : Refuse any more data until FiFo can absorb more packets (default)
FMPI_FIFO_DROP r/w Represents the percentage of packets that can be dropped by the driver in case of overflow : e.g 20% of dropping packet will handle an overflow of 17% of the bitrate (default is 0%)
FMPI_FIFO_UNIT r/w Unit of FiFo settings (size and start settings) :r FMPF_BYTES &eth;
units are bytes (default)or FMPF_MSEC&eth;
units are millisecond.
FMPI_FIFO_VID_SIZE r/w (DWORD) Maximum of video in FiFo (bytes or msec) (Flow Control). FMPI_FIFO_DROP needs to be enabled.
FMPI_FIFO_AUD_SIZE r/w (DWORD) Maximum of audio in FiFo (bytes or msec)(Flow Control). FMPI_FIFO_DROP needs to be enabled.
FMPI_FIFO_START r/w (DWORD) Start threshold (Flow control). Start playing when FiFo reaches FMPI_FIFO_START position (bytes or msec).
FMPI_FIFO_LOW r/w Low threshold (Flow control). Send FMPI_BUF_LOW message to the callback when FiFo is less than FMPI_FIFO_LOW % of the FiFO (maximum value is 100%)
FMPI_FIFO_HIGH r/w High threshold (Flow control). Send FMPI_BUF_HIGH message to the callback when FiFo is less than FMPI_FIFO_HIGH % of the FiFO (maximum value is 100%).
Common settings
FMPI_STM_TYPE r/s Type of the streamr FMPF_AUDIO &eth;Audio streamor FMPF_VIDEO&eth;
Video streamor FMPF_GROUP &eth;
Group of streams
FMPI_STM_SOURCE r r FMPF_FILE &eth;
the stream source is a fileor FMPF_BUFFERS &eth;
the stream is provided by buffersor FMPF_BROADCAST&eth;
the stream is provided by network buffers
FMPI_STM_FILEORG r/s (DWORD) Position of MPEG stream within a larger data file. For example, if you have appended all your MPEG movies together, you can tell the driver where to get the data.
FMPI_STM_FILESIZE r/s (DWORD) Size of the MPEG stream. Use this setting when you use FMPI_STM_FILEORG.
FMPI_STM_MODE r Current mode of the streamr FMPF_PAUSED &eth;
in pause modeor FMPF_STOPPED &eth;
in stop modeor FMPF_PLAYING &eth;
currently playingor FMPF_SEEKING &eth;
currently seekingor FMPF_STEPPING &eth;
currently steppingalso defined:FMPF_READY = FMPF_PAUSED or FMPF_STOPPED
FMPI_STM_POSITION r The actual position of the stream in the stream time format. (Last played data)
FMPI_STM_DEV_POS r The actual position of the device (file, buffer) in the stream time format. (Last read data).
FMPI_STM_TIME_FMT r/w Time format of the streamr FMPF_BYTES: bytes format (default)or FMPF_FRAMES: frames format or FMPF_SAMPLES: equivalent to FMPF_FRAMES
FMPI_STM_SPEED r/w Speed of the stream - divisor and multiplier (1:1 is normal speed and default, 2:1 isdo
uble speed)r Lo-word : multiplier (default = 1)r Hi-word : divisor (default = 1)
FMPI_STM_USER r/w 32 bit value where you can read/write any information
FMPI_STM_PASSWD r/w 32 bit key to play an encrypted stream.
FMPI_STM_NOCACHE r/w (BOOL) Enable or disable internal caching when the driver receives a seek command.(Default = 0 : cache enabled) Useful if you want to receive FMPM_BUF_SEEK or FMPM_PUSH_SEEK messages even if data are in the internal cache of the driver.
Buffered streams settings
FMPI_BUF_LEFT r Number of bytes left in the stream buffer.
FMPI_BUF_POS r/w (DWORD) Position causing a message or 0 for no message.
FMPI_BUF_ADDRESS r/w (BYTE *) The buffer address.
FMPI_BUF_SIZE r/w (DWORD) Size of the buffer in bytes (default is zero)
FMPI_BUF_MODE r/w Mode of the buffer streamr FMPF_BUF_LOOP : current buffer is scanned again if no new address is specified.
Broadcasted streams settings
FMPI_PUSH_ASYNC w (FMP_PUSH_STRUCT*) Pointer to a push buffer. Give a buffer to read to the driver.You have to wait for FMPM_PUSH_READ message from the callback routine before using this push buffer again.If the FIFO is full FMPSet returns FMPE_REFUSE
FMPI_PUSH_SYNC w (FMP_PUSH_STRUCT*) Pointer to a push buffer. Give a buffer to read to the driver The driver has finished reading the buffer before returning from FMPSet.If the FIFO is full FMPSet returns FMPE_REFUSE
Video streams settings
FMPI_VID_TYPE r/s type of the video streamr FMPF_VID_MPEG &eth;
MPEG 1 video streamor FMPF_VID_MPEG2 &eth;
MPEG 2 video stream
FMPI_VID_RATE r/s number of pictures per secondr Lo-word &eth;
integer partr Hi-word &eth;
decimal part multiplied by 10000
FMPI_VID_SIZE r/s size of a picturer Lo-word &eth;width in pixelsr Hi-word &eth;
height in pixels
FMPI_VID_ASPECT r/s the pixel aspect ratio (height/width)r Lo-word &eth;
integer partr Hi-word &eth;
decimal part multiplied by 10000
FMPI_VID_BIT_RATE r/s bit rate of the bit stream in bits/second. A zero value identifies variable bit rate operation
FMPI_VID_SRC_POS r/w position of the source windowr Lo-word &eth;
X position (default is zero)r Hi-word &eth;
Y position (default is zero)
FMPI_VID_SRC_SIZE r/w size of the source windowr Lo-word &eth;
width in pixels (zero is default and maximum width)r Hi-word &eth;
height in pixels (zero is default and maximum height)
FMPI_VID_DEST_POS r/w position of the destination windowr Lo-word &eth;
X position (default is zero)r Hi-word &eth;
Y position (default is zero)
FMPI_VID_DEST_SIZE r/w size of the destination windowr Lo-word &eth;
width in pixels (zero is default and maximum width)r Hi-word &eth;
height in pixels (zero is default and maximum height)
FMPI_VID_KEY_MODE r/w The color keying mode (see Frame buffer for details )r FMPF_ALL_VGA : All the VGA is displayed .or FMPF_ALL_VID : All the video is displayedor FMPF_KEY_VGA : VGA keying mode (default)or FMPF_KEY_VID : Video keying modeor FMPF_KEY_MIX : combination of VGA and Video Key
FMPI_VID_KEY_MIN r/w (COLORREF) Minimum color value for the 'video range keying'. 24 bits RGB value
FMPI_VID_KEY_MAX r/w (COLORREF) Maximum color value for the 'video range keying'. 24 bits RGB value :
FMPI_VID_KEY_MASK r/w (COLORREF) Mask for keying (default is 0xFFFFFF)
FMPI_VID_KEY_COL r/w (COLORREF) Color for keying. Default is dark green.
FMPI_VID_BRIGHTNESS r/w Brightness (Pro/Ultra):Lo-word: value from 0 - 256.
FMPI_VID_SATURATION r/w Color saturation (Pro/Ultra) :Lo-word : value from 0 - 256
FMPI_VID_CONTRAST r/w Contrast (Pro/Ultra) :Lo-word : value from 0 - 256
Audio streams settings
FMPI_AUD_TYPE r/s type of the audio stream. r FMPF_AUD_MPEG_L1 &eth;
MPEG1 Audio Layer I or FMPF_AUD_MPEG_L2 &eth;
MPEG1 Audio Layer II or FMPF_AUD_MPEG_L3 &eth;
MPEG1 Audio Layer III or FMPF_AUD_MPEG2_L1 &eth;
MPEG2 Audio Layer I or FMPF_AUD_MPEG2_L2 &eth;
MPEG2 Audio Layer II or FMPF_AUD_MPEG2_L3 &eth;
MPEG2 Audio Layer III or FMPF_AUD_DOLBY_AC3 &eth;
Dolby AC3 or FMPF_AUD_PCM &eth;
PCM sound
FMPI_AUD_CHANNELS r/s r FMPF_AUD_STEREO &eth;
stereo (MPEG Audio) or FMPF_AUD_JSTEREO &eth;
joint stereo (MPEG Audio) or FMPF_AUD_DUAL &eth;
dual channel (MPEG Audio) or FMPF_AUD_SINGLE &eth;
single channel (MPEG Audio) or FMPF_AUD_11 &eth;
Ch1,Ch2 (Dolby AC3) or FMPF_AUD_10 &eth;
C (Dolby AC3) or FMPF_AUD_20 &eth;
L, R (Dolby AC3) or FMPF_AUD_30 &eth;
L, C, R (Dolby AC3) or FMPF_AUD_21 &eth;
L, R, S (Dolby AC3) or FMPF_AUD_31 &eth;
L, C, R, S (Dolby AC3) or FMPF_AUD_22 &eth;
L, R, SL, SR(Dolby AC3) or FMPF_AUD_32 &eth;
L, C, R, SL, SR (Dolby AC3)
FMPI_AUD_EMPH r/s r FMPF_AUD_NO_EMPH &eth;
no emphasis or FMPF_AUD_EMPH_50 &eth;
50/15 msec emphasis or FMPF_AUD_EMPH_J17 &eth;
CCITT J.17 emphasis (MPEG Audio Only)
FMPI_AUD_RIGHTS r/s r FMPF_AUD_COPYRIGHT &eth;
there is a copyright on the streamr FMPF_AUD_ORIGINAL &eth;
the stream is an original(MPEG Audio Only)
FMPI_AUD_RATE r/s the sampling rate in samples per second
FMPI_AUD_BIT_RATE r/s bit rate of the stream in bits/second
FMPI_AUD_VOLUME r/w volumes of the right and left channelsr Lo-word &eth;
left channel in percent . Maximum = 100% (default)r Hi-word &eth;
right channel in percent. Maximum = 100% (default)
FMPI_AUD_TREBLE r/w high frequency level in percent. Default and nominal is 100%
FMPI_AUD_BASS r/w low frequency level in percent. Default and nominal is 100%
FMPI_AUD_BAL_L r/w left output channel balance:r Lo-word &eth;
percentage of left input channel. 100% (default)r Hi-word &eth;
percentage of right input channel. 0% default
FMPI_AUD_BAL_R r/w right output channel balance:r Lo-word &eth;
percentage of left input channel. 0% (default)r Hi-word &eth;
percentage of right input channel. 100% default
Group streams settings
FMPI_GRP_TYPE r type of the group stream.r FMPF_GRP_MPEG : MPEG1 system streamor FMPF_GRP_CUSTOM : streams have been inserted in the groupor FMPF_GRP_MPEG2_PROGRAM : MPEG2 program streamor FMPF_GRP_MPEG2_TRANSPORT : MPEG2 transport stream
FMPI_GRP_NB r Lo-word &eth;
Number of streams in the group
Using FMP Commands from Windows NT&#8482;
&
Windows 95&#8482;
IMPEG32.DLL (named "ReelDrv"
) is implemented as a Windows installable driver that understands the same commands as the Windows 3.1 Driver.
32-bit Windows applications should call FMPOpenDriver, implemented in FMPFCTW.C, before sending other commands. Thus, your application include the FMPFCTW.C module in your project. The FMPOpenDriver function loads Windows MPEG driver (IMPEG32.DLL) which implements the REALmagic API under Win32.
Modules that access the FMP commands should have the following include statement:
#include “FMPDEFS.H
The FMPCommand API is also implemented in FMPFCTW.C. Most other commands are implemented as macros that use FMPCommand.
The application should, before it terminates, call FMPCloseDriver function (implemented in FMPFCTW.C), which essentially unloads the Windows MPEG driver.
A general code shell might look like:
#define DRV_COMMAND DRV_USER+1
#define DRV_STATUS DRV_USER+2
#define MAKEDWORD(low, high) ((DWORD)(((WORD)(low)) | (((DWORD)((WORD)(high))) << 16)))
#define MAKEDWORD(a,b) MAKELPARAM(a,b)
#define FMPCommand(a,b,c,d) SendDriverMessage(hReelDrv,DRV_COMMAND,
MAKELPARAM(MAKEWORD(a,b),c),d)
#define FMPError() SendDriverMessage(hReelDrv,DRV_STATUS,0,0)
#include "fmpmacs.h"
// These macros can now be called exactly as you would in WIN32
{
int stream;
HDRVR hReelDrv;
hReelDrv = OpenDriver(TEXT(“ReelDrv”), NULL, NULL);
if( !hReelDrv)
{
MessageBox ( NULL,TEXT("REALmagic driver is not installed."
,
szError,MB_ICONASTERISK | MB_OK);
}
stream = FMPOpen(FMPF_FILE,TEXT(”test.mpg”));
if (!stream)
{
char txt[100];
wsprintf(txt,TEXT(”Error %x”),FMPError());
MessageBox ( NULL,TEXT("REALmagic driver is not installed."
,
szError,MB_ICONASTERISK | MB_OK);
}
// ... blah, blah, blah ...
if (stream)
FMPClose(stream);
CloseDriver(hReelDrv,NULL,NULL);
}
The initialization of the driver and the board is made when DRV_LOAD is received and the clean up isdo
ne when DRV_FREE is received.
Appendix A - Symbols
FMPMACS.H
/*******************************************************************************
*
* COPYRIGHT : (c) 1995-1996 Sigma Designs, Inc. All rights reserved.
*
* FILENAME : FMPMacs.h
*
* DESCRIPTION : This header file contains FMP specific macros that provide
* for an easier interface to sending FMP calls to the FMP
* MPEG support driver.
*
* PLATFORM : do
S, Windows
*
* PROGRAMMER : ECY
*
* COMMENTS : NONE
*
* NOTES : NONE
*
* CHANGES :
* 08/10/95 - Created.
* (ECY)
*
*******************************************************************************/
#ifndef __FMPMACS_H__
#define __FMPMACS_H__
#define FMPOpen( Flags, Filename ) /
LOBYTE( LOWORD( FMPCommand( FMP_OPEN, 0, Flags, Filename ) ) )
#define FMPClose( hMPEGStream ) /
FMPCommand( FMP_CLOSE, hMPEGStream, 0, 0 )
#define FMPSet( hMPEGStream, Index, Value ) /
FMPCommand( FMP_SET, hMPEGStream, Index, Value )
#define FMPGet( hMPEGStream, Index ) /
FMPCommand( FMP_GET, hMPEGStream, Index, 0 )
#define FMPPlay( hMPEGStream, Flags, Position ) /
FMPCommand( FMP_PLAY, hMPEGStream, Flags, Position )
#define FMPStep( hMPEGStream, Flags, Position ) /
FMPCommand( FMP_STEP, hMPEGStream, Flags, Position )
#define FMPCapture( hMPEGStream, Index, Position ) /
FMPCommand( FMP_CAPTURE, hMPEGStream, Index, Position )
#define FMPSeek( hMPEGStream, Flags, Position ) /
FMPCommand( FMP_SEEK, hMPEGStream, Flags, Position )
#define FMPSignal( hMPEGStream, Flags, Position ) /
FMPCommand( FMP_SIGNAL, hMPEGStream, Flags, Position )
#define FMPPause( hMPEGStream ) /
FMPCommand( FMP_PAUSE, hMPEGStream, 0, 0 )
#define FMPStop( hMPEGStream ) /
FMPCommand( FMP_STOP, hMPEGStream, 0, 0 )
#define FMPGroup( hMPEGStream, Flags, Value ) /
FMPCommand( FMP_GROUP, hMPEGStream, Flags, Value )
#define FMPCallback( hMPEGStream, Value ) /
FMPCommand( FMP_CALLBACK, hMPEGStream, FMPF_C, Value )
#define FMPUnload() /
FMPCommand( FMP_UNLOAD, 0, 0, 0 )
#define FMPInit() /
FMPCommand( FMP_INIT, 0, 0, 0 )
#define FMPFreeze( hMPEGStream, Flags, Value ) /
FMPCommand( FMP_FREEZE, hMPEGStream, Flags, Value )
#define FMPUpdate(subfunc,param1,param2) /
FMPCommand(FMP_UPDATE,subfunc,param1,param2)
#define FMPUpdatePalette( PaletteIndex, nColors ) /
FMPCommand( FMP_UPDATE, FMPI_UPD_PALETTE, 0, MAKEDWORD( nColors, PaletteIndex ) )
#define FMPUpdateVGAMode( Bits, Mode ) /
FMPCommand( FMP_UPDATE, FMPI_UPD_VGA_MODE, Bits, Mode )
#endif /* __FMPMACS_H__ */
FMPDefs.H
/*******************************************************************************
*
* COPYRIGHT : (c) 1995-1996 Sigma Designs, Inc. All rights reserved.
*
* FILENAME : FMPDefs.h
*
* DESCRIPTION : This header file contains FMP specific definitions.
*
* PLATFORM : do
S, Windows
*
* PROGRAMMER : ECY
*
* COMMENTS : NONE
*
* NOTES : NONE
*
* CHANGES :
* 08/10/95 - Created.
* (ECY)
*
*******************************************************************************/
#ifndef __FMPDEFS_H__
#define __FMPDEFS_H__
/*******************************************************************************
* FMP Commands
*******************************************************************************/
#define FMP_OPEN 0x01
#define FMP_CLOSE 0x02
#define FMP_PLAY 0x03
#define FMP_PAUSE 0x04
#define FMP_STOP 0x05
#define FMP_SEEK 0x06
#define FMP_STEP 0x07
#define FMP_GROUP 0x08
#define FMP_SET 0x09
#define FMP_GET 0x0A
#define FMP_CALLBACK 0x0B
#define FMP_SIGNAL 0x0C
#define FMP_UNLOAD 0x0D
#define FMP_INIT 0x0E
#define FMP_CAPTURE 0x0F
#define FMP_UPDATE 0x10
#define FMP_FREEZE 0x12
/*******************************************************************************
* FMP Errors
*******************************************************************************/
#define FMPE_DOS 0x0100
#define FMPE_INVALID_FLAGS 0x0200
#define FMPE_HANDLE 0x0300
#define FMPE_NOT_IMPLEMENT 0x0400
#define FMPE_INVALID_CMD 0x0500
#define FMPE_OUT_OF_MEM 0x0600
#define FMPE_INDEX 0x0700
#define FMPE_TYPE 0x0800
#define FMPE_WRITE 0x0900
#define FMPE_TOO_MANY 0x0A00
#define FMPE_ITEM_INDEX 0x0B00
#define FMPE_ITEM_HANDLE 0x0C00
#define FMPE_ERROR 0x0D00
#define FMPE_STREAM_DATA 0x0E00
#define FMPE_NOT_CDXA_DRV 0x0F00
#define FMPE_HARDWARE 0x1000
#define FMPE_NA 0x1100
#define FMPE_VALUE 0x1200
#define FMPE_TIME_FMT 0x1300
#define FMPE_NOT_READY 0x1400
#define FMPE_POS 0x1500
#define FMPE_REFUSE 0x1600
#define FMPE_INVALID_INDEX 0x1700
/*******************************************************************************
* FMP Messages
*******************************************************************************/
#define FMPM_BUF_POS 0x01
#define FMPM_BUF_EMPTY 0x02
#define FMPM_BUF_SEEK 0x03
#define FMPM_BUF_CREATE 0x04
#define FMPM_BUF_CLOSE 0x05
#define FMPM_BUF_TOTALSIZE 0x06
#define FMPM_COMPLETED 0x07
#define FMPM_CANCELED 0x08
#define FMPM_ERROR 0x09
#define FMPM_MEM_ALLOC 0x0A
#define FMPM_MEM_FREE 0x0B
#define FMPM_SIGNAL 0x0C
#define FMPM_FIFO_START 0x0D
#define FMPM_FIFO_LOW 0x0E
#define FMPM_FIFO_HIGH 0x0F
#define FMPM_FIFO_DROP 0x10
#define FMPM_PUSH_READ 0x11
#define FMPM_PUSH_SEEK 0x12
#define FMPM_PUSH_INIT 0x13
#define FMPM_PUSH_CLOSE 0x14
/*******************************************************************************
* FMP Flags
*******************************************************************************/
#define FMPF_BUF_LOW 0x00000000L
#define FMPF_BUF_EMS 0x00010000L
#define FMPF_BUF_XMS 0x00020000L
#define FMPF_PASCAL 0x1000
#define FMPF_C 0x2000
#define FMPF_TEST 0x8000
#define FMPF_INSERT 0x0001
#define FMPF_REMOVE 0x0002
#define FMPF_GET 0x0003
#define FMPF_SELECT 0x0004
#define FMPF_UNSELECT 0x0005
#define FMPF_HANDLE 0x0000
#define FMPF_INDEX 0x0020
#define FMPF_FILE 0x0001
#define FMPF_BUFFERS 0x0002
#define FMPF_GROUP 0x0003
#define FMPF_BROADCAST 0x0004
#define FMPF_EXTEND 0x0010
#define FMPF_NOACCESS 0x0100
#define FMPF_UNKNOWN 0x0000
#define FMPF_AUDIO 0x0001
#define FMPF_VIDEO 0x0002
#define FMPF_POS_START 0x0100
#define FMPF_POS_SET 0x0200
#define FMPF_POS_END 0x0300
#define FMPF_POS_CUR 0x0400
#define FMPF_DONT_UPDATE 0x1000
#define FMPF_UPDATE_ALL 0x2000
#define FMPF_SIG_AT 0x0001
#define FMPF_SIG_EVERY 0x0002
#define FMPF_SIG_REMOVE 0x0003
#define FMPF_SIG_REMOVE_AT 0x0004
#define FMPF_SIG_REMOVE_ALL 0x0005
#define FMPE_HRD 0x2000
#define FMPE_HRD_NO_DMA 0x2100
#define FMPE_HRD_NO_INT 0x2200
#define FMPE_HRD_NO_PORT 0x2300
#define FMPE_HRD_NOT_FOUND 0x2400
#define FMPE_HRD_DONT_USE 0x2500
#define FMPF_END_STOP 0x0000
#define FMPF_END_PAUSE 0x0001
#define FMPF_END_KEEP 0x0002
#define FMPF_END_REPEAT 0x0004
#define FMPF_END_CLOSE 0x0005
#define FMPF_PAUSED 0x0001
#define FMPF_STOPPED 0x0002
#define FMPF_PLAYING 0x0004
#define FMPF_SEEKING 0x0008
#define FMPF_STEPPING 0x0010
#define FMPF_CLOSED 0x0020
#define FMPF_READY (FMPF_PAUSED | FMPF_STOPPED)
#define FMPF_BYTES 0x0001
#define FMPF_SAMPLES 0x0002
#define FMPF_MSEC 0x0003
#define FMPF_HMSF 0x0004
#define FMPF_HMSC 0x0005
#define FMPF_FRAMES FMPF_SAMPLES
#define FMPF_TIME FMPF_HMSC
#define FMPF_SMPTE FMPF_HMSF
#define FMPF_BUF_32_BITS 0x0001
#define FMPF_BUF_LOOP 0x0002
#define FMPF_VID_UNKNOWN 0x0000
#define FMPF_VID_MPEG 0x0001
#define FMPF_VID_AVI 0x0002
#define FMPF_VID_MPEG2 0x0004
#define FMPF_ALL_VGA 0x0001
#define FMPF_ALL_VID 0x0002
#define FMPF_KEY_VGA 0x0004
#define FMPF_KEY_VID 0x0008
#define FMPF_KEY_MIX 0x000C
#define FMPF_KEY_CALIBRATE 0x000D
#define FMPF_AUD_UNKNOWN 0x0000
#define FMPF_AUD_MPEG 0x0001
#define FMPF_AUD_MPEG_L1 0x0002
#define FMPF_AUD_MPEG_L2 0x0004
#define FMPF_AUD_MPEG_L3 0x0008
#define FMPF_AUD_MPEG2 0x0010
#define FMPF_AUD_MPEG2_L1 0x0020
#define FMPF_AUD_MPEG2_L2 0x0040
#define FMPF_AUD_MPEG2_L3 0x0080
#define FMPF_AUD_DOLBY_AC3 0x0100
#define FMPF_AUD_WAVE 0x0010
#define FMPF_AUD_VOC 0x0020
#define FMPF_AUD_PCM 0x0040
#define FMPF_AUD_ADPCM 0x0080
#define FMPF_AUD_STEREO 0x0001
#define FMPF_AUD_JSTEREO 0x0002
#define FMPF_AUD_DUAL 0x0003
#define FMPF_AUD_SINGLE 0x0004
#define FMPF_AUD_NO_EMPH 0x0001
#define FMPF_AUD_EMPH_50 0x0002
#define FMPF_AUD_EMPH_J17 0x0003
#define FMPF_AUD_COPYRIGHT 0x0001
#define FMPF_AUD_ORIGINAL 0x0002
#define FMPF_GRP_UNKNOWN 0x0000
#define FMPF_GRP_MPEG 0x0001
#define FMPF_GRP_AVI 0x0002
#define FMPF_GRP_CUSTOM 0x0004
#define FMPF_GRP_MPEG2_PROGRAM 0x0008
#define FMPF_GRP_MPEG2_TRANSPORT 0x0010
#define FMPF_PIC_BMP 0x0001
#define FMPF_PIC_DIB24 0x0002
#define FMPF_PIC_TOFILE 0x0004
#define FMPF_REFUSE 0x0001
#define FMPF_IGNORE 0x0002
/*******************************************************************************
* FMP Index
*******************************************************************************/
#define FMPI_DRV_PRODUCT 0x0101
#define FMPI_DRV_VERSION 0x0102
#define FMPI_DRV_MAX_CHAN 0x0103
#define FMPI_DRV_VID_SUP 0x0104
#define FMPI_DRV_AUD_SUP 0x0105
#define FMPI_DRV_GRP_SUP 0x0106
#define FMPI_DRV_HDR_STAT 0x0107
#define FMPI_DRV_MEMORY 0x0108
#define FMPI_DRV_ID 0x0109
#define FMPI_DRV_CAPABILITY 0x010A
#define FMPI_STM_TYPE 0x0202
#define FMPI_STM_SOURCE 0x0203
#define FMPI_STM_MODE 0x0204
#define FMPI_STM_TIME_FMT 0x0205
#define FMPI_STM_POSITION 0x0206
#define FMPI_STM_SPEED 0x0207
#define FMPI_STM_USER 0x0208
#define FMPI_STM_SIZE 0x0209
#define FMPI_STM_SLIDE 0x020A
#define FMPI_STM_PASSWD 0x0210
#define FMPI_STM_FILETYPE 0x0211
#define FMPI_STM_MEMFLAGS 0x0212
#define FMPI_STM_FILESIZE 0x0213
#define FMPI_STM_FILEORG 0x0214
#define FMPI_STM_BIT_RATE 0x0215
#define FMPI_STM_NOCACHE 0x0216
#define FMPI_BUF_LEFT 0x0301
#define FMPI_BUF_POS 0x0302
#define FMPI_BUF_ADDRESS 0x0303
#define FMPI_BUF_SIZE 0x0304
#define FMPI_BUF_MODE 0x0305
#define FMPI_BUF_TOTALSIZE 0x0306
#define FMPI_VID_TYPE 0x0401
#define FMPI_VID_RATE 0x0402
#define FMPI_VID_SIZE 0x0403
#define FMPI_VID_ASPECT 0x0404
#define FMPI_VID_BIT_RATE 0x0405
#define FMPI_VID_SRC_POS 0x0406
#define FMPI_VID_SRC_SIZE 0x0407
#define FMPI_VID_DEST_POS 0x0408
#define FMPI_VID_DEST_SIZE 0x0409
#define FMPI_VID_KEY_MIN 0x040A
#define FMPI_VID_KEY_MAX 0x040B
#define FMPI_VID_KEY_MASK 0x040C
#define FMPI_VID_KEY_COL 0x040D
#define FMPI_VID_KEY_MODE 0x040E
#define FMPI_VID_KEY_TYPE 0x040F
#define FMPI_VID_CONTRAST 0x0410
#define FMPI_VID_BRIGHTNESS 0x0411
#define FMPI_VID_SATURATION 0x0412
#define FMPI_VID_SLIDE 0x0420
#define FMPI_VID_HWND 0x0413
#define FMPI_VID_KEY_COL_INDEX 0x0414
#define FMPI_VID_DEFAULTS 0x1000
#define FMPI_VID_REGISTRY 0x2000
#define FMPI_AUD_TYPE 0x0501
#define FMPI_AUD_RATE 0x0502
#define FMPI_AUD_VOLUME 0x0503
#define FMPI_AUD_BIT_RATE 0x0504
#define FMPI_AUD_TREBLE 0x0505
#define FMPI_AUD_BASS 0x0506
#define FMPI_AUD_CHANNELS 0x0507
#define FMPI_AUD_EMPH 0x0508
#define FMPI_AUD_RIGHTS 0x0509
#define FMPI_AUD_SHIFT 0x0510
#define FMPI_AUD_BAL_L 0x0511
#define FMPI_AUD_BAL_R 0x0512
#define FMPI_AUD_DEFAULTS 0x1000
#define FMPI_AUD_REGISTRY 0x2000
#define FMPI_GRP_TYPE 0x0601
#define FMPI_GRP_NB 0x0602
#define FMPI_FIFO_FCNTRL 0x0701
#define FMPI_FIFO_SIZE 0x0702
#define FMPI_FIFO_MAX 0x0703
#define FMPI_FIFO_VID_SIZE 0x0704
#define FMPI_FIFO_AUD_SIZE 0x0705
#define FMPI_FIFO_START 0x0706
#define FMPI_FIFO_LOW 0x0707
#define FMPI_FIFO_HIGH 0x0708
#define FMPI_FIFO_DROP 0x0709
#define FMPI_FIFO_UNIT 0x070A
#define FMPI_PUSH_ASYNC 0x0801
#define FMPI_PUSH_SYNC 0x0802
// Overlay specific settings (does not appky to rm 1 &
2)
#define FMPI_OVLY_XOFFSET 0x0901
#define FMPI_OVLY_YOFFSET 0x0902
#define FMPI_OVLY_VGACORRECTION 0x0903
#define FMPI_OVLY_STABILITY 0x0904
#define FMPI_OVLY_HFREQUENCY 0x0905
#define FMPI_OVLY_USEDEFAULTFREQ 0x0906
#define FMPI_OVLY_COLOR_SETTING 0x0907
#define FMPI_OVLY_LOWERLEVEL 0x0908
#define FMPI_OVLY_UPPERLEVEL 0x0909
#define FMPI_OVLY_DELTA_CALIBRATE 0x090A
#define FMPI_OVLY_COLOR_CALIBRATION 0x090B
#define FMPI_OVLY_JITTERING 0x090C
// Hoolywood (IBM MPEG 2) specific settings
#define FMPI_OVLY_CROPLEFT 0x0B01
#define FMPI_OVLY_CROPTOP 0x0B02
#define FMPI_OVLY_CROPRIGHT 0x0B03
#define FMPI_OVLY_CROPBOTTOM 0x0B04
#define FMPI_OVLY_INDELAY 0x0B05
#define FMPI_OVLY_OUTDELAY 0x0B06
// Values used for developpment purpose only
#define FMPI_ADJUSTMENT_A 0x0F01
#define FMPI_ADJUSTMENT_B 0x0F02
#define FMPI_ADJUSTMENT_C 0x0F03
#define FMPI_ADJUSTMENT_D 0x0F04
#define FMPI_ADJUSTMENT_E 0x0F05
#define FMPI_ADJUSTMENT_F 0x0F06
#define FMPI_OVLY_DEFAULTS 0x1000
#define FMPI_OVLY_REGISTRY 0x2000
#define FMPI_OVLY_RESET 0x4000
#define FMPI_UPD_PALETTE 0x0001
#define FMPI_UPD_VGA_MODE 0x0007
#define FMPI_UPD_FRAME_POS 0x0008
#define FMPI_UPD_FRAME_SIZE 0x0009
/*******************************************************************************
* FMP Constants
*******************************************************************************/
#define FMP_MIN_AUD_VOLUME 0
#define FMP_MAX_AUD_VOLUME 100
#define FMP_DEF_AUD_VOLUME 50
#define FMP_MIN_BSC 0 // Brightness, Saturation &
Contrast
#define FMP_MAX_BSC 1000
#define FMP_DEF_BSC 500
// REALmagic capabilities
#define FMP_CAPABILITY_BORDER_ADJUST 0x0001
#define FMP_CAPABILITY_KEYCOLOR_ADJUST 0x0002
#define FMP_CAPABILITY_BSC_ADJUST 0x0004 // Brightness, Saturation &
contrast
#define FMP_CAPABILITY_AUTO_CALIBRATE 0x0008
#define FMP_CAPABILITY_SPECIFIC_ADJUST 0x0010
#define FMP_CAPABILITY_GAMMA_ADJUST 0x0020
#define FMP_CAPABILITY_HIRES 0x0040
// RGB values used for min. medium and max color calibration
#define FMP_MIN_COLOR_LEVEL 0x00000000
#define FMP_MEDIUM_COLOR_LEVEL 0x00808080
#define FMP_MAX_COLOR_LEVEL 0x00FFFFFF
#define FMP_MEDIUM_COLOR 0x80
#define FMP_LOWER_RED 0x01
#define FMP_LOWER_GREEN 0x02
#define FMP_LOWER_BLUE 0x04
#define FMP_UPPER_RED 0x10
#define FMP_UPPER_GREEN 0x20
#define FMP_UPPER_BLUE 0x40
// Max sizes for low resolution
#define FMP_MAX_LOW_RES_WIDTH 640
#define FMP_MAX_LOW_RES_HEIGHT 480
/*******************************************************************************
* FMP Structures
*******************************************************************************/
typedef struct {
LPTSTR lpFileName;
DWORD dwCallBack;
BYTE Reserved[8];
} FMP_OPEN_STRUCT;
typedef struct {
DWORD dwSize;
void* lpBuffer;
} FMP_PUSH_STRUCT;
typedef struct {
COLORREF RGBColorKey;
COLORREF RGBUpper;
COLORREF RGBLower;
USHORT Mask;
} FMP_COLOR_SETTING_STRUCT;
#endif /* __FMPDEFS_H__ */
FMPFCTW.C
/*******************************************************************************
*
* COPYRIGHT : (c) 1995-1996 Sigma Designs, Inc. All rights reserved.
*
* FILENAME : FMPFctw.c
*
* DESCRIPTION : This source file contains functions to interface with the
* FMP IMPEG32 support driver.
*
* PLATFORM : WIN32
*
* PROGRAMMER : MI
*
* COMMENTS : NONE
*
* NOTES : NONE
*
* CHANGES :
* 8/13/96 - Created.
* (MI)
*
*******************************************************************************/
#include <windows.h>
#include "../../include/winfmp.h"
#include "../../include/FMPfctw.h"
HDRVR hReelDrv;
// REALmagic driver handle
/*******************************************************************************
*
* FUNCTION : FMPOpenDriver()
*
* DESCRIPTION : Opens IMPEG32.DLL
*
* RETURN : non-zero if successful, 0 if failed.
*
* NOTES :
*
*******************************************************************************/
int FMPOpenDriver(void)
{
hReelDrv=OpenDriver(TEXT("Reeldrv"
,TEXT("Driver32"
,0L);
if( !hReelDrv) {
return 0;
}
return 1; // successfully opened driver
}
/*******************************************************************************
*
* FUNCTION : FMPCloseDriver()
*
* DESCRIPTION : Closes IMPEG32.DLL
*
* RETURN : NONE
*
* NOTES :
*
*******************************************************************************/
void FMPCloseDriver(void)
{
CloseDriver(hReelDrv,0L,0L);
hReelDrv = 0;
}
/*******************************************************************************
*
* FUNCTION : FMPCommand()
*
* DESCRIPTION : This function interfaces with the FMP MPEG support driver
* and sends out the requested command.
*
* RETURN : value from SendDriverMessage
*
* NOTES :
*
*******************************************************************************/
DWORD FMPCommand( BYTE Command, BYTE hMPEGStream, WORD Flags, DWORD Value )
{
return (DWORD)SendDriverMessage(hReelDrv,DRV_USER+1,
MAKELPARAM(MAKEWORD(Command,hMPEGStream),Flags),Value);
}
/*******************************************************************************
*
* FUNCTION : FMPGetLastError()
*
* DESCRIPTION : Returns last command error code.
*
* RETURN : last REALmagic command error code
*
* NOTES :
*
*******************************************************************************/
DWORD FMPGetLastError(WORD a)
{
return (DWORD)SendDriverMessage(hReelDrv,DRV_USER+2,(DWORD)a,0L);
}