//---------------------------------------------------------------------------
//  HawkDVB API Header File
//  by Hawk 2005
//
//  Version 1.1.2
//  
//---------------------------------------------------------------------------

#ifndef HawkDVBApiH
#define HawkDVBApiH
//============================================================================
//=========================HawkDVB-Messages===================================
//======Don't use this Messages the moment!! =================================

#define HDVB_MESSAGES                   (WM_APP+1999)
#define HDVB_CREATECHANNELLIST          (HDVB_MESSAGES+2000)
#define HDVB_SETCHANNEL                 (HDVB_MESSAGES+2001)    //---wParam -> TChannel
#define HDVB_STARTRECORDING             (HDVB_MESSAGES+2002)    //---wParam -> Duration of recording
                                                                //   (0=infinite,10,20,30,45,60,90,120 mins),
                                                                //   lParam -> 1 =PC Shutdown
#define HDVB_STOPRECORDING              (HDVB_MESSAGES+2003)
#define HDVB_SHOWEPGWINDOW              (HDVB_MESSAGES+2004)
#define HDVB_AUTOMATION_START           (HDVB_MESSAGES+2005)
#define HDVB_AUTOMATION_STOP            (HDVB_MESSAGES+2006)
#define HDVB_AUTOMATION_ADD_EVENT       (HDVB_MESSAGES+2007)   //---wParam defines TAutomationEvent
#define HDVB_AUTOMATION_CLEAR_EVENTS    (HDVB_MESSAGES+2008)
#define HDVB_SET_WINDOW_VIEW            (HDVB_MESSAGES+2009)
#define HDVB_SET_FULLSCREEN_VIEW        (HDVB_MESSAGES+2010)
#define HDVB_GET_SIGNAL_LEVEL           (HDVB_MESSAGES+2011)   //---WParam -> Level Percentage
#define HDVB_GET_SIGNAL_QUALITY         (HDVB_MESSAGES+2012)   //---WParam -> Quality Percentage
#define HDVB_SET_VOLUME                 (HDVB_MESSAGES+2013)   //---WParam -> Volume Percentage
#define HDVB_REINIT_DIRECTSHOW          (HDVB_MESSAGES+2014)
//============================================================================
//=========================HawkDVB Module-API=================================
#define HDVB_MODULE_TYPE_UNKNOWN	0
#define HDVB_MODULE_TYPE_TEST		1


#define HDVB_MODULE_API_1_0     	0x1000000 // v1.0

struct THDVBModuleInfo
{
    DWORD 	    MajorVersion;
    DWORD 	    MinorVersion;
    char  	    ModuleName[40];
    short 	    ModuleType;
    TShortCut   ShortCut;
    DWORD	    ModuleAPIRequired;
};

/*
	BOOL     HDVBModuleInit(HANDLE HDVB_Handle, THDVBModuleInfo *modInfo);	 //--Init Module and get Info
 	BOOL     HDVBModuleShow();		//--Show Module
	BOOL	 HDVBModuleClose();		//--Close Module
*/
//============================================================================
//=========================Main Structures=========================================
struct TAVInfo              //-----Audio/Video Info structure
{
    DWORD   VideoWidth;
    DWORD   VideoHeight;
    DWORD   VideoAspectRatioX;
    DWORD   VideoAspectRatioY;
    DWORD   AudioChannelsCount;
    DWORD   AudioSamplesPerSec;
    WORD    AudioFormat;
};


//============================================================================
//=========================Automation=========================================

    //------Status-Flags
#define     AE_STATUS_WAITING      1
#define     AE_STATUS_FINISHED     2

    //------Event-Flags
#define     AE_EVENT_STARTREC           5
#define     AE_EVENT_STOPREC            6
#define     AE_EVENT_SWITCH_CHANNEL     7
#define     AE_EVENT_CLOSE_HAWKDVB      8
#define     AE_EVENT_SHUTDOWN_PC        9
#define     AE_EVENT_EXEC_COMMAND       10

