OSDN Git Service

LinGui: fix a display problem in the audio list
[handbrake-jp/handbrake-jp-git.git] / gtk / src / hb-backend.h
1 /*
2  * This program is free software; you can redistribute it and/or modify
3  * it under the terms of the GNU General Public License as published by
4  * the Free Software Foundation; either version 2 of the License, or
5  * (at your option) any later version.
6  * 
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10  * GNU Library General Public License for more details.
11  * 
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software
14  * Foundation, Inc., 51 Franklin Street, Fifth Floor Boston, MA 02110-1301,  USA
15  */
16  
17 #if !defined(_HBBACKEND_H_)
18 #define _HBBACKEND_H_
19
20 #include "settings.h"
21
22 enum
23 {
24         GHB_ERROR_NONE,
25         GHB_ERROR_CANCELED,
26         GHB_ERROR_FAIL,
27 };
28
29 typedef struct
30 {
31         gint state;
32
33         // SCANNING
34         gint title_count;
35         gint title_cur;
36
37         // WORKING
38         gint unique_id;
39         gint job_cur;
40         gint job_count;
41         gdouble progress;
42         gdouble rate_cur;
43         gdouble rate_avg;
44         gint hours;
45         gint minutes;
46         gint seconds;
47         gint error;
48 } ghb_instance_status_t;
49
50 typedef struct
51 {
52         ghb_instance_status_t scan;
53         ghb_instance_status_t queue;
54 } ghb_status_t;
55
56 #define GHB_PIC_KEEP_WIDTH          0x01
57 #define GHB_PIC_KEEP_HEIGHT         0x02
58 #define GHB_PIC_KEEP_DISPLAY_WIDTH  0x04
59 #define GHB_PIC_KEEP_DISPLAY_HEIGHT 0x08
60 #define GHB_PIC_KEEP_DAR            0x10
61 #define GHB_PIC_KEEP_PAR            0x20
62 #define GHB_PIC_USE_MAX             0x40
63
64 typedef struct
65 {
66         gchar *path;
67         gchar *name;
68         gint index;
69         gint type;
70         gint width;
71         gint height;
72         gint crop[4];
73         gint num_chapters;
74         gint rate;
75         gint rate_base;
76         gint interlaced;
77         gint aspect_n;
78         gint aspect_d;
79         gint hours;
80         gint minutes;
81         gint seconds;
82         gint64 duration;
83         gint angle_count;
84 } ghb_title_info_t;
85
86 typedef struct
87 {
88         gint codec;
89         gint bitrate;
90         gint samplerate;
91 } ghb_audio_info_t;
92
93 #define GHB_AUDIO_SAMPLERATE 1
94 #define GHB_AUDIO_BITRATE 2
95 #define GHB_FRAMERATE 3
96
97 const gchar* ghb_version(void);
98 void ghb_vquality_range(
99         signal_user_data_t *ud, 
100         gdouble *min, 
101         gdouble *max,
102         gdouble *step,
103         gdouble *page,
104         gint *digits,
105         gboolean *inverted);
106 //const gchar* ghb_get_rate_string(gint rate, gint type);
107 void ghb_combo_init(signal_user_data_t *ud);
108 void ghb_backend_init(gint debug);
109 void ghb_backend_close(void);
110 void ghb_add_job(GValue *js, gint unique_id);
111 void ghb_remove_job(gint unique_id);
112 void ghb_start_queue(void);
113 void ghb_stop_queue(void);
114 void ghb_pause_queue(void);
115
116 void ghb_add_live_job(GValue *js, gint unique_id);
117 void ghb_start_live_encode();
118 void ghb_stop_live_encode();
119
120 void ghb_clear_scan_state(gint state);
121 void ghb_clear_queue_state(gint state);
122
123 void ghb_set_state(gint state);
124 gint ghb_get_scan_state();
125 gint ghb_get_queue_state();
126 void ghb_get_status(ghb_status_t *status);
127 void ghb_track_status(void);
128 void ghb_backend_scan(const gchar *path, gint titleindex, gint preview_count, guint64 min_duration);
129 void ghb_backend_scan_stop();
130 void ghb_backend_queue_scan(const gchar *path, gint titleindex);
131 gboolean ghb_get_title_info(ghb_title_info_t *tinfo, gint titleindex);
132 void ghb_par_init(signal_user_data_t *ud);
133 void ghb_set_scale(signal_user_data_t *ud, gint mode);
134 GValue* ghb_get_chapters(gint titleindex);
135 void ghb_get_chapter_duration(gint ti, gint ii, gint *hh, gint *mm, gint *ss);
136 void ghb_part_duration(gint tt, gint sc, gint ec, gint *hh, gint *mm, gint *ss);
137 gint ghb_get_best_mix(gint titleindex, gint track, gint acodec, gint mix);
138 gboolean ghb_ac3_in_audio_list(const GValue *audio_list);
139 gboolean ghb_audio_is_passthru(gint acodec);
140 gboolean ghb_audio_can_passthru(gint acodec);
141 gint ghb_get_default_acodec(void);
142 gboolean ghb_get_audio_info(
143         ghb_audio_info_t *ainfo, gint titleindex, gint audioindex);
144 void ghb_set_passthru_bitrate_opts(GtkBuilder *builder, gint bitrate);
145 void ghb_set_default_bitrate_opts(
146         GtkBuilder *builder, gint first_rate, gint last_rate);
147 void ghb_grey_combo_options(GtkBuilder *builder);
148 void ghb_update_ui_combo_box(
149         signal_user_data_t *ud, const gchar *name, gint user_data, gboolean all);
150 gchar* ghb_get_source_audio_lang(gint titleindex, gint track);
151 gint ghb_find_audio_track(
152         gint titleindex, const gchar *lang, gint acodec, 
153         gint fallback_acodec, GHashTable *track_indices);
154 void ghb_add_all_subtitles(signal_user_data_t *ud, gint titleindex);
155 gint ghb_find_pref_subtitle_track(const gchar *lang);
156 gint ghb_find_subtitle_track(
157         gint titleindex, const gchar *lang, gboolean burn, 
158         gboolean force, gint source, GHashTable *track_indices);
159 gint ghb_pick_subtitle_track(signal_user_data_t *ud);
160 gint ghb_find_cc_track(gint titleindex);
161 gint ghb_longest_title(void);
162 gchar* ghb_build_x264opts_string(GValue *settings);
163 GdkPixbuf* ghb_get_preview_image(
164         gint titleindex, gint index, signal_user_data_t *ud,
165         gint *width, gint *height);
166 gint ghb_calculate_target_bitrate(GValue *settings, gint titleindex);
167 gchar* ghb_dvd_volname(const gchar *device);
168 gint ghb_get_title_number(gint titleindex);
169 gint ghb_subtitle_track_source(signal_user_data_t *ud, gint track);
170 const char* ghb_subtitle_track_source_name(signal_user_data_t *ud, gint track);
171 const char* ghb_subtitle_source_name(gint source);
172 gchar* ghb_subtitle_track_lang(signal_user_data_t *ud, gint track);
173
174 gboolean ghb_validate_vquality(GValue *settings);
175 gboolean ghb_validate_audio(signal_user_data_t *ud);
176 gboolean ghb_validate_subtitles(signal_user_data_t *ud);
177 gboolean ghb_validate_video(signal_user_data_t *ud);
178 gboolean ghb_validate_filters(signal_user_data_t *ud);
179 gboolean ghb_validate_filter_string(const gchar *str, gint max_fields);
180 void ghb_hb_cleanup(gboolean partial);
181 gint ghb_lookup_combo_int(const gchar *name, const GValue *gval);
182 gdouble ghb_lookup_combo_double(const gchar *name, const GValue *gval);
183 const gchar* ghb_lookup_combo_option(const gchar *name, const GValue *gval);
184 const gchar* ghb_lookup_combo_string(const gchar *name, const GValue *gval);
185 gchar* ghb_get_tmp_dir();
186 gint ghb_select_audio_codec(GValue *settings, gint acodec, gint track);
187 const gchar* ghb_select_audio_codec_str(GValue *settings, gint acodec, gint track);
188 gint ghb_find_closest_audio_bitrate(gint codec, gint rate);
189 gint ghb_find_closest_audio_rate(gint rate);
190 gint ghb_get_best_audio_bitrate(gint acodec, gint br, gint channels);
191 gint ghb_get_default_audio_bitrate(gint acodec, gint sr, gint br, gint channels);
192 GValue* ghb_lookup_acodec_value(gint val);
193
194 #endif // _HBBACKEND_H_