OSDN Git Service

LinGui: Picture Filter enhancements
[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         const gboolean hide;
15 } dependency_t;
16
17 static dependency_t dep_map[] =
18 {
19         {"title", "queue_add", "none", TRUE, FALSE},
20         {"title", "queue_add_menu", "none", TRUE, FALSE},
21         {"title", "show_picture", "none", TRUE, FALSE},
22         {"title", "show_preview_menu", "none", TRUE, FALSE},
23         {"title", "preview_frame", "none", TRUE, FALSE},
24         {"title", "picture_label", "none", TRUE, FALSE},
25         {"title", "picture_tab", "none", TRUE, FALSE},
26         {"title", "chapters_label", "none", TRUE, FALSE},
27         {"title", "chapters_tab", "none", TRUE, FALSE},
28         {"title", "title", "none", TRUE, FALSE},
29         {"title", "start_chapter", "none", TRUE, FALSE},
30         {"title", "end_chapter", "none", TRUE, FALSE},
31         {"vquality_type_bitrate", "VideoAvgBitrate", "TRUE", FALSE, FALSE},
32         {"vquality_type_target", "VideoTargetSize", "TRUE", FALSE, FALSE},
33         {"vquality_type_constant", "VideoQualitySlider", "TRUE", FALSE, FALSE},
34         {"vquality_type_constant", "constant_rate_factor", "TRUE", FALSE, FALSE},
35         {"vquality_type_constant", "VideoTwoPass", "TRUE", TRUE, FALSE},
36         {"vquality_type_constant", "VideoTurboTwoPass", "TRUE", TRUE, FALSE},
37         {"VideoTwoPass", "VideoTurboTwoPass", "TRUE", FALSE, FALSE},
38         {"FileFormat", "Mp4LargeFile", "mp4|m4v", FALSE, TRUE},
39         {"FileFormat", "Mp4HttpOptimize", "mp4|m4v", FALSE, TRUE},
40         {"FileFormat", "Mp4iPodCompatible", "mp4|m4v", FALSE, TRUE},
41         {"PictureDecomb", "PictureDeinterlace", "none", FALSE, FALSE},
42         {"PictureDecomb", "PictureDeinterlaceCustom", "none", FALSE, TRUE},
43         {"PictureDeinterlace", "PictureDeinterlaceCustom", "custom", FALSE, TRUE},
44         {"PictureDenoise", "PictureDenoiseCustom", "custom", FALSE, TRUE},
45         {"PictureDecomb", "PictureDecombCustom", "custom", FALSE, TRUE},
46         {"PictureDetelecine", "PictureDetelecineCustom", "custom", FALSE, TRUE},
47         {"PictureAutoCrop", "PictureTopCrop", "FALSE", FALSE, FALSE},
48         {"PictureAutoCrop", "PictureBottomCrop", "FALSE", FALSE, FALSE},
49         {"PictureAutoCrop", "PictureLeftCrop", "FALSE", FALSE, FALSE},
50         {"PictureAutoCrop", "PictureRightCrop", "FALSE", FALSE, FALSE},
51         {"autoscale", "scale_width", "FALSE", FALSE, FALSE},
52         {"autoscale", "scale_height", "FALSE", FALSE, FALSE},
53         {"anamorphic", "PictureKeepRatio", "FALSE", FALSE, FALSE},
54         // "CHECK" is a dummy value that forces scale_height deps to
55         // be re-evaluated whenever anamorphic changes
56         {"anamorphic", "scale_height", "CHECK", TRUE, FALSE},
57         {"PictureKeepRatio", "scale_height", "FALSE", FALSE, FALSE},
58         {"VideoEncoder", "x264_tab", "x264", FALSE, FALSE},
59         {"VideoEncoder", "x264_tab_label", "x264", FALSE, FALSE},
60         {"VideoEncoder", "Mp4iPodCompatible", "x264", FALSE, FALSE},
61         {"VideoEncoder", "directqp", "x264|ffmpeg", FALSE, FALSE},
62         {"AudioEncoder", "AudioBitrate", "ac3|dts", TRUE, FALSE},
63         {"AudioEncoder", "AudioSamplerate", "ac3|dts", TRUE, FALSE},
64         {"AudioEncoder", "AudioMixdown", "ac3|dts", TRUE, FALSE},
65         {"AudioEncoder", "AudioTrackDRCSlider", "ac3|dts", TRUE, FALSE},
66         {"x264_bframes", "x264_weighted_bframes", "0", TRUE, FALSE},
67         {"x264_bframes", "x264_bpyramid", "<2", TRUE, FALSE},
68         {"x264_bframes", "x264_direct", "0", TRUE, FALSE},
69         {"x264_refs", "x264_mixed_refs", "<2", TRUE, FALSE},
70         {"x264_cabac", "x264_trellis", "TRUE", FALSE, FALSE},
71         {"ChapterMarkers", "chapters_list", "TRUE", FALSE, FALSE},
72         {"use_source_name", "chapters_in_destination", "TRUE", FALSE, FALSE},
73         {"use_source_name", "title_no_in_destination", "TRUE", FALSE, FALSE},
74 };
75
76 int
77 main(gint argc, gchar *argv[])
78 {
79         gint ii, jj;
80         GValue *top;
81         gint count = sizeof(dep_map) / sizeof(dependency_t);
82
83         g_type_init();
84
85         top = ghb_dict_value_new();
86         for (ii = 0; ii < count; ii++)
87         {
88                 const gchar *name;
89                 GValue *array;
90
91                 name = dep_map[ii].widget_name;
92                 if (ghb_dict_lookup(top, name))
93                         continue;
94                 array = ghb_array_value_new(8);
95                 for (jj = 0; jj < count; jj++)
96                 {
97                         if (strcmp(name, dep_map[jj].widget_name) == 0)
98                         {
99                                 ghb_array_append(array,
100                                         ghb_value_dup(ghb_string_value(dep_map[jj].dep_name)));
101                         }
102                 }
103                 ghb_dict_insert(top, g_strdup(name), array);
104         }
105         ghb_plist_write_file("widget_deps", top);
106
107         // reverse map
108         top = ghb_dict_value_new();
109         for (ii = 0; ii < count; ii++)
110         {
111                 const gchar *name;
112                 GValue *array;
113
114                 name = dep_map[ii].dep_name;
115                 if (ghb_dict_lookup(top, name))
116                         continue;
117                 array = ghb_array_value_new(8);
118                 for (jj = 0; jj < count; jj++)
119                 {
120                         if (strcmp(name, dep_map[jj].dep_name) == 0)
121                         {
122                                 GValue *data;
123                                 data = ghb_array_value_new(3);
124                                 ghb_array_append(data, ghb_value_dup(
125                                         ghb_string_value(dep_map[jj].widget_name)));
126                                 ghb_array_append(data, ghb_value_dup(
127                                         ghb_string_value(dep_map[jj].enable_value)));
128                                 ghb_array_append(data, ghb_value_dup(
129                                         ghb_boolean_value(dep_map[jj].disable_if_equal)));
130                                 ghb_array_append(data, ghb_value_dup(
131                                         ghb_boolean_value(dep_map[jj].hide)));
132                                 ghb_array_append(array, data);
133                         }
134                 }
135                 ghb_dict_insert(top, g_strdup(name), array);
136         }
137         ghb_plist_write_file("widget_reverse_deps", top);
138         return 0;
139 }
140