MPEGator Programmer’s Reference Guide

Introduction


Introduction

Thank you for purchasing Darim’s MPEGator.  The provided MPEGator Software Development Kit (MSDK) allows for being creative in using the MPEGator and achieve the goals which were not possible with the standard software.  The MPEGator SETUP program installs MSDK if the corresponding line was checked during the Custom installation.

Note:  This document is a preliminary release of the final documentation.  It is meant to specify and accompany software that is still in development.  Some of the information in this documentation may be inaccurate or may not be an accurate representation of the functionality of the final implementation.  Darim Vision assumes no responsibility for any damages that might occur either directly or indirectly from these inaccuracies.  Darim Vision may have trademarks, copyrights, patents or pending patent applications, or other intellectual property rights covering subject matter in this document.  The furnishing of this document does not give you a license to these trademarks, copyrights, patents, or other intellectual property rights.


MSDK contents

MPEGator SDK consists of three major components, each of them represents a different level of software interfacing.  They are:

•	Component Object Model (COM) objects and interfaces to get the most comprehensive control over all MPEGator functions.

•	OLE Custom Control (OCX) for simplified application development using a set of high level functions.

•	ActiveMovie™ filters for seamless connectivity with existing and future ActiveMovie-aware applications.

Each of the parts is provided with a sample ready-to-compile and use application sources illustrating practical usage of the interface functions.


What you need to use MSDK

•	The same system configuration as described in the MPEGator User’s Guide.  However, 24 MB or more RAM is recommended for optimal development conditions.  Also, it is very important that MPEGator low and medium level software (VxD and DLLs) setup was completed successfully.

•	The provided C/C++ source and make files have been developed and tested using Microsoft Visual C++™ 4.0 compiler.  Although any other Win32-compatible compilers may be used (for example, Microsoft Visual C++™ 2.x, Borland C++™ 4.5), they have not been fully tested and some changes may be necessary to compile and run the samples.

•	The provided Visual Basic application requires Microsoft Visual Basic™ 4.0, 32-bit edition to be compiled successfully.

•	To enable usage of the ActiveMovie™ filters, the corresponding runtime files must be installed on your system.  Some of the ActiveMovie-compatible applications set up ActiveMovie runtime as a part of their own installation.  Alternatively,  you can get the latest ActiveMovie directly from Microsoft


Functional Overview

All of the medium level APIs in the MSDK are composed of objects and interfaces based on the Component Object Model (COM).  COM is a foundation for an object-based system that focuses on reuse of interfaces and is the model at the heart of OLE programming.  It is also an interface specification from which any number of interfaces can be built.  It is an object model at the operating system level.

Many MPEGator APIs are instantiated as a set of OLE objects.  The object can be considered a black box that represents the hardware and requires communication with applications through an interface.  The commands sent to and from the object through the COM interface are called methods.  For example, the IMtrCapture::OpenPreview method is sent through the IMtrCapture interface to open a preview window from the MtrMe object.

In general, the MSDK object model provides one main object for each function of the device, which support set of interfaces for each of the properties that need to be controlled.  For example, the MtrMe object represents the real time MPEG capturing and encoding function.  It provides, for example, IMtrCapture and IPreview interfaces to control various aspects of MPEG capturing and video source previewing.

To C++ programmers, a COM interface is like an abstract base class.  That is, it defines a set of signatures and semantics but not the implementation, and no state data is associated with the interface.  In a C++ abstract base class, all methods are defined as pure virtual, which means they have no code associated with them.

Pure virtual C++ functions and COM interfaces both employ a device called a vtable. A vtable contains the addresses of all functions that implement the given interface.  If you want a program or object to use these functions, you can use the QueryInterface method to verify the interface exists on an object, and to obtain a pointer to that interface.  What your program or object actually receives from the object after sending QueryInterface is a pointer to the vtable, through which this method can call the interface methods implemented by the object. This mechanism totally isolates private data used by the object and the calling client process.

Another similarity of COM objects to C++ objects is that the first argument of a method is the name of the interface or class, called the this argument in C++.  Because COM objects and C++ objects are totally binary compatible, the compiler treats COM interfaces like C++ abstract classes and assumes the same syntax.  This results in less complex code.  For example, the this argument in C++ is treated as an understood parameter and not coded, and the indirection through the vtable is handled implicitly in C++.

Throughout this document we will be using C++ syntax for convenience but this does not mean that programmers use C++ rather than C.  Any COM interface method can be called from a C program.  There are two things, however, you need to remember when calling an interface method from C:

•	The first parameter of the method is always a reference to the object that has been created and is invoking the method (the this argument).

•	Each method in the interface is referenced through a pointer to the object's vtable.

The following example enables or disables the preview associated with a MtrMe object by calling the IMtrCapture::Preview method using the C programming language:

ret = mtrcap->pVtbl->Preview (mtrcap, bFlag);

The MtrMe object associated with the preview is referenced by the mtrcap parameter.  This method uses the bFlag parameter to set the preview state.  To call the IMtrCapture::Preview method, you first dereference the MtrMe object's vtable, then dereference the method from the vtable. The first parameter supplied in the method is a reference to the MtrMe object that has been created and is invoking the method.

The same method in C++ is shown below (C++ implicitly dereferences the vtbl pointer and passes the this pointer):

ret = mtrcap->Preview (bFlag);


COM classes and interfaces

MPEGator software currently registers four classes, each of them corresponds to its own, independent hardware operation mode.  The classes are:

•	MtrMe	- provides set of interfaces and methods for real time capture of live video and audio data into fully ISO/IEC 11172 compliant MPEG streams.

•	MtrMa	- provides set of interfaces and methods for off-line compression of externally supplied video and audio data into fully ISO/IEC 11172 compliant MPEG streams.

•	MtrMd	- provides set of interfaces and methods to decode compressed video data from standard MPEG streams into any given uncompressed format (e.g. RGB).

•	IFrameMPEG	- provides set of interfaces and methods for real-time capture of I-frame-only MPEG (a.k.a. ‘editable MPEG’) embedded into AVI file which can be edited by any of the available video editing software.

The application

Each of the above classes, in turn, have a number of interfaces through which an application software can access those classes functionality.


IMtrCapture interface

This interface is provided solely by MtrMe object

Initialization and Termination	Open

Close

Global Parameters management	DefaultParam

SaveParam

LoadParam

SaveParamTemplate

LoadParamTemplate

SaveParamEx

LoadParamEx

Parameters Dialog	DlgParam

Output control	GetFileName

SetFileName

GetFileType

SetOutput

Status report	SetCallbackWnd

GetCapInfo

Preview control	OpenPreview

GetPreviewWnd

UpdatePreviewWnd

GetPreviewWndCaps

Preview

GetPreviewStatus

ClosePreview

Stream capture preparation	OpenStream

CloseStream

OpenStreamEx

CloseStreamEx

StreamGetPtr

StreamReleasePtr

GetWaitHandle

Capture process control	Start

Stop

Pause

Error information	GetLastError

Querying other interfaces	GetVMpegSetup

GetAMpegSetup

GetVideoSetup

GetAudioSetup

GetMuxerSetup

GetVideoPreview


Initialization and Termination functions

#include "mtrif.h"

#include "mtruid.h"

BOOL	OpenCapture(IMtrCapture ** mtrcap)

{

IClassFactory *pDBFactory=NULL;

HRESULT hRes;

hRes = CoGetClassObject(CLSID_MtrMe, CLSCTX_SERVER,

NULL, IID_IClassFactory, (void**) &pDBFactory);

if(FAILED(hRes)) {

return FALSE;

}

hRes = pDBFactory->CreateInstance(NULL, IID_IMtrCapture, (void**)mtrcap);

if(FAILED(hRes)) {

return FALSE;

}

pDBFactory->Release(); // do not need the factory anymore

}


