]> git.sesse.net Git - nageru/blob - nageru/flags.h
ad812b938431ba778286af7997245594fdda9444
[nageru] / nageru / flags.h
1 #ifndef _FLAGS_H
2 #define _FLAGS_H
3
4 #include <math.h>
5
6 #include <map>
7 #include <string>
8 #include <vector>
9
10 #include "defs.h"
11 #include "ycbcr_interpretation.h"
12
13 struct Flags {
14         int width = 1280, height = 720;
15         int min_num_cards = 2;
16         int max_num_cards = MAX_VIDEO_CARDS;
17         std::string va_display;
18         bool fake_cards_audio = false;
19         bool uncompressed_video_to_http = false;
20         bool x264_video_to_http = false;
21         bool x264_video_to_disk = false;  // Disables Quick Sync entirely. Implies x264_video_to_http == true.
22         std::vector<std::string> theme_dirs { ".", PREFIX "/share/nageru" };
23         std::string recording_dir = ".";
24         std::string theme_filename = "theme.lua";
25         bool locut_enabled = true;
26         bool gain_staging_auto = true;
27         float initial_gain_staging_db = 0.0f;
28         bool compressor_enabled = true;
29         bool limiter_enabled = true;
30         bool final_makeup_gain_auto = true;
31         bool flush_pbos = true;
32         std::string stream_mux_name = DEFAULT_STREAM_MUX_NAME;
33         bool stream_coarse_timebase = false;
34         std::string stream_audio_codec_name;  // Blank = use the same as for the recording.
35         int stream_audio_codec_bitrate = DEFAULT_AUDIO_OUTPUT_BIT_RATE;  // Ignored if stream_audio_codec_name is blank.
36         std::string x264_preset;  // Empty will be overridden by X264_DEFAULT_PRESET, unless speedcontrol is set.
37         std::string x264_tune = X264_DEFAULT_TUNE;
38         bool x264_speedcontrol = false;
39         bool x264_speedcontrol_verbose = false;
40         int x264_bitrate = -1;  // In kilobit/sec. -1 = not set = DEFAULT_X264_OUTPUT_BIT_RATE.
41         float x264_crf = HUGE_VAL;  // From 51 - QP_MAX_SPEC to 51. HUGE_VAL = not set = use x264_bitrate instead.
42         int x264_vbv_max_bitrate = -1;  // In kilobits. 0 = no limit, -1 = same as <x264_bitrate> (CBR).
43         int x264_vbv_buffer_size = -1;  // In kilobits. 0 = one-frame VBV, -1 = same as <x264_bitrate> (one-second VBV).
44         std::vector<std::string> x264_extra_param;  // In “key[,value]” format.
45         std::string v4l_output_device;  // Empty if none.
46         bool enable_alsa_output = true;
47         std::map<int, int> default_stream_mapping;
48         bool multichannel_mapping_mode = false;  // Implicitly true if input_mapping_filename is nonempty.
49         std::string input_mapping_filename;  // Empty for none.
50         std::string midi_mapping_filename;  // Empty for none.
51         bool default_hdmi_input = false;
52         bool print_video_latency = false;
53         double audio_queue_length_ms = 100.0;
54         bool ycbcr_rec709_coefficients = false;  // Will be overridden by HDMI/SDI output if ycbcr_auto_coefficients == true.
55         bool ycbcr_auto_coefficients = true;
56         int output_card = -1;
57         double output_buffer_frames = 6.0;
58         double output_slop_frames = 0.5;
59         int max_input_queue_frames = 6;
60         int http_port = DEFAULT_HTTPD_PORT;
61         int srt_port = DEFAULT_SRT_PORT;  // -1 for none.
62         bool display_timecode_in_stream = false;
63         bool display_timecode_on_stdout = false;
64         bool enable_quick_cut_keys = false;
65         bool ten_bit_input = false;
66         bool ten_bit_output = false;  // Implies x264_video_to_disk == true and x264_bit_depth == 10.
67         YCbCrInterpretation ycbcr_interpretation[MAX_VIDEO_CARDS];
68         bool transcode_audio = true;  // Kaeru only.
69         bool enable_audio = true;  // Kaeru only. If false, then transcode_audio is also false.
70         int x264_bit_depth = 8;  // Not user-settable.
71         bool use_zerocopy = false;  // Not user-settable.
72         bool fullscreen = false;
73         std::map<unsigned, unsigned> card_to_mjpeg_stream_export;  // If a card is not in the map, it is not exported.
74 };
75 extern Flags global_flags;
76
77 enum Program {
78         PROGRAM_NAGERU,
79         PROGRAM_KAERU
80 };
81 void usage(Program program);
82 void parse_flags(Program program, int argc, char * const argv[]);
83
84 #endif  // !defined(_FLAGS_H)