OSDN Git Service

Add Bluray support
[handbrake-jp/handbrake-jp-git.git] / gtk / src / widgetdeps.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", "preview_frame", "none", TRUE, FALSE},
22         {"title", "picture_label", "none", TRUE, FALSE},
23         {"title", "picture_tab", "none", TRUE, FALSE},
24         {"title", "chapters_label", "none", TRUE, FALSE},
25         {"title", "chapters_tab", "none", TRUE, FALSE},
26         {"title", "start_point", "none", TRUE, FALSE},
27         {"title", "end_point", "none", TRUE, FALSE},
28         {"title", "angle", "none", TRUE, FALSE},
29         {"title", "angle_label", "1", TRUE, FALSE},
30         {"use_dvdnav", "angle", "FALSE", TRUE, TRUE},
31         {"use_dvdnav", "angle_label", "FALSE", TRUE, TRUE},
32         {"angle_count", "angle", "1", TRUE, TRUE},
33         {"angle_count", "angle_label", "1", TRUE, TRUE},
34         {"vquality_type_bitrate", "VideoAvgBitrate", "TRUE", FALSE, FALSE},
35         {"vquality_type_target", "VideoTargetSize", "TRUE", FALSE, FALSE},
36         {"vquality_type_constant", "VideoQualitySlider", "TRUE", FALSE, FALSE},
37         {"vquality_type_constant", "VideoTwoPass", "TRUE", TRUE, FALSE},
38         {"vquality_type_constant", "VideoTurboTwoPass", "TRUE", TRUE, FALSE},
39         {"VideoTwoPass", "VideoTurboTwoPass", "TRUE", FALSE, FALSE},
40         {"FileFormat", "Mp4LargeFile", "mp4", FALSE, TRUE},
41         {"FileFormat", "Mp4HttpOptimize", "mp4", FALSE, TRUE},
42         {"FileFormat", "Mp4iPodCompatible", "mp4", FALSE, TRUE},
43         {"PictureDecombDeinterlace", "PictureDeinterlace", "TRUE", TRUE, TRUE},
44         {"PictureDecombDeinterlace", "PictureDeinterlaceCustom", "TRUE", TRUE, TRUE},
45         {"PictureDecombDeinterlace", "PictureDeinterlaceLabel", "TRUE", TRUE, TRUE},
46         {"PictureDecombDeinterlace", "PictureDecomb", "FALSE", TRUE, TRUE},
47         {"PictureDecombDeinterlace", "PictureDecombCustom", "FALSE", TRUE, TRUE},
48         {"PictureDecombDeinterlace", "PictureDecombLabel", "FALSE", TRUE, TRUE},
49         {"PictureDeinterlace", "PictureDeinterlaceCustom", "custom", FALSE, TRUE},
50         {"PictureDenoise", "PictureDenoiseCustom", "custom", FALSE, TRUE},
51         {"PictureDecomb", "PictureDecombCustom", "custom", FALSE, TRUE},
52         {"PictureDetelecine", "PictureDetelecineCustom", "custom", FALSE, TRUE},
53         {"PictureAutoCrop", "PictureTopCrop", "FALSE", FALSE, FALSE},
54         {"PictureAutoCrop", "PictureBottomCrop", "FALSE", FALSE, FALSE},
55         {"PictureAutoCrop", "PictureLeftCrop", "FALSE", FALSE, FALSE},
56         {"PictureAutoCrop", "PictureRightCrop", "FALSE", FALSE, FALSE},
57         {"VideoEncoder", "x264_tab", "x264", FALSE, FALSE},
58         {"VideoEncoder", "x264_tab_label", "x264", FALSE, FALSE},
59         {"VideoEncoder", "Mp4iPodCompatible", "x264", FALSE, FALSE},
60         {"AudioEncoderActual", "AudioBitrate", "ac3|dts", TRUE, FALSE},
61         {"AudioEncoderActual", "AudioSamplerate", "ac3|dts", TRUE, FALSE},
62         {"AudioEncoderActual", "AudioMixdown", "ac3|dts", TRUE, FALSE},
63         {"AudioEncoderActual", "AudioTrackDRCSlider", "ac3|dts", TRUE, FALSE},
64         {"AudioEncoderActual", "drc_label", "ac3|dts", TRUE, FALSE},
65         {"x264_bframes", "x264_bpyramid", "<2", TRUE, FALSE},
66         {"x264_bframes", "x264_direct", "0", TRUE, FALSE},
67         {"x264_bframes", "x264_b_adapt", "0", TRUE, FALSE},
68         {"x264_cabac", "x264_trellis", "TRUE", FALSE, FALSE},
69         {"x264_subme", "x264_psy_rd", "<6", TRUE, FALSE},
70         {"x264_subme", "x264_psy_trell", "<6", TRUE, FALSE},
71         {"x264_cabac", "x264_psy_trell", "TRUE", FALSE, FALSE},
72         {"x264_trellis", "x264_psy_trell", "0", TRUE, FALSE},
73         {"ChapterMarkers", "chapters_list", "TRUE", FALSE, FALSE},
74         {"use_source_name", "chapters_in_destination", "TRUE", FALSE, FALSE},
75         {"use_source_name", "title_no_in_destination", "TRUE", FALSE, FALSE},
76 };
77
78 int
79 main(gint argc, gchar *argv[])
80 {
81         gint ii, jj;
82         GValue *top;
83         gint count = sizeof(dep_map) / sizeof(dependency_t);
84
85         g_type_init();
86
87         top = ghb_dict_value_new();
88         for (ii = 0; ii < count; ii++)
89         {
90                 const gchar *name;
91                 GValue *array;
92
93                 name = dep_map[ii].widget_name;
94                 if (ghb_dict_lookup(top, name))
95                         continue;
96                 array = ghb_array_value_new(8);
97                 for (jj = 0; jj < count; jj++)
98                 {
99                         if (strcmp(name, dep_map[jj].widget_name) == 0)
100                         {
101                                 ghb_array_append(array,
102                                         ghb_value_dup(ghb_string_value(dep_map[jj].dep_name)));
103                         }
104                 }
105                 ghb_dict_insert(top, g_strdup(name), array);
106         }
107         ghb_plist_write_file("widget.deps", top);
108
109         // reverse map
110         top = ghb_dict_value_new();
111         for (ii = 0; ii < count; ii++)
112         {
113                 const gchar *name;
114                 GValue *array;
115
116                 name = dep_map[ii].dep_name;
117                 if (ghb_dict_lookup(top, name))
118                         continue;
119                 array = ghb_array_value_new(8);
120                 for (jj = 0; jj < count; jj++)
121                 {
122                         if (strcmp(name, dep_map[jj].dep_name) == 0)
123                         {
124                                 GValue *data;
125                                 data = ghb_array_value_new(3);
126                                 ghb_array_append(data, ghb_value_dup(
127                                         ghb_string_value(dep_map[jj].widget_name)));
128                                 ghb_array_append(data, ghb_value_dup(
129                                         ghb_string_value(dep_map[jj].enable_value)));
130                                 ghb_array_append(data, ghb_value_dup(
131                                         ghb_boolean_value(dep_map[jj].disable_if_equal)));
132                                 ghb_array_append(data, ghb_value_dup(
133                                         ghb_boolean_value(dep_map[jj].hide)));
134                                 ghb_array_append(array, data);
135                         }
136                 }
137                 ghb_dict_insert(top, g_strdup(name), array);
138         }
139         ghb_plist_write_file("widget_reverse.deps", top);
140         return 0;
141 }
142