IMtrCapture::Open

HRESULT Open();

Parameters:

None.

Returns:

S_OK in case of success, S_FALSE otherwise.

Description:

This method opens an internal channel for real time MPEG capturing and encoding.  It prepares the hardware and allocate necessary memory buffers.  The method initializes the internal configuration structure from the following pre-defined registry entry:

HKEY_CURRENT_USER\Software\Darim Vision\MTR\ME\Current

Since the hardware supports only one MPEG encoding channel at a time, all consecutive calls to this method, without calling to IMtrCapture::Close will return S_FALSE.

See also:

IMtrCapture::Close


IMtrCapture::Close

HRESULT Close();

Parameters:

None.

Returns:

S_OK in case of success, S_FALSE otherwise.

Description:

Closes the previously open channel for MPEG capturing and encoding.  The method de-allocates associated memory buffers, puts hardware into an idle state so it can be used for other purposes.

See also:

IMtrCapture::Open


IMtrCapture::DefaultParam

HRESULT meDefaultParam();

Parameters:

None.

Returns:

S_OK in case of success, S_FALSE otherwise.

Description:

Loads the factory-default set of the MPEG capturing and encoding parameters into the internal structure of currently effective parameters in memory.  This global structure defines the behavior of the MPEGator software and various characteristics of real time MPEG capture.  These parameters are hardwired into the MPEGator driver software and can not be changed in any way.

See also:

SaveParam, LoadParam


IMtrCapture::SaveParam

HRESULT SaveParam();

Parameters:

None.

Returns:

S_OK in case of success, S_FALSE otherwise.

Description:

Saves the internal structure of the currently effective parameters to the following registry entry:

HKEY_CURRENT_USER\Software\Darim Vision\MTR\ME\Current

See also:

LoadParam


IMtrCapture::LoadParam

HRESULT LoadParam();

Parameters:

None.

Returns:

S_OK in case of success, S_FALSE otherwise.

Description:

Loads the complete parameters set stored in the registry at

HKEY_CURRENT_USER\Software\Darim Vision\MTR\ME\Current

to the internal memory structure. The loaded parameters may or may not become immediately effective depending on the current software and hardware state.

See also:

SaveParam


IMtrCapture::SaveParamTemplate

HRESULT SaveParamTemplate(PTSTR name);

Parameters:

PTSTR name	- a null-terminated string containing the name of template to load.

Returns:

S_OK in case of success, S_FALSE otherwise.

Description:

Stores the internal structure of the currently effective parameters as a named template for later use.  The template is stored into the following registry entry:

HKEY_CURRENT_USER\Software\Darim Vision\MTR\ME\Template\<name>

See also:

SaveParam, LoadParamTemplate


IMtrCapture::LoadParamTemplate

HRESULT LoadParamTemplate(PTSTR name);

Parameters:

PTSTR name	- a null-terminated string containing the name of template to load.

Returns:

S_OK in case of success, FALSE otherwise.

Description:

Loads the internal parameters structure with the values stored in the following registry entry:

HKEY_CURRENT_USER\Software\Darim Vision\MTR\ME\Template\<name>

The loaded parameters may or may not become immediately effective depending on the current software and hardware state.

See also:

LoadParam, SaveParamTemplate


IMtrCapture::SaveParamEx

HRESULT SaveParamEx(LPVOID root, PTSTR key);

Parameters:

LPVOID root	- one of the following pre-defined registry keys:
HKEY_LOCAL_MACHINE, HKEY_USERS, HKEY_CURRENT_USER, HKEY_CLASSES_ROOT

PTSTR key	- a null-terminated string containing the of the registry key to store the data to.  The key must be a subkey of the key identified by the root parameter.

Returns:

S_OK in case of success, FALSE otherwise.

Description:

Stores the internal structure of the currently effective parameters to the specified location in the Windows registry.

See also:

LoadParamEx


IMtrCapture::LoadParamEx

HRESULT LoadParamEx(LPVOID root, PTSTR key);

Parameters:

LPVOID root	- one of the following pre-defined registry keys:
HKEY_LOCAL_MACHINE, HKEY_USERS, HKEY_CURRENT_USER, HKEY_CLASSES_ROOT

PTSTR key	- a null-terminated string containing the of the registry key to load the data from.  The key must be a subkey of the key identified by root parameter.

Returns:

S_OK in case of success, S_FALSE otherwise.

Description:

Loads the internal parameters structure from the specified location in the Windows registry.

See also:

SaveParamEx


IMtrCapture::DlgParam

HRESULT DlgParam(HWND hwndParent);

Parameters:

HWND hwndParent	- the handle of the parent window that will own the dialog.

Returns:

S_OK in case of success, S_FALSE otherwise.

Description:

The MPEG Parameters compound dialog is shown in the figures below.  By clicking on the corresponding tab you can access a different set of parameters, each of them described in greater detail below.

Select the MPEG Basic tab to set the basic MPEG capturing and encoding parameters.  The Stream Type dropdown list selects the type of MPEG stream to be produced.  The following types can be selected:

•	Video Only

•	System Layer with Video only

•	System Layer with Video and Audio

•	Video CD

This selection also determines the default extension that will be attached to the specified output file name automatically.  The standard extension for Video Only file is .MPV and for all other MPEG file types it is .MPG.

The Size dropdown list allows the user to change the resolution of the destination MPEG video.  The default resolution settings are 352x240 SIF (the maximum for NTSC) or 352x288 SIF (the maximum for PAL).  The two Bitrate fields specify the target compressed data rate in Kbits/sec for video and audio streams respectively.  Higher values usually produce better quality, while consuming more storage space.  However, the difference becomes hardly noticeable after certain values, which are dependent on video or audio content.  Note, that you can change the video bitrate to an arbitrary value within the allowed range from 50 to 3000 Kbits/sec.  In contrary, the audio bitrate can be set only to several discrete values, as specified by MPEG standard (ISO/IEC 11172-3) for layer II audio compression (see the dropdown list for the allowed bitrate values and their meaning).

Important notes:

1.	When the Video CD Stream Type is selected, both Bitrate and Size fields will be grayed (disabled).  Video CD (White Book) specification restricts these parameters to certain pre-defined values.

2.	The Stream Type dropdown list selection will not alter any of the parameters set in the other dialog pages.  Therefore, if you have changed any parameters in the MPEG Advanced page and want to restore them to the values corresponding to one of the standard formats, do either of the following:

•	Select and load the corresponding template.

•	Reset the MPEG Advanced parameters manually in addition to selecting the desired stream type in the Stream Type dropdown list.

The MPEG Advanced tab displays a tree-like structure of various advanced parameters of MPEG compression.  The parameters’ values and descriptions are shown when the cursor is positioned on them.  Changing any of these parameters require the complete understanding of the MPEG encoding process and may create an output file which will not be playable by some or all of the available MPEG players.  If you feel uncertain about any of the parameters, leave them at their default states.

Important:  Some of the parameters’ values here, or combination of them may produce unpredictable results and might even lead to system crashes.  You can recover from this state by pressing the Reset button to restore all advanced parameters to their default values.

The Video tab gives you complete control over the incoming video signal. First, you can choose either Composite or S-Video inputs by clicking on the Source dropdown list.  Select the video standard that is used in your country by accessing the Standard dropdown list right below.  Currently, two video standards are supported: NTSC and PAL.

The horizontal and vertical Offset fields allow you to shift the captured video region.  You can customize these values, for example, to get rid of unwanted noise at the top or at the bottom part of the picture.  Note, that the captured region size is always the same, only its position is shifted relatively to the top left corner of the video.

