aboutsummaryrefslogtreecommitdiffstats
path: root/src/tvtimeconf.h
blob: 91a7b1bbe04384b7487db17765c5f86da2b68a3b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
/**
 * Copyright (C) 2002 Doug Bell <drbell@users.sourceforge.net>
 * Copyright (C) 2003 Alexander Belov <asbel@mail.ru>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2, or (at your option)
 * any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software Foundation,
 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */

#ifndef TVTIMECONF_H_INCLUDED
#define TVTIMECONF_H_INCLUDED

#include <sys/types.h>
#include <unistd.h>

#ifdef __cplusplus
extern "C" {
#endif

/**
 * The config object represents the data contained in the tvtime config
 * file and specified on the command line, and also provides an API for
 * writing information back to a config file.
 *
 * However, these are separate: the read data is immutable, and so
 * values written using this API may not be later queried by the
 * application.
 *
 * This object handles parsing the command line and therefore also
 * prints the usage message for tvtime, tvtime-command, tvtime-scanner
 * and tvtime-configure.
 */

typedef struct config_s config_t;

/**
 * Create a new config object.  This will initialize the internal data
 * structures and attempt to read the default config file from the
 * config file in $sysconfdir/tvtime/tvtime.xml and then override these
 * with the values in $HOME/.tvtime/tvtime.xml.
 */
config_t *config_new( void );

/**
 * Deletes the config file object, freeing all internal data and closing
 * the config file writer.
 */
void config_delete( config_t *ct );

/**
 * This is the API to the config file saving.  This writes the option
 * with the given name and new value to the config file in $HOME, or if
 * the --configfile parameter is used, to that file instead.
 */
void config_save( config_t *ct, const char *name, const char *value );

/**
 * Parses the command line for the 'tvtime' command.
 */
int config_parse_tvtime_command_line( config_t *ct, int argc, char **argv );

/**
 * Parses the command line for the 'tvtime-configure' command.
 */
int config_parse_tvtime_config_command_line( config_t *ct, int argc, char **argv );

/**
 * Parses the command line for the 'tvtime-scanner' command.
 */
int config_parse_tvtime_scanner_command_line( config_t *ct, int argc, char **argv );

/**
 * Returns the tvtime command corresponding to the given key event.
 */
int config_key_to_command( config_t *ct, int key );

/**
 * Returns the argument to give the tvtime command corresponding to the
 * given key event.
 */
const char *config_key_to_command_argument( config_t *ct, int key );

/**
 * Given a tvtime command, this returns the first bound key event listed
 * in the config file.
 */
int config_command_to_key( config_t *ct, int command );

/**
 * Returns the tvtime menu command corresponding to a key.  This is for
 * mapping keys when we're in menu mode, so that keys can be doubled-up
 * between menu and normal mode (for example, the arrow keys).
 */
int config_key_to_menu_command( config_t *ct, int key );

/**
 * Returns the argument to give the tvtime menu command corresponding to
 * the given key event.
 */
const char *config_key_to_menu_command_argument( config_t *ct, int key );

/**
 * Given a tvtime menu command, this returns the first bound key event
 * listed in the config file.
 */
int config_menu_command_to_key( config_t *ct, int command );

/**
 * Given a mouse button, this returns the tvtime command bound to that
 * button press event.
 */
int config_button_to_command( config_t *ct, int button );

/**
 * Given a mouse button, this returns the argument to give the tvtime
 * command bound to that button press event.
 */
const char *config_button_to_command_argument( config_t *ct, int button );

/**
 * Given a mouse button, this returns the tvtime menu command bound to
 * that button press event.
 */
int config_button_to_menu_command( config_t *ct, int button );

/**
 * Given a mouse button, this returns the argument to give the tvtime
 * menu command bound to that button press event.
 */
const char *config_button_to_menu_command_argument( config_t *ct, int button );

/**
 * The following represents all of the information stored in a tvtime
 * config file.
 */

int config_get_verbose( config_t *ct );
int config_get_send_fields( config_t *ct );
int config_get_fullscreen_position( config_t *ct );
int config_get_debug( config_t *ct );
const char *config_get_geometry( config_t *ct );
int config_get_inputwidth( config_t *ct );
int config_get_aspect( config_t *ct );
int config_get_inputnum( config_t *ct );
const char *config_get_v4l_device( config_t *ct );
const char *config_get_v4l_norm( config_t *ct );
const char *config_get_v4l_freq( config_t *ct );
const char *config_get_vbi_device( config_t *ct );
int config_get_ntsc_cable_mode( config_t *ct );
const char *config_get_timeformat( config_t *ct );
unsigned int config_get_channel_text_rgb( config_t *ct );
unsigned int config_get_other_text_rgb( config_t *ct );
int config_get_fullscreen( config_t *ct );
int config_get_alwaysontop( config_t *ct );
int config_get_priority( config_t *ct );
uid_t config_get_uid( config_t *ct );
const char *config_get_deinterlace_method( config_t *ct );
int config_get_start_channel( config_t *ct );
int config_get_prev_channel( config_t *ct );
const char *config_get_screenshot_dir( config_t *ct );
int config_get_framerate_mode( config_t *ct );
int config_get_slave_mode( config_t *ct );
const char *config_get_mixer_device( config_t *ct );
int config_get_save_restore_picture( config_t *ct );
int config_get_global_brightness( config_t *ct );
int config_get_global_contrast( config_t *ct );
int config_get_global_saturation( config_t *ct );
int config_get_global_hue( config_t *ct );
const char *config_get_audio_mode( config_t *ct );
const char *config_get_xmltv_file( config_t *ct );
const char *config_get_xmltv_language( config_t *ct );
double config_get_overscan( config_t *ct );
int config_get_check_freq_present( config_t *ct );
int config_get_usexds( config_t *ct );
int config_get_invert( config_t *ct );
int config_get_cc( config_t *ct );
int config_get_mirror( config_t *ct );
int config_get_audio_boost( config_t *ct );
int config_get_quiet_screenshots( config_t *ct );
int config_get_unmute_volume( config_t *ct );
int config_get_muted( config_t *ct );
int config_get_mute_on_exit( config_t *ct );
int config_get_show_taglines( config_t *ct );
int config_get_square_pixels( config_t *ct );
const char *config_get_alsa_inputdev( config_t *ct );
const char *config_get_alsa_outputdev( config_t *ct );

#ifdef __cplusplus
};
#endif
#endif /* TVTIMECONF_H_INCLUDED */

Privacy Policy