Preface

This preface describes how to use this manual and how to reach us if you need technical support. This preface includes:
How To Use This Manual
Font Conventions
Related Documents
Technical Support Contacts

How To Use This Manual

The Video Development Environment Reference Guide describes and guides you through our developer tools, including our Xlib extension, Xt Widgets, XView objects and APIs, and Real-Time MovieTool API. Before you begin using this manual, make sure that your Parallax Graphics video card and software are already installed. If you ahve not yet installed thim, please see your Release Notes, Hardware Installation Guide, and Software Installation Guide for instructions. To get ideas for your own applications before you start development, we suggest reading your Multimedia User's Guide and trying out our video applications, VideoTool, MovieTool, and for Sun Solaris 2.5 users, Real-Time MovieTool. Also, before you start developing video, you should carefully read through the Release Notes to find out about bugs and recent software enhancements

Font Conventions



Italics Manual titles, new terms being defined
Typewriter Font
Commands typed in an X window, text that would appear in an X window

<Words> Indicates code and commands that are variable, conditional, or that present options (for example, <parallax base directory> or <filename>).

[words] Indicates optional code or commands that may be included or omitted (such as [-help] in a command line.)

Related Documents

Release Notes Skim before installation, then read in detail. These notes provide important information about recent changes and bugs.

Hardware Installation Guide Use for hardware installation

Software Installation Guide Use for software installation and de-installation

Multimedia User's GuideLearn how to use the application software, VideoTool, MovieTool, and MovieCat. For developers this may serve as an introduction to what you can do with Parallax cards and the Video Development Environment. Also, look at the Appendix of X-Client UNIX Utility and Demo Programs (Appendix C). These sample programs show how to use some of the Parallax capabilities, and the source code for these programs is included with the Video Development Environment.

Technical Support Contacts

If you need any technical assistance as you use these applications, please contact Parallax Graphics Technical Support.

Parallax Graphics Technical Support
Herndon, Virginia, USA
email: tsupport@parallax.com
phone: +1 703 450 7718
fax: +1 703 450 7719
web: http://www.parallax.com/support/

Introduction

The Parallax Graphics Video Development Environment provides a comprehensive set of APIs and example programs with source code to support your development of software for Parallax XVideo, XVideo Xtra, PowerVideo, and MultiVideo cards on Sun Solaris and HP-UX. This chapter introduces you to those APIs and sample programs, and discusses additional software requirements and other issues you should know about before developing with the Video Development Environment. This chapter includes:

Additional Software Required
APIs for Development: Xlib, Xt, and Motif
Xlib Video Extension
X Toolkit: Xt Video Widgets
Sample Applications and Source Code
Sample Applications: VideoTool, MovieTool, etc.
Source-Code Example Programs
Upgrade and Cross-Platform Differences
Differences between Framebuffer and Overlay Cards
Differences in Recent Releases
Adding Support for Zoom_2X
Using Shared Memory
Using Multiple Video Cards
Xlib Enhancements
Xt Enhancements
MovieTool Movie File Structure Enhancements
Porting Issues and Cross-Platform Development
Making Upgrades and Ports Easier: imake
Porting from Video Framebuffer to Overlay Cards
Porting from Video Overlay to Framebuffer Cards
Supporting Audio for Sun and HP
Shared Libraries
Porting between Specific Platforms
Sun-Framebuffer-Only APIs

Additional Software Required

To use the Video Development Environment development software, you must have at least one X toolkit installed: Xlib (required in all cases), and possibly X Toolkit (Xt), Motif, and/or XView. You will also need an ANSI C compliant compiler.

X Toolkit Requirements

You will need the following X Toolkit/s:

Normally if you are developing on these platforms, you will already have the necessary toolkits pre-installed on your system by the manufacturer (Sun, HP, etc.). It is best to use the toolkits provided by the system manufacturer.

In case you need to get Xlib and/or Xt, first try to get it from your system manufacturer. As an alternative, see the note below on how to get these toolkits. If you are developing on HP-UX 10.x, you will need Xlib/Xt from X11R6 (or X11R5). If you are developing on Solaris 2.5 or earlier, or HP-UX 9.x or earlier, you will need Xlib/Xt from X11R5. (When we release support for Solaris 2.6, that will support X11R6.)

ANSI C Compliant Compiler