The sliders on the right allow for image adjustment of the incoming video.  There are four controls:

•	Hue	-- allows you to adjust the phase of the signal’s color. By moving this slider in both directions you can change the tone of the input video signal. Increase to make skin tones become greenish. Decrease to make skin tones become purplish. The default value of 128 corresponds to normal color tones.  This control has effect only for NTSC video.

•	Saturation	-- adjusts the color intensity of the signal. Setting it to 0 will produce a Black & White picture. Setting to the maximum 511 will produce a picture with very bright (and often distorted) color spots. Default setting is 291.

•	Contrast	-- controls the difference between the brightest and darkest place of the picture. The minimum level of contrast (0) is a dark gray picture with indistinguishable details. The default level is 216 - medium contrast.

•	Brightness	-- adjusts the overall picture intensity. Has no effect on color. Affects only the ‘gray’ level of the picture, between minimum (0) - complete black and maximum (255) - almost white. The default value is 128.

You can always restore all settings to their default values by pressing the Reset button.

Important:  Some of the video properties controlled by these sliders may strongly affect (both increasing and decreasing) the resulting visual quality of the MPEG stream for the same compressed video bitrate.  So, if you are not satisfied with the visual quality of the just captured MPEG file, do not rush to increase the bitrate.  Instead, try to change video brightness, contrast and saturation.  It may lead to significant perceptual quality improvement.

The Audio tab lets you select audio source, control input and output signal stereo balance and levels.  The dialog’s left part controls the audio input.  MPEGator hardware has two audio input connectors, but only one of them can be active at a time.  Select either Line or Aux. input by clearing the corresponding Mute checkbox beneath.  Set the desired audio signal level by moving the amplification sliders.  The sliders are calibrated in decibels (dB).  Positive values increase the strength of the signal, the negative values decrease it, and the value of zero corresponds to the nominal signal level.  Adjust the Balance slider to achieve the desired stereo effect.

Important:  Certain audio sources may output analog signal at levels much higher than allowed by MPEGator specification.  The symptom is that even at the minimum amplification, a very noticeable distortion of the compressed audio will occur.  The solution is to lower the output audio level using the on-source controls or obtain an external attenuator.  For example, Betacam VTRs typically output audio signal at +4 dB, while the nominal level, expected by the MPEGator hardware is -10 dB.  Therefore, you need to lower the signal level by -14 dB to achieve optimal audio quality.

The dialog’s right part controls the audio output.  The Loopback (or pass-through) channel is provided to allow you to control the incoming audio signal which is ported to the MPEGator Audio Output connector.  Enable or disable the pass-through audio by clearing or checking the Loopback Mute checkbox.  Adjust the sound volume by moving the attenuation slider.  Note, that the pass-through audio can be heard only when preview is active and when it is unmuted.

The Template tab allows you to use standard templates and create new ones.  The templates contain the complete set of parameters and are stored in the Windows registry.  Select one of the existing templates to Load or Remove it.  Loading a template replaces all parameters for the entire MPEG Parameters dialog.  Type in the new template name and press the Save button to store the current values of all parameters for later use.

Important:  Since the templates hold the complete set of parameters (including video brightness, contrast, etc.) it is advisable to find the optimal values and store them into a separate template for each particular working material.

Common note:  You can press the Reset All button at anytime to restore all parameters under all tabs to their default values.  Press the Reset button to restore all parameters only under the current tab.  Finally, press Close when done to memorize all the values.

See also:

SaveParam, SaveParamTemplate


Example:

#include "mtrapi.h"

void myFunction(MTRCAPH mtrcap)

{

MTRCAPH	mtrcap;

meDlgParam(mtrcap, NULL /*no parent window*/);

meSaveParamEx(mtrcap, ROOTKEY, TEXT("Software\\MPEGatorTest_1\\"));

meLoadParamEx(mtrcap, ROOTKEY, TEXT("Software\\MPEGatorTest_2\\"));

}


IMtrCapture::GetFileName

HRESULT GetFileName(PTSTR fileName, int fileNameLen);

Parameters:

PTSTR fileName	- a character buffer that will receive current output file name set for MPEG encoding.

int fileNameLen	- a maximum file name length in bytes that the buffer can hold.

Returns:

S_OK in case of success, S_FALSE otherwise.

Description:

This method allows to get current output file name for the current MPEG capturing and encoding process, previously set by SetFileName method.  The file name and path returned exactly as it was specified by a preceding call to the SetFileName method.  This means that relative paths are not resolved to fully qualified ones.

See also:

SetFileName


IMtrCapture::SetFileName

HRESULT SetFileName(PTSTR fileName);

Parameters:

PTSTR fileName	- a null-terminated string containing a full output file name for MPEG encoding.

Returns:

S_OK in case of success, S_FALSE otherwise.

Description:

Set the destination file name for the current MPEG capturing and encoding process.  There is no default file name for this process, so this method must be called at least once, to tell the MPEGator software where the captured and compressed data must be stored to.  This method always creates new file and overwrites the existing file, if any.  It is a caller’s responsibility to ensure that the fileName parameter contains a valid path and that it is granted with enough access rights to create a file.

The fileName parameter is internally passed to the CreateFile function.  See Microsoft Win32 SDK documentation for a detailed description of the CreateFile.

See also:

GetFileName


IMtrCapture::GetFileType

int GetFileType();

Parameters:

None.

Returns:

Returns an integer code of the currently selected MPEG capturing format.  Currently defined codes are:

SEPVIDEO_TYPE

Video-only elementary stream

SYSVIDEO_TYPE

System layer stream containing only video stream

SYSAV_TYPE

System layer stream containing both video and audio streams

CDROM_TYPE

(reserved) Same as above with sectors padding for CD-ROM (2048 bytes)

VCD_TYPE

Video CD-ready, White Book-compliant system layer stream

Description:

This method lets you determine the currently selected output file format.  The selection can be made by loading the appropriate values to the currently effective parameters structure or using MPEG Basic parameters dialog shown on Figure XXXXX.

See also:

LoadParam, LoadTemplateParam, DlgParam


Example:

#include "mtrapi.h"

void myFunction(MTRCAPH mtrcap)

{

int	fileType;

fileType = meGetFileType();

switch(fileType) {

case SEPVIDEO_TYPE:

meSetFileName(mtrcap, TEXT("c:\\default.mpv"));

break;

case SYSVIDEO_TYPE:

case SYSAV_TYPE:

meSetFileName(mtrcap, TEXT("c:\\default.mpg"));

break;

}

}


IMtrCapture::SetOutput

HRESULT SetOutput(MTRIO ioproc, LPVOID inst);

Parameters:

MTRIO ioproc	- application-defined callback function for outputting the certain amount of encoded MPEG data (write to a file as a simplest case).

LPVOID inst	- application-defined parameter which will be passed to the callback function (e.g. the file handle as a simplest case).

Returns:

S_OK in case of success, S_FALSE otherwise.

Description:

Allows an application to specify a custom callback function which will be called when the certain amount of encoded data will need to be transferred to a storage device.  The callback function must be defined as follows:

long CALLBACK	MTRIO(LPVOID inst, LPSTR buffer, long len);

The following parameters will be passed to the callback function:

LPVOID inst	- an application-specific parameter defined by the SetOutput function.

LPSTR buffer	- the pointer to the encoded data to be output.

long len	- the effective output data size in bytes.

The function is expected to return the number of bytes that were actually output.

See also:

None.


Example:

#include <windows.h>

#include "mtrapi.h"

long CALLBACK	MyFileWrite(LPVOID inst, LPSTR buffer, long len)

