OSDN Git Service

LinGui: allow display of picture settings before a scan has been done
[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_chapter", "none", TRUE, FALSE},
27         {"title", "end_chapter", "none", TRUE, FALSE},
28         {"title", "angle", "none", TRUE, FALSE},
29         {"use_dvdnav", "angle", "FALSE", TRUE, TRUE},
30         {"use_dvdnav", "angle_label", "FALSE", TRUE, TRUE},
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", FALSE, TRUE},
39         {"FileFormat", "Mp4HttpOptimize", "mp4", FALSE, TRUE},
40         {"FileFormat", "Mp4iPodCompatible", "mp4", FALSE, TRUE},
41         {"PictureDecombDeinterlace", "PictureDeinterlace", "TRUE", TRUE, TRUE},
42         {"PictureDecombDeinterlace", "PictureDeinterlaceCustom", "TRUE", TRUE, TRUE},
43         {"PictureDecombDeinterlace", "PictureDeinterlaceLabel", "TRUE", TRUE, TRUE},
44         {"PictureDecombDeinterlace", "PictureDecomb", "FALSE", TRUE, TRUE},
45         {"PictureDecombDeinterlace", "PictureDecombCustom", "FALSE", TRUE, TRUE},
46         {"PictureDecombDeinterlace", "PictureDecombLabel", "FALSE", TRUE, TRUE},
47         {"PictureDeinterlace", "PictureDeinterlaceCustom", "custom", FALSE, TRUE},
48         {"PictureDenoise", "PictureDenoiseCustom", "custom", FALSE, TRUE},
49         {"PictureDecomb", "PictureDecombCustom", "custom", FALSE, TRUE},
50         {"PictureDetelecine", "PictureDetelecineCustom", "custom", FALSE, TRUE},
51         {"PictureAutoCrop", "PictureTopCrop", "FALSE", FALSE, FALSE},
52         {"PictureAutoCrop", "PictureBottomCrop", "FALSE", FALSE, FALSE},
53         {"PictureAutoCrop", "PictureLeftCrop", "FALSE", FALSE, FALSE},
54         {"PictureAutoCrop", "PictureRightCrop", "FALSE", FALSE, FALSE},
55         {"VideoEncoder", "x264_tab", "x264", FALSE, FALSE},
56         {"VideoEncoder", "x264_tab_label", "x264", FALSE, FALSE},
57         {"VideoEncoder", "Mp4iPodCompatible", "x264", FALSE, FALSE},
58         {"AudioEncoder", "AudioBitrate", "ac3|dts|auto", TRUE, FALSE},
59         {"AudioEncoder", "AudioSamplerate", "ac3|dts|auto", TRUE, FALSE},
60         {"AudioEncoder", "AudioMixdown", "ac3|dts|auto", TRUE, FALSE},
61         {"AudioEncoder", "AudioTrackDRCSlider", "ac3|dts|auto", TRUE, FALSE},
62         {"AudioEncoder", "drc_label", "ac3|dts|auto", TRUE, FALSE},
63         {"x264_bframes", "x264_weighted_bframes", "0", TRUE, FALSE},
64         {"x264_bframes", "x264_bpyramid", "<2", TRUE, FALSE},
65         {"x264_bframes", "x264_direct", "0", TRUE, FALSE},
66         {"x264_bframes", "x264_b_adapt", "0", TRUE, FALSE},
67         {"x264_refs", "x264_mixed_refs", "<2", 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         {"x264_mbtree", "x264_bpyramid", "TRUE", TRUE, FALSE},
74         {"ChapterMarkers", "chapters_list", "TRUE", FALSE, FALSE},
75         {"use_source_name", "chapters_in_destination", "TRUE", FALSE, FALSE},
76         {"use_source_name", "title_no_in_destination", "TRUE", FALSE, FALSE},
77 };
78
79 int
80 main(gint argc, gchar *argv[])
81 {
82         gint ii, jj;
83         GValue *top;
84         gint count = sizeof(dep_map) / sizeof(dependency_t);
85
86         g_type_init();
87
88         top = ghb_dict_value_new();
89         for (ii = 0; ii < count; ii++)
90         {
91                 const gchar *name;
92                 GValue *array;
93
94                 name = dep_map[ii].widget_name;
95                 if (ghb_dict_lookup(top, name))
96                         continue;
97                 array = ghb_array_value_new(8);
98                 for (jj = 0; jj < count; jj++)
99                 {
100                         if (strcmp(name, dep_map[jj].widget_name) == 0)
101                         {
102                                 ghb_array_append(array,
103                                         ghb_value_dup(ghb_string_value(dep_map[jj].dep_name)));
104                         }
105                 }
106                 ghb_dict_insert(top, g_strdup(name), array);
107         }
108         ghb_plist_write_file("widget.deps", top);
109
110         // reverse map
111         top = ghb_dict_value_new();
112         for (ii = 0; ii < count; ii++)
113         {
114                 const gchar *name;
115                 GValue *array;
116
117                 name = dep_map[ii].dep_name;
118                 if (ghb_dict_lookup(top, name))
119                         continue;
120                 array = ghb_array_value_new(8);
121                 for (jj = 0; jj < count; jj++)
122                 {
123                         if (strcmp(name, dep_map[jj].dep_name) == 0)
124                         {
125                                 GValue *data;
126                                 data = ghb_array_value_new(3);
127                                 ghb_array_append(data, ghb_value_dup(
128                                         ghb_string_value(dep_map[jj].widget_name)));
129                                 ghb_array_append(data, ghb_value_dup(
130                                         ghb_string_value(dep_map[jj].enable_value)));
131                                 ghb_array_append(data, ghb_value_dup(
132                                         ghb_boolean_value(dep_map[jj].disable_if_equal)));
133                                 ghb_array_append(data, ghb_value_dup(
134                                         ghb_boolean_value(dep_map[jj].hide)));
135                                 ghb_array_append(array, data);
136                         }
137                 }
138                 ghb_dict_insert(top, g_strdup(name), array);
139         }
140         ghb_plist_write_file("widget_reverse.deps", top);
141         return 0;
142 }
143