Imported Upstream version 2.2.0
[deb_libcec.git] / src / lib / platform / adl / adl-edid.h
CommitLineData
cbbe90dd
JB
1#pragma once
2/*
3 * This file is part of the libCEC(R) library.
4 *
5 * libCEC(R) is Copyright (C) 2011-2013 Pulse-Eight Limited. All rights reserved.
6 * libCEC(R) is an original work, containing original code.
7 *
8 * libCEC(R) is a trademark of Pulse-Eight Limited.
9 *
10 * This program is dual-licensed; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 *
24 *
25 * Alternatively, you can license this library under a commercial license,
26 * please contact Pulse-Eight Licensing for more information.
27 *
28 * For more information contact:
29 * Pulse-Eight Licensing <license@pulse-eight.com>
30 * http://www.pulse-eight.com/
31 * http://www.pulse-eight.net/
32 */
33
34#define HAS_ADL_EDID_PARSER
35
36#include "lib/platform/os.h"
37#include "lib/platform/util/edid.h"
38
39#if !defined(__WINDOWS__)
40#include "adl_sdk.h"
41#include <dlfcn.h>
42#include <stdlib.h>
43#include <string.h>
44#include <unistd.h>
45
46typedef void* ADL_LIB_HANDLE;
47
48#else
49#include <windows.h>
50#include <tchar.h>
51#include "adl_sdk.h"
52
53typedef HINSTANCE ADL_LIB_HANDLE;
54#endif
55
56typedef int (*ADL_MAIN_CONTROL_CREATE ) (ADL_MAIN_MALLOC_CALLBACK, int);
57typedef int (*ADL_MAIN_CONTROL_DESTROY) (void);
58typedef int (*ADL_ADAPTER_NUMBEROFADAPTERS_GET) (int*);
59typedef int (*ADL_ADAPTER_ADAPTERINFO_GET) (LPAdapterInfo, int);
60typedef int (*ADL_DISPLAY_DISPLAYINFO_GET) (int, int *, ADLDisplayInfo **, int);
61typedef int (*ADL_DISPLAY_EDIDDATA_GET) (int, int, ADLDisplayEDIDData *);
62
63#define ADL_DISPLAY_CONNECTED (ADL_DISPLAY_DISPLAYINFO_DISPLAYCONNECTED | ADL_DISPLAY_DISPLAYINFO_DISPLAYMAPPED)
64
65namespace PLATFORM
66{
67 class CADLEdidParser
68 {
69 public:
70 CADLEdidParser(void);
71 virtual ~CADLEdidParser(void);
72
73 uint16_t GetPhysicalAddress(void);
74 int GetNumAdapters(void);
75
76 private:
77 bool LibOpen(void) { return m_bOpen; }
78 void Initialise(void);
79 bool OpenLibrary(void);
80 void CloseLibrary(void);
81
82 LPAdapterInfo GetAdapterInfo(int iNumAdapters);
83 bool GetAdapterEDID(int iAdapterIndex, int iDisplayIndex, ADLDisplayEDIDData *data);
84
85 bool m_bOpen;
86 ADL_LIB_HANDLE m_handle;
87
88 ADL_MAIN_CONTROL_CREATE ADL_Main_Control_Create;
89 ADL_MAIN_CONTROL_DESTROY ADL_Main_Control_Destroy;
90 ADL_ADAPTER_NUMBEROFADAPTERS_GET ADL_Adapter_NumberOfAdapters_Get;
91 ADL_ADAPTER_ADAPTERINFO_GET ADL_Adapter_AdapterInfo_Get;
92 ADL_DISPLAY_DISPLAYINFO_GET ADL_Display_DisplayInfo_Get;
93 ADL_DISPLAY_EDIDDATA_GET ADL_Display_EdidData_Get;
94 };
95}