{

PMTRCap mtrcap = (PMTRCap)inst;

DWORD	dw;

WriteFile((HANDLE)inst, buffer, len, &dw, NULL);

return (long)dw;

}

void myFunction(MTRCAPH mtrcap)

{

MTRCAPH	mtrcap;

HANDLE	file;

file = CreateFile("c:\\hello.mpv", GENERIC_WRITE, 0, NULL,

OPEN_ALWAYS,

FILE_ATTRIBUTE_NORMAL | FILE_FLAG_WRITE_THROUGH | FILE_FLAG_NO_BUFFERING,

NULL);

if(!file)	/* can’t create file */

return;

meSetOutput(mtrcap, MyFileWrite, (LPVOID)file);

/* do capturing here */

meSetOutput(mtrcap, NULL, 0);

CloseHandle(file);

}


IMtrCapture::SetCallbackWnd

HRESULT SetCallbackWnd(HWND hWnd, int statmsg);

Parameters:

HWND hWnd	- handle of the window that will receive the notification message specified by the next parameter.

int statmsg	- user-defined message number that will be passed to the window procedure. Consider the following value for this parameter:

#define	WM_MTRSTATUS	WM_USER+1

Returns:

S_OK in case of success, S_FALSE otherwise.

Description:

Allows the caller to specify a window that will receive the pre-defined notification message when the new frame was just captured.  Upon receiving this message the GetCapInfo method can be called to obtain the most updated information about the capturing process.  It can be useful for frame counter updates, etc.

See also:

GetCapInfo


IMtrCapture::GetCapInfo

HRESULT GetCapInfo(MTRCAPINFO *capinfo);

Parameters:

MTRCAPINFO *capinfo	- pointer to the capturing information structure as follows:

typedef struct {

int	state;	// current hardware status (see below)

int	framesProcessed;	// number of frames captured

int	framesSkipped;	// number of frames skipped

int	numClockTics;	// number of 1 Hz ticks elapsed since the start of capture

} MTRCAPINFO, *PMTRCAPINFO;

The current hardware state can be have one of the following values:

MTRSTAT_IDLE

Hardware is idle.

MTRSTAT_PROCESS

Hardware is busy capturing.

MTRSTAT_ERROR

An error has occurred.

MTRSTAT_STOP

Capturing has been stopped.

MTRSTAT_PAUSE

Capturing has been paused.

Returns:

S_OK in case of success, S_FALSE otherwise.

Description:

This method allows the caller to get the current state of the hardware and the most recent capture process statistics.

See also:

None.


IMtrCapture::OpenPreview
IMtrCapture::OpenPreview	(obsolete)

HRESULT OpenPreview(HWND hwndParent);

Parameters:

HWND hWndParent	- handle of the parent window that will own the preview window.  This parameter can not be NULL.

Returns:

S_OK in case of success, S_FALSE otherwise.

Description:

Creates and shows the window for video preview.  The preview window is always a child window created based on the current capturing resolution and can not be re-sized.  The number of calls to this method must match with the number of calls to the ClosePreview method.

See also:

GetPreviewWnd, Preview


IMtrCapture::GetPreviewWnd
IMtrCapture::GetPreviewWnd	(obsolete)

HWND GetPreviewWnd();

Parameters:

None.

Returns:

The video preview window handle or NULL in case of error.

Description:

Retrieves the handle of the preview window previously created by the OpenPreview method.

See also:

OpenPreview


IMtrCapture::UpdatePreviewWnd
IMtrCapture::UpdatePreviewWnd	(obsolete)

HRESULT UpdatePreviewWnd();

Parameters:

None.

Returns:

S_OK in case of success, S_FALSE otherwise.

Description:

Notifies the preview window that its parent window has been moved.  The call to this method updates preview area position, clipping region, etc.  This method is usually called upon receiving the WM_MOVE message in the parent window procedure.

See also:

OpenPreview


IMtrCapture::GetPreviewWndCaps
IMtrCapture::GetPreviewWndCaps	(obsolete)

DWORD GetPreviewWndCaps();

Parameters:

None.

Returns:

Returns a DWORD containing the present preview capability flags as follows:

MTRP_555

Indicates that preview is displayed in RGB_555 (15-bit) color mode (5 bits for each of the R, G and B components).  This mode is used if the video display hardware directly supports 15-bit RGB display.

MTRP_565

Indicates that preview is displayed in RGB_565 (16-bit) color mode (5 bits for of the R and B and 6 bits for G components).  This mode is used if the video display hardware directly supports 15-bit RGB display.

MTRP_YUV2

Indicates that preview is displayed in 16-bit YUV 4:2:2 color mode.  This mode is used if the current video mode does not directly correspond to either of the RGB mode and the video hardware can perform real time color space conversion (YUV 4:2:2 to any type of RGB).

MTRP_SIZE

Indicates that preview window can be resized.

MTRP_MOVE

Indicates that preview window can be moved.

Description:

Allows the caller to obtain the information on the capabilities of the currently open preview window.

See also:

GetPreviewWnd


IMtrCapture::Preview
IMtrCapture::Preview	(obsolete)

HRESULT Preview(BOOL flag);

Parameters:

BOOL flag	- a boolean value that enables or disables video preview.

Returns:

S_OK in case of success, S_FALSE otherwise.

Description:

Starts or stop video previewing in the window previously created by the OpenPreview method.  It is advisable to always stop preview before closing the preview window.

See also:

OpenPreview, ClosePreview


IMtrCapture::GetPreviewStatus
IMtrCapture::GetPreviewStatus	(obsolete)

BOOL GetPreviewStatus();

Parameters:

None.

Returns:

TRUE if the video preview is active, FALSE otherwise.

Description:

Allows caller to determine the current state of the video preview.

See also:

Preview


Example:

#include <windows.h>

#include "mtrapi.h"

void myOpenPreview(MTRCAPH mtrcap, HWND parent)

{

meOpenPreview(mtrcap, parent);

mePreview(mtrcap, TRUE);

}

void myClosePreview(MTRCAPH mtrcap, HWND parent)

{

mePreview(mtrcap, FALSE);

meClosePreview(mtrcap, parent);

}

EXTERN_C long CALLBACK	ViewProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)

{

switch(msg) {

case WM_CREATE:

myOpenPreview(mtrcap);

return 0;

case WM_CLOSE:

myClosePreview(mtrcap);

return 0;

case WM_PAINT:

ValidateRect(hwnd, NULL);

return 0;

}

return DefWindowProc(hwnd, msg, wParam, lParam);

}

void myFunction(HANDLE module, MTRCAPH mtrcap)

{

HWND	prvParent;

WNDCLASS	wc;

/* Standard window creation stuff */

wc.style = CS_HREDRAW | CS_VREDRAW;

wc.lpfnWndProc = liveVideoProc;

wc.cbClsExtra = 0;

wc.cbWndExtra = 0;

wc.hInstance = module;

wc.hIcon = NULL;

wc.hCursor = LoadCursor(NULL, IDC_ARROW);

wc.hbrBackground = NULL;

wc.lpszMenuName = NULL;

wc.lpszClassName = ViewProc;

RegisterClass(&wc);

prvParent = CreateWindow(

TEXT("MyWindowClass"),

NULL,

WS_CHILD | WS_VISIBLE,

0, 0, 352, 240,

NULL, NULL, module, mtrcap);

}


IMtrCapture::ClosePreview
IMtrCapture::ClosePreview	(obsolete)

HWND ClosePreview();

Parameters:

None.

Returns:

S_OK in case of success, S_FALSE otherwise.

Description:

Destroys the video preview window created by the OpenPreview method.  This method disables the video preview process if necessary before actually closing the window.

See also:

OpenPreview


IMtrCapture::OpenStream

