summaryrefslogtreecommitdiffstats
path: root/gtk/src/hb-backend.h
blob: 8311de9a2890702093b24a70cf872b97765985c0 (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
/*
 * 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 of the License, 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 Library 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., 51 Franklin Street, Fifth Floor Boston, MA 02110-1301,  USA
 */

#if !defined(_HBBACKEND_H_)
#define _HBBACKEND_H_

#include "settings.h"
#include "hb.h"
#include "lang.h"

enum
{
    GHB_ERROR_NONE,
    GHB_ERROR_CANCELED,
    GHB_ERROR_FAIL,
};

typedef struct
{
    gint state;

    // SCANNING
    gint title_count;
    gint title_cur;
    gint preview_count;
    gint preview_cur;

    // WORKING
    gint unique_id;
    gint job_cur;
    gint job_count;
    gdouble progress;
    gdouble rate_cur;
    gdouble rate_avg;
    gint hours;
    gint minutes;
    gint seconds;
    gint error;
} ghb_instance_status_t;

typedef struct
{
    ghb_instance_status_t scan;
    ghb_instance_status_t queue;
} ghb_status_t;

#define GHB_PIC_KEEP_WIDTH          0x01
#define GHB_PIC_KEEP_HEIGHT         0x02
#define GHB_PIC_KEEP_DISPLAY_WIDTH  0x04
#define GHB_PIC_KEEP_DISPLAY_HEIGHT 0x08
#define GHB_PIC_KEEP_DAR            0x10
#define GHB_PIC_KEEP_PAR            0x20
#define GHB_PIC_USE_MAX             0x40

#define GHB_AUDIO_SAMPLERATE 1
#define GHB_AUDIO_BITRATE 2
#define GHB_FRAMERATE 3

const gchar* ghb_version(void);
void ghb_vquality_range(
    signal_user_data_t *ud,
    float *min,
    float *max,
    float *step,
    float *page,
    gint *digits,
    int *direction);
float ghb_vquality_default(signal_user_data_t *ud);

void ghb_combo_init(signal_user_data_t *ud);
void ghb_backend_init(gint debug);
void ghb_backend_close(void);
void ghb_add_job(GValue *js, gint unique_id);
void ghb_remove_job(gint unique_id);
void ghb_start_queue(void);
void ghb_stop_queue(void);
void ghb_pause_queue(void);

void ghb_add_live_job(GValue *js, gint unique_id);
void ghb_start_live_encode();
void ghb_stop_live_encode();

void ghb_clear_scan_state(gint state);
void ghb_clear_queue_state(gint state);

void ghb_set_state(gint state);
gint ghb_get_scan_state();
gint ghb_get_queue_state();
void ghb_get_status(ghb_status_t *status);
void ghb_track_status(void);
void ghb_backend_scan(const gchar *path, gint titleindex, gint preview_count, guint64 min_duration);
void ghb_backend_scan_stop();
void ghb_backend_queue_scan(const gchar *path, gint titleindex);
hb_title_t* ghb_get_title_info(gint titleindex);
hb_list_t * ghb_get_title_list();
void ghb_par_init(signal_user_data_t *ud);
void ghb_set_scale(signal_user_data_t *ud, gint mode);
void ghb_set_scale_settings(GValue *settings, gint mode);
void ghb_picture_settings_deps(signal_user_data_t *ud);
GValue* ghb_get_chapters(gint titleindex);
gint64 ghb_get_chapter_duration(gint ti, gint chap);
gint64 ghb_get_chapter_start(gint ti, gint chap);
void ghb_part_duration(gint tt, gint sc, gint ec, gint *hh, gint *mm, gint *ss);
gint ghb_get_best_mix(hb_audio_config_t *aconfig, gint acodec, gint mix);
gboolean ghb_ac3_in_audio_list(const GValue *audio_list);
gboolean ghb_audio_is_passthru(gint acodec);
gboolean ghb_audio_can_passthru(gint acodec);
gint ghb_get_default_acodec(void);
hb_audio_config_t* ghb_get_scan_audio_info(gint titleindex, gint audioindex);
void ghb_set_bitrate_opts(
    GtkBuilder *builder, gint first_rate, gint last_rate, gint extra_rate);
void ghb_grey_combo_options(signal_user_data_t *ud);
void ghb_update_ui_combo_box(
    signal_user_data_t *ud, const gchar *name, gint user_data, gboolean all);
const gchar* ghb_get_source_audio_lang(hb_title_t *title, gint track);
gint ghb_find_audio_track(hb_title_t *title, const gchar *lang, int start);
const gchar* ghb_audio_track_description(gint track, int titleindex);
void ghb_add_all_subtitles(signal_user_data_t *ud, gint titleindex);
gint ghb_find_pref_subtitle_track(const gchar *lang);
gint ghb_find_subtitle_track(hb_title_t * title, const gchar * lang, int start);
gint ghb_pick_subtitle_track(signal_user_data_t *ud);
gint ghb_longest_title(void);
gchar* ghb_build_advanced_opts_string(GValue *settings);
GdkPixbuf* ghb_get_preview_image(
    gint titleindex, gint index, signal_user_data_t *ud,
    gint *width, gint *height);
gchar* ghb_dvd_volname(const gchar *device);
gint ghb_get_title_number(gint titleindex);
int ghb_get_title_count();
gint ghb_subtitle_track_source(GValue *settings, gint track);
const gchar* ghb_subtitle_track_lang(GValue *settings, gint track);

gboolean ghb_validate_vquality(GValue *settings);
gboolean ghb_validate_audio(GValue *settings);
gboolean ghb_validate_subtitles(GValue *settings);
gboolean ghb_validate_video(GValue *settings);
gboolean ghb_validate_filters(GValue *settings);
gboolean ghb_validate_filter_string(const gchar *str, gint max_fields);
void ghb_hb_cleanup(gboolean partial);
gint ghb_lookup_combo_int(const gchar *name, const GValue *gval);
gdouble ghb_lookup_combo_double(const gchar *name, const GValue *gval);
const gchar* ghb_lookup_combo_option(const gchar *name, const GValue *gval);
const gchar* ghb_lookup_combo_string(const gchar *name, const GValue *gval);
gchar* ghb_get_tmp_dir();
gint ghb_find_closest_audio_samplerate(gint rate);
GValue* ghb_lookup_audio_encoder_value(gint val);

void ghb_init_lang_list_box(GtkListBox *list_box);

void ghb_init_combo_box(GtkComboBox *combo);
void ghb_audio_encoder_opts_set(GtkComboBox *combo);
void ghb_audio_bitrate_opts_set(GtkComboBox *combo, gboolean extra);
void ghb_audio_bitrate_opts_filter(GtkComboBox *combo, gint first_rate, gint last_rate);
void ghb_mix_opts_set(GtkComboBox *combo);
void ghb_mix_opts_filter(GtkComboBox *combo, gint acodec);
void ghb_audio_samplerate_opts_set(GtkComboBox *combo);

int ghb_lookup_audio_lang(const GValue *glang);
const iso639_lang_t* ghb_iso639_lookup_by_int(int idx);
void ghb_update_display_aspect_label(signal_user_data_t *ud);

#endif // _HBBACKEND_H_