/** @addtogroup  property 
    @{ */
/**
   @file rm84cmn.h 
   @brief comon definitions for EM84xx HwLib and user applications settings
   REALmagic Quasar Hardware Library
   @author Aurelia Popa-Radu
   Copyright Sigma Designs Inc
   Sigma Designs Proprietary and confidential
   @date 01/19/01
*/

#ifndef __RM84CMN_H__
#define __RM84CMN_H__

#ifdef __cplusplus
extern "C"{
#endif 

#ifndef KSPROPERTY_TYPE_GET
#define KSPROPERTY_TYPE_GET	0x00000001
#define KSPROPERTY_TYPE_SET	0x00000002
#endif

/**
	Hardware Library Property sets
*/
typedef enum {
	/** registry set common for all board versions*/
	REGISTRY_COMMON_SET = 1,
	/** registry set used for hdtv mode*/
	REGISTRY_HDTV_SET,	
	/** registry set used mostly for digital overlay */
	REGISTRY_VGAVENDOR_SET,	 
	
	/** property set for scan converter*/
	SCANCONVERTER_SET,	
	/** property set for eeprom*/
	EEPROM_SET,		
	/** property set for general properties of the board*/
	BOARDINFO_SET,		 
	/** property set for video properties of the board*/
	VIDEO_SET,		 
	/** property set for audio properties of the board*/
	AUDIO_SET,		
	/** property set for time properties of the board*/
	TIME_SET,
	/** property set for subpicture properties of the board*/
	SUBPICTURE_SET,
	/** property set for video decoder*/
	VIDEO_DECODER_SET,	 
	/** property set for mpeg encoder*/
	MPEG_ENCODER_SET,	 
	/** property set for DVI transmitter*/
	DVI_TRANSMITTER_SET,	 
	/** property set for Mpeg decoder*/
	DECODER_SET,		 
	/** property set for TV encoder*/
	TVENCODER_SET,
	/** property set for TvTuner encoder*/
	TVTUNER_SET,
	/** property set for OSD properties*/
	OSD_SET,
	/** property set for I2C properties*/
	I2C_SET,
	/** property set for VideoIn properties of the board (video capture)*/
	VIDEOIN_SET,
	/** hardware test properties of the board*/
	HARDWARE_TEST_SET,
	
	PROPERTY_MAX_SET
}PROPERTY_SETS;

/**
	Hardware Library Registry property set
	These values are set only at initialisation time.
*/
// REGISTRY_COMMON_SET uses RMuint32 = unsigned long = DWORD
typedef enum {
	eTvOut = 0,                 //? DEPRECATED
	
	/** @li 0 HwReset returns without resetting the hardware
	    @li 1 HwReset resets the hardware
	    @note The default value is 1. 
	*/
	eDoHwReset,                 //? RMuint32, if not 0 HwReset does hardware reset
	
	/** @li 0 HwReset leaves the Spdif output enabled
	    @li 1 HwReset disables the Spdif output
	    @note The default value is 1.	
	*/
	eDisableSpdifOutputInReset, //? RMuint32, if TRUE don't disable SPDIF output on reset
	
	/** The two values are used when playing on TV to set the
	    width of the active window.  They show the number of
	    active pixels displayed on TV (any value between 0...720)
	    for Ntsc / Pal. They will not affect the destination
	    window of the video or the scaling factors.  
	    @note The default value is 720.
	*/
 	eActiveVideoWidthNtsc,       //? RMuint32, number of pixels per line in NTSC mode
	eActiveVideoWidthPal,        //? RMuint32, number of pixels per line in PAL mode
	
	/** @li 1 for BROADCASTED_VIDEO -  the video is streamed and contains I blocks.
	    @li 0 for DVD_VIDEO - the video contains complete I frames. 
	    @note The default value is DVD_VIDEO.
	*/
	eBroadcastedVideo,           //? RMuint32, ???

	/** @li 1 for FORCED_PROGRESSIVE_OFF - displays progressive or interlaced like in the video stream
	    @li 0 for FORCED_PROGRESSIVE_ON - displays only progressive if the stream switches very fast from interlaced to progressive
	    @note The default value is 0. 
	*/
 	eForcedProgressiveSourceOff, //? RMuint32, ???

	/** @li 1 for PROGRESSIVE_ALWAYS - displays progressive for any video stream
	    @li 0 for PROGRESSIVE_MOVIES - displays progressive only for movies
	    @note The default value is 0. 
	*/
 	eForcedProgressiveAlways,    //? RMuint32, ???
	
	/** @li 1 for FRAME_DROP - it drops frames when it converts Ntsc clip to PAL TV.
	    @li 0 for FIELD_DROP - it drops fields when it converts Ntsc clip to PAL TV.
	    @note The default value is 0.
	*/
 	eNtscPalFrameDrop,           //? RMuint32, Drop frames when displaying NTSC (30 fps) content on PAL (25 fps)
	
	/** @li 1 for VGA_INTERLACED - displays only BOB on VGA
	    @li 0 VGA_INTERLACED - displays BOB or WEAVE on VGA, depending on stream
	    @note The default value is 0.
	*/
 	eVGAForcedInterlaced,        //? RMuint32, ???
	
	/** @li 0 for AUDIO_OUTPUT_STEREO
	    @li 1 for AUDIO_OUTPUT_AC3DTS
	    @note The default value is 0.
	*/
 	eAudioOutput,           //? RMuint32, ??? 
	
	/** audio volume right from 0 to 100
	    @note The default value is 100.
	*/
	eVolumeRight,           //? RMuint32: [0..100], left volume
	
	/** audio volume left from 0 to 100
	    @note The default value is 100. 
	*/
 	eVolumeLeft,            //? RMuint32: [0..100], right volume
	
	/** Used only for a specific hardware design (STPC - to select Pcm1716 or Pcm1720) 
	    @note The default value is 1720. 
	*/
 	eDacType,               //? RMuint32 ???

	/** @li 0 the audio I2S 16 or 24 bit will be selected by HwLib
	    @li 16 for audio I2S 16 bit
	    @li 24 for audio I2S 24 bit
	    @note The default value is 0. 
	*/
 	eAudioDacBitsPerSample, //? RMuint32: {8,16}, 

	/** This dword can be used for testing audio / video synchronization.
	    DoAudioLater is the number of PTS units that will be added to the audio PTS
	    from file send to the hardware. The HwLib will typecast DoAudioLater
	    to LONG - this means that negative values can be programmed.
	    The PTS unit is  11.(1) microseconds ( 90 kHz ).
	    @note The default value is 0.
	*/
 	eDoAudioLater,          //? RMuint32, ???
	
	/** values from 0 to 1000, used when SET_VGA is selected
	    @note The default value is 500.
	*/
 	eBrightness,   //? RMuint32: [0..1000], image brightness
	
	/** values from 0 to 1000, used when SET_VGA is selected
	    @note The default value is 500.
	*/
 	eContrast,     //? RMuint32: ]0..1000], image contrast
	
	/** values from 0 to 1000, used when SET_VGA is selected
	    @note The default value is 500.
	*/
 	eSaturation,   //? RMuint32: [0..1000], image saturation
	
	/** values from 0 to 1000, used when SET_TV is selected
	    @note The default value is 500.
	*/
 	eTvBrightness, //? RMuint32: [0..1000], tv out brightness
	
	/** values from 0 to 1000, used when SET_TV is selected
	    @note The default value is 500.
	*/
	eTvContrast,   //? RMuint32: [0..1000], tv out contrast
	
	/** values from 0 to 1000, used when SET_TV is selected
	    @note The default value is 500.
	*/
 	eTvSaturation, //? RMuint32: [0..1000], tv out saturarion

	/** It should be set according to VGA mode selected.
	    The default values are:
	    @notes	eDResBitsPerPixel= 8;
	    eDResScreenWidth = 1024;
	    eDResScreenHeight= 768;
	*/
 	eDResBitsPerPixel, //? RMuint32, ???
	eDResScreenWidth,  //? RMuint32, ???
	eDResScreenHeight, //? RMuint32, ???
	
	/** Used for analog overlay to program the pixel clock frequency for Nova chip.
	    At IDecoderBoard_HwReset time the analog overlay chip will detect the horizontal
	    frequency of the VGA mode and will program its PLL trying to match the VGA pixel
	    frequency. Because of not enough accuracy the result can be slightly different from
	    one detection to another and this causes a one pixel change in position of the video.
	    In order to avoid this, the user should save the horizontal frequency got from HwLib
	    in the registry and when the new detection will happen the HwLib will use the registry
	    value if the value is in a +/-200Hz range. If the value is too different the
	    auto-detected frequency will be used - the VGA mode was probably changed.
	    If the user don't use the value should be 0.
	    @notes The default value is 0. */
 	ePreviousHFreq,      //? RMuint32, ???
	
	/** Used for analog overlay to program the pixel clock frequency for Nova chip.
	    At IDecoderBoard_HwReset time the analog overlay chip will program the PLL frequency
	    based on horizontal frequency and an estimation of the pixels per line number.
	    For a better accuracy this number can be programmed by user in registry.
	    If the user don't use the value should be 0.
	    @notes The default value is 0. 
	*/
 	eTotalPixelsPerLine, //? RMuint32, ???

	/** @li 0 will not power off/on the EM8400 (no ACPI ON/OFF)
	    @li 1 IDecoder_Init will switch to ACPI_ON, IDecoder_Delete will switch to ACPI_OFF
	    @notes The default value is 0. 
	*/
 	eAcpiEnable,          //? RMuint32, ??? 
	
	/** Used for Ventura2k:
	    @li 0 EM8400 is master - EM8400 generates the HSync and VSync
	    @li 1 EM8400 is slave - EM8400 doesn't generate the HSync and VSync
	    @notest The default value is 0. 
	*/
 	eDecoderIsSlave,      //? RMuint32, Sets the TV encoder slave or master concerning synchro
	
	/** @li 0 no Zoom
	    @li 1 enable AcqWnd window to be the zoomed video window 
	*/
 	eZoomEnable,          //? RMuint32, ???
	
	/** @li 0 fullscreen on TV 
	    @li 1 enable destination window on TV 
	*/
 	eWindowTvEnable,      //? RMuint32, ???
	
	/** @li 0 fullscreen on HDTV
	    @li 1 enable destination window on HDTV 
	*/
 	eWindowHdtvEnable,    //? RMuint32, ???
	
	/** @li 0 OSD will be displayed relative to the video window 
	    @li 1 OSD will be displayed relative to the output device screen 
	*/
 	eOsdVideoIndependent, //? RMuint32, ???
	
	/** Used to program the digital video pixel clock Dvclk for EM9010.
	    @li 0 Dvclk will match the VGA pixel frequency
	    @li 1 Dvclk will be set to maximum limit 80000kHz = 80MHz
	    @li any required Dvclk in kHz, limited between hardware limits (30000 and 80000 for EM9010)
	    @notes The default value is 0. 
	*/
	eMaximumDvclk,        //? RMuint32 ???
	
	/** not a property */
	eCommonRegMax         //?
}REGISTRY_COMMON_SET_ID;

/**
	high definition television mode (HDTV) settings.
*/
// REGISTRY_HDTV_SET uses RMuint32 = unsigned long = DWORD
typedef enum {
	/** horizontal frequency in Hz*/
	eHdtvHFreq = 0,   //? RMuint32, ???

	/** vertical frequency in cHz (1Hz=100cHz)*/
	eHdtvVFreq,       //? RMuint32, ???

	/** number of visible video pixels per line*/
	eHdtvVideoWidth,  //? RMuint32, ???

	/** number of visible lines per frame*/
	eHdtvVideoHeight, //? RMuint32, ???

	/** number of pixels per line (visible + blanking)*/
	eHdtvHSyncTotal,  //? RMuint32, ???

	/** number of pixels between visible and HSync*/
	eHdtvPreHSync,    //? RMuint32, ???

	/** number of pixels in HSync active signal*/
	eHdtvHSyncActive, //? ???

	/** number of pixels between HSync and visible*/
	eHdtvPostHSync,   //? ???

	/** number of lines per frame (visible + blanking)*/
	eHdtvVSyncTotal,  //? RMuint32, ???

	/** number of lines between visible and VSync*/
	eHdtvPreVSync,    //? RMuint32, ???

	/** number of lines in VSync active signal*/
	eHdtvVSyncActive, //? ???

	/** number of lines between VSync and visible*/
	eHdtvPostVSync,   //? ???

	/** pixel frequency resulted from previous settings*/
	eHdtvPixelFreq,   //? RMuint32, ???

	/** interlaced mode, resulted from VideoHeight and the HFreq/VFreq*/
	eHdtvInterlaced,  //? ???

	/** not a property */
	eHdtvRegMax       //? ???
}REGISTRY_HDTV_SET_ID;

/** VGA specific settings (Digital Video Port) */
typedef enum {

	/** @li CCIR_NON_INVERT_FIELD for top-bottom display
	    @li CCIR_INVERT_FIELD for bottom-top display
	    @note The default value is 0. It depends on the VGA card. 
	*/
 	eInvertField = 0,  // RMuint32
	
	/** @li 0 for 8bits
	    @li 1 for 16 bits
	    @note The default value is 0.
	*/
 	eVmi_16bits,       // RMuint32
	
	/** @li  one of CCIR_601 or CCIR_656
	    @note The default value is CCIR_601 for analog overlay and CCIR_656 for digital overlay.
	*/
 	eCcir_656,         // RMuint32
	
	/** @li VS_ENABLED_HS_DISABLED_VRDYisVRDY_ENABLED: VSync enabled, HSync disabled, VVLD/HS=HS enabled,
	    @li VS_HS_VRDYisHS_ENABLED: VSync enabled, HSync enabled, VVLD/HS=VVLD enabled, 
	    @li VS_HS_VRDYisHS_DISABLED: VSync, HSync, VVLD/HS=VVLD disabled.
	    @note The default value is VS_HS_VRDYisHS_ENABLED for analog overlay
		      and VS_HS_VRDYisHS_DISABLED for digital overlay.
	*/
 	eSyncEnable,       // RMuint32
	
	/** @li 1 enables VIP 2.0
	    @note The default value is 0.
	*/
 	eVip20,            // RMuint32

	eVgaVendorRegMax
}REGISTRY_VGAVENDOR_SET_ID;

// SCANCONVERTER_SET uses RMuint32 = unsigned long = DWORD
typedef enum {
	escAccessRegister = 0,	     // genericReg_type (ADDR_DATA)
	escResetDefault,             //?
	escBrightness,               //?
	escContrast,                 //?
	escSaturation,               //?
	escSharpness,                //?
	escFlicker,                  //?
	escChromaFilter,             //?
	escLumaFilter,               //?
	escNtscPedestal,             //?
	escMacrovision,              // escMacrovision_type
	escTvStandard,               //? 
	escOutputFormat,             //?
	escHwOutputHorzOffsShadow,   //?
	escHwOutputVertOffsShadow,   //?
	escTVPixels,                 //?
	escTVLines,                  //?
	escHorizontalPositionOffset, //?
	escVerticalPositionOffset,   //?
	escHorizontalScaleStep,      //?
	escVerticalScaleStep,        //?
	escHorizontalPanPosition,    //?
	escVerticalPanPosition,      //?
	escZoom,                     //?
	escScanConverterMax          //?
}SCANCONVERTER_SET_ID;

// EEPROM_SET
typedef enum {
	eEepromAccess = 0, // genericReg_type (ADDR_DATA)
	eEepromMax         //?
}EEPROM_SET_ID;


// BOARDINFO_SET
typedef enum {
	ebiDeviceId = 0,	// RMuint32, get only (equivalent with MpegAttrGetSubID)
	ebiSubId,			// RMuint32, get only (equivalent with MpegAttrGetSubID)
	ebiBoardVersion,	// RMuint32, get only
	ebiAPMState,		// ebiAPMState_type
	ebiPIOAccess,		// genericReg_type (ADDR_DATA). get changes PIO in input, set changes PIO in output ???
	ebiHwLibVersion,	// RMuint32, get only (equivalent with MpegAttrCodeVersion)
	ebiUcodeVersion,	// RMuint32, get only
	ebiCommand,			// ebiCommand_type, set only
	ebiUcode,           // ebiUcode_type
	ebiAsynchCommand,   // RMuint32, set only
                        //  - 1 for new behavior - functions can return Q_PENDING and CheckPendingCommand should be called to complete
						//  - 0 for old behavior - no Q_PENDING return
	ebiBoardNameString,	// get only, buffer of more than 128 TCHAR should be provided
	ebiLastErrorInfoString,	// get only,, buffer of more than 256 TCHAR should be provided

	eBoardInfoMax
}BOARDINFO_SET_ID;

// VIDEO_SET uses u.ulData in DWORD
typedef enum {

	/** Scart Output ( TV output )
	    @li evScartOutput_COMPOSITE
	    @li evScartOutput_RGB
	    @li evScartOutput_DISABLE
	    @note The default value is evScartOutput_DISABLE 
	*/
	evScartOutput = 0, // evScartOutput_type

	/** Output Device for video display
	    @li evOutputDevice_VGA
	    @li evOutputDevice_TV
	    @li evOutputDevice_HDTV
	    @li evOutputDevice_DigOvOnly
	    @note The default value is evOutputDevice_VGA for analog boards and evOutputDevice_VGATV for digital boards. 
	*/
	evOutputDevice, // evOutputDevice_type (equivalent with MpegAttrVideoTv & VIDEOOUT_MASK)

	/** TV output format (TV output)
	    @li evTvOutputFormat_COMPOSITE
	    @li evTvOutputFormat_COMPONENT_YUV
	    @li evTvOutputFormat_COMPONENT_RGB
	    @li evTvOutputFormat_OUTPUT_OFF
	    @li evTvOutputFormat_COMPONENT_RGB_SCART
	    @note The default value is evTvOutputFormat_COMPOSITE. 
	*/
	evTvOutputFormat, //? evTvOutputFormat_type (equivalent with MpegAttrVideoTv & COMPONENT_MASK) ???
	
	/** TV standard (TV output)
	    @li evTvStandard_NTSC
	    @li evTvStandard_PAL
	    @li evTvStandard_PAL60
	    @li evTvStandard_PALM
	    @note The default value is evTvStandard_NTSC. 
	*/
	evTvStandard,   //? evTvStandard_type  (equivalent with MpegAttrVideoTv & STANDARDTV_MASK) ???

	evBrightness,	//?	RMuint32: [0..1000], brightness (equivalent with MpegAttrVideoBrightness)
	evContrast,		//?	RMuint32: [0..1000], contrast	(equivalent with MpegAttrVideoContrast)
	evSaturation,	//?	RMuint32: [0..1000], saturation	(equivalent with MpegAttrVideoSaturation)

	/** Video input aspect ratio
	    @li evInAspectRatio_4x3
	    @li evInAspectRatio_16x9
	    @note The default value is evInAspectRatio_4x3. 
	*/
	evInAspectRatio,	//?	evInAspectRatio_type: 	(equivalent with MpegAttrVideoAspectRatio)

	/** Video input standard ( based on frame rate and vertical width )
	    @li evInStandard_NTSC
	    @li evInStandard_PAL
	    @note The default value is evInStandard_NTSC. 
	*/
	evInStandard,		//?	evInStandard_type: 	(equivalent with MpegAttrVideoMode, MpegAttrVideoRate)

	/** Video output display option 
	    @li evOutDisplayOption_Normal
	    @li evOutDisplayOption_16x9to4x3_PanScan
	    @li evOutDisplayOption_16x9to4x3_LetterBox
	    @li evOutDisplayOption_4x3to16x9_HorzCenter
	    @li evOutDisplayOption_4x3to16x9_VertCenter
	    @note The default value is evOutDisplayOption_Normal. 
	*/
	evOutDisplayOption,	//?	evOutDisplayOption_type: 	(equivalent with MpegAttrVideoOutputMode)

	/** Source video window - {0,0, MpegWidth, MpegHeight}
	    @note Default Source window is 720x480
	*/
	evSourceWindow,	// Wnd_type, set/get

	/** Zoomed video window - it should be inside the SourceWindow
	    @note Default the Zoomed video window is equal with SourceWindow 
	*/
	evZoomedWindow,         // Wnd_type, set/get

	/** Maximum  output display resolution
	    @note It depends on the evOutputDevice selected. 
	*/
	evMaxDisplayWindow,     // Wnd_type, get only

	/** evDestinationWindow
	    @note For full screen get evMaxDisplayWindow and set evDestinationWindow
	*/
	evDestinationWindow,    // Wnd_type, set/get

	/** evValidWindow = Video valid window
	    @note The default is evMaxDisplayWindow
	*/
	evValidWindow,          // Wnd_type, set/get

	evCustomHdtvParams,     // CustomHdtvParams_type, set/get, (equivalent with MpegAttrHDTVMode)

	/** Video speed 
	    @note The default value is 0 for normal speed playback
	*/
	evSpeed,			// evSpeed_type (equivalent with MpegAttrVideoSpeed)

	/** evCaptureParams uses evCaptureParams_type to specify: 
	    wWidth        = picture width in pixels
	    wHeight       = height of frame or field in lines
	    wPictureType  = 0 for frame, 1 for field
	    dwBufferSize  = size of the buffer to receive the YUV info corresponding to CaptureFormat already set
	*/
	evCaptureParams,        // evCaptureParams_type, get only

    /** evCaptureFormat uses evCaptureFormat_type to specify:
        YUV_FRAME = 0,      // frame, weaved for interlaced content
        YUV_TOP_FIELD,      // top field for interlaced content.
                            // odd lines for progressive content
        YUV_BOTTOM_FIELD,   // bottom field for interlaced content.
                            // even lines for progressive content
        BGR_24BITS_BMP,     // frame, eventually weaved
        PALETTE_INDEX_BMP   // frame, eventually weaved
    */

    evCaptureFormat,        // evCaptureFormat_type

    /** evCaptureFrame has to provide a buffer of dwBufferSize bytes; dwBufferSize should be
    get from evCaptureParams, after setting the evCaptureFormat
    */
	evCaptureFrame,         // variable buffer size = dwBufferSize get from evCaptureParams_type

	evUnsupported,          // evFrameNumberInGOP unsupported starting with HwLib version 24

	/** AnalogCable Presence
	    @li evAnalogCable_NotConnected
	    @li evAnalogCable_Connected
	    @note The default value is evAnalogCable_Connected 
	*/
	evAnalogCable,		// evAnalogCable_type, get only

	/** DigitalCable Presence
	    @li evDigitalCable_NotConnected
	    @li evDigitalCable_Connected
	    @note The default value is evDigitalCable_Connected 
	*/
	evDigitalCable,		// evDigitalCable_type, get only

	/** ScartAspectRatio ( TV output )
	    @li evScartAspectRatio_Auto
	    @li evScartAspectRatio_4x3
	    @li evScartAspectRatio_16x9
	    @note The default value is evScartAspectRatio_Auto 
	*/
	evScartAspectRatio, // evScartAspectRatio_type, set and get

	/** Video frame counter gives the number of frames displayed since
	    previous video stop.
	    @note The default value after stop is 0.
	*/
	evFrameCounter,     // RMuint32, get only (similar with MpegAttrVideoFramePosition)

	evYUVWriteParams,   // evYUVWriteParams_type
	evDisplayFilter,    // evDisplayFilter_type

	evDigOvOnlyConfig,  // evDigOvOnlyConfig_type, set/get
	evDigOvOnlyParams,  // evDigOvOnlyParams_type, set/get

	evVOBUReverseParams,// evVOBUReverseParams_type
	evVOBULastPack,     // evVOBULastPack_type
	evVOBUReverseSpeed, // evSpeed_type

	/** @li 1 for BROADCASTED_VIDEO -  the video is streamed and contains I blocks.
	    @li 0 for DVD_VIDEO - the video contains complete I frames. 
	    @note The default value is DVD_VIDEO.
	*/
	evBroadcastedVideo,

	/** @li 1 - displays progressive or interlaced like in the video stream
	    @li 0 - displays only progressive if the stream switches very fast from interlaced to progressive
	    @note The default value is 0. 
	*/
 	evForcedProgressiveSourceOff,

	/** @li 1 - displays progressive for any video stream
	    @li 0 - displays progressive only for movies
	    @note The default value is 0. 
	*/
 	evForcedProgressiveAlways,
	
	/** @li 1 - it drops frames when it converts Ntsc clip to PAL TV.
	    @li 0 - it drops fields when it converts Ntsc clip to PAL TV.
	    @note The default value is 0.
	*/
 	evNtscPalFrameDrop,
	
	/** @li 1 - displays only BOB on progressive device output
	    @li 0 - displays BOB or WEAVE on progressive device output, depending on stream
	    @note The default value is 0.
	*/
 	evForcedBobDisplayOnOutputDevice,
	
	/** 4 bits info from video stream
		bit 1,0 = APS= analogue protection system= pseudo sync pulse, inverted split color burst
		bit 3,2 = CGMS= copy generation management system= copyright, copy generation
	*/
	evMacrovisionFlags, // RMuint32, set only (similar with MpegAttrVideoMacrovisionFlags)
	
	/** 
	    Information valid only in video decoding state.
		Index in table defined in Mpeg1/2 standard
	*/
	evHwFrameRateIndex,             // get only
	/** 
	    Information valid only in video decoding state.
		Index in table defined in Mpeg1/2 standard
	*/
	evHwAspectRatioIndex,           // get only

	/** 
    Is effective during the video PAUSE and STOP status after DICOM_Update flag is set to 1.
	evStreamDefaultAtPause
	evTopFieldAtPause,
	evBottomFieldAtPause,
	evBothFieldsAtPause
    */
	evFieldFrameAtPause,         // set, get, evFieldFrameAtPause_type
	evVideoHwPlay,		         // set, evVideoHwPlay_type
	evVideoHwPause,		         // set, no parameters needed
	evVideoHwStop,		         // set, no parameters needed

	evMax
/*
	evEnableSync,	//	MpegAttrVideoEnableSync
	evStill,		//	MpegAttrVideoStill
*/
}VIDEO_SET_ID;

// AUDIO_SET
typedef enum {

	/** setting for the "ppm value" for 27MHz input for audio clock.
	Supported only for Ne2kTv board.
	Accepted values: -150ppm, -75ppm, 0ppm, +75ppm, +150ppm
	*/
	eAudioFineVcxo = 0,         // int

	/** setting for the audio NovaLite Pll used for some hardware designs.
		In the VCXO_SET set:
		Coefficients[0] = (N & 0xFF) | ((M & 0xFF)<<8) | ((K & 0xFF)<<16);
		See NovaLite spec for values of N,M,K.
	*/
	eAudioVcxo,                 // VCXO_SET, set only

	/** setting for AC3 parameters:
	Ac3ComprDlgNorm      HwLib default eAc3LineOut
	Ac3SpeakerConfig     HwLib default eAc3SpeakerSurround
	Ac3HiLoDynamicRange  HwLib default 0xFFFF
	Ac3RepeatCounter     HwLib default 0x0000
	*/
	eaAc3Conf,                  // AC3_CONF structure

	/** setting for audio channels selection for the speakers:
	eAudioMode_Stereo
	eAudioMode_MonoLeft
	eAudioMode_MonoRight
	eAudioMode_MonoMix
	@note The default value is eAudioMode_Stereo.
	*/
	eAudioMode,                 // eAudioMode_type

	/** setting to select what audio signals are used for input/output,
	The setting is suppoted or not depending on the hardware design.
	Only Harmony = DigPvr board supports next settings:
	eAudioInOutDefault        - JDA1_SCkinJDA1CK_Jda1CkinGCK_ScinOUT_DamckOUT
	eAudioInOutVcxoJda1Ckin   - JDA1_SCkinJDA1CK_Jda1CkinDAMCK_ScinOUT_DamckIN, DAMCK = VCXO(27MHz)
	eAudioInOutExternJda1Ckin - JDA1_SCkinDAMCK_Jda1CkinGCK_ScinOUT_DamckIN, DAMCK = capture clock
	eAudioInOutSCkinCapture   - JDA1_SCkinJDA1CK_Jda1CkinDAMCK_ScinOUT_DamckIN, DAMCK = 1.5x(40MHz)
	@note The default value is eAudioInOutDefault.
	*/
	eaInOutConfig,              // AudioInOutConfig_type

	/** audio volume right from 0 to 100
	    @note The default value is 50.
	*/
	eaVolumeRight,               // RMuint32: [0..100], right volume

	/** audio volume left from 0 to 100
	    @note The default value is 50.
	*/
	eaVolumeLeft,                // RMuint32: [0..100], left volume

	/** format of the audio stream  ( mpeg, ac3, pcm,... )
	Setting should be applied in Stop state of the decoder.
	    @note The default value is eAudioFormat_AC3.
	*/
	eAudioFormat,                // eAudioFormat_type

	/** Sample rate of the audio stream  ( 32kHz, 48kHz, ... )
	    @note The default value is 48KHz.
	*/
	eAudioSampleRate,            // RMuint32

	/** Number of PCM channels of the audio stream, used only for PCM format.
	Setting should be applied in Stop state of the decoder.
	    @note The default value is 2.
	*/
	eAudioNumberOfChannels,      // RMuint32: 1,2,...,8

	/** Number bits per sample of PCM audio stream, used only for PCM format.
	Setting should be applied in Stop state of the decoder.
	    @note The default value is 16.
	*/
	eAudioNumberOfBitsPerSample, // RMuint32: 24, 20 or 16.

	/** eAudioI2SOutput enable or disable the I2S output
	    @li eAudioI2SOutput_Disabled
	    @li eAudioI2SOutput_Active
	    @li eAudioI2SOutput_ActiveData0
	    @note The default value is eAudioI2SOutput_Active.
	*/
	eAudioI2SOutput,             // eAudioI2SOutput_type

	/** eAudioSpdifOutput enable or disable the SPDIF output
	    @li eAudioSpdifOutput_Disabled
	    @li eAudioSpdifOutput_Active
	    @li eAudioSpdifOutput_ActiveData0
	    @note The default value is eAudioSpdifOutput_Active.
	*/
	eAudioSpdifOutput,           // eAudioSpdifOutput_type

	/** eAudioDigitalOutput selects if the audio data are decoded in Pcm or just passtrough
	    @li eAudioDigitalOutput_Pcm
	    @li eAudioDigitalOutput_Compressed
	    @note The default value is eAudioDigitalOutput_Pcm.
	*/
	eAudioDigitalOutput,         // eAudioDigitalOutput_type, (MpegAttrAudioOutput)

	/** 
    ChannelStatus in SPDIF has 192 bits. EM84xx has the possibility to
    program the first 32 bits using two 16 bits registers.
    MSB = bit 31 from ChannelStatus corresponds to bit 31 in SPDIF spec.
    LSB = bit 0 from ChannelStatus corresponds to bit 0 in SPDIF spec.
    Ex: Bit2 == copyright == (use SetMask = ResetMask = 0x00000004).

    HwLib code changes some bits from ChannelStatus registers:
     - bit 1 - programmed 0/1 according to PCM/digital content of the audio output,
       reprogrammed at every change of AudioFormat or AudioDigitalOutput.
     - bits 15,..,8 - initialized to 00011001 = 0x19, not reprogrammed.
     - bits 27,..,24 - programmed according to the audio sample rate,
       reprogrammed at every change of AudioSampleRate.
    The default ChannelStatus value is 0x02001902 (48k, DVD, digital content).

    SetProperty can modify any bit from the 32 available, using ResetMask
    and SetMask. The logical operation is:
      ChannelStatus = (ChannelStatus & ~ResetMask) | SetMask.
    It is application responsability to keep the sample rate and
    digital content correct ( protective mask 0x0F000002 ).

    GetProperty will return the value of ChannelStatus in SetMask.
	*/
	eAudioChannelStatus,       // ResetSetMask_type, set, get

	/** 
		Information available only in audio decoding AC3 or Mpeg state.
	    Get 32000, 44100, 48000 from the hardware audio decoder.
	*/
	eAudioHwDecSampleRate,       // get only

	/** 
	    Information valid only in audio decoding Mpeg state.
		Mpeg standard states:
		0 - stereo
		1 - joint_stereo
		2 - dual_channel
		3 - single_channel
	*/
	eAudioHwDecMode,             // get only

	/** 
	    Information valid only in audio decoding Mpeg state.
		Mpeg standard states:
		0 - no emphasis
		1 - 50/15 microsec. emphasis
		2 - reserved
		3 - CCITT J.17
	*/
	eAudioHwDecEmphasis,         // get only

	/** 
	    Information valid only in audio decoding Mpeg state.
	*/
	eAudioHwDecCopyright,        // get only

	eaMax
}AUDIO_SET_ID;

// TIME_SET uses TIME_INFO or etimSystemTimeClock_type
typedef enum {
	/** 
    etimPcrInfo (set/get) uses PCR_INFO structure
		Name			  Default	Comments/Unit
		-----------------------------------------------------------------------------
		PcrEnable			0		// 0/1 disables/enables Pcr mode;
		RecoveryTime		16		// log2 ( RecoveryTime / 200us )
		 							// e.g. For 16 -> RecoveryTime = 2^16 =13.1072sec
		PcrIntrPeriodUs		20000	// microsecond;	e.g 200000 = 200ms ->5 intr/sec
									// It can be changed to 20000=20ms->50 intr/sec,
									// for a smoother control of the voltage control
		TimeResolution		90000	// 90K unit;	e.g. 90000 = 1sec - specifies
									   the unit for the PCR_time
		DeltaPCR_SCR_Max	9000	// Max. accepted diff. between incoming PCR and board's clock SCR
									// 90K unit;	e.g. 9000 = 100ms
		DeltaSCR_APTS_Max	180		// Max. accepted diff. between SCR and the incoming AudioPTS
									// 90K unit;	e.g. 180 = 2ms
		HwVcxo				5		// Galaxy2 Siemens use PIO 5 for Vcxo
		PpmRange			150		// +/- 150ppm
	*/
	etimPcrInfo = 0,               // PCR_INFO

	/** 
    etimPcrTime uses etimSystemTimeClock_type structure, where
	dwTimeResolution		// 90000 for 90k pts unit, 1000 for ms unit
	dwlTime				    // time stamp
	*/
	etimPcrTime,             // etimSystemTimeClock_type, set, get

	/** 
    Replaces IDecodeBoard_ReadSCR/WriteSCR.
	Without setting etimSystemTimeClock, after VideoHwStop or AudioHwStop the first
	Pts received in SendVideoPayload or	SendAudioPayload will be used to update
	the decoder's reference	clock.
	If etimSystemTimeClock is set after VideoHwStop or AudioHwStop and before sending
	data and Pts the Pts from data will be disregarded.
	*/
	etimSystemTimeClock,     // etimSystemTimeClock_type, set, get

	/** 
	Returns the timestamp of the last decoded video frame (displayed or not).
	Replaces IDecoderBoard_ReadHwPts45k.
	*/
	etimLastDecodedVideoFrameTime, // etimSystemTimeClock_type, set, get

	/** 
	Returns the timestamp of the last decoded audio frame.
	*/
	etimLastDecodedAudioFrameTime, // etimSystemTimeClock_type, set, get

	/** 
    etimVOPTimeIncrRes - only for Mpeg4.
    Should be set before starting play with the value from DSI info.
	Returns the previously set:
	 - fixed VOP time increment resolution if the playback has forced rate, else
	 - VOP time increment resolution,
	HwLib default 30.
	*/
	etimVOPTimeIncrRes, // DWORD, set, get

	/** 
    etimVideoCTSTimeScale - only for Mpeg4.
	It should be set by mp4 parser.
	HwLib default 1000.
	*/
	etimVideoCTSTimeScale, // DWORD, set, get

	/** 
    etimAudioCTSTimeScale - only for Mpeg4.
	It should be set by mp4 parser.
	HwLib default 1000.
	*/
	etimAudioCTSTimeScale, // DWORD, set, get

	/** 
	    Returns the timestamp of the last displayed video frame.
	*/
	etimVideoFrameDisplayedTime, // etimSystemTimeClock_type, set, get

	etimMax
}TIME_SET_ID;

// SUBPICTURE_SET
typedef enum {
	/**
	   RMuint32.
	   This represents what will be set in the control register of the
	   SubPicture block of the chip. This register is named SP_CTRL.
	   For reference, here is its content:
	   15:9 --> Reserved.
	   8    --> Button Enable (Enables Highlight).
	   7    --> Field Enable (1: top, 0: Bottom) - microcode use
	   6    --> Field Alternate (1: Alternate, 0:Same) - microcode use
	   5    --> Vertical Downsampling Enable - microcode use
	   4    --> Horizontal Downsampling Enable - microcode use
	   3    --> Vertical Upsampling Enable - microcode use
	   2    --> Horizontal Upsampling Enable - microcode use
	   1    --> SubPicture Enable.
	   0    --> Reset - microcode use
	   The user can change through HwLib only bits 8 and 1 to enable/disable
	   the subpicture and the hilites = buttons.
	 */
	eSubpictureCmd,
	/**
	   An array of 16*4 bytes layed out as:
	   RYUV RYUV RYUV ... RYUV
	   Where each letter represents one byte.
	   R means reserved.
	   Y is the Y color component.
	   U is the U color component.
	   V is the V color component.
	 */
	eSubpictureUpdatePalette, 
	/**
	   a eSubpictureUpdateButton_type
	 */
	eSubpictureUpdateButton,
	eSubpictureMax
}SUBPICTURE_SET_ID;

// VIDEO_DECODER_SET uses RMuint32 = unsigned long = DWORD
typedef enum {
	evdAccessRegister = 0, // genericReg_type (ADDR_DATA)
	evdTvStandard,
	evdAudioClock,
	evdInputSource,
	evdMax
}VIDEO_DECODER_SET_ID;

// MPEG_ENCODER_SET
typedef enum {
	/**
	   genericReg_type
	 */
	emeAccessRegister = 0,  // genericReg_type (ADDR_DATA)
	/**
	   emeXferUcodeParameters_type
	 */
	emeXferUcodeParameters, // emeXferUcodeParameters_type
	emeMax
}MPEG_ENCODER_SET_ID;

// DVI_TRANSMITTER_SET
typedef enum {
	edtAccessRegister = 0, // genericReg_type (ADDR_DATA)
	edtMax
}DVI_TRANSMITTER_SET_ID;

// DECODER_SET uses DWORD
typedef enum {
	edecAudioInOutConfig = 0,	// EM847xAudioInOutConfigEnum defined in qhwlib.h
	edecAudioDacBitsPerSample,	// RMuint32: 16 or 24 bits 
	edecVideoStd,				// RMuint32: 0 for Mpeg1/2, 1 for Mpeg4
	edecOsdFlicker,				// RMuint32: 0 ... 15 ( 0 = flicker disabled)

	/*The register to control the PCI burst length is at address 0x1FEC:
			bit[2:0] min	max
			000		 4		 4
			001		 4		 8
			010		 8		 8
			011		 4		16
			100		 8		16
			101		16		16*/
	edecPciBurst,				//

	edecForceFixedVOPRate,		// edecForceFixedVOPRate_type
	edecAccessRegister,			// genericReg_type (ADDR_DATA)
	edecCSSChlg,				//? ???, get only.
	edecCSSKey1,				//? ???, set only.
	edecCSSChlg2,				//? ???, set only.
	edecCSSKey2,				//? ???, get only.
	edecCSSDiscKey,				//? ???, set only.
	edecCSSTitleKey,			//? ???, set only. 
	edecMax
}DECODER_SET_ID;

// TVENCODER_SET uses DWORD
typedef enum {
	etvNtscPedestal = 0,	// etvNtscPedestal_type
	etvLumaFilter,			// etvLumaFilter_type
	etvChromaFilter,		// etvChromaFilter_type
	etvColorBars,			// etvColorBars_type
	etvMax					// 
}TVENCODER_SET_ID;

// TVTUNER_SET
typedef enum {
       eTvTunerChannel = 0,      // uses struct eTvTunerChannel_type
       eTvTunerMax               //? ??? 
}TVTUNER_SET_ID;

typedef enum {
	/**
	   Set OSD to On, Off or Flush its buffer.
	 */
	eOsdCommand,            // edecOsdCommand_type
	/**
	   Set the OSD Hilight window. The window coordinates
	   are relative to the OSD bitmap.
	   In the highlight window, if the OSD is stored in 2,
	   4, or 7 BPP mode, the colors are looked up inthe 
	   upper half of the CLUT (Color LookUp Table).
	   ie: in 2bpp mode, the color 0 for highlight
	   will be looked up in index 4 of the CLUT.
	      
	 */
	eOsdHiLiWindow,             // Wnd_type
	/**
	   Set the position of the OSD bitmap relative to the current
	   coordinate system.
	 */
	eOsdDestinationWindow,      // Wnd_type
	eOsdMax
} OSD_SET_ID;

typedef enum {
	eI2cInit = 0,               // I2cInit_type, set only
	eI2cAccess,                 // I2cReadWrite_type + variable size buffer
								// set will write I2C, get will read
	eI2cMax                     // 
}I2C_SET_ID;

// VIDEOIN_SET
typedef enum {
	eviCommand = 0,         // see eviCommand_type

	eviParams,              // eviParams_type, set, get.
       /* eviParams property is applied to the hardware:
          - immediately when eviCommand_InitCapture property is send
          - at first VSync after SetProperty if decoder is in StartCapture state already
        The x,y,w,h, members define the captured window relative to VSync/HSync
        for 601 or embedded syncs for 656.
        In 601 mode:
           the beginning of a line is set by the hsync pulse;
           the beginning of a field/frame is set by the vsync pulse.
           Therefore, cropping is necessary to remove the horizontal and vertical blankings.
        In 656 mode:
           The active video is directly extracted from the data flow using the protocol embedded flags.
	       There is no blanking to remove.
        x specifies how many pixels will be skipped at the beginning of each line.
        y specifies how many lines will be skipped at the beginning of each frame.
		   If the content is progressive y lines will be skipped at every VSync. If the
		   content is interlaced only y/2 lines will be skipped at every VSync(per field).
        w specifies the pixel width of the picture to be captured - it should
	       be multiple of 8 for packed option and multiple of 2 for unpacked option
        h specifies the height of the picture (frame) to be captured. It should be even.
        OutputLineLength specifies the horizontal size of the image sent to DRAM - it should
	       be smaller or equal than width w, otherwise the SetProperty will return failure.
		   By default should be equal with w and no scaling will be used.
		   If it is smaller then width, horizontal downscale is done by VideoIn block
        Ccir;            // CCIR_656 or CCIR_601
        ChromaDownScale; // YUV420 or YUV422 format
        YuvPacked;       // 1 for luma & chroma captured packed
        InterlacedSource;// 1 if the video source is interlaced, 0 for progressive
        InvertField;     // CCIR_NON_INVERT_FIELD or CCIR_INVERT_FIELD
        BitsPerClock;    // 8 or 16 bits
        Vip20;           // 1 for VIP2.0; 0 for VIP1.x
        HSyncPolarity;   // 0 for active low; 1 for active high
        VSyncPolarity;   // 0 for active low; 1 for active high
        VSyncActiveEdge; // 0 for trailing edge; 1 for leading edge
		*/
	eviMax
}VIDEOIN_SET_ID;

//	To get extended error information about a failed test,
//  use property BOARDINFO_SET, ebiLastErrorInfoString. 
typedef enum {
	ehwTestMpegDecoderInitialize = 0,// minimum required for init testing
	ehwTestMpegDecoderRegisters,     // test some registers
	ehwTestMpegDecoderProgramMemory, // test internal program memory
	ehwTestMpegDecoderDataMemory,    // test internal data memory
	ehwTestDramSlave,                // test entire Dram using slave channel
	ehwTestDramMaster,               // test entire Dram using master channel
	ehwTestMax
}HARDWARE_TEST_SET_ID;

/************************************************************************************/
/************************************************************************************/
/*********************** Possible values ********************************************/
/*********************** Do not define SET_IDs above this limit *********************/
/************************************************************************************/

#ifndef SCART_MASK
/****************************** HACK *******************************************/
// defines already present in mpegcmn.h.

// MpegAttrForcedProgressive flags
#define FORCED_PROGRESSIVE_OFF	0x0100	// display progressive or interlaced like in the video stream
#define FORCED_PROGRESSIVE_ON	0x0000	// display only progressive if the stream switches very fast from interlaced to progressive
#define PROGRESSIVE_ALWAYS		0x0080
#define PROGRESSIVE_MOVIES		0x0000
#define FRAME_DROP				0x0040
#define FIELD_DROP				0x0000
#define VGA_INTERLACED			0x0002
#define VGA_PROGRESSIVE			0x0000

// MpegAttrHardwareInfo1 flags
#define DARK_COLOR_LETTERBOX	0x0001	// hwDecoder is Quasar1 - letterbox bug
#define VGA_CABLE_NOT_CONNECTED	0x0002	// VGA cable is not connected for analog overlay boards

#define SCART_MASK      0x0003
#define SCART_DISABLE   0x0000
#define SCART_COMPOSITE 0x0001
#define SCART_RGB       0x0003

#define VIDEOOUT_MASK   0x0021
#define SET_VGA         0x0000
#define SET_TV          0x0001
#define SET_HDTV        0x0020

#define STANDARDTV_MASK 0x010A
#define SET_NTSC        0x0000
#define SET_PAL         0x0002
#define SET_PAL60       0x0008
#define SET_PALM        0x000A
#define SET_480P        0x0100	// used only for Vga scan conversion

#define COMPONENT_MASK      0x02C0
#define COMPOSITE           0x0000
#define COMPONENT_YUV       0x0080
#define COMPONENT_RGB       0x00C0
#define OUTPUT_OFF          0x0040
#define COMPONENT_RGB_SCART 0x0200

#define AUDIO_FORMAT_MPEG1       1
#define AUDIO_FORMAT_MPEG2       2
#define AUDIO_FORMAT_AC3         3
#define AUDIO_FORMAT_PCM         4
#define AUDIO_FORMAT_DTS         5
#define AUDIO_FORMAT_DVD_AUDIO   6
#define AUDIO_FORMAT_REVERSE_PCM 7
#define AUDIO_FORMAT_AAC         8

#define VIDEO_ASPECT_RATIO_4_3   2
#define VIDEO_ASPECT_RATIO_16_9  3

#define MPEG_ATTRIBUTE_VIDEO_PAL  1
#define MPEG_ATTRIBUTE_VIDEO_NTSC 2

#define VIDEO_OUTPUT_MODE_NORMAL_OR_WIDE 0
#define VIDEO_OUTPUT_MODE_PAN_SCAN       1
#define VIDEO_OUTPUT_MODE_LETTERBOX      2
#define VIDEO_OUTPUT_MODE_HORZCENTER     3
#define VIDEO_OUTPUT_MODE_VERTCENTER     4

// flags used to enable/disable the hardware audio outputs
#define AUDIO_DAC_ENABLE						0x0001
#define AUDIO_DAC_DISABLE						0x0000
#define AUDIO_SPDIF_ENABLE						0x0002
#define AUDIO_SPDIF_DISABLE						0x0000

#define AUDIO_OUTPUT_STEREO						0
#define AUDIO_OUTPUT_AC3DTS						1

#endif // SCART_MASK

// APS= analogue protection system= bit1,0= pseudo sync pulse, inverted split color burst
#define MACROVISION_APS_MASK	0x03
#define MACROVISION_APS_OFF		0x00
#define MACROVISION_APS_1		0x01
#define MACROVISION_APS_2		0x02
#define MACROVISION_APS_3		0x03

// CGMS= copy generation management system= bit3,2= copyright, copy generation
#define MACROVISION_CGMS_MASK	0x0C
#define CGMS_NO_RESTRICTION		0x00
#define CGMS_RESERVED			0x04
#define CGMS_ONE_GENERATION		0x08
#define CGMS_NO_COPY			0x0C

#define YUV420					0x0001
#define YUV422					0x0000

#define CCIR_656				0x0001
#define CCIR_601				0x0000

// InvertField
#define CCIR_NON_INVERT_FIELD	0x0000
#define CCIR_INVERT_FIELD		0x0001

// SyncEnable
#define VS_HS_VRDYisHS_DISABLED						0x0000
#define VS_HS_VRDYisHS_ENABLED						0x0001
#define VS_ENABLED_HS_DISABLED_VRDYisVRDY_ENABLED	0x0002

#define BTN_ENABLE 0x0100
#define SP_ENABLE 0x0002
/****************************** HACK *******************************************/

// For Xcard the user should select one of:
//		- evScartOutput_COMPOSITE or 
//		- evScartOutput_RGB.
// The Xcard scart output is enabled only if both next conditions are met:
//   - evTvOutputFormat is set to evTvOutputFormat_COMPONENT_RGB_SCART
//	 - evOutputDevice is set to evOutputDevice_TV

// For NE2000TV card the user should select one of:
//		-  evScartOutput_DISABLE (scart output is disabled) or
//		- any of evScartOutput_COMPOSITE or evScartOutput_RGB (scart output is enabled).
 
typedef enum 
{
	evScartOutput_COMPOSITE	= SCART_COMPOSITE,
	evScartOutput_RGB       = SCART_RGB,
	evScartOutput_DISABLE   = SCART_DISABLE
} evScartOutput_type;

typedef enum 
{
	evScartAspectRatio_Auto = 0,
	evScartAspectRatio_4x3,
	evScartAspectRatio_16x9,
} evScartAspectRatio_type;

typedef enum 
{
	evOutputDevice_VGA  = SET_VGA,
	evOutputDevice_TV   = SET_TV,
	evOutputDevice_HDTV = SET_HDTV,
	evOutputDevice_DigOvOnly = 0x0021
} evOutputDevice_type;

typedef enum 
{
	evTvStandard_NTSC  = SET_NTSC,
	evTvStandard_PAL   = SET_PAL,
	evTvStandard_PAL60 = SET_PAL60,
	evTvStandard_PALM  = SET_PALM,
	evTvStandard_SECAM = 39823, // only supported by SAA7114.
} evTvStandard_type;

typedef enum 
{
	evTvOutputFormat_COMPOSITE           = COMPOSITE,
	evTvOutputFormat_COMPONENT_YUV       = COMPONENT_YUV,
	evTvOutputFormat_COMPONENT_RGB       = COMPONENT_RGB,
	evTvOutputFormat_COMPONENT_RGB_SCART = COMPONENT_RGB_SCART,
	evTvOutputFormat_OUTPUT_OFF          = OUTPUT_OFF
} evTvOutputFormat_type;

typedef enum
{
	evInAspectRatio_4x3  = VIDEO_ASPECT_RATIO_4_3,
	evInAspectRatio_16x9 = VIDEO_ASPECT_RATIO_16_9
} evInAspectRatio_type;

typedef enum
{
	evOutDisplayOption_Normal               = VIDEO_OUTPUT_MODE_NORMAL_OR_WIDE,
	evOutDisplayOption_16x9to4x3_PanScan    = VIDEO_OUTPUT_MODE_PAN_SCAN,
	evOutDisplayOption_16x9to4x3_LetterBox  = VIDEO_OUTPUT_MODE_LETTERBOX,
	evOutDisplayOption_4x3to16x9_HorzCenter = VIDEO_OUTPUT_MODE_HORZCENTER,
	evOutDisplayOption_4x3to16x9_VertCenter = VIDEO_OUTPUT_MODE_VERTCENTER
} evOutDisplayOption_type;

typedef enum
{
	evInStandard_NTSC = MPEG_ATTRIBUTE_VIDEO_NTSC,
	evInStandard_PAL  = MPEG_ATTRIBUTE_VIDEO_PAL
} evInStandard_type;

typedef DWORD evSpeed_type;  // see cqsrbrd.c for peculiar values to set here.		
                             // 1 to 255 = slow speed (from slowest to normal)
                             // 0 and 256 = normal speed
                             // > 257 = fast speed (from normal to fastest)

typedef enum
{
	// depending on wDisplayType from evCaptureParams_type the data
	// returned in user buffer is:
	// - 420 format = Y buffer (WxH size), followed by UV buffer(WxH/2)
	// - 422 format = Y buffer (WxH size), followed by UV buffer(WxH)
	YUV_FRAME = 0,      // frame, weaved for interlaced content
	YUV_TOP_FIELD,      // top field for interlaced content.
						// odd lines for progressive content
	YUV_BOTTOM_FIELD,   // bottom field for interlaced content.
						// even lines for progressive content

	// BMP formats return buffer with RGB data in bitmap format
	BGR_24BITS_BMP,         // frame, weaved for interlaced content
	PALETTE_INDEX_BMP       // frame, weaved for interlaced content
} evCaptureFormat_type;

typedef struct
{
	WORD wWidth;			// picture width in pixels
	WORD wHeight;			// height of frame or field in lines
	WORD wPictureType;		// 0 for frame, 1 for field
	WORD wDisplayType;		// YUV420 or YUV422 format
	DWORD dwBufferSize;		// size of the buffer to receive the YUV info corresponding to CaptureFormat already set
} evCaptureParams_type;

typedef enum
{
	YUV_420_UNPACKED = 0,
	YUV_422_UNPACKED,
} evYUVDataFormat_type;

typedef struct
{
	WORD wWidth;            // Picture width in pixels
	WORD wHeight;           // Picture height in lines
	evYUVDataFormat_type YUVFormat; // evYUVDataFormat_type
} evYUVWriteParams_type;

typedef struct
{
	DWORD dwVOBUBufferSize;       // approximate size for VOBU
	ULONGLONG dwlVOBUStartTime;	  // StartPts 90k pts unit
	ULONGLONG dwlVOBUEndTime;     // EndPts  90k pts unit
	ULONGLONG dwlVOBUDisplayTime; // first image played - 90k pts unit
} evVOBUReverseParams_type;

typedef DWORD evVOBULastPack_type;

typedef enum
{
	HorizontalBilinear = 0,
	Horizontal4tapDefault,
	Horizontal4tapJpg,
	VerticalBilinear,
	Vertical2tapDefault,
	Vertical4tapDefault,
} evDisplayFilter_type;

typedef enum 
{
	evAnalogCable_NotConnected = 0,
	evAnalogCable_Connected
} evAnalogCable_type;

typedef enum 
{
	evDigitalCable_NotConnected  = 0,
	evDigitalCable_Connected
} evDigitalCable_type;

typedef enum {
	eAudioFormat_MPEG1       = AUDIO_FORMAT_MPEG1, // mpeg1 layer 1.
	eAudioFormat_MPEG2       = AUDIO_FORMAT_MPEG2, // mpeg1 layer 2.
	eAudioFormat_AC3         = AUDIO_FORMAT_AC3,
	eAudioFormat_PCM         = AUDIO_FORMAT_PCM,
	eAudioFormat_DTS         = AUDIO_FORMAT_DTS,
	eAudioFormat_DVD_AUDIO   = AUDIO_FORMAT_DVD_AUDIO,
	eAudioFormat_REVERSE_PCM = AUDIO_FORMAT_REVERSE_PCM,
	eAudioFormat_AAC         = AUDIO_FORMAT_AAC,
	eAudioFormat_MPEG1_LAYER3,  // mpeg1 layer 3.
	eAudioFormat_MPEG2_LAYER1,  // mpeg2 layer 1.
	eAudioFormat_MPEG2_LAYER2,  // mpeg2 layer 2.
	eAudioFormat_MPEG2_LAYER3,  // mpeg2 layer 3.
	eAudioFormat_UNKNOWN, 
} eAudioFormat_type;

typedef enum {
	eAudioDigitalOutput_Pcm        = AUDIO_OUTPUT_STEREO,
	eAudioDigitalOutput_Compressed = AUDIO_OUTPUT_AC3DTS
} eAudioDigitalOutput_type;

typedef enum {
	eAudioSpdifOutput_Disabled = AUDIO_SPDIF_DISABLE,
	eAudioSpdifOutput_Active  = AUDIO_SPDIF_ENABLE,
	eAudioSpdifOutput_ActiveData0 = 4
} eAudioSpdifOutput_type;

typedef enum {
	eAudioI2SOutput_Disabled   = AUDIO_DAC_DISABLE,
	eAudioI2SOutput_Active    = AUDIO_DAC_ENABLE,
	eAudioI2SOutput_ActiveData0 = 8
} eAudioI2SOutput_type;

typedef enum {
	ebiAPMState_Suspend,       //
	ebiAPMState_ResumeSuspend, //
	ebiAPMState_Standby,       //
	ebiAPMState_ResumeStandby, //
	ebiAPMState_Max            //
} ebiAPMState_type;

typedef enum 
{
	edecVideoStd_MPEG12Video = 0,
	edecVideoStd_MPEG4Video  = 1,
	edecVideoStd_MPEG124Video = 445, // the two last values are not used by the hardware library.
	edecVideoStd_DivX3Video = 446,
} edecVideoStd_type;

typedef struct {	// used for PropId=etimPcrTime in PropSet=TIME_SET
	DWORD dwTimeResolution_Hz;	// 90000 for 90k pts unit
	ULONGLONG dwlTime;		// Pts
} etimSystemTimeClock_type;  //TIME_INFO; // (hack) we have to link mpegcmn.h to here.

typedef struct {
	DWORD	dwForceFixedVOPRate;	// command for set, status for get
	DWORD	dwFixedVopTimeIncr;		// ticks/VOP, default 1000
	DWORD	dwFixedTimeIncrRes;		// ticks/sec, default 24000
} edecForceFixedVOPRate_type;

typedef BYTE edecCSSChlg_type[10];
typedef BYTE edecCSSKey1_type[5];
typedef BYTE edecCSSChlg2_type[10];
typedef BYTE edecCSSKey2_type[5]; 
typedef BYTE edecCSSDiscKey_type[2048];
typedef BYTE edecCSSTitleKey_type[5];

typedef enum {
	eSubpictureCmd_BTN_ENABLE = BTN_ENABLE,
	eSubpictureCmd_SP_ENABLE  = SP_ENABLE,
} eSubpictureCmd_type;
	
typedef struct {
	BYTE yuvReserved;
	BYTE yuvY;
	BYTE yuvCr;
	BYTE yuvCb;
} eSubpictureUpdatePalette_type[16];

typedef struct {
	LONG leftb;
	LONG topb;
	LONG rightb;
	LONG bottomb;
	LONG wColor;
	LONG wContrast;
} eSubpictureUpdateButton_type;

typedef enum {
	ebiCommand_HardwareReset = 1,
	ebiCommand_VideoHwBlackFrame
} ebiCommand_type;

typedef enum {
	ebiUcode_MpegDecode = 1,
	ebiUcode_Yuv
} ebiUcode_type;

typedef enum {
	eviCommand_InitCapture = 0,  // eviInitCapture is accepted any time. It initializes the
                                 // capture parameters using values set in eviParams property
	eviCommand_StartCapture,     // starts the capture. It is accepted only if the decoder is
                                 // in eviFreezeCapture or video stop.

	eviCommand_FreezeCapture    // freeze the capture
} eviCommand_type;

typedef struct {
	LONG x;
	LONG y;
	LONG w;
	LONG h;
	LONG OutputLineLength;
	BYTE Ccir;            // CCIR_656 or CCIR_601
	BYTE ChromaDownScale; // YUV420 or YUV422 format
	BYTE YuvPacked;       // 1 for luma & chroma captured packed
	BYTE InterlacedSource;// 1 if the video source is interlaced, 0 for progressive
	BYTE InvertField;     // CCIR_NON_INVERT_FIELD or CCIR_INVERT_FIELD
	BYTE BitsPerClock;    // 8 or 16 bits
	BYTE Vip20;           // 1 for VIP2.0; 0 for VIP1.x
	BYTE HSyncPolarity;   // 0 for active low; 1 for active high
	BYTE VSyncPolarity;   // 0 for active low; 1 for active high
	BYTE VSyncActiveEdge; // 0 for trailing edge; 1 for leading edge
} eviParams_type;

typedef struct {
	DWORD Addr;
	DWORD Data;
} genericReg_type; // hack link qhwinc.h to here, ADDR_DATA

typedef struct {
	LONG x;
	LONG y;
	LONG w;
	LONG h;
} Wnd_type; // hack link qhwinc.h to here.

typedef struct {
	DWORD HFreq;
	DWORD VFreq;
	DWORD VideoWidth;
	DWORD VideoHeight;

	DWORD HSyncTotal;	
	DWORD PreHSync;
	DWORD HSyncActive;
	DWORD PostHSync;

	DWORD VSyncTotal;	
	DWORD PreVSync;
	DWORD VSyncActive;
	DWORD PostVSync;

	DWORD PixelFreq;
	DWORD Interlaced;
} CustomHdtvParams_type;

/*      |            (H/V)  Total           |
        |<--------------------------------->|<-------------------...
        |                                   | 
        |Pre|Active|Post|    Width/Heigth   |Pre|Active|Post|
      ->|<->|<---->|<-->|<----------------->|<->|<---->|<-->|<---
      
      ~\                +--/~~~~~...~~~~~\--+                /~~~...
      ------+      +----| MAX. VIDEO  VALID |---+      +----|----...
      ~/    |      |    +--\~~~~~~...~~~~/--+   |      |     \~~~...
            V______|                            V______| 
  
      ~\                    /~~~~~...~~~~\                    /~...
      ------+      +-------|  VIDEO DEST  |-----+      +-----|--...
      ~/    |      |        \~~~~~...~~~~/      |      |      \~...
            V______|                            V______|
HSyncTotal = PreHSync + HSyncActive + PostHSync + VideoWidth;
VSyncTotal = PreVSync + VSyncActive + PostVSync + VideoHeight;
HFreq = VFreq * VSyncTotal / (Interlaced ? 2:1);
PixelFreq = HFreq * HSyncTotal;

Sample:
720x480I_Ntsc= { 15734,5994, 720,480, 858,22,100,16,  525,6,3,36, 27000000,1, 0,0 };
720x576I_Pal=  { 15625,5000, 720,576, 864, 8,100,36,  625,2,3,44, 27000000,1, 0,0 };
*/
typedef struct {
                        // Sample values for 720x480I_Ntsc
	DWORD HFreq;        //    15734 Hz
	DWORD VFreq;        //     5994 cHz
	DWORD VideoWidth;   //      720 pixels
	DWORD VideoHeight;  //      480 lines

	DWORD HSyncTotal;   //      858 pixels
	DWORD PreHSync;     //       22 pixels
	DWORD HSyncActive;  //      100 pixels
	DWORD PostHSync;    //       16 pixels

	DWORD VSyncTotal;   //      525 lines	
	DWORD PreVSync;     //        6 lines
	DWORD VSyncActive;  //        3 line
	DWORD PostVSync;    //       36 lines

	DWORD PixelFreq;    // 27000000 Hz - not used for SetProperty, only for GetProperty.
	DWORD Interlaced;	//        1    - not used for SetProperty, only for GetProperty. 

	BYTE HSyncPolarity; //        0    - 0 for active low, 1 for active high
	BYTE VSyncPolarity; //        0    - 0 for active low, 1 for active high

} evDigOvOnlyParams_type; // almost the same as HDTV_MODE in mpegcmn.h.

typedef struct {
 	BYTE Ccir;         // CCIR_656 or CCIR_601
 	BYTE BitsPerClock; // 8 or 16 bits
 	BYTE InvertField;  // CCIR_INVERT_FIELD or CCIR_NON_INVERT_FIELD
 	BYTE SyncEnable;   // VS_ENABLED_HS_DISABLED_VRDYisVRDY_ENABLED (VSync enabled, HSync disabled, VVLD/HS=HS enabled)
                       // VS_HS_VRDYisHS_ENABLED (VSync enabled, HSync enabled, VVLD/HS=VVLD enabled) 
	                   // VS_HS_VRDYisHS_DISABLED (VSync, HSync, VVLD/HS=VVLD disabled)
 	BYTE Vip20;        // 1 for VIP2.0; 0 for VIP1.x
} evDigOvOnlyConfig_type;

typedef enum
{
	VideoHwPlayNormal = 0,
	VideoHwPlayToEvent,
	VideoHwPlayIFrame,
	VideoHwPlaySyncFaster,
	VideoHwPlayYUV,
	VideoHwPlayVOBUReverse,
	VideoHwPlayIFrameReverse,
	VideoHwSeekToFrame,
	VideoHwSeekToPts
}PLAY_OPTIONS;	// MpegAttrPlayOptions

typedef struct {
 	PLAY_OPTIONS	PlayOptions;
 	ULONGLONG		Event;	// event is number of frame for VideoHwSeekToFrame
							// for time being event is PTS (VideoHwSeekToPts) in Hw video pts units,
							//   (45k for mpeg1,2, VOPTimeResolution for Mpeg4)
} evVideoHwPlay_type;

typedef enum 
{
	evStreamDefaultAtPause = 0,
	evTopFieldAtPause,
	evBottomFieldAtPause,
	evBothFieldsAtPause
} evFieldFrameAtPause_type;

typedef enum 
{
	etvNtscPedestal_OffJapan = 0,
	etvNtscPedestal_OnUSA
} etvNtscPedestal_type;

typedef enum 
{
	// For EM847x Extended means 6.75MHz, LowPass 4.5MHz
	etvLumaFilter_CompositeExtended_ComponentExtended = 0,	// default
	etvLumaFilter_CompositeLowPass_ComponentExtended,		// not recommended
	etvLumaFilter_CompositeExtended_ComponentLowPass,		// not recommended
	etvLumaFilter_CompositeLowPass_ComponentLowPass			// not recommended
} etvLumaFilter_type;

typedef enum 
{
	// For EM847x Extended means 6.75MHz/2
	etvChromaFilter_CompositeDefaultLowPass_ComponentExtended = 0,	// default
	etvChromaFilter_CompositeExtended_ComponentExtended				// not recommended
} etvChromaFilter_type;

typedef enum 
{
	etvColorBars_Off = 0,	// default
	etvColorBars_On
} etvColorBars_type;

typedef enum {
	evdInputSource_COMPOSITE=0,
	evdInputSource_SVIDEO,
	evdInputSource_ONBOARDTUNER,
} evdInputSource_type;

typedef evTvStandard_type evdTvStandard_type; // The tv _encoder_ setting uses the same enums as tv _decoder_

typedef DWORD evdAudioClock_type; // use only 32000, 44100, 48000 values.

typedef enum {
	evTvTunerRange_NTSC_MNAIR,               // ntsc m/n air (antenna) channels
	evTvTunerRange_NTSC_MNCABLE,             // ntsc m/n cable channels
	evTvTunerRange_SECAM_AIR_France,
} eTvTunerRange_type;                      // for struct eTvTunerChannel_type

typedef struct {
	eTvTunerRange_type evTvTunerRange_value; // uses enum eTvTunerRange_type
	DWORD eTvTunerChannelInRange;             // [2..69] ntsc m/n air, [1..125] ntsc m/n cable
} eTvTunerChannel_type;

typedef enum
{
	eAudioInOutDefault = 0,
	eAudioInOutVcxoJda1Ckin,
	eAudioInOutExternJda1Ckin,
	eAudioInOutSCkinCapture
} AudioInOutConfig_type;

typedef enum	// used for PropId = eAudioMode in PropSet=AUDIO_SET
{
	eAudioMode_Stereo = 0,
	eAudioMode_MonoLeft,
	eAudioMode_MonoRight,
	eAudioMode_MonoMix
}eAudioMode_type;

typedef enum	// used for PropId = eaAc3Conf in PropSet=AUDIO_SET
{
	eAc3SpeakerSurround = 0,
	eAc3Speaker1_0,
	eAc3Speaker2_0
}Ac3SpeakerConfig;

typedef enum	// used for PropId = eaAc3Conf in PropSet=AUDIO_SET
{
	eAc3ComprDiagNormOff = 0,
	eAc3DiagNormOn,
	eAc3LineOut,
	eAc3RFModulation
}Ac3ComprDlgNorm;

typedef struct tagAC3_CONF	// used for PropId = eaAc3Conf in PropSet=AUDIO_SET
{
	WORD wStructureVersion;			// 0
	BYTE bAc3ComprDlgNorm;			// see Ac3ComprDlgNorm enum, HwLib default eAc3LineOut
	BYTE bAc3SpeakerConfig;			// see Ac3SpeakerConfig enum, HwLib default eAc3SpeakerSurround
	WORD wAc3HiLoDynamicRange;		// HwLib default 0xFFFF
	WORD wAc3RepeatCounter;			// HwLib default 0x0000
}AC3_CONF;

typedef struct
{
	DWORD ResetMask;
	DWORD SetMask;
}ResetSetMask_type;

typedef enum {
	eOsdOn = 0,
	eOsdOff,
	eOsdFlush
} eOsdCommand_type;

typedef struct {
	WORD PIO_clock;
	WORD PIO_data;
} I2cInit_type;

// base structure structure for Read/Write I2C. 
typedef struct {
	WORD I2c_WriteAddress;	// write address of the I2C device. Reserve WORD instead of BYTE for later extensions
	WORD I2c_ReadAddress;	// read address of the I2C device. Reserve WORD instead of BYTE for later extensions
	WORD I2c_usDelay;		// Delay in microseconds
	WORD SubAddress;		// subadress.  Reserve WORD instead of BYTE for later extensions, like 0xFFFF for no subaddress
	WORD nBytes;			// size of the BYTE buffer that follow this structure
} I2cReadWrite_type;

typedef enum {
	escMacrovision_APS_OFF = MACROVISION_APS_OFF,
	escMacrovision_APS_1 = MACROVISION_APS_1,
	escMacrovision_APS_2 = MACROVISION_APS_2,
	escMacrovision_APS_3 = MACROVISION_APS_3
} escMacrovision_type;

// defines moved from mpegcmn.h

// MpegAttrForcedProgressive flags
#define BROADCASTED_VIDEO		0x0200
#define DVD_VIDEO				0x0000

//	MpegAttrOverlayFlags
#define OVERLAY_FLAGS_MASK			0x004F
#define VIDEO_ZOOM_ENABLE			0x0001
#define VIDEO_TV_DEST_ENABLE		0x0002
#define VIDEO_HDTV_DEST_ENABLE		0x0004
#define OSD_VIDEO_INDEPENDENT_DEST	0x0008
#define SPECIAL_IGS_STANDARD		0x0040

typedef CustomHdtvParams_type HDTV_MODE, *PHDTV_MODE;

typedef struct
{
	DWORD SysPhysAddr;
	DWORD SysLinAddr;
	DWORD SysSizeInBytes;
	DWORD DramAddr;
	DWORD DramSizeInBytes;
}emeXferUcodeParameters_type;


#ifdef __cplusplus
}
#endif 
/** @} */

#endif // __RM84CMN_H__