HRESULT OpenStream();

Parameters:

None.

Returns:

S_OK in case of success, S_FALSE otherwise.

Description:

This method tells the hardware that the capturing and encoding process is about to begin.  It also opens (creates) the output stream (file) specified by call to the SetFileName method.  Every call to this method should be balanced with a call to the CloseStream method.

The call to this method places MPEGator software and hardware to the pause state.  To actually fire the MPEG capturing and encoding process you need to call the Start method.

See also:

CloseStream, Start, SetFileName


IMtrCapture::CloseStream

HRESULT CloseStream();

Parameters:

None.

Returns:

S_OK in case of success, S_FALSE otherwise.

Description:

Closes the MPEG capturing process and its associated stream (file).  The capturing and encoding should be stopped first by Stop method.

See also:

OpenStream, Stop


IMtrCapture::OpenStreamEx

HRESULT OpenStreamEx();

Parameters:

None.

Returns:

S_OK in case of success, S_FALSE otherwise.

Description:

This method performs the same action as the OpenStream method, except the output file is not opened.  Instead, a pointer to the data buffer can be obtained to facilitate encoded data streaming to the destination other than a file (e.g. network, bigger memory buffer, etc.).  Every call to this method should be balanced with a call to the CloseStreamEx method.

The call to this method places MPEGator software and hardware to the pause state.  To actually fire the MPEG capturing and encoding process you need to call the Start method.

See also:

OpenStream, CloseStreamEx, Start


IMtrCapture::CloseStreamEx

HRESULT CloseStreamEx();

Parameters:

None.

Returns:

S_OK in case of success, S_FALSE otherwise.

Description:

Closes the MPEG capturing process and its associated stream opened using the OpenStreamEx method.  The capturing and encoding should be stopped first by Stop method.

See also:

OpenStreamEx, Stop


IMtrCapture::StreamGetPtr

HRESULT StreamGetPtr(MTRSTREAMPTR *meBuf, BOOL wait);

Parameters:

MTRSTREAMPTR *meBuf	- pointer to the stream buffer structure as follows:

typedef	struct {

BOOL	isUsed;	// TRUE if the buffer is used for captured data

long	actualSize;	// amount of valid data in the buffer in bytes

long	bufferSize;	// maximum buffer size in bytes

PSTR	bufferPtr;	// pointer to the data in the buffer

} MTRSTREAMPTR;

BOOL wait	- a flag that instructs the method to wait for the data to become available.  If FALSE, it returns immediately.

Returns:

S_OK in case of success, S_FALSE otherwise.

Description:

Allows to obtain a pointer to and other information about the buffer containing the compressed MPEG data.  A caller will get MTRSTREAMPTR structure filled with the buffer size, pointer to the data, etc.  Based on the information retrieved from this structure a caller can get access to the compressed data for later storage or sending to other application or across the network.

See also:

OpenStream, Stop


IMtrCapture::StreamReleasePtr

HRESULT StreamReleasePtr(MTRSTREAMPTR *meBuf);

Parameters:

MTRSTREAMPTR *meBuf	- pointer to the stream buffer structure (see StreamGetPtr for description).

Returns:

S_OK in case of success, S_FALSE otherwise.

Description:

Releases the buffer associated with MTRSTREAMPTR structure obtained by StreamGetPtr method.

See also:

StreamGetPtr, Stop


IMtrCapture::GetWaitHandle

HANDLE GetWaitHandle();

Parameters:

None.

Returns:

Handle to the object that can be passed to a WaitForSingleObject function (refer to Microsoft Win32 SDK documentation for description).

Description:

Allows the caller to obtain the handle to the object that the system can wait for.

See also:

None.


pThis->OpenStreamEx();

while(1) {

MTRSTREAMPTR	strmPtr;

dw = WaitForSingleObject(pThis->GetWaitHandle(), INFINITE);

if(dw != WAIT_OBJECT_0) {

break;

}

for(;;) {

pThis->GetStreamPtr(&strmPtr, FALSE);

if(!strmPtr.isUsed)

break;

WriteFile(fileHandle, strmPtr.bufferPtr, strmPtr.actualSize, NULL, NULL);

pThis->ReleaseStreamPtr(&strmPtr);

}

}

pThis->CloseStreamEx();


IMtrCapture::Start

HRESULT Start();

Parameters:

None.

Returns:

S_OK in case of success, S_FALSE otherwise.

Description:

Actually fires the MPEG capturing and encoding process.  Must be preceded by call to the OpenStream method, which does all the preparations.

See also:

Stop, OpenStream


IMtrCapture::Stop

HRESULT Stop();

Parameters:

None.

Returns:

S_OK in case of success, S_FALSE otherwise.

Description:

Stops the capturing process.  Closes the output stream (file), so the process can not be restarted right away with the call to Start method.  You should call CloseStream method to complete the capturing process and then restart it from the scratch by calling OpenStream method.

If you intend to resume the capturing process from the same position in the stream, without closing it, use the Pause method instead.

See also:

Start, Pause, OpenStream, CloseStream


Example:

#include <windows.h>

#include "mtrapi.h"

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nShowCmd)

{

MTRCAPH	mtrcap;

if(!mtrOpen()) {

/* gracefully process error condition here */

return 0;

}

if((mtrcap = meOpen())==NULL) {

/* gracefully process error condition here */

meClose();

mtrClose();

return 0;

}

meSetFileName(mtrcap, TEXT("c:\\default.mpv"));

meOpenStream(mtrcap);

meSequence();

/* rest for a looooooooooong while here */

meStop();

meCloseStream(mtrcap);

meClose(mtrcap);

mtrClose();

}


IMtrCapture::Pause

HRESULT Pause();

Parameters:

None.

Returns:

S_OK in case of success, S_FALSE otherwise.

Description:

Pauses the capturing process.  Does not de-allocate internal buffers or closes the output file, so the process can be quickly resumed from the same position with the call to Start method.  There is no restrictions on the number of calls to Pause and Start methods, but the capture should be finally stopped with the call to the Stop method.

See also:

Start, Stop


IMtrCapture::GetLastError

HRESULT GetLastError(PTSTR str, int len);

Parameters:

PTSTR str	- character buffer which will receive the error message string.

int len	- maximum message length in bytes that the buffer can hold.

Returns:

S_OK in case of success, S_FALSE otherwise.

Description:

Use this method to obtain the error description text, if one of the previously called methods have returned S_FALSE.  The error code is obtained internally by calling Win32 GetLastError function.

See also:

None.


Example:

#include <windows.h>

#include "mtrif.h"

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,

LPSTR lpCmdLine, int nShowCmd)

{

TCHAR str[256];

if(!mtrOpen()) {

if(mtrGetErrorString(GetLastError(), str, 256))

MessageBox(NULL, str, "Error", MB_OK | MB_ICONERROR);

return 0;

}

mtrClose();

return 0;

}


IMtrCapture::GetVMpegSetup

HRESULT GetVMpegSetup(IVMpegSetup ** ppVMpeg);

Parameters:

IVMpegSetup ** ppVMpeg
- pointer to the variable that will receive the pointer to the IVMpegSetup interface.

Returns:

S_OK in case of success, S_FALSE otherwise.

Description:

Allows to obtain the pointer to the given interface of the same object.

See also:

IVMpegSetup


IMtrCapture::GetAMpegSetup

HRESULT GetAMpegSetup(IAMpegSetup ** ppAMpeg);

Parameters:

IAMpegSetup ** ppAMpeg
- pointer to the variable that will receive the pointer to the IAMpegSetup interface.

Returns:

S_OK in case of success, S_FALSE otherwise.

Description:

Allows to obtain the pointer to the given interface of the same object.

See also:

