- add sources.
[platform/framework/web/crosswalk.git] / src / base / x11 / edid_parser_x11.h
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef BASE_X11_EDID_PARSER_X11_H_
6 #define BASE_X11_EDID_PARSER_X11_H_
7
8 #include <string>
9
10 #include "base/base_export.h"
11 #include "base/basictypes.h"
12
13 typedef unsigned long XID;
14
15 // EDID (Extended Display Identification Data) is a format for monitor
16 // metadata. This provides a parser for the data and an interface to get it
17 // from XRandR.
18
19 namespace base {
20
21 // Get the EDID data from the |output| and stores to |prop|. |nitem| will store
22 // the number of characters |prop| will have. It doesn't take the ownership of
23 // |prop|, so caller must release it by XFree().
24 // Returns true if EDID property is successfully obtained. Otherwise returns
25 // false and does not touch |prop| and |nitems|.
26 BASE_EXPORT bool GetEDIDProperty(XID output,
27                                  unsigned long* nitems,
28                                  unsigned char** prop);
29
30 // Gets the EDID data from |output| and generates the display id through
31 // |GetDisplayIdFromEDID|.
32 BASE_EXPORT bool GetDisplayId(XID output, size_t index,
33                               int64* display_id_out);
34
35 // Generates the display id for the pair of |prop| with |nitems| length and
36 // |index|, and store in |display_id_out|. Returns true if the display id is
37 // successfully generated, or false otherwise.
38 BASE_EXPORT bool GetDisplayIdFromEDID(const unsigned char* prop,
39                                       unsigned long nitems,
40                                       size_t index,
41                                       int64* display_id_out);
42
43 // Parses |prop| as EDID data and stores extracted data into |manufacturer_id|
44 // and |human_readable_name| and returns true. NULL can be passed for unwanted
45 // output parameters. Some devices (especially internal displays) may not have
46 // the field for |human_readable_name|, and it will return true in that case.
47 BASE_EXPORT bool ParseOutputDeviceData(const unsigned char* prop,
48                                        unsigned long nitems,
49                                        uint16* manufacturer_id,
50                                        std::string* human_readable_name);
51
52 }  // namespace base
53
54 #endif  // BASE_X11_EDID_PARSER_X11_H_