struct TAutomationEvent
{
    TDateTime   aeStartTime;
    int         aeEvent;        //---Kind of Event
    int         aeStatus;       //---See AE_STATUS* Flags
    char        aeParam[256];
};
//============================================================================
//=================ChannelList Version 1.2====================================

    //-----DBListConfig Modes
#define CH_SCRAMBLEMODE_ALL         0
#define CH_SCRAMBLEMODE_FTA         1
#define CH_SCRAMBLEMODE_SCRAMBLE    2

#define CH_VIEWMODE_NAME            0
#define CH_VIEWMODE_PROVIDER        1
#define CH_VIEWMODE_TP              2
#define CH_VIEWMODE_TYPE            3

#define CH_CHANNELTYPES_ALL         0
#define CH_CHANNELTYPES_TV          1
#define CH_CHANNELTYPES_RADIO       2
#define CH_CHANNELTYPES_DATA        3
#define CH_CHANNELTYPES_TVRADIO     4

struct TChannelListConfig
{
    char        SatID[5];		    //-- Not used at the moment!
    short       LastChannelIndex;	//--Index of last-channel in DB
    short       Reserved;
    short       ComboIndex;		    //--Index of sat-combobox
    short       ScrambleMode;		//--Filter for scrambled channels
    short       ViewMode;           //--Filter for how to sort channels
    short       ChannelTypes;		//--Filter for channel-type
};

struct TAudio
{
    short        audStream[16];		//--Audio PID
    short        audType[16];		//--Audio Flag for example AC3
    short        audAutoVol;		//--Autovolume in percent: negative value decreases volume, positive value increases volume of channel
    short        audCurrent;
    short        audCount;
};

struct TCA
{
    short        caType[16];		//---Max ECM, EMM, CA Pids: 16
    short        caECMPid[16];
    short        caECMCurrent;
    short        caECMCount;
    short        caEMMPid[16];
    short        caEMMCurrent;
    short        caEMMCount;
};

struct TChannel
{
    char          chName[40];
    char          chProv[40];
    char          chID[40];
    short         chFav;		    //--Index of favorite-group [1...30]. If 0 no Favorites-group is selected
    char          chSatID[5];
    DWORD         chFreq;
    DWORD         chSymbolRate;
    DWORD         chLOF;
    short         chPolarity;		//--13: Vertical,18: Horizontal
    short         chType;		    //--1: TV,2: Radio,3: Data
    bool          chScrambled;
    bool          ch22Khz;
    short         chInversion;
    short         chViterbi;
    short         chPMT;
    short         chTeleText;
    short         chPCR;
    short         chVideo;
    short         chTID;
    short         chNID;
    short         chSID;
    TAudio        chAudio;
    TCA           chCA;
    TDateTime     chLastUpdate;		//--DateTime of updated channel
    short         chNr;			    //--Channel-Nr. If 0 no ChanellNr. available
    short         chDBIndex;		//--Index of channel in DB
    short         chTPChIndex;		//--Index of Channel in TP_INFO of DVBCore used for updating channel
    short         chAllowUpdate;	//-- Not used at the moment!
    short         chReserved;		//-- Not used at the moment! For future releases!
};

//--------Size of whole TDBChannelList: 3.680.944 Bytes

struct TDBChannelList
{
    short               DBMajorVer;		            //--Major Version of DB
    short               DBMinorVer;		            //--Minor version of DB
    short               DBChannelCount;		        //-- Not used at the moment!
    short               DBFavCount;		            //--Amount of favorite-groups-names in DB
    char                DBFavorites[30][30];	    //--To access a favorite-group-name use for example this: DBFavorites[2] (third entry) (max length of every entry 30 bytes)
    TDateTime           DBCreated;		            //--Creating date and time of DB
    TChannelListConfig  DBListConfig;		        //--Filter settings of channels
    TChannel            Channel[10000];		        //--Channel array (max. 10000 channels!)
};


//---------------------------------------------------------------------------
#endif