summaryrefslogtreecommitdiffstats
path: root/gtk/src/widgetdeps.c
blob: eeb400708cd6a31b9be119b692471f8dd15ae7cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
#include <glib.h>
#include <glib-object.h>
#include <glib/gstdio.h>
#include <string.h>
#include "values.h"
#include "plist.h"

typedef struct
{
	const gchar *widget_name;
	const gchar *dep_name;
	const gchar *enable_value;
	const gboolean disable_if_equal;
	const gboolean hide;
} dependency_t;

static dependency_t dep_map[] =
{
	{"title", "queue_add", "none", TRUE, FALSE},
	{"title", "queue_add_menu", "none", TRUE, FALSE},
	{"title", "preview_frame", "none", TRUE, FALSE},
	{"title", "picture_label", "none", TRUE, FALSE},
	{"title", "picture_tab", "none", TRUE, FALSE},
	{"title", "chapters_label", "none", TRUE, FALSE},
	{"title", "chapters_tab", "none", TRUE, FALSE},
	{"title", "start_point", "none", TRUE, FALSE},
	{"title", "end_point", "none", TRUE, FALSE},
	{"title", "angle", "none", TRUE, FALSE},
	{"title", "angle_label", "1", TRUE, FALSE},
	{"use_dvdnav", "angle", "FALSE", TRUE, TRUE},
	{"use_dvdnav", "angle_label", "FALSE", TRUE, TRUE},
	{"angle_count", "angle", "1", TRUE, TRUE},
	{"angle_count", "angle_label", "1", TRUE, TRUE},
	{"vquality_type_bitrate", "VideoAvgBitrate", "TRUE", FALSE, FALSE},
	{"vquality_type_target", "VideoTargetSize", "TRUE", FALSE, FALSE},
	{"vquality_type_constant", "VideoQualitySlider", "TRUE", FALSE, FALSE},
	{"vquality_type_constant", "VideoTwoPass", "TRUE", TRUE, FALSE},
	{"vquality_type_constant", "VideoTurboTwoPass", "TRUE", TRUE, FALSE},
	{"VideoTwoPass", "VideoTurboTwoPass", "TRUE", FALSE, FALSE},
	{"FileFormat", "Mp4LargeFile", "mp4", FALSE, TRUE},
	{"FileFormat", "Mp4HttpOptimize", "mp4", FALSE, TRUE},
	{"FileFormat", "Mp4iPodCompatible", "mp4", FALSE, TRUE},
	{"PictureDecombDeinterlace", "PictureDeinterlace", "TRUE", TRUE, TRUE},
	{"PictureDecombDeinterlace", "PictureDeinterlaceCustom", "TRUE", TRUE, TRUE},
	{"PictureDecombDeinterlace", "PictureDeinterlaceLabel", "TRUE", TRUE, TRUE},
	{"PictureDecombDeinterlace", "PictureDecomb", "FALSE", TRUE, TRUE},
	{"PictureDecombDeinterlace", "PictureDecombCustom", "FALSE", TRUE, TRUE},
	{"PictureDecombDeinterlace", "PictureDecombLabel", "FALSE", TRUE, TRUE},
	{"PictureDeinterlace", "PictureDeinterlaceCustom", "custom", FALSE, TRUE},
	{"PictureDenoise", "PictureDenoiseCustom", "custom", FALSE, TRUE},
	{"PictureDecomb", "PictureDecombCustom", "custom", FALSE, TRUE},
	{"PictureDetelecine", "PictureDetelecineCustom", "custom", FALSE, TRUE},
	{"PictureAutoCrop", "PictureTopCrop", "FALSE", FALSE, FALSE},
	{"PictureAutoCrop", "PictureBottomCrop", "FALSE", FALSE, FALSE},
	{"PictureAutoCrop", "PictureLeftCrop", "FALSE", FALSE, FALSE},
	{"PictureAutoCrop", "PictureRightCrop", "FALSE", FALSE, FALSE},
	{"VideoEncoder", "x264_tab", "x264", FALSE, FALSE},
	{"VideoEncoder", "x264_tab_label", "x264", FALSE, FALSE},
	{"VideoEncoder", "Mp4iPodCompatible", "x264", FALSE, FALSE},
	{"AudioEncoderActual", "AudioBitrate", "ac3|dts", TRUE, FALSE},
	{"AudioEncoderActual", "AudioSamplerate", "ac3|dts", TRUE, FALSE},
	{"AudioEncoderActual", "AudioMixdown", "ac3|dts", TRUE, FALSE},
	{"AudioEncoderActual", "AudioTrackDRCSlider", "ac3|dts", TRUE, FALSE},
	{"AudioEncoderActual", "drc_label", "ac3|dts", TRUE, FALSE},
	{"x264_bframes", "x264_weighted_bframes", "0", TRUE, FALSE},
	{"x264_bframes", "x264_bpyramid", "<2", TRUE, FALSE},
	{"x264_bframes", "x264_direct", "0", TRUE, FALSE},
	{"x264_bframes", "x264_b_adapt", "0", TRUE, FALSE},
	{"x264_refs", "x264_mixed_refs", "<2", TRUE, FALSE},
	{"x264_cabac", "x264_trellis", "TRUE", FALSE, FALSE},
	{"x264_subme", "x264_psy_rd", "<6", TRUE, FALSE},
	{"x264_subme", "x264_psy_trell", "<6", TRUE, FALSE},
	{"x264_cabac", "x264_psy_trell", "TRUE", FALSE, FALSE},
	{"x264_trellis", "x264_psy_trell", "0", TRUE, FALSE},
	{"ChapterMarkers", "chapters_list", "TRUE", FALSE, FALSE},
	{"use_source_name", "chapters_in_destination", "TRUE", FALSE, FALSE},
	{"use_source_name", "title_no_in_destination", "TRUE", FALSE, FALSE},
};

