OSDN Git Service

LinGui: vfr checkbox is toast.
[handbrake-jp/handbrake-jp-git.git] / gtk / src / makedeps.c
1 #include <glib.h>
2 #include <glib-object.h>
3 #include <glib/gstdio.h>
4 #include <string.h>
5 #include "values.h"
6 #include "plist.h"
7
8 typedef struct
9 {
10         const gchar *widget_name;
11         const gchar *dep_name;
12         const gchar *enable_value;
13         const gboolean disable_if_equal;
14 } dependency_t;
15
16 static dependency_t dep_map[] =
17 {
18         {"title", "queue_add", "none", TRUE},
19         {"title", "queue_add_menu", "none", TRUE},
20         {"title", "preview_button", "none", TRUE},
21         {"title", "show_preview_menu", "none", TRUE},
22         {"title", "preview_frame", "none", TRUE},
23         {"title", "picture_label", "none", TRUE},
24         {"title", "picture_tab", "none", TRUE},
25         {"title", "chapters_label", "none", TRUE},
26         {"title", "chapters_tab", "none", TRUE},
27         {"title", "title", "none", TRUE},
28         {"title", "start_chapter", "none", TRUE},
29         {"title", "end_chapter", "none", TRUE},
30         {"vquality_type_bitrate", "video_bitrate", "TRUE", FALSE},
31         {"vquality_type_target", "video_target_size", "TRUE", FALSE},
32         {"vquality_type_constant", "video_quality", "TRUE", FALSE},
33         {"vquality_type_constant", "constant_rate_factor", "TRUE", FALSE},
34         {"vquality_type_constant", "two_pass", "TRUE", TRUE},
35         {"vquality_type_constant", "turbo", "TRUE", TRUE},
36         {"two_pass", "turbo", "TRUE", FALSE},
37         {"container", "large_mp4", "mp4|m4v", FALSE},
38         {"container", "http_optimize_mp4", "mp4|m4v", FALSE},
39         {"container", "ipod_file", "mp4|m4v", FALSE},
40         {"decomb", "deinterlace", "TRUE", TRUE},
41         {"decomb", "tweak_deinterlace", "TRUE", TRUE},
42         {"autocrop", "crop_top", "FALSE", FALSE},
43         {"autocrop", "crop_bottom", "FALSE", FALSE},
44         {"autocrop", "crop_left", "FALSE", FALSE},
45         {"autocrop", "crop_right", "FALSE", FALSE},
46         {"autoscale", "scale_width", "FALSE", FALSE},
47         {"autoscale", "scale_height", "FALSE", FALSE},
48         {"anamorphic", "keep_aspect", "FALSE", FALSE},
49         {"anamorphic", "scale_height", "FALSE", FALSE},
50         {"keep_aspect", "scale_height", "FALSE", FALSE},
51         {"video_codec", "x264_tab", "x264", FALSE},
52         {"video_codec", "x264_tab_label", "x264", FALSE},
53         {"video_codec", "ipod_file", "x264", FALSE},
54         {"audio_codec", "audio_bitrate", "ac3", TRUE},
55         {"audio_codec", "audio_rate", "ac3", TRUE},
56         {"audio_codec", "audio_mix", "ac3", TRUE},
57         {"audio_codec", "audio_drc", "ac3", TRUE},
58         {"x264_bframes", "x264_weighted_bframes", "0", TRUE},
59         {"x264_bframes", "x264_brdo", "0", TRUE},
60         {"x264_bframes", "x264_bime", "0", TRUE},
61         {"x264_bframes", "x264_bpyramid", "<2", TRUE},
62         {"x264_bframes", "x264_direct", "0", TRUE},
63         {"x264_refs", "x264_mixed_refs", "<2", TRUE},
64         {"x264_cabac", "x264_trellis", "TRUE", FALSE},
65         {"x264_subme", "x264_brdo", "<6", TRUE},
66         {"x264_analyse", "x264_direct", "none", TRUE},
67         {"x264_me", "x264_merange", "umh|esa", FALSE},
68         {"chapter_markers", "chapters_list", "TRUE", FALSE},
69         {"use_source_name", "chapters_in_destination", "TRUE", FALSE},
70 };
71
72 int
73 main(gint argc, gchar *argv[])
74 {
75         gint ii, jj;
76         GValue *top;
77         gint count = sizeof(dep_map) / sizeof(dependency_t);
78
79         g_type_init();
80
81         top = ghb_dict_value_new();
82         for (ii = 0; ii < count; ii++)
83         {
84                 const gchar *name;
85                 GValue *array;
86
87                 name = dep_map[ii].widget_name;
88                 if (ghb_dict_lookup(top, name))
89                         continue;
90                 array = ghb_array_value_new(8);
91                 for (jj = 0; jj < count; jj++)
92                 {
93                         if (strcmp(name, dep_map[jj].widget_name) == 0)
94                         {
95                                 ghb_array_append(array,
96                                         ghb_value_dup(ghb_string_value(dep_map[jj].dep_name)));
97                         }
98                 }
99                 ghb_dict_insert(top, g_strdup(name), array);
100         }
101         ghb_plist_write_file("widget_deps", top);
102
103         // reverse map
104         top = ghb_dict_value_new();
105         for (ii = 0; ii < count; ii++)
106         {
107                 const gchar *name;
108                 GValue *array;
109
110                 name = dep_map[ii].dep_name;
111                 if (ghb_dict_lookup(top, name))
112                         continue;
113                 array = ghb_array_value_new(8);
114                 for (jj = 0; jj < count; jj++)
115                 {
116                         if (strcmp(name, dep_map[jj].dep_name) == 0)
117                         {
118                                 GValue *data;
119                                 data = ghb_array_value_new(3);
120                                 ghb_array_append(data, ghb_value_dup(
121                                         ghb_string_value(dep_map[jj].widget_name)));
122                                 ghb_array_append(data, ghb_value_dup(
123                                         ghb_string_value(dep_map[jj].enable_value)));
124                                 ghb_array_append(data, ghb_value_dup(
125                                         ghb_boolean_value(dep_map[jj].disable_if_equal)));
126                                 ghb_array_append(array, data);
127                         }
128                 }
129                 ghb_dict_insert(top, g_strdup(name), array);
130         }
131         ghb_plist_write_file("widget_reverse_deps", top);
132         return 0;
133 }
134