Remove unused methods.
[dcpomatic.git] / src / lib / util.h
1 /*
2     Copyright (C) 2012-2020 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
22 /** @file src/util.h
23  *  @brief Some utility functions and classes.
24  */
25
26
27 #ifndef DCPOMATIC_UTIL_H
28 #define DCPOMATIC_UTIL_H
29
30
31 #include "audio_mapping.h"
32 #include "dcpomatic_time.h"
33 #include "pixel_quanta.h"
34 #include "types.h"
35 #include <dcp/atmos_asset.h>
36 #include <dcp/decrypted_kdm.h>
37 #include <dcp/util.h>
38 #include <dcp/subtitle_image.h>
39 #include <boost/optional.hpp>
40 #include <boost/filesystem.hpp>
41 #include <boost/date_time/gregorian/gregorian.hpp>
42 #include <string>
43 #include <map>
44 #include <vector>
45
46 #undef check
47
48
49 namespace dcp {
50         class PictureAsset;
51         class SoundAsset;
52         class SubtitleAsset;
53 }
54
55 extern std::string program_name;
56 extern bool is_batch_converter;
57
58 struct AVSubtitle;
59 class AudioBuffers;
60 class TextDecoder;
61
62 extern std::string seconds_to_hms (int);
63 extern std::string time_to_hmsf (dcpomatic::DCPTime time, Frame rate);
64 extern std::string seconds_to_approximate_hms (int);
65 extern double seconds (struct timeval);
66 extern void dcpomatic_setup ();
67 extern void dcpomatic_setup_path_encoding ();
68 extern void dcpomatic_setup_gettext_i18n (std::string);
69 extern std::string digest_head_tail (std::vector<boost::filesystem::path>, boost::uintmax_t size);
70 extern std::string simple_digest (std::vector<boost::filesystem::path> paths);
71 extern void ensure_ui_thread ();
72 extern std::string audio_channel_name (int);
73 extern std::string short_audio_channel_name (int);
74 extern bool valid_image_file (boost::filesystem::path);
75 extern bool valid_sound_file (boost::filesystem::path);
76 extern bool valid_j2k_file (boost::filesystem::path);
77 #ifdef DCPOMATIC_WINDOWS
78 extern boost::filesystem::path mo_path ();
79 #endif
80 extern std::string tidy_for_filename (std::string);
81 extern dcp::Size fit_ratio_within (float ratio, dcp::Size);
82 extern void set_backtrace_file (boost::filesystem::path);
83 extern std::map<std::string, std::string> split_get_request (std::string url);
84 extern std::string video_asset_filename (std::shared_ptr<dcp::PictureAsset> asset, int reel_index, int reel_count, boost::optional<std::string> content_summary);
85 extern std::string audio_asset_filename (std::shared_ptr<dcp::SoundAsset> asset, int reel_index, int reel_count, boost::optional<std::string> content_summary);
86 extern std::string subtitle_asset_filename (std::shared_ptr<dcp::SubtitleAsset> asset, int reel_index, int reel_count, boost::optional<std::string> content_summary, std::string extension);
87 extern std::string atmos_asset_filename (std::shared_ptr<dcp::AtmosAsset> asset, int reel_index, int reel_count, boost::optional<std::string> content_summary);
88 extern float relaxed_string_to_float (std::string);
89 extern std::string careful_string_filter (std::string);
90 extern std::pair<int, int> audio_channel_types (std::list<int> mapped, int channels);
91 extern std::shared_ptr<AudioBuffers> remap (std::shared_ptr<const AudioBuffers> input, int output_channels, AudioMapping map);
92 extern Eyes increment_eyes (Eyes e);
93 extern size_t utf8_strlen (std::string s);
94 extern std::string day_of_week_to_string (boost::gregorian::greg_weekday d);
95 extern void emit_subtitle_image (dcpomatic::ContentTimePeriod period, dcp::SubtitleImage sub, dcp::Size size, std::shared_ptr<TextDecoder> decoder);
96 extern bool show_jobs_on_console (bool progress);
97 extern void copy_in_bits (boost::filesystem::path from, boost::filesystem::path to, std::function<void (float)>);
98 extern dcp::Size scale_for_display (dcp::Size s, dcp::Size display_container, dcp::Size film_container, PixelQuanta quanta);
99 extern dcp::DecryptedKDM decrypt_kdm_with_helpful_error (dcp::EncryptedKDM kdm);
100 extern boost::filesystem::path default_font_file ();
101 extern std::string to_upper (std::string s);
102 extern void start_of_thread (std::string name);
103 extern void capture_asdcp_logs ();
104 extern std::string error_details(boost::system::error_code ec);
105 extern bool contains_assetmap(boost::filesystem::path dir);
106
107 #endif