Dtavhal Programmers Interface Table of Contents
Total Page:16
File Type:pdf, Size:1020Kb
DTAvHAL Programmers Interface Revision 0.1 Copyright (c) 2004-2012 Drastic Technologies Ltd. All Rights Reserved www.drastic.tv Table of Contents DTAvHAL Programmers Interface......................................................................................1 Introduction.....................................................................................................................3 Direct Link Usage...........................................................................................................3 Windows 32 OS – using 32 bit..............................................................................3 Windows 64 – using 32 bit....................................................................................3 Windows 64 – using 64 bit....................................................................................3 Mac OS-X..............................................................................................................3 Linux 64.................................................................................................................3 Functions.........................................................................................................................5 avOpen...................................................................................................................5 avClose..................................................................................................................5 avChannels.............................................................................................................5 avGetInfo...............................................................................................................6 avSetInfo................................................................................................................6 avSetSpeed.............................................................................................................7 avSetMode.............................................................................................................7 avStatus..................................................................................................................7 avFrame.................................................................................................................8 avGetMemAvail.....................................................................................................8 avGetRecFrame.....................................................................................................8 avPutRecFrame......................................................................................................9 avGetPlayFrame.....................................................................................................9 avPutPlayFrame...................................................................................................10 avFreeFrame........................................................................................................10 avBufsInRecQ......................................................................................................10 avBufsInPlayQ.....................................................................................................11 avSetXMLFile.....................................................................................................11 avNeedCodecInfoSet...........................................................................................11 stdcall avGetAVCodecInfo..................................................................................12 stdcall avSetAVCodecInfo...................................................................................12 stdcall avGetCurMs.............................................................................................12 Defines And Constants..................................................................................................13 Video Formats...............................................................................................................16 ARGB 32 (8 bits per component, vertical invert)...........................................16 RGB 30 (10 bits per component)....................................................................16 YCbCr 8 (8 bits per component 4:2:2)............................................................16 YCbCr 10 (10 bits per component 4:2:2)........................................................16 Audio Formats...............................................................................................................17 Examples.......................................................................................................................18 Direct Link Headers......................................................................................................19 avhal.h – Important structures, defines and enums..............................................19 PhysHeap.h – Important structures, defines and enums......................................21 MediaCmd.h – Important structures, defines and enums....................................24 MediaCMD Commands..................................................................................25 MediaCMD Flags............................................................................................30 MediaCMD Channels.....................................................................................35 MediaCMD Get/Set Values............................................................................37 MediaCMD Get/Set Flags.............................................................................138 MediaCMD File Types.................................................................................147 MediaCMD Audio Types..............................................................................148 MediaCMD Signal Formats..........................................................................150 MediaCMD Supported Formats....................................................................164 MediaCMD Supported File Types................................................................165 MediaCMD Structure....................................................................................177 VvwTypes.h – Important structures, defines and enums...................................181 Frame_Info Structure....................................................................................183 Dframe Structure...........................................................................................186 VVWSystem Structure..................................................................................192 VVWVideo Structure....................................................................................197 VVWAudio Structure...................................................................................202 VVWInfo Structure.......................................................................................206 Introduction AvHAL is Drastic Technologies Audio Video Hardware Abstraction Layer. AvHAL is used by all Drastic products for receiving and sending audio, video and metadata information to and from video cards, like AJA, BlueFish and BlackMagic or video cards like NVidia and AMD/ATI with ASIO/ CoreAudio/ DirectSound/ WaveIO/ SDK audio. AvHAL provides a single, uniform interface to all these I/O devices along with a standard setup and requests for capabilities. The DTAvHAL interface exports this, and some associated APIs for use in third party applications. The interface is available under Windows 32, Windows 64, Mac OS-X 32/64 and Debian and RedHat Linux 64. Direct Link Usage The direct link setup depends on the platform being used: The Windows DLLs, including AvHAL are kept under the 32 bit Program Files directory. Under 32 bit OS Windows 32 OS – using 32 bit “C:\Program Files\DrasticDDR” Windows 64 – using 32 bit “C:\Program Files (x86)\DrasticDDR” Windows 64 – using 64 bit “C:\Program Files\DrsaticDDR” Mac OS-X /Libraries/Frameworks/DrasticDDR.framework Linux 64 /usr/bin /usr/lib To use the direct link, you will need to include “avhal.h”, “dtsystemtypes.h”, “mediacmd.h”, “vvwtypes.h” and “physheap.h” in your source file. The application has to be linked to “avhal.lib”, “physheap.lib”, “vvwutil.lib” and “dtutil.lib” (for OS-X the lib would be dylib, for Linux the lib would be so). Basic API Workflow • Open the API with avOpen • Set up the video standard, frame type, bit depth and audio setup • Set the required mode: • ctRecord – capture frames from the input • ctPause – display frames immediately • ctPlay – display frames at a given play speed • If recording, request the frames from avGetRecFrame, use the data and release the frame with avPutRecFrame • If playing or pausing, get a DFrame buffer with avGetPlayFrame, fill it with data and return it for playback with avPutPlayFrame • Close the API with avClose Functions avOpen DCHANHANDLE __stdcall (DWORD dwVidChan, DWORD dwAudChan, DWORD dwFlags = 0, BITMAPINFO * pBmi = NULL, WAVEFORMATEX * pWfx = NULL, FRAME_INFO * pfiCur = NULL, HWND hParentWnd = 0); Open an audio video channel. • dwVidChan Bit array of requested video channels, use avChannels() for result of open • dwAudChan Bit array of requested audio channels, use avChannels() for result of open • dwFlags AVHAL_FLAG_ types to control open • pBmi Bitmap info describing requested video format, use avGetInfo() for result of open • pWfx Wave format describing requested audio format, use avGetInfo() for result of open • pfiCur Pointer to a shared frame info structure for