Barely-functioning GL playback with new arrangement.
[dcpomatic.git] / src / lib / cross.h
1 /*
2     Copyright (C) 2012-2018 Carl Hetherington <cth@carlh.net>
3
4     This file is part of DCP-o-matic.
5
6     DCP-o-matic is free software; you can redistribute it and/or modify
7     it under the terms of the GNU General Public License as published by
8     the Free Software Foundation; either version 2 of the License, or
9     (at your option) any later version.
10
11     DCP-o-matic is distributed in the hope that it will be useful,
12     but WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14     GNU General Public License for more details.
15
16     You should have received a copy of the GNU General Public License
17     along with DCP-o-matic.  If not, see <http://www.gnu.org/licenses/>.
18
19 */
20
21 /** @file  src/lib/cross.h
22  *  @brief Cross-platform compatibility code.
23  */
24
25 #ifndef DCPOMATIC_CROSS_H
26 #define DCPOMATIC_CROSS_H
27
28 #ifdef DCPOMATIC_OSX
29 #include <IOKit/pwr_mgt/IOPMLib.h>
30 #endif
31 #include <boost/filesystem.hpp>
32 #include <boost/thread/mutex.hpp>
33
34 #ifdef DCPOMATIC_WINDOWS
35 #define WEXITSTATUS(w) (w)
36 #endif
37
38 class Log;
39 struct AVIOContext;
40
41 void dcpomatic_sleep_seconds (int);
42 void dcpomatic_sleep_milliseconds (int);
43 extern std::string cpu_info ();
44 extern void run_ffprobe (boost::filesystem::path, boost::filesystem::path);
45 extern std::list<std::pair<std::string, std::string> > mount_info ();
46 extern boost::filesystem::path openssl_path ();
47 #ifdef DCPOMATIC_OSX
48 extern boost::filesystem::path app_contents ();
49 #endif
50 #ifdef DCPOMATIC_WINDOWS
51 extern void maybe_open_console ();
52 #endif
53 extern boost::filesystem::path shared_path ();
54 extern FILE * fopen_boost (boost::filesystem::path, std::string);
55 extern int dcpomatic_fseek (FILE *, int64_t, int);
56 extern void start_batch_converter (boost::filesystem::path dcpomatic);
57 extern void start_player (boost::filesystem::path dcpomatic);
58 extern uint64_t thread_id ();
59 extern int avio_open_boost (AVIOContext** s, boost::filesystem::path file, int flags);
60 extern boost::filesystem::path home_directory ();
61 extern std::string command_and_read (std::string cmd);
62 extern bool running_32_on_64 ();
63
64 /** @class Waker
65  *  @brief A class which tries to keep the computer awake on various operating systems.
66  *
67  *  Create a Waker to prevent sleep, and call nudge() every so often (every minute or so).
68  *  Destroy the Waker to allow sleep again.
69  */
70 class Waker
71 {
72 public:
73         Waker ();
74         ~Waker ();
75
76         void nudge ();
77
78 private:
79         boost::mutex _mutex;
80 #ifdef DCPOMATIC_OSX
81         IOPMAssertionID _assertion_id;
82 #endif
83 };
84
85 #endif