IAMpegSetup


IMtrCapture::GetVideoSetup

HRESULT GetVideoSetup(IVideoSetup ** ppVideo);

Parameters:

IVideoSetup ** ppVideo
- pointer to the variable that will receive the pointer to the IVideoSetup interface.

Returns:

S_OK in case of success, S_FALSE otherwise.

Description:

Allows to obtain the pointer to the given interface of the same object.

See also:

IVideoSetup


IMtrCapture::GetAudioSetup

HRESULT GetAudioSetup(IAudioSetup ** ppAudio);

Parameters:

IAudioSetup ** ppAudio
- pointer to the variable that will receive the pointer to the IAudioSetup interface.

Returns:

S_OK in case of success, S_FALSE otherwise.

Description:

Allows to obtain the pointer to the given interface of the same object.

See also:

IAudioSetup


IMtrCapture::GetMuxerSetup

HRESULT GetMuxerSetup(IMuxerSetup ** ppMuxer);

Parameters:

IMuxerSetup ** ppMuxer
- pointer to the variable that will receive the pointer to the IMuxerSetup interface.

Returns:

S_OK in case of success, S_FALSE otherwise.

Description:

Allows to obtain the pointer to the given interface of the same object.

See also:

IMuxerSetup


IMtrCapture::GetVideoPreview

HRESULT GetVideoPreview(IVideoPreview ** ppPreview);

Parameters:

IVideoPreview ** ppPreview
- pointer to the variable that will receive the pointer to the IVideoPreview interface.

Returns:

S_OK in case of success, S_FALSE otherwise.

Description:

Allows to obtain the pointer to the given interface of the same object.

See also:

IVideoPreview


IVMpegSetup interface

Interface that provides methods to control various video MPEG encoding parameters.

General	get_VideoSystem

set_VideoSystem

get_VideoBitrate

set_VideoBitrate

get_PictureSize (enumerated)

set_PictureSize (enumerated)

get_PictureSize (arbitrary)

set_PictureSize (arbitrary)

GOP structure control	get_IFrameInterval

set_IFrameInterval

get_PFrameInterval

set_PFrameInterval

VBV buffer size control	get_VBVSize

set_VBVSize

get_VBVSizeKb

set_VBVSizeKb

Bitrate Control	get_IPercent

set_IPercent

get_PPercent

set_PPercent

get_BPercent

set_BPercent

Motion Estimation	get_MotionDecision

set_MotionDecision

get_MotionWidth

set_MotionWidth

get_MotionHeight

set_MotionHeight

get_MotionPel

set_MotionPel

Quality Control	get_ILastClip

set_ILastClip

get_PLastClip

set_PLastClip

get_PThreshold

set_PThreshold

get_BLastClip

set_BLastClip

get_BThreshold

set_BThreshold

get_QMatrixScale

set_QMatrixScale

Real Time Quantization Control	get_IQuant

set_IQuant

get_PQuant

set_PQuant

get_BQuant

set_BQuant

Parameters Load/Save (inherited)	RegLoad

RegSave

Default


IVMpegSetup::get_VideoSystem

STDMETHOD_(VSystem, get_VideoSystem)(THIS_ ) PURE;


IVMpegSetup::set_VideoSystem

STDMETHOD(set_VideoSystem)(THIS_ VSystem vsys) PURE;


IVMpegSetup::get_VideoBitrate

STDMETHOD_(DWORD, get_VideoBitrate)(THIS_ ) PURE;


IVMpegSetup::set_VideoBitrate

STDMETHOD(set_VideoBitrate)(THIS_ DWORD bitrate) PURE;


IVMpegSetup::get_PictureSize (enumerated)

STDMETHOD_(mpeg_size, get_PictureSize)(THIS_ ) PURE;


IVMpegSetup::set_PictureSize (enumerated)

STDMETHOD(set_PictureSize)(THIS_ mpeg_size size) PURE;


IVMpegSetup::get_PictureSize (arbitrary)

STDMETHOD(get_PictureSize)(THIS_ SIZE * ) PURE;


IVMpegSetup::set_PictureSize (arbitrary)

STDMETHOD(set_PictureSize)(THIS_ SIZE * ) PURE;


IVMpegSetup::get_IFrameInterval

STDMETHOD_(WORD, get_IFrameInterval)(THIS_ ) PURE;


IVMpegSetup::set_IFrameInterval

STDMETHOD(set_IFrameInterval)(THIS_ WORD interval) PURE;


IVMpegSetup::get_PFrameInterval

STDMETHOD_(WORD, get_PFrameInterval)(THIS_ ) PURE;


IVMpegSetup::set_PFrameInterval

STDMETHOD(set_PFrameInterval)(THIS_ WORD interval) PURE;


IVMpegSetup::get_VBVSize

STDMETHOD_(DWORD, get_VBVSize)(THIS_ ) PURE;


IVMpegSetup::set_VBVSize

STDMETHOD(set_VBVSize)(THIS_ DWORD size) PURE;


IVMpegSetup::get_VBVSizeKb

STDMETHOD_(DWORD, get_VBVSizeKb)(THIS_ ) PURE;


IVMpegSetup::set_VBVSizeKb

STDMETHOD(set_VBVSizeKb)(THIS_ DWORD size) PURE;


IVMpegSetup::get_IPercent

STDMETHOD_(WORD, get_IPercent)(THIS_ ) PURE;


IVMpegSetup::set_IPercent

STDMETHOD(set_IPercent)(THIS_ WORD percent) PURE;


IVMpegSetup::get_PPercent

STDMETHOD_(WORD, get_PPercent)(THIS_ ) PURE;


IVMpegSetup::set_PPercent

STDMETHOD(set_PPercent)(THIS_ WORD percent) PURE;


IVMpegSetup::get_BPercent

STDMETHOD_(WORD, get_BPercent)(THIS_ ) PURE;


IVMpegSetup::set_BPercent

STDMETHOD(set_BPercent)(THIS_ WORD percent) PURE;


IVMpegSetup::get_MotionDecision

STDMETHOD_(BOOL, get_MotionDecision)(THIS_ ) PURE;


IVMpegSetup::set_MotionDecision

STDMETHOD(set_MotionDecision)(THIS_ BOOL isDecision) PURE;


IVMpegSetup::get_MotionWidth

STDMETHOD_(WORD, get_MotionWidth)(THIS_ ) PURE;


IVMpegSetup::set_MotionWidth

STDMETHOD(set_MotionWidth)(THIS_ WORD width) PURE;


IVMpegSetup::get_MotionHeight

STDMETHOD_(WORD, get_MotionHeight)(THIS_ ) PURE;


IVMpegSetup::set_MotionHeight

STDMETHOD(set_MotionHeight)(THIS_ WORD height) PURE;


IVMpegSetup::get_MotionPel

STDMETHOD_(BOOL, get_MotionPel)(THIS_ ) PURE;


IVMpegSetup::set_MotionPel

STDMETHOD(set_MotionPel)(THIS_ BOOL isHalfPel) PURE;


IVMpegSetup::get_ILastClip

STDMETHOD_(int, get_ILastClip)(THIS_ ) PURE;


IVMpegSetup::set_ILastClip

STDMETHOD(set_ILastClip)(THIS_ int val) PURE;


IVMpegSetup::get_PLastClip

STDMETHOD_(int, get_PLastClip)(THIS_ ) PURE;


IVMpegSetup::set_PLastClip

STDMETHOD(set_PLastClip)(THIS_ int val) PURE;


IVMpegSetup::get_PThreshold

STDMETHOD_(int, get_PThreshold)(THIS_ ) PURE;


IVMpegSetup::set_PThreshold

STDMETHOD(set_PThreshold)(THIS_ int val) PURE;