int
main(gint argc, gchar *argv[])
{
	gint ii, jj;
	GValue *top;
	gint count = sizeof(dep_map) / sizeof(dependency_t);

	g_type_init();

	top = ghb_dict_value_new();
	for (ii = 0; ii < count; ii++)
	{
		const gchar *name;
		GValue *array;

		name = dep_map[ii].widget_name;
		if (ghb_dict_lookup(top, name))
			continue;
		array = ghb_array_value_new(8);
		for (jj = 0; jj < count; jj++)
		{
			if (strcmp(name, dep_map[jj].widget_name) == 0)
			{
				ghb_array_append(array,
					ghb_value_dup(ghb_string_value(dep_map[jj].dep_name)));
			}
		}
		ghb_dict_insert(top, g_strdup(name), array);
	}
	ghb_plist_write_file("widget.deps", top);

	// reverse map
	top = ghb_dict_value_new();
	for (ii = 0; ii < count; ii++)
	{
		const gchar *name;
		GValue *array;

		name = dep_map[ii].dep_name;
		if (ghb_dict_lookup(top, name))
			continue;
		array = ghb_array_value_new(8);
		for (jj = 0; jj < count; jj++)
		{
			if (strcmp(name, dep_map[jj].dep_name) == 0)
			{
				GValue *data;
				data = ghb_array_value_new(3);
				ghb_array_append(data, ghb_value_dup(
					ghb_string_value(dep_map[jj].widget_name)));
				ghb_array_append(data, ghb_value_dup(
					ghb_string_value(dep_map[jj].enable_value)));
				ghb_array_append(data, ghb_value_dup(
					ghb_boolean_value(dep_map[jj].disable_if_equal)));
				ghb_array_append(data, ghb_value_dup(
					ghb_boolean_value(dep_map[jj].hide)));
				ghb_array_append(array, data);
			}
		}
		ghb_dict_insert(top, g_strdup(name), array);
	}
	ghb_plist_write_file("widget_reverse.deps", top);
	return 0;
}