VAC SDK Software Reference Manual

Video Annotation Controller
Software Development Kit (SDK)
VAC2000, VAC104plus, VACPCI and eVAC2000
Document version: A.13
SOFTWARE
REFERENCE
MANUAL
Definitions
AMP and Advanced Micro Peripherals are the trading names for Advanced Micro Peripherals Inc. and Advanced Micro Peripherals Ltd.
Disclaimer
This document contains information on a new product. Specifications and information herein are subject to change without notice.
AMP reserves the right to make changes to any products herein to improve functioning and design. Although the information in this
document has been carefully reviewed and is believed to be reliable, AMP does not assume any liability arising out of the application
or use of any product or circuit described herein. Nothing in this document is to be taken as a license to operate under or a
recommendation to infringe any patents.
AMP does not recommend the use of any of its products in life support applications wherein a failure or malfunction of the product
may directly threaten life or injury. The user of AMP products in life support applications assumes all risk of such use and indemnifies
AMP against all damages. All information contained in this document is proprietary to AMP and may not be reproduced or disclosed
to any third parties without the written consent of AMP.
The information contained in this document has been carefully checked and is believed to be reliable. However, Advanced Micro
Peripherals Ltd (AMP) makes no guarantee or warranty concerning the accuracy of said information and shall not be responsible for
any loss or damage of whatever nature resulting from the use of, or reliance upon, it. AMP does not guarantee that the use of any
information herein will not infringe upon the patent, trademark, copyright, or other rights of third parties, and no patent or other
license is implied hereby
AMP reserves the right to make changes in the products or specifications, or both, presented in this document at any time and
without notice.
Trademarks
Tiny486, Tiny486, Tiny586DX, Tiny786LP, Mobile786EBX, Tiny886, TinyLX, VAC104, VAC104plus, The Embedded Video Experts
are trademarks of Advanced Micro Peripherals.
All other trademarks recognized.
Revision History
Document
Release
A.00
A.01
A.02
A.03
A.04
Date
Description
08/12/04
10/02/05
15/06/05
05/03/08
22/05/08
A.05
16/04/09
A.06
A.07
A.08
27/04/09
13/05/09
25/08/09
A.09
04/02/10
A.10
31/03/10
Initial release
Clarification of compiler flags and examples
Indication of root privilege requirement
Added VACPCI
Added GetVacCapFrame, GetVacCapPixel, StopCapture and
StartCapture.
Added VGAOutput, FpOutput, SetFrontWindow, SetSignalCallback,
SetStandardCallback
Added VAC2000 and format changes.
Added more screen shots and minor formatting changes
Added mirror, contrast, hue, saturation and brightness functions and
dual-headed configuration details.
Removed two un-supported functions (SetSignalCallback,
SetStandardCallback).
Added details of BOB & WEAVE de-interlacing modes
A.11
25/11/11
Added standard settings for eVAC2000
SC
A.12
10/02/12
SC
A.13
23/03/12
SelectVideoInput updated for eVAC
SelectMuxInput added
Description of S-Video passthrough added to SelectMuxInput
Advanced Micro Peripherals
operates a company-wide
quality management system,
which has been certified by
QMS International plc as
compliant with ISO9001:2000
Approved
JS/GM
JS/GM
SC
GM
SC / GM
SC
VAC SDK Software Reference Manual
Contents
1:
Introduction ............................................................................................. 4
Related Documentation ................................................................................................................................... 4
2:
Software architecture .............................................................................. 5
3:
Application development ......................................................................... 9
Include files ...................................................................................................................................................... 9
Initialization of VAC video hardware............................................................................................................... 10
Displaying video .............................................................................................................................................. 11
Alpha blending ............................................................................................................................................... 13
Capture of video to memory........................................................................................................................... 15
De-initialization of hardware........................................................................................................................... 15
The VAC Linux library .................................................................................................................................... 16
Running applications...................................................................................................................................... 16
Demonstration SDK ....................................................................................................................................... 17
4:
Structure Reference ............................................................................... 18
IVPSTRUCT and OVPSTRUCT..................................................................................................................... 18
5:
Function Reference ................................................................................ 19
General functions ........................................................................................................................................... 19
Capture and Overlay functions ...................................................................................................................... 23
Alpha blending functions ................................................................................................................................ 41
6:
Function Index ....................................................................................... 50
7:
Subject Index ......................................................................................... 51
A:
Application code examples .................................................................... 52
xtext-simple.................................................................................................................................................... 53
xtest-dualalphawin ......................................................................................................................................... 53
xtest-capture .................................................................................................................................................. 53
sdltest-alphasurf ............................................................................................................................................ 54
dualwindow-sdl .............................................................................................................................................. 54
offscreenalphatext-sdl .................................................................................................................................... 54
reticuleradar-sdl ............................................................................................................................................. 55
dualfullscreen-sdl ........................................................................................................................................... 55
B:
Contacting AMP ...................................................................................... 56
© 2012 Advanced Micro Peripherals
Document version A.13
3
1:
Introduction
Welcome to the VAC2000, VAC104plus, VACPCI and eVAC2000 programmer’s
reference for Linux/X11.
This manual is organized by category, with a function index and a separate
subject index at the back.
Related Documentation
Other Documentation that may be of use whilst reading this document are
described in the table below:
▪
XF86Config manual pages
▪
XLib manual pages
▪
SDL online documentation
▪
VAC2000 Hardware Reference Manual
▪
VAC104plus Hardware Reference Manual
▪
VACPCI Hardware Reference Manual
▪
eVAC2000 Hardware Reference Manual
© 2012 Advanced Micro Peripherals
Document version A.13
4
2:
Software
architecture
The VAC2000, VAC104plus, VACPCI and eVAC2000 can be used in
conjunction with the XFree86 or XOrg drivers provided to act as a
display device. The driver also provides functionality for accessing
video surfaces via the Xvideo extension, so that the inputs can be
viewed on applications such as xawtv.
This library aims to harness the X video driver by combining a front-end
to the Xvideo functions with more advanced features such as alpha
blending. This can then be integrated with the Xlib graphical functions
or a higher-level library such as SDL to draw graphics on top of the
video. As such, no drawing functions are provided by this SDK.
The X server is responsible for managing the output of the VAC2000,
VAC104plus, VACPCI and eVAC2000, so it must be configured
separately. Modules are provided for XFree86 4.3.0 (as used on Red
Hat 9), XOrg 6.7 (as used on Fedora Core 2), XOrg 7.1.1 (as used on
CentOS 5) and XOrg 7.3 (as used on Ubuntu 8.04). The driver file
(tvia_drv.o or tvia_drv.so) should be placed in the X server’s driver
directory. For older servers, this is normally found in
/usr/X11R6/lib/modules/drivers. Newer X servers use
/usr/lib/xorg/modules/drivers.
© 2012 Advanced Micro Peripherals
Document version A.13
5
2
2:
Software architecture
VAC SDK Software Reference Manual
The server configuration file needs to be set up in the /etc/X111
directory, following the standards documented in the X11 manpages.
This is named XF86Config for XFree86 or xorg.conf for XOrg. The
area specific to the Tvia is the Device section, which should be set up
as follows. The example below shows a basic setup:
Section "Device"
Identifier "VAC104"
Driver
"tvia"
EndSection
Further parameters are required for TV output. The following example
will output NTSC at a resolution of 640x480 on the VAC104, VAC2000
and VACPCI:
Section "Device"
Identifier "VAC104"
Driver
"tvia"
Option
"cyberpro_tv_on" "ntsc_640x480"
EndSection
The full list of TV modes is as follows:
Resolution
NTSC definition
PAL definition
640x400
ntsc_640x400
pal_640x400
640x440
ntsc_640x440
pal_640x440
640x480
ntsc_640x480
pal_640x480
720x480
ntsc_720x480
pal_720x480
720x540
Not supported
pal_720x540
720x576
Not supported
pal_720x576
768x576
Not supported
pal_768x576
800x600
Not supported
pal_800x600
It should be noted that regardless of the desired resolution, the mode
should be set to 640x480. If a mode with higher resolution is present in
the Screen section, this will be chosen in preference. Therefore, it is
1
Some Linux distributions have been known to store the XF86Config file in /etc
instead of /etc/X11.
© 2012 Advanced Micro Peripherals
Document version A.13
6
2
2:
Software architecture
VAC SDK Software Reference Manual
advisable to omit all other modes from this section if TV output is
desired.
The eVAC2000 uses a completely different method for setting the TV
output; the video is scaled from whatever input mode is selected to the
required standard. The default is NTSC but it can be overridden using
the following line:
Option "eVAC_PAL"
"True"
Another parameter that may be required when using both inputs at high
resolution is MemClock. If the picture starts to break up, it is possible
that the system is running into bandwidth problems, in which case it
should be increased. The default value for the VAC hardware is 75MHz.
The following line will set it to 86MHz:
Option "MemClock"
"86MHz"
It should be noted that it is also possible that running the memory at too
high a speed will also result in distortion.
If using multiple VACs in a system, the PCI ID of each card will need to
be specified using the BusID parameter, which is similar (but not
identical) to the format displayed by the lspci command. In order for the
SDK to identify the correct card for the current display, it is essential that
the cards are listed in order of PCI ID. Each device requires its own
Screen entry, which will then be referenced by the ServerLayout
section to handle positioning. The following example handles two cards
on the primary bus at locations 8 and 9.
Section "ServerLayout"
Identifier
"Default Layout"
Screen
0 "Screen0" 0 0
Screen
1 "Screen1" RightOf "Screen0"
InputDevice
"Mouse0" "CorePointer"
InputDevice
"Keyboard0" "CoreKeyboard"
EndSection
Section "Device"
Identifier "VAC0"
Driver
"tvia"
Option
"BusID" "PCI:0:8:0"
EndSection
Section "Device"
Identifier "VAC1"
Driver
"tvia"
Option
"BusID" "PCI:0:9:0"
EndSection
© 2012 Advanced Micro Peripherals
Document version A.13
7
2
2:
Software architecture
VAC SDK Software Reference Manual
Section "Screen"
Identifier "Screen0"
Device
"VAC0"
Monitor
"Monitor0"
DefaultDepth
16
SubSection "Display"
Depth
24
Modes
"640x480"
EndSubSection
SubSection "Display"
Depth
16
Modes
"640x480"
EndSubSection
EndSection
Section "Screen"
Identifier "Screen1"
Device
"VAC1"
Monitor
"Monitor0"
DefaultDepth
16
SubSection "Display"
Depth
24
Modes
"640x480"
EndSubSection
SubSection "Display"
Depth
16
Modes
"640x480"
EndSubSection
EndSection
No other options should be required for normal use.
© 2012 Advanced Micro Peripherals
Document version A.13
8
3:
Application
development
Writing an application to display captured video can be done relatively easily
using the functions provided. Graphics can be drawn on top of the video, using
either the standard X11 drawing functions or a graphics library such as SDL.
Include files
The vacapi.h header file must be included in all VAC hardware video display and
alpha blending applications. In addition, the X11/Xatom.h file will be required,
unless it is already referenced by the graphics library being used. The
X11/Xlib.h file is referenced by vacapi.h, so there is normally no need to use it
directly. However, it may be required if the application is to be tested
independently from the API.
To use the header files, the following lines should be present in the source code:
#include <vacapi.h>
© 2012 Advanced Micro Peripherals
Document version A.13
9
3
3:
Application development
VAC SDK Software Reference Manual
#include <X11/Xatom.h>
In addition, the following parameter should be added to the make command,
where /path/to/sdk is the absolute path to the directory containing vacapi.h:
–I/path/to/sdk
Further #include statements will be required for any graphics libraries being
used. Please consult the relevant documentation for information regarding these.
Initialization of VAC video hardware
Most of the hardware initialization will already have been performed by the
XFree86 driver. The InitVAC procedure performs further initialization so that the
hardware is ready for use and that the library is aware of the context in which it is
being used.
The InitVAC procedure takes two arguments. The first of these specifies the
target X window in which the program will operate. This can either be created via
the XCreateSimpleWindow function or obtained using a window handle
generated by a library such as SDL. Alternatively, it is possible to draw on the
root window of the screen by using the handle returned by the
RootWindowOfScreen function, which is one way of providing a full-screen
display. If using the root window, the application cannot be run under GNOME or
KDE.
The second argument is the display on which the window is shown. Normally,
this can be obtained using the XOpenDisplay function, but graphics libraries
such as SDL can have their own methods, which should be used in preference.
The following example uses standard X functions to create a 640x480 window:
Display
Screen
Window
*disp;
*scrn;
win;
disp= XOpenDisplay(NULL);
scrn= DefaultScreenOfDisplay(disp);
win = XCreateSimpleWindow(disp,RootWindowOfScreen(scrn),
0,0,640,480,1,
© 2012 Advanced Micro Peripherals
Document version A.13
10
3
3:
Application development
VAC SDK Software Reference Manual
BlackPixelOfScreen(scrn),
BlackPixelOfScreen(scrn));
InitVAC(win, disp);
Example using SDL to occupy the full screen at 800x600:
SDL_Surface *screen;
SDL_SysWMinfo sdlinf;
Uint32 video_flags;
video_flags = SDL_FULLSCREEN | SDL_DOUBLEBUF;
screen = SDL_SetVideoMode(800, 600, 16, video_flags);
SDL_VERSION(&sdlinf.version);
SDL_GetWMInfo(&sdlinf);
InitVAC(sdlinf.info.x11.window, sdlinf.info.x11.display);
Displaying video
Video can be displayed using the PutVideo function, which maps one of the
video inputs to an area on the screen.
A color key can be used to ensure that any text or graphics drawn will be on top
of the video. However, when alpha blending between graphics and video is
enabled, all graphics will be translucent on top of the video. In this situation,
color keying should be disabled. If two video sources are to be blended together,
keying can be used, but it is essential that both inputs use the same key color.
Please note that a driver bug means that in some cases, the accelerator needs to
be disabled to prevent the mouse cursor from corrupting the screen. In this case,
color keying will not work and alpha blending must be used instead.
Before plotting the video, the standard needs to be selected. To do this,
SetInputNormal should be called for the required channel. This will select
NTSC or PAL and set the default size for the video input (720x288 for PAL and
720x240 for NTSC). To select a different size (ie. to select just a section of the
video input), SetInputViewPortWindow should be called between
SetInputNormal and SetInputNormal.
PutVideo will automatically draw a rectangle using the key color, so there is
normally no need to color the area beforehand. This also means that any
© 2012 Advanced Micro Peripherals
Document version A.13
11
3
3:
Application development
VAC SDK Software Reference Manual
graphics will need to be drawn after the video has been displayed. However,
libraries such as SDL will be oblivious to this and are likely to overwrite the area
with their own graphics. In such a situation, a corresponding rectangle will need
to be drawn with the key color using the library’s own functions.
Placing an image containing the key color on top of the overlay surface will result
in the video showing through areas using that color, giving the effect of
transparency. It is also possible to create images with a mask, so that when
plotted, an area of the image will be transparent, leaving the original area
unchanged. This will accomplish the same effect, with the added advantage of
being able to draw images on top of each other.
Some graphics formats (such as PNG) have an alpha channel, which gives the
image a degree of translucency. This can be used in the same way as a mask by
defining areas of full opacity and full transparency. However, any intermediate
values will have the effect of tinting the image with the background color, which is
likely to be an undesirable effect when drawing over the video surface. For
example, an image with translucency round the edges blended with a magenta
color key will end up surrounded by a purple outline. Therefore, use of such
values for an alpha channel should be avoided.
After calling PutVideo, SelectVideoInput must be called to determine which of
the decoder’s inputs to use.
The following example will give a Picture in Picture display with a magenta color
key:
OVPSTRUCT layer1, layer2;
int width, height;
layer1.wHStart=0;
layer1.wVStart=0;
layer1.wWidth=width;
layer1.wHeight=height;
layer2.wHStart=width/2;
layer2.wVStart=height/2;
layer2.wWidth=width/4;
layer2.wHeight=width/4;
SetInputNormal(0, ID_PAL);
SetInputNormal(1, ID_PAL);
PutVideo(&layer1, 0, ID_COLKEY, 0xff00ff);
PutVideo(&layer2, 1, ID_COLKEY, 0xff00ff);
© 2012 Advanced Micro Peripherals
Document version A.13
12
3
3:
Application development
VAC SDK Software Reference Manual
SelectVideoInput(0, 0);
SelectVideoInput(1, 0);
The first channel will occupy the whole window, with the second channel taking
up a quarter-size area with its top-left corner in the middle of the first channel.
Alpha blending
Alpha blending can be implemented by placing up to four rectangular windows to
define transparency or on a pixel by pixel basis, using one of the overlay surfaces
as an alpha map.
Pixel alpha blending
Pixel alpha blending makes the selected pixel drawn onscreen translucent. Each
pixel’s alpha value is independent of its neighbors. The pixel map is defined by
writing a bitmap of eight-bit greyscale values to an overlay surface using
SysBlitAlpha . This can be equal to the size of the screen or smaller. To use
pixel alpha blending, set the blending mode to ID_ALPHA_PIXEL8 using
SetAlphaMode .
The following example draws a horizontal gradient to a surface of 800x600 pixels.
OVPSTRUCT alpha;
char alphasurf[800*600];
int x,y;
alpha.wHStart=0;
alpha.wVStart=0;
alpha.wWidth=800;
alpha.wHeight=600;
EnableAlphaBlending(ID_ENABLE_BLEND);
SetAlphaTargets(ID_ALPHA_GRAPHICS);
SetAlphaMode(ID_ALPHA_PIXEL8);
for(y=0;y<600;y++)
{
int x;
for(x=0;x<800;x++)
{
alphasurf[x+(800*y)]=x*256/800;
}
}
SysBlitAlpha(alphasurf, 0, 0, 800, 600, 800, 800, 3);
© 2012 Advanced Micro Peripherals
Document version A.13
13
3
3:
Application development
VAC SDK Software Reference Manual
When using both overlay surfaces (ie. when displaying both inputs), pixel alpha
blending cannot be used.
Window alpha blending
Window alpha blending makes the area behind the selected rectangular window
translucent. A maximum of four alpha windows can be used, each with an
independent alpha value. To use window alpha blending, set the alpha blending
mode to ID_ALPHA_SCREEN using SetAlphaMode .
Window alpha blending allows the video windows to be blended either with
graphics or with each other. Use SetAlphaTargets to select the mode for this.
ID_ALPHA_GRAPHICS will blend both video channels against the graphics. It is
not possible to blend the video channels against each other and the graphics
simultaneously.
The alpha value can be set using SetAlphaValue . This can be any value from 0
(fully transparent) to 255 (fully opaque). To set the size and position of the alpha
window, use SetAlphaWindow. If any alpha windows overlap, the window with
the highest number takes precedence.
The following example sets the alpha of the left half of an 800x600 screen to 128
by drawing a 400x600 window. This means that the graphics will be blended
50:50 with the video in this area.
OVPSTRUCT alpha;
alpha.wHStart=0;
alpha.wVStart=0;
alpha.wWidth=400;
alpha.wHeight=600;
EnableAlphaBlending(ID_ENABLE_BLEND);
SetAlphaTargets(ID_ALPHA_GRAPHICS);
SetAlphaMode(ID_ALPHA_SCREEN);
SetAlphaWindow(alpha, 0);
SetAlphaValue(0x80, 0);
© 2012 Advanced Micro Peripherals
Document version A.13
14
3
3:
Application development
VAC SDK Software Reference Manual
Capture of video to memory
The VAC2000, VAC104plus, VACPCI and eVAC2000 are primarily display devices
rather than frame grabbers.
Two functions are available, however, for low performance capture of the
incoming video to memory.
These are GetVacCapFrame and GetVacCapPixel.
The following example allocates memory to hold the captured frame, pauses the
capture to prevent update of the video during to frame capture and then calls the
GetVacCapFrame to get the frame data.
unsigned char *bpFrameData=(unsigned char *)malloc(720*576*4);
unsigned long ulFrameSize=720*576*4;
int nHeight=0;
int nWidth=0;
StopCapture(0); //stop the capture
usleep(40000);
//wait for ~1frames worth of time
//Capture the frame as bottom up capture. Windows bitmaps (including BMP
files) are bottom up
//ulFrameSize gets updated with the amount of the buffer used
//nWidth and nHeight get updated to give the actual width and height
GetVacCapFrame(0,bpFrameData,&ulFrameSize,0x02,&nWidth,&nHeight);
StartCapture(0); //restart the capture
De-initialization of hardware
The DeInitVAC function should be called upon closing the application to
de-initialize the hardware. Before this, all video inputs should be stopped
and alpha blending disabled as required. Video sources should be
disabled using
© 2012 Advanced Micro Peripherals
Document version A.13
15
3
3:
Application development
VAC SDK Software Reference Manual
StopVideoStopVideo .This must be called for all active video surfaces. If
alpha blending has been used, it should be disabled by calling
EnableAlphaBlending with a parameter of ID_DISABLE_BLEND. The
following example code is used to terminate a program that uses alpha
blending and displays video from both inputs.
StopVideo(0);
StopVideo(1);
EnableAlphaBlending(ID_DISABLE_BLEND);
DeInitVAC();
The VAC Linux library
The library file is called libvac.a and can be found the VACSDK/lib directory. In
addition, the Xvideo library will be required, as will any libraries required for
graphics. For the latter, please consult the relevant documentation.
To use the Linux library, the following flags should be passed to the compiler
when linking, where /path/to/sdk represents the path of the directory containing
libvac.a:
-lvac –L/path/to/sdk -L /usr/X11R6/lib –lXv –lX11 -lXext
Running applications
The application will need to know the X server on which it is expected to run. If it
is being launched under X, this will be passed on automatically. If it is being run
from elsewhere (such as a remote terminal), the DISPLAY environment variable
must be set, using a command such as the following:
export DISPLAY=":0.0"
This example is intended for use with the Bourne Again SHell (bash). If using
another shell, please consult the relevant documentation.
The library accesses the hardware directly, using functions that require root
privileges. Therefore, any programs built against the library must be run by the
root user.
© 2012 Advanced Micro Peripherals
Document version A.13
16
3
3:
Application development
VAC SDK Software Reference Manual
Demonstration SDK
The demonstration version of the SDK library is fully featured. However, live
video overlay and alpha blending will not work after one hour of continuous use
of the library. The full version of the SDK does not have this limitation. All
function calls are identical between the demonstration and full version, so
applications developed with the demonstration version will work with the full
version after recompilation.
© 2012 Advanced Micro Peripherals
Document version A.13
17
4:
Structure
Reference
IVPSTRUCT and OVPSTRUCT
These are two proprietary data structures used by the functions listed in this
document. Both hold origin, width and height data.
typedef struct tagIvpOvpStruct // Input/Output view port
{
WORD
wHStart; // Horizontal start address
WORD
wVStart; // Vertical start address
WORD
wWidth; // Width in pixels
WORD
wHeight; // Height in pixels
} IVPSTRUCT, OVPSTRUCT;
Member
wHStart
wVStart
wWidth
wHeight
© 2012 Advanced Micro Peripherals
Document version A.13
Description
Specifies the top left X co-ordinate for the viewport
(horizontal start address) in pixels.
Specifies the top left Y co-ordinate for the viewport
(vertical start address) in pixels.
Specifies the viewport width in pixels.
Specifies the viewport height in pixels.
18
5:
Function
Reference
General functions
InitVAC
int InitVAC (win, dpy)
Window win;
Display * dpy;
The InitVAC function enables memory access to the VAC104plus and VACPCI and reads the
window and display information for the library to use.
Parameter
win
dpy
Description
Handle of X window to be used for graphics. This can be
created using the XCreateSimpleWindow procedure.
Alternatively, the window may be created automatically by a
graphics library such as SDL. To obtain the handle, SDL
provides SDL_GetWMInfo, which provides a data structure
with member info.x11.window.
Current X display. Can be determined using XOpenDisplay
or element info.x11.display from SDL as described above.
Returns
The return value is 1 if successful. Otherwise, it is 0.
Comments
© 2012 Advanced Micro Peripherals
Document version A.13
19
5
5:
Function Reference
VAC SDK Software Reference Manual
DeInitVAC
void DeInitVAC (void)
The DeInitVAC function de-assigns the resources allocated by the InitVAC procedure.
Returns
This function does not return a value.
Comments
© 2012 Advanced Micro Peripherals
Document version A.13
20
5
5:
Function Reference
VAC SDK Software Reference Manual
FpOutput
void FpOutput (nMode)
int nMode;
The FpOutput function enables and disables flat panel output.
Parameter
nMode
Description
Specifies whether to enable or disable the flat panel output.
This parameter can be one of the following values:
Value
Meaning
ID_FP_ENABLE (0x01)
Enables flat panel output using the
current video mode
ID_FP_DISABLE (0x00)
Disables flat panel output.
Returns
This function does not return a value.
Comments
© 2012 Advanced Micro Peripherals
Document version A.13
21
5
5:
Function Reference
VAC SDK Software Reference Manual
VGAOutput
void VGAOutput (nMode)
int nMode;
The VGAOutput function enables and disables VGA output.
Parameter
nMode
Description
Specifies whether to enable or disable the VGA output. This
parameter can be one of the following values:
Value
Meaning
ID_VGA_ENABLE
Enables VGA output using the
(0x01)
current video mode (default)
ID_VGA_DISABLE
Disables VGA output.
(0x00)
Returns
This function does not return a value.
Comments
If using the VAC104plus, VAC2000 or VACPCI with no VGA monitor connected, it is
recommended that the VGA output is disabled using this function.
© 2012 Advanced Micro Peripherals
Document version A.13
22
5
5:
Function Reference
VAC SDK Software Reference Manual
Capture and Overlay functions
SetInputNormal
void SetInputNormal (bDecoder, nNormal)
BYTE bDecoder;
int nNormal;
The SetInputNormal function sets the input video normal.
Parameter
bDecoder
nNormal
Description
Specifies which decoder to set
Specifies the video standard of the input video. This can have the
following values:
Value
Meaning
ID_PAL
PAL
ID_NTSC
NTSC
Returns
This function does not return a value.
Comments
This procedure must be called before PutVideo. It is not possible to use it afterwards without
calling PutVideo for a second time.
© 2012 Advanced Micro Peripherals
Document version A.13
23
5
5:
Function Reference
VAC SDK Software Reference Manual
SelectVideoInput
void SelectVideoInput(bDecoder, bInput)
BYTE bDecoder,
BYTE bInput,
The SelectVideoInput function selects the video input to the specified decoder. It can be
called during operation to change inputs in real-time. The definitions for the VAC2000,
VAC104plus, VACPCI and eVAC2000 are shown in the following tables:
Parameter
bDecoder
VAC2000 Description
Specifies which decoder to set
bInput
Specifies which input to use. The valid values of this parameter
depend on the value of bDecoder and are as follows:
Value
bDecoder
Input
0
0
AIN1
1
0
AIN2
2
0
SVIDEO A
0
1
BIN1
1
1
BIN2
2
1
SVIDEO B
Parameter
bDecoder
VAC104plus Description
Specifies which decoder to set
bInput
Specifies which input to use. The valid values of this parameter
depend on the value of bDecoder and are as follows
Value
bDecoder
Input
0
0
A1
1
0
A2
2
0
A3
3
0
A4
4
0
SVIDEO0
5
0
SVIDEO1
0
1
B1
1
1
B2
2
1
B3
3
1
SVIDEO2
© 2012 Advanced Micro Peripherals
Document version A.13
24
5
5:
Function Reference
VAC SDK Software Reference Manual
Parameter
bDecoder
VACPCI Description
Specifies which decoder to set
bInput
Specifies which input to use. The valid values of this parameter
depend on the value of bDecoder and are as follows:
Value
bDecoder
Input
0
0
VIN
1
0
SVIN (S-VIDEO0 I/P)
Parameter
bDecoder
eVAC2000 Description
Specifies which decoder to set
bInput
Specifies which input to use. Values of 2 and 3 for bDecoder
correspond to the VOut1 and VOut2 passthrough outputs
respectively. The valid values of this parameter depend on the
value of bDecoder and are as follows:
Value
bDecoder
Input
0
0
AIN1
1
0
AIN2
2
0
SVIDEO A
0
1
BIN1
1
1
BIN2
2
1
SVIDEO B
0
2
AIN1
1
2
AIN2
2
2
BIN1
3
2
BIN2
0
3
AIN1
1
3
AIN2
2
3
BIN1
3
3
BIN2
Returns
This function does not return a value.
Comments
This function must be called after calling PutVideo.
© 2012 Advanced Micro Peripherals
Document version A.13
25
5
5:
Function Reference
VAC SDK Software Reference Manual
SelectMuxInput
void SelectMuxInput(bDecoder, bInput)
BYTE bDecoder,
BYTE bInput,
The SelectMuxInput function selects the video input to the specified passthrough output on
the eVAC2000. It can be called during operation to change inputs in real-time. The definitions
for the eVAC2000 are shown in the following tables:
Parameter
bDecoder
Description
Specifies which multiplexer to set (0 for VOut1 and 1 for VOut2).
bInput
Specifies which input to use. The valid values of this parameter
are as follows:
Value
bDecoder
Input
0
0
AIN1
1
0
AIN2
2
0
BIN1
3
0
BIN2
0
1
AIN1
1
1
AIN2
2
1
BIN1
3
1
BIN2
Returns
This function does not return a value.
Comments
This function is available only on the eVAC2000.
This function can also be used to perform an S-Video passthrough, using the two outputs for the
luma and chroma components. This requires two calls to SelectMuxInput: one for the luma and
the other for the chroma. For example, if using input A, AIN1 should be routed to VOut1 and
AIN2 should be routed to VOut2.
© 2012 Advanced Micro Peripherals
Document version A.13
26
5
5:
Function Reference
VAC SDK Software Reference Manual
MirrorX
void MirrorX (bDecoder, nMode)
BYTE bDecoder;
int nMode;
/* Decoder number */
/* Mirror mode */
The MirrorX function enables or disables mirroring of the captured video in the X direction
Parameter
bDecoder
nMode
Description
Specifies which decoder to use.
Specifies whether to enable or disable the mirroring:
Value
Meaning
ID_DISABLE_MIRROR
Specifies that the capture should be
(0x00)
not mirrored
ID_ENABLE_MIRROR
Specifies that the capture should be
(0x01)
mirrored.
Returns
This function does not return a value.
Comments
© 2012 Advanced Micro Peripherals
Document version A.13
27
5
5:
Function Reference
VAC SDK Software Reference Manual
DeinterlaceMode
void DeinterlaceMode (bDecoder, nMode)
BYTE bDecoder;
int nMode;
The DeinterlaceMode function sets the method for handling the interlaced video input.
Parameter
bDecoder
nMode
Description
Specifies which decoder to set
Specifies the de-interlacing mode to use. This can have the
following values:
Value
Meaning
ID_WEAVEMODE
Fields will be merged together by
taking alternating lines to make a
single frame.
ID_BOBMODE
Fields will be doubled in height and
displayed at twice the frame rate.
Returns
This function does not return a value.
Comments
This procedure must be called before PutVideo. It is not possible to use it afterwards without
calling PutVideo for a second time.
If the video image contains a good deal of motion, it is recommended that BOBMODE is used –
this will significantly reduce the appearance of interlacing artifacts. WEAVEMODE is
recommended when better vertical resolution of the captured image is required (however,
motion will cause combing / serration artifacts).
© 2012 Advanced Micro Peripherals
Document version A.13
28
5
5:
Function Reference
VAC SDK Software Reference Manual
SetInputViewPortWindow
void SetInputViewPortWindow (bDecoder, lpIVPStruct)
BYTE bDecoder;
LPIVPSTRUCT lpIVPStruct;
The SetInputViewPortWindow function sets the values to be used for the input viewport by
PutVideo. This allows subsections of the video window to be displayed and stretched.
Parameter
bDecoder
lpIVPStruct
Description
Specifies which decoder window to set
Pointer to an IVPSTRUCT structure holding the required input
viewport top left X and Y co-ordinates, together with the width
and height.
Returns
This function does not return a value.
Comments
This function should be called before PutVideo. It is required if only a section the input video
is actually required. If the entire picture is to be used, this function is not necessary.
© 2012 Advanced Micro Peripherals
Document version A.13
29
5
5:
Function Reference
VAC SDK Software Reference Manual
PutVideo
int PutVideo(display, bDecoder, usekey, colkey)
LPOVPSTRUCT display,
BYTE bDecoder,
BOOL usekey,
int colkey;
The PutVideo function puts video from the input specified by bDecoder onto the screen in the
area specified by display, with the option of color keying.
Parameter
display
bDecoder
Description
Pointer to an OVPSTRUCT structure holding the required overlay
surface top left X and Y co-ordinates, together with the width and
height.
Specifies which decoder to use.
usekey
Specifies whether to use color keying:
Value
ID_NOCOLKEY
colkey
Meaning
Color keying disabled. Video will be
drawn on top of graphics.
Keying defined by color colkey.
ID_COLKEY
Color to use for keying. This will be a 24-bit value, of the form
0xRRGGBB, where RR, GG and BB are 8-bit values representing
the red, green and blue components respectively. The format
remains the same regardless of color depth.
Returns
The return value is 1 if successful. Otherwise, it is 0.
Comments
© 2012 Advanced Micro Peripherals
Document version A.13
30
5
5:
Function Reference
VAC SDK Software Reference Manual
StopVideo
void StopVideo (bDecoder)
BYTE bDecoder;
The StopVideo function will disable the video input specified by bDecoder and remove the
overlay surface.
Parameter
bDecoder
Description
Specifies which decoder to stop.
Returns
This function does not return a value.
Comments
© 2012 Advanced Micro Peripherals
Document version A.13
31
5
5:
Function Reference
VAC SDK Software Reference Manual
StopCapture
void StopCapture (bDecoder)
BYTE bDecoder;
The StopCapture function will disable the video capture specified by bDecode. The overlay is
still visible
Parameter
bDecoder
Description
Specifies which decoder to stop.
Returns
This function does not return a value.
Comments
© 2012 Advanced Micro Peripherals
Document version A.13
32
5
5:
Function Reference
VAC SDK Software Reference Manual
StartCapture
void StartCapture (bDecoder)
BYTE bDecoder;
The StartCapture function will resume the video capture specified by bDecode.
Parameter
bDecoder
Description
Specifies which decoder to resume.
Returns
This function does not return a value.
Comments
© 2012 Advanced Micro Peripherals
Document version A.13
33
5
5:
Function Reference
VAC SDK Software Reference Manual
SetContrast
void SetContrast (bDecoder, bContrast)
BYTE bDecoder;
BYTE bContrast;
/* Decoder number */
/* Contrast */
The SetContrast function sets the contrast for captured video.
Parameter
bDecoder
bContrast
Description
Specifies which decoder to set
Specifies the contrast to set. The value of this parameter must
be in the range of 0 to 127. The default value is 64
Returns
This function does not return a value.
Comments
A bConstrast value of 127 corresponds to 1.984
A bContrast value of 64 corresponds to 1.0 (ITU level).
© 2012 Advanced Micro Peripherals
Document version A.13
34
5
5:
Function Reference
VAC SDK Software Reference Manual
SetSaturation
void SetSaturation (bDecoder, bSat)
BYTE bDecoder;
BYTE bSat;
/* Decoder number */
/* Saturation */
The SetSaturation function sets the saturation for captured video.
Parameter
bDecoder
bSat
Description
Specifies which decoder to set
Specifies the saturation to set. The value of this parameter
must be in the range 0 to 128. The default value is 64
Returns
This function does not return a value.
Comments
A bSat value of 127 corresponds to 1.984
A bSat value of 64 corresponds to 1.0 (ITU level).
© 2012 Advanced Micro Peripherals
Document version A.13
35
5
5:
Function Reference
VAC SDK Software Reference Manual
SetBrightness
void SetBrightness (bDecoder, bBright)
BYTE bDecoder;
BYTE bBright;
/* Decoder number */
/* Brightness */
The SetBrightness function sets the brightness for captured video..
Parameter
bDecoder
bBright
Description
Specifies which decoder to set
Specifies the brightness to set. The value of this parameter
must be in the range 0 to 255. The default value is 128
Returns
This function does not return a value.
Comments
A bBright value of 0 corresponds to dark.
A bBright value of 128 corresponds to ITU level
A bBright value of 255 corresponds to bright.
© 2012 Advanced Micro Peripherals
Document version A.13
36
5
5:
Function Reference
VAC SDK Software Reference Manual
SetHue
void SetHue (bDecoder, bHue)
BYTE bDecoder;
BYTE bSat;
/* Decoder number */
/* Saturation */
The SetHue function sets the hue for captured video.
Parameter
bDecoder
bHue
Description
Specifies which decoder to set
Specifies the hue to set. The value of this parameter must be
in the range of -128 to 127. The default value is 0
Returns
This function does not return a value.
Comments
A bHue value of 0 corresponds to a hue shift of 0.
A bHue value of 127 corresponds to a hue shift of 178.6.
A bHue value of -128 corresponds to a hue shift of –180.
© 2012 Advanced Micro Peripherals
Document version A.13
37
5
5:
Function Reference
VAC SDK Software Reference Manual
GetVacCapFrame
int GetVacCapFrame(bDecoder, bpFrame, pulFrameSize, bFlags, *pnWidth, *pnHeight)
BYTE bDecoder,
unsigned char *bpFrame,
unsigned long *pulFrameSize
unsigned char bFlags
int *pnWidth
int *pnHeight
The GetVacCapFrame function copies the captured video from the specified decoder to the
memory given by bpFrame.
Parameter
bDecoder
bpFrame
pulFrameSize
bFlags
pnWidth
pnHeight
Description
Specifies which decoder’s video to capture
Buffer in which to save the frame data to
Pointer to an unsigned long that contains the size of the buffer
specified in bpFrame.
If the buffer is too small, this will be updated to contain the
required size and the function will return 0.
Upon successful capture, the value will be updated to be
actual size of the data.
Control values. This can be a logical combination of the
following
Bit
Meaning
0
Reserved
1
Mirror capture vertically
Pointer to an int that will be updated with the width, in pixels, of
the captured frame
Pointer to an int that will be updated with the height, in lines, of
the captured frame
Returns
The return value is 1 if successful. Otherwise, it is 0.
Comments
The pixel data will be in RGB32 format.
The captured frame will not include the annotation.
© 2012 Advanced Micro Peripherals
Document version A.13
38
5
5:
Function Reference
VAC SDK Software Reference Manual
GetVacCapPixel
int GetVacCapPixel(bDecoder, x, y)
BYTE bDecoder,
int x,
int y
The GetVacCapPixel function returns the pixel given by (x,y) within the captured video
Parameter
bDecoder
x
y
Description
Specifies which decoder’s video to capture
Horizontal location, in pixels, to capture
Vertical location, in lines, to capture
Returns
If successful, the return value is a RGB32 representation of the pixel at (x, y)
Otherwise it is 0xff000000.
Comments
© 2012 Advanced Micro Peripherals
Document version A.13
39
5
5:
Function Reference
VAC SDK Software Reference Manual
SetFrontWindow
void SetFrontWindow (bWindow)
BYTE bWindow;
The SetFrontWindow function sets the front window when both overlay windows are enabled
and overlap
Parameter
bWindow
Description
Specifies which overlay window should be on top. Valid values
are 0 and 1
Returns
This function does not return a value.
Comments
If the top window has color keying enabled and the bottom window does not, the color keying is
still obeyed by the top window. This has the effect that the contents of the bottom window will
show through the top window at points where the color key is not present.
© 2012 Advanced Micro Peripherals
Document version A.13
40
5
5:
Function Reference
VAC SDK Software Reference Manual
Alpha blending functions
EnableAlphaBlending
void EnableAlphaBlending (nMode)
int nMode;
The EnableAlphaBlending function enables and disables the alpha blending.
Parameter
nMode
Description
Specifies whether to enable or disable the alpha blending. This
parameter can be one of the following values:
Value
Meaning
ID_ENABLE_BLEND
Enable alpha blending
(0x01)
ID_DISABLE_BLEND
Disable alpha blending
(0x02)
ID_HIDE_BLEND (0x03)
Disable alpha blending without
destroying the surface.
ID_SHOW_BLEND (0x04)
Re-enable alpha blending
previously disabled with
ID_HIDE_BLEND.
Returns
This function does not return a value.
Comments
© 2012 Advanced Micro Peripherals
Document version A.13
41
5
5:
Function Reference
VAC SDK Software Reference Manual
SetAlphaTargets
void SetAlphaTargets (bMode)
BYTE bMode;
The SetAlphaTargets function selects the target for the alpha blending.
Parameter
bMode
Description
Specifies the target of the alpha blending. This parameter can
be one of the following values:
Value
Meaning
ID_ALPHA_GRAPHICS
Video is alpha blended with the
graphics in the visible display area
ID_ALPHA_VIDEO
Video window 0 is blended with
video window 1.
Returns
This function does not return a value.
Comments
© 2012 Advanced Micro Peripherals
Document version A.13
42
5
5:
Function Reference
VAC SDK Software Reference Manual
SetAlphaMode
void SetAlphaMode (nMode)
int nMode;
The SetAlphaMode function sets the mode for the alpha blending.
Parameter
nMode
Description
Specifies the mode for the alpha blending. This parameter can
be one of the following values:
Value
Meaning
ID_ALPHA_PIXEL8
Pixel alpha, 8 bit alpha
ID_ALPHA_SCREEN
Window alpha
Returns
This function does not return a value.
Comments
© 2012 Advanced Micro Peripherals
Document version A.13
43
5
5:
Function Reference
VAC SDK Software Reference Manual
SetAlphaWindow
void SetAlphaWindow (lpOVPStruct, bWindow)
LPOVPSTRUCT lpOVPStruct;
BYTE bWindow;
The SetAlphaWindow function sets the position and size of the specified alpha window.
Parameter
lpOVPStruct
bWindow
Description
Pointer to an OVPSTRUCT structure holding the required alpha
window top left X and Y co-ordinates, together with the width and
height.
Specifies which alpha window to set.
Returns
This function does not return a value.
Comments
© 2012 Advanced Micro Peripherals
Document version A.13
44
5
5:
Function Reference
VAC SDK Software Reference Manual
SetAlphaValue
void SetAlphaValue (bAlpha, bWindow)
bAlpha bAlpha;
BYTE bWindow;
The SetAlphaValue function sets the transparency value for one of the alpha windows.
Parameter
bAlpha
Description
bWindow
Specifies the alpha window for which the value should be set.
Specifies the alpha value. The value of this parameter can be between
0 and 255, where 0 is fully transparent and 255 is opaque.
Returns
This function does not return a value.
Comments
© 2012 Advanced Micro Peripherals
Document version A.13
45
5
5:
Function Reference
VAC SDK Software Reference Manual
AlphaSurface
int AlphaSurface (image, data)
LPOVPSTRUCT image;
char * data;
The AlphaSurface function copies an 8-bit greyscale bitmap to the second overlay surface and
uses it as a map for alpha blending. Because of its use of the surface, this function cannot be
combined with use of the second video channel. The bitmap is in the form of raw data starting
from the top left hand corner. The image structure contains the size of the image and its
position on screen.
Parameter
image
data
Description
Data structure specifying the co-ordinates of the top left pixel
and the image size.
An array of 8-bit greyscale pixels representing the alpha values,
where 0 is fully transparent and 255 is opaque.
Returns
The return value is 1 if successful. Otherwise, it is 0.
Comments
This function should not be called after SetInputNormal because of conflicts with overlay
surfaces.
This function is retained for backwards compatibility. Please use after SysBlitAlpha instead
© 2012 Advanced Micro Peripherals
Document version A.13
46
5
5:
Function Reference
VAC SDK Software Reference Manual
SysBlitAlpha
int SysBlitAlpha (src, x, y, dwWidth, dwHeight, dwSrcPitch, dwDestPitch, rop)
void* src;
DWORD x;
DWORD y;
DWORD dwWidth;
DWORD dwHeight;
DWORD dwSrcPitch;
DWORD dwDestPitch;
BYTE rop;
The SysBlitAlpha function copies an 8-bit greyscale bitmap to the alpha surface and uses it as
a map for alpha blending. Because of its use of the surface, this function cannot be combined
with use of the second video channel. The bitmap is in the form of raw data starting from the
top left hand corner.
Parameter
src
Description
An array of 8-bit greyscale pixels representing the alpha values,
where 0 is fully transparent and 255 is opaque.
x
x co-ordinate of the top left corner of the destination of the copy
y
y co-ordinate of the top left corner of the destination of the copy
dwWidth
width of the source bitmap in pixels
dwHeight
height of the source bitmap in pixel
dwSrcPitch pitch in bytes of the source bitmap. This is the number of bytes
between the first pixel in a line and the first pixel in the next line
down
dwDestPitch pitch in bytes of the destination bitmap. This should be equal to
the horizontal resolution, in pixels, of the display.
rop
specifies the raster operation to use to copy the alpha bitmap
Value
0
1
2
3
4
5
6
7
8
9
10
© 2012 Advanced Micro Peripherals
Document version A.13
Meaning
All zeros
source AND destination
source AND NOT destination
source
NOT source AND destination
destination
source XOR destination
source OR destination
NOT source AND NOT destination
source XOR NOT destination
NOT destination
47
5
5:
Function Reference
11
12
13
14
15
VAC SDK Software Reference Manual
source OR NOT destination
NOT source
NOT source OR destination
NOT source OR NOT destination
All ones
Returns
The return value is 1 if successful. Otherwise, it is 0.
Comments
This function should not be called after SetInputNormal because of conflicts with overlay
surfaces.
© 2012 Advanced Micro Peripherals
Document version A.13
48
5
5:
Function Reference
VAC SDK Software Reference Manual
ClearAlpha
void ClearAlpha (bAlpha)
BYTE bAlpha;
The ClearAlpha function sets every location of the per-pixel alpha map to the specified alpha
value
Parameter
bAlpha
Description
Specifies the alpha value to set the alpha map to where 0 is fully
transparent and 255 is opaque.
Returns
This function does not return a value.
Comments
© 2012 Advanced Micro Peripherals
Document version A.13
49
6:
Function Index
A
M
AlphaSurface ..................................................... 45
MirrorX ........................................................... 26
C
P
ClearAlpha ........................................................ 48
PutVideo .......................................................... 29
D
S
DeInitVAC ......................................................... 20
DeinterlaceMode............................................... 27
SelectVideoInput .............................................. 24
SetAlphaMode ................................................. 42
SetAlphaTargets .............................................. 41
SetAlphaValue ................................................. 44
SetAlphaWindow.............................................. 43
SetBrightness ................................................... 35
SetContrast ...................................................... 33
SetFrontWindow .............................................. 39
SetHue ............................................................. 36
SetInputNormal ................................................ 23
SetInputViewPortWindow ................................ 28
SetSaturation ................................................... 34
StartCapture ..................................................... 32
StopCapture ..................................................... 31
StopVideo ........................................................ 30
SysBlitAlpha ...................................................... 46
E
EnableAlphaBlending ....................................... 40
F
FpOutput ........................................................... 21
G
GetVacCapFrame ............................................. 37
GetVacCapPixel ............................................... 38
I
InitVAC .............................................................. 19
V
VGAOutput ....................................................... 22
© 2012 Advanced Micro Peripherals
Document version A.13
50
7:
Subject Index
A
O
alpha blending, 5, 11, 13, 15, 40, 41, 42, 45, 46
pixel, 13, 14, 42, 53
window, 14, 42, 52
overlay, 13, 29, 30, 45, 47, 52
surface, 12, 13, 14
OVPSTRUCT, 12, 13, 14, 18, 29, 43
B
S
bandwidth, 7
brightness, 35
saturation, 34
SDL, 5, 9, 10, 11, 12, 19, 53
C
T
colour key, 11, 12, 26, 29
contrast, 33
TV output, 6
I
IVPSTRUCT, 18, 28
© 2012 Advanced Micro Peripherals
Document version A.13
X
XFree86, 5
Xlib, 5
Xvideo, 5
library, 16
51
A:
Application code
examples
The SDK software includes the following examples (note, further examples may
be added in the future).
Each example demonstrates a different set of capabilities of the VAC hardware.
The input defaults to PAL, but this can be overridden using the -n parameter,
which sets the standard to NTSC. Alternatively, the programs can be rebuilt with
nStandard initialised to ID_NTSC.
To build the sample programs, change to the examples directory and run make.
Some of the example programs require the SDL_image, SDL_gfx and SDL_ttf
libraries.
SDL_image can be downloaded from http://www.libsdl.org/projects/SDL_image/
SDL_gfx can be downloaded from
http://www.ferzkopp.net/joomla/content/view/19/14/
SDL_ttf can be downloaded from http://www.libsdl.org/projects/SDL_ttf/
Alternatively, these may be available as packages for the Linux distribution being
used on the system. For example, the following command may be run on a
Ubuntu 8.04 system to install the libraries and headers:
apt-get install libsdl-image1.2-dev libsdl-gfx1.2-dev
libsdl-ttf2.0-dev
With minor changes, the same command should be compatible with any Debian
or Ubuntu system.
© 2012 Advanced Micro Peripherals
Document version A.13
52
A
A:
Application code examples
VAC SDK Software Reference Manual
xtext-simple
Example of graphics overlay on top of single video source
This example will draw a blue circle and a diagonal row of squares changing color
from green to red on top of a single video channel. It uses only the standard X11
functions, requiring no extra graphics libraries.
The program uses the root window, which means that the display will be fullscreen. It is designed to run with no window manager (or at most a simple one)
at whatever resolution the X server is using. Please note that this example will
not work with desktop environments that actively use the root window, such as
KDE.
Works with VAC2000, eVAC2000, VAC104plus & VACPCI.
xtest-dualalphawin
Example of window alpha blending with two video surfaces
This example will display a picture-in-picture layout, whereby the second channel
is displayed at a reduced size on top of the first video input. The two inputs have
been alpha blended together, using four windows to change the degree of
translucency in each quadrant of the second source. This particular example
does not use any graphics at all.
This program creates a new window, so it should be run with a window-manager
running.
Works with VAC2000, eVAC2000 and VAC104plus only.
xtest-capture
Example capture video frame to memory
This example will display the first video channel.
It uses the GetVacCapFrame function to capture a single frame from the input
video to memory and saves it to disk as a BMP file.
The program uses the root window, which means that the display will be fullscreen. It is designed to run with no window manager (or at most a simple one)
at whatever resolution the X server is using. Please note that this example will
not work with desktop environments that actively use the root window, such as
KDE.
© 2012 Advanced Micro Peripherals
Document version A.13
53
A
A:
Application code examples
VAC SDK Software Reference Manual
Works with VAC2000, eVAC2000, VAC104plus & VACPCI.
sdltest-alphasurf
Example using pixel alpha blending and SDL
The following example will display the first video channel, pixel-blended against
an image, specified by clean1.jpg. The blending is defined by an eight-bit
greyscale bitmap, alpha2.bmp.
The program uses SDL to provide the graphics routines and will draw the window
full-screen at 800x600, even when a window manager is being used. As such, it
will be clipped if the display does not support such a resolution (eg. if NTSC TV
output is being used). Alternatively, the application may simply fail to load.
Works with VAC2000, eVAC2000, VAC104plus & VACPCI
dualwindow-sdl
Example to display dual window with window based alpha blending and live text
update.
The program uses SDL to provide the graphics routines and will draw the window
full-screen at 800x600, even when a window manager is being used. As such, it
will be clipped if the display does not support such a resolution (eg. if NTSC TV
output is being used). Alternatively, the application may simply fail to load.
Works with VAC2000, eVAC2000 and VAC104plus only.
offscreenalphatext-sdl
Example displays the first channel full screen with per-pixel alpha blending of live
text updates.
This uses an off screen surface to draw the data too before displaying in the
screen and the alpha surface. The program uses SDL to provide the graphics
routines and will draw the
window full-screen at 800x600, even when a window manager is being used.
As such, it will be clipped if the display does not support such a resolution (eg. if
NTSC TV output is being used). Alternatively, the application may simply fail to
load.
© 2012 Advanced Micro Peripherals
Document version A.13
54
A
A:
Application code examples
VAC SDK Software Reference Manual
Works with VAC2000, eVAC2000, VAC104plus & VACPCI
reticuleradar-sdl
Example displays the first channel full screen with per-pixel alpha blending of a
basic mock object tracker and reticule.
The program uses SDL to provide the graphics routines and will draw the window
full-screen at 800x600, even when a window manager is being used. As such, it
will be clipped if the display does not support such a resolution (eg. if NTSC TV
output is being used). Alternatively, the application may simply fail to load.
Works with VAC2000, eVAC2000, VAC104plus & VACPCI
dualfullscreen-sdl
Example sets both channels to be full screen but defaults to displaying the first
channel.
The program uses SDL to provide the graphics routines and will draw the window
full-screen at 800x600, even when a window manager is being used. As such, it
will be clipped if the display does not support such a resolution (eg. if NTSC TV
output is being used). Alternatively, the application may simply fail to load.
Works with VAC2000, eVAC2000 and VAC104plus only.
© 2012 Advanced Micro Peripherals
Document version A.13
55
B:
Contacting AMP
Sales
AMP’s sales team is always available to assist you in choosing the board that best
meets your requirements. Contact your local sales office or hotline.
Sales office US
Advanced Micro Peripherals Inc.
Suite 424, 234 5th Ave
New York
NY, 10001
USA
Sales office UK
Advanced Micro Peripherals Ltd.
1 Harrier House, Sedgeway Business Park
Witchford, Cambridge,
CB6 2HY
United Kingdom
Tel: +1 212 951 7205
Fax: +1 212 951 7206
E-mail: [email protected]
Web:
www.amp-usa.com
Tel: +44 (0)1353 659500
Fax: 01353 659600
E-mail: [email protected]
Web:
www.ampltd.com
Technical support
Comprehensive technical information is available on our websites (see above).
If you can’t find the information or solution you require, AMP has a team of
technical support engineers / embedded video experts available to provide a
quick and free response to your technical queries.
Please submit your technical support query to the appropriate email address:
Technical support US
E-mail: [email protected]
© 2012 Advanced Micro Peripherals
Document version A.13
Technical support UK
E-mail: [email protected]
56