In addition to the toolkits, you will need an ANSI C compliant compiler. For the Sun platform, you can get an ANSI C compliant compiler from Sun (not free) or from the Free Software Foundation/GNU (free). On HP-UX 9.x, you can use the standard compiler with the option "-Aa". On HP-UX 10.x, you can get an ANSI C compliant compiler from HP (not free) or from the Free Software Foundation/GNU (free).

APIs for Development: Xlib, Xt, and Motif

The three main APIs for developing an application that uses Parallax Graphics video capabilities are our Xlib extension, Xt video widgets, and Motif convenience functions.

Xlib Video Extension

The Xlib extension is the best API for applications that you want to execute as fast as possible (for instance, video input/output and compression/decompression). If you are capturing (compressing) and playing back (decompressing) video in real-time, you should use Xlib to capture and play back as many frames/second of video as possible. You can also use Xlib to build your own custom video widgets.

The Parallax extension to Xlib allows full access to standard Parallax hardware video inputs/outputs and JPEG compression/decompression:

See Chapter 2 for full details.

X Toolkit: Xt Video Widgets

The Xt video widgets are higher-level than the Xlib extension, and can help you write code faster and more easily. The Xt video widgets are good for event-handling, buttons, window-creation, and other situations that would require lengthy segments of code in Xlib.

Parallax Graphics has developed four Xt video widgets: VideoIn, VideoOut, JPEG, and TCWindow. Each widget has a full set of resources. These widgets exercise standard Parallax Graphics hardware features to provide video operations, such as:

See Chapter 3 for full details.

Motif Convenience Functions

The Motif convenience functions are provided to make it easier to write an application that provides user selection of live video or video output. This functionality is general, and without the Motif functions it could require large amounts of development time and application code. Also, users of Parallax Graphics video boards will benefit if this sort of user interface component looks the same (or at least similar) on all of our supported platforms and in all applications.

Parallax Graphics has developed two convenience functions to create cascading menus for selection of video input and video output: PlxCreateInputCascade() and PlxCreateOutputCascade(). Other supporting functions are also provided.

See Chapter 4 for full details.

Sample Applications and Source Code

Parallax Graphics includes source code for all of our released applications (VideoTool, MovieTool, etc.), as well as sample programs showing basic functionality (tcomp, xlib_test, etc.).

Sample Applications: VideoTool, MovieTool, etc.

Parallax Graphics' applications VideoTool, MovieTool, and for users of some platforms, MovieCat and RTMovieTool, provide examples of the capabilities that can be supported by the Parallax Graphics Video Development Environment and the Parallax video server and driver software. Before you start developing your own video application, you may want to look at these applications to get ideas for building your own applications.

These applications are fully tested and released.

The source files for the application programs are located in $PARALLAX_HOME/src in the following sub-directories:

Source-Code Example Programs

To demonstrate how to use the Xlib extension, Xt video widgets, and Motif convenience functions, we provide simple source-code example programs that can be run from the UNIX command line.

These sample programs are not as carefully built as the application programs, but do provide useful brief examples of how to use the Parallax development tools and hardware capabilities.

To use the sample programs:

Upgrade and Cross-Platform Differences

There are some basic differences between older and newer software releases and between Parallax video framebuffer cards and video overlay cards that you need to know about for cross-platform development and for porting to new releases or new platforms.

Recent releases of Parallax Graphics software include new capabilities (imake support, multi-card support), new development gadgets (more Xlib functions, Xt video resources, and sample programs), and other changes. This section discusses the differences and how to use some of the features. Here is a summary of differences between framebuffer and overlay and between different software releases:

Differences between Framebuffer and Overlay Cards

There are some general differences between our video framebuffer cards and video overlay cards that you should be aware of.

Overlay Cards Have:

Parallax Graphics video overlay cards have features that are not available on our video framebuffer cards:

Framebuffer Cards Have:

Parallax Graphics Sun video framebuffer cards have some functions that are not available for our video overlay cards:

Differences in Recent Releases

We have added significant capabilities in recent software releases, such as:

XView Objects and MovieTool API: Phasing Out

Because the use of XView for new development has declined rapidly in recent years, and because XView is Solaris-only and does not support cross-platform developers, Parallax Graphics is planning to remove XView support from the next release of our Video Development Environment software. If you are updating or building an application that you will port to new releases as they come out, you should avoid using the following:

