Table of Contents1H.264 1080p/1080i/720P Capture DeviceSoftware Manual (Windows)Models 2226 | Ver1.04 | March 2012
General SDK Usage1. Enumeration. If using multiple boards, they can be identified with the S2226_Enumerate call. If using a single board, it may be
After the board is successfully opened, it is necessary to configure it. Generally, it is not necessary to configure the audio settings. The default
Audio Meter• S2226_SetAudioMtrHoldTime• S2226_GetAudioMtrHoldTime• S2226_SetAudioMtrHoldRelease• S2226_GetAudioMtrHoldRelease• S2226_SetAudioMtrTest•
techniques to work with the data. This could involve, for example, saving the data from the callback to a queue or FIFO to work on in another thread.
Unfortunately, if the user does manage to move the video window from one display to another, the preview may freeze. When this happens, the recording
OverlayThe 2226 has the capability to add text captions and bitmap images on to the video stream. There are a total of 8 hardware windows to work wit
• S2226_SetMergeMethod• S2226_SnapshotToFile• S2226_SnapshotToFileW• S2226_SnapshotToMem• S2226_SnapshotRawNotificationsThe 2226 is a USB device. It
MID2226_API int S2226_CloseBoard(HANDLE hdev);Must be called before application terminates for proper clean-up of the SDK and SDK objects.Parametershd
);Selects current input. If bUpdateNow is set to FALSE, the input will not be updated until streaming is started. If changing from an HD input to an
MID2226_API int S2226_GetInput( MID2226_SOURCE *pSource, HANDLE hdev);Retrieves current input settings.ParameterspSourcepointer to the value to re
LIMITED WARRANTY ...
Parametersbitratebitrate of encoded stream in kbps. (1000-17000kbps). hdevhandle to device (obtained from S2226_OpenBoard).Returns0 on success, negati
MID2226_API int S2226_SetReducedClock( BOOL bReducedClock, HANDLE hdev);For HD inputs only (720p, 1080i) with NTSC video system. Some HD NTSC sou
ParameterspStatuspointer to status variable.hdevhandle to device (obtained from S2226_OpenBoard).Returns0 on success, negative value if error (see mid
MID2226_API int S2226_StopStream( HANDLE hdev);Stops streaming (recording, playing, previewing). Any registered callback is cleared.Parametershdevha
HANDLE hdev);Retrieves video levels.Parametersparamdefines the parameter to get (MID2226_LEVEL_CONTRAST, MID2226_LEVEL_BRIGHTNESS, MID2226_LEVEL_SA
MID2226_API int S2226_GetAudioGain( int *gainL, int *gainR, HANDLE hdev );Retrieves gain settings for internal PGA audio amp.ParametersgainLgain
gainLAGC gain for left channel(decibels times 2). 0-118 (0-59dB) 0dB recommended for line input.gainRAGC gain for right channel(decibels times 2). 0-1
handle to device (obtained from S2226_OpenBoard).Returns0 on success, negative value if error (see mid2226types.h for error codes list).MID2226_API in
int val, HANDLE hdev );Used for S2226_StartDecode only. Set the audio DAC volume.Parametersval0-127 (steps of -0.5 dB, 0=0Db=maximum volume, 127
Parametersextra_gain0-9 (in steps of 1 dB). The default and recommended setting is 0.hdevhandle to device (obtained from S2226_OpenBoard).Returns0 on
Audio Meter/Settings/Test ...
Returns0 on success, negative value if error (see mid2226types.h for error codes list).MID2226_API int S2226_GetAudioOutputHp( int *extra_gain, HA
Retrieve extra gain setting for audio stereo channel.Parametersextra_gain0-9 (in steps of 1 dB). The default and recommended setting is 0.hdevhandle t
handle to device (obtained from S2226_OpenBoard).Returns0 on success, negative value if error (see mid2226types.h for error codes list).MID2226_API in
AMUX_MPEG_IN_TONE - MPEG-In gets Tone Test AMUX_MPEG_IN_SDI_IN - MPEG-In gets SDI-In embedded audiohdevhandle to device (obtained from S2226_
Set Audio Meter Channel Select. Determines which Audio channel to send to the meter/monitor hardware.ParameterssourceSource can be one of: 0 = Lin
Set Audio Meter's Hold/Release setting.ParametersholdrelCan be one of: 1 = Force release of 'Held' output 0 = Allow holding of h
ParametersvalCan be one of: 0 = no hold (Update every 1 ms) 1 = Hold hold highest value 0.5 sec 2 = Hold hold highest value 1.0 sec 3 =
MID2226_API int S2226_SetAudioMtrTest( int val, HANDLE hdev );Set Audio Meter test type.ParametersvalCan be one of: 0 = No Test. 1
0 on success, negative value if error (see mid2226types.h for error codes list).MID2226_API int S2226_GetAudioMtrHold( int *hld_l, int *hld_r, i
MID2226_API int S2226_GetAudioMtrLevel( int *audl, int *audr, HANDLE hdev );Get the audio meter's peak amplitude that is decayed over time.
ovldel i ...
pointer to the value to receive the right channels current peak amplitude that is decayed over time in decibels. hdevhandle to device (obtained from S
callback function. See header file for definition of cbfunc_t function.hdevhandle to device (obtained from S2226_OpenBoard).Returns0 on success, nega
Returns0 on success, negative value if error (see mid2226types.h for error codes list).MID2226_API int S2226_StartDecode( char *fileName, MID2226_
Starts decoding a stream from memory. See demo application for an example usage of this function. Use S2226_SendData to send data to the 2226 to dec
handle to device (obtained from S2226_OpenBoard).Returns0 on success, negative value if error (see mid2226types.h for error codes list).MID2226_API in
MID2226_API int S2226_TestDecodeDone( HANDLE hdev);If message received, tests if decode was finished in the driver. This is NOT, however, when decod
);Starts video preview achieved by decompressing the stream. Available on Windows 7 only. Please note that H264 requires significant CPU resources t
wchar_t *fileName, HANDLE hdev);Same as S2226_StartPreviewAndRecord, but uses widechar or Unicode filenames.MID2226_API int S2226_SetRawPreviewSi
Start raw preview allows viewing the raw preview while streaming. It can be used with S2226_StartRecord or S2226_StartCallback. It should not be used
handle to device context.hdevhandle to device (obtained from S2226_OpenBoard).Returns0 on success, negative value if error (see mid2226types.h for err
Limited warrantySensoray Company, Incorporated (Sensoray) warrants the hardware to be free from defects in material and workmanship and perform to app
handle to device (obtained from S2226_OpenBoard).Returns0 on success, negative value if error (see mid2226types.h for error codes list).MID2226_API in
regionmaskMID2226_REGION_MONITOR, MID2226_REGION_MPEG, MID2226_REGION_STILL.hdevhandle to device (obtained from S2226_OpenBoard).Returns0 on success,
0 on success, negative value if error (see mid2226types.h for error codes list).MID2226_API int S2226_OverlayImage( int xpos, int ypos, char *im
);Adds overlay image. If overlay already exists at that x, y position, deletes window before adding.ParametersAtIndex(0-7) sub-window position to upda
ImagePointer to memory containing 24-bit RGB data Row 0 firstxPosStart X positionyPosStart y positionxSizeSize of horizontal line in pixels (Each pixe
type1=image, 0=textregionMID2226_REGION_MONITOR, MID2226_REGION_MPEG, MID2226_REGION_STILL.grouptext with common group number is kept together.xpossta
NOTE: All conditions are met when sub-window position 0 is set to match the input video resolution, thereby creating a full screen overlay that can be
redreg component 0-255greengreen component 0-255blueblue component 0-255hdevhandle to device (obtained from S2226_OpenBoard).Returns0 on success, nega
MID2226_API int S2226_OverlayDelXY( int xpos, int ypos, HANDLE hdev);Delete an overlay at x, y location if one exists at that location.Parameter
Refresh or update the overlay to the hardware.Parametershdevhandle to device (obtained from S2226_OpenBoard).Returns0 on success, negative value if er
IntroductionThe 2226 product is a USB 2.0 audio video H.264 capture device. The 2226 supports many different inputs and video formats including 1080p
HANDLE hdev);Sets all overlays for specified region.ParametersregionmaskMID2226_REGION_MONITOR, MID2226_REGION_MPEG, MID2226_REGION_STILL.hdevhandl
int freezetime, int wait, int qual, int unused, HANDLE hdev);Takes a snapshot and save to file in filename.Parametersfilenamefully qualifie
HANDLE hdev);Takes a snapshot and save to file in filename (unicode version)Parametersfilenamefully qualified unicode filename with path (without e
imagepointer to retrieved snapshot. (image must be preallocated).sizesize of the image buffer (image).freezetimetime in milli-seconds to freeze the im
pointer to the returned raw image fields.freezetimetime in milli-seconds to freeze the image( freezing is done on the video output channels of the 222
Returns0 on success, negative value if error (see mid2226types.h for error codes list).MID2226_API int S2226_GetSDKVersions( unsigned int num, uns
int type, HANDLE hdev);Sets the output control for the device for the composite outputs. Parameterstype0-scaled output off(raw preview may be use
MID2226_API int S2226_save_rgbW( const wchar_t *fileName, const unsigned char *rgb, int width, int height, int type);Unicode wide-char versi
callback mechanism is usually UYVY. This converts it to RGB format before saving the image to file as BMP. Parametersuyvypointer to UYVY image. Size
Demo ApplicationThe demo application is shown above.Board SelectionThe board selection allows the user to select between multiple boards in the system
SoftwareFeature SummarySensoray's Model 2226 is shipped with drivers for Microsoft Windows XP, Vista, Windows 7. A full-featured demo application
available using the 2226 termination board (2226TA). “2226S” is the default setting and displays the inputs on the boxed 2226 system.LevelsThe bright
Settings/Audio Routing...Audio settings brings up the audio gain and output settings.Settings/Mpeg-InSelects which audio input is selected to drive th
Audio Meter/Left,Right/LevelThe hexadecimal values returned from a call to S2226_GetAudioMtrLevel().Audio Meter/Left,Right/dBThe values returned from
The allowed preview scales using S2226_SetRawPreviewSize are as follows:SDI-SD, Composite, Svideo: 320x240, 640x480, 1280x720 (reduced frame rate), 19
FAQQ1) Can the 2226 record one file and decode another at the same time?A1) The 2226 is half duplex. Only one operation (encode/decode) may be perfor
Appendix A - TCL ScriptingThe 2226 Demo application includes a TCL scripting language interface. It is accessed from the Tools menu. The version used
Using TCLUpon selecting TCL from the Tools menu, an interactive (console) environment is setup for running and creating TCL scripts.Command can be exe
Integration with the 2226Integration with the 2226 is done in a single file: jim_TclShell.cppThe routines that wrap the API function's typically
Appendix B – API wrappersThe following 2226 API routines have been wrapped, and can be called, with TCL commands.SettingsReducedclock / rc nCalls S22
get_inputCalls S2226_GetInput()This routine returns the input number given to the input command.outputscale typeCalls S2226_SetOutput()Sets the outpu
The files PushFileSource2.ax and sraywrite.ax are registered by the installer using regsvr32. If re-distributing using a custom install, these files
record_preview_raw filenameThis routine calls S2226_SetPreviewType() and S2226_StartPreviewAndRecord() to record the selected input to the file-filen
SnapshotSetmerge mCalls S2226_SetMergeMethod()This routine sets the method that an interlaced video snapshot is de-interlaced before being saved to f
ovlimagei f i x y Calls S2226_OverlayImageIdx() and optionally S2226_UpdateOverlay() Overlay .bmp file f to location x, y using index iovlimageraw
ovldel iCalls S2226_OverlayDel() and optionally S2226_UpdateOverlay() This routine deletes overlay index-iovlclearCalls S2226_ClearOverlay()This rout
kbhitThis routine senses whether the user presses a key on the keyboard. It can be used to break out of infinite loops.hexprThis routine, written in T
Appendix C - Fast graphic overlaysThe new fast graphics Overlay API consists of a single function: SN_CopyBmpToOverlayZero(...)This function can
gopen xsz yszThe purpose of gopen is to create the Handle to Device Context, and Handle to Bitmap of size xsz by ysz, that Windows needs to write gr
Graphicsgpen t w r g bThis is a simple wrapper function for the Windows CreatePen () function. It also sets a global default values for subsequent ca
gsetrop2 opThis is a simple wrapper function for the Windows SetROP2 () function.The op parameter controls how the bitmap is copied.Valid op values:
gbkmode modeThis is a simple wrapper function for the Windows SetBkMode () function.Valid values for mode:1=TRANSPARENT2=OPAQUEgsetbkcolor r g bThis
• Improved demo applications and preview window.• 64 bit DLL support (in addition to previously released 64 bit driver).• Decode UDP stream from netwo
gellipse xL yT xR yBThis is a simple wrapper function for the Windows Ellipse () function.Arguments:xL = Horizontal coordinate for the top left pixel
gfont f h [wi=0][p=0][we=0][i=0][u=0][s=0][es=0][or=0]This is a simple wrapper function for the Windows CreateFont () function. It also sets a global
gtext t xL yT xR yB [s=0]This is a simple wrapper function for the Windows DrawText () function. It also returns Width and Height values when DrawTe
Bitmapgloadimage fThis is a wrapper function for the Windows LoadImage () function. It loads the image into a second Bitmap/Device Context pair, g_hb
gstretchblt xDest yDest wDest hDest xSrc ySrc wSrc hSrc RopThis is a simple wrapper function for the Windows BitBlt () function. The source parameter
Commentaires sur ces manuels