IVMpegSetup::get_BLastClip

STDMETHOD_(int, get_BLastClip)(THIS_ ) PURE;


IVMpegSetup::set_BLastClip

STDMETHOD(set_BLastClip)(THIS_ int val) PURE;


IVMpegSetup::get_BThreshold

STDMETHOD_(int, get_BThreshold)(THIS_ ) PURE;


IVMpegSetup::set_BThreshold

STDMETHOD(set_BThreshold)(THIS_ int val) PURE;


IVMpegSetup::get_QMatrixScale

STDMETHOD_(WORD, get_QMatrixScale)(THIS_ ) PURE;


IVMpegSetup::set_QMatrixScale

STDMETHOD(set_QMatrixScale)(THIS_ WORD scale) PURE;


IVMpegSetup::get_IQuant

STDMETHOD()(THIS_ MTRQUANT * q) PURE;


IVMpegSetup::set_IQuant

STDMETHOD(set_IQuant)(THIS_ MTRQUANT * q) PURE;


IVMpegSetup::get_PQuant

STDMETHOD(get_PQuant)(THIS_ MTRQUANT * q) PURE;


IVMpegSetup::set_PQuant

STDMETHOD(set_PQuant)(THIS_ MTRQUANT * q) PURE;


IVMpegSetup::get_BQuant

STDMETHOD(get_BQuant)(THIS_ MTRQUANT * q) PURE;


IVMpegSetup::set_BQuant

STDMETHOD(set_BQuant)(THIS_ MTRQUANT * q) PURE;


IAMpegSetup interface

Interface that provides methods to control various audio MPEG encoding parameters.

General	get_AudioBitrateType

set_AudioBitrateType

get_AudioBitrate

set_AudioBitrate

get_Layer

set_Layer

get_SampleFrequency

set_SampleFrequency

get_Mode

set_Mode

Parameters Load/Save (inherited)	RegLoad

RegSave

Default


IAMpegSetup::get_AudioBitrateType

STDMETHOD_(ampeg_type, get_AudioBitrateType)(THIS_ ) PURE;


IAMpegSetup::set_AudioBitrateType

STDMETHOD(set_AudioBitrateType)(THIS_ ampeg_type type) PURE;


IAMpegSetup::get_AudioBitrate

STDMETHOD_(DWORD, get_AudioBitrate)(THIS_ ) PURE;


IAMpegSetup::set_AudioBitrate

STDMETHOD(set_AudioBitrate)(THIS_ DWORD bitrate) PURE;


IAMpegSetup::get_Layer

STDMETHOD_(ampeg_layer, get_Layer)(THIS_ ) PURE;


IAMpegSetup::set_Layer

STDMETHOD(set_Layer)(THIS_ ampeg_layer layer) PURE;


IAMpegSetup::get_SampleFrequency

STDMETHOD_(ampeg_freq, get_SampleFrequency)(THIS_ ) PURE;


IAMpegSetup::set_SampleFrequency

STDMETHOD(set_SampleFrequency)(THIS_ ampeg_freq freq) PURE;


IAMpegSetup::get_Mode

STDMETHOD_(ampeg_mode, get_Mode)(THIS_ ) PURE;


IAMpegSetup::set_Mode

STDMETHOD(set_Mode)(THIS_ ampeg_mode mode) PURE;


IVideoSetup interface

Interface that provides methods to control various video input parameters.

Video attributes controls	get_HUE

set_HUE

get_SAT

set_SAT

get_CONT

set_CONT

get_BRIG

set_BRIG

Video source information	get_System

set_System

get_Source

set_Source

Cropping parameters	get_Offset

set_Offset

get_Size

set_Size

Update all settings	Update

Parameters Load/Save (inherited)	RegLoad

RegSave

Default


IVideoSetup::get_HUE

STDMETHOD_(int, get_HUE)(THIS_ ) PURE;


IVideoSetup::set_HUE

STDMETHOD(set_HUE)(THIS_ int v) PURE;


IVideoSetup::get_SAT

STDMETHOD_(int, get_SAT)(THIS_ ) PURE;


IVideoSetup::set_SAT

STDMETHOD(set_SAT)(THIS_ int v) PURE;


IVideoSetup::get_CONT

STDMETHOD_(int, get_CONT)(THIS_ ) PURE;


IVideoSetup::set_CONT

STDMETHOD(set_CONT)(THIS_ int v) PURE;


IVideoSetup::get_BRIG

STDMETHOD_(int, get_BRIG)(THIS_ ) PURE;


IVideoSetup::set_BRIG

STDMETHOD(set_BRIG)(THIS_ int v) PURE;


IVideoSetup::get_System

STDMETHOD_(VSystem, get_System)(THIS_ ) PURE;


IVideoSetup::set_System

STDMETHOD(set_System)(THIS_ VSystem v) PURE;


IVideoSetup::get_Source

STDMETHOD_(int, get_Source)(THIS_ ) PURE;


IVideoSetup::set_Source

STDMETHOD(set_Source)(THIS_ int v) PURE;


IVideoSetup::get_Offset

STDMETHOD(get_Offset)(THIS_ POINT * v) PURE;


IVideoSetup::set_Offset

STDMETHOD(set_Offset)(THIS_ POINT * v) PURE;


IVideoSetup::get_Size

STDMETHOD(get_Size)(THIS_ SIZE * v) PURE;


IVideoSetup::set_Size

STDMETHOD(set_Size)(THIS_ SIZE * v) PURE;


IVideoSetup::Update

STDMETHOD(Update)(THIS_ ) PURE;


IAudioSetup interface

Interface that provides methods to control various audio input parameters.

Line Input controls	get_LineInVolume

set_LineInVolume

get_LineInBalance

set_LineInBalance

get_LineInMute

set_LineInMute

Auxiliary Input controls	get_AuxInVolume

set_AuxInVolume

get_AuxInBalance

set_AuxInBalance

get_AuxInMute

set_AuxInMute

Loopback Output controls	get_LoopVolume

set_LoopVolume

get_LoopBalance

set_LoopBalance

get_LoopMute

set_LoopMute

Line Output controls	get_OutVolume

set_OutVolume

get_OutBalance

set_OutBalance

get_OutMute

set_OutMute

Update all settings	Update

Parameters Load/Save (inherited)	RegLoad

RegSave

Default


IAudioSetup::get_LineInVolume

STDMETHOD_(int, get_LineInVolume)(THIS_ ) PURE;


IAudioSetup::set_LineInVolume

STDMETHOD(set_LineInVolume)(THIS_ int v) PURE;


IAudioSetup::get_LineInBalance

STDMETHOD_(int, get_LineInBalance)(THIS_ ) PURE;


IAudioSetup::set_LineInBalance

STDMETHOD(set_LineInBalance)(THIS_ int v) PURE;


IAudioSetup::get_LineInMute

STDMETHOD_(BOOL, get_LineInMute)(THIS_ ) PURE;


IAudioSetup::set_LineInMute

STDMETHOD(set_LineInMute)(THIS_ BOOL v) PURE;


IAudioSetup::get_AuxInVolume

STDMETHOD_(int, get_AuxInVolume)(THIS_ ) PURE;


IAudioSetup::set_AuxInVolume

STDMETHOD(set_AuxInVolume)(THIS_ int v) PURE;


IAudioSetup::get_AuxInBalance

STDMETHOD_(int, get_AuxInBalance)(THIS_ ) PURE;


IAudioSetup::set_AuxInBalance

STDMETHOD(set_AuxInBalance)(THIS_ int v) PURE;


IAudioSetup::get_AuxInMute

STDMETHOD_(BOOL, get_AuxInMute)(THIS_ ) PURE;