Adding Support for Zoom_2X

Overlay cards only: Video overlay cards have a feature called Zoom_2X that uses hardware pixel replication to enlarge the video display to two times the vertical/horizontal size and four times the area of regular full size video. Zoom is not available for framebuffers.

Using the Zoom_2X capability requires some changes to how you use some of the Xt Widgets' X resources and Xlib extension functions. The differences are described in each resource and function description:

Zoom related functions:

XPlxGetZoomFactor()
XPlxSetZoomFactor()

Zoom and video input:

XPlxQueryVideo()
VideoIn widget: XtNdisplayRect
VideoIn widget: XtNsourceRect

Zoom and video output:

XPlxVideoScaleOutput()
VideoOut widget: XtNdestRect
VideoOut widget: XtNsourceRect

Zoom and JPEG compression/decompression:

XPlxGetCImage()
XPlxPutCImage()
XPlxShmGetCImage()
XPlxShmPutCImage()
JPEG widget: XtNcompressDestRect
JPEG widget: XtNcompressSourceRect
JPEG widget: XtNdisplayDestRect
JPEG widget: XtNdisplaySourceRect

Zoom and uncompressed images:

XPlxGetImage()
XPlxPutImage()

Using Shared Memory

Sun or HP version 9.3 or later only: Shared memory for JPEG compression and decompression is now supported on:

To add shared memory to your own application, first look at the utility/demo programs fcomp and scomp, and use them as guides. The source files for fcomp and scomp are located in $PARALLAX_HOME/src/motif/[file_comp/fcomp.c or slider_continuous_comp/scomp.c].

Shared Memory for Compression and Decompression

To use shared memory for JPEG compression and decompression operations, application programmers must make calls to Parallax versions of the MIT-SHM shared memory extension routines.

Parallax supports shared memory only for compressed video and images. For uncompressed shared memory operations, programmers must continue to use the existing XShm...() MIT-SHM shared memory extension routines.

The new Parallax shared memory routines follow the MIT-SHM calling conventions and semantics. If existing code calls MIT-SHM routines for JPEG shared memory operations, the code should now call the Parallax versions of those routines. The following is a list of all affected functions:

MIT-SHM Parallax Graphics
XShmDetach XPlxShmDetach
XShmAttach XPlxShmAttach
XShmGetEventBase XPlxShmGetEventBase
XShmQueryVersion XPlxShmQueryVersion
You should also look at the following X resources and Xlib functions.

Xlib Extension and Shared Memory

For an overview of using shared memory with the Xlib extension
For the individual functions:

Xt Video Widgets and Shared Memory

XtNuseSharedMemory is an X resource for the JPEG widget that indicates if the JPEG widget is currently using shared memory to store JPEG data If you are using XtNuseSharedMemory, you may need to modify how you use XtNjpegData. For details on how to use XtNjpegData with shared memory, see Chapter 3.

Using Shared Memory on HP

If you are writing your own application supporting HP with shared memory (Parallax software version 9.3 or higher for HP), and if there is a possibility that you may use software decompression of JPEG data, then you should search for and remove a string of garbage data (FFFFFFD0) in each JPEG frame before you write the frame.

This garbage data does not cause a problem unless you use software decoding. If you display JPEG and JFIF compressed video and images only with Parallax hardware decompression, you can ignore this garbage data. If you ever do software decoding such as displaying a still JFIF with third party applications that use software decompression, or converting JPEG movies to other digital movie formats, then you must remove the garbage data.

The four bytes of garbage data would be located in the digital movie or image file right after LOAD_JPEG. In Parallax software version 9.3 or higher for HP, MovieTool and VideoTool correctly remove this garbage data (scomp does not), so you can look at VideoTool and MovieTool as examples.

If you are using Parallax's Xlib extension:

You should write your application to remove the garbage data for JFIF and JPEG still images and for JPEG movie files. After using XPlxShmGetCImage(), you must add some code or example below) to remove the garbage data before writing a still image or movie file.

If you are using Parallax's Xt widget:

The Xt widget will automatically remove the garbage data before saving a JFIF still image.

You must write your application to remove the garbage data for JPEG still images and JPEG movie files. After using XtNGetNewImage(), you must add some code or see the example below) to remove the garbage data before writing a JPEG still image or movie file.

Here's an example showing how to remove the garbage data:

For more information, see (Xlib), (Xt), and Appendix C.

Using Multiple Video Cards

HP version 9.3 or 10.10 only: We have enhanced our API to allow one application to seamlessly use multiple Parallax Graphics video cards. Before this release, XPlxSelectHardwareInstance() could tell the application which video card (hardware instance) to use, but each application could use only one video card. Now, an application can use multiple video cards by tying a specific window to a specific video card using the function XPlxSelectWindowHardwareInstance(). XPlxVideoInputSelect() and XPlxVideoOutputSelect() also tie the window to a specific video card.

You can look at the applications VideoTool and MovieTool in HP version 9.3 or higher to see how to display and manipulate video through multiple video cards. Note that VideoTool and MovieTool software can select video from up to three video cards (up to six inputs if the cards are XVideo700's), BUT the VideoTool software is limited to displaying only two live video inputs at once, and MovieTool can display only one. For displaying more inputs at once, the work-around is to open multiple VideoTool sessions--displaying each video input in only one window to avoid conflicts. VideoTool and MovieTool can also select output to any XVideo card in the workstation, but can send only one output at a time. And keep in mind that workstations generally support one audio input channel and one audio output channel at a time.

XPlxVideoInputSelect()

XPlxVideoInputSelect() has been modified slightly to accommodate multiple Parallax Graphics video cards. The hardware instance should now be encoded into the upper

16 bits of the channel parameter. For example, to display video from the "Video
In Composite 2" wire on the second Parallax Graphics video card, use a command similar to this:

XPlxVideoOutputSelect()

The technique above is also used to specify which video card to use for video output using the XPlxVideoOutputSelect() call.

Xlib Enhancements

Sun Solaris 2.5 and HP version 9.3 or higher: Our XPlx X extension library now includes several new utility functions, which are described in Chapter 2:

Xt Enhancements

Sun Solaris 2.5 and HP version 9.3 or higher: We have added several enhancements to our Xt library: a new widget called TCWindow, and new resources called CustomDrawMethod and autoSearch for the XVideoIn and JPEG widgets.

TCWindow

The "TCWindow" widget (an abbreviation for "TrueColor Window"), is a convenience for programmers who wish to create TrueColor windows in their Xt or Motif applications. Creates a TrueColor window if possible, or if TrueColor is not available (for example with an 8-bit framebuffer), TCWindow will create a default visual window.

The new widget and resources are described in Chapter 3.

Motif Enhancements

Sun Solaris 2.5 and HP version 9.3 or higher: Our library now includes several new convenience functions for creating cascading menus to select video inputs and outputs. The functions are described in Chapter 4:

MovieTool Movie File Structure Enhancements

Sun Solaris 2.5 and HP version 9.3 and 10.10: We have updated the file structure for MovieTool movie files, what we used to call the JPEG Movie File Format/Specification. The new movie structure versions are JPEG_VERSION_3 and JPEG_VERSION_4.

The current version of MovieTool (Sun Solaris 2.5 and HP version 9.3 and 10.10) captures movies in JPEG_VERSION_2 and then converts them to JPEG_VERSION_3 if you use MovieTool to trim frames off the beginning or end of the movie. MovieTool does not implement JPEG_VERSION_4, so there is no example code for the JPEG_ VERSION_4 enhancements.

MovieTool uses the lowest common version of the movie file structure to ensure cross-platform compatibility with older versions of Parallax MovieTool and videotool, and for playback by Sun XView. XView plays back JPEG_VERSION_2 movie files.

The changes to the MovieTool movie file structure are indicated by the updated "movie.h" file with new operands, and by new attributes in the movie file header. Most of these changes (JPEG_VERSION_4) are not implemented in MovieTool at this point, so you will have to work without example code. The new capabilities include:

For details about the revised movie file header, new attributes, and operands, please read Appendix C.

Porting Issues and Cross-Platform Development

If you are porting (upgrade or cross-platform) and/or doing cross-platform development, you need to know about imake and some porting issues.

Making Upgrades and Ports Easier: imake

If you write applications for more than one platform (Sun Solaris 2.x, HP-UX, etc.), you should consider using imake to simplify the process of building your applications. With imake you can create just one Imakefile for all platforms instead of creating a separate Makefile fore every platform.

Not all platforms provide imake. If you do not have imake on your system, you can get the source and build it yourself. The source is available from ftp.x.org/pub/R5.

Parallax Graphics now ships an imake template file that makes writing an Imakefile for video applications easy. The template file is in the $PARALLAX_HOME/include directory, named "Parallax.tmpl". This template file should be copied into the config directory (usually in /usr/X11/lib/config).

The easiest way to write an Imakefile is to copy one from our source tree and modify it for your needs. Be sure to copy an Imakefile from an appropriate part of the tree. For example, if you are writing an Xlib application, start with $PARALLAX_HOME/src/xlib/example/Imakefile. If you are writing a motif application, start with $PARALLAX_HOME/src/motif/VideoTool/Imakefile.

For more information about setting up Imakefile support for specific Xt widgets, see Chapter 3 in this manual.

Porting from Video Framebuffer to Overlay Cards

Software for the Parallax Graphics video overlay cards is based on MIT's xv extension. There are a couple of things to watch out for when porting software for Parallax Graphics video framebuffer cards (Sun framebuffer XVideo, PowerVideo, MultiVideo) to Parallax Graphics video overlay cards (Sun XVideo Xtra, HP):

Multiple Video Operations in a Video Window: xv Ports

Sun overlay version 1.0 and HP version 9.2 or earlier: These releases allow only one video operation to occur in a window at one time (reliably). For example, you can either display live video in a window or send video output from a window.

On Sun overlay version 1.0 and HP version 9.2 overlay, you can get video in and video out to appear as if they are in the same window by using the root window for the output operation.

The reason for this problem is related to xv ports. xv ports are allocated for each window doing video operations. It is possible to get the same xv port attached to more than one window. This can cause erratic operation if an xv port is shared between live video and a decompression operation.

To avoid this problem, be sure to set up your live video first. In applications that display live video and perform compression and decompression, you should perform a XPlxVideoInputSelect() before any calls to XPlxPutTable().

Graphics Over Video

Graphics over video does not work the same on a Parallax Graphics video overlay card as it does on a Parallax Graphics framebuffer card.

It is possible to do graphics over video on video overlay cards. Unfortunately, we do not currently have an API that handles graphics over video on video overlay cards to speed up your work. If you want to use graphics over video for video overlay cards and you are using HP version 9.3 or higher or XVideo Xtra, look at the xvshow.c file as an example.

Adding Support for Zoom

Overlay cards offer hardware-enabled zoom. See here to find out where you need to set up zoom.

Porting from Video Overlay to Framebuffer Cards

If you are porting from video overlay cards (Sun XVideo Xtra, HP) to video framebuffer cards (Sun framebuffer XVideo, PowerVideo, MultiVideo), you should know that you will need to add tags. Tags are not required for overlay cards but are needed for framebuffer cards. For more information about tags, see Chapter 2 (Xlib extension), step 4 of the table, and look at on XPlxVideoTag() .

Software for Video Overlay Cards Runs on Framebuffers

Our software libraries for Sun video overlay cards work for both video overlay cards and video framebuffer cards. So if you develop some software using our libraries for Sun video overlay cards, the binary will also work on our Solaris 2.5 release for Sun video framebuffer cards. Also, you can run applications on a system with a video overlay card and display the application (with video) on a different system with a video framebuffer card. The main problem is graphics over video.

Supporting Audio for Sun and HP

If your application includes audio support, you will want to make sure that your makefile uses the correct audio include files and libraries for each platform you compile on. We have included audio in our imake support for your convenience. For an example showing audio include files and libraries for each platform, look at the Imakefile in $PARALLAX_HOME/src/motif/MovieTool. And if you have a cross-platform application, MovieTool is a good example of how to handle audio on multiple platforms.

Shared Libraries

Solaris 2.5 (framebuffer and overlay), HP version 9.3 or higher: These software releases have shared libraries which can be dynamically linked.

Solaris 2.4 or earlier (framebuffer), HP version 9.2: These releases did not contain shared libraries. If you are writing an application that you intend customers using these releases to use, you must link statically.

Porting between Specific Platforms

Before you get started, look at the Release Notes for all platforms you are porting between to find out about bugs, fixes, and enhancements. Also look at the chart summarizing some major differences between platforms and releases. Below are some tips for specific cross-platform porting issues.

Sun Overlay to/from HP Version 9.3 or Higher

These releases are nearly identical. The main differences you should be aware of are:

HP Version 9.2 to/from HP Version 9.3 or Higher

There are some important differences you need to be aware of:

If you develop an application on Parallax software version 9.3 or higher for HP, it will run on Parallax version 9.2 or earlier with the exception of shared memory and dynamic linking of libraries.

Uncompressed Images

In our HP 9.2 release, we overloaded the XGetImage() and XPutImage() functions to display an image into Parallax video memory if certain conditions were met. These conditions are as follows:

In our HP 9.3 release, we changed this to be a little easier to use. We now have new calls to get/put uncompressed images into Parallax video memory. The new calls are XPlxPutImage() and XPlxGetImage(). They have the same argument list as their non-video memory counterparts. The only condition to meet with the new scheme is #2.

Shared Memory

Our 9.2 release did not support shared memory. If you are writing an application that uses shared memory and you will be supporting customers having our 9.2 and 9.3 release, you should seriously consider providing non-shared memory support. scomp is a good example of how to detect if shared memory is available. If your application must use shared memory, all of your customers will need our 9.3 release.

Shared Libraries

Our 9.2 release did not contain shared libraries. If you are writing an application that you intend customers using our 9.2 release to use, you must link statically.

Multi-board Support

Our 9.2 release had limited multi-board support. Applications could get live video to work on either of 2 Parallax video boards installed in the system.

Our 9.3 release has enhanced multi-board support. We now support up to 3 Parallax video boards installed in the same system. One instance of an application can now use all functions of all installed video boards.

If your application requires multiple Parallax video boards and some of your customers are using 9.2, they must upgrade to our 9.3 release.

Multiple Video Operations in the Same Window

Our 9.2 release did not allow more than one video operation to occur at the same time in one window. For example, a 9.2 application cannot create a window, display live video in it, and then output the live video from the same window. To achieve this particular effect, the application would have to output from the root window the region bounded by the video window.

Other examples of multiple video operations in a window include:

If an application does try to do this, the live video or output will stop when the second video operation is done.

Our 9.3 release fixes this problem. You can now do as many different operations in one window as you like. Here are the conditions:

Sun-Framebuffer-Only APIs

The following APIs are available only for Sun framebuffer users.

Real-Time MovieTool for Solaris 2.5

For video framebuffer cards on Sun Solaris 2.5 only: The Real-Time MovieTool API will help you capture and play back movies to/from a local disk in near real-time at near-broadcast quality. For details, see Appendix D.

If you are using Solaris 2.5 and Parallax video framebuffer cards with compression, and if you want to make your application capture and play back frame-accurate movies to/from a local disk in real-time at near-broadcast quality (full motion, full size, 24-bit TrueColor), you should try the Real-Time MovieTool (RTMovieTool) API.

The RTMovieTool API is currently available only on the Sun platform, for Solaris 2.5 and video framebuffer card users (not XVideo Xtra). RTMovieTool requires hardware compression (XVideo-SVC-VIO or PowerVideo) and a SPARCstation 5, 10, or 20 with at least 32 Megabytes of ram.

To see RTMovieTool at work, read your Multimedia User's Guide's Chapter 5 and test drive RTMovieTool.

To bring these capabilities into your own application, read Appendix D: Real-Time MovieTool JPEG Movie API and File Structure (Sun Solaris 2.5 Only) in this manual. Appendix D includes code examples and a documented program, troubleshooting, a complete reference section, a description of the RTMovieTool file format, and sample programs to extract information from RTMovieTool movie files.

XView Toolkit: XView Video Objects and MovieTool API

For video framebuffer cards on Sun only: Do not use these tools for cross-platform development. We also recommend not using these tools if you plan to port your applications to new releases, because we do not plan to support XView in future releases.

Developers using the XView Toolkit from Sun can use two XView video objects (with a full set of object attributes): VIDEO_IN and VIDEO_OUT. See Appendix E for details.

If you are using XView, you can also use the MovieTool JPEG Movie API for creating movie-file authoring applications. The API provides a library of functions for recording JPEG-compressed movies in the MovieTool movie-file format and for playing these movies back in near real-time with hardware compression and decompression. See Appendix E for details.