IAudioSetup::set_AuxInMute

STDMETHOD(set_AuxInMute)(THIS_ BOOL v) PURE;


IAudioSetup::get_LoopVolume

STDMETHOD_(int, get_LoopVolume)(THIS_ ) PURE;


IAudioSetup::set_LoopVolume

STDMETHOD(set_LoopVolume)(THIS_ int v) PURE;


IAudioSetup::get_LoopBalance

STDMETHOD_(int, get_LoopBalance)(THIS_ ) PURE;


IAudioSetup::set_LoopBalance

STDMETHOD(set_LoopBalance)(THIS_ int v) PURE;


IAudioSetup::get_LoopMute

STDMETHOD_(BOOL, get_LoopMute)(THIS_ ) PURE;


IAudioSetup::set_LoopMute

STDMETHOD(set_LoopMute)(THIS_ BOOL v) PURE;


IAudioSetup::get_OutVolume

STDMETHOD_(int, get_OutVolume)(THIS_ ) PURE;


IAudioSetup::set_OutVolume

STDMETHOD(set_OutVolume)(THIS_ int v) PURE;


IAudioSetup::get_OutBalance

STDMETHOD_(int, get_OutBalance)(THIS_ ) PURE;


IAudioSetup::set_OutBalance

STDMETHOD(set_OutBalance)(THIS_ int v) PURE;


IAudioSetup::get_OutMute

STDMETHOD_(BOOL, get_OutMute)(THIS_ ) PURE;


IAudioSetup::set_OutMute

STDMETHOD(set_OutMute)(THIS_ BOOL v) PURE;


IAudioSetup::Update

STDMETHOD(Update)(THIS_ ) PURE;


IMuxerSetup interface

Provides methods to setup various parameters of video / audio multiplexor.

Stream Type Manipulation	get_StreamType

set_StreamType

Bitrate Manipulation	get_BitrateType

set_BitrateType

Stream Type Query	is_SystemStream

is_AudioStream

is_VideoStream

Parameters Load/Save (inherited)	RegLoad

RegSave

Default


IMuxerSetup::get_StreamType

STDMETHOD_(int, get_StreamType)(THIS_ ) PURE;


IMuxerSetup::set_StreamType

STDMETHOD(set_StreamType)(THIS_ int type) PURE;


IMuxerSetup::get_BitrateType

STDMETHOD_(bitrate_type, get_BitrateType)(THIS_ ) PURE;


IMuxerSetup::set_BitrateType

STDMETHOD(set_BitrateType)(THIS_ bitrate_type) PURE;


IMuxerSetup::is_SystemStream

STDMETHOD_(BOOL, is_SystemStream)(THIS_ ) PURE;


IMuxerSetup::is_AudioStream

STDMETHOD_(BOOL, is_AudioStream)(THIS_ ) PURE;


IMuxerSetup::is_VideoStream

STDMETHOD_(BOOL, is_VideoStream)(THIS_ ) PURE;


RegLoad
RegLoad	(inhereted by all IxxxSetup interfaces)

STDMETHOD(RegLoad)(THIS_ HKEY hKey) PURE;


RegSave
RegSave	(inhereted by all IxxxSetup interfaces)

STDMETHOD(RegSave)(THIS_ HKEY hKey) PURE;


Default
Default	(inhereted by all IxxxSetup interfaces)

STDMETHOD(Default)(THIS_ ) PURE;


IVideoPreview interface

Provides methods to control video preview and its appearance.

General	Open

Close

Enable

Status and Capabilities information	GetCaps

GetCapsD

GetStatus

Preview window control	GetWnd

Update

Size control	GetSize

SetSize

GetVideoSize

SetVideoSize


IVideoPreview::Open

STDMETHOD(Open)(THIS_ HWND hWndParent) PURE;


IVideoPreview::Close

STDMETHOD(Close)(THIS_) PURE;


IVideoPreview::Enable

STDMETHOD(Enable)(THIS_ BOOL flag) PURE;


IVideoPreview::GetCaps

STDMETHOD(GetCaps)(THIS_ MTRPREVIEW_CAPS * caps) PURE;


IVideoPreview::GetCapsD

STDMETHOD_(DWORD, GetCapsD)(THIS_ ) PURE;


IVideoPreview::GetStatus

STDMETHOD_(BOOL, GetStatus)(THIS_ ) PURE;


IVideoPreview::GetWnd

STDMETHOD(GetWnd)(THIS_ HWND * hWnd) PURE;


IVideoPreview::Update

STDMETHOD(Update)(THIS_ ) PURE;


IVideoPreview::GetSize

STDMETHOD(GetSize)(THIS_ SIZE * rc) PURE;


IVideoPreview::SetSize

STDMETHOD(SetSize)(THIS_ SIZE * rc) PURE;


IVideoPreview::GetVideoSize

STDMETHOD(GetVideoSize)(THIS_ SIZE * rc) PURE;


IVideoPreview::SetVideoSize

STDMETHOD(SetVideoSize)(THIS_ SIZE * rc) PURE;


IMtrAccel interface


IMtrDecode interface


IMtrFrameCapture interface


MPEGator error codes

#define MTR_ERR	0x40000000l

#define MTR_ERR_MEMORY	MTR_ERR

#define MTR_ERR_OPENVXD	MTR_ERR+1

#define MTR_ERR_HARDWARE	MTR_ERR+2

#define MTR_ERR_OPENFILE	MTR_ERR+3

#define MTR_ERR_CLOSEFILE	MTR_ERR+4

#define MTR_ERR_IOFILE	MTR_ERR+5

#define MTR_ERR_HANDLE	MTR_ERR+6

#define MTR_ERR_HWAUDIO	MTR_ERR+7

#define MTR_ERR_HWVIDEO	MTR_ERR+8

#define MTR_ERR_PLAY	MTR_ERR+9

#define MTR_ERR_DIRECT	MTR_ERR+10

#define MTR_ERR_START_ENCODE	MTR_ERR+11

#define MTR_VWND_ERR	MTR_ERR+12

#define	MTR_VWND_ERROR_NODDX	MTR_ERR+13

#define	MTR_VWND_ERROR_PRIM	MTR_ERR+14

#define	MTR_VWND_ERROR_SEC	MTR_ERR+15

#define	MTR_VWND_ERROR_COOP	MTR_ERR+16

#define	MTR_VWND_ERROR_MEM	MTR_ERR+17

#define	MTR_VWND_ERROR_FMT	MTR_ERR+18

#define	MTR_VWND_ERROR_1	MTR_ERR+19

#define	MTR_VWND_ERROR_2	MTR_ERR+20

#define	MTR_VWND_ERROR_3	MTR_ERR+21

#define	MTR_VWND_ERROR_4	MTR_ERR+22

#define MTR_ERR_NUMB_100	MTR_ERR+23 // error initializing muxer

#define MTR_ERR_NUMB_101	MTR_ERR+24 // error create ring0 thread

#define MTR_ERR_NUMB_102	MTR_ERR+25 // error virtualizing IRQ

#define MTR_ERR_NUMB_103	MTR_ERR+26 // error open semaphore

#define MTR_ERR_NUMB_104	MTR_ERR+27 // error allocate memory pool

#define MTR_ERR_NUMB_105	MTR_ERR+28 // error open audio encoding lib

#define MTR_ERR_NUMB_106	MTR_ERR+29 //

#define MTR_ERR_NUMB_107	MTR_ERR+30 // MPEG functions disabled

#define MTR_ERR_NUMB_108	MTR_ERR+31 // Not Installed

#define MTR_ERR_NUMB_109	MTR_ERR+32

#define MTR_ERR_NUMB_110	MTR_ERR+33