summaryrefslogtreecommitdiffstats
path: root/gtk/src
diff options
context:
space:
mode:
Diffstat (limited to 'gtk/src')
-rw-r--r--gtk/src/Makefile.am4
-rw-r--r--gtk/src/appcast.c370
-rw-r--r--gtk/src/appcast.h2
-rw-r--r--gtk/src/audiohandler.c2210
-rw-r--r--gtk/src/audiohandler.h6
-rw-r--r--gtk/src/callbacks.c8204
-rw-r--r--gtk/src/callbacks.h20
-rw-r--r--gtk/src/create_resources.c820
-rw-r--r--gtk/src/create_resources.py242
-rw-r--r--gtk/src/ghb-dvd.c556
-rw-r--r--gtk/src/ghb.ui1450
-rw-r--r--gtk/src/ghbcellrenderertext.c572
-rw-r--r--gtk/src/ghbcellrenderertext.h18
-rw-r--r--gtk/src/ghbcompat.h4
-rw-r--r--gtk/src/ghbcompositor.c4
-rw-r--r--gtk/src/hb-backend.c8756
-rw-r--r--gtk/src/hb-backend.h70
-rw-r--r--gtk/src/icon_tools.c96
-rw-r--r--gtk/src/icons.c72
-rw-r--r--gtk/src/ini_to_plist.c136
-rw-r--r--gtk/src/internal_defaults.xml832
-rw-r--r--gtk/src/main.c1492
-rw-r--r--gtk/src/makedeps.py234
-rw-r--r--gtk/src/marshalers.c2
-rw-r--r--gtk/src/marshalers.h4
-rw-r--r--gtk/src/plist.c982
-rw-r--r--gtk/src/preset_xlat.c1044
-rw-r--r--gtk/src/presets.c7510
-rw-r--r--gtk/src/presets.h2
-rw-r--r--gtk/src/preview.c1876
-rw-r--r--gtk/src/queuehandler.c2566
-rw-r--r--gtk/src/queuehandler.h6
-rw-r--r--gtk/src/quotestring.c68
-rw-r--r--gtk/src/quotestring.py102
-rw-r--r--gtk/src/renderer_button.c178
-rw-r--r--gtk/src/renderer_button.h8
-rw-r--r--gtk/src/resources.c8
-rw-r--r--gtk/src/resources.list98
-rw-r--r--gtk/src/settings.c1136
-rw-r--r--gtk/src/settings.h86
-rw-r--r--gtk/src/standard_presets.xml2378
-rw-r--r--gtk/src/subtitlehandler.c2444
-rw-r--r--gtk/src/subtitlehandler.h6
-rw-r--r--gtk/src/values.c976
-rw-r--r--gtk/src/values.h4
-rw-r--r--gtk/src/widgetdeps.c234
-rw-r--r--gtk/src/x264handler.c1668
-rw-r--r--gtk/src/x264handler.h6
48 files changed, 24781 insertions, 24781 deletions
diff --git a/gtk/src/Makefile.am b/gtk/src/Makefile.am
index 8fffaa337..2aff574ad 100644
--- a/gtk/src/Makefile.am
+++ b/gtk/src/Makefile.am
@@ -110,8 +110,8 @@ ghb_SOURCES = \
renderer_button.c \
ghbcellrenderertext.c \
ghbcellrenderertext.h \
- ghbcompositor.c \
- ghbcompositor.h \
+ ghbcompositor.c \
+ ghbcompositor.h \
ghb-dvd.c \
ghb-dvd.h \
marshalers.c \
diff --git a/gtk/src/appcast.c b/gtk/src/appcast.c
index 0658e9dc5..95966eacb 100644
--- a/gtk/src/appcast.c
+++ b/gtk/src/appcast.c
@@ -21,251 +21,251 @@
enum
{
- A_NONE = 0,
- A_DESCRIPTION,
- A_ENCLOSURE,
- A_ITEM,
+ A_NONE = 0,
+ A_DESCRIPTION,
+ A_ENCLOSURE,
+ A_ITEM,
};
typedef struct
{
- gchar *tag;
- gint id;
+ gchar *tag;
+ gint id;
} tag_map_t;
static tag_map_t tag_map[] =
{
- {"sparkle:releaseNotesLink", A_DESCRIPTION},
- {"enclosure", A_ENCLOSURE},
- {"item", A_ITEM},
+ {"sparkle:releaseNotesLink", A_DESCRIPTION},
+ {"enclosure", A_ENCLOSURE},
+ {"item", A_ITEM},
};
-#define TAG_MAP_SZ (sizeof(tag_map)/sizeof(tag_map_t))
+#define TAG_MAP_SZ (sizeof(tag_map)/sizeof(tag_map_t))
typedef struct
{
- gchar *key;
- gchar *value;
- GQueue *stack;
- GQueue *tag_stack;
- GString *description;
- gchar *build;
- gchar *version;
- gboolean item;
+ gchar *key;
+ gchar *value;
+ GQueue *stack;
+ GQueue *tag_stack;
+ GString *description;
+ gchar *build;
+ gchar *version;
+ gboolean item;
} parse_data_t;
static const gchar*
lookup_attr_value(
- const gchar *name,
- const gchar **attr_names,
- const gchar **attr_values)
+ const gchar *name,
+ const gchar **attr_names,
+ const gchar **attr_values)
{
- gint ii;
+ gint ii;
- if (attr_names == NULL) return NULL;
- for (ii = 0; attr_names[ii] != NULL; ii++)
- {
- if (strcmp(name, attr_names[ii]) == 0)
- return attr_values[ii];
- }
- return NULL;
+ if (attr_names == NULL) return NULL;
+ for (ii = 0; attr_names[ii] != NULL; ii++)
+ {
+ if (strcmp(name, attr_names[ii]) == 0)
+ return attr_values[ii];
+ }
+ return NULL;
}
static void
start_element(
- GMarkupParseContext *ctx,
- const gchar *tag,
- const gchar **attr_names,
- const gchar **attr_values,
- gpointer ud,
- GError **error)
+ GMarkupParseContext *ctx,
+ const gchar *tag,
+ const gchar **attr_names,
+ const gchar **attr_values,
+ gpointer ud,
+ GError **error)
{
- parse_data_t *pd = (parse_data_t*)ud;
- union
- {
- gint id;
- gpointer pid;
- } id;
- gint ii;
+ parse_data_t *pd = (parse_data_t*)ud;
+ union
+ {
+ gint id;
+ gpointer pid;
+ } id;
+ gint ii;
- for (ii = 0; ii < TAG_MAP_SZ; ii++)
- {
- if (strcmp(tag, tag_map[ii].tag) == 0)
- {
- id.id = tag_map[ii].id;
- break;
- }
- }
- if (ii == TAG_MAP_SZ)
- {
- g_debug("Unrecognized start tag (%s)", tag);
- id.id = A_NONE;
- }
- g_queue_push_head(pd->tag_stack, id.pid);
- switch (id.id)
- {
- case A_ITEM:
- {
- pd->item = TRUE;
- } break;
- case A_ENCLOSURE:
- {
- const gchar *build, *version;
- build = lookup_attr_value(
- "sparkle:version", attr_names, attr_values);
- version = lookup_attr_value(
- "sparkle:shortVersionString", attr_names, attr_values);
- if (build)
- pd->build = g_strdup(build);
- if (version)
- pd->version = g_strdup(version);
- } break;
- }
+ for (ii = 0; ii < TAG_MAP_SZ; ii++)
+ {
+ if (strcmp(tag, tag_map[ii].tag) == 0)
+ {
+ id.id = tag_map[ii].id;
+ break;
+ }
+ }
+ if (ii == TAG_MAP_SZ)
+ {
+ g_debug("Unrecognized start tag (%s)", tag);
+ id.id = A_NONE;
+ }
+ g_queue_push_head(pd->tag_stack, id.pid);
+ switch (id.id)
+ {
+ case A_ITEM:
+ {
+ pd->item = TRUE;
+ } break;
+ case A_ENCLOSURE:
+ {
+ const gchar *build, *version;
+ build = lookup_attr_value(
+ "sparkle:version", attr_names, attr_values);
+ version = lookup_attr_value(
+ "sparkle:shortVersionString", attr_names, attr_values);
+ if (build)
+ pd->build = g_strdup(build);
+ if (version)
+ pd->version = g_strdup(version);
+ } break;
+ }
}
static void
end_element(
- GMarkupParseContext *ctx,
- const gchar *tag,
- gpointer ud,
- GError **error)
+ GMarkupParseContext *ctx,
+ const gchar *tag,
+ gpointer ud,
+ GError **error)
{
- parse_data_t *pd = (parse_data_t*)ud;
- gint id;
- union
- {
- gint id;
- gpointer pid;
- } start_id;
- gint ii;
+ parse_data_t *pd = (parse_data_t*)ud;
+ gint id;
+ union
+ {
+ gint id;
+ gpointer pid;
+ } start_id;
+ gint ii;
- for (ii = 0; ii < TAG_MAP_SZ; ii++)
- {
- if (strcmp(tag, tag_map[ii].tag) == 0)
- {
- id = tag_map[ii].id;
- break;
- }
- }
- if (ii == TAG_MAP_SZ)
- {
- g_debug("Unrecognized end tag (%s)", tag);
- id = A_NONE;
- }
- start_id.pid = g_queue_pop_head(pd->tag_stack);
- if (start_id.id != id)
- g_warning("start tag != end tag: (%s %d) %d", tag, start_id.id, id);
- switch (id)
- {
- case A_ITEM:
- {
- pd->item = FALSE;
- } break;
- default:
- {
- } break;
- }
+ for (ii = 0; ii < TAG_MAP_SZ; ii++)
+ {
+ if (strcmp(tag, tag_map[ii].tag) == 0)
+ {
+ id = tag_map[ii].id;
+ break;
+ }
+ }
+ if (ii == TAG_MAP_SZ)
+ {
+ g_debug("Unrecognized end tag (%s)", tag);
+ id = A_NONE;
+ }
+ start_id.pid = g_queue_pop_head(pd->tag_stack);
+ if (start_id.id != id)
+ g_warning("start tag != end tag: (%s %d) %d", tag, start_id.id, id);
+ switch (id)
+ {
+ case A_ITEM:
+ {
+ pd->item = FALSE;
+ } break;
+ default:
+ {
+ } break;
+ }
}
static void
text_data(
- GMarkupParseContext *ctx,
- const gchar *text,
- gsize len,
- gpointer ud,
- GError **error)
+ GMarkupParseContext *ctx,
+ const gchar *text,
+ gsize len,
+ gpointer ud,
+ GError **error)
{
- parse_data_t *pd = (parse_data_t*)ud;
- union
- {
- gint id;
- gpointer pid;
- } start_id;
+ parse_data_t *pd = (parse_data_t*)ud;
+ union
+ {
+ gint id;
+ gpointer pid;
+ } start_id;
- start_id.pid = g_queue_peek_head(pd->tag_stack);
- switch (start_id.id)
- {
- case A_DESCRIPTION:
- {
- if (pd->item)
- {
- g_string_append(pd->description, text);
- }
- } break;
- default:
- {
- if (pd->value) g_free(pd->value);
- pd->value = g_strdup(text);
- } break;
- }
+ start_id.pid = g_queue_peek_head(pd->tag_stack);
+ switch (start_id.id)
+ {
+ case A_DESCRIPTION:
+ {
+ if (pd->item)
+ {
+ g_string_append(pd->description, text);
+ }
+ } break;
+ default:
+ {
+ if (pd->value) g_free(pd->value);
+ pd->value = g_strdup(text);
+ } break;
+ }
}
static void
passthrough(
- GMarkupParseContext *ctx,
- const gchar *text,
- gsize len,
- gpointer ud,
- GError **error)
+ GMarkupParseContext *ctx,
+ const gchar *text,
+ gsize len,
+ gpointer ud,
+ GError **error)
{
- //parse_data_t *pd = (parse_data_t*)ud;
+ //parse_data_t *pd = (parse_data_t*)ud;
- //g_debug("passthrough %s", text);
+ //g_debug("passthrough %s", text);
}
static void
parse_error(GMarkupParseContext *ctx, GError *error, gpointer ud)
{
- g_warning("Resource parse error: %s", error->message);
+ g_warning("Resource parse error: %s", error->message);
}
// This is required or the parser crashes
static void
destroy_notify(gpointer data)
{ // Do nothing
- //g_debug("destroy parser");
+ //g_debug("destroy parser");
}
void
ghb_appcast_parse(gchar *buf, gchar **desc, gchar **build, gchar **version)
{
- GMarkupParseContext *ctx;
- GMarkupParser parser;
- parse_data_t pd;
- GError *err = NULL;
- gint len;
- gchar *start;
- //gchar tmp[4096]
+ GMarkupParseContext *ctx;
+ GMarkupParser parser;
+ parse_data_t pd;
+ GError *err = NULL;
+ gint len;
+ gchar *start;
+ //gchar tmp[4096]
- // Skip junk at beginning of buffer
- start = strstr(buf, "<?xml ");
- pd.description = g_string_new("");
- pd.item = FALSE;
- pd.build = NULL;
- pd.version = NULL;
- len = strlen(start);
- pd.tag_stack = g_queue_new();
- pd.key = NULL;
- pd.value = NULL;
+ // Skip junk at beginning of buffer
+ start = strstr(buf, "<?xml ");
+ pd.description = g_string_new("");
+ pd.item = FALSE;
+ pd.build = NULL;
+ pd.version = NULL;
+ len = strlen(start);
+ pd.tag_stack = g_queue_new();
+ pd.key = NULL;
+ pd.value = NULL;
- parser.start_element = start_element;
- parser.end_element = end_element;
- parser.text = text_data;
- parser.passthrough = passthrough;
- parser.error = parse_error;
- ctx = g_markup_parse_context_new(
- &parser, G_MARKUP_TREAT_CDATA_AS_TEXT, &pd, destroy_notify);
+ parser.start_element = start_element;
+ parser.end_element = end_element;
+ parser.text = text_data;
+ parser.passthrough = passthrough;
+ parser.error = parse_error;
+ ctx = g_markup_parse_context_new(
+ &parser, G_MARKUP_TREAT_CDATA_AS_TEXT, &pd, destroy_notify);
- g_markup_parse_context_parse(ctx, start, len, &err);
- g_markup_parse_context_end_parse(ctx, &err);
- g_markup_parse_context_free(ctx);
- g_queue_free(pd.tag_stack);
- *desc = g_string_free(pd.description, FALSE);
- // work around a bug to leaves the CDATA closing brakets on the string
- gchar *glitch;
- glitch = g_strrstr(*desc, "]]>");
- if (glitch)
- *glitch = 0;
- *build = pd.build;
- *version = pd.version;
+ g_markup_parse_context_parse(ctx, start, len, &err);
+ g_markup_parse_context_end_parse(ctx, &err);
+ g_markup_parse_context_free(ctx);
+ g_queue_free(pd.tag_stack);
+ *desc = g_string_free(pd.description, FALSE);
+ // work around a bug to leaves the CDATA closing brakets on the string
+ gchar *glitch;
+ glitch = g_strrstr(*desc, "]]>");
+ if (glitch)
+ *glitch = 0;
+ *build = pd.build;
+ *version = pd.version;
}
diff --git a/gtk/src/appcast.h b/gtk/src/appcast.h
index 2520be601..d4f5eea55 100644
--- a/gtk/src/appcast.h
+++ b/gtk/src/appcast.h
@@ -17,6 +17,6 @@
#define _GHB_APPCAST_H_
void ghb_appcast_parse(
- gchar *buf, gchar **desc, gchar **build, gchar **version);
+ gchar *buf, gchar **desc, gchar **build, gchar **version);
#endif // _GHB_APPCAST_H_
diff --git a/gtk/src/audiohandler.c b/gtk/src/audiohandler.c
index 95b9ba166..53a0c29cb 100644
--- a/gtk/src/audiohandler.c
+++ b/gtk/src/audiohandler.c
@@ -31,1272 +31,1272 @@ static gboolean block_updates = FALSE;
void
ghb_show_hide_advanced_audio( signal_user_data_t *ud )
{
- GtkWidget *widget;
-
- g_debug("audio_advanced_clicked_cb ()");
- widget = GHB_WIDGET(ud->builder, "AdvancedAudioPassTable");
- if (!ghb_settings_get_boolean(ud->settings, "AdvancedAutoPassthru"))
- gtk_widget_hide(widget);
- else
- gtk_widget_show(widget);
+ GtkWidget *widget;
+
+ g_debug("audio_advanced_clicked_cb ()");
+ widget = GHB_WIDGET(ud->builder, "AdvancedAudioPassTable");
+ if (!ghb_settings_get_boolean(ud->settings, "AdvancedAutoPassthru"))
+ gtk_widget_hide(widget);
+ else
+ gtk_widget_show(widget);
}
void
check_list_full(signal_user_data_t *ud)
{
- GValue *audio_list;
- gint count;
+ GValue *audio_list;
+ gint count;
- audio_list = ghb_settings_get_value(ud->settings, "audio_list");
- count = ghb_array_len(audio_list);
- GtkWidget * widget = GHB_WIDGET(ud->builder, "audio_add");
- gtk_widget_set_sensitive(widget, count != 99);
+ audio_list = ghb_settings_get_value(ud->settings, "audio_list");
+ count = ghb_array_len(audio_list);
+ GtkWidget * widget = GHB_WIDGET(ud->builder, "audio_add");
+ gtk_widget_set_sensitive(widget, count != 99);
}
gint
ghb_select_audio_codec(gint mux, hb_audio_config_t *aconfig, gint acodec, gint fallback, gint copy_mask)
{
- guint32 in_codec = aconfig != NULL ? aconfig->in.codec : 0;
-
- if (acodec == HB_ACODEC_AUTO_PASS)
- {
- return hb_autopassthru_get_encoder(in_codec, copy_mask, fallback, mux);
- }
-
- gint ii;
- // Sanitize fallback
- for (ii = 0; ii < hb_audio_encoders_count; ii++)
- {
- if (hb_audio_encoders[ii].encoder == fallback &&
- !(hb_audio_encoders[ii].muxers & mux))
- {
- if ( mux == HB_MUX_MKV )
- fallback = HB_ACODEC_LAME;
- else
- fallback = HB_ACODEC_FAAC;
- break;
- }
- }
- if ((acodec & HB_ACODEC_PASS_FLAG) &&
- !(acodec & in_codec & HB_ACODEC_PASS_MASK))
- {
- return fallback;
- }
- for (ii = 0; ii < hb_audio_encoders_count; ii++)
- {
- if (hb_audio_encoders[ii].encoder == acodec &&
- !(hb_audio_encoders[ii].muxers & mux))
- {
- return fallback;
- }
- }
- return acodec;
+ guint32 in_codec = aconfig != NULL ? aconfig->in.codec : 0;
+
+ if (acodec == HB_ACODEC_AUTO_PASS)
+ {
+ return hb_autopassthru_get_encoder(in_codec, copy_mask, fallback, mux);
+ }
+
+ gint ii;
+ // Sanitize fallback
+ for (ii = 0; ii < hb_audio_encoders_count; ii++)
+ {
+ if (hb_audio_encoders[ii].encoder == fallback &&
+ !(hb_audio_encoders[ii].muxers & mux))
+ {
+ if ( mux == HB_MUX_MKV )
+ fallback = HB_ACODEC_LAME;
+ else
+ fallback = HB_ACODEC_FAAC;
+ break;
+ }
+ }
+ if ((acodec & HB_ACODEC_PASS_FLAG) &&
+ !(acodec & in_codec & HB_ACODEC_PASS_MASK))
+ {
+ return fallback;
+ }
+ for (ii = 0; ii < hb_audio_encoders_count; ii++)
+ {
+ if (hb_audio_encoders[ii].encoder == acodec &&
+ !(hb_audio_encoders[ii].muxers & mux))
+ {
+ return fallback;
+ }
+ }
+ return acodec;
}
int ghb_get_copy_mask(GValue *settings)
{
- gint mask = 0;
-
- if (ghb_settings_get_boolean(settings, "AudioAllowMP3Pass"))
- {
- mask |= HB_ACODEC_MP3;
- }
- if (ghb_settings_get_boolean(settings, "AudioAllowAACPass"))
- {
- mask |= HB_ACODEC_FFAAC;
- }
- if (ghb_settings_get_boolean(settings, "AudioAllowAC3Pass"))
- {
- mask |= HB_ACODEC_AC3;
- }
- if (ghb_settings_get_boolean(settings, "AudioAllowDTSPass"))
- {
- mask |= HB_ACODEC_DCA;
- }
- if (ghb_settings_get_boolean(settings, "AudioAllowDTSHDPass"))
- {
- mask |= HB_ACODEC_DCA_HD;
- }
- return mask;
+ gint mask = 0;
+
+ if (ghb_settings_get_boolean(settings, "AudioAllowMP3Pass"))
+ {
+ mask |= HB_ACODEC_MP3;
+ }
+ if (ghb_settings_get_boolean(settings, "AudioAllowAACPass"))
+ {
+ mask |= HB_ACODEC_FFAAC;
+ }
+ if (ghb_settings_get_boolean(settings, "AudioAllowAC3Pass"))
+ {
+ mask |= HB_ACODEC_AC3;
+ }
+ if (ghb_settings_get_boolean(settings, "AudioAllowDTSPass"))
+ {
+ mask |= HB_ACODEC_DCA;
+ }
+ if (ghb_settings_get_boolean(settings, "AudioAllowDTSHDPass"))
+ {
+ mask |= HB_ACODEC_DCA_HD;
+ }
+ return mask;
}
int ghb_select_fallback( GValue *settings, int mux, int acodec )
{
- gint mask;
- gint fallback = 0;
-
- switch ( acodec )
- {
- case HB_ACODEC_MP3_PASS:
- return HB_ACODEC_LAME;
-
- case HB_ACODEC_AAC_PASS:
- return HB_ACODEC_FAAC;
-
- case HB_ACODEC_AC3_PASS:
- return HB_ACODEC_AC3;
-
- default:
- {
- fallback = ghb_settings_combo_int(settings, "AudioEncoderFallback");
- }
- }
- if ( mux == HB_MUX_MP4 )
- {
- mask = HB_ACODEC_LAME |
- HB_ACODEC_FFAAC |
- HB_ACODEC_FAAC |
- HB_ACODEC_AC3;
- }
- if ( mux == HB_MUX_MKV )
- {
- mask =
- HB_ACODEC_FAAC |
- HB_ACODEC_LAME |
- HB_ACODEC_VORBIS |
- HB_ACODEC_AC3 |
- HB_ACODEC_FFAAC |
- HB_ACODEC_FFFLAC;
- }
- if (!(fallback & mask ))
- {
- fallback = HB_ACODEC_LAME;
- }
- return fallback;
+ gint mask;
+ gint fallback = 0;
+
+ switch ( acodec )
+ {
+ case HB_ACODEC_MP3_PASS:
+ return HB_ACODEC_LAME;
+
+ case HB_ACODEC_AAC_PASS:
+ return HB_ACODEC_FAAC;
+
+ case HB_ACODEC_AC3_PASS:
+ return HB_ACODEC_AC3;
+
+ default:
+ {
+ fallback = ghb_settings_combo_int(settings, "AudioEncoderFallback");
+ }
+ }
+ if ( mux == HB_MUX_MP4 )
+ {
+ mask = HB_ACODEC_LAME |
+ HB_ACODEC_FFAAC |
+ HB_ACODEC_FAAC |
+ HB_ACODEC_AC3;
+ }
+ if ( mux == HB_MUX_MKV )
+ {
+ mask =
+ HB_ACODEC_FAAC |
+ HB_ACODEC_LAME |
+ HB_ACODEC_VORBIS |
+ HB_ACODEC_AC3 |
+ HB_ACODEC_FFAAC |
+ HB_ACODEC_FFFLAC;
+ }
+ if (!(fallback & mask ))
+ {
+ fallback = HB_ACODEC_LAME;
+ }
+ return fallback;
}
void
ghb_sanitize_audio(GValue *settings, GValue *asettings)
{
- gint titleindex, track, acodec, select_acodec, mix;
- hb_audio_config_t *aconfig;
- gint mux;
- gint bitrate;
- gint sr;
-
- g_debug("ghb_santiize_audio ()");
- mux = ghb_settings_combo_int(settings, "FileFormat");
- titleindex = ghb_settings_get_int(settings, "title_no");
- track = ghb_settings_combo_int(asettings, "AudioTrack");
- acodec = ghb_settings_combo_int(asettings, "AudioEncoder");
- mix = ghb_settings_combo_int(asettings, "AudioMixdown");
- bitrate = ghb_settings_combo_int(asettings, "AudioBitrate");
- sr = ghb_settings_combo_int(asettings, "AudioSamplerate");
-
- aconfig = ghb_get_scan_audio_info(titleindex, track);
- if (sr == 0)
- {
- sr = aconfig ? aconfig->in.samplerate : 48000;
- }
- gint fallback = ghb_select_fallback(settings, mux, acodec);
- gint copy_mask = ghb_get_copy_mask(settings);
- select_acodec = ghb_select_audio_codec(mux, aconfig, acodec, fallback, copy_mask);
- if (ghb_audio_is_passthru (select_acodec))
- {
- if (aconfig)
- {
- bitrate = aconfig->in.bitrate / 1000;
-
- // Set the values for bitrate and samplerate to the input rates
- mix = 0;
- ghb_settings_set_string(asettings, "AudioMixdown",
- ghb_lookup_combo_string("AudioMixdown", ghb_int_value(mix)));
- select_acodec &= aconfig->in.codec | HB_ACODEC_PASS_FLAG;
- ghb_settings_set_string(asettings, "AudioSamplerate",
- ghb_lookup_combo_string("AudioSamplerate", ghb_int_value(0)));
- }
- else
- {
- mix = 0;
- ghb_settings_set_string(asettings, "AudioMixdown",
- ghb_lookup_combo_string("AudioMixdown", ghb_int_value(mix)));
- ghb_settings_set_string(asettings, "AudioSamplerate",
- ghb_lookup_combo_string("AudioSamplerate", ghb_int_value(0)));
- bitrate = 448;
- }
- ghb_settings_set_double(asettings, "AudioTrackDRCSlider", 0.0);
- }
- else
- {
- if (mix == 0)
- mix = ghb_get_best_mix( aconfig, select_acodec, 0);
- bitrate = hb_get_best_audio_bitrate(select_acodec, bitrate, sr, mix);
- ghb_settings_set_string(asettings, "AudioMixdown",
- ghb_lookup_combo_string("AudioMixdown", ghb_int_value(mix)));
- }
- ghb_settings_set_string(asettings, "AudioBitrate",
- ghb_lookup_combo_string("AudioBitrate", ghb_int_value(bitrate)));
-
- ghb_settings_take_value(asettings, "AudioEncoderActual",
- ghb_lookup_acodec_value(select_acodec));
+ gint titleindex, track, acodec, select_acodec, mix;
+ hb_audio_config_t *aconfig;
+ gint mux;
+ gint bitrate;
+ gint sr;
+
+ g_debug("ghb_santiize_audio ()");
+ mux = ghb_settings_combo_int(settings, "FileFormat");
+ titleindex = ghb_settings_get_int(settings, "title_no");
+ track = ghb_settings_combo_int(asettings, "AudioTrack");
+ acodec = ghb_settings_combo_int(asettings, "AudioEncoder");
+ mix = ghb_settings_combo_int(asettings, "AudioMixdown");
+ bitrate = ghb_settings_combo_int(asettings, "AudioBitrate");
+ sr = ghb_settings_combo_int(asettings, "AudioSamplerate");
+
+ aconfig = ghb_get_scan_audio_info(titleindex, track);
+ if (sr == 0)
+ {
+ sr = aconfig ? aconfig->in.samplerate : 48000;
+ }
+ gint fallback = ghb_select_fallback(settings, mux, acodec);
+ gint copy_mask = ghb_get_copy_mask(settings);
+ select_acodec = ghb_select_audio_codec(mux, aconfig, acodec, fallback, copy_mask);
+ if (ghb_audio_is_passthru (select_acodec))
+ {
+ if (aconfig)
+ {
+ bitrate = aconfig->in.bitrate / 1000;
+
+ // Set the values for bitrate and samplerate to the input rates
+ mix = 0;
+ ghb_settings_set_string(asettings, "AudioMixdown",
+ ghb_lookup_combo_string("AudioMixdown", ghb_int_value(mix)));
+ select_acodec &= aconfig->in.codec | HB_ACODEC_PASS_FLAG;
+ ghb_settings_set_string(asettings, "AudioSamplerate",
+ ghb_lookup_combo_string("AudioSamplerate", ghb_int_value(0)));
+ }
+ else
+ {
+ mix = 0;
+ ghb_settings_set_string(asettings, "AudioMixdown",
+ ghb_lookup_combo_string("AudioMixdown", ghb_int_value(mix)));
+ ghb_settings_set_string(asettings, "AudioSamplerate",
+ ghb_lookup_combo_string("AudioSamplerate", ghb_int_value(0)));
+ bitrate = 448;
+ }
+ ghb_settings_set_double(asettings, "AudioTrackDRCSlider", 0.0);
+ }
+ else
+ {
+ if (mix == 0)
+ mix = ghb_get_best_mix( aconfig, select_acodec, 0);
+ bitrate = hb_get_best_audio_bitrate(select_acodec, bitrate, sr, mix);
+ ghb_settings_set_string(asettings, "AudioMixdown",
+ ghb_lookup_combo_string("AudioMixdown", ghb_int_value(mix)));
+ }
+ ghb_settings_set_string(asettings, "AudioBitrate",
+ ghb_lookup_combo_string("AudioBitrate", ghb_int_value(bitrate)));
+
+ ghb_settings_take_value(asettings, "AudioEncoderActual",
+ ghb_lookup_acodec_value(select_acodec));
}
void
ghb_adjust_audio_rate_combos(signal_user_data_t *ud)
{
- gint titleindex, track, acodec, select_acodec, mix;
- hb_audio_config_t *aconfig;
- GtkWidget *widget;
- GValue *gval;
- gint mux;
- gint bitrate;
- gint sr = 48000;
-
- g_debug("ghb_adjust_audio_rate_combos ()");
- mux = ghb_settings_combo_int(ud->settings, "FileFormat");
- titleindex = ghb_settings_combo_int(ud->settings, "title");
-
- widget = GHB_WIDGET(ud->builder, "AudioTrack");
- gval = ghb_widget_value(widget);
- track = ghb_lookup_combo_int("AudioTrack", gval);
- ghb_value_free(gval);
-
- widget = GHB_WIDGET(ud->builder, "AudioEncoder");
- gval = ghb_widget_value(widget);
- acodec = ghb_lookup_combo_int("AudioEncoder", gval);
- ghb_value_free(gval);
- widget = GHB_WIDGET(ud->builder, "AudioMixdown");
- gval = ghb_widget_value(widget);
- mix = ghb_lookup_combo_int("AudioMixdown", gval);
- ghb_value_free(gval);
-
- widget = GHB_WIDGET(ud->builder, "AudioBitrate");
- gval = ghb_widget_value(widget);
- bitrate = ghb_lookup_combo_int("AudioBitrate", gval);
-
- widget = GHB_WIDGET(ud->builder, "AudioSamplerate");
- gval = ghb_widget_value(widget);
- sr = ghb_lookup_combo_int("AudioSamplerate", gval);
-
-
- aconfig = ghb_get_scan_audio_info(titleindex, track);
- if (sr == 0)
- {
- sr = aconfig ? aconfig->in.samplerate : 48000;
- }
- gint fallback = ghb_select_fallback( ud->settings, mux, acodec );
- gint copy_mask = ghb_get_copy_mask(ud->settings);
- select_acodec = ghb_select_audio_codec(mux, aconfig, acodec, fallback, copy_mask);
- gboolean codec_defined_bitrate = FALSE;
- if (ghb_audio_is_passthru (select_acodec))
- {
- if (aconfig)
- {
- bitrate = aconfig->in.bitrate / 1000;
-
- // Set the values for bitrate and samplerate to the input rates
- ghb_set_bitrate_opts (ud->builder, bitrate, bitrate, bitrate);
- mix = 0;
- ghb_ui_update(ud, "AudioMixdown", ghb_int64_value(mix));
- select_acodec &= aconfig->in.codec | HB_ACODEC_PASS_FLAG;
- codec_defined_bitrate = TRUE;
- ghb_ui_update(ud, "AudioSamplerate", ghb_int64_value(0));
- }
- else
- {
- ghb_ui_update(ud, "AudioSamplerate", ghb_int64_value(0));
- mix = 0;
- ghb_ui_update(ud, "AudioMixdown", ghb_int64_value(mix));
- bitrate = 448;
- }
- ghb_ui_update(ud, "AudioTrackDRCSlider", ghb_double_value(0));
- }
- else
- {
- if (mix == 0)
- mix = ghb_get_best_mix( aconfig, select_acodec, 0);
- bitrate = hb_get_best_audio_bitrate(select_acodec, bitrate, sr, mix);
- ghb_ui_update(ud, "AudioMixdown", ghb_int64_value(mix));
- }
- if (!codec_defined_bitrate)
- {
- int low, high;
- mix = ghb_get_best_mix( aconfig, select_acodec, mix);
- hb_get_audio_bitrate_limits(select_acodec, sr, mix, &low, &high);
- ghb_set_bitrate_opts (ud->builder, low, high, -1);
- }
- ghb_ui_update(ud, "AudioBitrate", ghb_int64_value(bitrate));
-
- ghb_settings_take_value(ud->settings, "AudioEncoderActual",
- ghb_lookup_acodec_value(select_acodec));
- GValue *asettings = get_selected_asettings(ud);
- if (asettings)
- {
- ghb_settings_take_value(asettings, "AudioEncoderActual",
- ghb_lookup_acodec_value(select_acodec));
- }
- ghb_audio_list_refresh_selected(ud);
- ghb_check_dependency(ud, NULL, "AudioEncoderActual");
+ gint titleindex, track, acodec, select_acodec, mix;
+ hb_audio_config_t *aconfig;
+ GtkWidget *widget;
+ GValue *gval;
+ gint mux;
+ gint bitrate;
+ gint sr = 48000;
+
+ g_debug("ghb_adjust_audio_rate_combos ()");
+ mux = ghb_settings_combo_int(ud->settings, "FileFormat");
+ titleindex = ghb_settings_combo_int(ud->settings, "title");
+
+ widget = GHB_WIDGET(ud->builder, "AudioTrack");
+ gval = ghb_widget_value(widget);
+ track = ghb_lookup_combo_int("AudioTrack", gval);
+ ghb_value_free(gval);
+
+ widget = GHB_WIDGET(ud->builder, "AudioEncoder");
+ gval = ghb_widget_value(widget);
+ acodec = ghb_lookup_combo_int("AudioEncoder", gval);
+ ghb_value_free(gval);
+ widget = GHB_WIDGET(ud->builder, "AudioMixdown");
+ gval = ghb_widget_value(widget);
+ mix = ghb_lookup_combo_int("AudioMixdown", gval);
+ ghb_value_free(gval);
+
+ widget = GHB_WIDGET(ud->builder, "AudioBitrate");
+ gval = ghb_widget_value(widget);
+ bitrate = ghb_lookup_combo_int("AudioBitrate", gval);
+
+ widget = GHB_WIDGET(ud->builder, "AudioSamplerate");
+ gval = ghb_widget_value(widget);
+ sr = ghb_lookup_combo_int("AudioSamplerate", gval);
+
+
+ aconfig = ghb_get_scan_audio_info(titleindex, track);
+ if (sr == 0)
+ {
+ sr = aconfig ? aconfig->in.samplerate : 48000;
+ }
+ gint fallback = ghb_select_fallback( ud->settings, mux, acodec );
+ gint copy_mask = ghb_get_copy_mask(ud->settings);
+ select_acodec = ghb_select_audio_codec(mux, aconfig, acodec, fallback, copy_mask);
+ gboolean codec_defined_bitrate = FALSE;
+ if (ghb_audio_is_passthru (select_acodec))
+ {
+ if (aconfig)
+ {
+ bitrate = aconfig->in.bitrate / 1000;
+
+ // Set the values for bitrate and samplerate to the input rates
+ ghb_set_bitrate_opts (ud->builder, bitrate, bitrate, bitrate);
+ mix = 0;
+ ghb_ui_update(ud, "AudioMixdown", ghb_int64_value(mix));
+ select_acodec &= aconfig->in.codec | HB_ACODEC_PASS_FLAG;
+ codec_defined_bitrate = TRUE;
+ ghb_ui_update(ud, "AudioSamplerate", ghb_int64_value(0));
+ }
+ else
+ {
+ ghb_ui_update(ud, "AudioSamplerate", ghb_int64_value(0));
+ mix = 0;
+ ghb_ui_update(ud, "AudioMixdown", ghb_int64_value(mix));
+ bitrate = 448;
+ }
+ ghb_ui_update(ud, "AudioTrackDRCSlider", ghb_double_value(0));
+ }
+ else
+ {
+ if (mix == 0)
+ mix = ghb_get_best_mix( aconfig, select_acodec, 0);
+ bitrate = hb_get_best_audio_bitrate(select_acodec, bitrate, sr, mix);
+ ghb_ui_update(ud, "AudioMixdown", ghb_int64_value(mix));
+ }
+ if (!codec_defined_bitrate)
+ {
+ int low, high;
+ mix = ghb_get_best_mix( aconfig, select_acodec, mix);
+ hb_get_audio_bitrate_limits(select_acodec, sr, mix, &low, &high);
+ ghb_set_bitrate_opts (ud->builder, low, high, -1);
+ }
+ ghb_ui_update(ud, "AudioBitrate", ghb_int64_value(bitrate));
+
+ ghb_settings_take_value(ud->settings, "AudioEncoderActual",
+ ghb_lookup_acodec_value(select_acodec));
+ GValue *asettings = get_selected_asettings(ud);
+ if (asettings)
+ {
+ ghb_settings_take_value(asettings, "AudioEncoderActual",
+ ghb_lookup_acodec_value(select_acodec));
+ }
+ ghb_audio_list_refresh_selected(ud);
+ ghb_check_dependency(ud, NULL, "AudioEncoderActual");
}
static void
free_audio_hash_key_value(gpointer data)
{
- g_free(data);
+ g_free(data);
}
const gchar*
ghb_get_user_audio_lang(GValue *settings, gint titleindex, gint track)
{
- GValue *audio_list, *asettings;
- const gchar *lang;
-
- audio_list = ghb_settings_get_value(settings, "audio_list");
- if (ghb_array_len(audio_list) <= track)
- return "und";
- asettings = ghb_array_get_nth(audio_list, track);
- track = ghb_settings_get_int(asettings, "AudioTrack");
- lang = ghb_get_source_audio_lang(titleindex, track);
- return lang;
+ GValue *audio_list, *asettings;
+ const gchar *lang;
+
+ audio_list = ghb_settings_get_value(settings, "audio_list");
+ if (ghb_array_len(audio_list) <= track)
+ return "und";
+ asettings = ghb_array_get_nth(audio_list, track);
+ track = ghb_settings_get_int(asettings, "AudioTrack");
+ lang = ghb_get_source_audio_lang(titleindex, track);
+ return lang;
}
void
ghb_set_pref_audio_settings(gint titleindex, GValue *settings)
{
- gint track;
- gchar *source_lang;
- hb_audio_config_t *aconfig;
- GHashTable *track_indices;
- gint mux;
-
- const GValue *pref_audio;
- const GValue *audio, *drc, *gain, *enable_qual;
- gint acodec, bitrate, mix;
- gdouble rate, quality;
- gint count, ii, list_count;
-
- g_debug("set_pref_audio");
- mux = ghb_settings_combo_int(settings, "FileFormat");
- track_indices = g_hash_table_new_full(g_int_hash, g_int_equal,
- free_audio_hash_key_value, free_audio_hash_key_value);
- // Clear the audio list
- ghb_clear_audio_list_settings(settings);
-
- // Find "best" audio based on audio preferences
- if (!ghb_settings_get_boolean(settings, "AudioDUB"))
- {
- source_lang = g_strdup(ghb_get_source_audio_lang(titleindex, 0));
- }
- else
- {
- source_lang = ghb_settings_get_string(settings, "PreferredLanguage");
- }
-
- pref_audio = ghb_settings_get_value(settings, "AudioList");
-
- list_count = 0;
- count = ghb_array_len(pref_audio);
- for (ii = 0; ii < count; ii++)
- {
- gint select_acodec;
- gint fallback;
-
- audio = ghb_array_get_nth(pref_audio, ii);
- acodec = ghb_settings_combo_int(audio, "AudioEncoder");
- fallback = ghb_select_fallback(settings, mux, acodec);
- gint copy_mask = ghb_get_copy_mask(settings);
- select_acodec = ghb_select_audio_codec(mux, NULL, acodec, fallback, copy_mask);
- bitrate = ghb_settings_combo_int(audio, "AudioBitrate");
- rate = ghb_settings_combo_double(audio, "AudioSamplerate");
- mix = ghb_settings_combo_int(audio, "AudioMixdown");
- drc = ghb_settings_get_value(audio, "AudioTrackDRCSlider");
- gain = ghb_settings_get_value(audio, "AudioTrackGain");
- enable_qual = ghb_settings_get_value(audio, "AudioTrackQualityEnable");
- quality = ghb_settings_get_double(audio, "AudioTrackQuality");
- // If there are multiple audios using the same codec, then
- // select sequential tracks for each. The hash keeps track
- // of the tracks used for each codec.
- track = ghb_find_audio_track(titleindex, source_lang,
- select_acodec, fallback, track_indices);
- // Check to see if:
- // 1. pref codec is passthru
- // 2. source codec is not passthru
- // 3. next pref is enabled
- aconfig = ghb_get_scan_audio_info(titleindex, track);
- if (aconfig && ghb_audio_is_passthru (acodec))
- {
- // HB_ACODEC_* are bit fields. Treat acodec as mask
- if (!(aconfig->in.codec & select_acodec & HB_ACODEC_PASS_MASK))
- {
- if (acodec != HB_ACODEC_AUTO_PASS)
- acodec = fallback;
- // If we can't substitute the passthru with a suitable
- // encoder and
- // If there's more audio to process, or we've already
- // placed one in the list, then we can skip this one
- if (!(select_acodec & fallback) &&
- ((ii + 1 < count) || (list_count != 0)))
- {
- // Skip this audio
- acodec = 0;
- }
- }
- else
- {
- select_acodec &= aconfig->in.codec | HB_ACODEC_PASS_FLAG;
- }
- }
- if (titleindex >= 0 && track < 0)
- acodec = 0;
- if (acodec != 0)
- {
- GValue *asettings = ghb_dict_value_new();
- ghb_settings_set_int(asettings, "AudioTrack", track);
- ghb_settings_set_string(asettings, "AudioEncoder",
- ghb_lookup_combo_string("AudioEncoder", ghb_int_value(acodec)));
- ghb_settings_set_value(asettings, "AudioEncoderActual",
- ghb_lookup_acodec_value(select_acodec));
- ghb_settings_set_value(asettings, "AudioTrackQualityEnable", enable_qual);
- ghb_settings_set_double(asettings, "AudioTrackQuality", quality);
-
- // This gets set autimatically if the codec is passthru
- ghb_settings_set_string(asettings, "AudioBitrate",
- ghb_lookup_combo_string("AudioBitrate", ghb_int_value(bitrate)));
- ghb_settings_set_string(asettings, "AudioSamplerate",
- ghb_lookup_combo_string("AudioSamplerate", ghb_int_value(rate)));
- mix = ghb_get_best_mix( aconfig, select_acodec, mix);
- ghb_settings_set_string(asettings, "AudioMixdown",
- ghb_lookup_combo_string("AudioMixdown", ghb_int_value(mix)));
- ghb_settings_set_value(asettings, "AudioTrackDRCSlider", drc);
- ghb_settings_set_value(asettings, "AudioTrackGain", gain);
- ghb_sanitize_audio(settings, asettings);
- ghb_add_audio_to_settings(settings, asettings);
- }
- }
- g_free(source_lang);
- g_hash_table_destroy(track_indices);
+ gint track;
+ gchar *source_lang;
+ hb_audio_config_t *aconfig;
+ GHashTable *track_indices;
+ gint mux;
+
+ const GValue *pref_audio;
+ const GValue *audio, *drc, *gain, *enable_qual;
+ gint acodec, bitrate, mix;
+ gdouble rate, quality;
+ gint count, ii, list_count;
+
+ g_debug("set_pref_audio");
+ mux = ghb_settings_combo_int(settings, "FileFormat");
+ track_indices = g_hash_table_new_full(g_int_hash, g_int_equal,
+ free_audio_hash_key_value, free_audio_hash_key_value);
+ // Clear the audio list
+ ghb_clear_audio_list_settings(settings);
+
+ // Find "best" audio based on audio preferences
+ if (!ghb_settings_get_boolean(settings, "AudioDUB"))
+ {
+ source_lang = g_strdup(ghb_get_source_audio_lang(titleindex, 0));
+ }
+ else
+ {
+ source_lang = ghb_settings_get_string(settings, "PreferredLanguage");
+ }
+
+ pref_audio = ghb_settings_get_value(settings, "AudioList");
+
+ list_count = 0;
+ count = ghb_array_len(pref_audio);
+ for (ii = 0; ii < count; ii++)
+ {
+ gint select_acodec;
+ gint fallback;
+
+ audio = ghb_array_get_nth(pref_audio, ii);
+ acodec = ghb_settings_combo_int(audio, "AudioEncoder");
+ fallback = ghb_select_fallback(settings, mux, acodec);
+ gint copy_mask = ghb_get_copy_mask(settings);
+ select_acodec = ghb_select_audio_codec(mux, NULL, acodec, fallback, copy_mask);
+ bitrate = ghb_settings_combo_int(audio, "AudioBitrate");
+ rate = ghb_settings_combo_double(audio, "AudioSamplerate");
+ mix = ghb_settings_combo_int(audio, "AudioMixdown");
+ drc = ghb_settings_get_value(audio, "AudioTrackDRCSlider");
+ gain = ghb_settings_get_value(audio, "AudioTrackGain");
+ enable_qual = ghb_settings_get_value(audio, "AudioTrackQualityEnable");
+ quality = ghb_settings_get_double(audio, "AudioTrackQuality");
+ // If there are multiple audios using the same codec, then
+ // select sequential tracks for each. The hash keeps track
+ // of the tracks used for each codec.
+ track = ghb_find_audio_track(titleindex, source_lang,
+ select_acodec, fallback, track_indices);
+ // Check to see if:
+ // 1. pref codec is passthru
+ // 2. source codec is not passthru
+ // 3. next pref is enabled
+ aconfig = ghb_get_scan_audio_info(titleindex, track);
+ if (aconfig && ghb_audio_is_passthru (acodec))
+ {
+ // HB_ACODEC_* are bit fields. Treat acodec as mask
+ if (!(aconfig->in.codec & select_acodec & HB_ACODEC_PASS_MASK))
+ {
+ if (acodec != HB_ACODEC_AUTO_PASS)
+ acodec = fallback;
+ // If we can't substitute the passthru with a suitable
+ // encoder and
+ // If there's more audio to process, or we've already
+ // placed one in the list, then we can skip this one
+ if (!(select_acodec & fallback) &&
+ ((ii + 1 < count) || (list_count != 0)))
+ {
+ // Skip this audio
+ acodec = 0;
+ }
+ }
+ else
+ {
+ select_acodec &= aconfig->in.codec | HB_ACODEC_PASS_FLAG;
+ }
+ }
+ if (titleindex >= 0 && track < 0)
+ acodec = 0;
+ if (acodec != 0)
+ {
+ GValue *asettings = ghb_dict_value_new();
+ ghb_settings_set_int(asettings, "AudioTrack", track);
+ ghb_settings_set_string(asettings, "AudioEncoder",
+ ghb_lookup_combo_string("AudioEncoder", ghb_int_value(acodec)));
+ ghb_settings_set_value(asettings, "AudioEncoderActual",
+ ghb_lookup_acodec_value(select_acodec));
+ ghb_settings_set_value(asettings, "AudioTrackQualityEnable", enable_qual);
+ ghb_settings_set_double(asettings, "AudioTrackQuality", quality);
+
+ // This gets set autimatically if the codec is passthru
+ ghb_settings_set_string(asettings, "AudioBitrate",
+ ghb_lookup_combo_string("AudioBitrate", ghb_int_value(bitrate)));
+ ghb_settings_set_string(asettings, "AudioSamplerate",
+ ghb_lookup_combo_string("AudioSamplerate", ghb_int_value(rate)));
+ mix = ghb_get_best_mix( aconfig, select_acodec, mix);
+ ghb_settings_set_string(asettings, "AudioMixdown",
+ ghb_lookup_combo_string("AudioMixdown", ghb_int_value(mix)));
+ ghb_settings_set_value(asettings, "AudioTrackDRCSlider", drc);
+ ghb_settings_set_value(asettings, "AudioTrackGain", gain);
+ ghb_sanitize_audio(settings, asettings);
+ ghb_add_audio_to_settings(settings, asettings);
+ }
+ }
+ g_free(source_lang);
+ g_hash_table_destroy(track_indices);
}
void
ghb_set_pref_audio_from_settings(signal_user_data_t *ud, GValue *settings)
{
- const GValue *audio_list, *audio;
- gint count, ii;
-
- // Clear the audio list
- ghb_clear_audio_list_ui(ud->builder);
-
- audio_list = ghb_settings_get_value(settings, "audio_list");
- count = ghb_array_len(audio_list);
- for (ii = 0; ii < count; ii++)
- {
- audio = ghb_array_get_nth(audio_list, ii);
- ghb_add_audio_to_ui(ud->builder, audio);
- ghb_adjust_audio_rate_combos(ud);
- }
- check_list_full(ud);
+ const GValue *audio_list, *audio;
+ gint count, ii;
+
+ // Clear the audio list
+ ghb_clear_audio_list_ui(ud->builder);
+
+ audio_list = ghb_settings_get_value(settings, "audio_list");
+ count = ghb_array_len(audio_list);
+ for (ii = 0; ii < count; ii++)
+ {
+ audio = ghb_array_get_nth(audio_list, ii);
+ ghb_add_audio_to_ui(ud->builder, audio);
+ ghb_adjust_audio_rate_combos(ud);
+ }
+ check_list_full(ud);
}
static GValue*
get_selected_asettings(signal_user_data_t *ud)
{
- GtkTreeView *treeview;
- GtkTreePath *treepath;
- GtkTreeSelection *selection;
- GtkTreeModel *store;
- GtkTreeIter iter;
- gint *indices;
- gint row;
- GValue *asettings = NULL;
- const GValue *audio_list;
-
- g_debug("get_selected_asettings ()");
- treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "audio_list"));
- selection = gtk_tree_view_get_selection (treeview);
- if (gtk_tree_selection_get_selected(selection, &store, &iter))
- {
- // Get the row number
- treepath = gtk_tree_model_get_path (store, &iter);
- indices = gtk_tree_path_get_indices (treepath);
- row = indices[0];
- gtk_tree_path_free(treepath);
- // find audio settings
- if (row < 0) return NULL;
- audio_list = ghb_settings_get_value(ud->settings, "audio_list");
- if (row >= ghb_array_len(audio_list))
- return NULL;
- asettings = ghb_array_get_nth(audio_list, row);
- }
- return asettings;
+ GtkTreeView *treeview;
+ GtkTreePath *treepath;
+ GtkTreeSelection *selection;
+ GtkTreeModel *store;
+ GtkTreeIter iter;
+ gint *indices;
+ gint row;
+ GValue *asettings = NULL;
+ const GValue *audio_list;
+
+ g_debug("get_selected_asettings ()");
+ treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "audio_list"));
+ selection = gtk_tree_view_get_selection (treeview);
+ if (gtk_tree_selection_get_selected(selection, &store, &iter))
+ {
+ // Get the row number
+ treepath = gtk_tree_model_get_path (store, &iter);
+ indices = gtk_tree_path_get_indices (treepath);
+ row = indices[0];
+ gtk_tree_path_free(treepath);
+ // find audio settings
+ if (row < 0) return NULL;
+ audio_list = ghb_settings_get_value(ud->settings, "audio_list");
+ if (row >= ghb_array_len(audio_list))
+ return NULL;
+ asettings = ghb_array_get_nth(audio_list, row);
+ }
+ return asettings;
}
void
ghb_audio_list_refresh_selected(signal_user_data_t *ud)
{
- GtkTreeView *treeview;
- GtkTreePath *treepath;
- GtkTreeSelection *selection;
- GtkTreeModel *store;
- GtkTreeIter iter;
- gint *indices;
- gint row;
- GValue *asettings = NULL;
- const GValue *audio_list;
-
- g_debug("ghb_audio_list_refresh_selected ()");
- treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "audio_list"));
- selection = gtk_tree_view_get_selection (treeview);
- if (gtk_tree_selection_get_selected(selection, &store, &iter))
- {
- const gchar *track, *codec, *br, *sr, *mix;
- gchar *s_drc, *s_gain, *s_quality = NULL;
- gdouble drc, gain;
- // Get the row number
- treepath = gtk_tree_model_get_path (store, &iter);
- indices = gtk_tree_path_get_indices (treepath);
- row = indices[0];
- gtk_tree_path_free(treepath);
- // find audio settings
- if (row < 0) return;
- audio_list = ghb_settings_get_value(ud->settings, "audio_list");
- if (row >= ghb_array_len(audio_list))
- return;
- asettings = ghb_array_get_nth(audio_list, row);
-
- track = ghb_settings_combo_option(asettings, "AudioTrack");
- codec = ghb_settings_combo_option(asettings, "AudioEncoderActual");
- double quality = ghb_settings_get_double(asettings, "AudioTrackQuality");
- if (ghb_settings_get_boolean(asettings, "AudioTrackQualityEnable") &&
- quality != HB_INVALID_AUDIO_QUALITY)
- {
- int codec = ghb_settings_combo_int(asettings, "AudioEncoderActual");
- s_quality = ghb_format_quality("Q/", codec, quality);
- }
- else
- {
- br = ghb_settings_combo_option(asettings, "AudioBitrate");
- }
- sr = ghb_settings_combo_option(asettings, "AudioSamplerate");
- mix = ghb_settings_combo_option(asettings, "AudioMixdown");
- gain = ghb_settings_get_double(asettings, "AudioTrackGain");
- s_gain = g_strdup_printf("%ddB", (int)gain);
-
- drc = ghb_settings_get_double(asettings, "AudioTrackDRCSlider");
- if (drc < 1.0)
- s_drc = g_strdup("Off");
- else
- s_drc = g_strdup_printf("%.1f", drc);
-
- gtk_list_store_set(GTK_LIST_STORE(store), &iter,
- // These are displayed in list
- 0, track,
- 1, codec,
- 2, s_quality ? s_quality : br,
- 3, sr,
- 4, mix,
- 5, s_gain,
- 6, s_drc,
- -1);
- g_free(s_drc);
- g_free(s_gain);
- g_free(s_quality);
- }
+ GtkTreeView *treeview;
+ GtkTreePath *treepath;
+ GtkTreeSelection *selection;
+ GtkTreeModel *store;
+ GtkTreeIter iter;
+ gint *indices;
+ gint row;
+ GValue *asettings = NULL;
+ const GValue *audio_list;
+
+ g_debug("ghb_audio_list_refresh_selected ()");
+ treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "audio_list"));
+ selection = gtk_tree_view_get_selection (treeview);
+ if (gtk_tree_selection_get_selected(selection, &store, &iter))
+ {
+ const gchar *track, *codec, *br, *sr, *mix;
+ gchar *s_drc, *s_gain, *s_quality = NULL;
+ gdouble drc, gain;
+ // Get the row number
+ treepath = gtk_tree_model_get_path (store, &iter);
+ indices = gtk_tree_path_get_indices (treepath);
+ row = indices[0];
+ gtk_tree_path_free(treepath);
+ // find audio settings
+ if (row < 0) return;
+ audio_list = ghb_settings_get_value(ud->settings, "audio_list");
+ if (row >= ghb_array_len(audio_list))
+ return;
+ asettings = ghb_array_get_nth(audio_list, row);
+
+ track = ghb_settings_combo_option(asettings, "AudioTrack");
+ codec = ghb_settings_combo_option(asettings, "AudioEncoderActual");
+ double quality = ghb_settings_get_double(asettings, "AudioTrackQuality");
+ if (ghb_settings_get_boolean(asettings, "AudioTrackQualityEnable") &&
+ quality != HB_INVALID_AUDIO_QUALITY)
+ {
+ int codec = ghb_settings_combo_int(asettings, "AudioEncoderActual");
+ s_quality = ghb_format_quality("Q/", codec, quality);
+ }
+ else
+ {
+ br = ghb_settings_combo_option(asettings, "AudioBitrate");
+ }
+ sr = ghb_settings_combo_option(asettings, "AudioSamplerate");
+ mix = ghb_settings_combo_option(asettings, "AudioMixdown");
+ gain = ghb_settings_get_double(asettings, "AudioTrackGain");
+ s_gain = g_strdup_printf("%ddB", (int)gain);
+
+ drc = ghb_settings_get_double(asettings, "AudioTrackDRCSlider");
+ if (drc < 1.0)
+ s_drc = g_strdup("Off");
+ else
+ s_drc = g_strdup_printf("%.1f", drc);
+
+ gtk_list_store_set(GTK_LIST_STORE(store), &iter,
+ // These are displayed in list
+ 0, track,
+ 1, codec,
+ 2, s_quality ? s_quality : br,
+ 3, sr,
+ 4, mix,
+ 5, s_gain,
+ 6, s_drc,
+ -1);
+ g_free(s_drc);
+ g_free(s_gain);
+ g_free(s_quality);
+ }
}
void
ghb_audio_list_refresh(signal_user_data_t *ud)
{
- GtkTreeView *treeview;
- GtkTreeIter iter;
- GtkListStore *store;
- gboolean done;
- gint row = 0;
- const GValue *audio_list;
-
- g_debug("ghb_audio_list_refresh ()");
- treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "audio_list"));
- store = GTK_LIST_STORE(gtk_tree_view_get_model(treeview));
- if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(store), &iter))
- {
- do
- {
- const gchar *track, *codec, *br, *sr, *mix;
- gchar *s_drc, *s_gain, *s_quality = NULL;
- gdouble drc, gain;
- GValue *asettings;
-
- audio_list = ghb_settings_get_value(ud->settings, "audio_list");
- if (row >= ghb_array_len(audio_list))
- return;
- asettings = ghb_array_get_nth(audio_list, row);
-
- track = ghb_settings_combo_option(asettings, "AudioTrack");
- codec = ghb_settings_combo_option(asettings, "AudioEncoderActual");
- double quality = ghb_settings_get_double(asettings, "AudioTrackQuality");
- if (ghb_settings_get_boolean(asettings, "AudioTrackQualityEnable") &&
- quality != HB_INVALID_AUDIO_QUALITY)
- {
- int codec = ghb_settings_combo_int(asettings, "AudioEncoderActual");
- s_quality = ghb_format_quality("Q/", codec, quality);
- }
- else
- {
- br = ghb_settings_get_string(asettings, "AudioBitrate");
- }
- sr = ghb_settings_combo_option(asettings, "AudioSamplerate");
- mix = ghb_settings_combo_option(asettings, "AudioMixdown");
- gain = ghb_settings_get_double(asettings, "AudioTrackGain");
- s_gain = g_strdup_printf("%.fdB", gain);
-
- drc = ghb_settings_get_double(asettings, "AudioTrackDRCSlider");
- if (drc < 1.0)
- s_drc = g_strdup("Off");
- else
- s_drc = g_strdup_printf("%.1f", drc);
-
- gtk_list_store_set(GTK_LIST_STORE(store), &iter,
- // These are displayed in list
- 0, track,
- 1, codec,
- 2, s_quality ? s_quality : br,
- 3, sr,
- 4, mix,
- 5, s_gain,
- 6, s_drc,
- -1);
- g_free(s_drc);
- g_free(s_gain);
- done = !gtk_tree_model_iter_next(GTK_TREE_MODEL(store), &iter);
- row++;
- } while (!done);
- }
+ GtkTreeView *treeview;
+ GtkTreeIter iter;
+ GtkListStore *store;
+ gboolean done;
+ gint row = 0;
+ const GValue *audio_list;
+
+ g_debug("ghb_audio_list_refresh ()");
+ treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "audio_list"));
+ store = GTK_LIST_STORE(gtk_tree_view_get_model(treeview));
+ if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(store), &iter))
+ {
+ do
+ {
+ const gchar *track, *codec, *br, *sr, *mix;
+ gchar *s_drc, *s_gain, *s_quality = NULL;
+ gdouble drc, gain;
+ GValue *asettings;
+
+ audio_list = ghb_settings_get_value(ud->settings, "audio_list");
+ if (row >= ghb_array_len(audio_list))
+ return;
+ asettings = ghb_array_get_nth(audio_list, row);
+
+ track = ghb_settings_combo_option(asettings, "AudioTrack");
+ codec = ghb_settings_combo_option(asettings, "AudioEncoderActual");
+ double quality = ghb_settings_get_double(asettings, "AudioTrackQuality");
+ if (ghb_settings_get_boolean(asettings, "AudioTrackQualityEnable") &&
+ quality != HB_INVALID_AUDIO_QUALITY)
+ {
+ int codec = ghb_settings_combo_int(asettings, "AudioEncoderActual");
+ s_quality = ghb_format_quality("Q/", codec, quality);
+ }
+ else
+ {
+ br = ghb_settings_get_string(asettings, "AudioBitrate");
+ }
+ sr = ghb_settings_combo_option(asettings, "AudioSamplerate");
+ mix = ghb_settings_combo_option(asettings, "AudioMixdown");
+ gain = ghb_settings_get_double(asettings, "AudioTrackGain");
+ s_gain = g_strdup_printf("%.fdB", gain);
+
+ drc = ghb_settings_get_double(asettings, "AudioTrackDRCSlider");
+ if (drc < 1.0)
+ s_drc = g_strdup("Off");
+ else
+ s_drc = g_strdup_printf("%.1f", drc);
+
+ gtk_list_store_set(GTK_LIST_STORE(store), &iter,
+ // These are displayed in list
+ 0, track,
+ 1, codec,
+ 2, s_quality ? s_quality : br,
+ 3, sr,
+ 4, mix,
+ 5, s_gain,
+ 6, s_drc,
+ -1);
+ g_free(s_drc);
+ g_free(s_gain);
+ done = !gtk_tree_model_iter_next(GTK_TREE_MODEL(store), &iter);
+ row++;
+ } while (!done);
+ }
}
G_MODULE_EXPORT void
audio_codec_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
{
- static gint prev_acodec = 0;
- gint acodec_code;
- GValue *asettings, *gval;
-
- g_debug("audio_codec_changed_cb ()");
- gval = ghb_widget_value(widget);
- acodec_code = ghb_lookup_combo_int("AudioEncoder", gval);
- ghb_value_free(gval);
-
- if (block_updates)
- {
- prev_acodec = acodec_code;
- ghb_grey_combo_options (ud);
- ghb_check_dependency(ud, widget, NULL);
- return;
- }
-
- asettings = get_selected_asettings(ud);
- if (ghb_audio_is_passthru (prev_acodec) &&
- !ghb_audio_is_passthru (acodec_code))
- {
- // Transition from passthru to not, put some audio settings back to
- // pref settings
- gint titleindex;
- gint track;
- gint br, sr, mix_code;
-
- if (asettings != NULL)
- {
- br = ghb_settings_get_int(asettings, "AudioBitrate");
- sr = ghb_settings_combo_int(asettings, "AudioSamplerate");
- mix_code = ghb_settings_combo_int(asettings, "AudioMixdown");
- }
- else
- {
- br = 160;
- sr = 0;
- mix_code = 0;
- }
-
- titleindex = ghb_settings_combo_int(ud->settings, "title");
- track = ghb_settings_combo_int(ud->settings, "AudioTrack");
- if (sr)
- {
- sr = ghb_find_closest_audio_rate(sr);
- }
- ghb_ui_update(ud, "AudioSamplerate", ghb_int64_value(sr));
-
- hb_audio_config_t *aconfig;
- aconfig = ghb_get_scan_audio_info(titleindex, track);
- if (sr == 0)
- {
- sr = aconfig ? aconfig->in.samplerate : 48000;
- }
- mix_code = ghb_get_best_mix( aconfig, acodec_code, mix_code);
- br = hb_get_best_audio_bitrate(acodec_code, br, sr, mix_code);
- ghb_ui_update(ud, "AudioBitrate", ghb_int64_value(br));
-
- ghb_ui_update(ud, "AudioMixdown", ghb_int64_value(mix_code));
- }
- ghb_adjust_audio_rate_combos(ud);
- ghb_grey_combo_options (ud);
- ghb_check_dependency(ud, widget, NULL);
- prev_acodec = acodec_code;
- if (asettings != NULL)
- {
- ghb_widget_to_setting(asettings, widget);
- ghb_settings_set_value(asettings, "AudioEncoderActual", ghb_settings_get_value(ud->settings, "AudioEncoderActual"));
- ghb_audio_list_refresh_selected(ud);
- }
- ghb_live_reset(ud);
-
- float low, high, gran, defval;
- int dir;
- hb_get_audio_quality_limits(acodec_code, &low, &high, &gran, &dir);
- defval = hb_get_default_audio_quality(acodec_code);
- GtkScaleButton *sb;
- GtkAdjustment *adj;
- sb = GTK_SCALE_BUTTON(GHB_WIDGET(ud->builder, "AudioTrackQuality"));
- adj = gtk_scale_button_get_adjustment(sb);
- if (dir)
- {
- // Quality values are inverted
- defval = high - defval + low;
- }
- gtk_adjustment_configure (adj, defval, low, high, gran, gran * 10, 0);
+ static gint prev_acodec = 0;
+ gint acodec_code;
+ GValue *asettings, *gval;
+
+ g_debug("audio_codec_changed_cb ()");
+ gval = ghb_widget_value(widget);
+ acodec_code = ghb_lookup_combo_int("AudioEncoder", gval);
+ ghb_value_free(gval);
+
+ if (block_updates)
+ {
+ prev_acodec = acodec_code;
+ ghb_grey_combo_options (ud);
+ ghb_check_dependency(ud, widget, NULL);
+ return;
+ }
+
+ asettings = get_selected_asettings(ud);
+ if (ghb_audio_is_passthru (prev_acodec) &&
+ !ghb_audio_is_passthru (acodec_code))
+ {
+ // Transition from passthru to not, put some audio settings back to
+ // pref settings
+ gint titleindex;
+ gint track;
+ gint br, sr, mix_code;
+
+ if (asettings != NULL)
+ {
+ br = ghb_settings_get_int(asettings, "AudioBitrate");
+ sr = ghb_settings_combo_int(asettings, "AudioSamplerate");
+ mix_code = ghb_settings_combo_int(asettings, "AudioMixdown");
+ }
+ else
+ {
+ br = 160;
+ sr = 0;
+ mix_code = 0;
+ }
+
+ titleindex = ghb_settings_combo_int(ud->settings, "title");
+ track = ghb_settings_combo_int(ud->settings, "AudioTrack");
+ if (sr)
+ {
+ sr = ghb_find_closest_audio_rate(sr);
+ }
+ ghb_ui_update(ud, "AudioSamplerate", ghb_int64_value(sr));
+
+ hb_audio_config_t *aconfig;
+ aconfig = ghb_get_scan_audio_info(titleindex, track);
+ if (sr == 0)
+ {
+ sr = aconfig ? aconfig->in.samplerate : 48000;
+ }
+ mix_code = ghb_get_best_mix( aconfig, acodec_code, mix_code);
+ br = hb_get_best_audio_bitrate(acodec_code, br, sr, mix_code);
+ ghb_ui_update(ud, "AudioBitrate", ghb_int64_value(br));
+
+ ghb_ui_update(ud, "AudioMixdown", ghb_int64_value(mix_code));
+ }
+ ghb_adjust_audio_rate_combos(ud);
+ ghb_grey_combo_options (ud);
+ ghb_check_dependency(ud, widget, NULL);
+ prev_acodec = acodec_code;
+ if (asettings != NULL)
+ {
+ ghb_widget_to_setting(asettings, widget);
+ ghb_settings_set_value(asettings, "AudioEncoderActual", ghb_settings_get_value(ud->settings, "AudioEncoderActual"));
+ ghb_audio_list_refresh_selected(ud);
+ }
+ ghb_live_reset(ud);
+
+ float low, high, gran, defval;
+ int dir;
+ hb_get_audio_quality_limits(acodec_code, &low, &high, &gran, &dir);
+ defval = hb_get_default_audio_quality(acodec_code);
+ GtkScaleButton *sb;
+ GtkAdjustment *adj;
+ sb = GTK_SCALE_BUTTON(GHB_WIDGET(ud->builder, "AudioTrackQuality"));
+ adj = gtk_scale_button_get_adjustment(sb);
+ if (dir)
+ {
+ // Quality values are inverted
+ defval = high - defval + low;
+ }
+ gtk_adjustment_configure (adj, defval, low, high, gran, gran * 10, 0);
}
G_MODULE_EXPORT void
audio_track_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
{
- GValue *asettings;
-
- g_debug("audio_track_changed_cb ()");
- if (block_updates)
- {
- ghb_check_dependency(ud, widget, NULL);
- ghb_grey_combo_options (ud);
- return;
- }
-
- ghb_adjust_audio_rate_combos(ud);
- ghb_check_dependency(ud, widget, NULL);
- ghb_grey_combo_options(ud);
- asettings = get_selected_asettings(ud);
- if (asettings != NULL)
- {
- const gchar *track;
-
- ghb_widget_to_setting(asettings, widget);
- ghb_audio_list_refresh_selected(ud);
- track = ghb_settings_combo_option(asettings, "AudioTrack");
- ghb_settings_set_string(asettings, "AudioTrackDescription", track);
- }
- ghb_live_reset(ud);
+ GValue *asettings;
+
+ g_debug("audio_track_changed_cb ()");
+ if (block_updates)
+ {
+ ghb_check_dependency(ud, widget, NULL);
+ ghb_grey_combo_options (ud);
+ return;
+ }
+
+ ghb_adjust_audio_rate_combos(ud);
+ ghb_check_dependency(ud, widget, NULL);
+ ghb_grey_combo_options(ud);
+ asettings = get_selected_asettings(ud);
+ if (asettings != NULL)
+ {
+ const gchar *track;
+
+ ghb_widget_to_setting(asettings, widget);
+ ghb_audio_list_refresh_selected(ud);
+ track = ghb_settings_combo_option(asettings, "AudioTrack");
+ ghb_settings_set_string(asettings, "AudioTrackDescription", track);
+ }
+ ghb_live_reset(ud);
}
G_MODULE_EXPORT void
audio_mix_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
{
- GValue *asettings;
-
- g_debug("audio_mix_changed_cb ()");
- if (block_updates)
- {
- ghb_check_dependency(ud, widget, NULL);
- return;
- }
-
- ghb_adjust_audio_rate_combos(ud);
- ghb_check_dependency(ud, widget, NULL);
- asettings = get_selected_asettings(ud);
- if (asettings != NULL)
- {
- ghb_widget_to_setting(asettings, widget);
- ghb_audio_list_refresh_selected(ud);
- }
- ghb_live_reset(ud);
+ GValue *asettings;
+
+ g_debug("audio_mix_changed_cb ()");
+ if (block_updates)
+ {
+ ghb_check_dependency(ud, widget, NULL);
+ return;
+ }
+
+ ghb_adjust_audio_rate_combos(ud);
+ ghb_check_dependency(ud, widget, NULL);
+ asettings = get_selected_asettings(ud);
+ if (asettings != NULL)
+ {
+ ghb_widget_to_setting(asettings, widget);
+ ghb_audio_list_refresh_selected(ud);
+ }
+ ghb_live_reset(ud);
}
G_MODULE_EXPORT void
audio_widget_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
{
- GValue *asettings;
-
- g_debug("audio_widget_changed_cb ()");
- if (block_updates)
- {
- ghb_check_dependency(ud, widget, NULL);
- return;
- }
-
- ghb_adjust_audio_rate_combos(ud);
- asettings = get_selected_asettings(ud);
- if (asettings != NULL)
- {
- ghb_widget_to_setting(asettings, widget);
- ghb_audio_list_refresh_selected(ud);
- }
- ghb_live_reset(ud);
+ GValue *asettings;
+
+ g_debug("audio_widget_changed_cb ()");
+ if (block_updates)
+ {
+ ghb_check_dependency(ud, widget, NULL);
+ return;
+ }
+
+ ghb_adjust_audio_rate_combos(ud);
+ asettings = get_selected_asettings(ud);
+ if (asettings != NULL)
+ {
+ ghb_widget_to_setting(asettings, widget);
+ ghb_audio_list_refresh_selected(ud);
+ }
+ ghb_live_reset(ud);
}
G_MODULE_EXPORT void
global_audio_widget_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
{
- g_debug("global_audio_widget_changed_cb ()");
- if (block_updates)
- {
- ghb_check_dependency(ud, widget, NULL);
- return;
- }
-
- ghb_check_dependency(ud, widget, NULL);
- ghb_widget_to_setting(ud->settings, widget);
- ghb_adjust_audio_rate_combos(ud);
- ghb_grey_combo_options (ud);
- ghb_audio_list_refresh_selected(ud);
- ghb_live_reset(ud);
+ g_debug("global_audio_widget_changed_cb ()");
+ if (block_updates)
+ {
+ ghb_check_dependency(ud, widget, NULL);
+ return;
+ }
+
+ ghb_check_dependency(ud, widget, NULL);
+ ghb_widget_to_setting(ud->settings, widget);
+ ghb_adjust_audio_rate_combos(ud);
+ ghb_grey_combo_options (ud);
+ ghb_audio_list_refresh_selected(ud);
+ ghb_live_reset(ud);
}
G_MODULE_EXPORT gchar*
format_drc_cb(GtkScale *scale, gdouble val, signal_user_data_t *ud)
{
- if (val < 1.0)
- return g_strdup_printf("%-7s", "Off");
- else
- return g_strdup_printf("%-7.1f", val);
+ if (val < 1.0)
+ return g_strdup_printf("%-7s", "Off");
+ else
+ return g_strdup_printf("%-7.1f", val);
}
static inline int is_close(float a, float b, float metric)
{
- float diff = a - b;
- diff = (diff > 0) ? diff : -diff;
- return diff < metric;
+ float diff = a - b;
+ diff = (diff > 0) ? diff : -diff;
+ return diff < metric;
}
char * ghb_format_quality( const char *prefix, int codec, double quality )
{
- float low, high, gran;
- int dir;
- hb_get_audio_quality_limits(codec, &low, &high, &gran, &dir);
-
- int digits = 0;
- float tmp = gran;
- while (1)
- {
- if (is_close(tmp, (int)tmp, gran / 10))
- break;
- digits++;
- tmp *= 10;
- }
- return g_strdup_printf("%s%.*f", prefix, digits, quality);
+ float low, high, gran;
+ int dir;
+ hb_get_audio_quality_limits(codec, &low, &high, &gran, &dir);
+
+ int digits = 0;
+ float tmp = gran;
+ while (1)
+ {
+ if (is_close(tmp, (int)tmp, gran / 10))
+ break;
+ digits++;
+ tmp *= 10;
+ }
+ return g_strdup_printf("%s%.*f", prefix, digits, quality);
}
G_MODULE_EXPORT void
quality_widget_changed_cb(GtkWidget *widget, gdouble quality, signal_user_data_t *ud)
{
- GValue *asettings;
-
- g_debug("quality_widget_changed_cb ()");
-
- ghb_check_dependency(ud, widget, NULL);
- float low, high, gran;
- int dir;
- int codec = ghb_settings_combo_int(ud->settings, "AudioEncoderActual");
- hb_get_audio_quality_limits(codec, &low, &high, &gran, &dir);
- if (dir)
- {
- // Quality values are inverted
- quality = high - quality + low;
- }
- char *s_quality = ghb_format_quality("", codec, quality);
- ghb_ui_update( ud, "AudioTrackQualityValue", ghb_string_value(s_quality));
- g_free(s_quality);
-
- if (block_updates) return;
-
- asettings = get_selected_asettings(ud);
- if (asettings != NULL)
- {
- ghb_settings_set_double(asettings, "AudioTrackQuality", quality);
- ghb_audio_list_refresh_selected(ud);
- }
- ghb_live_reset(ud);
+ GValue *asettings;
+
+ g_debug("quality_widget_changed_cb ()");
+
+ ghb_check_dependency(ud, widget, NULL);
+ float low, high, gran;
+ int dir;
+ int codec = ghb_settings_combo_int(ud->settings, "AudioEncoderActual");
+ hb_get_audio_quality_limits(codec, &low, &high, &gran, &dir);
+ if (dir)
+ {
+ // Quality values are inverted
+ quality = high - quality + low;
+ }
+ char *s_quality = ghb_format_quality("", codec, quality);
+ ghb_ui_update( ud, "AudioTrackQualityValue", ghb_string_value(s_quality));
+ g_free(s_quality);
+
+ if (block_updates) return;
+
+ asettings = get_selected_asettings(ud);
+ if (asettings != NULL)
+ {
+ ghb_settings_set_double(asettings, "AudioTrackQuality", quality);
+ ghb_audio_list_refresh_selected(ud);
+ }
+ ghb_live_reset(ud);
}
G_MODULE_EXPORT void
drc_widget_changed_cb(GtkWidget *widget, gdouble drc, signal_user_data_t *ud)
{
- GValue *asettings;
-
- g_debug("drc_widget_changed_cb ()");
-
- ghb_check_dependency(ud, widget, NULL);
- if (block_updates) return;
-
- char *s_drc;
- if (drc < 0.99)
- s_drc = g_strdup("Off");
- else
- s_drc = g_strdup_printf("%.1f", drc);
- ghb_ui_update( ud, "AudioTrackDRCValue", ghb_string_value(s_drc));
- g_free(s_drc);
-
- asettings = get_selected_asettings(ud);
- if (asettings != NULL)
- {
- ghb_widget_to_setting(asettings, widget);
- ghb_audio_list_refresh_selected(ud);
- }
- ghb_live_reset(ud);
+ GValue *asettings;
+
+ g_debug("drc_widget_changed_cb ()");
+
+ ghb_check_dependency(ud, widget, NULL);
+ if (block_updates) return;
+
+ char *s_drc;
+ if (drc < 0.99)
+ s_drc = g_strdup("Off");
+ else
+ s_drc = g_strdup_printf("%.1f", drc);
+ ghb_ui_update( ud, "AudioTrackDRCValue", ghb_string_value(s_drc));
+ g_free(s_drc);
+
+ asettings = get_selected_asettings(ud);
+ if (asettings != NULL)
+ {
+ ghb_widget_to_setting(asettings, widget);
+ ghb_audio_list_refresh_selected(ud);
+ }
+ ghb_live_reset(ud);
}
G_MODULE_EXPORT gchar*
format_gain_cb(GtkScale *scale, gdouble val, signal_user_data_t *ud)
{
- if ( val >= 21.0 )
- return g_strdup_printf("*11*");
- return g_strdup_printf("%ddB", (int)val);
+ if ( val >= 21.0 )
+ return g_strdup_printf("*11*");
+ return g_strdup_printf("%ddB", (int)val);
}
G_MODULE_EXPORT void
gain_widget_changed_cb(GtkWidget *widget, gdouble gain, signal_user_data_t *ud)
{
- GValue *asettings;
-
- g_debug("gain_widget_changed_cb ()");
-
- ghb_check_dependency(ud, widget, NULL);
- if (block_updates) return;
- asettings = get_selected_asettings(ud);
-
- char *s_gain;
- if ( gain >= 21.0 )
- s_gain = g_strdup_printf("*11*");
- else
- s_gain = g_strdup_printf("%ddB", (int)gain);
- ghb_ui_update( ud, "AudioTrackGainValue", ghb_string_value(s_gain));
- g_free(s_gain);
-
- if (asettings != NULL)
- {
- ghb_widget_to_setting(asettings, widget);
- ghb_audio_list_refresh_selected(ud);
- }
- ghb_live_reset(ud);
+ GValue *asettings;
+
+ g_debug("gain_widget_changed_cb ()");
+
+ ghb_check_dependency(ud, widget, NULL);
+ if (block_updates) return;
+ asettings = get_selected_asettings(ud);
+
+ char *s_gain;
+ if ( gain >= 21.0 )
+ s_gain = g_strdup_printf("*11*");
+ else
+ s_gain = g_strdup_printf("%ddB", (int)gain);
+ ghb_ui_update( ud, "AudioTrackGainValue", ghb_string_value(s_gain));
+ g_free(s_gain);
+
+ if (asettings != NULL)
+ {
+ ghb_widget_to_setting(asettings, widget);
+ ghb_audio_list_refresh_selected(ud);
+ }
+ ghb_live_reset(ud);
}
void
ghb_clear_audio_list_settings(GValue *settings)
{
- GValue *audio_list;
-
- g_debug("clear_audio_list_settings ()");
- audio_list = ghb_settings_get_value(settings, "audio_list");
- if (audio_list == NULL)
- {
- audio_list = ghb_array_value_new(8);
- ghb_settings_set_value(settings, "audio_list", audio_list);
- }
- else
- ghb_array_value_reset(audio_list, 8);
+ GValue *audio_list;
+
+ g_debug("clear_audio_list_settings ()");
+ audio_list = ghb_settings_get_value(settings, "audio_list");
+ if (audio_list == NULL)
+ {
+ audio_list = ghb_array_value_new(8);
+ ghb_settings_set_value(settings, "audio_list", audio_list);
+ }
+ else
+ ghb_array_value_reset(audio_list, 8);
}
void
ghb_clear_audio_list_ui(GtkBuilder *builder)
{
- GtkTreeView *treeview;
- GtkListStore *store;
-
- g_debug("clear_audio_list_ui ()");
- treeview = GTK_TREE_VIEW(GHB_WIDGET(builder, "audio_list"));
- store = GTK_LIST_STORE(gtk_tree_view_get_model(treeview));
- gtk_list_store_clear (store);
+ GtkTreeView *treeview;
+ GtkListStore *store;
+
+ g_debug("clear_audio_list_ui ()");
+ treeview = GTK_TREE_VIEW(GHB_WIDGET(builder, "audio_list"));
+ store = GTK_LIST_STORE(gtk_tree_view_get_model(treeview));
+ gtk_list_store_clear (store);
}
static void
ghb_add_audio_to_ui(GtkBuilder *builder, const GValue *settings)
{
- GtkTreeView *treeview;
- GtkTreeIter iter;
- GtkListStore *store;
- GtkTreeSelection *selection;
- const gchar *track, *codec, *br, *sr, *mix;
- gchar *s_drc, *s_gain, *s_quality = NULL;
- gdouble drc;
- gdouble gain;
-
- g_debug("ghb_add_audio_to_ui ()");
- treeview = GTK_TREE_VIEW(GHB_WIDGET(builder, "audio_list"));
- selection = gtk_tree_view_get_selection (treeview);
- store = GTK_LIST_STORE(gtk_tree_view_get_model(treeview));
-
- track = ghb_settings_combo_option(settings, "AudioTrack");
- codec = ghb_settings_combo_option(settings, "AudioEncoderActual");
- double quality = ghb_settings_get_double(settings, "AudioTrackQuality");
- if (ghb_settings_get_boolean(settings, "AudioTrackQualityEnable") &&
- quality != HB_INVALID_AUDIO_QUALITY)
- {
- int codec = ghb_settings_combo_int(settings, "AudioEncoderActual");
- s_quality = ghb_format_quality("Q/", codec, quality);
- }
- else
- {
- br = ghb_settings_combo_option(settings, "AudioBitrate");
- }
- sr = ghb_settings_combo_option(settings, "AudioSamplerate");
- mix = ghb_settings_combo_option(settings, "AudioMixdown");
- gain = ghb_settings_get_double(settings, "AudioTrackGain");
- s_gain = g_strdup_printf("%ddB", (int)gain);
-
- drc = ghb_settings_get_double(settings, "AudioTrackDRCSlider");
- if (drc < 1.0)
- s_drc = g_strdup("Off");
- else
- s_drc = g_strdup_printf("%.1f", drc);
-
- gtk_list_store_append(store, &iter);
- gtk_list_store_set(store, &iter,
- // These are displayed in list
- 0, track,
- 1, codec,
- 2, s_quality ? s_quality : br,
- 3, sr,
- 4, mix,
- 5, s_gain,
- 6, s_drc,
- -1);
- gtk_tree_selection_select_iter(selection, &iter);
- g_free(s_drc);
- g_free(s_gain);
- g_free(s_quality);
+ GtkTreeView *treeview;
+ GtkTreeIter iter;
+ GtkListStore *store;
+ GtkTreeSelection *selection;
+ const gchar *track, *codec, *br, *sr, *mix;
+ gchar *s_drc, *s_gain, *s_quality = NULL;
+ gdouble drc;
+ gdouble gain;
+
+ g_debug("ghb_add_audio_to_ui ()");
+ treeview = GTK_TREE_VIEW(GHB_WIDGET(builder, "audio_list"));
+ selection = gtk_tree_view_get_selection (treeview);
+ store = GTK_LIST_STORE(gtk_tree_view_get_model(treeview));
+
+ track = ghb_settings_combo_option(settings, "AudioTrack");
+ codec = ghb_settings_combo_option(settings, "AudioEncoderActual");
+ double quality = ghb_settings_get_double(settings, "AudioTrackQuality");
+ if (ghb_settings_get_boolean(settings, "AudioTrackQualityEnable") &&
+ quality != HB_INVALID_AUDIO_QUALITY)
+ {
+ int codec = ghb_settings_combo_int(settings, "AudioEncoderActual");
+ s_quality = ghb_format_quality("Q/", codec, quality);
+ }
+ else
+ {
+ br = ghb_settings_combo_option(settings, "AudioBitrate");
+ }
+ sr = ghb_settings_combo_option(settings, "AudioSamplerate");
+ mix = ghb_settings_combo_option(settings, "AudioMixdown");
+ gain = ghb_settings_get_double(settings, "AudioTrackGain");
+ s_gain = g_strdup_printf("%ddB", (int)gain);
+
+ drc = ghb_settings_get_double(settings, "AudioTrackDRCSlider");
+ if (drc < 1.0)
+ s_drc = g_strdup("Off");
+ else
+ s_drc = g_strdup_printf("%.1f", drc);
+
+ gtk_list_store_append(store, &iter);
+ gtk_list_store_set(store, &iter,
+ // These are displayed in list
+ 0, track,
+ 1, codec,
+ 2, s_quality ? s_quality : br,
+ 3, sr,
+ 4, mix,
+ 5, s_gain,
+ 6, s_drc,
+ -1);
+ gtk_tree_selection_select_iter(selection, &iter);
+ g_free(s_drc);
+ g_free(s_gain);
+ g_free(s_quality);
}
G_MODULE_EXPORT void
audio_list_selection_changed_cb(GtkTreeSelection *selection, signal_user_data_t *ud)
{
- GtkTreeModel *store;
- GtkTreeIter iter;
- GtkWidget *widget;
-
- GtkTreePath *treepath;
- gint *indices;
- gint row;
- GValue *asettings = NULL;
-
- const GValue *audio_list;
- g_debug("audio_list_selection_changed_cb ()");
- if (gtk_tree_selection_get_selected(selection, &store, &iter))
- {
- //const gchar *actual_codec, *track, *codec, *bitrate, *sample_rate, *mix;
- //gdouble drc;
-
- // Get the row number
- treepath = gtk_tree_model_get_path (store, &iter);
- indices = gtk_tree_path_get_indices (treepath);
- row = indices[0];
- gtk_tree_path_free(treepath);
- // find audio settings
- if (row < 0) return;
- audio_list = ghb_settings_get_value(ud->settings, "audio_list");
- if (row >= ghb_array_len(audio_list))
- return;
- asettings = ghb_array_get_nth(audio_list, row);
-
- block_updates = TRUE;
- ghb_ui_update(ud, "AudioTrack", ghb_settings_get_value(asettings, "AudioTrack"));
- ghb_ui_update(ud, "AudioEncoder", ghb_settings_get_value(asettings, "AudioEncoder"));
- ghb_settings_set_value(ud->settings, "AudioEncoderActual", ghb_settings_get_value(asettings, "AudioEncoderActual"));
- ghb_check_dependency(ud, NULL, "AudioEncoderActual");
- ghb_ui_update(ud, "AudioBitrate", ghb_settings_get_value(asettings, "AudioBitrate"));
- ghb_ui_update(ud, "AudioTrackName", ghb_settings_get_value(asettings, "AudioTrackName"));
- ghb_ui_update(ud, "AudioSamplerate", ghb_settings_get_value(asettings, "AudioSamplerate"));
- ghb_ui_update(ud, "AudioMixdown", ghb_settings_get_value(asettings, "AudioMixdown"));
- ghb_ui_update(ud, "AudioTrackDRCSlider", ghb_settings_get_value(asettings, "AudioTrackDRCSlider"));
- ghb_ui_update(ud, "AudioTrackGain", ghb_settings_get_value(asettings, "AudioTrackGain"));
- ghb_ui_update(ud, "AudioTrackQuality", ghb_settings_get_value(asettings, "AudioTrackQuality"));
- ghb_ui_update(ud, "AudioTrackQualityEnable", ghb_settings_get_value(asettings, "AudioTrackQualityEnable"));
- block_updates = FALSE;
- widget = GHB_WIDGET (ud->builder, "audio_remove");
- gtk_widget_set_sensitive(widget, TRUE);
- }
- else
- {
- widget = GHB_WIDGET (ud->builder, "audio_remove");
- gtk_widget_set_sensitive(widget, FALSE);
- }
+ GtkTreeModel *store;
+ GtkTreeIter iter;
+ GtkWidget *widget;
+
+ GtkTreePath *treepath;
+ gint *indices;
+ gint row;
+ GValue *asettings = NULL;
+
+ const GValue *audio_list;
+ g_debug("audio_list_selection_changed_cb ()");
+ if (gtk_tree_selection_get_selected(selection, &store, &iter))
+ {
+ //const gchar *actual_codec, *track, *codec, *bitrate, *sample_rate, *mix;
+ //gdouble drc;
+
+ // Get the row number
+ treepath = gtk_tree_model_get_path (store, &iter);
+ indices = gtk_tree_path_get_indices (treepath);
+ row = indices[0];
+ gtk_tree_path_free(treepath);
+ // find audio settings
+ if (row < 0) return;
+ audio_list = ghb_settings_get_value(ud->settings, "audio_list");
+ if (row >= ghb_array_len(audio_list))
+ return;
+ asettings = ghb_array_get_nth(audio_list, row);
+
+ block_updates = TRUE;
+ ghb_ui_update(ud, "AudioTrack", ghb_settings_get_value(asettings, "AudioTrack"));
+ ghb_ui_update(ud, "AudioEncoder", ghb_settings_get_value(asettings, "AudioEncoder"));
+ ghb_settings_set_value(ud->settings, "AudioEncoderActual", ghb_settings_get_value(asettings, "AudioEncoderActual"));
+ ghb_check_dependency(ud, NULL, "AudioEncoderActual");
+ ghb_ui_update(ud, "AudioBitrate", ghb_settings_get_value(asettings, "AudioBitrate"));
+ ghb_ui_update(ud, "AudioTrackName", ghb_settings_get_value(asettings, "AudioTrackName"));
+ ghb_ui_update(ud, "AudioSamplerate", ghb_settings_get_value(asettings, "AudioSamplerate"));
+ ghb_ui_update(ud, "AudioMixdown", ghb_settings_get_value(asettings, "AudioMixdown"));
+ ghb_ui_update(ud, "AudioTrackDRCSlider", ghb_settings_get_value(asettings, "AudioTrackDRCSlider"));
+ ghb_ui_update(ud, "AudioTrackGain", ghb_settings_get_value(asettings, "AudioTrackGain"));
+ ghb_ui_update(ud, "AudioTrackQuality", ghb_settings_get_value(asettings, "AudioTrackQuality"));
+ ghb_ui_update(ud, "AudioTrackQualityEnable", ghb_settings_get_value(asettings, "AudioTrackQualityEnable"));
+ block_updates = FALSE;
+ widget = GHB_WIDGET (ud->builder, "audio_remove");
+ gtk_widget_set_sensitive(widget, TRUE);
+ }
+ else
+ {
+ widget = GHB_WIDGET (ud->builder, "audio_remove");
+ gtk_widget_set_sensitive(widget, FALSE);
+ }
}
static gboolean
ghb_add_audio_to_settings(GValue *settings, GValue *asettings)
{
- GValue *audio_list;
- const gchar * track;
- int count;
-
- audio_list = ghb_settings_get_value(settings, "audio_list");
- if (audio_list == NULL)
- {
- audio_list = ghb_array_value_new(8);
- ghb_settings_set_value(settings, "audio_list", audio_list);
- }
- count = ghb_array_len(audio_list);
- // Don't allow more than 99
- // This is a hard limit imposed by libhb/reader.c:GetFifoForId()
- if (count >= 99)
- {
- ghb_value_free(asettings);
- return FALSE;
- }
-
- int title_no = ghb_settings_get_int(settings, "title_no");
- int track_no = ghb_settings_get_int(asettings, "AudioTrack");
- track = ghb_audio_track_description(track_no, title_no);
- ghb_settings_set_string(asettings, "AudioTrackDescription", track);
-
- GValue *aname;
- aname = ghb_dict_lookup(asettings, "AudioTrackName");
- if (aname == NULL)
- {
- ghb_settings_set_string(asettings, "AudioTrackName", "");
- }
- if (ghb_array_len(audio_list) >= 99)
- {
- ghb_value_free(asettings);
- return FALSE;
- }
- ghb_array_append(audio_list, asettings);
- return TRUE;
+ GValue *audio_list;
+ const gchar * track;
+ int count;
+
+ audio_list = ghb_settings_get_value(settings, "audio_list");
+ if (audio_list == NULL)
+ {
+ audio_list = ghb_array_value_new(8);
+ ghb_settings_set_value(settings, "audio_list", audio_list);
+ }
+ count = ghb_array_len(audio_list);
+ // Don't allow more than 99
+ // This is a hard limit imposed by libhb/reader.c:GetFifoForId()
+ if (count >= 99)
+ {
+ ghb_value_free(asettings);
+ return FALSE;
+ }
+
+ int title_no = ghb_settings_get_int(settings, "title_no");
+ int track_no = ghb_settings_get_int(asettings, "AudioTrack");
+ track = ghb_audio_track_description(track_no, title_no);
+ ghb_settings_set_string(asettings, "AudioTrackDescription", track);
+
+ GValue *aname;
+ aname = ghb_dict_lookup(asettings, "AudioTrackName");
+ if (aname == NULL)
+ {
+ ghb_settings_set_string(asettings, "AudioTrackName", "");
+ }
+ if (ghb_array_len(audio_list) >= 99)
+ {
+ ghb_value_free(asettings);
+ return FALSE;
+ }
+ ghb_array_append(audio_list, asettings);
+ return TRUE;
}
G_MODULE_EXPORT void
audio_add_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud)
{
- // Add the current audio settings to the list.
- GValue *asettings;
- GtkWidget *widget;
-
- g_debug("audio_add_clicked_cb ()");
- asettings = ghb_dict_value_new();
- widget = GHB_WIDGET(ud->builder, "AudioTrack");
- ghb_settings_take_value(asettings, "AudioTrack", ghb_widget_value(widget));
- widget = GHB_WIDGET(ud->builder, "AudioEncoder");
- ghb_settings_take_value(asettings, "AudioEncoder", ghb_widget_value(widget));
- ghb_settings_set_value(asettings, "AudioEncoderActual",
- ghb_settings_get_value(ud->settings, "AudioEncoderActual"));
- widget = GHB_WIDGET(ud->builder, "AudioTrackQualityEnable");
- ghb_settings_take_value(asettings, "AudioTrackQualityEnable", ghb_widget_value(widget));
- widget = GHB_WIDGET(ud->builder, "AudioTrackQuality");
- ghb_settings_take_value(asettings, "AudioTrackQuality", ghb_widget_value(widget));
- widget = GHB_WIDGET(ud->builder, "AudioBitrate");
- ghb_settings_take_value(asettings, "AudioBitrate", ghb_widget_value(widget));
- widget = GHB_WIDGET(ud->builder, "AudioSamplerate");
- ghb_settings_take_value(asettings, "AudioSamplerate", ghb_widget_value(widget));
- widget = GHB_WIDGET(ud->builder, "AudioMixdown");
- ghb_settings_take_value(asettings, "AudioMixdown", ghb_widget_value(widget));
- widget = GHB_WIDGET(ud->builder, "AudioTrackGain");
- ghb_settings_take_value(asettings, "AudioTrackGain", ghb_widget_value(widget));
- widget = GHB_WIDGET(ud->builder, "AudioTrackDRCSlider");
- ghb_settings_take_value(asettings, "AudioTrackDRCSlider", ghb_widget_value(widget));
-
- if (!ghb_add_audio_to_settings(ud->settings, asettings))
- return;
-
- ghb_add_audio_to_ui(ud->builder, asettings);
- check_list_full(ud);
+ // Add the current audio settings to the list.
+ GValue *asettings;
+ GtkWidget *widget;
+
+ g_debug("audio_add_clicked_cb ()");
+ asettings = ghb_dict_value_new();
+ widget = GHB_WIDGET(ud->builder, "AudioTrack");
+ ghb_settings_take_value(asettings, "AudioTrack", ghb_widget_value(widget));
+ widget = GHB_WIDGET(ud->builder, "AudioEncoder");
+ ghb_settings_take_value(asettings, "AudioEncoder", ghb_widget_value(widget));
+ ghb_settings_set_value(asettings, "AudioEncoderActual",
+ ghb_settings_get_value(ud->settings, "AudioEncoderActual"));
+ widget = GHB_WIDGET(ud->builder, "AudioTrackQualityEnable");
+ ghb_settings_take_value(asettings, "AudioTrackQualityEnable", ghb_widget_value(widget));
+ widget = GHB_WIDGET(ud->builder, "AudioTrackQuality");
+ ghb_settings_take_value(asettings, "AudioTrackQuality", ghb_widget_value(widget));
+ widget = GHB_WIDGET(ud->builder, "AudioBitrate");
+ ghb_settings_take_value(asettings, "AudioBitrate", ghb_widget_value(widget));
+ widget = GHB_WIDGET(ud->builder, "AudioSamplerate");
+ ghb_settings_take_value(asettings, "AudioSamplerate", ghb_widget_value(widget));
+ widget = GHB_WIDGET(ud->builder, "AudioMixdown");
+ ghb_settings_take_value(asettings, "AudioMixdown", ghb_widget_value(widget));
+ widget = GHB_WIDGET(ud->builder, "AudioTrackGain");
+ ghb_settings_take_value(asettings, "AudioTrackGain", ghb_widget_value(widget));
+ widget = GHB_WIDGET(ud->builder, "AudioTrackDRCSlider");
+ ghb_settings_take_value(asettings, "AudioTrackDRCSlider", ghb_widget_value(widget));
+
+ if (!ghb_add_audio_to_settings(ud->settings, asettings))
+ return;
+
+ ghb_add_audio_to_ui(ud->builder, asettings);
+ check_list_full(ud);
}
G_MODULE_EXPORT void
audio_remove_clicked_cb(GtkWidget *widget, signal_user_data_t *ud)
{
- GtkTreeView *treeview;
- GtkTreePath *treepath;
- GtkTreeSelection *selection;
- GtkTreeModel *store;
- GtkTreeIter iter, nextIter;
- gint *indices;
- gint row;
- GValue *audio_list;
-
- g_debug("audio_remove_clicked_cb ()");
- treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "audio_list"));
- selection = gtk_tree_view_get_selection (treeview);
- if (gtk_tree_selection_get_selected(selection, &store, &iter))
- {
- nextIter = iter;
- if (!gtk_tree_model_iter_next(store, &nextIter))
- {
- nextIter = iter;
- if (gtk_tree_model_get_iter_first(store, &nextIter))
- {
- gtk_tree_selection_select_iter (selection, &nextIter);
- }
- }
- else
- {
- gtk_tree_selection_select_iter (selection, &nextIter);
- }
- // Get the row number
- treepath = gtk_tree_model_get_path (store, &iter);
- indices = gtk_tree_path_get_indices (treepath);
- row = indices[0];
- gtk_tree_path_free(treepath);
- // Remove the selected item
- gtk_list_store_remove (GTK_LIST_STORE(store), &iter);
- // remove from audio settings list
- if (row < 0) return;
- widget = GHB_WIDGET (ud->builder, "audio_add");
- gtk_widget_set_sensitive(widget, TRUE);
- audio_list = ghb_settings_get_value(ud->settings, "audio_list");
- if (row >= ghb_array_len(audio_list))
- return;
- GValue *old = ghb_array_get_nth(audio_list, row);
- ghb_value_free(old);
- ghb_array_remove(audio_list, row);
- }
+ GtkTreeView *treeview;
+ GtkTreePath *treepath;
+ GtkTreeSelection *selection;
+ GtkTreeModel *store;
+ GtkTreeIter iter, nextIter;
+ gint *indices;
+ gint row;
+ GValue *audio_list;
+
+ g_debug("audio_remove_clicked_cb ()");
+ treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "audio_list"));
+ selection = gtk_tree_view_get_selection (treeview);
+ if (gtk_tree_selection_get_selected(selection, &store, &iter))
+ {
+ nextIter = iter;
+ if (!gtk_tree_model_iter_next(store, &nextIter))
+ {
+ nextIter = iter;
+ if (gtk_tree_model_get_iter_first(store, &nextIter))
+ {
+ gtk_tree_selection_select_iter (selection, &nextIter);
+ }
+ }
+ else
+ {
+ gtk_tree_selection_select_iter (selection, &nextIter);
+ }
+ // Get the row number
+ treepath = gtk_tree_model_get_path (store, &iter);
+ indices = gtk_tree_path_get_indices (treepath);
+ row = indices[0];
+ gtk_tree_path_free(treepath);
+ // Remove the selected item
+ gtk_list_store_remove (GTK_LIST_STORE(store), &iter);
+ // remove from audio settings list
+ if (row < 0) return;
+ widget = GHB_WIDGET (ud->builder, "audio_add");
+ gtk_widget_set_sensitive(widget, TRUE);
+ audio_list = ghb_settings_get_value(ud->settings, "audio_list");
+ if (row >= ghb_array_len(audio_list))
+ return;
+ GValue *old = ghb_array_get_nth(audio_list, row);
+ ghb_value_free(old);
+ ghb_array_remove(audio_list, row);
+ }
}
void
ghb_set_audio(signal_user_data_t *ud, GValue *settings)
{
- gint acodec_code;
-
- GValue *alist;
- GValue *track, *audio, *acodec, *acodec_actual, *bitrate, *rate,
- *mix, *drc, *gain, *quality, *enable_quality;
- gint count, ii;
-
- g_debug("set_audio");
- // Clear the audio list
- ghb_clear_audio_list_settings(ud->settings);
- ghb_clear_audio_list_ui(ud->builder);
- alist = ghb_settings_get_value(settings, "audio_list");
-
- count = ghb_array_len(alist);
- for (ii = 0; ii < count; ii++)
- {
- audio = ghb_array_get_nth(alist, ii);
- track = ghb_settings_get_value(audio, "AudioTrack");
- acodec = ghb_settings_get_value(audio, "AudioEncoder");
- acodec_actual = ghb_settings_get_value(audio, "AudioEncoderActual");
- enable_quality = ghb_settings_get_value(audio, "AudioTrackQualityEnable");
- quality = ghb_settings_get_value(audio, "AudioTrackQuality");
- bitrate = ghb_settings_get_value(audio, "AudioBitrate");
- rate = ghb_settings_get_value(audio, "AudioSamplerate");
- mix = ghb_settings_get_value(audio, "AudioMixdown");
- gain = ghb_settings_get_value(audio, "AudioTrackGain");
- drc = ghb_settings_get_value(audio, "AudioTrackDRCSlider");
- acodec_code = ghb_lookup_combo_int("AudioEncoder", acodec);
-
- if (acodec_code != 0)
- {
- GValue *asettings = ghb_dict_value_new();
- ghb_settings_set_value(asettings, "AudioTrack", track);
- ghb_settings_set_value(asettings, "AudioEncoder", acodec);
- ghb_settings_set_value(asettings, "AudioEncoderActual", acodec_actual);
- ghb_settings_set_value(asettings, "AudioTrackQualityEnable", enable_quality);
- ghb_settings_set_value(asettings, "AudioTrackQuality", quality);
-
- // This gets set autimatically if the codec is passthru
- ghb_settings_set_value(asettings, "AudioBitrate", bitrate);
- ghb_settings_set_value(asettings, "AudioSamplerate", rate);
- ghb_settings_set_value(asettings, "AudioMixdown", mix);
- ghb_settings_set_value(asettings, "AudioTrackGain", gain);
- ghb_settings_set_value(asettings, "AudioTrackDRCSlider", drc);
-
- ghb_add_audio_to_settings(ud->settings, asettings);
-
- ghb_add_audio_to_ui(ud->builder, asettings);
- ghb_adjust_audio_rate_combos(ud);
- }
- }
- check_list_full(ud);
+ gint acodec_code;
+
+ GValue *alist;
+ GValue *track, *audio, *acodec, *acodec_actual, *bitrate, *rate,
+ *mix, *drc, *gain, *quality, *enable_quality;
+ gint count, ii;
+
+ g_debug("set_audio");
+ // Clear the audio list
+ ghb_clear_audio_list_settings(ud->settings);
+ ghb_clear_audio_list_ui(ud->builder);
+ alist = ghb_settings_get_value(settings, "audio_list");
+
+ count = ghb_array_len(alist);
+ for (ii = 0; ii < count; ii++)
+ {
+ audio = ghb_array_get_nth(alist, ii);
+ track = ghb_settings_get_value(audio, "AudioTrack");
+ acodec = ghb_settings_get_value(audio, "AudioEncoder");
+ acodec_actual = ghb_settings_get_value(audio, "AudioEncoderActual");
+ enable_quality = ghb_settings_get_value(audio, "AudioTrackQualityEnable");
+ quality = ghb_settings_get_value(audio, "AudioTrackQuality");
+ bitrate = ghb_settings_get_value(audio, "AudioBitrate");
+ rate = ghb_settings_get_value(audio, "AudioSamplerate");
+ mix = ghb_settings_get_value(audio, "AudioMixdown");
+ gain = ghb_settings_get_value(audio, "AudioTrackGain");
+ drc = ghb_settings_get_value(audio, "AudioTrackDRCSlider");
+ acodec_code = ghb_lookup_combo_int("AudioEncoder", acodec);
+
+ if (acodec_code != 0)
+ {
+ GValue *asettings = ghb_dict_value_new();
+ ghb_settings_set_value(asettings, "AudioTrack", track);
+ ghb_settings_set_value(asettings, "AudioEncoder", acodec);
+ ghb_settings_set_value(asettings, "AudioEncoderActual", acodec_actual);
+ ghb_settings_set_value(asettings, "AudioTrackQualityEnable", enable_quality);
+ ghb_settings_set_value(asettings, "AudioTrackQuality", quality);
+
+ // This gets set autimatically if the codec is passthru
+ ghb_settings_set_value(asettings, "AudioBitrate", bitrate);
+ ghb_settings_set_value(asettings, "AudioSamplerate", rate);
+ ghb_settings_set_value(asettings, "AudioMixdown", mix);
+ ghb_settings_set_value(asettings, "AudioTrackGain", gain);
+ ghb_settings_set_value(asettings, "AudioTrackDRCSlider", drc);
+
+ ghb_add_audio_to_settings(ud->settings, asettings);
+
+ ghb_add_audio_to_ui(ud->builder, asettings);
+ ghb_adjust_audio_rate_combos(ud);
+ }
+ }
+ check_list_full(ud);
}
diff --git a/gtk/src/audiohandler.h b/gtk/src/audiohandler.h
index 7bd300cc5..7fde7381e 100644
--- a/gtk/src/audiohandler.h
+++ b/gtk/src/audiohandler.h
@@ -17,9 +17,9 @@
*
* You should have received a copy of the GNU General Public License
* along with callbacks.h. If not, write to:
- * The Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301, USA.
+ * The Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301, USA.
*/
#if !defined(_AUDIOHANDLER_H_)
diff --git a/gtk/src/callbacks.c b/gtk/src/callbacks.c
index a37771a86..a3c8947e8 100644
--- a/gtk/src/callbacks.c
+++ b/gtk/src/callbacks.c
@@ -107,305 +107,305 @@ GValue *rev_map;
void
ghb_init_dep_map()
{
- dep_map = ghb_resource_get("widget-deps");
- rev_map = ghb_resource_get("widget-reverse-deps");
+ dep_map = ghb_resource_get("widget-deps");
+ rev_map = ghb_resource_get("widget-reverse-deps");
}
static gboolean
dep_check(signal_user_data_t *ud, const gchar *name, gboolean *out_hide)
{
- GtkWidget *widget;
- GObject *dep_object;
- gint ii;
- gint count;
- gboolean result = TRUE;
- GValue *array, *data;
- gchar *widget_name;
-
- g_debug("dep_check () %s", name);
-
- if (rev_map == NULL) return TRUE;
- array = ghb_dict_lookup(rev_map, name);
- count = ghb_array_len(array);
- *out_hide = FALSE;
- for (ii = 0; ii < count; ii++)
- {
- data = ghb_array_get_nth(array, ii);
- widget_name = ghb_value_string(ghb_array_get_nth(data, 0));
- widget = GHB_WIDGET(ud->builder, widget_name);
- dep_object = gtk_builder_get_object(ud->builder, name);
- if (widget != NULL && !gtk_widget_is_sensitive(widget))
- continue;
- if (dep_object == NULL)
- {
- g_message("Failed to find widget");
- }
- else
- {
- gchar *value;
- gint jj = 0;
- gchar **values;
- gboolean sensitive = FALSE;
- gboolean die, hide;
-
- die = ghb_value_boolean(ghb_array_get_nth(data, 2));
- hide = ghb_value_boolean(ghb_array_get_nth(data, 3));
- value = ghb_value_string(ghb_array_get_nth(data, 1));
- values = g_strsplit(value, "|", 10);
- g_free(value);
-
- if (widget)
- value = ghb_widget_string(widget);
- else
- value = ghb_settings_get_string(ud->settings, widget_name);
- while (values && values[jj])
- {
- if (values[jj][0] == '>')
- {
- gdouble dbl = g_strtod (&values[jj][1], NULL);
- gdouble dvalue = ghb_widget_double(widget);
- if (dvalue > dbl)
- {
- sensitive = TRUE;
- break;
- }
- }
- else if (values[jj][0] == '<')
- {
- gdouble dbl = g_strtod (&values[jj][1], NULL);
- gdouble dvalue = ghb_widget_double(widget);
- if (dvalue < dbl)
- {
- sensitive = TRUE;
- break;
- }
- }
- if (strcmp(values[jj], value) == 0)
- {
- sensitive = TRUE;
- break;
- }
- jj++;
- }
- sensitive = die ^ sensitive;
- if (!sensitive)
- {
- result = FALSE;
- *out_hide |= hide;
- }
- g_strfreev (values);
- g_free(value);
- }
- g_free(widget_name);
- }
- return result;
+ GtkWidget *widget;
+ GObject *dep_object;
+ gint ii;
+ gint count;
+ gboolean result = TRUE;
+ GValue *array, *data;
+ gchar *widget_name;
+
+ g_debug("dep_check () %s", name);
+
+ if (rev_map == NULL) return TRUE;
+ array = ghb_dict_lookup(rev_map, name);
+ count = ghb_array_len(array);
+ *out_hide = FALSE;
+ for (ii = 0; ii < count; ii++)
+ {
+ data = ghb_array_get_nth(array, ii);
+ widget_name = ghb_value_string(ghb_array_get_nth(data, 0));
+ widget = GHB_WIDGET(ud->builder, widget_name);
+ dep_object = gtk_builder_get_object(ud->builder, name);
+ if (widget != NULL && !gtk_widget_is_sensitive(widget))
+ continue;
+ if (dep_object == NULL)
+ {
+ g_message("Failed to find widget");
+ }
+ else
+ {
+ gchar *value;
+ gint jj = 0;
+ gchar **values;
+ gboolean sensitive = FALSE;
+ gboolean die, hide;
+
+ die = ghb_value_boolean(ghb_array_get_nth(data, 2));
+ hide = ghb_value_boolean(ghb_array_get_nth(data, 3));
+ value = ghb_value_string(ghb_array_get_nth(data, 1));
+ values = g_strsplit(value, "|", 10);
+ g_free(value);
+
+ if (widget)
+ value = ghb_widget_string(widget);
+ else
+ value = ghb_settings_get_string(ud->settings, widget_name);
+ while (values && values[jj])
+ {
+ if (values[jj][0] == '>')
+ {
+ gdouble dbl = g_strtod (&values[jj][1], NULL);
+ gdouble dvalue = ghb_widget_double(widget);
+ if (dvalue > dbl)
+ {
+ sensitive = TRUE;
+ break;
+ }
+ }
+ else if (values[jj][0] == '<')
+ {
+ gdouble dbl = g_strtod (&values[jj][1], NULL);
+ gdouble dvalue = ghb_widget_double(widget);
+ if (dvalue < dbl)
+ {
+ sensitive = TRUE;
+ break;
+ }
+ }
+ if (strcmp(values[jj], value) == 0)
+ {
+ sensitive = TRUE;
+ break;
+ }
+ jj++;
+ }
+ sensitive = die ^ sensitive;
+ if (!sensitive)
+ {
+ result = FALSE;
+ *out_hide |= hide;
+ }
+ g_strfreev (values);
+ g_free(value);
+ }
+ g_free(widget_name);
+ }
+ return result;
}
void
ghb_check_dependency(
- signal_user_data_t *ud,
- GtkWidget *widget,
- const char *alt_name)
-{
- GObject *dep_object;
- const gchar *name;
- GValue *array, *data;
- gint count, ii;
- gchar *dep_name;
- GType type;
-
- if (widget != NULL)
- {
- type = G_OBJECT_TYPE(widget);
- if (type == GTK_TYPE_COMBO_BOX || type == GTK_TYPE_COMBO_BOX_ENTRY)
- if (gtk_combo_box_get_active(GTK_COMBO_BOX(widget)) < 0) return;
- name = ghb_get_setting_key(widget);
- }
- else
- name = alt_name;
-
- g_debug("ghb_check_dependency () %s", name);
-
- if (dep_map == NULL) return;
- array = ghb_dict_lookup(dep_map, name);
- count = ghb_array_len(array);
- for (ii = 0; ii < count; ii++)
- {
- gboolean sensitive;
- gboolean hide;
-
- data = ghb_array_get_nth(array, ii);
- dep_name = ghb_value_string(data);
- dep_object = gtk_builder_get_object(ud->builder, dep_name);
- if (dep_object == NULL)
- {
- g_message("Failed to find dependent widget %s", dep_name);
- g_free(dep_name);
- continue;
- }
- sensitive = dep_check(ud, dep_name, &hide);
- if (GTK_IS_ACTION(dep_object))
- {
- gtk_action_set_sensitive(GTK_ACTION(dep_object), sensitive);
- gtk_action_set_visible(GTK_ACTION(dep_object), sensitive || !hide);
- }
- else
- {
- gtk_widget_set_sensitive(GTK_WIDGET(dep_object), sensitive);
- if (!sensitive && hide)
- {
- if (gtk_widget_get_visible(GTK_WIDGET(dep_object)))
- {
- gtk_widget_hide(GTK_WIDGET(dep_object));
- }
- }
- else
- {
- if (!gtk_widget_get_visible(GTK_WIDGET(dep_object)))
- {
- gtk_widget_show_now(GTK_WIDGET(dep_object));
- }
- }
- }
- g_free(dep_name);
- }
+ signal_user_data_t *ud,
+ GtkWidget *widget,
+ const char *alt_name)
+{
+ GObject *dep_object;
+ const gchar *name;
+ GValue *array, *data;
+ gint count, ii;
+ gchar *dep_name;
+ GType type;
+
+ if (widget != NULL)
+ {
+ type = G_OBJECT_TYPE(widget);
+ if (type == GTK_TYPE_COMBO_BOX || type == GTK_TYPE_COMBO_BOX_ENTRY)
+ if (gtk_combo_box_get_active(GTK_COMBO_BOX(widget)) < 0) return;
+ name = ghb_get_setting_key(widget);
+ }
+ else
+ name = alt_name;
+
+ g_debug("ghb_check_dependency () %s", name);
+
+ if (dep_map == NULL) return;
+ array = ghb_dict_lookup(dep_map, name);
+ count = ghb_array_len(array);
+ for (ii = 0; ii < count; ii++)
+ {
+ gboolean sensitive;
+ gboolean hide;
+
+ data = ghb_array_get_nth(array, ii);
+ dep_name = ghb_value_string(data);
+ dep_object = gtk_builder_get_object(ud->builder, dep_name);
+ if (dep_object == NULL)
+ {
+ g_message("Failed to find dependent widget %s", dep_name);
+ g_free(dep_name);
+ continue;
+ }
+ sensitive = dep_check(ud, dep_name, &hide);
+ if (GTK_IS_ACTION(dep_object))
+ {
+ gtk_action_set_sensitive(GTK_ACTION(dep_object), sensitive);
+ gtk_action_set_visible(GTK_ACTION(dep_object), sensitive || !hide);
+ }
+ else
+ {
+ gtk_widget_set_sensitive(GTK_WIDGET(dep_object), sensitive);
+ if (!sensitive && hide)
+ {
+ if (gtk_widget_get_visible(GTK_WIDGET(dep_object)))
+ {
+ gtk_widget_hide(GTK_WIDGET(dep_object));
+ }
+ }
+ else
+ {
+ if (!gtk_widget_get_visible(GTK_WIDGET(dep_object)))
+ {
+ gtk_widget_show_now(GTK_WIDGET(dep_object));
+ }
+ }
+ }
+ g_free(dep_name);
+ }
}
void
ghb_check_all_depencencies(signal_user_data_t *ud)
{
- GHashTableIter iter;
- gchar *dep_name;
- GValue *value;
- GObject *dep_object;
-
- g_debug("ghb_check_all_depencencies ()");
- if (rev_map == NULL) return;
- ghb_dict_iter_init(&iter, rev_map);
- // middle (void*) cast prevents gcc warning "defreferencing type-punned
- // pointer will break strict-aliasing rules"
- while (g_hash_table_iter_next(
- &iter, (gpointer*)(void*)&dep_name, (gpointer*)(void*)&value))
- {
- gboolean sensitive;
- gboolean hide;
-
- dep_object = gtk_builder_get_object (ud->builder, dep_name);
- if (dep_object == NULL)
- {
- g_message("Failed to find dependent widget %s", dep_name);
- continue;
- }
- sensitive = dep_check(ud, dep_name, &hide);
- if (GTK_IS_ACTION(dep_object))
- {
- gtk_action_set_sensitive(GTK_ACTION(dep_object), sensitive);
- gtk_action_set_visible(GTK_ACTION(dep_object), sensitive || !hide);
- }
- else
- {
- gtk_widget_set_sensitive(GTK_WIDGET(dep_object), sensitive);
- if (!sensitive && hide)
- {
- gtk_widget_hide(GTK_WIDGET(dep_object));
- }
- else
- {
- gtk_widget_show_now(GTK_WIDGET(dep_object));
- }
- }
- }
+ GHashTableIter iter;
+ gchar *dep_name;
+ GValue *value;
+ GObject *dep_object;
+
+ g_debug("ghb_check_all_depencencies ()");
+ if (rev_map == NULL) return;
+ ghb_dict_iter_init(&iter, rev_map);
+ // middle (void*) cast prevents gcc warning "defreferencing type-punned
+ // pointer will break strict-aliasing rules"
+ while (g_hash_table_iter_next(
+ &iter, (gpointer*)(void*)&dep_name, (gpointer*)(void*)&value))
+ {
+ gboolean sensitive;
+ gboolean hide;
+
+ dep_object = gtk_builder_get_object (ud->builder, dep_name);
+ if (dep_object == NULL)
+ {
+ g_message("Failed to find dependent widget %s", dep_name);
+ continue;
+ }
+ sensitive = dep_check(ud, dep_name, &hide);
+ if (GTK_IS_ACTION(dep_object))
+ {
+ gtk_action_set_sensitive(GTK_ACTION(dep_object), sensitive);
+ gtk_action_set_visible(GTK_ACTION(dep_object), sensitive || !hide);
+ }
+ else
+ {
+ gtk_widget_set_sensitive(GTK_WIDGET(dep_object), sensitive);
+ if (!sensitive && hide)
+ {
+ gtk_widget_hide(GTK_WIDGET(dep_object));
+ }
+ else
+ {
+ gtk_widget_show_now(GTK_WIDGET(dep_object));
+ }
+ }
+ }
}
G_MODULE_EXPORT void
on_quit1_activate(GtkMenuItem *quit, signal_user_data_t *ud)
{
- gint state = ghb_get_queue_state();
- g_debug("on_quit1_activate ()");
- if (state & (GHB_STATE_WORKING|GHB_STATE_SEARCHING))
- {
- if (ghb_cancel_encode2(ud, "Closing HandBrake will terminate encoding.\n"))
- {
- ghb_hb_cleanup(FALSE);
- prune_logs(ud);
- gtk_main_quit();
- return;
- }
- return;
- }
- ghb_hb_cleanup(FALSE);
- prune_logs(ud);
- gtk_main_quit();
+ gint state = ghb_get_queue_state();
+ g_debug("on_quit1_activate ()");
+ if (state & (GHB_STATE_WORKING|GHB_STATE_SEARCHING))
+ {
+ if (ghb_cancel_encode2(ud, "Closing HandBrake will terminate encoding.\n"))
+ {
+ ghb_hb_cleanup(FALSE);
+ prune_logs(ud);
+ gtk_main_quit();
+ return;
+ }
+ return;
+ }
+ ghb_hb_cleanup(FALSE);
+ prune_logs(ud);
+ gtk_main_quit();
}
gboolean
uppers_and_unders(gchar *str)
{
- if (str == NULL) return FALSE;
- str = g_strchomp(g_strchug(str));
- while (*str)
- {
- if (*str == ' ')
- {
- return FALSE;
- }
- if (*str >= 'a' && *str <= 'z')
- {
- return FALSE;
- }
- str++;
- }
- return TRUE;
+ if (str == NULL) return FALSE;
+ str = g_strchomp(g_strchug(str));
+ while (*str)
+ {
+ if (*str == ' ')
+ {
+ return FALSE;
+ }
+ if (*str >= 'a' && *str <= 'z')
+ {
+ return FALSE;
+ }
+ str++;
+ }
+ return TRUE;
}
enum
{
- CAMEL_FIRST_UPPER,
- CAMEL_OTHER
+ CAMEL_FIRST_UPPER,
+ CAMEL_OTHER
};
void
camel_convert(gchar *str)
{
- gint state = CAMEL_OTHER;
-
- if (str == NULL) return;
- while (*str)
- {
- if (*str == '_') *str = ' ';
- switch (state)
- {
- case CAMEL_OTHER:
- {
- if (*str >= 'A' && *str <= 'Z')
- state = CAMEL_FIRST_UPPER;
- else
- state = CAMEL_OTHER;
-
- } break;
- case CAMEL_FIRST_UPPER:
- {
- if (*str >= 'A' && *str <= 'Z')
- *str = *str - 'A' + 'a';
- else
- state = CAMEL_OTHER;
- } break;
- }
- str++;
- }
+ gint state = CAMEL_OTHER;
+
+ if (str == NULL) return;
+ while (*str)
+ {
+ if (*str == '_') *str = ' ';
+ switch (state)
+ {
+ case CAMEL_OTHER:
+ {
+ if (*str >= 'A' && *str <= 'Z')
+ state = CAMEL_FIRST_UPPER;
+ else
+ state = CAMEL_OTHER;
+
+ } break;
+ case CAMEL_FIRST_UPPER:
+ {
+ if (*str >= 'A' && *str <= 'Z')
+ *str = *str - 'A' + 'a';
+ else
+ state = CAMEL_OTHER;
+ } break;
+ }
+ str++;
+ }
}
#if defined(_WIN32)
static gchar*
get_dvd_device_name(gchar *device)
{
- return g_strdup(device);
+ return g_strdup(device);
}
#else
static gchar*
get_dvd_device_name(GDrive *gd)
{
- return g_drive_get_identifier(gd, G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE);
+ return g_drive_get_identifier(gd, G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE);
}
#endif
@@ -415,449 +415,449 @@ static GMutex *volname_mutex = NULL;
static void
free_volname_key(gpointer data)
{
- if (data != NULL)
- g_free(data);
+ if (data != NULL)
+ g_free(data);
}
static void
free_volname_value(gpointer data)
{
- if (data != NULL)
- g_free(data);
+ if (data != NULL)
+ g_free(data);
}
#if defined(_WIN32)
static gchar*
get_direct_dvd_volume_name(const gchar *drive)
{
- gchar *result = NULL;
- gchar vname[51], fsname[51];
+ gchar *result = NULL;
+ gchar vname[51], fsname[51];
- if (GetVolumeInformation(drive, vname, 50, NULL, NULL, NULL, fsname, 50))
- {
- result = g_strdup_printf("%s", vname);
- }
- return result;
+ if (GetVolumeInformation(drive, vname, 50, NULL, NULL, NULL, fsname, 50))
+ {
+ result = g_strdup_printf("%s", vname);
+ }
+ return result;
}
#else
static gchar*
get_direct_dvd_volume_name(const gchar *drive)
{
- gchar *result;
+ gchar *result;
- result = ghb_dvd_volname (drive);
- return result;
+ result = ghb_dvd_volname (drive);
+ return result;
}
#endif
static gchar*
get_dvd_volume_name(gpointer gd)
{
- gchar *label = NULL;
- gchar *result;
- gchar *drive;
-
- drive = get_dvd_device_name(gd);
- g_mutex_lock(volname_mutex);
- label = g_strdup(g_hash_table_lookup(volname_hash, drive));
- g_mutex_unlock(volname_mutex);
- if (label != NULL)
- {
- if (uppers_and_unders(label))
- {
- camel_convert(label);
- }
+ gchar *label = NULL;
+ gchar *result;
+ gchar *drive;
+
+ drive = get_dvd_device_name(gd);
+ g_mutex_lock(volname_mutex);
+ label = g_strdup(g_hash_table_lookup(volname_hash, drive));
+ g_mutex_unlock(volname_mutex);
+ if (label != NULL)
+ {
+ if (uppers_and_unders(label))
+ {
+ camel_convert(label);
+ }
#if defined(_WIN32)
- result = g_strdup_printf("%s (%s)", label, drive);
+ result = g_strdup_printf("%s (%s)", label, drive);
#else
- result = g_strdup_printf("%s - %s", drive, label);
+ result = g_strdup_printf("%s - %s", drive, label);
#endif
- g_free(label);
- }
- else
- {
- result = g_strdup_printf("%s", drive);
- }
- g_free(drive);
- return result;
+ g_free(label);
+ }
+ else
+ {
+ result = g_strdup_printf("%s", drive);
+ }
+ g_free(drive);
+ return result;
}
void
ghb_volname_cache_init(void)
{
- volname_mutex = g_mutex_new();
- volname_hash = g_hash_table_new_full(g_str_hash, g_str_equal,
- free_volname_key, free_volname_value);
+ volname_mutex = g_mutex_new();
+ volname_hash = g_hash_table_new_full(g_str_hash, g_str_equal,
+ free_volname_key, free_volname_value);
}
static void
free_drive(gpointer drive)
{
#if defined(_WIN32)
- g_free(drive);
+ g_free(drive);
#else
- g_object_unref(drive);
+ g_object_unref(drive);
#endif
}
gpointer
ghb_cache_volnames(signal_user_data_t *ud)
{
- GList *link, *drives;
+ GList *link, *drives;
- g_debug("ghb_cache_volnames()");
- link = drives = dvd_device_list();
- if (drives == NULL)
- return NULL;
+ g_debug("ghb_cache_volnames()");
+ link = drives = dvd_device_list();
+ if (drives == NULL)
+ return NULL;
- g_mutex_lock(volname_mutex);
- g_hash_table_remove_all(volname_hash);
- while (link != NULL)
- {
- gchar *name, *drive;
+ g_mutex_lock(volname_mutex);
+ g_hash_table_remove_all(volname_hash);
+ while (link != NULL)
+ {
+ gchar *name, *drive;
#if !defined(_WIN32)
- if (!g_drive_has_media (link->data))
- {
- g_object_unref(link->data);
- link = link->next;
- continue;
- }
+ if (!g_drive_has_media (link->data))
+ {
+ g_object_unref(link->data);
+ link = link->next;
+ continue;
+ }
#endif
- drive = get_dvd_device_name(link->data);
- name = get_direct_dvd_volume_name(drive);
+ drive = get_dvd_device_name(link->data);
+ name = get_direct_dvd_volume_name(drive);
- if (drive != NULL && name != NULL)
- {
- g_hash_table_insert(volname_hash, drive, name);
- }
- else
- {
- if (drive != NULL)
- g_free(drive);
- if (name != NULL)
- g_free(name);
- }
-
- free_drive(link->data);
- link = link->next;
- }
- g_mutex_unlock(volname_mutex);
+ if (drive != NULL && name != NULL)
+ {
+ g_hash_table_insert(volname_hash, drive, name);
+ }
+ else
+ {
+ if (drive != NULL)
+ g_free(drive);
+ if (name != NULL)
+ g_free(name);
+ }
+
+ free_drive(link->data);
+ link = link->next;
+ }
+ g_mutex_unlock(volname_mutex);
- g_list_free(drives);
+ g_list_free(drives);
- g_idle_add((GSourceFunc)ghb_file_menu_add_dvd, ud);
+ g_idle_add((GSourceFunc)ghb_file_menu_add_dvd, ud);
- return NULL;
+ return NULL;
}
static const gchar*
get_extension(GValue *settings)
{
- int container;
- const gchar *extension = "error";
-
- container = ghb_settings_combo_int(settings, "FileFormat");
- if (container == HB_MUX_MP4)
- {
- extension = "mp4";
- if (ghb_settings_get_boolean(settings, "UseM4v"))
- {
- extension = "m4v";
- }
- }
- else if (container == HB_MUX_MKV)
- {
- extension = "mkv";
- }
- return extension;
+ int container;
+ const gchar *extension = "error";
+
+ container = ghb_settings_combo_int(settings, "FileFormat");
+ if (container == HB_MUX_MP4)
+ {
+ extension = "mp4";
+ if (ghb_settings_get_boolean(settings, "UseM4v"))
+ {
+ extension = "m4v";
+ }
+ }
+ else if (container == HB_MUX_MKV)
+ {
+ extension = "mkv";
+ }
+ return extension;
}
static void
set_destination_settings(GValue *settings)
{
- g_debug("set_destination_settings");
- if (ghb_settings_get_boolean(settings, "use_source_name"))
- {
- GString *str = g_string_new("");
- gchar *vol_name;
- const gchar *extension;
- gchar *new_name;
- gint title;
-
- extension = get_extension(settings);
- vol_name = ghb_settings_get_string(settings, "volume_label");
- g_string_append_printf(str, "%s", vol_name);
- title = ghb_settings_get_int(settings, "title_no");
- if (title >= 0)
- {
- if (ghb_settings_get_boolean(settings, "title_no_in_destination"))
- {
-
- g_string_append_printf(str, " - %d", title+1);
- }
- if (ghb_settings_combo_int(settings, "PtoPType") == 0 &&
- ghb_settings_get_boolean(
- settings, "chapters_in_destination"))
- {
- gint start, end;
-
- if (!ghb_settings_get_boolean(
- settings, "title_no_in_destination"))
- {
- g_string_append_printf(str, " -");
- }
- start = ghb_settings_get_int(settings, "start_point");
- end = ghb_settings_get_int(settings, "end_point");
- if (start == end)
- g_string_append_printf(str, " Ch %d", start);
- else
- g_string_append_printf(str, " Ch %d-%d", start, end);
- }
- }
- g_string_append_printf(str, ".%s", extension);
- new_name = g_string_free(str, FALSE);
- ghb_settings_set_string(settings, "dest_file", new_name);
- g_free(vol_name);
- g_free(new_name);
- }
+ g_debug("set_destination_settings");
+ if (ghb_settings_get_boolean(settings, "use_source_name"))
+ {
+ GString *str = g_string_new("");
+ gchar *vol_name;
+ const gchar *extension;
+ gchar *new_name;
+ gint title;
+
+ extension = get_extension(settings);
+ vol_name = ghb_settings_get_string(settings, "volume_label");
+ g_string_append_printf(str, "%s", vol_name);
+ title = ghb_settings_get_int(settings, "title_no");
+ if (title >= 0)
+ {
+ if (ghb_settings_get_boolean(settings, "title_no_in_destination"))
+ {
+
+ g_string_append_printf(str, " - %d", title+1);
+ }
+ if (ghb_settings_combo_int(settings, "PtoPType") == 0 &&
+ ghb_settings_get_boolean(
+ settings, "chapters_in_destination"))
+ {
+ gint start, end;
+
+ if (!ghb_settings_get_boolean(
+ settings, "title_no_in_destination"))
+ {
+ g_string_append_printf(str, " -");
+ }
+ start = ghb_settings_get_int(settings, "start_point");
+ end = ghb_settings_get_int(settings, "end_point");
+ if (start == end)
+ g_string_append_printf(str, " Ch %d", start);
+ else
+ g_string_append_printf(str, " Ch %d-%d", start, end);
+ }
+ }
+ g_string_append_printf(str, ".%s", extension);
+ new_name = g_string_free(str, FALSE);
+ ghb_settings_set_string(settings, "dest_file", new_name);
+ g_free(vol_name);
+ g_free(new_name);
+ }
}
static void
set_destination(signal_user_data_t *ud)
{
- set_destination_settings(ud->settings);
- ghb_ui_update(ud, "dest_file",
- ghb_settings_get_value(ud->settings, "dest_file"));
+ set_destination_settings(ud->settings);
+ ghb_ui_update(ud, "dest_file",
+ ghb_settings_get_value(ud->settings, "dest_file"));
}
static gchar*
get_file_label(const gchar *filename)
{
- gchar *base, *pos, *end;
+ gchar *base, *pos, *end;
- base = g_path_get_basename(filename);
- pos = strrchr(base, '.');
- if (pos != NULL)
- {
- // If the last '.' is within 4 chars of end of name, assume
- // there is an extension we want to strip.
- end = &base[strlen(base) - 1];
- if (end - pos <= 4)
- *pos = 0;
- }
- return base;
+ base = g_path_get_basename(filename);
+ pos = strrchr(base, '.');
+ if (pos != NULL)
+ {
+ // If the last '.' is within 4 chars of end of name, assume
+ // there is an extension we want to strip.
+ end = &base[strlen(base) - 1];
+ if (end - pos <= 4)
+ *pos = 0;
+ }
+ return base;
}
static gchar*
resolve_drive_name(gchar *filename)
{
#if defined(_WIN32)
- if (filename[1] == ':')
- {
- gchar drive[4];
- gchar *name;
- gint dtype;
-
- g_strlcpy(drive, filename, 4);
- dtype = GetDriveType(drive);
- if (dtype == DRIVE_CDROM)
- {
- gchar vname[51], fsname[51];
- GetVolumeInformation(drive, vname, 50, NULL,
- NULL, NULL, fsname, 50);
- name = g_strdup(vname);
- return name;
- }
- }
- return NULL;
+ if (filename[1] == ':')
+ {
+ gchar drive[4];
+ gchar *name;
+ gint dtype;
+
+ g_strlcpy(drive, filename, 4);
+ dtype = GetDriveType(drive);
+ if (dtype == DRIVE_CDROM)
+ {
+ gchar vname[51], fsname[51];
+ GetVolumeInformation(drive, vname, 50, NULL,
+ NULL, NULL, fsname, 50);
+ name = g_strdup(vname);
+ return name;
+ }
+ }
+ return NULL;
#else
- return NULL;
+ return NULL;
#endif
}
static gboolean
update_source_label(signal_user_data_t *ud, const gchar *source, gboolean update_dest)
{
- gchar *label = NULL;
- gint len;
- gchar **path;
- gchar *start;
- gchar *filename = g_strdup(source);
-
- g_debug("update_source_label()");
- len = strlen(filename);
- if (g_file_test(filename, G_FILE_TEST_IS_DIR))
- {
- // Skip dos drive letters
+ gchar *label = NULL;
+ gint len;
+ gchar **path;
+ gchar *start;
+ gchar *filename = g_strdup(source);
+
+ g_debug("update_source_label()");
+ len = strlen(filename);
+ if (g_file_test(filename, G_FILE_TEST_IS_DIR))
+ {
+ // Skip dos drive letters
#if defined(_WIN32)
- start = strchr(filename, ':');
+ start = strchr(filename, ':');
#else
- start = filename;
+ start = filename;
#endif
- label = resolve_drive_name(filename);
- if (label != NULL)
- {
- if (uppers_and_unders(label))
- {
- camel_convert(label);
- }
- }
- else
- {
- if (filename[len-1] == G_DIR_SEPARATOR) filename[len-1] = 0;
- if (start != NULL)
- start++;
- else
- start = filename;
-
- path = g_strsplit(start, G_DIR_SEPARATOR_S, -1);
- len = g_strv_length (path);
- if ((len > 1) && (strcmp("VIDEO_TS", path[len-1]) == 0))
- {
- label = g_strdup(path[len-2]);
- if (uppers_and_unders(label))
- {
- camel_convert(label);
- }
- }
- else if (len > 0)
- {
- if (path[len-1][0] != 0)
- {
- label = g_strdup(path[len-1]);
- if (uppers_and_unders(label))
- {
- camel_convert(label);
- }
- }
- else
- label = g_strdup("new_video");
- }
- else
- label = g_strdup("new_video");
- g_strfreev (path);
- }
- }
- else
- {
- // Is regular file or block dev.
- // Check to see if it is a dvd image
- label = ghb_dvd_volname (filename);
- if (label == NULL)
- {
- label = get_file_label(filename);
- }
- else
- {
- if (uppers_and_unders(label))
- {
- camel_convert(label);
- }
- }
- }
- g_free(filename);
- GtkWidget *widget = GHB_WIDGET (ud->builder, "source_title");
- if (label != NULL)
- {
- gtk_label_set_text (GTK_LABEL(widget), label);
- ghb_settings_set_string(ud->settings, "volume_label", label);
- g_free(label);
- if (update_dest)
- set_destination(ud);
- }
- else
- {
- label = "No Title Found";
- gtk_label_set_text (GTK_LABEL(widget), label);
- ghb_settings_set_string(ud->settings, "volume_label", label);
- return FALSE;
- }
- return TRUE;
+ label = resolve_drive_name(filename);
+ if (label != NULL)
+ {
+ if (uppers_and_unders(label))
+ {
+ camel_convert(label);
+ }
+ }
+ else
+ {
+ if (filename[len-1] == G_DIR_SEPARATOR) filename[len-1] = 0;
+ if (start != NULL)
+ start++;
+ else
+ start = filename;
+
+ path = g_strsplit(start, G_DIR_SEPARATOR_S, -1);
+ len = g_strv_length (path);
+ if ((len > 1) && (strcmp("VIDEO_TS", path[len-1]) == 0))
+ {
+ label = g_strdup(path[len-2]);
+ if (uppers_and_unders(label))
+ {
+ camel_convert(label);
+ }
+ }
+ else if (len > 0)
+ {
+ if (path[len-1][0] != 0)
+ {
+ label = g_strdup(path[len-1]);
+ if (uppers_and_unders(label))
+ {
+ camel_convert(label);
+ }
+ }
+ else
+ label = g_strdup("new_video");
+ }
+ else
+ label = g_strdup("new_video");
+ g_strfreev (path);
+ }
+ }
+ else
+ {
+ // Is regular file or block dev.
+ // Check to see if it is a dvd image
+ label = ghb_dvd_volname (filename);
+ if (label == NULL)
+ {
+ label = get_file_label(filename);
+ }
+ else
+ {
+ if (uppers_and_unders(label))
+ {
+ camel_convert(label);
+ }
+ }
+ }
+ g_free(filename);
+ GtkWidget *widget = GHB_WIDGET (ud->builder, "source_title");
+ if (label != NULL)
+ {
+ gtk_label_set_text (GTK_LABEL(widget), label);
+ ghb_settings_set_string(ud->settings, "volume_label", label);
+ g_free(label);
+ if (update_dest)
+ set_destination(ud);
+ }
+ else
+ {
+ label = "No Title Found";
+ gtk_label_set_text (GTK_LABEL(widget), label);
+ ghb_settings_set_string(ud->settings, "volume_label", label);
+ return FALSE;
+ }
+ return TRUE;
}
G_MODULE_EXPORT void
chooser_file_selected_cb(GtkFileChooser *dialog, signal_user_data_t *ud)
{
- gchar *name = gtk_file_chooser_get_filename (dialog);
- GtkTreeModel *store;
- GtkTreeIter iter;
- const gchar *device;
- gboolean foundit = FALSE;
- GtkComboBox *combo;
-
- g_debug("chooser_file_selected_cb ()");
-
- if (name == NULL) return;
- combo = GTK_COMBO_BOX(GHB_WIDGET(ud->builder, "source_device"));
- store = gtk_combo_box_get_model(combo);
- if (gtk_tree_model_get_iter_first(store, &iter))
- {
- do
- {
- gtk_tree_model_get(store, &iter, 0, &device, -1);
- if (strcmp(name, device) == 0)
- {
- foundit = TRUE;
- break;
- }
- } while (gtk_tree_model_iter_next(GTK_TREE_MODEL(store), &iter));
- }
- if (foundit)
- gtk_combo_box_set_active_iter (combo, &iter);
- else
- gtk_combo_box_set_active (combo, 0);
-
- g_free(name);
+ gchar *name = gtk_file_chooser_get_filename (dialog);
+ GtkTreeModel *store;
+ GtkTreeIter iter;
+ const gchar *device;
+ gboolean foundit = FALSE;
+ GtkComboBox *combo;
+
+ g_debug("chooser_file_selected_cb ()");
+
+ if (name == NULL) return;
+ combo = GTK_COMBO_BOX(GHB_WIDGET(ud->builder, "source_device"));
+ store = gtk_combo_box_get_model(combo);
+ if (gtk_tree_model_get_iter_first(store, &iter))
+ {
+ do
+ {
+ gtk_tree_model_get(store, &iter, 0, &device, -1);
+ if (strcmp(name, device) == 0)
+ {
+ foundit = TRUE;
+ break;
+ }
+ } while (gtk_tree_model_iter_next(GTK_TREE_MODEL(store), &iter));
+ }
+ if (foundit)
+ gtk_combo_box_set_active_iter (combo, &iter);
+ else
+ gtk_combo_box_set_active (combo, 0);
+
+ g_free(name);
}
G_MODULE_EXPORT void
dvd_device_changed_cb(GtkComboBox *combo, signal_user_data_t *ud)
{
- GtkWidget *dialog;
- gint ii;
-
- g_debug("dvd_device_changed_cb ()");
- ii = gtk_combo_box_get_active (combo);
- if (ii > 0)
- {
- const gchar *device;
- gchar *name;
+ GtkWidget *dialog;
+ gint ii;
- dialog = GHB_WIDGET(ud->builder, "source_dialog");
- device = gtk_combo_box_get_active_text (combo);
- name = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER(dialog));
- if (name == NULL || strcmp(name, device) != 0)
- gtk_file_chooser_select_filename (GTK_FILE_CHOOSER(dialog), device);
- if (name != NULL)
- g_free(name);
- }
+ g_debug("dvd_device_changed_cb ()");
+ ii = gtk_combo_box_get_active (combo);
+ if (ii > 0)
+ {
+ const gchar *device;
+ gchar *name;
+
+ dialog = GHB_WIDGET(ud->builder, "source_dialog");
+ device = gtk_combo_box_get_active_text (combo);
+ name = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER(dialog));
+ if (name == NULL || strcmp(name, device) != 0)
+ gtk_file_chooser_select_filename (GTK_FILE_CHOOSER(dialog), device);
+ if (name != NULL)
+ g_free(name);
+ }
}
static void
source_dialog_extra_widgets(
- signal_user_data_t *ud,
- GtkWidget *dialog)
-{
- GtkComboBox *combo;
- GList *drives, *link;
-
- g_debug("source_dialog_extra_widgets ()");
- combo = GTK_COMBO_BOX(GHB_WIDGET(ud->builder, "source_device"));
- gtk_list_store_clear(GTK_LIST_STORE(gtk_combo_box_get_model(combo)));
-
- link = drives = dvd_device_list();
- gtk_combo_box_append_text (combo, "Not Selected");
- while (link != NULL)
- {
- gchar *name = get_dvd_device_name(link->data);
- gtk_combo_box_append_text(combo, name);
- g_free(name);
- free_drive(link->data);
- link = link->next;
- }
- g_list_free(drives);
- gtk_combo_box_set_active (combo, 0);
+ signal_user_data_t *ud,
+ GtkWidget *dialog)
+{
+ GtkComboBox *combo;
+ GList *drives, *link;
+
+ g_debug("source_dialog_extra_widgets ()");
+ combo = GTK_COMBO_BOX(GHB_WIDGET(ud->builder, "source_device"));
+ gtk_list_store_clear(GTK_LIST_STORE(gtk_combo_box_get_model(combo)));
+
+ link = drives = dvd_device_list();
+ gtk_combo_box_append_text (combo, "Not Selected");
+ while (link != NULL)
+ {
+ gchar *name = get_dvd_device_name(link->data);
+ gtk_combo_box_append_text(combo, name);
+ g_free(name);
+ free_drive(link->data);
+ link = link->next;
+ }
+ g_list_free(drives);
+ gtk_combo_box_set_active (combo, 0);
}
extern GValue *ghb_queue_edit_settings;
@@ -866,277 +866,277 @@ static gchar *last_scan_file = NULL;
static void
show_scan_progress(signal_user_data_t *ud)
{
- GtkProgressBar *progress;
- GtkLabel *label;
+ GtkProgressBar *progress;
+ GtkLabel *label;
- progress = GTK_PROGRESS_BAR(GHB_WIDGET(ud->builder, "scan_prog"));
- gtk_progress_bar_set_fraction (progress, 0);
- gtk_widget_show(GTK_WIDGET(progress));
+ progress = GTK_PROGRESS_BAR(GHB_WIDGET(ud->builder, "scan_prog"));
+ gtk_progress_bar_set_fraction (progress, 0);
+ gtk_widget_show(GTK_WIDGET(progress));
- label = GTK_LABEL(GHB_WIDGET(ud->builder, "source_title"));
- gtk_label_set_text( label, "Scanning ..." );
+ label = GTK_LABEL(GHB_WIDGET(ud->builder, "source_title"));
+ gtk_label_set_text( label, "Scanning ..." );
}
static void
start_scan(
- signal_user_data_t *ud,
- const gchar *path,
- gint titlenum,
- gint preview_count)
+ signal_user_data_t *ud,
+ const gchar *path,
+ gint titlenum,
+ gint preview_count)
{
- GtkWidget *widget;
- GtkAction *action;
- ghb_status_t status;
+ GtkWidget *widget;
+ GtkAction *action;
+ ghb_status_t status;
- ghb_get_status(&status);
- if (status.scan.state != GHB_STATE_IDLE)
- return;
+ ghb_get_status(&status);
+ if (status.scan.state != GHB_STATE_IDLE)
+ return;
- widget = GHB_WIDGET(ud->builder, "sourcetoolbutton");
- gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(widget), "hb-stop");
- gtk_tool_button_set_label(GTK_TOOL_BUTTON(widget), "Stop Scan");
- gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(widget), "Stop Scan");
- //gtk_widget_set_sensitive(widget, FALSE);
+ widget = GHB_WIDGET(ud->builder, "sourcetoolbutton");
+ gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(widget), "hb-stop");
+ gtk_tool_button_set_label(GTK_TOOL_BUTTON(widget), "Stop Scan");
+ gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(widget), "Stop Scan");
+ //gtk_widget_set_sensitive(widget, FALSE);
- action = GHB_ACTION(ud->builder, "source_action");
- gtk_action_set_sensitive(action, FALSE);
- action = GHB_ACTION(ud->builder, "source_single_action");
- gtk_action_set_sensitive(action, FALSE);
- ghb_backend_scan(path, titlenum, preview_count,
- 90000L * ghb_settings_get_int64(ud->settings, "MinTitleDuration"));
+ action = GHB_ACTION(ud->builder, "source_action");
+ gtk_action_set_sensitive(action, FALSE);
+ action = GHB_ACTION(ud->builder, "source_single_action");
+ gtk_action_set_sensitive(action, FALSE);
+ ghb_backend_scan(path, titlenum, preview_count,
+ 90000L * ghb_settings_get_int64(ud->settings, "MinTitleDuration"));
}
gboolean
ghb_idle_scan(signal_user_data_t *ud)
{
- gchar *path;
- path = ghb_settings_get_string( ud->settings, "scan_source");
- ghb_do_scan(ud, path, 0, TRUE);
- g_free(path);
- return FALSE;
+ gchar *path;
+ path = ghb_settings_get_string( ud->settings, "scan_source");
+ ghb_do_scan(ud, path, 0, TRUE);
+ g_free(path);
+ return FALSE;
}
void
ghb_do_scan(
- signal_user_data_t *ud,
- const gchar *filename,
- gint titlenum,
- gboolean force)
-{
- g_debug("ghb_do_scan()");
- if (!force && last_scan_file != NULL &&
- strcmp(last_scan_file, filename) == 0)
- {
- if (ghb_queue_edit_settings)
- {
- ghb_settings_to_ui(ud, ghb_queue_edit_settings);
- ghb_set_audio(ud, ghb_queue_edit_settings);
- ghb_reset_subtitles(ud, ghb_queue_edit_settings);
- reset_chapter_list(ud, ghb_queue_edit_settings);
- ghb_value_free(ghb_queue_edit_settings);
- ghb_queue_edit_settings = NULL;
- }
- return;
- }
- if (last_scan_file != NULL)
- g_free(last_scan_file);
- last_scan_file = NULL;
- if (filename != NULL)
- {
- last_scan_file = g_strdup(filename);
- ghb_settings_set_string(ud->settings, "scan_source", filename);
- if (update_source_label(ud, filename, TRUE))
- {
- gchar *path;
- gint preview_count;
-
- show_scan_progress(ud);
- path = ghb_settings_get_string( ud->settings, "scan_source");
- prune_logs(ud);
-
- preview_count = ghb_settings_get_int(ud->settings, "preview_count");
- start_scan(ud, path, titlenum, preview_count);
- g_free(path);
- }
- else
- {
- // TODO: error dialog
- }
- }
+ signal_user_data_t *ud,
+ const gchar *filename,
+ gint titlenum,
+ gboolean force)
+{
+ g_debug("ghb_do_scan()");
+ if (!force && last_scan_file != NULL &&
+ strcmp(last_scan_file, filename) == 0)
+ {
+ if (ghb_queue_edit_settings)
+ {
+ ghb_settings_to_ui(ud, ghb_queue_edit_settings);
+ ghb_set_audio(ud, ghb_queue_edit_settings);
+ ghb_reset_subtitles(ud, ghb_queue_edit_settings);
+ reset_chapter_list(ud, ghb_queue_edit_settings);
+ ghb_value_free(ghb_queue_edit_settings);
+ ghb_queue_edit_settings = NULL;
+ }
+ return;
+ }
+ if (last_scan_file != NULL)
+ g_free(last_scan_file);
+ last_scan_file = NULL;
+ if (filename != NULL)
+ {
+ last_scan_file = g_strdup(filename);
+ ghb_settings_set_string(ud->settings, "scan_source", filename);
+ if (update_source_label(ud, filename, TRUE))
+ {
+ gchar *path;
+ gint preview_count;
+
+ show_scan_progress(ud);
+ path = ghb_settings_get_string( ud->settings, "scan_source");
+ prune_logs(ud);
+
+ preview_count = ghb_settings_get_int(ud->settings, "preview_count");
+ start_scan(ud, path, titlenum, preview_count);
+ g_free(path);
+ }
+ else
+ {
+ // TODO: error dialog
+ }
+ }
}
static void
do_source_dialog(GtkButton *button, gboolean single, signal_user_data_t *ud)
{
- GtkWidget *dialog;
- gchar *sourcename;
- gint response;
-
- g_debug("source_browse_clicked_cb ()");
- sourcename = ghb_settings_get_string(ud->settings, "scan_source");
- GtkWidget *widget;
- widget = GHB_WIDGET(ud->builder, "single_title_box");
- if (single)
- gtk_widget_show(widget);
- else
- gtk_widget_hide(widget);
- dialog = GHB_WIDGET(ud->builder, "source_dialog");
- source_dialog_extra_widgets(ud, dialog);
-
- gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(dialog), sourcename);
- response = gtk_dialog_run(GTK_DIALOG (dialog));
- gtk_widget_hide(dialog);
- if (response == GTK_RESPONSE_NO)
- {
- gchar *filename;
-
- filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
- if (filename != NULL)
- {
- gint titlenum;
-
- if (single)
- titlenum = ghb_settings_get_int(ud->settings, "single_title");
- else
- titlenum = 0;
- ghb_do_scan(ud, filename, titlenum, TRUE);
- if (strcmp(sourcename, filename) != 0)
- {
- ghb_settings_set_string (ud->settings,
- "default_source", filename);
- ghb_pref_save (ud->settings, "default_source");
- ghb_dvd_set_current (filename, ud);
- }
- g_free(filename);
- }
- }
- g_free(sourcename);
+ GtkWidget *dialog;
+ gchar *sourcename;
+ gint response;
+
+ g_debug("source_browse_clicked_cb ()");
+ sourcename = ghb_settings_get_string(ud->settings, "scan_source");
+ GtkWidget *widget;
+ widget = GHB_WIDGET(ud->builder, "single_title_box");
+ if (single)
+ gtk_widget_show(widget);
+ else
+ gtk_widget_hide(widget);
+ dialog = GHB_WIDGET(ud->builder, "source_dialog");
+ source_dialog_extra_widgets(ud, dialog);
+
+ gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(dialog), sourcename);
+ response = gtk_dialog_run(GTK_DIALOG (dialog));
+ gtk_widget_hide(dialog);
+ if (response == GTK_RESPONSE_NO)
+ {
+ gchar *filename;
+
+ filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
+ if (filename != NULL)
+ {
+ gint titlenum;
+
+ if (single)
+ titlenum = ghb_settings_get_int(ud->settings, "single_title");
+ else
+ titlenum = 0;
+ ghb_do_scan(ud, filename, titlenum, TRUE);
+ if (strcmp(sourcename, filename) != 0)
+ {
+ ghb_settings_set_string (ud->settings,
+ "default_source", filename);
+ ghb_pref_save (ud->settings, "default_source");
+ ghb_dvd_set_current (filename, ud);
+ }
+ g_free(filename);
+ }
+ }
+ g_free(sourcename);
}
G_MODULE_EXPORT void
source_button_clicked_cb(GtkButton *button, signal_user_data_t *ud)
{
- ghb_status_t status;
- ghb_get_status(&status);
- if (status.scan.state & GHB_STATE_SCANNING)
- {
- ghb_backend_scan_stop();
- }
- else
- {
- do_source_dialog(button, FALSE, ud);
- }
+ ghb_status_t status;
+ ghb_get_status(&status);
+ if (status.scan.state & GHB_STATE_SCANNING)
+ {
+ ghb_backend_scan_stop();
+ }
+ else
+ {
+ do_source_dialog(button, FALSE, ud);
+ }
}
G_MODULE_EXPORT void
single_title_source_cb(GtkButton *button, signal_user_data_t *ud)
{
- do_source_dialog(button, TRUE, ud);
+ do_source_dialog(button, TRUE, ud);
}
G_MODULE_EXPORT void
dvd_source_activate_cb(GtkAction *action, signal_user_data_t *ud)
{
- const gchar *filename;
- gchar *sourcename;
+ const gchar *filename;
+ gchar *sourcename;
- sourcename = ghb_settings_get_string(ud->settings, "scan_source");
- filename = gtk_buildable_get_name(GTK_BUILDABLE(action));
- ghb_do_scan(ud, filename, 0, TRUE);
- if (strcmp(sourcename, filename) != 0)
- {
- ghb_settings_set_string (ud->settings, "default_source", filename);
- ghb_pref_save (ud->settings, "default_source");
- ghb_dvd_set_current (filename, ud);
- }
- g_free(sourcename);
+ sourcename = ghb_settings_get_string(ud->settings, "scan_source");
+ filename = gtk_buildable_get_name(GTK_BUILDABLE(action));
+ ghb_do_scan(ud, filename, 0, TRUE);
+ if (strcmp(sourcename, filename) != 0)
+ {
+ ghb_settings_set_string (ud->settings, "default_source", filename);
+ ghb_pref_save (ud->settings, "default_source");
+ ghb_dvd_set_current (filename, ud);
+ }
+ g_free(sourcename);
}
void
ghb_update_destination_extension(signal_user_data_t *ud)
{
- static gchar *containers[] = {".mkv", ".mp4", ".m4v", NULL};
- gchar *filename;
- const gchar *extension;
- gint ii;
- GtkEntry *entry;
- static gboolean busy = FALSE;
-
- g_debug("ghb_update_destination_extension ()");
- // Since this function modifies the thing that triggers it's
- // invocation, check to see if busy to prevent accidental infinite
- // recursion.
- if (busy)
- return;
- busy = TRUE;
- extension = get_extension(ud->settings);
- entry = GTK_ENTRY(GHB_WIDGET(ud->builder, "dest_file"));
- filename = g_strdup(gtk_entry_get_text(entry));
- for (ii = 0; containers[ii] != NULL; ii++)
- {
- if (g_str_has_suffix(filename, containers[ii]))
- {
- gchar *pos;
- gchar *new_name;
-
- pos = g_strrstr( filename, "." );
- if (pos == NULL)
- {
- // No period? shouldn't happen
- break;
- }
- *pos = 0;
- if (strcmp(extension, &pos[1]) == 0)
- {
- // Extension is already correct
- break;
- }
- new_name = g_strjoin(".", filename, extension, NULL);
- ghb_ui_update(ud, "dest_file", ghb_string_value(new_name));
- g_free(new_name);
- break;
- }
- }
- g_free(filename);
- busy = FALSE;
+ static gchar *containers[] = {".mkv", ".mp4", ".m4v", NULL};
+ gchar *filename;
+ const gchar *extension;
+ gint ii;
+ GtkEntry *entry;
+ static gboolean busy = FALSE;
+
+ g_debug("ghb_update_destination_extension ()");
+ // Since this function modifies the thing that triggers it's
+ // invocation, check to see if busy to prevent accidental infinite
+ // recursion.
+ if (busy)
+ return;
+ busy = TRUE;
+ extension = get_extension(ud->settings);
+ entry = GTK_ENTRY(GHB_WIDGET(ud->builder, "dest_file"));
+ filename = g_strdup(gtk_entry_get_text(entry));
+ for (ii = 0; containers[ii] != NULL; ii++)
+ {
+ if (g_str_has_suffix(filename, containers[ii]))
+ {
+ gchar *pos;
+ gchar *new_name;
+
+ pos = g_strrstr( filename, "." );
+ if (pos == NULL)
+ {
+ // No period? shouldn't happen
+ break;
+ }
+ *pos = 0;
+ if (strcmp(extension, &pos[1]) == 0)
+ {
+ // Extension is already correct
+ break;
+ }
+ new_name = g_strjoin(".", filename, extension, NULL);
+ ghb_ui_update(ud, "dest_file", ghb_string_value(new_name));
+ g_free(new_name);
+ break;
+ }
+ }
+ g_free(filename);
+ busy = FALSE;
}
static void
destination_select_title(GtkEntry *entry)
{
- const gchar *dest;
- gint start, end;
-
- dest = gtk_entry_get_text(entry);
- for (end = strlen(dest)-1; end > 0; end--)
- {
- if (dest[end] == '.')
- {
- break;
- }
- }
- for (start = end; start >= 0; start--)
- {
- if (dest[start] == G_DIR_SEPARATOR)
- {
- start++;
- break;
- }
- }
- if (start < 0) start = 0;
- if (start < end)
- {
- gtk_editable_select_region(GTK_EDITABLE(entry), start, end);
- }
+ const gchar *dest;
+ gint start, end;
+
+ dest = gtk_entry_get_text(entry);
+ for (end = strlen(dest)-1; end > 0; end--)
+ {
+ if (dest[end] == '.')
+ {
+ break;
+ }
+ }
+ for (start = end; start >= 0; start--)
+ {
+ if (dest[start] == G_DIR_SEPARATOR)
+ {
+ start++;
+ break;
+ }
+ }
+ if (start < 0) start = 0;
+ if (start < end)
+ {
+ gtk_editable_select_region(GTK_EDITABLE(entry), start, end);
+ }
}
G_MODULE_EXPORT gboolean
destination_grab_cb(
- GtkEntry *entry,
- signal_user_data_t *ud)
+ GtkEntry *entry,
+ signal_user_data_t *ud)
{
- destination_select_title(entry);
- return FALSE;
+ destination_select_title(entry);
+ return FALSE;
}
static gboolean update_default_destination = FALSE;
@@ -1144,469 +1144,469 @@ static gboolean update_default_destination = FALSE;
G_MODULE_EXPORT void
dest_dir_set_cb(GtkFileChooserButton *dest_chooser, signal_user_data_t *ud)
{
- gchar *dest_file, *dest_dir, *dest;
-
- g_debug("dest_dir_set_cb ()");
- ghb_widget_to_setting(ud->settings, (GtkWidget*)dest_chooser);
- dest_file = ghb_settings_get_string(ud->settings, "dest_file");
- dest_dir = ghb_settings_get_string(ud->settings, "dest_dir");
- dest = g_strdup_printf("%s" G_DIR_SEPARATOR_S "%s", dest_dir, dest_file);
- ghb_settings_set_string(ud->settings, "destination", dest);
- g_free(dest_file);
- g_free(dest_dir);
- g_free(dest);
- update_default_destination = TRUE;
+ gchar *dest_file, *dest_dir, *dest;
+
+ g_debug("dest_dir_set_cb ()");
+ ghb_widget_to_setting(ud->settings, (GtkWidget*)dest_chooser);
+ dest_file = ghb_settings_get_string(ud->settings, "dest_file");
+ dest_dir = ghb_settings_get_string(ud->settings, "dest_dir");
+ dest = g_strdup_printf("%s" G_DIR_SEPARATOR_S "%s", dest_dir, dest_file);
+ ghb_settings_set_string(ud->settings, "destination", dest);
+ g_free(dest_file);
+ g_free(dest_dir);
+ g_free(dest);
+ update_default_destination = TRUE;
}
G_MODULE_EXPORT void
dest_file_changed_cb(GtkEntry *entry, signal_user_data_t *ud)
{
- gchar *dest_file, *dest_dir, *dest;
-
- g_debug("dest_file_changed_cb ()");
- ghb_update_destination_extension(ud);
- ghb_widget_to_setting(ud->settings, (GtkWidget*)entry);
- // This signal goes off with ever keystroke, so I'm putting this
- // update on the timer.
- dest_file = ghb_settings_get_string(ud->settings, "dest_file");
- dest_dir = ghb_settings_get_string(ud->settings, "dest_dir");
- dest = g_strdup_printf("%s" G_DIR_SEPARATOR_S "%s", dest_dir, dest_file);
- ghb_settings_set_string(ud->settings, "destination", dest);
- g_free(dest_file);
- g_free(dest_dir);
- g_free(dest);
- update_default_destination = TRUE;
+ gchar *dest_file, *dest_dir, *dest;
+
+ g_debug("dest_file_changed_cb ()");
+ ghb_update_destination_extension(ud);
+ ghb_widget_to_setting(ud->settings, (GtkWidget*)entry);
+ // This signal goes off with ever keystroke, so I'm putting this
+ // update on the timer.
+ dest_file = ghb_settings_get_string(ud->settings, "dest_file");
+ dest_dir = ghb_settings_get_string(ud->settings, "dest_dir");
+ dest = g_strdup_printf("%s" G_DIR_SEPARATOR_S "%s", dest_dir, dest_file);
+ ghb_settings_set_string(ud->settings, "destination", dest);
+ g_free(dest_file);
+ g_free(dest_dir);
+ g_free(dest);
+ update_default_destination = TRUE;
}
G_MODULE_EXPORT void
destination_browse_clicked_cb(GtkButton *button, signal_user_data_t *ud)
{
- GtkWidget *dialog;
- GtkEntry *entry;
- gchar *destname;
- gchar *basename;
-
- g_debug("destination_browse_clicked_cb ()");
- destname = ghb_settings_get_string(ud->settings, "destination");
- dialog = gtk_file_chooser_dialog_new ("Choose Destination",
- NULL,
- GTK_FILE_CHOOSER_ACTION_SAVE,
- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
- GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
- NULL);
- gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(dialog), destname);
- basename = g_path_get_basename(destname);
- g_free(destname);
- gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(dialog), basename);
- g_free(basename);
- if (gtk_dialog_run(GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT)
- {
- char *filename, *dirname;
- GtkFileChooser *dest_chooser;
-
- filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
- basename = g_path_get_basename(filename);
- dirname = g_path_get_dirname(filename);
- entry = (GtkEntry*)GHB_WIDGET(ud->builder, "dest_file");
- gtk_entry_set_text(entry, basename);
- dest_chooser = GTK_FILE_CHOOSER(GHB_WIDGET(ud->builder, "dest_dir"));
- gtk_file_chooser_set_filename(dest_chooser, dirname);
- g_free (dirname);
- g_free (basename);
- g_free (filename);
- }
- gtk_widget_destroy(dialog);
+ GtkWidget *dialog;
+ GtkEntry *entry;
+ gchar *destname;
+ gchar *basename;
+
+ g_debug("destination_browse_clicked_cb ()");
+ destname = ghb_settings_get_string(ud->settings, "destination");
+ dialog = gtk_file_chooser_dialog_new ("Choose Destination",
+ NULL,
+ GTK_FILE_CHOOSER_ACTION_SAVE,
+ GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+ GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
+ NULL);
+ gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(dialog), destname);
+ basename = g_path_get_basename(destname);
+ g_free(destname);
+ gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(dialog), basename);
+ g_free(basename);
+ if (gtk_dialog_run(GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT)
+ {
+ char *filename, *dirname;
+ GtkFileChooser *dest_chooser;
+
+ filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
+ basename = g_path_get_basename(filename);
+ dirname = g_path_get_dirname(filename);
+ entry = (GtkEntry*)GHB_WIDGET(ud->builder, "dest_file");
+ gtk_entry_set_text(entry, basename);
+ dest_chooser = GTK_FILE_CHOOSER(GHB_WIDGET(ud->builder, "dest_dir"));
+ gtk_file_chooser_set_filename(dest_chooser, dirname);
+ g_free (dirname);
+ g_free (basename);
+ g_free (filename);
+ }
+ gtk_widget_destroy(dialog);
}
G_MODULE_EXPORT gboolean
window_destroy_event_cb(GtkWidget *widget, GdkEvent *event, signal_user_data_t *ud)
{
- g_debug("window_destroy_event_cb ()");
- ghb_hb_cleanup(FALSE);
- prune_logs(ud);
- gtk_main_quit();
- return FALSE;
+ g_debug("window_destroy_event_cb ()");
+ ghb_hb_cleanup(FALSE);
+ prune_logs(ud);
+ gtk_main_quit();
+ return FALSE;
}
G_MODULE_EXPORT gboolean
window_delete_event_cb(GtkWidget *widget, GdkEvent *event, signal_user_data_t *ud)
{
- gint state = ghb_get_queue_state();
- g_debug("window_delete_event_cb ()");
- if (state & (GHB_STATE_WORKING|GHB_STATE_SEARCHING))
- {
- if (ghb_cancel_encode2(ud, "Closing HandBrake will terminate encoding.\n"))
- {
- ghb_hb_cleanup(FALSE);
- prune_logs(ud);
- gtk_main_quit();
- return FALSE;
- }
- return TRUE;
- }
- ghb_hb_cleanup(FALSE);
- prune_logs(ud);
- gtk_main_quit();
- return FALSE;
+ gint state = ghb_get_queue_state();
+ g_debug("window_delete_event_cb ()");
+ if (state & (GHB_STATE_WORKING|GHB_STATE_SEARCHING))
+ {
+ if (ghb_cancel_encode2(ud, "Closing HandBrake will terminate encoding.\n"))
+ {
+ ghb_hb_cleanup(FALSE);
+ prune_logs(ud);
+ gtk_main_quit();
+ return FALSE;
+ }
+ return TRUE;
+ }
+ ghb_hb_cleanup(FALSE);
+ prune_logs(ud);
+ gtk_main_quit();
+ return FALSE;
}
static void
update_acodec_combo(signal_user_data_t *ud)
{
ghb_adjust_audio_rate_combos(ud);
- ghb_grey_combo_options (ud);
+ ghb_grey_combo_options (ud);
}
G_MODULE_EXPORT void
container_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
{
- g_debug("container_changed_cb ()");
- ghb_widget_to_setting(ud->settings, widget);
- ghb_check_dependency(ud, widget, NULL);
- update_acodec_combo(ud);
- ghb_update_destination_extension(ud);
- ghb_clear_presets_selection(ud);
- ghb_live_reset(ud);
- ghb_subtitle_prune(ud);
- ghb_subtitle_list_refresh_selected(ud);
- ghb_audio_list_refresh_selected(ud);
+ g_debug("container_changed_cb ()");
+ ghb_widget_to_setting(ud->settings, widget);
+ ghb_check_dependency(ud, widget, NULL);
+ update_acodec_combo(ud);
+ ghb_update_destination_extension(ud);
+ ghb_clear_presets_selection(ud);
+ ghb_live_reset(ud);
+ ghb_subtitle_prune(ud);
+ ghb_subtitle_list_refresh_selected(ud);
+ ghb_audio_list_refresh_selected(ud);
}
static gchar*
get_aspect_string(gint aspect_n, gint aspect_d)
{
- gchar *aspect;
+ gchar *aspect;
- if (aspect_d < 10)
- {
- aspect = g_strdup_printf("%d:%d", aspect_n, aspect_d);
- }
- else
- {
- gdouble aspect_nf = (gdouble)aspect_n / aspect_d;
- aspect = g_strdup_printf("%.2f:1", aspect_nf);
- }
- return aspect;
+ if (aspect_d < 10)
+ {
+ aspect = g_strdup_printf("%d:%d", aspect_n, aspect_d);
+ }
+ else
+ {
+ gdouble aspect_nf = (gdouble)aspect_n / aspect_d;
+ aspect = g_strdup_printf("%.2f:1", aspect_nf);
+ }
+ return aspect;
}
static gchar*
get_rate_string(gint rate_base, gint rate)
{
- gdouble rate_f = (gdouble)rate / rate_base;
- gchar *rate_s;
+ gdouble rate_f = (gdouble)rate / rate_base;
+ gchar *rate_s;
- rate_s = g_strdup_printf("%.6g", rate_f);
- return rate_s;
+ rate_s = g_strdup_printf("%.6g", rate_f);
+ return rate_s;
}
static void
update_title_duration(signal_user_data_t *ud)
{
- gint ti;
- gint hh, mm, ss, start, end;
- gchar *text;
- GtkWidget *widget;
-
- ti = ghb_settings_combo_int(ud->settings, "title");
- widget = GHB_WIDGET (ud->builder, "title_duration");
-
- if (ghb_settings_combo_int(ud->settings, "PtoPType") == 0)
- {
- start = ghb_settings_get_int(ud->settings, "start_point");
- end = ghb_settings_get_int(ud->settings, "end_point");
- ghb_part_duration(ti, start, end, &hh, &mm, &ss);
- }
- else if (ghb_settings_combo_int(ud->settings, "PtoPType") == 1)
- {
- gint duration;
-
- start = ghb_settings_get_int(ud->settings, "start_point");
- end = ghb_settings_get_int(ud->settings, "end_point");
- duration = end - start;
- hh = duration / (60*60);
- mm = (duration / 60) % 60;
- ss = duration % 60;
- }
- else if (ghb_settings_combo_int(ud->settings, "PtoPType") == 2)
- {
- hb_title_t * title = ghb_get_title_info (ti);
- if (title != NULL)
- {
- gint64 frames;
- gint duration;
-
- start = ghb_settings_get_int(ud->settings, "start_point");
- end = ghb_settings_get_int(ud->settings, "end_point");
- frames = end - start + 1;
- duration = frames * title->rate_base / title->rate;
- hh = duration / (60*60);
- mm = (duration / 60) % 60;
- ss = duration % 60;
- }
- else
- {
- hh = mm = ss = 0;
- }
- }
- text = g_strdup_printf("%02d:%02d:%02d", hh, mm, ss);
- gtk_label_set_text (GTK_LABEL(widget), text);
- g_free(text);
+ gint ti;
+ gint hh, mm, ss, start, end;
+ gchar *text;
+ GtkWidget *widget;
+
+ ti = ghb_settings_combo_int(ud->settings, "title");
+ widget = GHB_WIDGET (ud->builder, "title_duration");
+
+ if (ghb_settings_combo_int(ud->settings, "PtoPType") == 0)
+ {
+ start = ghb_settings_get_int(ud->settings, "start_point");
+ end = ghb_settings_get_int(ud->settings, "end_point");
+ ghb_part_duration(ti, start, end, &hh, &mm, &ss);
+ }
+ else if (ghb_settings_combo_int(ud->settings, "PtoPType") == 1)
+ {
+ gint duration;
+
+ start = ghb_settings_get_int(ud->settings, "start_point");
+ end = ghb_settings_get_int(ud->settings, "end_point");
+ duration = end - start;
+ hh = duration / (60*60);
+ mm = (duration / 60) % 60;
+ ss = duration % 60;
+ }
+ else if (ghb_settings_combo_int(ud->settings, "PtoPType") == 2)
+ {
+ hb_title_t * title = ghb_get_title_info (ti);
+ if (title != NULL)
+ {
+ gint64 frames;
+ gint duration;
+
+ start = ghb_settings_get_int(ud->settings, "start_point");
+ end = ghb_settings_get_int(ud->settings, "end_point");
+ frames = end - start + 1;
+ duration = frames * title->rate_base / title->rate;
+ hh = duration / (60*60);
+ mm = (duration / 60) % 60;
+ ss = duration % 60;
+ }
+ else
+ {
+ hh = mm = ss = 0;
+ }
+ }
+ text = g_strdup_printf("%02d:%02d:%02d", hh, mm, ss);
+ gtk_label_set_text (GTK_LABEL(widget), text);
+ g_free(text);
}
static void
show_title_info(signal_user_data_t *ud, hb_title_t *title)
{
- GtkWidget *widget;
- gchar *text;
-
- ghb_settings_set_string(ud->settings, "source", title->path);
- if (title->type == HB_STREAM_TYPE || title->type == HB_FF_STREAM_TYPE)
- {
- GtkWidget *widget = GHB_WIDGET (ud->builder, "source_title");
- if (title->name != NULL && title->name[0] != 0)
- {
- gtk_label_set_text (GTK_LABEL(widget), title->name);
- ghb_settings_set_string(ud->settings, "volume_label", title->name);
- set_destination(ud);
- }
- else
- {
- gchar *label = "No Title Found";
- gtk_label_set_text (GTK_LABEL(widget), label);
- ghb_settings_set_string(ud->settings, "volume_label", label);
- }
- }
- ud->dont_clear_presets = TRUE;
- ud->scale_busy = TRUE;
- update_title_duration(ud);
- widget = GHB_WIDGET (ud->builder, "source_codec");
- if ( title->video_codec_name )
- gtk_label_set_text (GTK_LABEL(widget), title->video_codec_name);
- else
- gtk_label_set_text (GTK_LABEL(widget), "Unknown");
- widget = GHB_WIDGET (ud->builder, "source_dimensions");
- text = g_strdup_printf ("%d x %d", title->width, title->height);
- gtk_label_set_text (GTK_LABEL(widget), text);
- ghb_settings_set_int(ud->settings, "source_width", title->width);
- ghb_settings_set_int(ud->settings, "source_height", title->height);
- g_free(text);
- widget = GHB_WIDGET (ud->builder, "source_aspect");
- gint aspect_n, aspect_d;
- hb_reduce(&aspect_n, &aspect_d,
- title->width * title->pixel_aspect_width,
- title->height * title->pixel_aspect_height);
- text = get_aspect_string(aspect_n, aspect_d);
- gtk_label_set_text (GTK_LABEL(widget), text);
- g_free(text);
-
- widget = GHB_WIDGET (ud->builder, "source_frame_rate");
- text = (gchar*)get_rate_string(title->rate_base, title->rate);
- gtk_label_set_text (GTK_LABEL(widget), text);
- g_free(text);
-
- //widget = GHB_WIDGET (ud->builder, "source_interlaced");
- //gtk_label_set_text (GTK_LABEL(widget), title->interlaced ? "Yes" : "No");
-
- ghb_ui_update(ud, "scale_width",
- ghb_int64_value(title->width - title->crop[2] - title->crop[3]));
- // If anamorphic or keep_aspect, the hight will be automatically calculated
- gboolean keep_aspect;
- gint pic_par;
- keep_aspect = ghb_settings_get_boolean(ud->settings, "PictureKeepRatio");
- pic_par = ghb_settings_combo_int(ud->settings, "PicturePAR");
- if (!(keep_aspect || pic_par) || pic_par == 3)
- {
- ghb_ui_update(ud, "scale_height",
- ghb_int64_value(title->height - title->crop[0] - title->crop[1]));
- }
-
- // Set the limits of cropping. hb_set_anamorphic_size crashes if
- // you pass it a cropped width or height == 0.
- gint bound;
- bound = title->height / 2 - 8;
- widget = GHB_WIDGET (ud->builder, "PictureTopCrop");
- gtk_spin_button_set_range (GTK_SPIN_BUTTON(widget), 0, bound);
- widget = GHB_WIDGET (ud->builder, "PictureBottomCrop");
- gtk_spin_button_set_range (GTK_SPIN_BUTTON(widget), 0, bound);
- bound = title->width / 2 - 8;
- widget = GHB_WIDGET (ud->builder, "PictureLeftCrop");
- gtk_spin_button_set_range (GTK_SPIN_BUTTON(widget), 0, bound);
- widget = GHB_WIDGET (ud->builder, "PictureRightCrop");
- gtk_spin_button_set_range (GTK_SPIN_BUTTON(widget), 0, bound);
- if (ghb_settings_get_boolean(ud->settings, "PictureAutoCrop"))
- {
- ghb_ui_update(ud, "PictureTopCrop", ghb_int64_value(title->crop[0]));
- ghb_ui_update(ud, "PictureBottomCrop", ghb_int64_value(title->crop[1]));
- ghb_ui_update(ud, "PictureLeftCrop", ghb_int64_value(title->crop[2]));
- ghb_ui_update(ud, "PictureRightCrop", ghb_int64_value(title->crop[3]));
- }
- ud->scale_busy = FALSE;
- ghb_set_scale (ud, GHB_PIC_KEEP_PAR|GHB_PIC_USE_MAX);
- gint width, height, crop[4];
- crop[0] = ghb_settings_get_int(ud->settings, "PictureTopCrop");
- crop[1] = ghb_settings_get_int(ud->settings, "PictureBottomCrop");
- crop[2] = ghb_settings_get_int(ud->settings, "PictureLeftCrop");
- crop[3] = ghb_settings_get_int(ud->settings, "PictureRightCrop");
- width = title->width - crop[2] - crop[3];
- height = title->height - crop[0] - crop[1];
- widget = GHB_WIDGET (ud->builder, "crop_dimensions");
- text = g_strdup_printf ("%d x %d", width, height);
- gtk_label_set_text (GTK_LABEL(widget), text);
- g_free(text);
-
-
- gint duration = title->duration / 90000;
-
- gint num_chapters = hb_list_count(title->list_chapter);
- if (ghb_settings_combo_int(ud->settings, "PtoPType") == 0)
- {
- widget = GHB_WIDGET (ud->builder, "start_point");
- gtk_spin_button_set_range (GTK_SPIN_BUTTON(widget), 1, num_chapters);
- gtk_spin_button_set_value (GTK_SPIN_BUTTON(widget), 1);
-
- widget = GHB_WIDGET (ud->builder, "end_point");
- gtk_spin_button_set_range (GTK_SPIN_BUTTON(widget), 1, num_chapters);
- gtk_spin_button_set_value (GTK_SPIN_BUTTON(widget), num_chapters);
- }
- else if (ghb_settings_combo_int(ud->settings, "PtoPType") == 1)
- {
-
- widget = GHB_WIDGET (ud->builder, "start_point");
- gtk_spin_button_set_range (GTK_SPIN_BUTTON(widget), 0, duration-1);
- gtk_spin_button_set_value (GTK_SPIN_BUTTON(widget), 0);
-
- widget = GHB_WIDGET (ud->builder, "end_point");
- gtk_spin_button_set_range (GTK_SPIN_BUTTON(widget), 1, duration);
- gtk_spin_button_set_value (GTK_SPIN_BUTTON(widget), duration);
- }
- else if (ghb_settings_combo_int(ud->settings, "PtoPType") == 2)
- {
- gdouble max_frames = (gdouble)duration * title->rate / title->rate_base;
- widget = GHB_WIDGET (ud->builder, "start_point");
- gtk_spin_button_set_range (GTK_SPIN_BUTTON(widget), 1, max_frames);
- gtk_spin_button_set_value (GTK_SPIN_BUTTON(widget), 1);
-
- widget = GHB_WIDGET (ud->builder, "end_point");
- gtk_spin_button_set_range (GTK_SPIN_BUTTON(widget), 1, max_frames);
- gtk_spin_button_set_value (GTK_SPIN_BUTTON(widget), max_frames);
- }
-
- widget = GHB_WIDGET (ud->builder, "angle");
- gtk_spin_button_set_value (GTK_SPIN_BUTTON(widget), 1);
- gtk_spin_button_set_range (GTK_SPIN_BUTTON(widget), 1, title->angle_count);
- ghb_settings_set_int(ud->settings, "angle_count", title->angle_count);
- ud->dont_clear_presets = FALSE;
- // Set default metadata name
- ghb_ui_update(ud, "MetaName", ghb_string_value(title->name));
- if (title->metadata)
- {
- if (title->metadata->name)
- {
- ghb_ui_update(ud, "MetaName",
- ghb_string_value(title->metadata->name));
- }
- ghb_ui_update(ud, "MetaArtist",
- ghb_string_value(title->metadata->artist));
- ghb_ui_update(ud, "MetaReleaseDate",
- ghb_string_value(title->metadata->release_date));
- ghb_ui_update(ud, "MetaComment",
- ghb_string_value(title->metadata->comment));
- if (!title->metadata->name && title->metadata->album)
- {
- ghb_ui_update(ud, "MetaName",
- ghb_string_value(title->metadata->album));
- }
- ghb_ui_update(ud, "MetaAlbumArtist",
- ghb_string_value(title->metadata->album_artist));
- ghb_ui_update(ud, "MetaGenre",
- ghb_string_value(title->metadata->genre));
- ghb_ui_update(ud, "MetaDescription",
- ghb_string_value(title->metadata->description));
- ghb_ui_update(ud, "MetaLongDescription",
- ghb_string_value(title->metadata->long_description));
- }
+ GtkWidget *widget;
+ gchar *text;
+
+ ghb_settings_set_string(ud->settings, "source", title->path);
+ if (title->type == HB_STREAM_TYPE || title->type == HB_FF_STREAM_TYPE)
+ {
+ GtkWidget *widget = GHB_WIDGET (ud->builder, "source_title");
+ if (title->name != NULL && title->name[0] != 0)
+ {
+ gtk_label_set_text (GTK_LABEL(widget), title->name);
+ ghb_settings_set_string(ud->settings, "volume_label", title->name);
+ set_destination(ud);
+ }
+ else
+ {
+ gchar *label = "No Title Found";
+ gtk_label_set_text (GTK_LABEL(widget), label);
+ ghb_settings_set_string(ud->settings, "volume_label", label);
+ }
+ }
+ ud->dont_clear_presets = TRUE;
+ ud->scale_busy = TRUE;
+ update_title_duration(ud);
+ widget = GHB_WIDGET (ud->builder, "source_codec");
+ if ( title->video_codec_name )
+ gtk_label_set_text (GTK_LABEL(widget), title->video_codec_name);
+ else
+ gtk_label_set_text (GTK_LABEL(widget), "Unknown");
+ widget = GHB_WIDGET (ud->builder, "source_dimensions");
+ text = g_strdup_printf ("%d x %d", title->width, title->height);
+ gtk_label_set_text (GTK_LABEL(widget), text);
+ ghb_settings_set_int(ud->settings, "source_width", title->width);
+ ghb_settings_set_int(ud->settings, "source_height", title->height);
+ g_free(text);
+ widget = GHB_WIDGET (ud->builder, "source_aspect");
+ gint aspect_n, aspect_d;
+ hb_reduce(&aspect_n, &aspect_d,
+ title->width * title->pixel_aspect_width,
+ title->height * title->pixel_aspect_height);
+ text = get_aspect_string(aspect_n, aspect_d);
+ gtk_label_set_text (GTK_LABEL(widget), text);
+ g_free(text);
+
+ widget = GHB_WIDGET (ud->builder, "source_frame_rate");
+ text = (gchar*)get_rate_string(title->rate_base, title->rate);
+ gtk_label_set_text (GTK_LABEL(widget), text);
+ g_free(text);
+
+ //widget = GHB_WIDGET (ud->builder, "source_interlaced");
+ //gtk_label_set_text (GTK_LABEL(widget), title->interlaced ? "Yes" : "No");
+
+ ghb_ui_update(ud, "scale_width",
+ ghb_int64_value(title->width - title->crop[2] - title->crop[3]));
+ // If anamorphic or keep_aspect, the hight will be automatically calculated
+ gboolean keep_aspect;
+ gint pic_par;
+ keep_aspect = ghb_settings_get_boolean(ud->settings, "PictureKeepRatio");
+ pic_par = ghb_settings_combo_int(ud->settings, "PicturePAR");
+ if (!(keep_aspect || pic_par) || pic_par == 3)
+ {
+ ghb_ui_update(ud, "scale_height",
+ ghb_int64_value(title->height - title->crop[0] - title->crop[1]));
+ }
+
+ // Set the limits of cropping. hb_set_anamorphic_size crashes if
+ // you pass it a cropped width or height == 0.
+ gint bound;
+ bound = title->height / 2 - 8;
+ widget = GHB_WIDGET (ud->builder, "PictureTopCrop");
+ gtk_spin_button_set_range (GTK_SPIN_BUTTON(widget), 0, bound);
+ widget = GHB_WIDGET (ud->builder, "PictureBottomCrop");
+ gtk_spin_button_set_range (GTK_SPIN_BUTTON(widget), 0, bound);
+ bound = title->width / 2 - 8;
+ widget = GHB_WIDGET (ud->builder, "PictureLeftCrop");
+ gtk_spin_button_set_range (GTK_SPIN_BUTTON(widget), 0, bound);
+ widget = GHB_WIDGET (ud->builder, "PictureRightCrop");
+ gtk_spin_button_set_range (GTK_SPIN_BUTTON(widget), 0, bound);
+ if (ghb_settings_get_boolean(ud->settings, "PictureAutoCrop"))
+ {
+ ghb_ui_update(ud, "PictureTopCrop", ghb_int64_value(title->crop[0]));
+ ghb_ui_update(ud, "PictureBottomCrop", ghb_int64_value(title->crop[1]));
+ ghb_ui_update(ud, "PictureLeftCrop", ghb_int64_value(title->crop[2]));
+ ghb_ui_update(ud, "PictureRightCrop", ghb_int64_value(title->crop[3]));
+ }
+ ud->scale_busy = FALSE;
+ ghb_set_scale (ud, GHB_PIC_KEEP_PAR|GHB_PIC_USE_MAX);
+ gint width, height, crop[4];
+ crop[0] = ghb_settings_get_int(ud->settings, "PictureTopCrop");
+ crop[1] = ghb_settings_get_int(ud->settings, "PictureBottomCrop");
+ crop[2] = ghb_settings_get_int(ud->settings, "PictureLeftCrop");
+ crop[3] = ghb_settings_get_int(ud->settings, "PictureRightCrop");
+ width = title->width - crop[2] - crop[3];
+ height = title->height - crop[0] - crop[1];
+ widget = GHB_WIDGET (ud->builder, "crop_dimensions");
+ text = g_strdup_printf ("%d x %d", width, height);
+ gtk_label_set_text (GTK_LABEL(widget), text);
+ g_free(text);
+
+
+ gint duration = title->duration / 90000;
+
+ gint num_chapters = hb_list_count(title->list_chapter);
+ if (ghb_settings_combo_int(ud->settings, "PtoPType") == 0)
+ {
+ widget = GHB_WIDGET (ud->builder, "start_point");
+ gtk_spin_button_set_range (GTK_SPIN_BUTTON(widget), 1, num_chapters);
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON(widget), 1);
+
+ widget = GHB_WIDGET (ud->builder, "end_point");
+ gtk_spin_button_set_range (GTK_SPIN_BUTTON(widget), 1, num_chapters);
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON(widget), num_chapters);
+ }
+ else if (ghb_settings_combo_int(ud->settings, "PtoPType") == 1)
+ {
+
+ widget = GHB_WIDGET (ud->builder, "start_point");
+ gtk_spin_button_set_range (GTK_SPIN_BUTTON(widget), 0, duration-1);
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON(widget), 0);
+
+ widget = GHB_WIDGET (ud->builder, "end_point");
+ gtk_spin_button_set_range (GTK_SPIN_BUTTON(widget), 1, duration);
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON(widget), duration);
+ }
+ else if (ghb_settings_combo_int(ud->settings, "PtoPType") == 2)
+ {
+ gdouble max_frames = (gdouble)duration * title->rate / title->rate_base;
+ widget = GHB_WIDGET (ud->builder, "start_point");
+ gtk_spin_button_set_range (GTK_SPIN_BUTTON(widget), 1, max_frames);
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON(widget), 1);
+
+ widget = GHB_WIDGET (ud->builder, "end_point");
+ gtk_spin_button_set_range (GTK_SPIN_BUTTON(widget), 1, max_frames);
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON(widget), max_frames);
+ }
+
+ widget = GHB_WIDGET (ud->builder, "angle");
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON(widget), 1);
+ gtk_spin_button_set_range (GTK_SPIN_BUTTON(widget), 1, title->angle_count);
+ ghb_settings_set_int(ud->settings, "angle_count", title->angle_count);
+ ud->dont_clear_presets = FALSE;
+ // Set default metadata name
+ ghb_ui_update(ud, "MetaName", ghb_string_value(title->name));
+ if (title->metadata)
+ {
+ if (title->metadata->name)
+ {
+ ghb_ui_update(ud, "MetaName",
+ ghb_string_value(title->metadata->name));
+ }
+ ghb_ui_update(ud, "MetaArtist",
+ ghb_string_value(title->metadata->artist));
+ ghb_ui_update(ud, "MetaReleaseDate",
+ ghb_string_value(title->metadata->release_date));
+ ghb_ui_update(ud, "MetaComment",
+ ghb_string_value(title->metadata->comment));
+ if (!title->metadata->name && title->metadata->album)
+ {
+ ghb_ui_update(ud, "MetaName",
+ ghb_string_value(title->metadata->album));
+ }
+ ghb_ui_update(ud, "MetaAlbumArtist",
+ ghb_string_value(title->metadata->album_artist));
+ ghb_ui_update(ud, "MetaGenre",
+ ghb_string_value(title->metadata->genre));
+ ghb_ui_update(ud, "MetaDescription",
+ ghb_string_value(title->metadata->description));
+ ghb_ui_update(ud, "MetaLongDescription",
+ ghb_string_value(title->metadata->long_description));
+ }
}
void
set_title_settings(GValue *settings, gint titleindex)
{
- ghb_settings_set_int(settings, "title", titleindex);
- ghb_settings_set_int(settings, "title_no", titleindex);
-
- hb_title_t * title = ghb_get_title_info(titleindex);
- if (title != NULL)
- {
- ghb_settings_set_int(settings, "source_width", title->width);
- ghb_settings_set_int(settings, "source_height", title->height);
- ghb_settings_set_string(settings, "source", title->path);
- if (title->type == HB_STREAM_TYPE || title->type == HB_FF_STREAM_TYPE)
- {
- if (title->name != NULL && title->name[0] != 0)
- {
- ghb_settings_set_string(settings, "volume_label", title->name);
- }
- else
- {
- gchar *label = "No Title Found";
- ghb_settings_set_string(settings, "volume_label", label);
- }
- }
- ghb_settings_set_int(settings, "scale_width",
- title->width - title->crop[2] - title->crop[3]);
-
- // If anamorphic or keep_aspect, the hight will
- // be automatically calculated
- gboolean keep_aspect;
- gint pic_par;
- keep_aspect = ghb_settings_get_boolean(settings, "PictureKeepRatio");
- pic_par = ghb_settings_combo_int(settings, "PicturePAR");
- if (!(keep_aspect || pic_par) || pic_par == 3)
- {
- ghb_settings_set_int(settings, "scale_height",
- title->width - title->crop[0] - title->crop[1]);
- }
-
- ghb_set_scale_settings(settings, GHB_PIC_KEEP_PAR|GHB_PIC_USE_MAX);
- ghb_settings_set_int(settings, "angle_count", title->angle_count);
- }
- update_chapter_list_settings(settings);
- ghb_set_pref_audio_settings(titleindex, settings);
- ghb_set_pref_subtitle_settings(titleindex, settings);
- set_destination_settings(settings);
-
- char *dest_file, *dest_dir, *dest;
- dest_file = ghb_settings_get_string(settings, "dest_file");
- dest_dir = ghb_settings_get_string(settings, "dest_dir");
- dest = g_strdup_printf("%s" G_DIR_SEPARATOR_S "%s", dest_dir, dest_file);
- ghb_settings_set_string(settings, "destination", dest);
- g_free(dest_file);
- g_free(dest_dir);
- g_free(dest);
+ ghb_settings_set_int(settings, "title", titleindex);
+ ghb_settings_set_int(settings, "title_no", titleindex);
+
+ hb_title_t * title = ghb_get_title_info(titleindex);
+ if (title != NULL)
+ {
+ ghb_settings_set_int(settings, "source_width", title->width);
+ ghb_settings_set_int(settings, "source_height", title->height);
+ ghb_settings_set_string(settings, "source", title->path);
+ if (title->type == HB_STREAM_TYPE || title->type == HB_FF_STREAM_TYPE)
+ {
+ if (title->name != NULL && title->name[0] != 0)
+ {
+ ghb_settings_set_string(settings, "volume_label", title->name);
+ }
+ else
+ {
+ gchar *label = "No Title Found";
+ ghb_settings_set_string(settings, "volume_label", label);
+ }
+ }
+ ghb_settings_set_int(settings, "scale_width",
+ title->width - title->crop[2] - title->crop[3]);
+
+ // If anamorphic or keep_aspect, the hight will
+ // be automatically calculated
+ gboolean keep_aspect;
+ gint pic_par;
+ keep_aspect = ghb_settings_get_boolean(settings, "PictureKeepRatio");
+ pic_par = ghb_settings_combo_int(settings, "PicturePAR");
+ if (!(keep_aspect || pic_par) || pic_par == 3)
+ {
+ ghb_settings_set_int(settings, "scale_height",
+ title->width - title->crop[0] - title->crop[1]);
+ }
+
+ ghb_set_scale_settings(settings, GHB_PIC_KEEP_PAR|GHB_PIC_USE_MAX);
+ ghb_settings_set_int(settings, "angle_count", title->angle_count);
+ }
+ update_chapter_list_settings(settings);
+ ghb_set_pref_audio_settings(titleindex, settings);
+ ghb_set_pref_subtitle_settings(titleindex, settings);
+ set_destination_settings(settings);
+
+ char *dest_file, *dest_dir, *dest;
+ dest_file = ghb_settings_get_string(settings, "dest_file");
+ dest_dir = ghb_settings_get_string(settings, "dest_dir");
+ dest = g_strdup_printf("%s" G_DIR_SEPARATOR_S "%s", dest_dir, dest_file);
+ ghb_settings_set_string(settings, "destination", dest);
+ g_free(dest_file);
+ g_free(dest_dir);
+ g_free(dest);
}
void
ghb_add_all_titles(signal_user_data_t *ud)
{
- gint ii;
- gint count = ghb_get_title_count();
-
- for (ii = 0; ii < count; ii++)
- {
- GValue *settings = ghb_value_dup(ud->settings);
- ghb_settings_set_boolean(settings, "use_source_name", TRUE);
- hb_title_t * title = ghb_get_title_info(ii);
- if (title != NULL)
- {
- if (title->type == HB_DVD_TYPE ||
- title->type == HB_BD_TYPE)
- {
- ghb_settings_set_boolean(settings,
- "title_no_in_destination", TRUE);
- }
- }
- set_title_settings(settings, ii);
- ghb_queue_add(ud, settings, ii);
- }
+ gint ii;
+ gint count = ghb_get_title_count();
+
+ for (ii = 0; ii < count; ii++)
+ {
+ GValue *settings = ghb_value_dup(ud->settings);
+ ghb_settings_set_boolean(settings, "use_source_name", TRUE);
+ hb_title_t * title = ghb_get_title_info(ii);
+ if (title != NULL)
+ {
+ if (title->type == HB_DVD_TYPE ||
+ title->type == HB_BD_TYPE)
+ {
+ ghb_settings_set_boolean(settings,
+ "title_no_in_destination", TRUE);
+ }
+ }
+ set_title_settings(settings, ii);
+ ghb_queue_add(ud, settings, ii);
+ }
}
static gboolean update_preview = FALSE;
@@ -1614,2222 +1614,2222 @@ static gboolean update_preview = FALSE;
G_MODULE_EXPORT void
title_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
{
- gint titleindex;
-
- g_debug("title_changed_cb ()");
- ghb_widget_to_setting(ud->settings, widget);
-
- titleindex = ghb_settings_combo_int(ud->settings, "title");
- ghb_settings_set_int(ud->settings, "title_no", titleindex);
- ghb_update_ui_combo_box (ud, "AudioTrack", titleindex, FALSE);
- ghb_update_ui_combo_box (ud, "SubtitleTrack", titleindex, FALSE);
-
- hb_title_t * title = ghb_get_title_info(titleindex);
- if (title != NULL)
- {
- show_title_info(ud, title);
- }
- ghb_check_dependency(ud, widget, NULL);
- update_chapter_list_settings(ud->settings);
- update_chapter_list_from_settings(ud->builder, ud->settings);
- ghb_set_pref_audio_settings(titleindex, ud->settings);
- ghb_set_pref_audio_from_settings(ud, ud->settings);
- ghb_set_pref_subtitle(titleindex, ud);
- ghb_grey_combo_options (ud);
-
- // Unfortunately, there is no way to query how many frames were
- // actually generated during the scan.
- // If I knew how many were generated, I would adjust the spin
- // control range here.
- // I do know how many were asked for.
- gint preview_count;
- preview_count = ghb_settings_get_int(ud->settings, "preview_count");
- widget = GHB_WIDGET(ud->builder, "preview_frame");
- gtk_range_set_range (GTK_RANGE(widget), 1, preview_count);
- ghb_ui_update(ud, "preview_frame", ghb_int64_value(2));
-
- ghb_set_preview_image (ud);
- if (ghb_settings_get_boolean(ud->settings, "title_no_in_destination"))
- {
- set_destination(ud);
- }
- ghb_preview_set_visible(ud);
-
- gint end;
- widget = GHB_WIDGET (ud->builder, "ChapterMarkers");
- end = ghb_settings_get_int(ud->settings, "end_point");
- if (1 == end)
- {
- gtk_widget_set_sensitive(widget, FALSE);
- }
- else
- {
- gtk_widget_set_sensitive(widget, TRUE);
- }
+ gint titleindex;
+
+ g_debug("title_changed_cb ()");
+ ghb_widget_to_setting(ud->settings, widget);
+
+ titleindex = ghb_settings_combo_int(ud->settings, "title");
+ ghb_settings_set_int(ud->settings, "title_no", titleindex);
+ ghb_update_ui_combo_box (ud, "AudioTrack", titleindex, FALSE);
+ ghb_update_ui_combo_box (ud, "SubtitleTrack", titleindex, FALSE);
+
+ hb_title_t * title = ghb_get_title_info(titleindex);
+ if (title != NULL)
+ {
+ show_title_info(ud, title);
+ }
+ ghb_check_dependency(ud, widget, NULL);
+ update_chapter_list_settings(ud->settings);
+ update_chapter_list_from_settings(ud->builder, ud->settings);
+ ghb_set_pref_audio_settings(titleindex, ud->settings);
+ ghb_set_pref_audio_from_settings(ud, ud->settings);
+ ghb_set_pref_subtitle(titleindex, ud);
+ ghb_grey_combo_options (ud);
+
+ // Unfortunately, there is no way to query how many frames were
+ // actually generated during the scan.
+ // If I knew how many were generated, I would adjust the spin
+ // control range here.
+ // I do know how many were asked for.
+ gint preview_count;
+ preview_count = ghb_settings_get_int(ud->settings, "preview_count");
+ widget = GHB_WIDGET(ud->builder, "preview_frame");
+ gtk_range_set_range (GTK_RANGE(widget), 1, preview_count);
+ ghb_ui_update(ud, "preview_frame", ghb_int64_value(2));
+
+ ghb_set_preview_image (ud);
+ if (ghb_settings_get_boolean(ud->settings, "title_no_in_destination"))
+ {
+ set_destination(ud);
+ }
+ ghb_preview_set_visible(ud);
+
+ gint end;
+ widget = GHB_WIDGET (ud->builder, "ChapterMarkers");
+ end = ghb_settings_get_int(ud->settings, "end_point");
+ if (1 == end)
+ {
+ gtk_widget_set_sensitive(widget, FALSE);
+ }
+ else
+ {
+ gtk_widget_set_sensitive(widget, TRUE);
+ }
}
G_MODULE_EXPORT void
ptop_widget_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
{
- gint ti;
- hb_title_t * title;
-
- ghb_widget_to_setting(ud->settings, widget);
- ghb_check_dependency(ud, widget, NULL);
- ghb_live_reset(ud);
-
- ti = ghb_settings_combo_int(ud->settings, "title");
- title = ghb_get_title_info(ti);
- if (title == NULL)
- return;
-
- gint num_chapters = hb_list_count(title->list_chapter);
- gint duration = title->duration / 90000;
- if (ghb_settings_combo_int(ud->settings, "PtoPType") == 0)
- {
- widget = GHB_WIDGET (ud->builder, "start_point");
- gtk_spin_button_set_range (GTK_SPIN_BUTTON(widget), 1, num_chapters);
- gtk_spin_button_set_value (GTK_SPIN_BUTTON(widget), 1);
-
- widget = GHB_WIDGET (ud->builder, "end_point");
- gtk_spin_button_set_range (GTK_SPIN_BUTTON(widget), 1, num_chapters);
- gtk_spin_button_set_value (GTK_SPIN_BUTTON(widget), num_chapters);
- }
- else if (ghb_settings_combo_int(ud->settings, "PtoPType") == 1)
- {
- widget = GHB_WIDGET (ud->builder, "start_point");
- gtk_spin_button_set_range (GTK_SPIN_BUTTON(widget), 0, duration-1);
- gtk_spin_button_set_value (GTK_SPIN_BUTTON(widget), 0);
-
- widget = GHB_WIDGET (ud->builder, "end_point");
- gtk_spin_button_set_range (GTK_SPIN_BUTTON(widget), 1, duration);
- gtk_spin_button_set_value (GTK_SPIN_BUTTON(widget), duration);
- }
- else if (ghb_settings_combo_int(ud->settings, "PtoPType") == 2)
- {
- gdouble max_frames = (gdouble)duration * title->rate / title->rate_base;
- widget = GHB_WIDGET (ud->builder, "start_point");
- gtk_spin_button_set_range (GTK_SPIN_BUTTON(widget), 1, max_frames);
- gtk_spin_button_set_value (GTK_SPIN_BUTTON(widget), 1);
-
- widget = GHB_WIDGET (ud->builder, "end_point");
- gtk_spin_button_set_range (GTK_SPIN_BUTTON(widget), 1, max_frames);
- gtk_spin_button_set_value (GTK_SPIN_BUTTON(widget), max_frames);
- }
+ gint ti;
+ hb_title_t * title;
+
+ ghb_widget_to_setting(ud->settings, widget);
+ ghb_check_dependency(ud, widget, NULL);
+ ghb_live_reset(ud);
+
+ ti = ghb_settings_combo_int(ud->settings, "title");
+ title = ghb_get_title_info(ti);
+ if (title == NULL)
+ return;
+
+ gint num_chapters = hb_list_count(title->list_chapter);
+ gint duration = title->duration / 90000;
+ if (ghb_settings_combo_int(ud->settings, "PtoPType") == 0)
+ {
+ widget = GHB_WIDGET (ud->builder, "start_point");
+ gtk_spin_button_set_range (GTK_SPIN_BUTTON(widget), 1, num_chapters);
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON(widget), 1);
+
+ widget = GHB_WIDGET (ud->builder, "end_point");
+ gtk_spin_button_set_range (GTK_SPIN_BUTTON(widget), 1, num_chapters);
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON(widget), num_chapters);
+ }
+ else if (ghb_settings_combo_int(ud->settings, "PtoPType") == 1)
+ {
+ widget = GHB_WIDGET (ud->builder, "start_point");
+ gtk_spin_button_set_range (GTK_SPIN_BUTTON(widget), 0, duration-1);
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON(widget), 0);
+
+ widget = GHB_WIDGET (ud->builder, "end_point");
+ gtk_spin_button_set_range (GTK_SPIN_BUTTON(widget), 1, duration);
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON(widget), duration);
+ }
+ else if (ghb_settings_combo_int(ud->settings, "PtoPType") == 2)
+ {
+ gdouble max_frames = (gdouble)duration * title->rate / title->rate_base;
+ widget = GHB_WIDGET (ud->builder, "start_point");
+ gtk_spin_button_set_range (GTK_SPIN_BUTTON(widget), 1, max_frames);
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON(widget), 1);
+
+ widget = GHB_WIDGET (ud->builder, "end_point");
+ gtk_spin_button_set_range (GTK_SPIN_BUTTON(widget), 1, max_frames);
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON(widget), max_frames);
+ }
}
G_MODULE_EXPORT void
framerate_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
{
- ghb_widget_to_setting(ud->settings, widget);
+ ghb_widget_to_setting(ud->settings, widget);
- if (ghb_settings_combo_int(ud->settings, "VideoFramerate") != 0)
- {
- if (!ghb_settings_get_boolean(ud->settings, "VideoFrameratePFR"))
+ if (ghb_settings_combo_int(ud->settings, "VideoFramerate") != 0)
+ {
+ if (!ghb_settings_get_boolean(ud->settings, "VideoFrameratePFR"))
{
- ghb_ui_update(ud, "VideoFramerateCFR", ghb_boolean_value(TRUE));
+ ghb_ui_update(ud, "VideoFramerateCFR", ghb_boolean_value(TRUE));
}
- }
- if (ghb_settings_combo_int(ud->settings, "VideoFramerate") == 0 &&
- ghb_settings_get_boolean(ud->settings, "VideoFrameratePFR"))
- {
- ghb_ui_update(ud, "VideoFramerateVFR", ghb_boolean_value(TRUE));
- }
- ghb_check_dependency(ud, widget, NULL);
- ghb_clear_presets_selection(ud);
- ghb_live_reset(ud);
+ }
+ if (ghb_settings_combo_int(ud->settings, "VideoFramerate") == 0 &&
+ ghb_settings_get_boolean(ud->settings, "VideoFrameratePFR"))
+ {
+ ghb_ui_update(ud, "VideoFramerateVFR", ghb_boolean_value(TRUE));
+ }
+ ghb_check_dependency(ud, widget, NULL);
+ ghb_clear_presets_selection(ud);
+ ghb_live_reset(ud);
}
G_MODULE_EXPORT void
setting_widget_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
{
- ghb_widget_to_setting(ud->settings, widget);
- ghb_check_dependency(ud, widget, NULL);
- ghb_clear_presets_selection(ud);
- ghb_live_reset(ud);
+ ghb_widget_to_setting(ud->settings, widget);
+ ghb_check_dependency(ud, widget, NULL);
+ ghb_clear_presets_selection(ud);
+ ghb_live_reset(ud);
}
G_MODULE_EXPORT gboolean
meta_focus_out_cb(GtkWidget *widget, GdkEventFocus *event,
- signal_user_data_t *ud)
+ signal_user_data_t *ud)
{
- ghb_widget_to_setting(ud->settings, widget);
- return FALSE;
+ ghb_widget_to_setting(ud->settings, widget);
+ return FALSE;
}
G_MODULE_EXPORT void
meta_setting_widget_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
{
- ghb_widget_to_setting(ud->settings, widget);
+ ghb_widget_to_setting(ud->settings, widget);
}
G_MODULE_EXPORT void
chapter_markers_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
{
- ghb_widget_to_setting(ud->settings, widget);
- ghb_check_dependency(ud, widget, NULL);
- ghb_clear_presets_selection(ud);
- ghb_live_reset(ud);
+ ghb_widget_to_setting(ud->settings, widget);
+ ghb_check_dependency(ud, widget, NULL);
+ ghb_clear_presets_selection(ud);
+ ghb_live_reset(ud);
}
G_MODULE_EXPORT void
vquality_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
{
- ghb_widget_to_setting(ud->settings, widget);
- ghb_check_dependency(ud, widget, NULL);
- ghb_clear_presets_selection(ud);
- ghb_live_reset(ud);
-
- gint vcodec = ghb_settings_combo_int(ud->settings, "VideoEncoder");
- gdouble step;
- if (vcodec == HB_VCODEC_X264)
- {
- step = ghb_settings_combo_double(ud->settings,
- "VideoQualityGranularity");
- }
- else
- {
- step = 1;
- }
- gdouble val = gtk_range_get_value(GTK_RANGE(widget));
- val = ((int)((val + step / 2) / step)) * step;
- gtk_range_set_value(GTK_RANGE(widget), val);
+ ghb_widget_to_setting(ud->settings, widget);
+ ghb_check_dependency(ud, widget, NULL);
+ ghb_clear_presets_selection(ud);
+ ghb_live_reset(ud);
+
+ gint vcodec = ghb_settings_combo_int(ud->settings, "VideoEncoder");
+ gdouble step;
+ if (vcodec == HB_VCODEC_X264)
+ {
+ step = ghb_settings_combo_double(ud->settings,
+ "VideoQualityGranularity");
+ }
+ else
+ {
+ step = 1;
+ }
+ gdouble val = gtk_range_get_value(GTK_RANGE(widget));
+ val = ((int)((val + step / 2) / step)) * step;
+ gtk_range_set_value(GTK_RANGE(widget), val);
}
G_MODULE_EXPORT void
http_opt_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
{
- ghb_widget_to_setting(ud->settings, widget);
- ghb_check_dependency(ud, widget, NULL);
- ghb_clear_presets_selection(ud);
- ghb_live_reset(ud);
- // AC3 is not allowed when Web optimized
- ghb_grey_combo_options (ud);
+ ghb_widget_to_setting(ud->settings, widget);
+ ghb_check_dependency(ud, widget, NULL);
+ ghb_clear_presets_selection(ud);
+ ghb_live_reset(ud);
+ // AC3 is not allowed when Web optimized
+ ghb_grey_combo_options (ud);
}
G_MODULE_EXPORT void
vcodec_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
{
- gdouble vqmin, vqmax, step, page;
- gboolean inverted;
- gint digits;
+ gdouble vqmin, vqmax, step, page;
+ gboolean inverted;
+ gint digits;
- ghb_widget_to_setting(ud->settings, widget);
- ghb_check_dependency(ud, widget, NULL);
- ghb_clear_presets_selection(ud);
- ghb_live_reset(ud);
- ghb_vquality_range(ud, &vqmin, &vqmax, &step, &page, &digits, &inverted);
- GtkWidget *qp = GHB_WIDGET(ud->builder, "VideoQualitySlider");
- gtk_range_set_range (GTK_RANGE(qp), vqmin, vqmax);
- gtk_range_set_increments (GTK_RANGE(qp), step, page);
- gtk_scale_set_digits(GTK_SCALE(qp), digits);
- gtk_range_set_inverted (GTK_RANGE(qp), inverted);
+ ghb_widget_to_setting(ud->settings, widget);
+ ghb_check_dependency(ud, widget, NULL);
+ ghb_clear_presets_selection(ud);
+ ghb_live_reset(ud);
+ ghb_vquality_range(ud, &vqmin, &vqmax, &step, &page, &digits, &inverted);
+ GtkWidget *qp = GHB_WIDGET(ud->builder, "VideoQualitySlider");
+ gtk_range_set_range (GTK_RANGE(qp), vqmin, vqmax);
+ gtk_range_set_increments (GTK_RANGE(qp), step, page);
+ gtk_scale_set_digits(GTK_SCALE(qp), digits);
+ gtk_range_set_inverted (GTK_RANGE(qp), inverted);
}
G_MODULE_EXPORT void
start_point_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
{
- gint start, end;
- const gchar *name = ghb_get_setting_key(widget);
-
- g_debug("start_point_changed_cb () %s", name);
- ghb_widget_to_setting(ud->settings, widget);
- if (ghb_settings_combo_int(ud->settings, "PtoPType") == 0)
- {
- start = ghb_settings_get_int(ud->settings, "start_point");
- end = ghb_settings_get_int(ud->settings, "end_point");
- if (start > end)
- ghb_ui_update(ud, "end_point", ghb_int_value(start));
- ghb_check_dependency(ud, widget, NULL);
- if (ghb_settings_get_boolean(ud->settings, "chapters_in_destination"))
- {
- set_destination(ud);
- }
- widget = GHB_WIDGET (ud->builder, "ChapterMarkers");
- // End may have been changed above, get it again
- end = ghb_settings_get_int(ud->settings, "end_point");
- if (start == end)
- {
- gtk_widget_set_sensitive(widget, FALSE);
- }
- else
- {
- gtk_widget_set_sensitive(widget, TRUE);
- }
- update_title_duration(ud);
- }
- else if (ghb_settings_combo_int(ud->settings, "PtoPType") == 1)
- {
- start = ghb_settings_get_int(ud->settings, "start_point");
- end = ghb_settings_get_int(ud->settings, "end_point");
- if (start >= end)
- ghb_ui_update(ud, "end_point", ghb_int_value(start+1));
- ghb_check_dependency(ud, widget, NULL);
- update_title_duration(ud);
- }
- else if (ghb_settings_combo_int(ud->settings, "PtoPType") == 2)
- {
- start = ghb_settings_get_int(ud->settings, "start_point");
- end = ghb_settings_get_int(ud->settings, "end_point");
- if (start > end)
- ghb_ui_update(ud, "end_point", ghb_int_value(start));
- ghb_check_dependency(ud, widget, NULL);
- update_title_duration(ud);
- }
+ gint start, end;
+ const gchar *name = ghb_get_setting_key(widget);
+
+ g_debug("start_point_changed_cb () %s", name);
+ ghb_widget_to_setting(ud->settings, widget);
+ if (ghb_settings_combo_int(ud->settings, "PtoPType") == 0)
+ {
+ start = ghb_settings_get_int(ud->settings, "start_point");
+ end = ghb_settings_get_int(ud->settings, "end_point");
+ if (start > end)
+ ghb_ui_update(ud, "end_point", ghb_int_value(start));
+ ghb_check_dependency(ud, widget, NULL);
+ if (ghb_settings_get_boolean(ud->settings, "chapters_in_destination"))
+ {
+ set_destination(ud);
+ }
+ widget = GHB_WIDGET (ud->builder, "ChapterMarkers");
+ // End may have been changed above, get it again
+ end = ghb_settings_get_int(ud->settings, "end_point");
+ if (start == end)
+ {
+ gtk_widget_set_sensitive(widget, FALSE);
+ }
+ else
+ {
+ gtk_widget_set_sensitive(widget, TRUE);
+ }
+ update_title_duration(ud);
+ }
+ else if (ghb_settings_combo_int(ud->settings, "PtoPType") == 1)
+ {
+ start = ghb_settings_get_int(ud->settings, "start_point");
+ end = ghb_settings_get_int(ud->settings, "end_point");
+ if (start >= end)
+ ghb_ui_update(ud, "end_point", ghb_int_value(start+1));
+ ghb_check_dependency(ud, widget, NULL);
+ update_title_duration(ud);
+ }
+ else if (ghb_settings_combo_int(ud->settings, "PtoPType") == 2)
+ {
+ start = ghb_settings_get_int(ud->settings, "start_point");
+ end = ghb_settings_get_int(ud->settings, "end_point");
+ if (start > end)
+ ghb_ui_update(ud, "end_point", ghb_int_value(start));
+ ghb_check_dependency(ud, widget, NULL);
+ update_title_duration(ud);
+ }
}
G_MODULE_EXPORT void
end_point_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
{
- gint start, end;
- const gchar *name = ghb_get_setting_key(widget);
-
- g_debug("end_point_changed_cb () %s", name);
- ghb_widget_to_setting(ud->settings, widget);
- if (ghb_settings_combo_int(ud->settings, "PtoPType") == 0)
- {
- start = ghb_settings_get_int(ud->settings, "start_point");
- end = ghb_settings_get_int(ud->settings, "end_point");
- if (start > end)
- ghb_ui_update(ud, "start_point", ghb_int_value(end));
- ghb_check_dependency(ud, widget, NULL);
- if (ghb_settings_get_boolean(ud->settings, "chapters_in_destination"))
- {
- set_destination(ud);
- }
- widget = GHB_WIDGET (ud->builder, "ChapterMarkers");
- // Start may have been changed above, get it again
- start = ghb_settings_get_int(ud->settings, "start_point");
- if (start == end)
- {
- gtk_widget_set_sensitive(widget, FALSE);
- }
- else
- {
- gtk_widget_set_sensitive(widget, TRUE);
- }
- update_title_duration(ud);
- }
- else if (ghb_settings_combo_int(ud->settings, "PtoPType") == 1)
- {
- start = ghb_settings_get_int(ud->settings, "start_point");
- end = ghb_settings_get_int(ud->settings, "end_point");
- if (start >= end)
- ghb_ui_update(ud, "start_point", ghb_int_value(end-1));
- ghb_check_dependency(ud, widget, NULL);
- update_title_duration(ud);
- }
- else if (ghb_settings_combo_int(ud->settings, "PtoPType") == 2)
- {
- start = ghb_settings_get_int(ud->settings, "start_point");
- end = ghb_settings_get_int(ud->settings, "end_point");
- if (start > end)
- ghb_ui_update(ud, "start_point", ghb_int_value(end));
- ghb_check_dependency(ud, widget, NULL);
- update_title_duration(ud);
- }
+ gint start, end;
+ const gchar *name = ghb_get_setting_key(widget);
+
+ g_debug("end_point_changed_cb () %s", name);
+ ghb_widget_to_setting(ud->settings, widget);
+ if (ghb_settings_combo_int(ud->settings, "PtoPType") == 0)
+ {
+ start = ghb_settings_get_int(ud->settings, "start_point");
+ end = ghb_settings_get_int(ud->settings, "end_point");
+ if (start > end)
+ ghb_ui_update(ud, "start_point", ghb_int_value(end));
+ ghb_check_dependency(ud, widget, NULL);
+ if (ghb_settings_get_boolean(ud->settings, "chapters_in_destination"))
+ {
+ set_destination(ud);
+ }
+ widget = GHB_WIDGET (ud->builder, "ChapterMarkers");
+ // Start may have been changed above, get it again
+ start = ghb_settings_get_int(ud->settings, "start_point");
+ if (start == end)
+ {
+ gtk_widget_set_sensitive(widget, FALSE);
+ }
+ else
+ {
+ gtk_widget_set_sensitive(widget, TRUE);
+ }
+ update_title_duration(ud);
+ }
+ else if (ghb_settings_combo_int(ud->settings, "PtoPType") == 1)
+ {
+ start = ghb_settings_get_int(ud->settings, "start_point");
+ end = ghb_settings_get_int(ud->settings, "end_point");
+ if (start >= end)
+ ghb_ui_update(ud, "start_point", ghb_int_value(end-1));
+ ghb_check_dependency(ud, widget, NULL);
+ update_title_duration(ud);
+ }
+ else if (ghb_settings_combo_int(ud->settings, "PtoPType") == 2)
+ {
+ start = ghb_settings_get_int(ud->settings, "start_point");
+ end = ghb_settings_get_int(ud->settings, "end_point");
+ if (start > end)
+ ghb_ui_update(ud, "start_point", ghb_int_value(end));
+ ghb_check_dependency(ud, widget, NULL);
+ update_title_duration(ud);
+ }
}
G_MODULE_EXPORT void
scale_width_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
{
- g_debug("scale_width_changed_cb ()");
- ghb_widget_to_setting(ud->settings, widget);
- ghb_check_dependency(ud, widget, NULL);
- ghb_clear_presets_selection(ud);
- if (gtk_widget_is_sensitive(widget))
- ghb_set_scale (ud, GHB_PIC_KEEP_WIDTH);
- update_preview = TRUE;
- gchar *text;
- gint width = ghb_settings_get_int(ud->settings, "scale_width");
- gint height = ghb_settings_get_int(ud->settings, "scale_height");
- widget = GHB_WIDGET (ud->builder, "scale_dimensions");
- text = g_strdup_printf ("%d x %d", width, height);
- gtk_label_set_text (GTK_LABEL(widget), text);
- g_free(text);
- ghb_live_reset(ud);
+ g_debug("scale_width_changed_cb ()");
+ ghb_widget_to_setting(ud->settings, widget);
+ ghb_check_dependency(ud, widget, NULL);
+ ghb_clear_presets_selection(ud);
+ if (gtk_widget_is_sensitive(widget))
+ ghb_set_scale (ud, GHB_PIC_KEEP_WIDTH);
+ update_preview = TRUE;
+ gchar *text;
+ gint width = ghb_settings_get_int(ud->settings, "scale_width");
+ gint height = ghb_settings_get_int(ud->settings, "scale_height");
+ widget = GHB_WIDGET (ud->builder, "scale_dimensions");
+ text = g_strdup_printf ("%d x %d", width, height);
+ gtk_label_set_text (GTK_LABEL(widget), text);
+ g_free(text);
+ ghb_live_reset(ud);
}
G_MODULE_EXPORT void
scale_height_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
{
- g_debug("scale_height_changed_cb ()");
- ghb_widget_to_setting(ud->settings, widget);
- ghb_check_dependency(ud, widget, NULL);
- ghb_clear_presets_selection(ud);
- if (gtk_widget_is_sensitive(widget))
- ghb_set_scale (ud, GHB_PIC_KEEP_HEIGHT);
- update_preview = TRUE;
- gchar *text;
- gint width = ghb_settings_get_int(ud->settings, "scale_width");
- gint height = ghb_settings_get_int(ud->settings, "scale_height");
- widget = GHB_WIDGET (ud->builder, "scale_dimensions");
- text = g_strdup_printf ("%d x %d", width, height);
- gtk_label_set_text (GTK_LABEL(widget), text);
- g_free(text);
- ghb_live_reset(ud);
+ g_debug("scale_height_changed_cb ()");
+ ghb_widget_to_setting(ud->settings, widget);
+ ghb_check_dependency(ud, widget, NULL);
+ ghb_clear_presets_selection(ud);
+ if (gtk_widget_is_sensitive(widget))
+ ghb_set_scale (ud, GHB_PIC_KEEP_HEIGHT);
+ update_preview = TRUE;
+ gchar *text;
+ gint width = ghb_settings_get_int(ud->settings, "scale_width");
+ gint height = ghb_settings_get_int(ud->settings, "scale_height");
+ widget = GHB_WIDGET (ud->builder, "scale_dimensions");
+ text = g_strdup_printf ("%d x %d", width, height);
+ gtk_label_set_text (GTK_LABEL(widget), text);
+ g_free(text);
+ ghb_live_reset(ud);
}
G_MODULE_EXPORT void
crop_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
{
- gint titleindex, crop[4];
-
- g_debug("crop_changed_cb ()");
- ghb_widget_to_setting(ud->settings, widget);
- ghb_check_dependency(ud, widget, NULL);
- ghb_clear_presets_selection(ud);
- if (gtk_widget_is_sensitive(widget))
- ghb_set_scale (ud, 0);
-
- crop[0] = ghb_settings_get_int(ud->settings, "PictureTopCrop");
- crop[1] = ghb_settings_get_int(ud->settings, "PictureBottomCrop");
- crop[2] = ghb_settings_get_int(ud->settings, "PictureLeftCrop");
- crop[3] = ghb_settings_get_int(ud->settings, "PictureRightCrop");
- titleindex = ghb_settings_combo_int(ud->settings, "title");
- hb_title_t * title = ghb_get_title_info(titleindex);
- if (title != NULL)
- {
- gint width, height;
- gchar *text;
-
- width = title->width - crop[2] - crop[3];
- height = title->height - crop[0] - crop[1];
- widget = GHB_WIDGET (ud->builder, "crop_dimensions");
- text = g_strdup_printf ("%d x %d", width, height);
- gtk_label_set_text (GTK_LABEL(widget), text);
- widget = GHB_WIDGET (ud->builder, "crop_dimensions2");
- gtk_label_set_text (GTK_LABEL(widget), text);
- g_free(text);
- }
- gchar *text;
- widget = GHB_WIDGET (ud->builder, "crop_values");
- text = g_strdup_printf ("%d:%d:%d:%d", crop[0], crop[1], crop[2], crop[3]);
- gtk_label_set_text (GTK_LABEL(widget), text);
- g_free(text);
- update_preview = TRUE;
- ghb_live_reset(ud);
+ gint titleindex, crop[4];
+
+ g_debug("crop_changed_cb ()");
+ ghb_widget_to_setting(ud->settings, widget);
+ ghb_check_dependency(ud, widget, NULL);
+ ghb_clear_presets_selection(ud);
+ if (gtk_widget_is_sensitive(widget))
+ ghb_set_scale (ud, 0);
+
+ crop[0] = ghb_settings_get_int(ud->settings, "PictureTopCrop");
+ crop[1] = ghb_settings_get_int(ud->settings, "PictureBottomCrop");
+ crop[2] = ghb_settings_get_int(ud->settings, "PictureLeftCrop");
+ crop[3] = ghb_settings_get_int(ud->settings, "PictureRightCrop");
+ titleindex = ghb_settings_combo_int(ud->settings, "title");
+ hb_title_t * title = ghb_get_title_info(titleindex);
+ if (title != NULL)
+ {
+ gint width, height;
+ gchar *text;
+
+ width = title->width - crop[2] - crop[3];
+ height = title->height - crop[0] - crop[1];
+ widget = GHB_WIDGET (ud->builder, "crop_dimensions");
+ text = g_strdup_printf ("%d x %d", width, height);
+ gtk_label_set_text (GTK_LABEL(widget), text);
+ widget = GHB_WIDGET (ud->builder, "crop_dimensions2");
+ gtk_label_set_text (GTK_LABEL(widget), text);
+ g_free(text);
+ }
+ gchar *text;
+ widget = GHB_WIDGET (ud->builder, "crop_values");
+ text = g_strdup_printf ("%d:%d:%d:%d", crop[0], crop[1], crop[2], crop[3]);
+ gtk_label_set_text (GTK_LABEL(widget), text);
+ g_free(text);
+ update_preview = TRUE;
+ ghb_live_reset(ud);
}
G_MODULE_EXPORT void
display_width_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
{
- g_debug("display_width_changed_cb ()");
- ghb_widget_to_setting(ud->settings, widget);
- ghb_check_dependency(ud, widget, NULL);
- ghb_clear_presets_selection(ud);
- ghb_live_reset(ud);
- if (gtk_widget_is_sensitive(widget))
- ghb_set_scale (ud, GHB_PIC_KEEP_DISPLAY_WIDTH);
+ g_debug("display_width_changed_cb ()");
+ ghb_widget_to_setting(ud->settings, widget);
+ ghb_check_dependency(ud, widget, NULL);
+ ghb_clear_presets_selection(ud);
+ ghb_live_reset(ud);
+ if (gtk_widget_is_sensitive(widget))
+ ghb_set_scale (ud, GHB_PIC_KEEP_DISPLAY_WIDTH);
- update_preview = TRUE;
+ update_preview = TRUE;
}
G_MODULE_EXPORT void
display_height_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
{
- g_debug("display_height_changed_cb ()");
- ghb_widget_to_setting(ud->settings, widget);
- ghb_check_dependency(ud, widget, NULL);
- ghb_clear_presets_selection(ud);
- ghb_live_reset(ud);
- if (gtk_widget_is_sensitive(widget))
- ghb_set_scale (ud, GHB_PIC_KEEP_DISPLAY_HEIGHT);
+ g_debug("display_height_changed_cb ()");
+ ghb_widget_to_setting(ud->settings, widget);
+ ghb_check_dependency(ud, widget, NULL);
+ ghb_clear_presets_selection(ud);
+ ghb_live_reset(ud);
+ if (gtk_widget_is_sensitive(widget))
+ ghb_set_scale (ud, GHB_PIC_KEEP_DISPLAY_HEIGHT);
- update_preview = TRUE;
+ update_preview = TRUE;
}
G_MODULE_EXPORT void
par_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
{
- g_debug("par_changed_cb ()");
- ghb_widget_to_setting(ud->settings, widget);
- ghb_check_dependency(ud, widget, NULL);
- ghb_clear_presets_selection(ud);
- ghb_live_reset(ud);
- if (gtk_widget_is_sensitive(widget))
- ghb_set_scale (ud, GHB_PIC_KEEP_PAR);
+ g_debug("par_changed_cb ()");
+ ghb_widget_to_setting(ud->settings, widget);
+ ghb_check_dependency(ud, widget, NULL);
+ ghb_clear_presets_selection(ud);
+ ghb_live_reset(ud);
+ if (gtk_widget_is_sensitive(widget))
+ ghb_set_scale (ud, GHB_PIC_KEEP_PAR);
- update_preview = TRUE;
+ update_preview = TRUE;
}
G_MODULE_EXPORT void
scale_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
{
- g_debug("scale_changed_cb ()");
- ghb_widget_to_setting(ud->settings, widget);
- ghb_check_dependency(ud, widget, NULL);
- ghb_clear_presets_selection(ud);
- ghb_live_reset(ud);
- if (gtk_widget_is_sensitive(widget))
- ghb_set_scale (ud, 0);
- update_preview = TRUE;
-
- gchar *text;
-
- text = ghb_settings_get_boolean(ud->settings, "PictureAutoCrop") ? "On" : "Off";
- widget = GHB_WIDGET (ud->builder, "crop_auto");
- gtk_label_set_text (GTK_LABEL(widget), text);
- text = ghb_settings_get_boolean(ud->settings, "autoscale") ? "On" : "Off";
- widget = GHB_WIDGET (ud->builder, "scale_auto");
- gtk_label_set_text (GTK_LABEL(widget), text);
- switch (ghb_settings_combo_int(ud->settings, "PicturePAR"))
- {
- case 0:
- text = "Off";
- break;
- case 1:
- text = "Strict";
- break;
- case 2:
- text = "Loose";
- break;
- case 3:
- text = "Custom";
- break;
- default:
- text = "Unknown";
- break;
- }
- widget = GHB_WIDGET (ud->builder, "scale_anamorphic");
- gtk_label_set_text (GTK_LABEL(widget), text);
+ g_debug("scale_changed_cb ()");
+ ghb_widget_to_setting(ud->settings, widget);
+ ghb_check_dependency(ud, widget, NULL);
+ ghb_clear_presets_selection(ud);
+ ghb_live_reset(ud);
+ if (gtk_widget_is_sensitive(widget))
+ ghb_set_scale (ud, 0);
+ update_preview = TRUE;
+
+ gchar *text;
+
+ text = ghb_settings_get_boolean(ud->settings, "PictureAutoCrop") ? "On" : "Off";
+ widget = GHB_WIDGET (ud->builder, "crop_auto");
+ gtk_label_set_text (GTK_LABEL(widget), text);
+ text = ghb_settings_get_boolean(ud->settings, "autoscale") ? "On" : "Off";
+ widget = GHB_WIDGET (ud->builder, "scale_auto");
+ gtk_label_set_text (GTK_LABEL(widget), text);
+ switch (ghb_settings_combo_int(ud->settings, "PicturePAR"))
+ {
+ case 0:
+ text = "Off";
+ break;
+ case 1:
+ text = "Strict";
+ break;
+ case 2:
+ text = "Loose";
+ break;
+ case 3:
+ text = "Custom";
+ break;
+ default:
+ text = "Unknown";
+ break;
+ }
+ widget = GHB_WIDGET (ud->builder, "scale_anamorphic");
+ gtk_label_set_text (GTK_LABEL(widget), text);
}
G_MODULE_EXPORT void
show_crop_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
{
- g_debug("show_crop_changed_cb ()");
- ghb_widget_to_setting(ud->settings, widget);
- ghb_check_dependency(ud, widget, NULL);
- ghb_live_reset(ud);
- if (gtk_widget_is_sensitive(widget))
- ghb_set_scale (ud, 0);
- update_preview = TRUE;
+ g_debug("show_crop_changed_cb ()");
+ ghb_widget_to_setting(ud->settings, widget);
+ ghb_check_dependency(ud, widget, NULL);
+ ghb_live_reset(ud);
+ if (gtk_widget_is_sensitive(widget))
+ ghb_set_scale (ud, 0);
+ update_preview = TRUE;
}
G_MODULE_EXPORT void
generic_entry_changed_cb(GtkEntry *entry, signal_user_data_t *ud)
{
- // Normally (due to user input) I only want to process the entry
- // when editing is done and the focus-out signal is sent.
- // But... there's always a but.
- // If the entry is changed by software, the focus-out signal is not sent.
- // The changed signal is sent ... so here we are.
- // I don't want to process upon every keystroke, so I prevent processing
- // while the widget has focus.
- g_debug("generic_entry_changed_cb ()");
- if (!gtk_widget_has_focus((GtkWidget*)entry))
- {
- ghb_widget_to_setting(ud->settings, (GtkWidget*)entry);
- }
+ // Normally (due to user input) I only want to process the entry
+ // when editing is done and the focus-out signal is sent.
+ // But... there's always a but.
+ // If the entry is changed by software, the focus-out signal is not sent.
+ // The changed signal is sent ... so here we are.
+ // I don't want to process upon every keystroke, so I prevent processing
+ // while the widget has focus.
+ g_debug("generic_entry_changed_cb ()");
+ if (!gtk_widget_has_focus((GtkWidget*)entry))
+ {
+ ghb_widget_to_setting(ud->settings, (GtkWidget*)entry);
+ }
}
G_MODULE_EXPORT void
prefs_dialog_cb(GtkWidget *xwidget, signal_user_data_t *ud)
{
- GtkWidget *dialog;
+ GtkWidget *dialog;
- g_debug("prefs_dialog_cb ()");
- dialog = GHB_WIDGET(ud->builder, "prefs_dialog");
- gtk_dialog_run(GTK_DIALOG(dialog));
- gtk_widget_hide(dialog);
+ g_debug("prefs_dialog_cb ()");
+ dialog = GHB_WIDGET(ud->builder, "prefs_dialog");
+ gtk_dialog_run(GTK_DIALOG(dialog));
+ gtk_widget_hide(dialog);
}
typedef struct
{
- GtkMessageDialog *dlg;
- const gchar *msg;
- const gchar *action;
- gint timeout;
- signal_user_data_t *ud;
+ GtkMessageDialog *dlg;
+ const gchar *msg;
+ const gchar *action;
+ gint timeout;
+ signal_user_data_t *ud;
} countdown_t;
static gboolean
quit_cb(countdown_t *cd)
{
- gchar *str;
+ gchar *str;
- cd->timeout--;
- if (cd->timeout == 0)
- {
- ghb_hb_cleanup(FALSE);
- prune_logs(cd->ud);
+ cd->timeout--;
+ if (cd->timeout == 0)
+ {
+ ghb_hb_cleanup(FALSE);
+ prune_logs(cd->ud);
- gtk_widget_destroy (GTK_WIDGET(cd->dlg));
- gtk_main_quit();
- return FALSE;
- }
- str = g_strdup_printf("%s\n\n%s in %d seconds ...",
- cd->msg, cd->action, cd->timeout);
- gtk_message_dialog_set_markup(cd->dlg, str);
- g_free(str);
- return TRUE;
+ gtk_widget_destroy (GTK_WIDGET(cd->dlg));
+ gtk_main_quit();
+ return FALSE;
+ }
+ str = g_strdup_printf("%s\n\n%s in %d seconds ...",
+ cd->msg, cd->action, cd->timeout);
+ gtk_message_dialog_set_markup(cd->dlg, str);
+ g_free(str);
+ return TRUE;
}
static gboolean
shutdown_cb(countdown_t *cd)
{
- gchar *str;
+ gchar *str;
- cd->timeout--;
- if (cd->timeout == 0)
- {
- ghb_hb_cleanup(FALSE);
- prune_logs(cd->ud);
+ cd->timeout--;
+ if (cd->timeout == 0)
+ {
+ ghb_hb_cleanup(FALSE);
+ prune_logs(cd->ud);
- ghb_shutdown_gsm();
- gtk_main_quit();
- return FALSE;
- }
- str = g_strdup_printf("%s\n\n%s in %d seconds ...",
- cd->msg, cd->action, cd->timeout);
- gtk_message_dialog_set_markup(cd->dlg, str);
- g_free(str);
- return TRUE;
+ ghb_shutdown_gsm();
+ gtk_main_quit();
+ return FALSE;
+ }
+ str = g_strdup_printf("%s\n\n%s in %d seconds ...",
+ cd->msg, cd->action, cd->timeout);
+ gtk_message_dialog_set_markup(cd->dlg, str);
+ g_free(str);
+ return TRUE;
}
static gboolean
suspend_cb(countdown_t *cd)
{
- gchar *str;
+ gchar *str;
- cd->timeout--;
- if (cd->timeout == 0)
- {
- gtk_widget_destroy (GTK_WIDGET(cd->dlg));
- ghb_suspend_gpm();
- return FALSE;
- }
- str = g_strdup_printf("%s\n\n%s in %d seconds ...",
- cd->msg, cd->action, cd->timeout);
- gtk_message_dialog_set_markup(cd->dlg, str);
- g_free(str);
- return TRUE;
+ cd->timeout--;
+ if (cd->timeout == 0)
+ {
+ gtk_widget_destroy (GTK_WIDGET(cd->dlg));
+ ghb_suspend_gpm();
+ return FALSE;
+ }
+ str = g_strdup_printf("%s\n\n%s in %d seconds ...",
+ cd->msg, cd->action, cd->timeout);
+ gtk_message_dialog_set_markup(cd->dlg, str);
+ g_free(str);
+ return TRUE;
}
void
ghb_countdown_dialog(
- GtkMessageType type,
- const gchar *message,
- const gchar *action,
- const gchar *cancel,
- GSourceFunc action_func,
- signal_user_data_t *ud,
- gint timeout)
-{
- GtkWidget *dialog;
- GtkResponseType response;
- guint timeout_id;
- countdown_t cd;
-
- cd.msg = message;
- cd.action = action;
- cd.timeout = timeout;
- cd.ud = ud;
-
- // Toss up a warning dialog
- dialog = gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL,
- type, GTK_BUTTONS_NONE,
- "%s\n\n%s in %d seconds ...",
- message, action, timeout);
- gtk_dialog_add_buttons( GTK_DIALOG(dialog),
- cancel, GTK_RESPONSE_CANCEL,
- NULL);
-
- cd.dlg = GTK_MESSAGE_DIALOG(dialog);
- timeout_id = g_timeout_add(1000, action_func, &cd);
- response = gtk_dialog_run(GTK_DIALOG(dialog));
- gtk_widget_destroy (dialog);
- if (response == GTK_RESPONSE_CANCEL)
- {
- GMainContext *mc;
- GSource *source;
-
- mc = g_main_context_default();
- source = g_main_context_find_source_by_id(mc, timeout_id);
- if (source != NULL)
- g_source_destroy(source);
- }
+ GtkMessageType type,
+ const gchar *message,
+ const gchar *action,
+ const gchar *cancel,
+ GSourceFunc action_func,
+ signal_user_data_t *ud,
+ gint timeout)
+{
+ GtkWidget *dialog;
+ GtkResponseType response;
+ guint timeout_id;
+ countdown_t cd;
+
+ cd.msg = message;
+ cd.action = action;
+ cd.timeout = timeout;
+ cd.ud = ud;
+
+ // Toss up a warning dialog
+ dialog = gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL,
+ type, GTK_BUTTONS_NONE,
+ "%s\n\n%s in %d seconds ...",
+ message, action, timeout);
+ gtk_dialog_add_buttons( GTK_DIALOG(dialog),
+ cancel, GTK_RESPONSE_CANCEL,
+ NULL);
+
+ cd.dlg = GTK_MESSAGE_DIALOG(dialog);
+ timeout_id = g_timeout_add(1000, action_func, &cd);
+ response = gtk_dialog_run(GTK_DIALOG(dialog));
+ gtk_widget_destroy (dialog);
+ if (response == GTK_RESPONSE_CANCEL)
+ {
+ GMainContext *mc;
+ GSource *source;
+
+ mc = g_main_context_default();
+ source = g_main_context_find_source_by_id(mc, timeout_id);
+ if (source != NULL)
+ g_source_destroy(source);
+ }
}
gboolean
ghb_message_dialog(GtkMessageType type, const gchar *message, const gchar *no, const gchar *yes)
{
- GtkWidget *dialog;
- GtkResponseType response;
-
- // Toss up a warning dialog
- dialog = gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL,
- type, GTK_BUTTONS_NONE,
- "%s", message);
- gtk_dialog_add_buttons( GTK_DIALOG(dialog),
- no, GTK_RESPONSE_NO,
- yes, GTK_RESPONSE_YES, NULL);
- response = gtk_dialog_run(GTK_DIALOG(dialog));
- gtk_widget_destroy (dialog);
- if (response == GTK_RESPONSE_NO)
- {
- return FALSE;
- }
- return TRUE;
+ GtkWidget *dialog;
+ GtkResponseType response;
+
+ // Toss up a warning dialog
+ dialog = gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL,
+ type, GTK_BUTTONS_NONE,
+ "%s", message);
+ gtk_dialog_add_buttons( GTK_DIALOG(dialog),
+ no, GTK_RESPONSE_NO,
+ yes, GTK_RESPONSE_YES, NULL);
+ response = gtk_dialog_run(GTK_DIALOG(dialog));
+ gtk_widget_destroy (dialog);
+ if (response == GTK_RESPONSE_NO)
+ {
+ return FALSE;
+ }
+ return TRUE;
}
void
ghb_error_dialog(GtkMessageType type, const gchar *message, const gchar *cancel)
{
- GtkWidget *dialog;
+ GtkWidget *dialog;
- // Toss up a warning dialog
- dialog = gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL,
- type, GTK_BUTTONS_NONE,
- "%s", message);
- gtk_dialog_add_buttons( GTK_DIALOG(dialog),
- cancel, GTK_RESPONSE_CANCEL, NULL);
- gtk_dialog_run(GTK_DIALOG(dialog));
- gtk_widget_destroy (dialog);
+ // Toss up a warning dialog
+ dialog = gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL,
+ type, GTK_BUTTONS_NONE,
+ "%s", message);
+ gtk_dialog_add_buttons( GTK_DIALOG(dialog),
+ cancel, GTK_RESPONSE_CANCEL, NULL);
+ gtk_dialog_run(GTK_DIALOG(dialog));
+ gtk_widget_destroy (dialog);
}
void
ghb_cancel_encode(signal_user_data_t *ud, const gchar *extra_msg)
{
- GtkWidget *dialog;
- GtkResponseType response;
-
- if (extra_msg == NULL) extra_msg = "";
- // Toss up a warning dialog
- dialog = gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL,
- GTK_MESSAGE_WARNING, GTK_BUTTONS_NONE,
- "%sYour movie will be lost if you don't continue encoding.",
- extra_msg);
- gtk_dialog_add_buttons( GTK_DIALOG(dialog),
- "Cancel Current and Stop", 1,
- "Cancel Current, Start Next", 2,
- "Finish Current, then Stop", 3,
- "Continue Encoding", 4,
- NULL);
- response = gtk_dialog_run(GTK_DIALOG(dialog));
- gtk_widget_destroy (dialog);
- switch ((int)response)
- {
- case 1:
- ghb_stop_queue();
- ud->cancel_encode = GHB_CANCEL_ALL;
- break;
- case 2:
- ghb_stop_queue();
- ud->cancel_encode = GHB_CANCEL_CURRENT;
- break;
- case 3:
- ud->cancel_encode = GHB_CANCEL_FINISH;
- break;
- case 4:
- default:
- ud->cancel_encode = GHB_CANCEL_NONE;
- break;
- }
+ GtkWidget *dialog;
+ GtkResponseType response;
+
+ if (extra_msg == NULL) extra_msg = "";
+ // Toss up a warning dialog
+ dialog = gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL,
+ GTK_MESSAGE_WARNING, GTK_BUTTONS_NONE,
+ "%sYour movie will be lost if you don't continue encoding.",
+ extra_msg);
+ gtk_dialog_add_buttons( GTK_DIALOG(dialog),
+ "Cancel Current and Stop", 1,
+ "Cancel Current, Start Next", 2,
+ "Finish Current, then Stop", 3,
+ "Continue Encoding", 4,
+ NULL);
+ response = gtk_dialog_run(GTK_DIALOG(dialog));
+ gtk_widget_destroy (dialog);
+ switch ((int)response)
+ {
+ case 1:
+ ghb_stop_queue();
+ ud->cancel_encode = GHB_CANCEL_ALL;
+ break;
+ case 2:
+ ghb_stop_queue();
+ ud->cancel_encode = GHB_CANCEL_CURRENT;
+ break;
+ case 3:
+ ud->cancel_encode = GHB_CANCEL_FINISH;
+ break;
+ case 4:
+ default:
+ ud->cancel_encode = GHB_CANCEL_NONE;
+ break;
+ }
}
gboolean
ghb_cancel_encode2(signal_user_data_t *ud, const gchar *extra_msg)
{
- GtkWidget *dialog;
- GtkResponseType response;
-
- if (extra_msg == NULL) extra_msg = "";
- // Toss up a warning dialog
- dialog = gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL,
- GTK_MESSAGE_WARNING, GTK_BUTTONS_NONE,
- "%sYour movie will be lost if you don't continue encoding.",
- extra_msg);
- gtk_dialog_add_buttons( GTK_DIALOG(dialog),
- "Cancel Current and Stop", 1,
- "Continue Encoding", 4,
- NULL);
- response = gtk_dialog_run(GTK_DIALOG(dialog));
- gtk_widget_destroy (dialog);
- switch ((int)response)
- {
- case 1:
- ghb_stop_queue();
- ud->cancel_encode = GHB_CANCEL_ALL;
- return TRUE;
- case 4:
- default:
- break;
- }
- return FALSE;
+ GtkWidget *dialog;
+ GtkResponseType response;
+
+ if (extra_msg == NULL) extra_msg = "";
+ // Toss up a warning dialog
+ dialog = gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL,
+ GTK_MESSAGE_WARNING, GTK_BUTTONS_NONE,
+ "%sYour movie will be lost if you don't continue encoding.",
+ extra_msg);
+ gtk_dialog_add_buttons( GTK_DIALOG(dialog),
+ "Cancel Current and Stop", 1,
+ "Continue Encoding", 4,
+ NULL);
+ response = gtk_dialog_run(GTK_DIALOG(dialog));
+ gtk_widget_destroy (dialog);
+ switch ((int)response)
+ {
+ case 1:
+ ghb_stop_queue();
+ ud->cancel_encode = GHB_CANCEL_ALL;
+ return TRUE;
+ case 4:
+ default:
+ break;
+ }
+ return FALSE;
}
static void
submit_job(GValue *settings)
{
- static gint unique_id = 1;
- gchar *type, *modified, *preset;
- const GValue *path;
- gboolean preset_modified;
+ static gint unique_id = 1;
+ gchar *type, *modified, *preset;
+ const GValue *path;
+ gboolean preset_modified;
- g_debug("submit_job");
- if (settings == NULL) return;
- preset_modified = ghb_settings_get_boolean(settings, "preset_modified");
- path = ghb_settings_get_value(settings, "preset");
- preset = ghb_preset_path_string(path);
- type = ghb_preset_is_custom() ? "Custom " : "";
- modified = preset_modified ? "Modified " : "";
- ghb_log("%s%sPreset: %s", modified, type, preset);
- g_free(preset);
+ g_debug("submit_job");
+ if (settings == NULL) return;
+ preset_modified = ghb_settings_get_boolean(settings, "preset_modified");
+ path = ghb_settings_get_value(settings, "preset");
+ preset = ghb_preset_path_string(path);
+ type = ghb_preset_is_custom() ? "Custom " : "";
+ modified = preset_modified ? "Modified " : "";
+ ghb_log("%s%sPreset: %s", modified, type, preset);
+ g_free(preset);
- ghb_settings_set_int(settings, "job_unique_id", unique_id);
- ghb_settings_set_int(settings, "job_status", GHB_QUEUE_RUNNING);
- ghb_add_job (settings, unique_id);
- ghb_start_queue();
- unique_id++;
+ ghb_settings_set_int(settings, "job_unique_id", unique_id);
+ ghb_settings_set_int(settings, "job_status", GHB_QUEUE_RUNNING);
+ ghb_add_job (settings, unique_id);
+ ghb_start_queue();
+ unique_id++;
}
static void
prune_logs(signal_user_data_t *ud)
{
- gchar *dest_dir;
- gint days;
-
- // Only prune logs stored in the default config dir location
- days = ghb_settings_combo_int(ud->settings, "LogLongevity");
- if (days > 365)
- return;
-
- dest_dir = ghb_get_user_config_dir("EncodeLogs");
- if (g_file_test(dest_dir, G_FILE_TEST_IS_DIR))
- {
- const gchar *file;
- gint duration = days * 24 * 60 * 60;
-
- GDir *gdir = g_dir_open(dest_dir, 0, NULL);
- time_t now;
-
- now = time(NULL);
- file = g_dir_read_name(gdir);
- while (file)
- {
- gchar *path;
- struct stat stbuf;
-
- path = g_strdup_printf("%s/%s", dest_dir, file);
- g_stat(path, &stbuf);
- if (now - stbuf.st_mtime > duration)
- {
- g_unlink(path);
- }
- g_free(path);
- file = g_dir_read_name(gdir);
- }
- g_dir_close(gdir);
- }
- g_free(dest_dir);
- ghb_preview_cleanup(ud);
+ gchar *dest_dir;
+ gint days;
+
+ // Only prune logs stored in the default config dir location
+ days = ghb_settings_combo_int(ud->settings, "LogLongevity");
+ if (days > 365)
+ return;
+
+ dest_dir = ghb_get_user_config_dir("EncodeLogs");
+ if (g_file_test(dest_dir, G_FILE_TEST_IS_DIR))
+ {
+ const gchar *file;
+ gint duration = days * 24 * 60 * 60;
+
+ GDir *gdir = g_dir_open(dest_dir, 0, NULL);
+ time_t now;
+
+ now = time(NULL);
+ file = g_dir_read_name(gdir);
+ while (file)
+ {
+ gchar *path;
+ struct stat stbuf;
+
+ path = g_strdup_printf("%s/%s", dest_dir, file);
+ g_stat(path, &stbuf);
+ if (now - stbuf.st_mtime > duration)
+ {
+ g_unlink(path);
+ }
+ g_free(path);
+ file = g_dir_read_name(gdir);
+ }
+ g_dir_close(gdir);
+ }
+ g_free(dest_dir);
+ ghb_preview_cleanup(ud);
}
static void
queue_scan(signal_user_data_t *ud, GValue *js)
{
- gchar *path;
- gint titlenum;
- time_t _now;
- struct tm *now;
- gchar *log_path, *pos, *destname, *basename, *dest_dir;
-
- _now = time(NULL);
- now = localtime(&_now);
- destname = ghb_settings_get_string(js, "destination");
- basename = g_path_get_basename(destname);
- if (ghb_settings_get_boolean(ud->settings, "EncodeLogLocation"))
- {
- dest_dir = g_path_get_dirname (destname);
- }
- else
- {
- dest_dir = ghb_get_user_config_dir("EncodeLogs");
- }
- g_free(destname);
- pos = g_strrstr( basename, "." );
- if (pos != NULL)
- {
- *pos = 0;
- }
- log_path = g_strdup_printf("%s/%s %d-%02d-%02d %02d-%02d-%02d.log",
- dest_dir,
- basename,
- now->tm_year + 1900, now->tm_mon + 1, now->tm_mday,
- now->tm_hour, now->tm_min, now->tm_sec);
- g_free(basename);
- g_free(dest_dir);
- if (ud->job_activity_log)
- g_io_channel_unref(ud->job_activity_log);
- ud->job_activity_log = g_io_channel_new_file (log_path, "w", NULL);
- if (ud->job_activity_log)
- {
- gchar *ver_str;
-
- ver_str = g_strdup_printf("Handbrake Version: %s (%d)\n",
- hb_get_version(NULL), hb_get_build(NULL));
- g_io_channel_write_chars (ud->job_activity_log, ver_str,
- -1, NULL, NULL);
- g_free(ver_str);
- }
- g_free(log_path);
-
- path = ghb_settings_get_string( js, "source");
- titlenum = ghb_settings_get_int(js, "titlenum");
- ghb_backend_queue_scan(path, titlenum);
- g_free(path);
+ gchar *path;
+ gint titlenum;
+ time_t _now;
+ struct tm *now;
+ gchar *log_path, *pos, *destname, *basename, *dest_dir;
+
+ _now = time(NULL);
+ now = localtime(&_now);
+ destname = ghb_settings_get_string(js, "destination");
+ basename = g_path_get_basename(destname);
+ if (ghb_settings_get_boolean(ud->settings, "EncodeLogLocation"))
+ {
+ dest_dir = g_path_get_dirname (destname);
+ }
+ else
+ {
+ dest_dir = ghb_get_user_config_dir("EncodeLogs");
+ }
+ g_free(destname);
+ pos = g_strrstr( basename, "." );
+ if (pos != NULL)
+ {
+ *pos = 0;
+ }
+ log_path = g_strdup_printf("%s/%s %d-%02d-%02d %02d-%02d-%02d.log",
+ dest_dir,
+ basename,
+ now->tm_year + 1900, now->tm_mon + 1, now->tm_mday,
+ now->tm_hour, now->tm_min, now->tm_sec);
+ g_free(basename);
+ g_free(dest_dir);
+ if (ud->job_activity_log)
+ g_io_channel_unref(ud->job_activity_log);
+ ud->job_activity_log = g_io_channel_new_file (log_path, "w", NULL);
+ if (ud->job_activity_log)
+ {
+ gchar *ver_str;
+
+ ver_str = g_strdup_printf("Handbrake Version: %s (%d)\n",
+ hb_get_version(NULL), hb_get_build(NULL));
+ g_io_channel_write_chars (ud->job_activity_log, ver_str,
+ -1, NULL, NULL);
+ g_free(ver_str);
+ }
+ g_free(log_path);
+
+ path = ghb_settings_get_string( js, "source");
+ titlenum = ghb_settings_get_int(js, "titlenum");
+ ghb_backend_queue_scan(path, titlenum);
+ g_free(path);
}
static gint
queue_pending_count(GValue *queue)
{
- gint nn, ii, count;
- GValue *js;
- gint status;
+ gint nn, ii, count;
+ GValue *js;
+ gint status;
- nn = 0;
- count = ghb_array_len(queue);
- for (ii = 0; ii < count; ii++)
- {
+ nn = 0;
+ count = ghb_array_len(queue);
+ for (ii = 0; ii < count; ii++)
+ {
- js = ghb_array_get_nth(queue, ii);
- status = ghb_settings_get_int(js, "job_status");
- if (status == GHB_QUEUE_PENDING)
- {
- nn++;
- }
- }
- return nn;
+ js = ghb_array_get_nth(queue, ii);
+ status = ghb_settings_get_int(js, "job_status");
+ if (status == GHB_QUEUE_PENDING)
+ {
+ nn++;
+ }
+ }
+ return nn;
}
void
ghb_update_pending(signal_user_data_t *ud)
{
- GtkLabel *label;
- gint pending;
- gchar *str;
+ GtkLabel *label;
+ gint pending;
+ gchar *str;
- label = GTK_LABEL(GHB_WIDGET(ud->builder, "pending_status"));
- pending = queue_pending_count(ud->queue);
- str = g_strdup_printf("%d encode(s) pending", pending);
- gtk_label_set_text(label, str);
- g_free(str);
+ label = GTK_LABEL(GHB_WIDGET(ud->builder, "pending_status"));
+ pending = queue_pending_count(ud->queue);
+ str = g_strdup_printf("%d encode(s) pending", pending);
+ gtk_label_set_text(label, str);
+ g_free(str);
}
GValue*
ghb_start_next_job(signal_user_data_t *ud, gboolean find_first)
{
- static gint current = 0;
- gint count, ii, jj;
- GValue *js;
- gint status;
- GtkWidget *prog;
-
- g_debug("start_next_job");
- prog = GHB_WIDGET(ud->builder, "progressbar");
- gtk_widget_show(prog);
-
- count = ghb_array_len(ud->queue);
- if (find_first)
- { // Start the first pending item in the queue
- current = 0;
- for (ii = 0; ii < count; ii++)
- {
-
- js = ghb_array_get_nth(ud->queue, ii);
- status = ghb_settings_get_int(js, "job_status");
- if (status == GHB_QUEUE_PENDING)
- {
- current = ii;
- ghb_inhibit_gsm(ud);
- queue_scan(ud, js);
- ghb_update_pending(ud);
- return js;
- }
- }
- // Nothing pending
- ghb_uninhibit_gsm();
- ghb_notify_done(ud);
- return NULL;
- }
- // Find the next pending item after the current running item
- for (ii = 0; ii < count-1; ii++)
- {
- js = ghb_array_get_nth(ud->queue, ii);
- status = ghb_settings_get_int(js, "job_status");
- if (status == GHB_QUEUE_RUNNING)
- {
- for (jj = ii+1; jj < count; jj++)
- {
- js = ghb_array_get_nth(ud->queue, jj);
- status = ghb_settings_get_int(js, "job_status");
- if (status == GHB_QUEUE_PENDING)
- {
- current = jj;
- ghb_inhibit_gsm(ud);
- queue_scan(ud, js);
- ghb_update_pending(ud);
- return js;
- }
- }
- }
- }
- // No running item found? Maybe it was deleted
- // Look for a pending item starting from the last index we started
- for (ii = current; ii < count; ii++)
- {
- js = ghb_array_get_nth(ud->queue, ii);
- status = ghb_settings_get_int(js, "job_status");
- if (status == GHB_QUEUE_PENDING)
- {
- current = ii;
- ghb_inhibit_gsm(ud);
- queue_scan(ud, js);
- ghb_update_pending(ud);
- return js;
- }
- }
- // Nothing found
- ghb_uninhibit_gsm();
- ghb_notify_done(ud);
- ghb_update_pending(ud);
- gtk_widget_hide(prog);
- return NULL;
+ static gint current = 0;
+ gint count, ii, jj;
+ GValue *js;
+ gint status;
+ GtkWidget *prog;
+
+ g_debug("start_next_job");
+ prog = GHB_WIDGET(ud->builder, "progressbar");
+ gtk_widget_show(prog);
+
+ count = ghb_array_len(ud->queue);
+ if (find_first)
+ { // Start the first pending item in the queue
+ current = 0;
+ for (ii = 0; ii < count; ii++)
+ {
+
+ js = ghb_array_get_nth(ud->queue, ii);
+ status = ghb_settings_get_int(js, "job_status");
+ if (status == GHB_QUEUE_PENDING)
+ {
+ current = ii;
+ ghb_inhibit_gsm(ud);
+ queue_scan(ud, js);
+ ghb_update_pending(ud);
+ return js;
+ }
+ }
+ // Nothing pending
+ ghb_uninhibit_gsm();
+ ghb_notify_done(ud);
+ return NULL;
+ }
+ // Find the next pending item after the current running item
+ for (ii = 0; ii < count-1; ii++)
+ {
+ js = ghb_array_get_nth(ud->queue, ii);
+ status = ghb_settings_get_int(js, "job_status");
+ if (status == GHB_QUEUE_RUNNING)
+ {
+ for (jj = ii+1; jj < count; jj++)
+ {
+ js = ghb_array_get_nth(ud->queue, jj);
+ status = ghb_settings_get_int(js, "job_status");
+ if (status == GHB_QUEUE_PENDING)
+ {
+ current = jj;
+ ghb_inhibit_gsm(ud);
+ queue_scan(ud, js);
+ ghb_update_pending(ud);
+ return js;
+ }
+ }
+ }
+ }
+ // No running item found? Maybe it was deleted
+ // Look for a pending item starting from the last index we started
+ for (ii = current; ii < count; ii++)
+ {
+ js = ghb_array_get_nth(ud->queue, ii);
+ status = ghb_settings_get_int(js, "job_status");
+ if (status == GHB_QUEUE_PENDING)
+ {
+ current = ii;
+ ghb_inhibit_gsm(ud);
+ queue_scan(ud, js);
+ ghb_update_pending(ud);
+ return js;
+ }
+ }
+ // Nothing found
+ ghb_uninhibit_gsm();
+ ghb_notify_done(ud);
+ ghb_update_pending(ud);
+ gtk_widget_hide(prog);
+ return NULL;
}
static gint
find_queue_job(GValue *queue, gint unique_id, GValue **job)
{
- GValue *js;
- gint ii, count;
- gint job_unique_id;
-
- *job = NULL;
- g_debug("find_queue_job");
- if (unique_id == 0) // Invalid Id
- return -1;
-
- count = ghb_array_len(queue);
- for (ii = 0; ii < count; ii++)
- {
- js = ghb_array_get_nth(queue, ii);
- job_unique_id = ghb_settings_get_int(js, "job_unique_id");
- if (job_unique_id == unique_id)
- {
- *job = js;
- return ii;
- }
- }
- return -1;
+ GValue *js;
+ gint ii, count;
+ gint job_unique_id;
+
+ *job = NULL;
+ g_debug("find_queue_job");
+ if (unique_id == 0) // Invalid Id
+ return -1;
+
+ count = ghb_array_len(queue);
+ for (ii = 0; ii < count; ii++)
+ {
+ js = ghb_array_get_nth(queue, ii);
+ job_unique_id = ghb_settings_get_int(js, "job_unique_id");
+ if (job_unique_id == unique_id)
+ {
+ *job = js;
+ return ii;
+ }
+ }
+ return -1;
}
gchar*
working_status_string(signal_user_data_t *ud, ghb_instance_status_t *status)
{
- gchar *task_str, *job_str, *status_str;
- gint qcount;
- gint index;
- GValue *js;
- gboolean subtitle_scan = FALSE;
-
- qcount = ghb_array_len(ud->queue);
- index = find_queue_job(ud->queue, status->unique_id, &js);
- if (js != NULL)
- {
- subtitle_scan = ghb_settings_get_boolean(js, "subtitle_scan");
- }
- if (qcount > 1)
- {
- job_str = g_strdup_printf("job %d of %d, ", index+1, qcount);
- }
- else
- {
- job_str = g_strdup("");
- }
- if (status->job_count > 1)
- {
- if (status->job_cur == 1 && subtitle_scan)
- {
- task_str = g_strdup_printf("pass %d (subtitle scan) of %d, ",
- status->job_cur, status->job_count);
- }
- else
- {
- task_str = g_strdup_printf("pass %d of %d, ",
- status->job_cur, status->job_count);
- }
- }
- else
- {
- task_str = g_strdup("");
- }
- if(status->seconds > -1)
- {
- if (status->rate_cur > 0.0)
- {
- status_str= g_strdup_printf(
- "Encoding: %s%s%.2f %%"
- " (%.2f fps, avg %.2f fps, ETA %02dh%02dm%02ds)",
- job_str, task_str,
- 100.0 * status->progress,
- status->rate_cur, status->rate_avg, status->hours,
- status->minutes, status->seconds );
- }
- else
- {
- status_str= g_strdup_printf(
- "Encoding: %s%s%.2f %%"
- " (ETA %02dh%02dm%02ds)",
- job_str, task_str,
- 100.0 * status->progress,
- status->hours, status->minutes, status->seconds );
- }
- }
- else
- {
- status_str= g_strdup_printf(
- "Encoding: %s%s%.2f %%",
- job_str, task_str,
- 100.0 * status->progress );
- }
- g_free(task_str);
- g_free(job_str);
- return status_str;
+ gchar *task_str, *job_str, *status_str;
+ gint qcount;
+ gint index;
+ GValue *js;
+ gboolean subtitle_scan = FALSE;
+
+ qcount = ghb_array_len(ud->queue);
+ index = find_queue_job(ud->queue, status->unique_id, &js);
+ if (js != NULL)
+ {
+ subtitle_scan = ghb_settings_get_boolean(js, "subtitle_scan");
+ }
+ if (qcount > 1)
+ {
+ job_str = g_strdup_printf("job %d of %d, ", index+1, qcount);
+ }
+ else
+ {
+ job_str = g_strdup("");
+ }
+ if (status->job_count > 1)
+ {
+ if (status->job_cur == 1 && subtitle_scan)
+ {
+ task_str = g_strdup_printf("pass %d (subtitle scan) of %d, ",
+ status->job_cur, status->job_count);
+ }
+ else
+ {
+ task_str = g_strdup_printf("pass %d of %d, ",
+ status->job_cur, status->job_count);
+ }
+ }
+ else
+ {
+ task_str = g_strdup("");
+ }
+ if(status->seconds > -1)
+ {
+ if (status->rate_cur > 0.0)
+ {
+ status_str= g_strdup_printf(
+ "Encoding: %s%s%.2f %%"
+ " (%.2f fps, avg %.2f fps, ETA %02dh%02dm%02ds)",
+ job_str, task_str,
+ 100.0 * status->progress,
+ status->rate_cur, status->rate_avg, status->hours,
+ status->minutes, status->seconds );
+ }
+ else
+ {
+ status_str= g_strdup_printf(
+ "Encoding: %s%s%.2f %%"
+ " (ETA %02dh%02dm%02ds)",
+ job_str, task_str,
+ 100.0 * status->progress,
+ status->hours, status->minutes, status->seconds );
+ }
+ }
+ else
+ {
+ status_str= g_strdup_printf(
+ "Encoding: %s%s%.2f %%",
+ job_str, task_str,
+ 100.0 * status->progress );
+ }
+ g_free(task_str);
+ g_free(job_str);
+ return status_str;
}
gchar*
searching_status_string(signal_user_data_t *ud, ghb_instance_status_t *status)
{
- gchar *task_str, *job_str, *status_str;
- gint qcount;
- gint index;
- GValue *js;
-
- qcount = ghb_array_len(ud->queue);
- index = find_queue_job(ud->queue, status->unique_id, &js);
- if (qcount > 1)
- {
- job_str = g_strdup_printf("job %d of %d, ", index+1, qcount);
- }
- else
- {
- job_str = g_strdup("");
- }
- task_str = g_strdup_printf("Searching for start time, ");
- if(status->seconds > -1)
- {
- status_str= g_strdup_printf(
- "Encoding: %s%s%.2f %%"
- " (ETA %02dh%02dm%02ds)",
- job_str, task_str,
- 100.0 * status->progress,
- status->hours, status->minutes, status->seconds );
- }
- else
- {
- status_str= g_strdup_printf(
- "Encoding: %s%s%.2f %%",
- job_str, task_str,
- 100.0 * status->progress );
- }
- g_free(task_str);
- g_free(job_str);
- return status_str;
+ gchar *task_str, *job_str, *status_str;
+ gint qcount;
+ gint index;
+ GValue *js;
+
+ qcount = ghb_array_len(ud->queue);
+ index = find_queue_job(ud->queue, status->unique_id, &js);
+ if (qcount > 1)
+ {
+ job_str = g_strdup_printf("job %d of %d, ", index+1, qcount);
+ }
+ else
+ {
+ job_str = g_strdup("");
+ }
+ task_str = g_strdup_printf("Searching for start time, ");
+ if(status->seconds > -1)
+ {
+ status_str= g_strdup_printf(
+ "Encoding: %s%s%.2f %%"
+ " (ETA %02dh%02dm%02ds)",
+ job_str, task_str,
+ 100.0 * status->progress,
+ status->hours, status->minutes, status->seconds );
+ }
+ else
+ {
+ status_str= g_strdup_printf(
+ "Encoding: %s%s%.2f %%",
+ job_str, task_str,
+ 100.0 * status->progress );
+ }
+ g_free(task_str);
+ g_free(job_str);
+ return status_str;
}
static void
ghb_backend_events(signal_user_data_t *ud)
{
- ghb_status_t status;
- gchar *status_str;
- GtkProgressBar *progress;
- GtkLabel *work_status;
- gint titleindex;
- GValue *js;
- gint index;
- GtkTreeView *treeview;
- GtkTreeStore *store;
- GtkTreeIter iter;
- static gint prev_scan_state = 0;
- static gint prev_queue_state = 0;
-
- ghb_track_status();
- ghb_get_status(&status);
- if (prev_scan_state != status.scan.state ||
- prev_queue_state != status.queue.state)
- {
- ghb_queue_buttons_grey(ud);
- prev_scan_state = status.scan.state;
- prev_queue_state = status.queue.state;
- }
- progress = GTK_PROGRESS_BAR(GHB_WIDGET (ud->builder, "progressbar"));
- work_status = GTK_LABEL(GHB_WIDGET (ud->builder, "work_status"));
- if (status.scan.state == GHB_STATE_IDLE &&
- status.queue.state == GHB_STATE_IDLE)
- {
- static gboolean prev_dvdnav;
- gboolean dvdnav = ghb_settings_get_boolean(ud->settings, "use_dvdnav");
- if (dvdnav != prev_dvdnav)
- {
- hb_dvd_set_dvdnav(dvdnav);
- prev_dvdnav = dvdnav;
- }
- }
- // First handle the status of title scans
- // Then handle the status of the queue
- if (status.scan.state & GHB_STATE_SCANNING)
- {
- GtkProgressBar *scan_prog;
- GtkLabel *label;
-
- scan_prog = GTK_PROGRESS_BAR(GHB_WIDGET (ud->builder, "scan_prog"));
- label = GTK_LABEL(GHB_WIDGET (ud->builder, "source_title"));
-
- if (status.scan.title_cur == 0)
- {
- status_str = g_strdup ("Scanning...");
- }
- else
- {
- status_str = g_strdup_printf ("Scanning title %d of %d...",
- status.scan.title_cur, status.scan.title_count );
- }
- gtk_label_set_text (label, status_str);
- g_free(status_str);
- if (status.scan.title_count > 0)
- {
- gtk_progress_bar_set_fraction (scan_prog,
- (gdouble)status.scan.title_cur / status.scan.title_count);
- }
- }
- else if (status.scan.state & GHB_STATE_SCANDONE)
- {
- gchar *source;
- GtkProgressBar *scan_prog;
- GtkLabel *label;
-
- GtkWidget *widget;
- GtkAction *action;
-
- widget = GHB_WIDGET(ud->builder, "sourcetoolbutton");
- gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(widget), "hb-source");
- gtk_tool_button_set_label(GTK_TOOL_BUTTON(widget), "Source");
- gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(widget), "Choose Video Source");
-
- action = GHB_ACTION(ud->builder, "source_action");
- gtk_action_set_sensitive(action, TRUE);
- action = GHB_ACTION(ud->builder, "source_single_action");
- gtk_action_set_sensitive(action, TRUE);
-
- source = ghb_settings_get_string(ud->settings, "scan_source");
- update_source_label(ud, source, FALSE);
-
- scan_prog = GTK_PROGRESS_BAR(GHB_WIDGET (ud->builder, "scan_prog"));
- gtk_progress_bar_set_fraction (scan_prog, 1.0);
- gtk_widget_hide(GTK_WIDGET(scan_prog));
-
- if (!ghb_settings_get_boolean(ud->settings, "preset_modified"))
- {
- ghb_refresh_preset(ud);
- }
-
- ghb_update_ui_combo_box(ud, "title", 0, FALSE);
- titleindex = ghb_longest_title();
- ghb_ui_update(ud, "title", ghb_int64_value(titleindex));
-
- label = GTK_LABEL(GHB_WIDGET (ud->builder, "source_title"));
- // Are there really any titles.
- hb_title_t * title = ghb_get_title_info(titleindex);
- if (title == NULL)
- {
- gtk_label_set_text(label, "None");
- }
- ghb_clear_scan_state(GHB_STATE_SCANDONE);
- if (ghb_queue_edit_settings)
- {
- ghb_settings_to_ui(ud, ghb_queue_edit_settings);
- ghb_set_audio(ud, ghb_queue_edit_settings);
- ghb_reset_subtitles(ud, ghb_queue_edit_settings);
- reset_chapter_list(ud, ghb_queue_edit_settings);
- ghb_value_free(ghb_queue_edit_settings);
- ghb_queue_edit_settings = NULL;
- }
- }
-
- if (status.queue.state & GHB_STATE_SCANNING)
- {
- // This needs to be in scanning and working since scanning
- // happens fast enough that it can be missed
- gtk_label_set_text (work_status, "Scanning ...");
- gtk_progress_bar_set_fraction (progress, 0);
- }
- else if (status.queue.state & GHB_STATE_SCANDONE)
- {
- ghb_clear_queue_state(GHB_STATE_SCANDONE);
- usleep(2000000);
- submit_job(ud->current_job);
- ghb_update_pending(ud);
- }
- else if (status.queue.state & GHB_STATE_PAUSED)
- {
- gtk_label_set_text (work_status, "Paused");
- }
- else if (status.queue.state & GHB_STATE_SEARCHING)
- {
- static gint working = 0;
-
- // This needs to be in scanning and working since scanning
- // happens fast enough that it can be missed
- index = find_queue_job(ud->queue, status.queue.unique_id, &js);
- if (status.queue.unique_id != 0 && index >= 0)
- {
- gchar working_icon[] = "hb-working0";
- working_icon[10] = '0' + working;
- working = (working+1) % 6;
- treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "queue_list"));
- store = GTK_TREE_STORE(gtk_tree_view_get_model(treeview));
- gchar *path = g_strdup_printf ("%d", index);
- if (gtk_tree_model_get_iter_from_string(
- GTK_TREE_MODEL(store), &iter, path))
- {
- gtk_tree_store_set(store, &iter, 0, working_icon, -1);
- }
- g_free(path);
- }
- GtkLabel *label;
- gchar *status_str;
-
- status_str = searching_status_string(ud, &status.queue);
- label = GTK_LABEL(GHB_WIDGET(ud->builder, "queue_status"));
- gtk_label_set_text (label, status_str);
- if (ghb_settings_get_boolean(ud->settings, "show_status"))
- {
+ ghb_status_t status;
+ gchar *status_str;
+ GtkProgressBar *progress;
+ GtkLabel *work_status;
+ gint titleindex;
+ GValue *js;
+ gint index;
+ GtkTreeView *treeview;
+ GtkTreeStore *store;
+ GtkTreeIter iter;
+ static gint prev_scan_state = 0;
+ static gint prev_queue_state = 0;
+
+ ghb_track_status();
+ ghb_get_status(&status);
+ if (prev_scan_state != status.scan.state ||
+ prev_queue_state != status.queue.state)
+ {
+ ghb_queue_buttons_grey(ud);
+ prev_scan_state = status.scan.state;
+ prev_queue_state = status.queue.state;
+ }
+ progress = GTK_PROGRESS_BAR(GHB_WIDGET (ud->builder, "progressbar"));
+ work_status = GTK_LABEL(GHB_WIDGET (ud->builder, "work_status"));
+ if (status.scan.state == GHB_STATE_IDLE &&
+ status.queue.state == GHB_STATE_IDLE)
+ {
+ static gboolean prev_dvdnav;
+ gboolean dvdnav = ghb_settings_get_boolean(ud->settings, "use_dvdnav");
+ if (dvdnav != prev_dvdnav)
+ {
+ hb_dvd_set_dvdnav(dvdnav);
+ prev_dvdnav = dvdnav;
+ }
+ }
+ // First handle the status of title scans
+ // Then handle the status of the queue
+ if (status.scan.state & GHB_STATE_SCANNING)
+ {
+ GtkProgressBar *scan_prog;
+ GtkLabel *label;
+
+ scan_prog = GTK_PROGRESS_BAR(GHB_WIDGET (ud->builder, "scan_prog"));
+ label = GTK_LABEL(GHB_WIDGET (ud->builder, "source_title"));
+
+ if (status.scan.title_cur == 0)
+ {
+ status_str = g_strdup ("Scanning...");
+ }
+ else
+ {
+ status_str = g_strdup_printf ("Scanning title %d of %d...",
+ status.scan.title_cur, status.scan.title_count );
+ }
+ gtk_label_set_text (label, status_str);
+ g_free(status_str);
+ if (status.scan.title_count > 0)
+ {
+ gtk_progress_bar_set_fraction (scan_prog,
+ (gdouble)status.scan.title_cur / status.scan.title_count);
+ }
+ }
+ else if (status.scan.state & GHB_STATE_SCANDONE)
+ {
+ gchar *source;
+ GtkProgressBar *scan_prog;
+ GtkLabel *label;
+
+ GtkWidget *widget;
+ GtkAction *action;
+
+ widget = GHB_WIDGET(ud->builder, "sourcetoolbutton");
+ gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(widget), "hb-source");
+ gtk_tool_button_set_label(GTK_TOOL_BUTTON(widget), "Source");
+ gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(widget), "Choose Video Source");
+
+ action = GHB_ACTION(ud->builder, "source_action");
+ gtk_action_set_sensitive(action, TRUE);
+ action = GHB_ACTION(ud->builder, "source_single_action");
+ gtk_action_set_sensitive(action, TRUE);
+
+ source = ghb_settings_get_string(ud->settings, "scan_source");
+ update_source_label(ud, source, FALSE);
+
+ scan_prog = GTK_PROGRESS_BAR(GHB_WIDGET (ud->builder, "scan_prog"));
+ gtk_progress_bar_set_fraction (scan_prog, 1.0);
+ gtk_widget_hide(GTK_WIDGET(scan_prog));
+
+ if (!ghb_settings_get_boolean(ud->settings, "preset_modified"))
+ {
+ ghb_refresh_preset(ud);
+ }
+
+ ghb_update_ui_combo_box(ud, "title", 0, FALSE);
+ titleindex = ghb_longest_title();
+ ghb_ui_update(ud, "title", ghb_int64_value(titleindex));
+
+ label = GTK_LABEL(GHB_WIDGET (ud->builder, "source_title"));
+ // Are there really any titles.
+ hb_title_t * title = ghb_get_title_info(titleindex);
+ if (title == NULL)
+ {
+ gtk_label_set_text(label, "None");
+ }
+ ghb_clear_scan_state(GHB_STATE_SCANDONE);
+ if (ghb_queue_edit_settings)
+ {
+ ghb_settings_to_ui(ud, ghb_queue_edit_settings);
+ ghb_set_audio(ud, ghb_queue_edit_settings);
+ ghb_reset_subtitles(ud, ghb_queue_edit_settings);
+ reset_chapter_list(ud, ghb_queue_edit_settings);
+ ghb_value_free(ghb_queue_edit_settings);
+ ghb_queue_edit_settings = NULL;
+ }
+ }
+
+ if (status.queue.state & GHB_STATE_SCANNING)
+ {
+ // This needs to be in scanning and working since scanning
+ // happens fast enough that it can be missed
+ gtk_label_set_text (work_status, "Scanning ...");
+ gtk_progress_bar_set_fraction (progress, 0);
+ }
+ else if (status.queue.state & GHB_STATE_SCANDONE)
+ {
+ ghb_clear_queue_state(GHB_STATE_SCANDONE);
+ usleep(2000000);
+ submit_job(ud->current_job);
+ ghb_update_pending(ud);
+ }
+ else if (status.queue.state & GHB_STATE_PAUSED)
+ {
+ gtk_label_set_text (work_status, "Paused");
+ }
+ else if (status.queue.state & GHB_STATE_SEARCHING)
+ {
+ static gint working = 0;
+
+ // This needs to be in scanning and working since scanning
+ // happens fast enough that it can be missed
+ index = find_queue_job(ud->queue, status.queue.unique_id, &js);
+ if (status.queue.unique_id != 0 && index >= 0)
+ {
+ gchar working_icon[] = "hb-working0";
+ working_icon[10] = '0' + working;
+ working = (working+1) % 6;
+ treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "queue_list"));
+ store = GTK_TREE_STORE(gtk_tree_view_get_model(treeview));
+ gchar *path = g_strdup_printf ("%d", index);
+ if (gtk_tree_model_get_iter_from_string(
+ GTK_TREE_MODEL(store), &iter, path))
+ {
+ gtk_tree_store_set(store, &iter, 0, working_icon, -1);
+ }
+ g_free(path);
+ }
+ GtkLabel *label;
+ gchar *status_str;
+
+ status_str = searching_status_string(ud, &status.queue);
+ label = GTK_LABEL(GHB_WIDGET(ud->builder, "queue_status"));
+ gtk_label_set_text (label, status_str);
+ if (ghb_settings_get_boolean(ud->settings, "show_status"))
+ {
#if !GTK_CHECK_VERSION(2, 16, 0)
- GtkStatusIcon *si;
+ GtkStatusIcon *si;
- si = GTK_STATUS_ICON(GHB_OBJECT(ud->builder, "hb_status"));
- gtk_status_icon_set_tooltip(si, status_str);
+ si = GTK_STATUS_ICON(GHB_OBJECT(ud->builder, "hb_status"));
+ gtk_status_icon_set_tooltip(si, status_str);
#endif
#if defined(_USE_APP_IND)
- char * ai_status_str= g_strdup_printf(
- "%.2f%%",
- 100.0 * status.queue.progress);
- app_indicator_set_label( ud->ai, ai_status_str, "99.99%");
- g_free(ai_status_str);
+ char * ai_status_str= g_strdup_printf(
+ "%.2f%%",
+ 100.0 * status.queue.progress);
+ app_indicator_set_label( ud->ai, ai_status_str, "99.99%");
+ g_free(ai_status_str);
#endif
- }
- gtk_label_set_text (work_status, status_str);
- gtk_progress_bar_set_fraction (progress, status.queue.progress);
- g_free(status_str);
- }
- else if (status.queue.state & GHB_STATE_WORKING)
- {
- static gint working = 0;
-
- // This needs to be in scanning and working since scanning
- // happens fast enough that it can be missed
- index = find_queue_job(ud->queue, status.queue.unique_id, &js);
- if (status.queue.unique_id != 0 && index >= 0)
- {
- gchar working_icon[] = "hb-working0";
- working_icon[10] = '0' + working;
- working = (working+1) % 6;
- treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "queue_list"));
- store = GTK_TREE_STORE(gtk_tree_view_get_model(treeview));
- gchar *path = g_strdup_printf ("%d", index);
- if (gtk_tree_model_get_iter_from_string(
- GTK_TREE_MODEL(store), &iter, path))
- {
- gtk_tree_store_set(store, &iter, 0, working_icon, -1);
- }
- g_free(path);
- }
- GtkLabel *label;
- gchar *status_str;
-
- status_str = working_status_string(ud, &status.queue);
- label = GTK_LABEL(GHB_WIDGET(ud->builder, "queue_status"));
- gtk_label_set_text (label, status_str);
- if (ghb_settings_get_boolean(ud->settings, "show_status"))
- {
+ }
+ gtk_label_set_text (work_status, status_str);
+ gtk_progress_bar_set_fraction (progress, status.queue.progress);
+ g_free(status_str);
+ }
+ else if (status.queue.state & GHB_STATE_WORKING)
+ {
+ static gint working = 0;
+
+ // This needs to be in scanning and working since scanning
+ // happens fast enough that it can be missed
+ index = find_queue_job(ud->queue, status.queue.unique_id, &js);
+ if (status.queue.unique_id != 0 && index >= 0)
+ {
+ gchar working_icon[] = "hb-working0";
+ working_icon[10] = '0' + working;
+ working = (working+1) % 6;
+ treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "queue_list"));
+ store = GTK_TREE_STORE(gtk_tree_view_get_model(treeview));
+ gchar *path = g_strdup_printf ("%d", index);
+ if (gtk_tree_model_get_iter_from_string(
+ GTK_TREE_MODEL(store), &iter, path))
+ {
+ gtk_tree_store_set(store, &iter, 0, working_icon, -1);
+ }
+ g_free(path);
+ }
+ GtkLabel *label;
+ gchar *status_str;
+
+ status_str = working_status_string(ud, &status.queue);
+ label = GTK_LABEL(GHB_WIDGET(ud->builder, "queue_status"));
+ gtk_label_set_text (label, status_str);
+ if (ghb_settings_get_boolean(ud->settings, "show_status"))
+ {
#if defined(_USE_APP_IND)
- char * ai_status_str= g_strdup_printf(
- "%.2f%%",
- 100.0 * status.queue.progress);
- app_indicator_set_label( ud->ai, ai_status_str, "99.99%");
- g_free(ai_status_str);
+ char * ai_status_str= g_strdup_printf(
+ "%.2f%%",
+ 100.0 * status.queue.progress);
+ app_indicator_set_label( ud->ai, ai_status_str, "99.99%");
+ g_free(ai_status_str);
#else
#if !GTK_CHECK_VERSION(2, 16, 0)
- GtkStatusIcon *si;
+ GtkStatusIcon *si;
- si = GTK_STATUS_ICON(GHB_OBJECT(ud->builder, "hb_status"));
- gtk_status_icon_set_tooltip(si, status_str);
+ si = GTK_STATUS_ICON(GHB_OBJECT(ud->builder, "hb_status"));
+ gtk_status_icon_set_tooltip(si, status_str);
#endif
#endif
- }
- gtk_label_set_text (work_status, status_str);
- gtk_progress_bar_set_fraction (progress, status.queue.progress);
- g_free(status_str);
- }
- else if (status.queue.state & GHB_STATE_WORKDONE)
- {
- gint qstatus;
-
- index = find_queue_job(ud->queue, status.queue.unique_id, &js);
- treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "queue_list"));
- store = GTK_TREE_STORE(gtk_tree_view_get_model(treeview));
- if (ud->cancel_encode == GHB_CANCEL_ALL ||
- ud->cancel_encode == GHB_CANCEL_CURRENT)
- status.queue.error = GHB_ERROR_CANCELED;
- switch( status.queue.error )
- {
- case GHB_ERROR_NONE:
- gtk_label_set_text (work_status, "Encode Done!");
- qstatus = GHB_QUEUE_DONE;
- if (js != NULL)
- {
- gchar *path = g_strdup_printf ("%d", index);
- if (gtk_tree_model_get_iter_from_string(
- GTK_TREE_MODEL(store), &iter, path))
- {
- gtk_tree_store_set(store, &iter, 0, "hb-complete", -1);
- }
- g_free(path);
- }
- break;
- case GHB_ERROR_CANCELED:
- gtk_label_set_text (work_status, "Encode Canceled.");
- qstatus = GHB_QUEUE_CANCELED;
- if (js != NULL)
- {
- gchar *path = g_strdup_printf ("%d", index);
- if (gtk_tree_model_get_iter_from_string(
- GTK_TREE_MODEL(store), &iter, path))
- {
- gtk_tree_store_set(store, &iter, 0, "hb-canceled", -1);
- }
- g_free(path);
- }
- break;
- default:
- gtk_label_set_text (work_status, "Encode Failed.");
- qstatus = GHB_QUEUE_CANCELED;
- if (js != NULL)
- {
- gchar *path = g_strdup_printf ("%d", index);
- if (gtk_tree_model_get_iter_from_string(
- GTK_TREE_MODEL(store), &iter, path))
- {
- gtk_tree_store_set(store, &iter, 0, "hb-canceled", -1);
- }
- g_free(path);
- }
- }
- gtk_progress_bar_set_fraction (progress, 1.0);
- ghb_clear_queue_state(GHB_STATE_WORKDONE);
- if (ud->job_activity_log)
- g_io_channel_unref(ud->job_activity_log);
- ud->job_activity_log = NULL;
- if (ud->cancel_encode != GHB_CANCEL_ALL &&
- ud->cancel_encode != GHB_CANCEL_FINISH)
- {
- ud->current_job = ghb_start_next_job(ud, FALSE);
- }
- else
- {
- ghb_uninhibit_gsm();
- ud->current_job = NULL;
- gtk_widget_hide(GTK_WIDGET(progress));
- }
- if (js)
- ghb_settings_set_int(js, "job_status", qstatus);
- ghb_save_queue(ud->queue);
- ud->cancel_encode = GHB_CANCEL_NONE;
+ }
+ gtk_label_set_text (work_status, status_str);
+ gtk_progress_bar_set_fraction (progress, status.queue.progress);
+ g_free(status_str);
+ }
+ else if (status.queue.state & GHB_STATE_WORKDONE)
+ {
+ gint qstatus;
+
+ index = find_queue_job(ud->queue, status.queue.unique_id, &js);
+ treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "queue_list"));
+ store = GTK_TREE_STORE(gtk_tree_view_get_model(treeview));
+ if (ud->cancel_encode == GHB_CANCEL_ALL ||
+ ud->cancel_encode == GHB_CANCEL_CURRENT)
+ status.queue.error = GHB_ERROR_CANCELED;
+ switch( status.queue.error )
+ {
+ case GHB_ERROR_NONE:
+ gtk_label_set_text (work_status, "Encode Done!");
+ qstatus = GHB_QUEUE_DONE;
+ if (js != NULL)
+ {
+ gchar *path = g_strdup_printf ("%d", index);
+ if (gtk_tree_model_get_iter_from_string(
+ GTK_TREE_MODEL(store), &iter, path))
+ {
+ gtk_tree_store_set(store, &iter, 0, "hb-complete", -1);
+ }
+ g_free(path);
+ }
+ break;
+ case GHB_ERROR_CANCELED:
+ gtk_label_set_text (work_status, "Encode Canceled.");
+ qstatus = GHB_QUEUE_CANCELED;
+ if (js != NULL)
+ {
+ gchar *path = g_strdup_printf ("%d", index);
+ if (gtk_tree_model_get_iter_from_string(
+ GTK_TREE_MODEL(store), &iter, path))
+ {
+ gtk_tree_store_set(store, &iter, 0, "hb-canceled", -1);
+ }
+ g_free(path);
+ }
+ break;
+ default:
+ gtk_label_set_text (work_status, "Encode Failed.");
+ qstatus = GHB_QUEUE_CANCELED;
+ if (js != NULL)
+ {
+ gchar *path = g_strdup_printf ("%d", index);
+ if (gtk_tree_model_get_iter_from_string(
+ GTK_TREE_MODEL(store), &iter, path))
+ {
+ gtk_tree_store_set(store, &iter, 0, "hb-canceled", -1);
+ }
+ g_free(path);
+ }
+ }
+ gtk_progress_bar_set_fraction (progress, 1.0);
+ ghb_clear_queue_state(GHB_STATE_WORKDONE);
+ if (ud->job_activity_log)
+ g_io_channel_unref(ud->job_activity_log);
+ ud->job_activity_log = NULL;
+ if (ud->cancel_encode != GHB_CANCEL_ALL &&
+ ud->cancel_encode != GHB_CANCEL_FINISH)
+ {
+ ud->current_job = ghb_start_next_job(ud, FALSE);
+ }
+ else
+ {
+ ghb_uninhibit_gsm();
+ ud->current_job = NULL;
+ gtk_widget_hide(GTK_WIDGET(progress));
+ }
+ if (js)
+ ghb_settings_set_int(js, "job_status", qstatus);
+ ghb_save_queue(ud->queue);
+ ud->cancel_encode = GHB_CANCEL_NONE;
#if defined(_USE_APP_IND)
- app_indicator_set_label( ud->ai, "", "99.99%");
+ app_indicator_set_label( ud->ai, "", "99.99%");
#else
#if !GTK_CHECK_VERSION(2, 16, 0)
- GtkStatusIcon *si;
+ GtkStatusIcon *si;
- si = GTK_STATUS_ICON(GHB_OBJECT(ud->builder, "hb_status"));
- gtk_status_icon_set_tooltip(si, "HandBrake");
+ si = GTK_STATUS_ICON(GHB_OBJECT(ud->builder, "hb_status"));
+ gtk_status_icon_set_tooltip(si, "HandBrake");
#endif
#endif
- }
- else if (status.queue.state & GHB_STATE_MUXING)
- {
- gtk_label_set_text (work_status, "Muxing: This may take a while...");
- }
-
- if (status.scan.state & GHB_STATE_WORKING)
- {
- GtkProgressBar *live_progress;
- live_progress = GTK_PROGRESS_BAR(
- GHB_WIDGET(ud->builder, "live_encode_progress"));
- status_str = working_status_string(ud, &status.scan);
- gtk_progress_bar_set_text (live_progress, status_str);
- gtk_progress_bar_set_fraction (live_progress, status.scan.progress);
- g_free(status_str);
- }
- if (status.scan.state & GHB_STATE_WORKDONE)
- {
- switch( status.scan.error )
- {
- case GHB_ERROR_NONE:
- {
- ghb_live_encode_done(ud, TRUE);
- } break;
- default:
- {
- ghb_live_encode_done(ud, FALSE);
- } break;
- }
- ghb_clear_scan_state(GHB_STATE_WORKDONE);
- }
+ }
+ else if (status.queue.state & GHB_STATE_MUXING)
+ {
+ gtk_label_set_text (work_status, "Muxing: This may take a while...");
+ }
+
+ if (status.scan.state & GHB_STATE_WORKING)
+ {
+ GtkProgressBar *live_progress;
+ live_progress = GTK_PROGRESS_BAR(
+ GHB_WIDGET(ud->builder, "live_encode_progress"));
+ status_str = working_status_string(ud, &status.scan);
+ gtk_progress_bar_set_text (live_progress, status_str);
+ gtk_progress_bar_set_fraction (live_progress, status.scan.progress);
+ g_free(status_str);
+ }
+ if (status.scan.state & GHB_STATE_WORKDONE)
+ {
+ switch( status.scan.error )
+ {
+ case GHB_ERROR_NONE:
+ {
+ ghb_live_encode_done(ud, TRUE);
+ } break;
+ default:
+ {
+ ghb_live_encode_done(ud, FALSE);
+ } break;
+ }
+ ghb_clear_scan_state(GHB_STATE_WORKDONE);
+ }
}
#if GTK_CHECK_VERSION(2, 16, 0)
G_MODULE_EXPORT gboolean
status_icon_query_tooltip_cb(
- GtkStatusIcon *si,
- gint x,
- gint y,
- gboolean kbd_mode,
- GtkTooltip *tt,
- signal_user_data_t *ud)
-{
- ghb_status_t status;
- gchar *status_str;
-
- ghb_get_status(&status);
- if (status.queue.state & GHB_STATE_WORKING)
- status_str = working_status_string(ud, &status.queue);
- else if (status.queue.state & GHB_STATE_SEARCHING)
- status_str = searching_status_string(ud, &status.queue);
- else if (status.queue.state & GHB_STATE_WORKDONE)
- status_str = g_strdup("Encode Complete");
- else
- status_str = g_strdup("HandBrake");
-
- gtk_tooltip_set_text(tt, status_str);
- gtk_tooltip_set_icon_from_icon_name(tt, "hb-icon", GTK_ICON_SIZE_BUTTON);
- g_free(status_str);
- return TRUE;
+ GtkStatusIcon *si,
+ gint x,
+ gint y,
+ gboolean kbd_mode,
+ GtkTooltip *tt,
+ signal_user_data_t *ud)
+{
+ ghb_status_t status;
+ gchar *status_str;
+
+ ghb_get_status(&status);
+ if (status.queue.state & GHB_STATE_WORKING)
+ status_str = working_status_string(ud, &status.queue);
+ else if (status.queue.state & GHB_STATE_SEARCHING)
+ status_str = searching_status_string(ud, &status.queue);
+ else if (status.queue.state & GHB_STATE_WORKDONE)
+ status_str = g_strdup("Encode Complete");
+ else
+ status_str = g_strdup("HandBrake");
+
+ gtk_tooltip_set_text(tt, status_str);
+ gtk_tooltip_set_icon_from_icon_name(tt, "hb-icon", GTK_ICON_SIZE_BUTTON);
+ g_free(status_str);
+ return TRUE;
}
#endif
G_MODULE_EXPORT gboolean
ghb_timer_cb(gpointer data)
{
- signal_user_data_t *ud = (signal_user_data_t*)data;
-
- ghb_live_preview_progress(ud);
- ghb_backend_events(ud);
- if (update_default_destination)
- {
- gchar *dest, *dest_dir, *def_dest;
- dest = ghb_settings_get_string(ud->settings, "destination");
- dest_dir = g_path_get_dirname (dest);
- def_dest = ghb_settings_get_string(ud->settings, "destination_dir");
- if (strcmp(dest_dir, def_dest) != 0)
- {
- ghb_settings_set_string (ud->settings, "destination_dir", dest_dir);
- ghb_pref_save (ud->settings, "destination_dir");
- }
- g_free(dest);
- g_free(dest_dir);
- g_free(def_dest);
- update_default_destination = FALSE;
- }
- if (update_preview)
- {
- g_debug("Updating preview\n");
- ghb_set_preview_image (ud);
- update_preview = FALSE;
- }
+ signal_user_data_t *ud = (signal_user_data_t*)data;
+
+ ghb_live_preview_progress(ud);
+ ghb_backend_events(ud);
+ if (update_default_destination)
+ {
+ gchar *dest, *dest_dir, *def_dest;
+ dest = ghb_settings_get_string(ud->settings, "destination");
+ dest_dir = g_path_get_dirname (dest);
+ def_dest = ghb_settings_get_string(ud->settings, "destination_dir");
+ if (strcmp(dest_dir, def_dest) != 0)
+ {
+ ghb_settings_set_string (ud->settings, "destination_dir", dest_dir);
+ ghb_pref_save (ud->settings, "destination_dir");
+ }
+ g_free(dest);
+ g_free(dest_dir);
+ g_free(def_dest);
+ update_default_destination = FALSE;
+ }
+ if (update_preview)
+ {
+ g_debug("Updating preview\n");
+ ghb_set_preview_image (ud);
+ update_preview = FALSE;
+ }
#if !defined(_NO_UPDATE_CHECK)
- if (!appcast_busy)
- {
- gchar *updates;
- updates = ghb_settings_get_string(ud->settings, "check_updates");
- gint64 duration = 0;
- if (strcmp(updates, "daily") == 0)
- duration = 60 * 60 * 24;
- else if (strcmp(updates, "weekly") == 0)
- duration = 60 * 60 * 24 * 7;
- else if (strcmp(updates, "monthly") == 0)
- duration = 60 * 60 * 24 * 7;
-
- g_free(updates);
- if (duration != 0)
- {
- gint64 last;
- time_t tt;
-
- last = ghb_settings_get_int64(ud->settings, "last_update_check");
- time(&tt);
- if (last + duration < tt)
- {
- ghb_settings_set_int64(ud->settings,
- "last_update_check", tt);
- ghb_pref_save(ud->settings, "last_update_check");
- g_thread_create((GThreadFunc)ghb_check_update, ud,
- FALSE, NULL);
- }
- }
- }
+ if (!appcast_busy)
+ {
+ gchar *updates;
+ updates = ghb_settings_get_string(ud->settings, "check_updates");
+ gint64 duration = 0;
+ if (strcmp(updates, "daily") == 0)
+ duration = 60 * 60 * 24;
+ else if (strcmp(updates, "weekly") == 0)
+ duration = 60 * 60 * 24 * 7;
+ else if (strcmp(updates, "monthly") == 0)
+ duration = 60 * 60 * 24 * 7;
+
+ g_free(updates);
+ if (duration != 0)
+ {
+ gint64 last;
+ time_t tt;
+
+ last = ghb_settings_get_int64(ud->settings, "last_update_check");
+ time(&tt);
+ if (last + duration < tt)
+ {
+ ghb_settings_set_int64(ud->settings,
+ "last_update_check", tt);
+ ghb_pref_save(ud->settings, "last_update_check");
+ g_thread_create((GThreadFunc)ghb_check_update, ud,
+ FALSE, NULL);
+ }
+ }
+ }
#endif
- return TRUE;
+ return TRUE;
}
G_MODULE_EXPORT gboolean
ghb_log_cb(GIOChannel *source, GIOCondition cond, gpointer data)
{
- gchar *text = NULL;
- gsize length, outlength;
- GtkTextView *textview;
- GtkTextBuffer *buffer;
- GtkTextIter iter;
- GtkTextMark *mark;
- GError *gerror = NULL;
- GIOStatus status;
-
- signal_user_data_t *ud = (signal_user_data_t*)data;
-
- status = g_io_channel_read_line (source, &text, &length, NULL, &gerror);
- // Trim nils from end of text, they cause g_io_channel_write_chars to
- // fail with an assertion that aborts
- while (length > 0 && text[length-1] == 0)
- length--;
- if (text != NULL && length > 0)
- {
- GdkWindow *window;
- gint width, height;
- gint x, y;
- gboolean bottom = FALSE;
- gchar *utf8_text;
-
- textview = GTK_TEXT_VIEW(GHB_WIDGET (ud->builder, "activity_view"));
- buffer = gtk_text_view_get_buffer (textview);
- // I would like to auto-scroll the window when the scrollbar
- // is at the bottom,
- // must determine whether the insert point is at
- // the bottom of the window
- window = gtk_text_view_get_window(textview, GTK_TEXT_WINDOW_TEXT);
- if (window != NULL)
- {
- gdk_drawable_get_size(GDK_DRAWABLE(window), &width, &height);
- gtk_text_view_window_to_buffer_coords(textview,
- GTK_TEXT_WINDOW_TEXT, width, height, &x, &y);
- gtk_text_view_get_iter_at_location(textview, &iter, x, y);
- if (gtk_text_iter_is_end(&iter))
- {
- bottom = TRUE;
- }
- }
- else
- {
- // If the window isn't available, assume bottom
- bottom = TRUE;
- }
- gtk_text_buffer_get_end_iter(buffer, &iter);
- utf8_text = g_convert_with_fallback(text, -1, "UTF-8", "ISO-8859-1",
- "?", NULL, &length, NULL);
- if (utf8_text != NULL)
- {
- gtk_text_buffer_insert(buffer, &iter, utf8_text, -1);
- if (bottom)
- {
- gtk_text_buffer_get_end_iter(buffer, &iter);
- mark = gtk_text_buffer_create_mark(buffer, NULL, &iter, FALSE);
- gtk_text_view_scroll_mark_onscreen(textview, mark);
- gtk_text_buffer_delete_mark(buffer, mark);
- }
+ gchar *text = NULL;
+ gsize length, outlength;
+ GtkTextView *textview;
+ GtkTextBuffer *buffer;
+ GtkTextIter iter;
+ GtkTextMark *mark;
+ GError *gerror = NULL;
+ GIOStatus status;
+
+ signal_user_data_t *ud = (signal_user_data_t*)data;
+
+ status = g_io_channel_read_line (source, &text, &length, NULL, &gerror);
+ // Trim nils from end of text, they cause g_io_channel_write_chars to
+ // fail with an assertion that aborts
+ while (length > 0 && text[length-1] == 0)
+ length--;
+ if (text != NULL && length > 0)
+ {
+ GdkWindow *window;
+ gint width, height;
+ gint x, y;
+ gboolean bottom = FALSE;
+ gchar *utf8_text;
+
+ textview = GTK_TEXT_VIEW(GHB_WIDGET (ud->builder, "activity_view"));
+ buffer = gtk_text_view_get_buffer (textview);
+ // I would like to auto-scroll the window when the scrollbar
+ // is at the bottom,
+ // must determine whether the insert point is at
+ // the bottom of the window
+ window = gtk_text_view_get_window(textview, GTK_TEXT_WINDOW_TEXT);
+ if (window != NULL)
+ {
+ gdk_drawable_get_size(GDK_DRAWABLE(window), &width, &height);
+ gtk_text_view_window_to_buffer_coords(textview,
+ GTK_TEXT_WINDOW_TEXT, width, height, &x, &y);
+ gtk_text_view_get_iter_at_location(textview, &iter, x, y);
+ if (gtk_text_iter_is_end(&iter))
+ {
+ bottom = TRUE;
+ }
+ }
+ else
+ {
+ // If the window isn't available, assume bottom
+ bottom = TRUE;
+ }
+ gtk_text_buffer_get_end_iter(buffer, &iter);
+ utf8_text = g_convert_with_fallback(text, -1, "UTF-8", "ISO-8859-1",
+ "?", NULL, &length, NULL);
+ if (utf8_text != NULL)
+ {
+ gtk_text_buffer_insert(buffer, &iter, utf8_text, -1);
+ if (bottom)
+ {
+ gtk_text_buffer_get_end_iter(buffer, &iter);
+ mark = gtk_text_buffer_create_mark(buffer, NULL, &iter, FALSE);
+ gtk_text_view_scroll_mark_onscreen(textview, mark);
+ gtk_text_buffer_delete_mark(buffer, mark);
+ }
#if defined(_WIN32)
- gsize one = 1;
- utf8_text[length-1] = '\r';
+ gsize one = 1;
+ utf8_text[length-1] = '\r';
#endif
- g_io_channel_write_chars (ud->activity_log, utf8_text,
- length, &outlength, NULL);
+ g_io_channel_write_chars (ud->activity_log, utf8_text,
+ length, &outlength, NULL);
#if defined(_WIN32)
- g_io_channel_write_chars (ud->activity_log, "\n",
- one, &one, NULL);
+ g_io_channel_write_chars (ud->activity_log, "\n",
+ one, &one, NULL);
#endif
- g_io_channel_flush(ud->activity_log, NULL);
- if (ud->job_activity_log)
- {
- g_io_channel_write_chars (ud->job_activity_log, utf8_text,
- length, &outlength, NULL);
+ g_io_channel_flush(ud->activity_log, NULL);
+ if (ud->job_activity_log)
+ {
+ g_io_channel_write_chars (ud->job_activity_log, utf8_text,
+ length, &outlength, NULL);
#if defined(_WIN32)
- g_io_channel_write_chars (ud->activity_log, "\n",
- one, &outlength, NULL);
+ g_io_channel_write_chars (ud->activity_log, "\n",
+ one, &outlength, NULL);
#endif
- g_io_channel_flush(ud->job_activity_log, NULL);
- }
- g_free(utf8_text);
- }
- }
- if (text != NULL)
- g_free(text);
-
- if (status != G_IO_STATUS_NORMAL)
- {
- // This should never happen, but if it does I would get into an
- // infinite loop. Returning false removes this callback.
- g_warning("Error while reading activity from pipe");
- if (gerror != NULL)
- {
- g_warning("%s", gerror->message);
- g_error_free (gerror);
- }
- return FALSE;
- }
- if (gerror != NULL)
- g_error_free (gerror);
- return TRUE;
+ g_io_channel_flush(ud->job_activity_log, NULL);
+ }
+ g_free(utf8_text);
+ }
+ }
+ if (text != NULL)
+ g_free(text);
+
+ if (status != G_IO_STATUS_NORMAL)
+ {
+ // This should never happen, but if it does I would get into an
+ // infinite loop. Returning false removes this callback.
+ g_warning("Error while reading activity from pipe");
+ if (gerror != NULL)
+ {
+ g_warning("%s", gerror->message);
+ g_error_free (gerror);
+ }
+ return FALSE;
+ }
+ if (gerror != NULL)
+ g_error_free (gerror);
+ return TRUE;
}
static void
set_visible(GtkWidget *widget, gboolean visible)
{
- if (visible)
- {
- gtk_widget_show_now(widget);
- }
- else
- {
- gtk_widget_hide(widget);
- }
+ if (visible)
+ {
+ gtk_widget_show_now(widget);
+ }
+ else
+ {
+ gtk_widget_hide(widget);
+ }
}
G_MODULE_EXPORT void
show_activity_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud)
{
- GtkWidget *widget = GHB_WIDGET (ud->builder, "activity_window");
- set_visible(widget, gtk_toggle_tool_button_get_active(
- GTK_TOGGLE_TOOL_BUTTON(xwidget)));
+ GtkWidget *widget = GHB_WIDGET (ud->builder, "activity_window");
+ set_visible(widget, gtk_toggle_tool_button_get_active(
+ GTK_TOGGLE_TOOL_BUTTON(xwidget)));
}
G_MODULE_EXPORT void
show_activity_menu_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud)
{
- GtkWidget *widget = GHB_WIDGET (ud->builder, "activity_window");
- set_visible(widget, TRUE);
- widget = GHB_WIDGET (ud->builder, "show_activity");
- gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(widget), TRUE);
+ GtkWidget *widget = GHB_WIDGET (ud->builder, "activity_window");
+ set_visible(widget, TRUE);
+ widget = GHB_WIDGET (ud->builder, "show_activity");
+ gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(widget), TRUE);
}
G_MODULE_EXPORT gboolean
activity_window_delete_cb(GtkWidget *xwidget, GdkEvent *event, signal_user_data_t *ud)
{
- set_visible(xwidget, FALSE);
- GtkWidget *widget = GHB_WIDGET (ud->builder, "show_activity");
- gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(widget), FALSE);
- return TRUE;
+ set_visible(xwidget, FALSE);
+ GtkWidget *widget = GHB_WIDGET (ud->builder, "show_activity");
+ gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(widget), FALSE);
+ return TRUE;
}
void
ghb_log(gchar *log, ...)
{
- va_list args;
- time_t _now;
+ va_list args;
+ time_t _now;
struct tm *now;
- gchar fmt[362];
+ gchar fmt[362];
- _now = time(NULL);
- now = localtime( &_now );
- snprintf(fmt, 362, "[%02d:%02d:%02d] gtkgui: %s\n",
- now->tm_hour, now->tm_min, now->tm_sec, log);
- va_start(args, log);
- vfprintf(stderr, fmt, args);
- va_end(args);
+ _now = time(NULL);
+ now = localtime( &_now );
+ snprintf(fmt, 362, "[%02d:%02d:%02d] gtkgui: %s\n",
+ now->tm_hour, now->tm_min, now->tm_sec, log);
+ va_start(args, log);
+ vfprintf(stderr, fmt, args);
+ va_end(args);
}
static void
browse_url(const gchar *url)
{
#if defined(_WIN32)
- HINSTANCE r;
- r = ShellExecute(NULL, "open", url, NULL, NULL, SW_SHOWNORMAL);
+ HINSTANCE r;
+ r = ShellExecute(NULL, "open", url, NULL, NULL, SW_SHOWNORMAL);
#else
- gboolean result;
- char *argv[] =
- {"xdg-open",NULL,NULL,NULL};
- argv[1] = (gchar*)url;
- result = g_spawn_async(NULL, argv, NULL, G_SPAWN_SEARCH_PATH, NULL,
- NULL, NULL, NULL);
- if (result) return;
-
- argv[0] = "gnome-open";
- result = g_spawn_async(NULL, argv, NULL, G_SPAWN_SEARCH_PATH, NULL,
- NULL, NULL, NULL);
- if (result) return;
-
- argv[0] = "kfmclient";
- argv[1] = "exec";
- argv[2] = "http://trac.handbrake.fr/wiki/HandBrakeGuide";
- result = g_spawn_async(NULL, argv, NULL, G_SPAWN_SEARCH_PATH, NULL,
- NULL, NULL, NULL);
- if (result) return;
-
- argv[0] = "firefox";
- argv[1] = "http://trac.handbrake.fr/wiki/HandBrakeGuide";
- argv[2] = NULL;
- result = g_spawn_async(NULL, argv, NULL, G_SPAWN_SEARCH_PATH, NULL,
- NULL, NULL, NULL);
+ gboolean result;
+ char *argv[] =
+ {"xdg-open",NULL,NULL,NULL};
+ argv[1] = (gchar*)url;
+ result = g_spawn_async(NULL, argv, NULL, G_SPAWN_SEARCH_PATH, NULL,
+ NULL, NULL, NULL);
+ if (result) return;
+
+ argv[0] = "gnome-open";
+ result = g_spawn_async(NULL, argv, NULL, G_SPAWN_SEARCH_PATH, NULL,
+ NULL, NULL, NULL);
+ if (result) return;
+
+ argv[0] = "kfmclient";
+ argv[1] = "exec";
+ argv[2] = "http://trac.handbrake.fr/wiki/HandBrakeGuide";
+ result = g_spawn_async(NULL, argv, NULL, G_SPAWN_SEARCH_PATH, NULL,
+ NULL, NULL, NULL);
+ if (result) return;
+
+ argv[0] = "firefox";
+ argv[1] = "http://trac.handbrake.fr/wiki/HandBrakeGuide";
+ argv[2] = NULL;
+ result = g_spawn_async(NULL, argv, NULL, G_SPAWN_SEARCH_PATH, NULL,
+ NULL, NULL, NULL);
#endif
}
void
about_web_hook(GtkAboutDialog *about, const gchar *link, gpointer data)
{
- browse_url(link);
+ browse_url(link);
}
G_MODULE_EXPORT void
about_activate_cb(GtkWidget *xwidget, signal_user_data_t *ud)
{
- GtkWidget *widget = GHB_WIDGET (ud->builder, "hb_about");
- gchar *ver;
+ GtkWidget *widget = GHB_WIDGET (ud->builder, "hb_about");
+ gchar *ver;
- ver = g_strdup_printf("%s (%s)", HB_PROJECT_VERSION, HB_PROJECT_BUILD_ARCH);
- gtk_about_dialog_set_url_hook(about_web_hook, NULL, NULL);
- gtk_about_dialog_set_version(GTK_ABOUT_DIALOG(widget), ver);
- g_free(ver);
- gtk_about_dialog_set_website(GTK_ABOUT_DIALOG(widget),
- HB_PROJECT_URL_WEBSITE);
- gtk_about_dialog_set_website_label(GTK_ABOUT_DIALOG(widget),
- HB_PROJECT_URL_WEBSITE);
- gtk_widget_show (widget);
+ ver = g_strdup_printf("%s (%s)", HB_PROJECT_VERSION, HB_PROJECT_BUILD_ARCH);
+ gtk_about_dialog_set_url_hook(about_web_hook, NULL, NULL);
+ gtk_about_dialog_set_version(GTK_ABOUT_DIALOG(widget), ver);
+ g_free(ver);
+ gtk_about_dialog_set_website(GTK_ABOUT_DIALOG(widget),
+ HB_PROJECT_URL_WEBSITE);
+ gtk_about_dialog_set_website_label(GTK_ABOUT_DIALOG(widget),
+ HB_PROJECT_URL_WEBSITE);
+ gtk_widget_show (widget);
}
G_MODULE_EXPORT void
guide_activate_cb(GtkWidget *xwidget, signal_user_data_t *ud)
{
- browse_url("http://trac.handbrake.fr/wiki/HandBrakeGuide");
+ browse_url("http://trac.handbrake.fr/wiki/HandBrakeGuide");
}
G_MODULE_EXPORT void
hb_about_response_cb(GtkWidget *widget, gint response, signal_user_data_t *ud)
{
- gtk_widget_hide (widget);
+ gtk_widget_hide (widget);
}
G_MODULE_EXPORT void
show_queue_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud)
{
- GtkWidget *widget = GHB_WIDGET (ud->builder, "queue_window");
- set_visible(widget, gtk_toggle_tool_button_get_active(
- GTK_TOGGLE_TOOL_BUTTON(xwidget)));
+ GtkWidget *widget = GHB_WIDGET (ud->builder, "queue_window");
+ set_visible(widget, gtk_toggle_tool_button_get_active(
+ GTK_TOGGLE_TOOL_BUTTON(xwidget)));
}
G_MODULE_EXPORT void
show_queue_menu_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud)
{
- GtkWidget *widget = GHB_WIDGET (ud->builder, "queue_window");
- set_visible(widget, TRUE);
- widget = GHB_WIDGET (ud->builder, "show_queue");
- gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(widget), TRUE);
+ GtkWidget *widget = GHB_WIDGET (ud->builder, "queue_window");
+ set_visible(widget, TRUE);
+ widget = GHB_WIDGET (ud->builder, "show_queue");
+ gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(widget), TRUE);
}
G_MODULE_EXPORT gboolean
queue_window_delete_cb(GtkWidget *xwidget, GdkEvent *event, signal_user_data_t *ud)
{
- set_visible(xwidget, FALSE);
- GtkWidget *widget = GHB_WIDGET (ud->builder, "show_queue");
- gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(widget), FALSE);
- return TRUE;
+ set_visible(xwidget, FALSE);
+ GtkWidget *widget = GHB_WIDGET (ud->builder, "show_queue");
+ gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(widget), FALSE);
+ return TRUE;
}
G_MODULE_EXPORT void
show_presets_toggled_cb(GtkWidget *action, signal_user_data_t *ud)
{
- GtkWidget *widget;
- GtkWindow *hb_window;
-
- g_debug("show_presets_clicked_cb ()");
- widget = GHB_WIDGET (ud->builder, "presets_frame");
- ghb_widget_to_setting(ud->settings, action);
- if (ghb_settings_get_boolean(ud->settings, "show_presets"))
- {
- gtk_widget_show_now(widget);
- }
- else
- {
- gtk_widget_hide(widget);
- hb_window = GTK_WINDOW(GHB_WIDGET (ud->builder, "hb_window"));
- gtk_window_resize(hb_window, 16, 16);
- }
- ghb_pref_save(ud->settings, "show_presets");
+ GtkWidget *widget;
+ GtkWindow *hb_window;
+
+ g_debug("show_presets_clicked_cb ()");
+ widget = GHB_WIDGET (ud->builder, "presets_frame");
+ ghb_widget_to_setting(ud->settings, action);
+ if (ghb_settings_get_boolean(ud->settings, "show_presets"))
+ {
+ gtk_widget_show_now(widget);
+ }
+ else
+ {
+ gtk_widget_hide(widget);
+ hb_window = GTK_WINDOW(GHB_WIDGET (ud->builder, "hb_window"));
+ gtk_window_resize(hb_window, 16, 16);
+ }
+ ghb_pref_save(ud->settings, "show_presets");
}
static void
reset_chapter_list(signal_user_data_t *ud, GValue *settings)
{
- GtkTreeView *treeview;
- GtkTreeIter iter;
- GtkListStore *store;
- gboolean done;
- GValue *chapters;
- gint titleindex, ii;
- gint count;
-
- g_debug("reset_chapter_list ()");
- chapters = ghb_value_dup(ghb_settings_get_value(settings, "chapter_list"));
- count = ghb_array_len(chapters);
- ghb_settings_set_value(ud->settings, "chapter_list", chapters);
- titleindex = ghb_settings_combo_int(ud->settings, "title");
-
- treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "chapters_list"));
- store = GTK_LIST_STORE(gtk_tree_view_get_model(treeview));
- ii = 0;
- if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(store), &iter))
- {
- do
- {
-
- if (ii < count)
- {
- gchar *chapter, *duration;
- gint hh, mm, ss;
-
- // Update row with settings data
- g_debug("Updating row");
- chapter = ghb_value_string(ghb_array_get_nth(chapters, ii));
- ghb_get_chapter_duration(titleindex, ii, &hh, &mm, &ss);
- duration = g_strdup_printf("%02d:%02d:%02d", hh, mm, ss);
- gtk_list_store_set(store, &iter,
- 0, ii+1,
- 1, duration,
- 2, chapter,
- 3, TRUE,
- -1);
- g_free(chapter);
- g_free(duration);
- ii++;
- done = !gtk_tree_model_iter_next(GTK_TREE_MODEL(store), &iter);
- }
- else
- {
- // No more settings data, remove row
- g_debug("Removing row");
- done = !gtk_list_store_remove(store, &iter);
- }
- } while (!done);
- }
- while (ii < count)
- {
- gchar *chapter, *duration;
- gint hh, mm, ss;
-
- // Additional settings, add row
- g_debug("Adding row");
- chapter = ghb_value_string(ghb_array_get_nth(chapters, ii));
- ghb_get_chapter_duration(titleindex, ii, &hh, &mm, &ss);
- duration = g_strdup_printf("%02d:%02d:%02d", hh, mm, ss);
- gtk_list_store_append(store, &iter);
- gtk_list_store_set(store, &iter,
- 0, ii+1,
- 1, duration,
- 2, chapter,
- 3, TRUE,
- -1);
- g_free(chapter);
- g_free(duration);
- ii++;
- }
+ GtkTreeView *treeview;
+ GtkTreeIter iter;
+ GtkListStore *store;
+ gboolean done;
+ GValue *chapters;
+ gint titleindex, ii;
+ gint count;
+
+ g_debug("reset_chapter_list ()");
+ chapters = ghb_value_dup(ghb_settings_get_value(settings, "chapter_list"));
+ count = ghb_array_len(chapters);
+ ghb_settings_set_value(ud->settings, "chapter_list", chapters);
+ titleindex = ghb_settings_combo_int(ud->settings, "title");
+
+ treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "chapters_list"));
+ store = GTK_LIST_STORE(gtk_tree_view_get_model(treeview));
+ ii = 0;
+ if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(store), &iter))
+ {
+ do
+ {
+
+ if (ii < count)
+ {
+ gchar *chapter, *duration;
+ gint hh, mm, ss;
+
+ // Update row with settings data
+ g_debug("Updating row");
+ chapter = ghb_value_string(ghb_array_get_nth(chapters, ii));
+ ghb_get_chapter_duration(titleindex, ii, &hh, &mm, &ss);
+ duration = g_strdup_printf("%02d:%02d:%02d", hh, mm, ss);
+ gtk_list_store_set(store, &iter,
+ 0, ii+1,
+ 1, duration,
+ 2, chapter,
+ 3, TRUE,
+ -1);
+ g_free(chapter);
+ g_free(duration);
+ ii++;
+ done = !gtk_tree_model_iter_next(GTK_TREE_MODEL(store), &iter);
+ }
+ else
+ {
+ // No more settings data, remove row
+ g_debug("Removing row");
+ done = !gtk_list_store_remove(store, &iter);
+ }
+ } while (!done);
+ }
+ while (ii < count)
+ {
+ gchar *chapter, *duration;
+ gint hh, mm, ss;
+
+ // Additional settings, add row
+ g_debug("Adding row");
+ chapter = ghb_value_string(ghb_array_get_nth(chapters, ii));
+ ghb_get_chapter_duration(titleindex, ii, &hh, &mm, &ss);
+ duration = g_strdup_printf("%02d:%02d:%02d", hh, mm, ss);
+ gtk_list_store_append(store, &iter);
+ gtk_list_store_set(store, &iter,
+ 0, ii+1,
+ 1, duration,
+ 2, chapter,
+ 3, TRUE,
+ -1);
+ g_free(chapter);
+ g_free(duration);
+ ii++;
+ }
}
static void
update_chapter_list_settings(GValue *settings)
{
- GValue *chapters;
- gint titleindex;
-
- g_debug("update_chapter_list_settings ()");
- titleindex = ghb_settings_get_int(settings, "title_no");
- chapters = ghb_get_chapters(titleindex);
- if (chapters)
- ghb_settings_set_value(settings, "chapter_list", chapters);
+ GValue *chapters;
+ gint titleindex;
+
+ g_debug("update_chapter_list_settings ()");
+ titleindex = ghb_settings_get_int(settings, "title_no");
+ chapters = ghb_get_chapters(titleindex);
+ if (chapters)
+ ghb_settings_set_value(settings, "chapter_list", chapters);
}
static void
update_chapter_list_from_settings(GtkBuilder *builder, GValue *settings)
{
- GtkTreeView *treeview;
- GtkTreeIter iter;
- GtkListStore *store;
- gboolean done;
- GValue *chapters;
- gint titleindex, ii;
- gint count;
-
- g_debug("update_chapter_list ()");
- titleindex = ghb_settings_get_int(settings, "title_no");
- chapters = ghb_settings_get_value(settings, "chapter_list");
- count = ghb_array_len(chapters);
-
- treeview = GTK_TREE_VIEW(GHB_WIDGET(builder, "chapters_list"));
- store = GTK_LIST_STORE(gtk_tree_view_get_model(treeview));
- ii = 0;
- if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(store), &iter))
- {
- do
- {
-
- if (ii < count)
- {
- gchar *chapter, *duration;
- gint hh, mm, ss;
-
- // Update row with settings data
- g_debug("Updating row");
- chapter = ghb_value_string(ghb_array_get_nth(chapters, ii));
- ghb_get_chapter_duration(titleindex, ii, &hh, &mm, &ss);
- duration = g_strdup_printf("%02d:%02d:%02d", hh, mm, ss);
- gtk_list_store_set(store, &iter,
- 0, ii+1,
- 1, duration,
- 2, chapter,
- 3, TRUE,
- -1);
- g_free(chapter);
- g_free(duration);
- ii++;
- done = !gtk_tree_model_iter_next(GTK_TREE_MODEL(store), &iter);
- }
- else
- {
- // No more settings data, remove row
- g_debug("Removing row");
- done = !gtk_list_store_remove(store, &iter);
- }
- } while (!done);
- }
- while (ii < count)
- {
- gchar *chapter, *duration;
- gint hh, mm, ss;
-
- // Additional settings, add row
- g_debug("Adding row");
- chapter = ghb_value_string(ghb_array_get_nth(chapters, ii));
- ghb_get_chapter_duration(titleindex, ii, &hh, &mm, &ss);
- duration = g_strdup_printf("%02d:%02d:%02d", hh, mm, ss);
- gtk_list_store_append(store, &iter);
- gtk_list_store_set(store, &iter,
- 0, ii+1,
- 1, duration,
- 2, chapter,
- 3, TRUE,
- -1);
- g_free(chapter);
- g_free(duration);
- ii++;
- }
+ GtkTreeView *treeview;
+ GtkTreeIter iter;
+ GtkListStore *store;
+ gboolean done;
+ GValue *chapters;
+ gint titleindex, ii;
+ gint count;
+
+ g_debug("update_chapter_list ()");
+ titleindex = ghb_settings_get_int(settings, "title_no");
+ chapters = ghb_settings_get_value(settings, "chapter_list");
+ count = ghb_array_len(chapters);
+
+ treeview = GTK_TREE_VIEW(GHB_WIDGET(builder, "chapters_list"));
+ store = GTK_LIST_STORE(gtk_tree_view_get_model(treeview));
+ ii = 0;
+ if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(store), &iter))
+ {
+ do
+ {
+
+ if (ii < count)
+ {
+ gchar *chapter, *duration;
+ gint hh, mm, ss;
+
+ // Update row with settings data
+ g_debug("Updating row");
+ chapter = ghb_value_string(ghb_array_get_nth(chapters, ii));
+ ghb_get_chapter_duration(titleindex, ii, &hh, &mm, &ss);
+ duration = g_strdup_printf("%02d:%02d:%02d", hh, mm, ss);
+ gtk_list_store_set(store, &iter,
+ 0, ii+1,
+ 1, duration,
+ 2, chapter,
+ 3, TRUE,
+ -1);
+ g_free(chapter);
+ g_free(duration);
+ ii++;
+ done = !gtk_tree_model_iter_next(GTK_TREE_MODEL(store), &iter);
+ }
+ else
+ {
+ // No more settings data, remove row
+ g_debug("Removing row");
+ done = !gtk_list_store_remove(store, &iter);
+ }
+ } while (!done);
+ }
+ while (ii < count)
+ {
+ gchar *chapter, *duration;
+ gint hh, mm, ss;
+
+ // Additional settings, add row
+ g_debug("Adding row");
+ chapter = ghb_value_string(ghb_array_get_nth(chapters, ii));
+ ghb_get_chapter_duration(titleindex, ii, &hh, &mm, &ss);
+ duration = g_strdup_printf("%02d:%02d:%02d", hh, mm, ss);
+ gtk_list_store_append(store, &iter);
+ gtk_list_store_set(store, &iter,
+ 0, ii+1,
+ 1, duration,
+ 2, chapter,
+ 3, TRUE,
+ -1);
+ g_free(chapter);
+ g_free(duration);
+ ii++;
+ }
}
static gint chapter_edit_key = 0;
G_MODULE_EXPORT gboolean
chapter_keypress_cb(
- GhbCellRendererText *cell,
- GdkEventKey *event,
- signal_user_data_t *ud)
+ GhbCellRendererText *cell,
+ GdkEventKey *event,
+ signal_user_data_t *ud)
{
- chapter_edit_key = event->keyval;
- return FALSE;
+ chapter_edit_key = event->keyval;
+ return FALSE;
}
G_MODULE_EXPORT void
chapter_edited_cb(
- GhbCellRendererText *cell,
- gchar *path,
- gchar *text,
- signal_user_data_t *ud)
-{
- GtkTreePath *treepath;
- GtkListStore *store;
- GtkTreeView *treeview;
- GtkTreeIter iter;
- gint index;
- gint *pi;
- gint row;
-
- g_debug("chapter_edited_cb ()");
- g_debug("path (%s)", path);
- g_debug("text (%s)", text);
- treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "chapters_list"));
- store = GTK_LIST_STORE(gtk_tree_view_get_model(treeview));
- treepath = gtk_tree_path_new_from_string (path);
- pi = gtk_tree_path_get_indices(treepath);
- row = pi[0];
- gtk_tree_model_get_iter(GTK_TREE_MODEL(store), &iter, treepath);
- gtk_list_store_set(store, &iter,
- 2, text,
- 3, TRUE,
- -1);
- gtk_tree_model_get(GTK_TREE_MODEL(store), &iter, 0, &index, -1);
-
- const GValue *chapters;
- GValue *chapter;
-
- chapters = ghb_settings_get_value(ud->settings, "chapter_list");
- chapter = ghb_array_get_nth(chapters, index-1);
- g_value_set_string(chapter, text);
- if ((chapter_edit_key == GDK_KEY_Return || chapter_edit_key == GDK_KEY_Down) &&
- gtk_tree_model_iter_next(GTK_TREE_MODEL(store), &iter))
- {
- GtkTreeViewColumn *column;
-
- gtk_tree_path_next(treepath);
- // When a cell has been edited, I want to advance to the
- // next cell and start editing it automaitcally.
- // Unfortunately, we may not be in a state here where
- // editing is allowed. This happens when the user selects
- // a new cell with the mouse instead of just hitting enter.
- // Some kind of Gtk quirk. widget_editable==NULL assertion.
- // Editing is enabled again once the selection event has been
- // processed. So I'm queueing up a callback to be called
- // when things go idle. There, I will advance to the next
- // cell and initiate editing.
- //
- // Now, you might be asking why I don't catch the keypress
- // event and determine what action to take based on that.
- // The Gtk developers in their infinite wisdom have made the
- // actual GtkEdit widget being used a private member of
- // GtkCellRendererText, so it can not be accessed to hang a
- // signal handler off of. And they also do not propagate the
- // keypress signals in any other way. So that information is lost.
- //g_idle_add((GSourceFunc)next_cell, ud);
- //
- // Keeping the above comment for posterity.
- // I got industrious and made my own CellTextRendererText that
- // passes on the key-press-event. So now I have much better
- // control of this.
- column = gtk_tree_view_get_column(treeview, 2);
- gtk_tree_view_set_cursor(treeview, treepath, column, TRUE);
- }
- else if (chapter_edit_key == GDK_KEY_Up && row > 0)
- {
- GtkTreeViewColumn *column;
- gtk_tree_path_prev(treepath);
- column = gtk_tree_view_get_column(treeview, 2);
- gtk_tree_view_set_cursor(treeview, treepath, column, TRUE);
- }
- gtk_tree_path_free (treepath);
+ GhbCellRendererText *cell,
+ gchar *path,
+ gchar *text,
+ signal_user_data_t *ud)
+{
+ GtkTreePath *treepath;
+ GtkListStore *store;
+ GtkTreeView *treeview;
+ GtkTreeIter iter;
+ gint index;
+ gint *pi;
+ gint row;
+
+ g_debug("chapter_edited_cb ()");
+ g_debug("path (%s)", path);
+ g_debug("text (%s)", text);
+ treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "chapters_list"));
+ store = GTK_LIST_STORE(gtk_tree_view_get_model(treeview));
+ treepath = gtk_tree_path_new_from_string (path);
+ pi = gtk_tree_path_get_indices(treepath);
+ row = pi[0];
+ gtk_tree_model_get_iter(GTK_TREE_MODEL(store), &iter, treepath);
+ gtk_list_store_set(store, &iter,
+ 2, text,
+ 3, TRUE,
+ -1);
+ gtk_tree_model_get(GTK_TREE_MODEL(store), &iter, 0, &index, -1);
+
+ const GValue *chapters;
+ GValue *chapter;
+
+ chapters = ghb_settings_get_value(ud->settings, "chapter_list");
+ chapter = ghb_array_get_nth(chapters, index-1);
+ g_value_set_string(chapter, text);
+ if ((chapter_edit_key == GDK_KEY_Return || chapter_edit_key == GDK_KEY_Down) &&
+ gtk_tree_model_iter_next(GTK_TREE_MODEL(store), &iter))
+ {
+ GtkTreeViewColumn *column;
+
+ gtk_tree_path_next(treepath);
+ // When a cell has been edited, I want to advance to the
+ // next cell and start editing it automaitcally.
+ // Unfortunately, we may not be in a state here where
+ // editing is allowed. This happens when the user selects
+ // a new cell with the mouse instead of just hitting enter.
+ // Some kind of Gtk quirk. widget_editable==NULL assertion.
+ // Editing is enabled again once the selection event has been
+ // processed. So I'm queueing up a callback to be called
+ // when things go idle. There, I will advance to the next
+ // cell and initiate editing.
+ //
+ // Now, you might be asking why I don't catch the keypress
+ // event and determine what action to take based on that.
+ // The Gtk developers in their infinite wisdom have made the
+ // actual GtkEdit widget being used a private member of
+ // GtkCellRendererText, so it can not be accessed to hang a
+ // signal handler off of. And they also do not propagate the
+ // keypress signals in any other way. So that information is lost.
+ //g_idle_add((GSourceFunc)next_cell, ud);
+ //
+ // Keeping the above comment for posterity.
+ // I got industrious and made my own CellTextRendererText that
+ // passes on the key-press-event. So now I have much better
+ // control of this.
+ column = gtk_tree_view_get_column(treeview, 2);
+ gtk_tree_view_set_cursor(treeview, treepath, column, TRUE);
+ }
+ else if (chapter_edit_key == GDK_KEY_Up && row > 0)
+ {
+ GtkTreeViewColumn *column;
+ gtk_tree_path_prev(treepath);
+ column = gtk_tree_view_get_column(treeview, 2);
+ gtk_tree_view_set_cursor(treeview, treepath, column, TRUE);
+ }
+ gtk_tree_path_free (treepath);
}
void
debug_log_handler(const gchar *domain, GLogLevelFlags flags, const gchar *msg, gpointer data)
{
- signal_user_data_t *ud = (signal_user_data_t*)data;
-
- if (ud->debug)
- {
- printf("%s: %s\n", domain, msg);
- }
+ signal_user_data_t *ud = (signal_user_data_t*)data;
+
+ if (ud->debug)
+ {
+ printf("%s: %s\n", domain, msg);
+ }
}
void
warn_log_handler(const gchar *domain, GLogLevelFlags flags, const gchar *msg, gpointer data)
{
- printf("%s: %s\n", domain, msg);
+ printf("%s: %s\n", domain, msg);
}
void
ghb_hbfd(signal_user_data_t *ud, gboolean hbfd)
{
- GtkWidget *widget;
- g_debug("ghb_hbfd");
- widget = GHB_WIDGET(ud->builder, "queue_pause1");
- set_visible(widget, !hbfd);
- widget = GHB_WIDGET(ud->builder, "queue_add");
- set_visible(widget, !hbfd);
- widget = GHB_WIDGET(ud->builder, "show_queue");
- set_visible(widget, !hbfd);
- widget = GHB_WIDGET(ud->builder, "show_activity");
- set_visible(widget, !hbfd);
-
- widget = GHB_WIDGET(ud->builder, "chapter_box");
- set_visible(widget, !hbfd);
- widget = GHB_WIDGET(ud->builder, "container_box");
- set_visible(widget, !hbfd);
- widget = GHB_WIDGET(ud->builder, "SettingsNotebook");
- set_visible(widget, !hbfd);
- widget = GHB_WIDGET(ud->builder, "presets_save");
- set_visible(widget, !hbfd);
- widget = GHB_WIDGET(ud->builder, "presets_remove");
- set_visible(widget, !hbfd);
- widget = GHB_WIDGET (ud->builder, "hb_window");
- gtk_window_resize(GTK_WINDOW(widget), 16, 16);
+ GtkWidget *widget;
+ g_debug("ghb_hbfd");
+ widget = GHB_WIDGET(ud->builder, "queue_pause1");
+ set_visible(widget, !hbfd);
+ widget = GHB_WIDGET(ud->builder, "queue_add");
+ set_visible(widget, !hbfd);
+ widget = GHB_WIDGET(ud->builder, "show_queue");
+ set_visible(widget, !hbfd);
+ widget = GHB_WIDGET(ud->builder, "show_activity");
+ set_visible(widget, !hbfd);
+
+ widget = GHB_WIDGET(ud->builder, "chapter_box");
+ set_visible(widget, !hbfd);
+ widget = GHB_WIDGET(ud->builder, "container_box");
+ set_visible(widget, !hbfd);
+ widget = GHB_WIDGET(ud->builder, "SettingsNotebook");
+ set_visible(widget, !hbfd);
+ widget = GHB_WIDGET(ud->builder, "presets_save");
+ set_visible(widget, !hbfd);
+ widget = GHB_WIDGET(ud->builder, "presets_remove");
+ set_visible(widget, !hbfd);
+ widget = GHB_WIDGET (ud->builder, "hb_window");
+ gtk_window_resize(GTK_WINDOW(widget), 16, 16);
}
G_MODULE_EXPORT void
hbfd_toggled_cb(GtkWidget *widget, signal_user_data_t *ud)
{
- g_debug("hbfd_toggled_cb");
- ghb_widget_to_setting (ud->settings, widget);
- gboolean hbfd = ghb_settings_get_boolean(ud->settings, "hbfd");
- ghb_hbfd(ud, hbfd);
- ghb_pref_save(ud->settings, "hbfd");
+ g_debug("hbfd_toggled_cb");
+ ghb_widget_to_setting (ud->settings, widget);
+ gboolean hbfd = ghb_settings_get_boolean(ud->settings, "hbfd");
+ ghb_hbfd(ud, hbfd);
+ ghb_pref_save(ud->settings, "hbfd");
}
G_MODULE_EXPORT void
advanced_audio_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
{
- g_debug("advanced_audio_changed_cb");
- ghb_widget_to_setting (ud->settings, widget);
- ghb_check_dependency(ud, widget, NULL);
- const gchar *name = ghb_get_setting_key(widget);
- ghb_pref_save(ud->settings, name);
- ghb_show_hide_advanced_audio( ud );
+ g_debug("advanced_audio_changed_cb");
+ ghb_widget_to_setting (ud->settings, widget);
+ ghb_check_dependency(ud, widget, NULL);
+ const gchar *name = ghb_get_setting_key(widget);
+ ghb_pref_save(ud->settings, name);
+ ghb_show_hide_advanced_audio( ud );
}
G_MODULE_EXPORT void
advanced_video_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
{
- g_debug("advanced_video_changed_cb");
- ghb_widget_to_setting (ud->settings, widget);
- ghb_check_dependency(ud, widget, NULL);
- const gchar *name = ghb_get_setting_key(widget);
- ghb_pref_save(ud->settings, name);
- ghb_show_hide_advanced_video( ud );
+ g_debug("advanced_video_changed_cb");
+ ghb_widget_to_setting (ud->settings, widget);
+ ghb_check_dependency(ud, widget, NULL);
+ const gchar *name = ghb_get_setting_key(widget);
+ ghb_pref_save(ud->settings, name);
+ ghb_show_hide_advanced_video( ud );
}
G_MODULE_EXPORT void
pref_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
{
- g_debug("pref_changed_cb");
- ghb_widget_to_setting (ud->settings, widget);
- ghb_check_dependency(ud, widget, NULL);
- const gchar *name = ghb_get_setting_key(widget);
- ghb_pref_save(ud->settings, name);
+ g_debug("pref_changed_cb");
+ ghb_widget_to_setting (ud->settings, widget);
+ ghb_check_dependency(ud, widget, NULL);
+ const gchar *name = ghb_get_setting_key(widget);
+ ghb_pref_save(ud->settings, name);
}
G_MODULE_EXPORT void
use_m4v_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
{
- g_debug("use_m4v_changed_cb");
- ghb_widget_to_setting (ud->settings, widget);
- ghb_check_dependency(ud, widget, NULL);
- const gchar *name = ghb_get_setting_key(widget);
- ghb_pref_save(ud->settings, name);
- ghb_update_destination_extension(ud);
+ g_debug("use_m4v_changed_cb");
+ ghb_widget_to_setting (ud->settings, widget);
+ ghb_check_dependency(ud, widget, NULL);
+ const gchar *name = ghb_get_setting_key(widget);
+ ghb_pref_save(ud->settings, name);
+ ghb_update_destination_extension(ud);
}
G_MODULE_EXPORT void
show_status_cb(GtkWidget *widget, signal_user_data_t *ud)
{
- g_debug("show_status_cb");
- ghb_widget_to_setting (ud->settings, widget);
- ghb_check_dependency(ud, widget, NULL);
- const gchar *name = ghb_get_setting_key(widget);
- ghb_pref_save(ud->settings, name);
+ g_debug("show_status_cb");
+ ghb_widget_to_setting (ud->settings, widget);
+ ghb_check_dependency(ud, widget, NULL);
+ const gchar *name = ghb_get_setting_key(widget);
+ ghb_pref_save(ud->settings, name);
#if defined(_USE_APP_IND)
if (ud->ai)
@@ -3844,122 +3844,122 @@ show_status_cb(GtkWidget *widget, signal_user_data_t *ud)
}
}
#else
- GtkStatusIcon *si;
+ GtkStatusIcon *si;
- si = GTK_STATUS_ICON(GHB_OBJECT (ud->builder, "hb_status"));
- gtk_status_icon_set_visible(si,
- ghb_settings_get_boolean(ud->settings, "show_status"));
+ si = GTK_STATUS_ICON(GHB_OBJECT (ud->builder, "hb_status"));
+ gtk_status_icon_set_visible(si,
+ ghb_settings_get_boolean(ud->settings, "show_status"));
#endif
}
G_MODULE_EXPORT void
vqual_granularity_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
{
- g_debug("vqual_granularity_changed_cb");
- ghb_widget_to_setting (ud->settings, widget);
- ghb_check_dependency(ud, widget, NULL);
+ g_debug("vqual_granularity_changed_cb");
+ ghb_widget_to_setting (ud->settings, widget);
+ ghb_check_dependency(ud, widget, NULL);
- const gchar *name = ghb_get_setting_key(widget);
- ghb_pref_save(ud->settings, name);
+ const gchar *name = ghb_get_setting_key(widget);
+ ghb_pref_save(ud->settings, name);
- gdouble vqmin, vqmax, step, page;
- gboolean inverted;
- gint digits;
+ gdouble vqmin, vqmax, step, page;
+ gboolean inverted;
+ gint digits;
- ghb_vquality_range(ud, &vqmin, &vqmax, &step, &page, &digits, &inverted);
- GtkWidget *qp = GHB_WIDGET(ud->builder, "VideoQualitySlider");
- gtk_range_set_increments (GTK_RANGE(qp), step, page);
+ ghb_vquality_range(ud, &vqmin, &vqmax, &step, &page, &digits, &inverted);
+ GtkWidget *qp = GHB_WIDGET(ud->builder, "VideoQualitySlider");
+ gtk_range_set_increments (GTK_RANGE(qp), step, page);
}
G_MODULE_EXPORT void
tweaks_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
{
- g_debug("tweaks_changed_cb");
- ghb_widget_to_setting (ud->settings, widget);
- const gchar *name = ghb_get_setting_key(widget);
- ghb_pref_save(ud->settings, name);
+ g_debug("tweaks_changed_cb");
+ ghb_widget_to_setting (ud->settings, widget);
+ const gchar *name = ghb_get_setting_key(widget);
+ ghb_pref_save(ud->settings, name);
}
G_MODULE_EXPORT void
hbfd_feature_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
{
- g_debug("hbfd_feature_changed_cb");
- ghb_widget_to_setting (ud->settings, widget);
- const gchar *name = ghb_get_setting_key(widget);
- ghb_pref_save(ud->settings, name);
+ g_debug("hbfd_feature_changed_cb");
+ ghb_widget_to_setting (ud->settings, widget);
+ const gchar *name = ghb_get_setting_key(widget);
+ ghb_pref_save(ud->settings, name);
- gboolean hbfd = ghb_settings_get_boolean(ud->settings, "hbfd_feature");
- GtkAction *action;
- if (hbfd)
- {
- const GValue *val;
- val = ghb_settings_get_value(ud->settings, "hbfd");
- ghb_ui_update(ud, "hbfd", val);
- }
- action = GHB_ACTION (ud->builder, "hbfd");
- gtk_action_set_visible(action, hbfd);
+ gboolean hbfd = ghb_settings_get_boolean(ud->settings, "hbfd_feature");
+ GtkAction *action;
+ if (hbfd)
+ {
+ const GValue *val;
+ val = ghb_settings_get_value(ud->settings, "hbfd");
+ ghb_ui_update(ud, "hbfd", val);
+ }
+ action = GHB_ACTION (ud->builder, "hbfd");
+ gtk_action_set_visible(action, hbfd);
}
gboolean
ghb_file_menu_add_dvd(signal_user_data_t *ud)
{
- GList *link, *drives;
- static GtkActionGroup *agroup = NULL;
- static gint merge_id;
-
- g_debug("ghb_file_menu_add_dvd()");
- link = drives = dvd_device_list();
- if (drives != NULL)
- {
- GtkUIManager *ui = GTK_UI_MANAGER(
- gtk_builder_get_object(ud->builder, "uimanager1"));
-
- if (agroup == NULL)
- {
- agroup = gtk_action_group_new("dvdgroup");
- gtk_ui_manager_insert_action_group(ui, agroup, 0);
- }
- else
- gtk_ui_manager_remove_ui(ui, merge_id);
-
- merge_id = gtk_ui_manager_new_merge_id(ui);
- // Add separator
- gtk_ui_manager_add_ui(ui, merge_id,
- "ui/menubar1/menuitem1/quit1", "dvdsep", NULL,
- GTK_UI_MANAGER_SEPARATOR, TRUE);
-
- while (link != NULL)
- {
- GtkAction *action;
- gchar *drive = get_dvd_device_name(link->data);
- gchar *name = get_dvd_volume_name(link->data);
-
- action = gtk_action_group_get_action(agroup, drive);
- if (action != NULL)
- {
- gtk_action_group_remove_action(agroup, action);
- g_object_unref(G_OBJECT(action));
- }
- // Create action for this drive
- action = gtk_action_new(drive, name,
- "Scan this DVD source", "gtk-cdrom");
- // Add action to action group
- gtk_action_group_add_action_with_accel(agroup, action, NULL);
- // Add to ui manager
- gtk_ui_manager_add_ui(ui, merge_id,
- "ui/menubar1/menuitem1/dvdsep", drive, drive,
- GTK_UI_MANAGER_AUTO, TRUE);
- // Connect signal to action (menu item)
- g_signal_connect(action, "activate",
- (GCallback)dvd_source_activate_cb, ud);
- g_free(name);
- g_free(drive);
- free_drive(link->data);
- link = link->next;
- }
- g_list_free(drives);
- }
- return FALSE;
+ GList *link, *drives;
+ static GtkActionGroup *agroup = NULL;
+ static gint merge_id;
+
+ g_debug("ghb_file_menu_add_dvd()");
+ link = drives = dvd_device_list();
+ if (drives != NULL)
+ {
+ GtkUIManager *ui = GTK_UI_MANAGER(
+ gtk_builder_get_object(ud->builder, "uimanager1"));
+
+ if (agroup == NULL)
+ {
+ agroup = gtk_action_group_new("dvdgroup");
+ gtk_ui_manager_insert_action_group(ui, agroup, 0);
+ }
+ else
+ gtk_ui_manager_remove_ui(ui, merge_id);
+
+ merge_id = gtk_ui_manager_new_merge_id(ui);
+ // Add separator
+ gtk_ui_manager_add_ui(ui, merge_id,
+ "ui/menubar1/menuitem1/quit1", "dvdsep", NULL,
+ GTK_UI_MANAGER_SEPARATOR, TRUE);
+
+ while (link != NULL)
+ {
+ GtkAction *action;
+ gchar *drive = get_dvd_device_name(link->data);
+ gchar *name = get_dvd_volume_name(link->data);
+
+ action = gtk_action_group_get_action(agroup, drive);
+ if (action != NULL)
+ {
+ gtk_action_group_remove_action(agroup, action);
+ g_object_unref(G_OBJECT(action));
+ }
+ // Create action for this drive
+ action = gtk_action_new(drive, name,
+ "Scan this DVD source", "gtk-cdrom");
+ // Add action to action group
+ gtk_action_group_add_action_with_accel(agroup, action, NULL);
+ // Add to ui manager
+ gtk_ui_manager_add_ui(ui, merge_id,
+ "ui/menubar1/menuitem1/dvdsep", drive, drive,
+ GTK_UI_MANAGER_AUTO, TRUE);
+ // Connect signal to action (menu item)
+ g_signal_connect(action, "activate",
+ (GCallback)dvd_source_activate_cb, ud);
+ g_free(name);
+ g_free(drive);
+ free_drive(link->data);
+ link = link->next;
+ }
+ g_list_free(drives);
+ }
+ return FALSE;
}
gboolean ghb_is_cd(GDrive *gd);
@@ -3967,54 +3967,54 @@ gboolean ghb_is_cd(GDrive *gd);
static GList*
dvd_device_list()
{
- GList *dvd_devices = NULL;
+ GList *dvd_devices = NULL;
#if defined(_WIN32)
- gint ii, drives;
- gchar drive[5];
-
- strcpy(drive, "A:" G_DIR_SEPARATOR_S);
- drives = GetLogicalDrives();
- for (ii = 0; ii < 26; ii++)
- {
- if (drives & 0x01)
- {
- guint dtype;
-
- drive[0] = 'A' + ii;
- dtype = GetDriveType(drive);
- if (dtype == DRIVE_CDROM)
- {
- dvd_devices = g_list_append(dvd_devices,
- (gpointer)g_strdup(drive));
- }
- }
- drives >>= 1;
- }
+ gint ii, drives;
+ gchar drive[5];
+
+ strcpy(drive, "A:" G_DIR_SEPARATOR_S);
+ drives = GetLogicalDrives();
+ for (ii = 0; ii < 26; ii++)
+ {
+ if (drives & 0x01)
+ {
+ guint dtype;
+
+ drive[0] = 'A' + ii;
+ dtype = GetDriveType(drive);
+ if (dtype == DRIVE_CDROM)
+ {
+ dvd_devices = g_list_append(dvd_devices,
+ (gpointer)g_strdup(drive));
+ }
+ }
+ drives >>= 1;
+ }
#else
- GVolumeMonitor *gvm;
- GList *drives, *link;
-
- gvm = g_volume_monitor_get ();
- drives = g_volume_monitor_get_connected_drives (gvm);
- link = drives;
- while (link != NULL)
- {
- GDrive *gd;
-
- gd = (GDrive*)link->data;
- if (ghb_is_cd(gd))
- {
- dvd_devices = g_list_append(dvd_devices, gd);
- }
- else
- g_object_unref (gd);
- link = link->next;
- }
- g_list_free(drives);
+ GVolumeMonitor *gvm;
+ GList *drives, *link;
+
+ gvm = g_volume_monitor_get ();
+ drives = g_volume_monitor_get_connected_drives (gvm);
+ link = drives;
+ while (link != NULL)
+ {
+ GDrive *gd;
+
+ gd = (GDrive*)link->data;
+ if (ghb_is_cd(gd))
+ {
+ dvd_devices = g_list_append(dvd_devices, gd);
+ }
+ else
+ g_object_unref (gd);
+ link = link->next;
+ }
+ g_list_free(drives);
#endif
- return dvd_devices;
+ return dvd_devices;
}
#if defined(__linux__)
@@ -4025,33 +4025,33 @@ gboolean
ghb_is_cd(GDrive *gd)
{
#if defined(__linux__)
- gchar *device;
- GUdevDevice *udd;
+ gchar *device;
+ GUdevDevice *udd;
- if (udev_ctx == NULL)
- return FALSE;
+ if (udev_ctx == NULL)
+ return FALSE;
- device = g_drive_get_identifier(gd, G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE);
- if (device == NULL)
- return FALSE;
+ device = g_drive_get_identifier(gd, G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE);
+ if (device == NULL)
+ return FALSE;
- udd = g_udev_client_query_by_device_file(udev_ctx, device);
- g_free(device);
+ udd = g_udev_client_query_by_device_file(udev_ctx, device);
+ g_free(device);
- if (udd == NULL)
- {
- g_message("udev: Failed to lookup device %s", device);
- return FALSE;
- }
+ if (udd == NULL)
+ {
+ g_message("udev: Failed to lookup device %s", device);
+ return FALSE;
+ }
- gint val;
- val = g_udev_device_get_property_as_int(udd, "ID_CDROM_DVD");
- if (val == 1)
- return TRUE;
+ gint val;
+ val = g_udev_device_get_property_as_int(udd, "ID_CDROM_DVD");
+ if (val == 1)
+ return TRUE;
- return FALSE;
+ return FALSE;
#else
- return FALSE;
+ return FALSE;
#endif
}
@@ -4059,7 +4059,7 @@ void
ghb_udev_init()
{
#if defined(__linux__)
- udev_ctx = g_udev_client_new(NULL);
+ udev_ctx = g_udev_client_new(NULL);
#endif
}
@@ -4067,106 +4067,106 @@ ghb_udev_init()
static void
handle_media_change(const gchar *device, gboolean insert, signal_user_data_t *ud)
{
- guint dtype;
- static gint ins_count = 0;
- static gint rem_count = 0;
-
- // The media change event in windows bounces around a bit
- // so I debounce it here
- // DVD insertion detected. Scan it.
- dtype = GetDriveType(device);
- if (dtype != DRIVE_CDROM)
- return;
- if (insert)
- {
- rem_count = 0;
- ins_count++;
- if (ins_count == 2)
- {
- g_thread_create((GThreadFunc)ghb_cache_volnames, ud, FALSE, NULL);
- if (ghb_settings_get_boolean(ud->settings, "AutoScan") &&
- ud->current_dvd_device != NULL &&
- strcmp(device, ud->current_dvd_device) == 0)
- {
- show_scan_progress(ud);
- update_source_label(ud, device, TRUE);
- gint preview_count;
- preview_count = ghb_settings_get_int(ud->settings, "preview_count");
- ghb_settings_set_string(ud->settings, "scan_source", device);
- start_scan(ud, device, 0, preview_count);
- }
- }
- }
- else
- {
- ins_count = 0;
- rem_count++;
- if (rem_count == 2)
- {
- g_thread_create((GThreadFunc)ghb_cache_volnames, ud, FALSE, NULL);
- if (ud->current_dvd_device != NULL &&
- strcmp(device, ud->current_dvd_device) == 0)
- {
- ghb_hb_cleanup(TRUE);
- prune_logs(ud);
- ghb_settings_set_string(ud->settings, "scan_source", "/dev/null");
- start_scan(ud, "/dev/null", 0, 1);
- }
- }
- }
+ guint dtype;
+ static gint ins_count = 0;
+ static gint rem_count = 0;
+
+ // The media change event in windows bounces around a bit
+ // so I debounce it here
+ // DVD insertion detected. Scan it.
+ dtype = GetDriveType(device);
+ if (dtype != DRIVE_CDROM)
+ return;
+ if (insert)
+ {
+ rem_count = 0;
+ ins_count++;
+ if (ins_count == 2)
+ {
+ g_thread_create((GThreadFunc)ghb_cache_volnames, ud, FALSE, NULL);
+ if (ghb_settings_get_boolean(ud->settings, "AutoScan") &&
+ ud->current_dvd_device != NULL &&
+ strcmp(device, ud->current_dvd_device) == 0)
+ {
+ show_scan_progress(ud);
+ update_source_label(ud, device, TRUE);
+ gint preview_count;
+ preview_count = ghb_settings_get_int(ud->settings, "preview_count");
+ ghb_settings_set_string(ud->settings, "scan_source", device);
+ start_scan(ud, device, 0, preview_count);
+ }
+ }
+ }
+ else
+ {
+ ins_count = 0;
+ rem_count++;
+ if (rem_count == 2)
+ {
+ g_thread_create((GThreadFunc)ghb_cache_volnames, ud, FALSE, NULL);
+ if (ud->current_dvd_device != NULL &&
+ strcmp(device, ud->current_dvd_device) == 0)
+ {
+ ghb_hb_cleanup(TRUE);
+ prune_logs(ud);
+ ghb_settings_set_string(ud->settings, "scan_source", "/dev/null");
+ start_scan(ud, "/dev/null", 0, 1);
+ }
+ }
+ }
}
static gchar
FindDriveFromMask(ULONG unitmask)
{
- gchar cc;
- for (cc = 0; cc < 26; cc++)
- {
- if (unitmask & 0x01)
- return 'A' + cc;
- unitmask >>= 1;
- }
- return 0;
+ gchar cc;
+ for (cc = 0; cc < 26; cc++)
+ {
+ if (unitmask & 0x01)
+ return 'A' + cc;
+ unitmask >>= 1;
+ }
+ return 0;
}
void
wm_drive_changed(MSG *msg, signal_user_data_t *ud)
{
- PDEV_BROADCAST_HDR bch = (PDEV_BROADCAST_HDR)msg->lParam;
- gchar drive[4];
-
- g_strlcpy(drive, "A:" G_DIR_SEPARATOR_S, 4);
- switch (msg->wParam)
- {
- case DBT_DEVICEARRIVAL:
- {
- if (bch->dbch_devicetype == DBT_DEVTYP_VOLUME)
- {
- PDEV_BROADCAST_VOLUME bcv = (PDEV_BROADCAST_VOLUME)bch;
-
- if (bcv->dbcv_flags & DBTF_MEDIA)
- {
- drive[0] = FindDriveFromMask(bcv->dbcv_unitmask);
- handle_media_change(drive, TRUE, ud);
- }
- }
- } break;
-
- case DBT_DEVICEREMOVECOMPLETE:
- {
- if (bch->dbch_devicetype == DBT_DEVTYP_VOLUME)
- {
- PDEV_BROADCAST_VOLUME bcv = (PDEV_BROADCAST_VOLUME)bch;
-
- if (bcv->dbcv_flags & DBTF_MEDIA)
- {
- drive[0] = FindDriveFromMask(bcv->dbcv_unitmask);
- handle_media_change(drive, FALSE, ud);
- }
- }
- } break;
- default: ;
- }
+ PDEV_BROADCAST_HDR bch = (PDEV_BROADCAST_HDR)msg->lParam;
+ gchar drive[4];
+
+ g_strlcpy(drive, "A:" G_DIR_SEPARATOR_S, 4);
+ switch (msg->wParam)
+ {
+ case DBT_DEVICEARRIVAL:
+ {
+ if (bch->dbch_devicetype == DBT_DEVTYP_VOLUME)
+ {
+ PDEV_BROADCAST_VOLUME bcv = (PDEV_BROADCAST_VOLUME)bch;
+
+ if (bcv->dbcv_flags & DBTF_MEDIA)
+ {
+ drive[0] = FindDriveFromMask(bcv->dbcv_unitmask);
+ handle_media_change(drive, TRUE, ud);
+ }
+ }
+ } break;
+
+ case DBT_DEVICEREMOVECOMPLETE:
+ {
+ if (bch->dbch_devicetype == DBT_DEVTYP_VOLUME)
+ {
+ PDEV_BROADCAST_VOLUME bcv = (PDEV_BROADCAST_VOLUME)bch;
+
+ if (bcv->dbcv_flags & DBTF_MEDIA)
+ {
+ drive[0] = FindDriveFromMask(bcv->dbcv_unitmask);
+ handle_media_change(drive, FALSE, ud);
+ }
+ }
+ } break;
+ default: ;
+ }
}
#else
@@ -4174,48 +4174,48 @@ wm_drive_changed(MSG *msg, signal_user_data_t *ud)
G_MODULE_EXPORT void
drive_changed_cb(GVolumeMonitor *gvm, GDrive *gd, signal_user_data_t *ud)
{
- gchar *device;
- gint state;
-
- g_debug("drive_changed_cb()");
- g_thread_create((GThreadFunc)ghb_cache_volnames, ud, FALSE, NULL);
-
- state = ghb_get_scan_state();
- device = g_drive_get_identifier(gd, G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE);
- if (ud->current_dvd_device == NULL ||
- strcmp(device, ud->current_dvd_device) != 0 ||
- state != GHB_STATE_IDLE )
- {
- return;
- }
- if (g_drive_has_media(gd))
- {
- if (ghb_settings_get_boolean(ud->settings, "AutoScan"))
- {
- show_scan_progress(ud);
- update_source_label(ud, device, TRUE);
- gint preview_count;
- preview_count = ghb_settings_get_int(ud->settings, "preview_count");
- ghb_settings_set_string(ud->settings, "scan_source", device);
- start_scan(ud, device, 0, preview_count);
- }
- }
- else
- {
- ghb_hb_cleanup(TRUE);
- prune_logs(ud);
- ghb_settings_set_string(ud->settings, "scan_source", "/dev/null");
- start_scan(ud, "/dev/null", 0, 1);
- }
+ gchar *device;
+ gint state;
+
+ g_debug("drive_changed_cb()");
+ g_thread_create((GThreadFunc)ghb_cache_volnames, ud, FALSE, NULL);
+
+ state = ghb_get_scan_state();
+ device = g_drive_get_identifier(gd, G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE);
+ if (ud->current_dvd_device == NULL ||
+ strcmp(device, ud->current_dvd_device) != 0 ||
+ state != GHB_STATE_IDLE )
+ {
+ return;
+ }
+ if (g_drive_has_media(gd))
+ {
+ if (ghb_settings_get_boolean(ud->settings, "AutoScan"))
+ {
+ show_scan_progress(ud);
+ update_source_label(ud, device, TRUE);
+ gint preview_count;
+ preview_count = ghb_settings_get_int(ud->settings, "preview_count");
+ ghb_settings_set_string(ud->settings, "scan_source", device);
+ start_scan(ud, device, 0, preview_count);
+ }
+ }
+ else
+ {
+ ghb_hb_cleanup(TRUE);
+ prune_logs(ud);
+ ghb_settings_set_string(ud->settings, "scan_source", "/dev/null");
+ start_scan(ud, "/dev/null", 0, 1);
+ }
}
#endif
#if !defined(_WIN32)
-#define GPM_DBUS_PM_SERVICE "org.freedesktop.PowerManagement"
-#define GPM_DBUS_PM_PATH "/org/freedesktop/PowerManagement"
-#define GPM_DBUS_PM_INTERFACE "org.freedesktop.PowerManagement"
-#define GPM_DBUS_INHIBIT_PATH "/org/freedesktop/PowerManagement/Inhibit"
-#define GPM_DBUS_INHIBIT_INTERFACE "org.freedesktop.PowerManagement.Inhibit"
+#define GPM_DBUS_PM_SERVICE "org.freedesktop.PowerManagement"
+#define GPM_DBUS_PM_PATH "/org/freedesktop/PowerManagement"
+#define GPM_DBUS_PM_INTERFACE "org.freedesktop.PowerManagement"
+#define GPM_DBUS_INHIBIT_PATH "/org/freedesktop/PowerManagement/Inhibit"
+#define GPM_DBUS_INHIBIT_INTERFACE "org.freedesktop.PowerManagement.Inhibit"
static gboolean gpm_inhibited = FALSE;
static guint gpm_cookie = -1;
#endif
@@ -4223,93 +4223,93 @@ static guint gpm_cookie = -1;
static gboolean
ghb_can_suspend_gpm()
{
- gboolean can_suspend = FALSE;
+ gboolean can_suspend = FALSE;
#if !defined(_WIN32)
- DBusGConnection *conn;
- DBusGProxy *proxy;
- GError *error = NULL;
- gboolean res;
-
-
- g_debug("ghb_can_suspend_gpm()");
- conn = dbus_g_bus_get(DBUS_BUS_SESSION, &error);
- if (error != NULL)
- {
- g_warning("DBUS cannot connect: %s", error->message);
- g_error_free(error);
- return FALSE;
- }
- proxy = dbus_g_proxy_new_for_name(conn, GPM_DBUS_PM_SERVICE,
- GPM_DBUS_PM_PATH, GPM_DBUS_PM_INTERFACE);
- if (proxy == NULL)
- {
- g_warning("Could not get DBUS proxy: %s", GPM_DBUS_PM_SERVICE);
- dbus_g_connection_unref(conn);
- return FALSE;
- }
- res = dbus_g_proxy_call(proxy, "CanSuspend", &error,
- G_TYPE_INVALID,
- G_TYPE_BOOLEAN, &can_suspend,
- G_TYPE_INVALID);
- if (!res)
- {
- if (error != NULL)
- {
- g_warning("CanSuspend failed: %s", error->message);
- g_error_free(error);
- }
- else
- g_warning("CanSuspend failed");
- // Try to shutdown anyway
- can_suspend = TRUE;
- }
- g_object_unref(G_OBJECT(proxy));
- dbus_g_connection_unref(conn);
+ DBusGConnection *conn;
+ DBusGProxy *proxy;
+ GError *error = NULL;
+ gboolean res;
+
+
+ g_debug("ghb_can_suspend_gpm()");
+ conn = dbus_g_bus_get(DBUS_BUS_SESSION, &error);
+ if (error != NULL)
+ {
+ g_warning("DBUS cannot connect: %s", error->message);
+ g_error_free(error);
+ return FALSE;
+ }
+ proxy = dbus_g_proxy_new_for_name(conn, GPM_DBUS_PM_SERVICE,
+ GPM_DBUS_PM_PATH, GPM_DBUS_PM_INTERFACE);
+ if (proxy == NULL)
+ {
+ g_warning("Could not get DBUS proxy: %s", GPM_DBUS_PM_SERVICE);
+ dbus_g_connection_unref(conn);
+ return FALSE;
+ }
+ res = dbus_g_proxy_call(proxy, "CanSuspend", &error,
+ G_TYPE_INVALID,
+ G_TYPE_BOOLEAN, &can_suspend,
+ G_TYPE_INVALID);
+ if (!res)
+ {
+ if (error != NULL)
+ {
+ g_warning("CanSuspend failed: %s", error->message);
+ g_error_free(error);
+ }
+ else
+ g_warning("CanSuspend failed");
+ // Try to shutdown anyway
+ can_suspend = TRUE;
+ }
+ g_object_unref(G_OBJECT(proxy));
+ dbus_g_connection_unref(conn);
#endif
- return can_suspend;
+ return can_suspend;
}
static void
ghb_suspend_gpm()
{
#if !defined(_WIN32)
- DBusGConnection *conn;
- DBusGProxy *proxy;
- GError *error = NULL;
- gboolean res;
-
-
- g_debug("ghb_suspend_gpm()");
- conn = dbus_g_bus_get(DBUS_BUS_SESSION, &error);
- if (error != NULL)
- {
- g_warning("DBUS cannot connect: %s", error->message);
- g_error_free(error);
- return;
- }
- proxy = dbus_g_proxy_new_for_name(conn, GPM_DBUS_PM_SERVICE,
- GPM_DBUS_PM_PATH, GPM_DBUS_PM_INTERFACE);
- if (proxy == NULL)
- {
- g_warning("Could not get DBUS proxy: %s", GPM_DBUS_PM_SERVICE);
- dbus_g_connection_unref(conn);
- return;
- }
- res = dbus_g_proxy_call(proxy, "Suspend", &error,
- G_TYPE_INVALID,
- G_TYPE_INVALID);
- if (!res)
- {
- if (error != NULL)
- {
- g_warning("Suspend failed: %s", error->message);
- g_error_free(error);
- }
- else
- g_warning("Suspend failed");
- }
- g_object_unref(G_OBJECT(proxy));
- dbus_g_connection_unref(conn);
+ DBusGConnection *conn;
+ DBusGProxy *proxy;
+ GError *error = NULL;
+ gboolean res;
+
+
+ g_debug("ghb_suspend_gpm()");
+ conn = dbus_g_bus_get(DBUS_BUS_SESSION, &error);
+ if (error != NULL)
+ {
+ g_warning("DBUS cannot connect: %s", error->message);
+ g_error_free(error);
+ return;
+ }
+ proxy = dbus_g_proxy_new_for_name(conn, GPM_DBUS_PM_SERVICE,
+ GPM_DBUS_PM_PATH, GPM_DBUS_PM_INTERFACE);
+ if (proxy == NULL)
+ {
+ g_warning("Could not get DBUS proxy: %s", GPM_DBUS_PM_SERVICE);
+ dbus_g_connection_unref(conn);
+ return;
+ }
+ res = dbus_g_proxy_call(proxy, "Suspend", &error,
+ G_TYPE_INVALID,
+ G_TYPE_INVALID);
+ if (!res)
+ {
+ if (error != NULL)
+ {
+ g_warning("Suspend failed: %s", error->message);
+ g_error_free(error);
+ }
+ else
+ g_warning("Suspend failed");
+ }
+ g_object_unref(G_OBJECT(proxy));
+ dbus_g_connection_unref(conn);
#endif
}
@@ -4317,48 +4317,48 @@ ghb_suspend_gpm()
static gboolean
ghb_can_shutdown_gpm()
{
- gboolean can_shutdown = FALSE;
- DBusGConnection *conn;
- DBusGProxy *proxy;
- GError *error = NULL;
- gboolean res;
-
-
- g_debug("ghb_can_shutdown_gpm()");
- conn = dbus_g_bus_get(DBUS_BUS_SESSION, &error);
- if (error != NULL)
- {
- g_warning("DBUS cannot connect: %s", error->message);
- g_error_free(error);
- return FALSE;
- }
- proxy = dbus_g_proxy_new_for_name(conn, GPM_DBUS_PM_SERVICE,
- GPM_DBUS_PM_PATH, GPM_DBUS_PM_INTERFACE);
- if (proxy == NULL)
- {
- g_warning("Could not get DBUS proxy: %s", GPM_DBUS_PM_SERVICE);
- dbus_g_connection_unref(conn);
- return FALSE;
- }
- res = dbus_g_proxy_call(proxy, "CanShutdown", &error,
- G_TYPE_INVALID,
- G_TYPE_BOOLEAN, &can_shutdown,
- G_TYPE_INVALID);
- if (!res)
- {
- if (error != NULL)
- {
- g_warning("CanShutdown failed: %s", error->message);
- g_error_free(error);
- }
- else
- g_warning("CanShutdown failed");
- // Try to shutdown anyway
- can_shutdown = TRUE;
- }
- g_object_unref(G_OBJECT(proxy));
- dbus_g_connection_unref(conn);
- return can_shutdown;
+ gboolean can_shutdown = FALSE;
+ DBusGConnection *conn;
+ DBusGProxy *proxy;
+ GError *error = NULL;
+ gboolean res;
+
+
+ g_debug("ghb_can_shutdown_gpm()");
+ conn = dbus_g_bus_get(DBUS_BUS_SESSION, &error);
+ if (error != NULL)
+ {
+ g_warning("DBUS cannot connect: %s", error->message);
+ g_error_free(error);
+ return FALSE;
+ }
+ proxy = dbus_g_proxy_new_for_name(conn, GPM_DBUS_PM_SERVICE,
+ GPM_DBUS_PM_PATH, GPM_DBUS_PM_INTERFACE);
+ if (proxy == NULL)
+ {
+ g_warning("Could not get DBUS proxy: %s", GPM_DBUS_PM_SERVICE);
+ dbus_g_connection_unref(conn);
+ return FALSE;
+ }
+ res = dbus_g_proxy_call(proxy, "CanShutdown", &error,
+ G_TYPE_INVALID,
+ G_TYPE_BOOLEAN, &can_shutdown,
+ G_TYPE_INVALID);
+ if (!res)
+ {
+ if (error != NULL)
+ {
+ g_warning("CanShutdown failed: %s", error->message);
+ g_error_free(error);
+ }
+ else
+ g_warning("CanShutdown failed");
+ // Try to shutdown anyway
+ can_shutdown = TRUE;
+ }
+ g_object_unref(G_OBJECT(proxy));
+ dbus_g_connection_unref(conn);
+ return can_shutdown;
}
#endif
@@ -4366,43 +4366,43 @@ ghb_can_shutdown_gpm()
static void
ghb_shutdown_gpm()
{
- DBusGConnection *conn;
- DBusGProxy *proxy;
- GError *error = NULL;
- gboolean res;
-
-
- g_debug("ghb_shutdown_gpm()");
- conn = dbus_g_bus_get(DBUS_BUS_SESSION, &error);
- if (error != NULL)
- {
- g_warning("DBUS cannot connect: %s", error->message);
- g_error_free(error);
- return;
- }
- proxy = dbus_g_proxy_new_for_name(conn, GPM_DBUS_PM_SERVICE,
- GPM_DBUS_PM_PATH, GPM_DBUS_PM_INTERFACE);
- if (proxy == NULL)
- {
- g_warning("Could not get DBUS proxy: %s", GPM_DBUS_PM_SERVICE);
- dbus_g_connection_unref(conn);
- return;
- }
- res = dbus_g_proxy_call(proxy, "Shutdown", &error,
- G_TYPE_INVALID,
- G_TYPE_INVALID);
- if (!res)
- {
- if (error != NULL)
- {
- g_warning("Shutdown failed: %s", error->message);
- g_error_free(error);
- }
- else
- g_warning("Shutdown failed");
- }
- g_object_unref(G_OBJECT(proxy));
- dbus_g_connection_unref(conn);
+ DBusGConnection *conn;
+ DBusGProxy *proxy;
+ GError *error = NULL;
+ gboolean res;
+
+
+ g_debug("ghb_shutdown_gpm()");
+ conn = dbus_g_bus_get(DBUS_BUS_SESSION, &error);
+ if (error != NULL)
+ {
+ g_warning("DBUS cannot connect: %s", error->message);
+ g_error_free(error);
+ return;
+ }
+ proxy = dbus_g_proxy_new_for_name(conn, GPM_DBUS_PM_SERVICE,
+ GPM_DBUS_PM_PATH, GPM_DBUS_PM_INTERFACE);
+ if (proxy == NULL)
+ {
+ g_warning("Could not get DBUS proxy: %s", GPM_DBUS_PM_SERVICE);
+ dbus_g_connection_unref(conn);
+ return;
+ }
+ res = dbus_g_proxy_call(proxy, "Shutdown", &error,
+ G_TYPE_INVALID,
+ G_TYPE_INVALID);
+ if (!res)
+ {
+ if (error != NULL)
+ {
+ g_warning("Shutdown failed: %s", error->message);
+ g_error_free(error);
+ }
+ else
+ g_warning("Shutdown failed");
+ }
+ g_object_unref(G_OBJECT(proxy));
+ dbus_g_connection_unref(conn);
}
#endif
@@ -4410,55 +4410,55 @@ void
ghb_inhibit_gpm()
{
#if !defined(_WIN32)
- DBusGConnection *conn;
- DBusGProxy *proxy;
- GError *error = NULL;
- gboolean res;
-
-
- if (gpm_inhibited)
- {
- // Already inhibited
- return;
- }
- g_debug("ghb_inhibit_gpm()");
- conn = dbus_g_bus_get(DBUS_BUS_SESSION, &error);
- if (error != NULL)
- {
- g_warning("DBUS cannot connect: %s", error->message);
- g_error_free(error);
- return;
- }
- proxy = dbus_g_proxy_new_for_name(conn, GPM_DBUS_PM_SERVICE,
- GPM_DBUS_INHIBIT_PATH, GPM_DBUS_INHIBIT_INTERFACE);
- if (proxy == NULL)
- {
- g_warning("Could not get DBUS proxy: %s", GPM_DBUS_PM_SERVICE);
- dbus_g_connection_unref(conn);
- return;
- }
- res = dbus_g_proxy_call(proxy, "Inhibit", &error,
- G_TYPE_STRING, "ghb",
- G_TYPE_STRING, "Encoding",
- G_TYPE_INVALID,
- G_TYPE_UINT, &gpm_cookie,
- G_TYPE_INVALID);
- gpm_inhibited = TRUE;
- if (!res)
- {
- if (error != NULL)
- {
- g_warning("Inhibit failed: %s", error->message);
- g_error_free(error);
- gpm_cookie = -1;
- }
- else
- g_warning("Inhibit failed");
- gpm_cookie = -1;
- gpm_inhibited = FALSE;
- }
- g_object_unref(G_OBJECT(proxy));
- dbus_g_connection_unref(conn);
+ DBusGConnection *conn;
+ DBusGProxy *proxy;
+ GError *error = NULL;
+ gboolean res;
+
+
+ if (gpm_inhibited)
+ {
+ // Already inhibited
+ return;
+ }
+ g_debug("ghb_inhibit_gpm()");
+ conn = dbus_g_bus_get(DBUS_BUS_SESSION, &error);
+ if (error != NULL)
+ {
+ g_warning("DBUS cannot connect: %s", error->message);
+ g_error_free(error);
+ return;
+ }
+ proxy = dbus_g_proxy_new_for_name(conn, GPM_DBUS_PM_SERVICE,
+ GPM_DBUS_INHIBIT_PATH, GPM_DBUS_INHIBIT_INTERFACE);
+ if (proxy == NULL)
+ {
+ g_warning("Could not get DBUS proxy: %s", GPM_DBUS_PM_SERVICE);
+ dbus_g_connection_unref(conn);
+ return;
+ }
+ res = dbus_g_proxy_call(proxy, "Inhibit", &error,
+ G_TYPE_STRING, "ghb",
+ G_TYPE_STRING, "Encoding",
+ G_TYPE_INVALID,
+ G_TYPE_UINT, &gpm_cookie,
+ G_TYPE_INVALID);
+ gpm_inhibited = TRUE;
+ if (!res)
+ {
+ if (error != NULL)
+ {
+ g_warning("Inhibit failed: %s", error->message);
+ g_error_free(error);
+ gpm_cookie = -1;
+ }
+ else
+ g_warning("Inhibit failed");
+ gpm_cookie = -1;
+ gpm_inhibited = FALSE;
+ }
+ g_object_unref(G_OBJECT(proxy));
+ dbus_g_connection_unref(conn);
#endif
}
@@ -4466,150 +4466,150 @@ void
ghb_uninhibit_gpm()
{
#if !defined(_WIN32)
- DBusGConnection *conn;
- DBusGProxy *proxy;
- GError *error = NULL;
- gboolean res;
-
- g_debug("ghb_uninhibit_gpm() gpm_cookie %u", gpm_cookie);
-
- if (!gpm_inhibited)
- {
- // Not inhibited
- return;
- }
- conn = dbus_g_bus_get(DBUS_BUS_SESSION, &error);
- if (error != NULL)
- {
- g_warning("DBUS cannot connect: %s", error->message);
- g_error_free(error);
- return;
- }
- proxy = dbus_g_proxy_new_for_name(conn, GPM_DBUS_PM_SERVICE,
- GPM_DBUS_INHIBIT_PATH, GPM_DBUS_INHIBIT_INTERFACE);
- if (proxy == NULL)
- {
- g_warning("Could not get DBUS proxy: %s", GPM_DBUS_PM_SERVICE);
- dbus_g_connection_unref(conn);
- return;
- }
- res = dbus_g_proxy_call(proxy, "UnInhibit", &error,
- G_TYPE_UINT, gpm_cookie,
- G_TYPE_INVALID,
- G_TYPE_INVALID);
- if (!res)
- {
- if (error != NULL)
- {
- g_warning("UnInhibit failed: %s", error->message);
- g_error_free(error);
- }
- else
- g_warning("UnInhibit failed");
- }
- gpm_inhibited = FALSE;
- dbus_g_connection_unref(conn);
- g_object_unref(G_OBJECT(proxy));
+ DBusGConnection *conn;
+ DBusGProxy *proxy;
+ GError *error = NULL;
+ gboolean res;
+
+ g_debug("ghb_uninhibit_gpm() gpm_cookie %u", gpm_cookie);
+
+ if (!gpm_inhibited)
+ {
+ // Not inhibited
+ return;
+ }
+ conn = dbus_g_bus_get(DBUS_BUS_SESSION, &error);
+ if (error != NULL)
+ {
+ g_warning("DBUS cannot connect: %s", error->message);
+ g_error_free(error);
+ return;
+ }
+ proxy = dbus_g_proxy_new_for_name(conn, GPM_DBUS_PM_SERVICE,
+ GPM_DBUS_INHIBIT_PATH, GPM_DBUS_INHIBIT_INTERFACE);
+ if (proxy == NULL)
+ {
+ g_warning("Could not get DBUS proxy: %s", GPM_DBUS_PM_SERVICE);
+ dbus_g_connection_unref(conn);
+ return;
+ }
+ res = dbus_g_proxy_call(proxy, "UnInhibit", &error,
+ G_TYPE_UINT, gpm_cookie,
+ G_TYPE_INVALID,
+ G_TYPE_INVALID);
+ if (!res)
+ {
+ if (error != NULL)
+ {
+ g_warning("UnInhibit failed: %s", error->message);
+ g_error_free(error);
+ }
+ else
+ g_warning("UnInhibit failed");
+ }
+ gpm_inhibited = FALSE;
+ dbus_g_connection_unref(conn);
+ g_object_unref(G_OBJECT(proxy));
#endif
}
#if !defined(_WIN32)
// For inhibit and shutdown
-#define GPM_DBUS_SM_SERVICE "org.gnome.SessionManager"
-#define GPM_DBUS_SM_PATH "/org/gnome/SessionManager"
-#define GPM_DBUS_SM_INTERFACE "org.gnome.SessionManager"
+#define GPM_DBUS_SM_SERVICE "org.gnome.SessionManager"
+#define GPM_DBUS_SM_PATH "/org/gnome/SessionManager"
+#define GPM_DBUS_SM_INTERFACE "org.gnome.SessionManager"
#endif
static gboolean
ghb_can_shutdown_gsm()
{
- gboolean can_shutdown = FALSE;
+ gboolean can_shutdown = FALSE;
#if !defined(_WIN32)
- DBusGConnection *conn;
- DBusGProxy *proxy;
- GError *error = NULL;
- gboolean res;
-
-
- g_debug("ghb_can_shutdown_gpm()");
- conn = dbus_g_bus_get(DBUS_BUS_SESSION, &error);
- if (error != NULL)
- {
- g_warning("DBUS cannot connect: %s", error->message);
- g_error_free(error);
- return FALSE;
- }
- proxy = dbus_g_proxy_new_for_name(conn, GPM_DBUS_SM_SERVICE,
- GPM_DBUS_SM_PATH, GPM_DBUS_SM_INTERFACE);
- if (proxy == NULL)
- {
- g_warning("Could not get DBUS proxy: %s", GPM_DBUS_SM_SERVICE);
- dbus_g_connection_unref(conn);
- return FALSE;
- }
- res = dbus_g_proxy_call(proxy, "CanShutdown", &error,
- G_TYPE_INVALID,
- G_TYPE_BOOLEAN, &can_shutdown,
- G_TYPE_INVALID);
- g_object_unref(G_OBJECT(proxy));
- dbus_g_connection_unref(conn);
- if (!res)
- {
- if (error != NULL)
- {
- g_error_free(error);
- }
- // Try to shutdown anyway
- can_shutdown = TRUE;
- // Try the gpm version
- return ghb_can_shutdown_gpm();
- }
+ DBusGConnection *conn;
+ DBusGProxy *proxy;
+ GError *error = NULL;
+ gboolean res;
+
+
+ g_debug("ghb_can_shutdown_gpm()");
+ conn = dbus_g_bus_get(DBUS_BUS_SESSION, &error);
+ if (error != NULL)
+ {
+ g_warning("DBUS cannot connect: %s", error->message);
+ g_error_free(error);
+ return FALSE;
+ }
+ proxy = dbus_g_proxy_new_for_name(conn, GPM_DBUS_SM_SERVICE,
+ GPM_DBUS_SM_PATH, GPM_DBUS_SM_INTERFACE);
+ if (proxy == NULL)
+ {
+ g_warning("Could not get DBUS proxy: %s", GPM_DBUS_SM_SERVICE);
+ dbus_g_connection_unref(conn);
+ return FALSE;
+ }
+ res = dbus_g_proxy_call(proxy, "CanShutdown", &error,
+ G_TYPE_INVALID,
+ G_TYPE_BOOLEAN, &can_shutdown,
+ G_TYPE_INVALID);
+ g_object_unref(G_OBJECT(proxy));
+ dbus_g_connection_unref(conn);
+ if (!res)
+ {
+ if (error != NULL)
+ {
+ g_error_free(error);
+ }
+ // Try to shutdown anyway
+ can_shutdown = TRUE;
+ // Try the gpm version
+ return ghb_can_shutdown_gpm();
+ }
#endif
- return can_shutdown;
+ return can_shutdown;
}
static void
ghb_shutdown_gsm()
{
#if !defined(_WIN32)
- DBusGConnection *conn;
- DBusGProxy *proxy;
- GError *error = NULL;
- gboolean res;
-
-
- g_debug("ghb_shutdown_gpm()");
- conn = dbus_g_bus_get(DBUS_BUS_SESSION, &error);
- if (error != NULL)
- {
- g_warning("DBUS cannot connect: %s", error->message);
- g_error_free(error);
- return;
- }
- proxy = dbus_g_proxy_new_for_name(conn, GPM_DBUS_SM_SERVICE,
- GPM_DBUS_SM_PATH, GPM_DBUS_SM_INTERFACE);
- if (proxy == NULL)
- {
- g_warning("Could not get DBUS proxy: %s", GPM_DBUS_SM_SERVICE);
- dbus_g_connection_unref(conn);
- return;
- }
- res = dbus_g_proxy_call(proxy, "Shutdown", &error,
- G_TYPE_INVALID,
- G_TYPE_INVALID);
- g_object_unref(G_OBJECT(proxy));
- dbus_g_connection_unref(conn);
- if (!res)
- {
- if (error != NULL)
- {
- g_error_free(error);
- }
- // Try the gpm version
- ghb_shutdown_gpm();
- }
+ DBusGConnection *conn;
+ DBusGProxy *proxy;
+ GError *error = NULL;
+ gboolean res;
+
+
+ g_debug("ghb_shutdown_gpm()");
+ conn = dbus_g_bus_get(DBUS_BUS_SESSION, &error);
+ if (error != NULL)
+ {
+ g_warning("DBUS cannot connect: %s", error->message);
+ g_error_free(error);
+ return;
+ }
+ proxy = dbus_g_proxy_new_for_name(conn, GPM_DBUS_SM_SERVICE,
+ GPM_DBUS_SM_PATH, GPM_DBUS_SM_INTERFACE);
+ if (proxy == NULL)
+ {
+ g_warning("Could not get DBUS proxy: %s", GPM_DBUS_SM_SERVICE);
+ dbus_g_connection_unref(conn);
+ return;
+ }
+ res = dbus_g_proxy_call(proxy, "Shutdown", &error,
+ G_TYPE_INVALID,
+ G_TYPE_INVALID);
+ g_object_unref(G_OBJECT(proxy));
+ dbus_g_connection_unref(conn);
+ if (!res)
+ {
+ if (error != NULL)
+ {
+ g_error_free(error);
+ }
+ // Try the gpm version
+ ghb_shutdown_gpm();
+ }
#endif
}
@@ -4617,60 +4617,60 @@ void
ghb_inhibit_gsm(signal_user_data_t *ud)
{
#if !defined(_WIN32)
- DBusGConnection *conn;
- DBusGProxy *proxy;
- GError *error = NULL;
- gboolean res;
- guint xid;
- GtkWidget *widget;
-
-
- if (gpm_inhibited)
- {
- // Already inhibited
- return;
- }
- g_debug("ghb_inhibit_gsm()");
- conn = dbus_g_bus_get(DBUS_BUS_SESSION, &error);
- if (error != NULL)
- {
- g_warning("DBUS cannot connect: %s", error->message);
- g_error_free(error);
- return;
- }
- proxy = dbus_g_proxy_new_for_name(conn, GPM_DBUS_SM_SERVICE,
- GPM_DBUS_SM_PATH, GPM_DBUS_SM_INTERFACE);
- if (proxy == NULL)
- {
- g_warning("Could not get DBUS proxy: %s", GPM_DBUS_SM_SERVICE);
- dbus_g_connection_unref(conn);
- return;
- }
- widget = GHB_WIDGET(ud->builder, "hb_window");
- xid = GDK_WINDOW_XID(gtk_widget_get_window(widget));
- res = dbus_g_proxy_call(proxy, "Inhibit", &error,
- G_TYPE_STRING, "ghb",
- G_TYPE_UINT, xid,
- G_TYPE_STRING, "Encoding",
- G_TYPE_UINT, 1 | 4,
- G_TYPE_INVALID,
- G_TYPE_UINT, &gpm_cookie,
- G_TYPE_INVALID);
- gpm_inhibited = TRUE;
- g_object_unref(G_OBJECT(proxy));
- dbus_g_connection_unref(conn);
- if (!res)
- {
- if (error != NULL)
- {
- g_error_free(error);
- gpm_cookie = -1;
- }
- gpm_cookie = -1;
- gpm_inhibited = FALSE;
- // Try the gpm version
- ghb_inhibit_gpm();
- }
+ DBusGConnection *conn;
+ DBusGProxy *proxy;
+ GError *error = NULL;
+ gboolean res;
+ guint xid;
+ GtkWidget *widget;
+
+
+ if (gpm_inhibited)
+ {
+ // Already inhibited
+ return;
+ }
+ g_debug("ghb_inhibit_gsm()");
+ conn = dbus_g_bus_get(DBUS_BUS_SESSION, &error);
+ if (error != NULL)
+ {
+ g_warning("DBUS cannot connect: %s", error->message);
+ g_error_free(error);
+ return;
+ }
+ proxy = dbus_g_proxy_new_for_name(conn, GPM_DBUS_SM_SERVICE,
+ GPM_DBUS_SM_PATH, GPM_DBUS_SM_INTERFACE);
+ if (proxy == NULL)
+ {
+ g_warning("Could not get DBUS proxy: %s", GPM_DBUS_SM_SERVICE);
+ dbus_g_connection_unref(conn);
+ return;
+ }
+ widget = GHB_WIDGET(ud->builder, "hb_window");
+ xid = GDK_WINDOW_XID(gtk_widget_get_window(widget));
+ res = dbus_g_proxy_call(proxy, "Inhibit", &error,
+ G_TYPE_STRING, "ghb",
+ G_TYPE_UINT, xid,
+ G_TYPE_STRING, "Encoding",
+ G_TYPE_UINT, 1 | 4,
+ G_TYPE_INVALID,
+ G_TYPE_UINT, &gpm_cookie,
+ G_TYPE_INVALID);
+ gpm_inhibited = TRUE;
+ g_object_unref(G_OBJECT(proxy));
+ dbus_g_connection_unref(conn);
+ if (!res)
+ {
+ if (error != NULL)
+ {
+ g_error_free(error);
+ gpm_cookie = -1;
+ }
+ gpm_cookie = -1;
+ gpm_inhibited = FALSE;
+ // Try the gpm version
+ ghb_inhibit_gpm();
+ }
#endif
}
@@ -4678,443 +4678,443 @@ void
ghb_uninhibit_gsm()
{
#if !defined(_WIN32)
- DBusGConnection *conn;
- DBusGProxy *proxy;
- GError *error = NULL;
- gboolean res;
-
- g_debug("ghb_uninhibit_gsm() gpm_cookie %u", gpm_cookie);
-
- if (!gpm_inhibited)
- {
- // Not inhibited
- return;
- }
- conn = dbus_g_bus_get(DBUS_BUS_SESSION, &error);
- if (error != NULL)
- {
- g_warning("DBUS cannot connect: %s", error->message);
- g_error_free(error);
- return;
- }
- proxy = dbus_g_proxy_new_for_name(conn, GPM_DBUS_SM_SERVICE,
- GPM_DBUS_SM_PATH, GPM_DBUS_SM_INTERFACE);
- if (proxy == NULL)
- {
- g_warning("Could not get DBUS proxy: %s", GPM_DBUS_SM_SERVICE);
- dbus_g_connection_unref(conn);
- return;
- }
- res = dbus_g_proxy_call(proxy, "Uninhibit", &error,
- G_TYPE_UINT, gpm_cookie,
- G_TYPE_INVALID,
- G_TYPE_INVALID);
- dbus_g_connection_unref(conn);
- g_object_unref(G_OBJECT(proxy));
- if (!res)
- {
- if (error != NULL)
- {
- g_error_free(error);
- }
- ghb_uninhibit_gpm();
- }
- gpm_inhibited = FALSE;
+ DBusGConnection *conn;
+ DBusGProxy *proxy;
+ GError *error = NULL;
+ gboolean res;
+
+ g_debug("ghb_uninhibit_gsm() gpm_cookie %u", gpm_cookie);
+
+ if (!gpm_inhibited)
+ {
+ // Not inhibited
+ return;
+ }
+ conn = dbus_g_bus_get(DBUS_BUS_SESSION, &error);
+ if (error != NULL)
+ {
+ g_warning("DBUS cannot connect: %s", error->message);
+ g_error_free(error);
+ return;
+ }
+ proxy = dbus_g_proxy_new_for_name(conn, GPM_DBUS_SM_SERVICE,
+ GPM_DBUS_SM_PATH, GPM_DBUS_SM_INTERFACE);
+ if (proxy == NULL)
+ {
+ g_warning("Could not get DBUS proxy: %s", GPM_DBUS_SM_SERVICE);
+ dbus_g_connection_unref(conn);
+ return;
+ }
+ res = dbus_g_proxy_call(proxy, "Uninhibit", &error,
+ G_TYPE_UINT, gpm_cookie,
+ G_TYPE_INVALID,
+ G_TYPE_INVALID);
+ dbus_g_connection_unref(conn);
+ g_object_unref(G_OBJECT(proxy));
+ if (!res)
+ {
+ if (error != NULL)
+ {
+ g_error_free(error);
+ }
+ ghb_uninhibit_gpm();
+ }
+ gpm_inhibited = FALSE;
#endif
}
G_MODULE_EXPORT gboolean
tweak_setting_cb(
- GtkWidget *widget,
- GdkEventButton *event,
- signal_user_data_t *ud)
-{
- const gchar *name;
- gchar *tweak_name;
- gboolean ret = FALSE;
- gboolean allow_tweaks;
-
- g_debug("press %d %d", event->type, event->button);
- allow_tweaks = ghb_settings_get_boolean(ud->settings, "allow_tweaks");
- if (allow_tweaks && event->type == GDK_BUTTON_PRESS && event->button == 3)
- { // Its a right mouse click
- GtkWidget *dialog;
- GtkEntry *entry;
- GtkResponseType response;
- gchar *tweak = NULL;
-
- name = ghb_get_setting_key(widget);
- if (g_str_has_prefix(name, "tweak_"))
- {
- tweak_name = g_strdup(name);
- }
- else
- {
- tweak_name = g_strdup_printf("tweak_%s", name);
- }
-
- tweak = ghb_settings_get_string (ud->settings, tweak_name);
- dialog = GHB_WIDGET(ud->builder, "tweak_dialog");
- gtk_window_set_title(GTK_WINDOW(dialog), tweak_name);
- entry = GTK_ENTRY(GHB_WIDGET(ud->builder, "tweak_setting"));
- if (tweak)
- {
- gtk_entry_set_text(entry, tweak);
- g_free(tweak);
- }
- response = gtk_dialog_run(GTK_DIALOG(dialog));
- gtk_widget_hide(dialog);
- if (response == GTK_RESPONSE_OK)
- {
- tweak = (gchar*)gtk_entry_get_text(entry);
- if (ghb_validate_filter_string(tweak, -1))
- ghb_settings_set_string(ud->settings, tweak_name, tweak);
- else
- {
- gchar *message;
- message = g_strdup_printf(
- "Invalid Settings:\n%s",
- tweak);
- ghb_message_dialog(GTK_MESSAGE_ERROR, message, "Cancel", NULL);
- g_free(message);
- }
- }
- g_free(tweak_name);
- ret = TRUE;
- }
- return ret;
+ GtkWidget *widget,
+ GdkEventButton *event,
+ signal_user_data_t *ud)
+{
+ const gchar *name;
+ gchar *tweak_name;
+ gboolean ret = FALSE;
+ gboolean allow_tweaks;
+
+ g_debug("press %d %d", event->type, event->button);
+ allow_tweaks = ghb_settings_get_boolean(ud->settings, "allow_tweaks");
+ if (allow_tweaks && event->type == GDK_BUTTON_PRESS && event->button == 3)
+ { // Its a right mouse click
+ GtkWidget *dialog;
+ GtkEntry *entry;
+ GtkResponseType response;
+ gchar *tweak = NULL;
+
+ name = ghb_get_setting_key(widget);
+ if (g_str_has_prefix(name, "tweak_"))
+ {
+ tweak_name = g_strdup(name);
+ }
+ else
+ {
+ tweak_name = g_strdup_printf("tweak_%s", name);
+ }
+
+ tweak = ghb_settings_get_string (ud->settings, tweak_name);
+ dialog = GHB_WIDGET(ud->builder, "tweak_dialog");
+ gtk_window_set_title(GTK_WINDOW(dialog), tweak_name);
+ entry = GTK_ENTRY(GHB_WIDGET(ud->builder, "tweak_setting"));
+ if (tweak)
+ {
+ gtk_entry_set_text(entry, tweak);
+ g_free(tweak);
+ }
+ response = gtk_dialog_run(GTK_DIALOG(dialog));
+ gtk_widget_hide(dialog);
+ if (response == GTK_RESPONSE_OK)
+ {
+ tweak = (gchar*)gtk_entry_get_text(entry);
+ if (ghb_validate_filter_string(tweak, -1))
+ ghb_settings_set_string(ud->settings, tweak_name, tweak);
+ else
+ {
+ gchar *message;
+ message = g_strdup_printf(
+ "Invalid Settings:\n%s",
+ tweak);
+ ghb_message_dialog(GTK_MESSAGE_ERROR, message, "Cancel", NULL);
+ g_free(message);
+ }
+ }
+ g_free(tweak_name);
+ ret = TRUE;
+ }
+ return ret;
}
G_MODULE_EXPORT gboolean
easter_egg_cb(
- GtkWidget *widget,
- GdkEventButton *event,
- signal_user_data_t *ud)
-{
- g_debug("press %d %d", event->type, event->button);
- if (event->type == GDK_3BUTTON_PRESS && event->button == 1)
- { // Its a tripple left mouse button click
- GtkWidget *widget;
- widget = GHB_WIDGET(ud->builder, "allow_tweaks");
- gtk_widget_show(widget);
- widget = GHB_WIDGET(ud->builder, "hbfd_feature");
- gtk_widget_show(widget);
- }
- else if (event->type == GDK_BUTTON_PRESS && event->button == 1)
- {
- GtkWidget *widget;
- widget = GHB_WIDGET(ud->builder, "allow_tweaks");
- gtk_widget_hide(widget);
- widget = GHB_WIDGET(ud->builder, "hbfd_feature");
- gtk_widget_hide(widget);
- }
- return FALSE;
+ GtkWidget *widget,
+ GdkEventButton *event,
+ signal_user_data_t *ud)
+{
+ g_debug("press %d %d", event->type, event->button);
+ if (event->type == GDK_3BUTTON_PRESS && event->button == 1)
+ { // Its a tripple left mouse button click
+ GtkWidget *widget;
+ widget = GHB_WIDGET(ud->builder, "allow_tweaks");
+ gtk_widget_show(widget);
+ widget = GHB_WIDGET(ud->builder, "hbfd_feature");
+ gtk_widget_show(widget);
+ }
+ else if (event->type == GDK_BUTTON_PRESS && event->button == 1)
+ {
+ GtkWidget *widget;
+ widget = GHB_WIDGET(ud->builder, "allow_tweaks");
+ gtk_widget_hide(widget);
+ widget = GHB_WIDGET(ud->builder, "hbfd_feature");
+ gtk_widget_hide(widget);
+ }
+ return FALSE;
}
G_MODULE_EXPORT gchar*
format_deblock_cb(GtkScale *scale, gdouble val, signal_user_data_t *ud)
{
- if (val < 5.0)
- {
- return g_strdup_printf("Off");
- }
- else
- {
- return g_strdup_printf("%d", (gint)val);
- }
+ if (val < 5.0)
+ {
+ return g_strdup_printf("Off");
+ }
+ else
+ {
+ return g_strdup_printf("%d", (gint)val);
+ }
}
G_MODULE_EXPORT gchar*
format_vquality_cb(GtkScale *scale, gdouble val, signal_user_data_t *ud)
{
- gint vcodec = ghb_settings_combo_int(ud->settings, "VideoEncoder");
- switch (vcodec)
- {
- case HB_VCODEC_X264:
- {
- if (val == 0.0)
- {
- return g_strdup_printf("RF: %.4g (Warning: lossless)", val);
- }
- else
- {
- return g_strdup_printf("RF: %.4g", val);
- }
- } break;
-
- case HB_VCODEC_FFMPEG_MPEG4:
- case HB_VCODEC_FFMPEG_MPEG2:
- {
- return g_strdup_printf("QP: %d", (int)val);
- } break;
-
- case HB_VCODEC_THEORA:
- {
- return g_strdup_printf("QP: %d", (int)val);
- } break;
-
- default:
- {
- } break;
- }
- return g_strdup_printf("QP: %.4g", val);
+ gint vcodec = ghb_settings_combo_int(ud->settings, "VideoEncoder");
+ switch (vcodec)
+ {
+ case HB_VCODEC_X264:
+ {
+ if (val == 0.0)
+ {
+ return g_strdup_printf("RF: %.4g (Warning: lossless)", val);
+ }
+ else
+ {
+ return g_strdup_printf("RF: %.4g", val);
+ }
+ } break;
+
+ case HB_VCODEC_FFMPEG_MPEG4:
+ case HB_VCODEC_FFMPEG_MPEG2:
+ {
+ return g_strdup_printf("QP: %d", (int)val);
+ } break;
+
+ case HB_VCODEC_THEORA:
+ {
+ return g_strdup_printf("QP: %d", (int)val);
+ } break;
+
+ default:
+ {
+ } break;
+ }
+ return g_strdup_printf("QP: %.4g", val);
}
static void
process_appcast(signal_user_data_t *ud)
{
- gchar *description = NULL, *build = NULL, *version = NULL, *msg;
+ gchar *description = NULL, *build = NULL, *version = NULL, *msg;
#if !defined(_WIN32)
- GtkWidget *window;
- static GtkWidget *html = NULL;
+ GtkWidget *window;
+ static GtkWidget *html = NULL;
#endif
- GtkWidget *dialog, *label;
- gint response, ibuild = 0, skip;
-
- if (ud->appcast == NULL || ud->appcast_len < 15 ||
- strncmp(&(ud->appcast[9]), "200 OK", 6))
- {
- goto done;
- }
- ghb_appcast_parse(ud->appcast, &description, &build, &version);
- if (build)
- ibuild = g_strtod(build, NULL);
- skip = ghb_settings_get_int(ud->settings, "update_skip_version");
- if (description == NULL || build == NULL || version == NULL
- || ibuild <= hb_get_build(NULL) || skip == ibuild)
- {
- goto done;
- }
- msg = g_strdup_printf("HandBrake %s/%s is now available (you have %s/%d).",
- version, build, hb_get_version(NULL), hb_get_build(NULL));
- label = GHB_WIDGET(ud->builder, "update_message");
- gtk_label_set_text(GTK_LABEL(label), msg);
+ GtkWidget *dialog, *label;
+ gint response, ibuild = 0, skip;
+
+ if (ud->appcast == NULL || ud->appcast_len < 15 ||
+ strncmp(&(ud->appcast[9]), "200 OK", 6))
+ {
+ goto done;
+ }
+ ghb_appcast_parse(ud->appcast, &description, &build, &version);
+ if (build)
+ ibuild = g_strtod(build, NULL);
+ skip = ghb_settings_get_int(ud->settings, "update_skip_version");
+ if (description == NULL || build == NULL || version == NULL
+ || ibuild <= hb_get_build(NULL) || skip == ibuild)
+ {
+ goto done;
+ }
+ msg = g_strdup_printf("HandBrake %s/%s is now available (you have %s/%d).",
+ version, build, hb_get_version(NULL), hb_get_build(NULL));
+ label = GHB_WIDGET(ud->builder, "update_message");
+ gtk_label_set_text(GTK_LABEL(label), msg);
#if !defined(_WIN32)
#if !defined(_NO_UPDATE_CHECK)
- if (html == NULL)
- {
- html = webkit_web_view_new();
- window = GHB_WIDGET(ud->builder, "update_scroll");
- gtk_container_add(GTK_CONTAINER(window), html);
- // Show it
- gtk_widget_set_size_request(html, 420, 240);
- gtk_widget_show(html);
- }
- webkit_web_view_open(WEBKIT_WEB_VIEW(html), description);
+ if (html == NULL)
+ {
+ html = webkit_web_view_new();
+ window = GHB_WIDGET(ud->builder, "update_scroll");
+ gtk_container_add(GTK_CONTAINER(window), html);
+ // Show it
+ gtk_widget_set_size_request(html, 420, 240);
+ gtk_widget_show(html);
+ }
+ webkit_web_view_open(WEBKIT_WEB_VIEW(html), description);
#endif
#endif
- dialog = GHB_WIDGET(ud->builder, "update_dialog");
- response = gtk_dialog_run(GTK_DIALOG(dialog));
- gtk_widget_hide(dialog);
- if (response == GTK_RESPONSE_OK)
- {
- // Skip
- ghb_settings_set_int(ud->settings, "update_skip_version", ibuild);
- ghb_pref_save(ud->settings, "update_skip_version");
- }
- g_free(msg);
+ dialog = GHB_WIDGET(ud->builder, "update_dialog");
+ response = gtk_dialog_run(GTK_DIALOG(dialog));
+ gtk_widget_hide(dialog);
+ if (response == GTK_RESPONSE_OK)
+ {
+ // Skip
+ ghb_settings_set_int(ud->settings, "update_skip_version", ibuild);
+ ghb_pref_save(ud->settings, "update_skip_version");
+ }
+ g_free(msg);
done:
- if (description) g_free(description);
- if (build) g_free(build);
- if (version) g_free(version);
- g_free(ud->appcast);
- ud->appcast_len = 0;
- ud->appcast = NULL;
- appcast_busy = FALSE;
+ if (description) g_free(description);
+ if (build) g_free(build);
+ if (version) g_free(version);
+ g_free(ud->appcast);
+ ud->appcast_len = 0;
+ ud->appcast = NULL;
+ appcast_busy = FALSE;
}
void
ghb_net_close(GIOChannel *ioc)
{
- gint fd;
+ gint fd;
- g_debug("ghb_net_close");
- if (ioc == NULL) return;
- fd = g_io_channel_unix_get_fd(ioc);
- close(fd);
- g_io_channel_unref(ioc);
+ g_debug("ghb_net_close");
+ if (ioc == NULL) return;
+ fd = g_io_channel_unix_get_fd(ioc);
+ close(fd);
+ g_io_channel_unref(ioc);
}
G_MODULE_EXPORT gboolean
ghb_net_recv_cb(GIOChannel *ioc, GIOCondition cond, gpointer data)
{
- gchar buf[2048];
- gsize len;
- GError *gerror = NULL;
- GIOStatus status;
-
- g_debug("ghb_net_recv_cb");
- signal_user_data_t *ud = (signal_user_data_t*)data;
-
- status = g_io_channel_read_chars (ioc, buf, 2048, &len, &gerror);
- if ((status == G_IO_STATUS_NORMAL || status == G_IO_STATUS_EOF) &&
- len > 0)
- {
- gint new_len = ud->appcast_len + len;
- ud->appcast = g_realloc(ud->appcast, new_len + 1);
- memcpy(&(ud->appcast[ud->appcast_len]), buf, len);
- ud->appcast_len = new_len;
- }
- if (status == G_IO_STATUS_EOF)
- {
- if ( ud->appcast != NULL )
- {
- ud->appcast[ud->appcast_len] = 0;
- }
- ghb_net_close(ioc);
- process_appcast(ud);
- return FALSE;
- }
- return TRUE;
+ gchar buf[2048];
+ gsize len;
+ GError *gerror = NULL;
+ GIOStatus status;
+
+ g_debug("ghb_net_recv_cb");
+ signal_user_data_t *ud = (signal_user_data_t*)data;
+
+ status = g_io_channel_read_chars (ioc, buf, 2048, &len, &gerror);
+ if ((status == G_IO_STATUS_NORMAL || status == G_IO_STATUS_EOF) &&
+ len > 0)
+ {
+ gint new_len = ud->appcast_len + len;
+ ud->appcast = g_realloc(ud->appcast, new_len + 1);
+ memcpy(&(ud->appcast[ud->appcast_len]), buf, len);
+ ud->appcast_len = new_len;
+ }
+ if (status == G_IO_STATUS_EOF)
+ {
+ if ( ud->appcast != NULL )
+ {
+ ud->appcast[ud->appcast_len] = 0;
+ }
+ ghb_net_close(ioc);
+ process_appcast(ud);
+ return FALSE;
+ }
+ return TRUE;
}
GIOChannel*
ghb_net_open(signal_user_data_t *ud, gchar *address, gint port)
{
- GIOChannel *ioc;
- gint fd;
-
- struct sockaddr_in sock;
- struct hostent * host;
-
- g_debug("ghb_net_open");
- if( !( host = gethostbyname( address ) ) )
- {
- g_warning( "gethostbyname failed (%s)", address );
- appcast_busy = FALSE;
- return NULL;
- }
-
- memset( &sock, 0, sizeof( struct sockaddr_in ) );
- sock.sin_family = host->h_addrtype;
- sock.sin_port = htons( port );
- memcpy( &sock.sin_addr, host->h_addr, host->h_length );
-
- fd = socket(host->h_addrtype, SOCK_STREAM, 0);
- if( fd < 0 )
- {
- g_debug( "socket failed" );
- appcast_busy = FALSE;
- return NULL;
- }
-
- if(connect(fd, (struct sockaddr*)&sock, sizeof(struct sockaddr_in )) < 0 )
- {
- g_debug( "connect failed" );
- appcast_busy = FALSE;
- return NULL;
- }
- ioc = g_io_channel_unix_new(fd);
- g_io_channel_set_encoding (ioc, NULL, NULL);
- g_io_channel_set_flags(ioc, G_IO_FLAG_NONBLOCK, NULL);
- g_io_add_watch (ioc, G_IO_IN, ghb_net_recv_cb, (gpointer)ud );
-
- return ioc;
+ GIOChannel *ioc;
+ gint fd;
+
+ struct sockaddr_in sock;
+ struct hostent * host;
+
+ g_debug("ghb_net_open");
+ if( !( host = gethostbyname( address ) ) )
+ {
+ g_warning( "gethostbyname failed (%s)", address );
+ appcast_busy = FALSE;
+ return NULL;
+ }
+
+ memset( &sock, 0, sizeof( struct sockaddr_in ) );
+ sock.sin_family = host->h_addrtype;
+ sock.sin_port = htons( port );
+ memcpy( &sock.sin_addr, host->h_addr, host->h_length );
+
+ fd = socket(host->h_addrtype, SOCK_STREAM, 0);
+ if( fd < 0 )
+ {
+ g_debug( "socket failed" );
+ appcast_busy = FALSE;
+ return NULL;
+ }
+
+ if(connect(fd, (struct sockaddr*)&sock, sizeof(struct sockaddr_in )) < 0 )
+ {
+ g_debug( "connect failed" );
+ appcast_busy = FALSE;
+ return NULL;
+ }
+ ioc = g_io_channel_unix_new(fd);
+ g_io_channel_set_encoding (ioc, NULL, NULL);
+ g_io_channel_set_flags(ioc, G_IO_FLAG_NONBLOCK, NULL);
+ g_io_add_watch (ioc, G_IO_IN, ghb_net_recv_cb, (gpointer)ud );
+
+ return ioc;
}
gpointer
ghb_check_update(signal_user_data_t *ud)
{
- gchar *query;
- gsize len;
- GIOChannel *ioc;
- GError *gerror = NULL;
- GRegex *regex;
- GMatchInfo *mi;
- gchar *host, *appcast;
-
- g_debug("ghb_check_update");
- appcast_busy = TRUE;
- regex = g_regex_new("^http://(.+)/(.+)$", 0, 0, NULL);
- if (!g_regex_match(regex, HB_PROJECT_URL_APPCAST, 0, &mi))
- {
- return NULL;
- }
+ gchar *query;
+ gsize len;
+ GIOChannel *ioc;
+ GError *gerror = NULL;
+ GRegex *regex;
+ GMatchInfo *mi;
+ gchar *host, *appcast;
+
+ g_debug("ghb_check_update");
+ appcast_busy = TRUE;
+ regex = g_regex_new("^http://(.+)/(.+)$", 0, 0, NULL);
+ if (!g_regex_match(regex, HB_PROJECT_URL_APPCAST, 0, &mi))
+ {
+ return NULL;
+ }
- host = g_match_info_fetch(mi, 1);
- appcast = g_match_info_fetch(mi, 2);
+ host = g_match_info_fetch(mi, 1);
+ appcast = g_match_info_fetch(mi, 2);
- if (host == NULL || appcast == NULL)
- return NULL;
+ if (host == NULL || appcast == NULL)
+ return NULL;
- query = g_strdup_printf("GET /%s HTTP/1.0\r\nHost: %s\r\n\r\n",
- appcast, host);
+ query = g_strdup_printf("GET /%s HTTP/1.0\r\nHost: %s\r\n\r\n",
+ appcast, host);
- ioc = ghb_net_open(ud, host, 80);
- if (ioc == NULL)
- goto free_resources;
+ ioc = ghb_net_open(ud, host, 80);
+ if (ioc == NULL)
+ goto free_resources;
- g_io_channel_write_chars(ioc, query, strlen(query), &len, &gerror);
- g_io_channel_flush(ioc, &gerror);
+ g_io_channel_write_chars(ioc, query, strlen(query), &len, &gerror);
+ g_io_channel_flush(ioc, &gerror);
free_resources:
- g_free(query);
- g_free(host);
- g_free(appcast);
- g_match_info_free(mi);
- g_regex_unref(regex);
- return NULL;
+ g_free(query);
+ g_free(host);
+ g_free(appcast);
+ g_match_info_free(mi);
+ g_regex_unref(regex);
+ return NULL;
}
G_MODULE_EXPORT gboolean
hb_visibility_event_cb(
- GtkWidget *widget,
- GdkEventVisibility *vs,
- signal_user_data_t *ud)
+ GtkWidget *widget,
+ GdkEventVisibility *vs,
+ signal_user_data_t *ud)
{
- ud->hb_visibility = vs->state;
- return FALSE;
+ ud->hb_visibility = vs->state;
+ return FALSE;
}
G_MODULE_EXPORT void
status_activate_cb(GtkStatusIcon *si, signal_user_data_t *ud)
{
- GtkWindow *window;
- GdkWindowState state;
+ GtkWindow *window;
+ GdkWindowState state;
- window = GTK_WINDOW(GHB_WIDGET(ud->builder, "hb_window"));
- state = gdk_window_get_state(gtk_widget_get_window(GTK_WIDGET(window)));
- if ((state & GDK_WINDOW_STATE_ICONIFIED) ||
- (ud->hb_visibility != GDK_VISIBILITY_UNOBSCURED))
- {
- gtk_window_present(window);
- gtk_window_set_skip_taskbar_hint(window, FALSE);
- }
- else
- {
- gtk_window_set_skip_taskbar_hint(window, TRUE);
- gtk_window_iconify(window);
- }
+ window = GTK_WINDOW(GHB_WIDGET(ud->builder, "hb_window"));
+ state = gdk_window_get_state(gtk_widget_get_window(GTK_WIDGET(window)));
+ if ((state & GDK_WINDOW_STATE_ICONIFIED) ||
+ (ud->hb_visibility != GDK_VISIBILITY_UNOBSCURED))
+ {
+ gtk_window_present(window);
+ gtk_window_set_skip_taskbar_hint(window, FALSE);
+ }
+ else
+ {
+ gtk_window_set_skip_taskbar_hint(window, TRUE);
+ gtk_window_iconify(window);
+ }
}
G_MODULE_EXPORT void
show_hide_toggle_cb(GtkWidget *xwidget, signal_user_data_t *ud)
{
- GtkWindow *window;
- GdkWindowState state;
+ GtkWindow *window;
+ GdkWindowState state;
- window = GTK_WINDOW(GHB_WIDGET(ud->builder, "hb_window"));
- state = gdk_window_get_state(gtk_widget_get_window(GTK_WIDGET(window)));
- if ((state & GDK_WINDOW_STATE_ICONIFIED) ||
- (ud->hb_visibility != GDK_VISIBILITY_UNOBSCURED))
- {
- gtk_window_present(window);
- gtk_window_set_skip_taskbar_hint(window, FALSE);
- }
- else
- {
- gtk_window_set_skip_taskbar_hint(window, TRUE);
- gtk_window_iconify(window);
- }
+ window = GTK_WINDOW(GHB_WIDGET(ud->builder, "hb_window"));
+ state = gdk_window_get_state(gtk_widget_get_window(GTK_WIDGET(window)));
+ if ((state & GDK_WINDOW_STATE_ICONIFIED) ||
+ (ud->hb_visibility != GDK_VISIBILITY_UNOBSCURED))
+ {
+ gtk_window_present(window);
+ gtk_window_set_skip_taskbar_hint(window, FALSE);
+ }
+ else
+ {
+ gtk_window_set_skip_taskbar_hint(window, TRUE);
+ gtk_window_iconify(window);
+ }
}
#if !defined(_WIN32)
G_MODULE_EXPORT void
notify_closed_cb(NotifyNotification *notification, signal_user_data_t *ud)
{
- g_object_unref(G_OBJECT(notification));
+ g_object_unref(G_OBJECT(notification));
}
#endif
@@ -5122,83 +5122,83 @@ void
ghb_notify_done(signal_user_data_t *ud)
{
- if (ghb_settings_combo_int(ud->settings, "WhenComplete") == 0)
- return;
+ if (ghb_settings_combo_int(ud->settings, "WhenComplete") == 0)
+ return;
#if !defined(_WIN32)
- NotifyNotification *notification;
- notification = notify_notification_new(
- "Encode Complete",
- "Put down that cocktail, Your HandBrake queue is done!",
- NULL
+ NotifyNotification *notification;
+ notification = notify_notification_new(
+ "Encode Complete",
+ "Put down that cocktail, Your HandBrake queue is done!",
+ NULL
#if NOTIFY_CHECK_VERSION (0, 7, 0)
);
#else
- ,NULL);
+ ,NULL);
- GtkStatusIcon *si = GTK_STATUS_ICON(GHB_OBJECT(ud->builder, "hb_status"));
- notify_notification_attach_to_status_icon(notification, si);
+ GtkStatusIcon *si = GTK_STATUS_ICON(GHB_OBJECT(ud->builder, "hb_status"));
+ notify_notification_attach_to_status_icon(notification, si);
#endif
- GtkIconTheme *theme = gtk_icon_theme_get_default();
- GdkPixbuf *pb = gtk_icon_theme_load_icon(theme, "hb-icon", 32,
- GTK_ICON_LOOKUP_USE_BUILTIN, NULL);
- notify_notification_set_icon_from_pixbuf(notification, pb);
- g_signal_connect(notification, "closed", (GCallback)notify_closed_cb, ud);
- notify_notification_show(notification, NULL);
- g_object_unref(G_OBJECT(pb));
+ GtkIconTheme *theme = gtk_icon_theme_get_default();
+ GdkPixbuf *pb = gtk_icon_theme_load_icon(theme, "hb-icon", 32,
+ GTK_ICON_LOOKUP_USE_BUILTIN, NULL);
+ notify_notification_set_icon_from_pixbuf(notification, pb);
+ g_signal_connect(notification, "closed", (GCallback)notify_closed_cb, ud);
+ notify_notification_show(notification, NULL);
+ g_object_unref(G_OBJECT(pb));
#endif
- if (ghb_settings_combo_int(ud->settings, "WhenComplete") == 3)
- {
- if (ghb_can_shutdown_gsm())
- {
- ghb_countdown_dialog(GTK_MESSAGE_WARNING,
- "Your encode is complete.",
- "Shutting down the computer",
- "Cancel", (GSourceFunc)shutdown_cb, ud, 60);
- }
- }
- if (ghb_settings_combo_int(ud->settings, "WhenComplete") == 2)
- {
- if (ghb_can_suspend_gpm())
- {
- ghb_countdown_dialog(GTK_MESSAGE_WARNING,
- "Your encode is complete.",
- "Putting computer to sleep",
- "Cancel", (GSourceFunc)suspend_cb, ud, 60);
- }
- }
- if (ghb_settings_combo_int(ud->settings, "WhenComplete") == 4)
- {
- ghb_countdown_dialog(GTK_MESSAGE_WARNING,
- "Your encode is complete.",
- "Quiting Handbrake",
- "Cancel", (GSourceFunc)quit_cb, ud, 60);
- }
+ if (ghb_settings_combo_int(ud->settings, "WhenComplete") == 3)
+ {
+ if (ghb_can_shutdown_gsm())
+ {
+ ghb_countdown_dialog(GTK_MESSAGE_WARNING,
+ "Your encode is complete.",
+ "Shutting down the computer",
+ "Cancel", (GSourceFunc)shutdown_cb, ud, 60);
+ }
+ }
+ if (ghb_settings_combo_int(ud->settings, "WhenComplete") == 2)
+ {
+ if (ghb_can_suspend_gpm())
+ {
+ ghb_countdown_dialog(GTK_MESSAGE_WARNING,
+ "Your encode is complete.",
+ "Putting computer to sleep",
+ "Cancel", (GSourceFunc)suspend_cb, ud, 60);
+ }
+ }
+ if (ghb_settings_combo_int(ud->settings, "WhenComplete") == 4)
+ {
+ ghb_countdown_dialog(GTK_MESSAGE_WARNING,
+ "Your encode is complete.",
+ "Quiting Handbrake",
+ "Cancel", (GSourceFunc)quit_cb, ud, 60);
+ }
}
G_MODULE_EXPORT gboolean
window_configure_cb(
- GtkWidget *widget,
- GdkEventConfigure *event,
- signal_user_data_t *ud)
-{
- //g_message("preview_configure_cb()");
- if (gtk_widget_get_visible(widget))
- {
- gint w, h;
- w = ghb_settings_get_int(ud->settings, "window_width");
- h = ghb_settings_get_int(ud->settings, "window_height");
-
- if ( w != event->width || h != event->height )
- {
- ghb_settings_set_int(ud->settings, "window_width", event->width);
- ghb_settings_set_int(ud->settings, "window_height", event->height);
- ghb_pref_set(ud->settings, "window_width");
- ghb_pref_set(ud->settings, "window_height");
- ghb_prefs_store();
- }
- }
- return FALSE;
+ GtkWidget *widget,
+ GdkEventConfigure *event,
+ signal_user_data_t *ud)
+{
+ //g_message("preview_configure_cb()");
+ if (gtk_widget_get_visible(widget))
+ {
+ gint w, h;
+ w = ghb_settings_get_int(ud->settings, "window_width");
+ h = ghb_settings_get_int(ud->settings, "window_height");
+
+ if ( w != event->width || h != event->height )
+ {
+ ghb_settings_set_int(ud->settings, "window_width", event->width);
+ ghb_settings_set_int(ud->settings, "window_height", event->height);
+ ghb_pref_set(ud->settings, "window_width");
+ ghb_pref_set(ud->settings, "window_height");
+ ghb_prefs_store();
+ }
+ }
+ return FALSE;
}
diff --git a/gtk/src/callbacks.h b/gtk/src/callbacks.h
index 16e4b5b40..8b201e237 100644
--- a/gtk/src/callbacks.h
+++ b/gtk/src/callbacks.h
@@ -17,9 +17,9 @@
*
* You should have received a copy of the GNU General Public License
* along with callbacks.h. If not, write to:
- * The Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301, USA.
+ * The Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301, USA.
*/
#if !defined(_CALLBACKS_H_)
@@ -36,25 +36,25 @@ void ghb_check_all_depencencies(signal_user_data_t *ud);
gboolean ghb_timer_cb(gpointer data);
gboolean ghb_log_cb(GIOChannel *source, GIOCondition cond, gpointer data);
void warn_log_handler(
- const gchar *domain, GLogLevelFlags flags, const gchar *msg, gpointer ud);
+ const gchar *domain, GLogLevelFlags flags, const gchar *msg, gpointer ud);
void debug_log_handler(
- const gchar *domain, GLogLevelFlags flags, const gchar *msg, gpointer ud);
+ const gchar *domain, GLogLevelFlags flags, const gchar *msg, gpointer ud);
void ghb_hbfd(signal_user_data_t *ud, gboolean hbfd);
gboolean ghb_file_menu_add_dvd(signal_user_data_t *ud);
void ghb_udev_init(void);
gboolean ghb_message_dialog(
- GtkMessageType type, const gchar *message,
- const gchar *no, const gchar *yes);
+ GtkMessageType type, const gchar *message,
+ const gchar *no, const gchar *yes);
void ghb_error_dialog(
- GtkMessageType type, const gchar *message, const gchar *cancel);
+ GtkMessageType type, const gchar *message, const gchar *cancel);
void ghb_init_dep_map(void);
void ghb_cancel_encode(signal_user_data_t *ud, const gchar *extra_msg);
gboolean ghb_cancel_encode2(signal_user_data_t *ud, const gchar *extra_msg);
GValue* ghb_start_next_job(signal_user_data_t *ud, gboolean find_first);
void ghb_check_dependency(
- signal_user_data_t *ud, GtkWidget *widget, const gchar *alt_name);
+ signal_user_data_t *ud, GtkWidget *widget, const gchar *alt_name);
void ghb_do_scan( signal_user_data_t *ud, const gchar *filename,
- gint titlenum, gboolean force);
+ gint titlenum, gboolean force);
void ghb_log(gchar *log, ...);
gpointer ghb_check_update(signal_user_data_t *ud);
void ghb_uninhibit_gsm(void);
diff --git a/gtk/src/create_resources.c b/gtk/src/create_resources.c
index ca5ea828b..70342e4ca 100644
--- a/gtk/src/create_resources.c
+++ b/gtk/src/create_resources.c
@@ -12,38 +12,38 @@
enum
{
- R_NONE = 0,
- R_RESOURCES,
- R_SECTION,
- R_ICON,
- R_PLIST,
- R_STRING,
+ R_NONE = 0,
+ R_RESOURCES,
+ R_SECTION,
+ R_ICON,
+ R_PLIST,
+ R_STRING,
};
typedef struct
{
- gchar *tag;
- gint id;
+ gchar *tag;
+ gint id;
} tag_map_t;
static tag_map_t tag_map[] =
{
- {"resources", R_RESOURCES},
- {"section", R_SECTION},
- {"icon", R_ICON},
- {"plist", R_PLIST},
- {"string", R_STRING},
+ {"resources", R_RESOURCES},
+ {"section", R_SECTION},
+ {"icon", R_ICON},
+ {"plist", R_PLIST},
+ {"string", R_STRING},
};
-#define TAG_MAP_SZ (sizeof(tag_map)/sizeof(tag_map_t))
+#define TAG_MAP_SZ (sizeof(tag_map)/sizeof(tag_map_t))
typedef struct
{
- gchar *key;
- gchar *value;
- GValue *plist;
- GQueue *stack;
- GQueue *tag_stack;
- gboolean closed_top;
+ gchar *key;
+ gchar *value;
+ GValue *plist;
+ GQueue *stack;
+ GQueue *tag_stack;
+ gboolean closed_top;
} parse_data_t;
GList *inc_list = NULL;
@@ -51,427 +51,427 @@ GList *inc_list = NULL;
static gchar*
find_file(GList *list, const gchar *name)
{
- gchar *str;
- GList *link = list;
-
- while (link != NULL)
- {
- gchar *inc;
-
- inc = (gchar*)link->data;
- str = g_strdup_printf("%s/%s", inc, name);
- if (g_file_test(str, G_FILE_TEST_IS_REGULAR))
- {
- return str;
- }
- g_free(str);
- link = g_list_next(link);
- }
- if (g_file_test(name, G_FILE_TEST_IS_REGULAR))
- {
- return g_strdup(name);
- }
- return NULL;
+ gchar *str;
+ GList *link = list;
+
+ while (link != NULL)
+ {
+ gchar *inc;
+
+ inc = (gchar*)link->data;
+ str = g_strdup_printf("%s/%s", inc, name);
+ if (g_file_test(str, G_FILE_TEST_IS_REGULAR))
+ {
+ return str;
+ }
+ g_free(str);
+ link = g_list_next(link);
+ }
+ if (g_file_test(name, G_FILE_TEST_IS_REGULAR))
+ {
+ return g_strdup(name);
+ }
+ return NULL;
}
static const gchar*
lookup_attr_value(
- const gchar *name,
- const gchar **attr_names,
- const gchar **attr_values)
+ const gchar *name,
+ const gchar **attr_names,
+ const gchar **attr_values)
{
- gint ii;
-
- if (attr_names == NULL) return NULL;
- for (ii = 0; attr_names[ii] != NULL; ii++)
- {
- if (strcmp(name, attr_names[ii]) == 0)
- return attr_values[ii];
- }
- return NULL;
+ gint ii;
+
+ if (attr_names == NULL) return NULL;
+ for (ii = 0; attr_names[ii] != NULL; ii++)
+ {
+ if (strcmp(name, attr_names[ii]) == 0)
+ return attr_values[ii];
+ }
+ return NULL;
}
static GValue*
read_string_from_file(const gchar *filename)
{
- gchar *buffer;
- size_t size;
- GValue *gval;
- FILE *fd;
-
- fd = g_fopen(filename, "r");
- if (fd == NULL)
- return NULL;
- fseek(fd, 0, SEEK_END);
- size = ftell(fd);
- fseek(fd, 0, SEEK_SET);
- buffer = g_malloc(size+1);
- size = fread(buffer, 1, size, fd);
- buffer[size] = 0;
- gval = ghb_value_new(G_TYPE_STRING);
- g_value_take_string(gval, buffer);
- fclose(fd);
- return gval;
+ gchar *buffer;
+ size_t size;
+ GValue *gval;
+ FILE *fd;
+
+ fd = g_fopen(filename, "r");
+ if (fd == NULL)
+ return NULL;
+ fseek(fd, 0, SEEK_END);
+ size = ftell(fd);
+ fseek(fd, 0, SEEK_SET);
+ buffer = g_malloc(size+1);
+ size = fread(buffer, 1, size, fd);
+ buffer[size] = 0;
+ gval = ghb_value_new(G_TYPE_STRING);
+ g_value_take_string(gval, buffer);
+ fclose(fd);
+ return gval;
}
static void
start_element(
- GMarkupParseContext *ctx,
- const gchar *tag,
- const gchar **attr_names,
- const gchar **attr_values,
- gpointer ud,
- GError **error)
+ GMarkupParseContext *ctx,
+ const gchar *tag,
+ const gchar **attr_names,
+ const gchar **attr_values,
+ gpointer ud,
+ GError **error)
{
- parse_data_t *pd = (parse_data_t*)ud;
- union
- {
- gint id;
- gpointer pid;
- } id;
- gint ii;
-
- // Check to see if the first element found has been closed
- // If so, ignore any junk following it.
- if (pd->closed_top)
- return;
-
- for (ii = 0; ii < TAG_MAP_SZ; ii++)
- {
- if (strcmp(tag, tag_map[ii].tag) == 0)
- {
- id.id = tag_map[ii].id;
- break;
- }
- }
- if (ii == TAG_MAP_SZ)
- {
- g_warning("Unrecognized start tag (%s)", tag);
- return;
- }
- g_queue_push_head(pd->tag_stack, id.pid);
- GType gtype = 0;
- GValue *gval = NULL;
- GValue *current = g_queue_peek_head(pd->stack);
- switch (id.id)
- {
- case R_SECTION:
- {
- const gchar *name;
-
- name = lookup_attr_value("name", attr_names, attr_values);
- if (name && strcmp(name, "icons") == 0)
- {
- gval = ghb_dict_value_new();
- if (pd->key) g_free(pd->key);
- pd->key = g_strdup(name);
- g_queue_push_head(pd->stack, gval);
- }
- } break;
- case R_ICON:
- {
- gchar *filename;
- const gchar *name;
-
- name = lookup_attr_value("file", attr_names, attr_values);
- filename = find_file(inc_list, name);
- name = lookup_attr_value("name", attr_names, attr_values);
- if (filename && name)
- {
- ghb_rawdata_t *rd;
- GdkPixbuf *pb;
- GError *err = NULL;
-
- pb = gdk_pixbuf_new_from_file(filename, &err);
- if (pb == NULL)
- {
- g_warning("Failed to open icon file %s: %s", filename, err->message);
- break;
- }
- gval = ghb_dict_value_new();
- int colorspace = gdk_pixbuf_get_colorspace(pb);
- gboolean alpha = gdk_pixbuf_get_has_alpha(pb);
- int width = gdk_pixbuf_get_width(pb);
- int height = gdk_pixbuf_get_height(pb);
- int bps = gdk_pixbuf_get_bits_per_sample(pb);
- int rowstride = gdk_pixbuf_get_rowstride(pb);
-
- ghb_dict_insert(gval, g_strdup("colorspace"),
- ghb_int_value_new(colorspace));
- ghb_dict_insert(gval, g_strdup("alpha"),
- ghb_boolean_value_new(alpha));
- ghb_dict_insert(gval, g_strdup("width"),
- ghb_int_value_new(width));
- ghb_dict_insert(gval, g_strdup("height"),
- ghb_int_value_new(height));
- ghb_dict_insert(gval, g_strdup("bps"),
- ghb_int_value_new(bps));
- ghb_dict_insert(gval, g_strdup("rowstride"),
- ghb_int_value_new(rowstride));
-
- rd = g_malloc(sizeof(ghb_rawdata_t));
- rd->data = gdk_pixbuf_get_pixels(pb);
- rd->size = height * rowstride * bps / 8;
- GValue *data = ghb_rawdata_value_new(rd);
- ghb_dict_insert(gval, g_strdup("data"), data);
-
- if (pd->key) g_free(pd->key);
- pd->key = g_strdup(name);
- g_free(filename);
- }
- else
- {
- g_warning("%s:missing a requried attribute", name);
- exit(EXIT_FAILURE);
- }
- } break;
- case R_PLIST:
- {
- gchar *filename;
- const gchar *name;
-
- name = lookup_attr_value("file", attr_names, attr_values);
- filename = find_file(inc_list, name);
- name = lookup_attr_value("name", attr_names, attr_values);
- if (filename && name)
- {
- gval = ghb_plist_parse_file(filename);
- if (pd->key) g_free(pd->key);
- pd->key = g_strdup(name);
- g_free(filename);
- }
- else
- {
- g_warning("%s:missing a requried attribute", name);
- exit(EXIT_FAILURE);
- }
- } break;
- case R_STRING:
- {
- gchar *filename;
- const gchar *name;
-
- name = lookup_attr_value("file", attr_names, attr_values);
- filename = find_file(inc_list, name);
- name = lookup_attr_value("name", attr_names, attr_values);
- if (filename && name)
- {
- gval = read_string_from_file(filename);
- if (pd->key) g_free(pd->key);
- pd->key = g_strdup(name);
- g_free(filename);
- }
- else
- {
- g_warning("%s:missing a requried attribute", name);
- exit(EXIT_FAILURE);
- }
- } break;
- }
- // Add the element to the current container
- if (gval)
- { // There's an element to add
- if (current == NULL)
- {
- pd->plist = gval;
- return;
- }
- gtype = G_VALUE_TYPE(current);
- if (gtype == ghb_array_get_type())
- {
- ghb_array_append(current, gval);
- }
- else if (gtype == ghb_dict_get_type())
- {
- if (pd->key == NULL)
- {
- g_warning("No key for dictionary item");
- ghb_value_free(gval);
- }
- else
- {
- ghb_dict_insert(current, g_strdup(pd->key), gval);
- }
- }
- else
- {
- g_error("Invalid container type. This shouldn't happen");
- }
- }
+ parse_data_t *pd = (parse_data_t*)ud;
+ union
+ {
+ gint id;
+ gpointer pid;
+ } id;
+ gint ii;
+
+ // Check to see if the first element found has been closed
+ // If so, ignore any junk following it.
+ if (pd->closed_top)
+ return;
+
+ for (ii = 0; ii < TAG_MAP_SZ; ii++)
+ {
+ if (strcmp(tag, tag_map[ii].tag) == 0)
+ {
+ id.id = tag_map[ii].id;
+ break;
+ }
+ }
+ if (ii == TAG_MAP_SZ)
+ {
+ g_warning("Unrecognized start tag (%s)", tag);
+ return;
+ }
+ g_queue_push_head(pd->tag_stack, id.pid);
+ GType gtype = 0;
+ GValue *gval = NULL;
+ GValue *current = g_queue_peek_head(pd->stack);
+ switch (id.id)
+ {
+ case R_SECTION:
+ {
+ const gchar *name;
+
+ name = lookup_attr_value("name", attr_names, attr_values);
+ if (name && strcmp(name, "icons") == 0)
+ {
+ gval = ghb_dict_value_new();
+ if (pd->key) g_free(pd->key);
+ pd->key = g_strdup(name);
+ g_queue_push_head(pd->stack, gval);
+ }
+ } break;
+ case R_ICON:
+ {
+ gchar *filename;
+ const gchar *name;
+
+ name = lookup_attr_value("file", attr_names, attr_values);
+ filename = find_file(inc_list, name);
+ name = lookup_attr_value("name", attr_names, attr_values);
+ if (filename && name)
+ {
+ ghb_rawdata_t *rd;
+ GdkPixbuf *pb;
+ GError *err = NULL;
+
+ pb = gdk_pixbuf_new_from_file(filename, &err);
+ if (pb == NULL)
+ {
+ g_warning("Failed to open icon file %s: %s", filename, err->message);
+ break;
+ }
+ gval = ghb_dict_value_new();
+ int colorspace = gdk_pixbuf_get_colorspace(pb);
+ gboolean alpha = gdk_pixbuf_get_has_alpha(pb);
+ int width = gdk_pixbuf_get_width(pb);
+ int height = gdk_pixbuf_get_height(pb);
+ int bps = gdk_pixbuf_get_bits_per_sample(pb);
+ int rowstride = gdk_pixbuf_get_rowstride(pb);
+
+ ghb_dict_insert(gval, g_strdup("colorspace"),
+ ghb_int_value_new(colorspace));
+ ghb_dict_insert(gval, g_strdup("alpha"),
+ ghb_boolean_value_new(alpha));
+ ghb_dict_insert(gval, g_strdup("width"),
+ ghb_int_value_new(width));
+ ghb_dict_insert(gval, g_strdup("height"),
+ ghb_int_value_new(height));
+ ghb_dict_insert(gval, g_strdup("bps"),
+ ghb_int_value_new(bps));
+ ghb_dict_insert(gval, g_strdup("rowstride"),
+ ghb_int_value_new(rowstride));
+
+ rd = g_malloc(sizeof(ghb_rawdata_t));
+ rd->data = gdk_pixbuf_get_pixels(pb);
+ rd->size = height * rowstride * bps / 8;
+ GValue *data = ghb_rawdata_value_new(rd);
+ ghb_dict_insert(gval, g_strdup("data"), data);
+
+ if (pd->key) g_free(pd->key);
+ pd->key = g_strdup(name);
+ g_free(filename);
+ }
+ else
+ {
+ g_warning("%s:missing a requried attribute", name);
+ exit(EXIT_FAILURE);
+ }
+ } break;
+ case R_PLIST:
+ {
+ gchar *filename;
+ const gchar *name;
+
+ name = lookup_attr_value("file", attr_names, attr_values);
+ filename = find_file(inc_list, name);
+ name = lookup_attr_value("name", attr_names, attr_values);
+ if (filename && name)
+ {
+ gval = ghb_plist_parse_file(filename);
+ if (pd->key) g_free(pd->key);
+ pd->key = g_strdup(name);
+ g_free(filename);
+ }
+ else
+ {
+ g_warning("%s:missing a requried attribute", name);
+ exit(EXIT_FAILURE);
+ }
+ } break;
+ case R_STRING:
+ {
+ gchar *filename;
+ const gchar *name;
+
+ name = lookup_attr_value("file", attr_names, attr_values);
+ filename = find_file(inc_list, name);
+ name = lookup_attr_value("name", attr_names, attr_values);
+ if (filename && name)
+ {
+ gval = read_string_from_file(filename);
+ if (pd->key) g_free(pd->key);
+ pd->key = g_strdup(name);
+ g_free(filename);
+ }
+ else
+ {
+ g_warning("%s:missing a requried attribute", name);
+ exit(EXIT_FAILURE);
+ }
+ } break;
+ }
+ // Add the element to the current container
+ if (gval)
+ { // There's an element to add
+ if (current == NULL)
+ {
+ pd->plist = gval;
+ return;
+ }
+ gtype = G_VALUE_TYPE(current);
+ if (gtype == ghb_array_get_type())
+ {
+ ghb_array_append(current, gval);
+ }
+ else if (gtype == ghb_dict_get_type())
+ {
+ if (pd->key == NULL)
+ {
+ g_warning("No key for dictionary item");
+ ghb_value_free(gval);
+ }
+ else
+ {
+ ghb_dict_insert(current, g_strdup(pd->key), gval);
+ }
+ }
+ else
+ {
+ g_error("Invalid container type. This shouldn't happen");
+ }
+ }
}
static void
end_element(
- GMarkupParseContext *ctx,
- const gchar *name,
- gpointer ud,
- GError **error)
+ GMarkupParseContext *ctx,
+ const gchar *name,
+ gpointer ud,
+ GError **error)
{
- parse_data_t *pd = (parse_data_t*)ud;
- gint id;
- union
- {
- gint id;
- gpointer pid;
- } start_id;
- gint ii;
-
- // Check to see if the first element found has been closed
- // If so, ignore any junk following it.
- if (pd->closed_top)
- return;
-
- for (ii = 0; ii < TAG_MAP_SZ; ii++)
- {
- if (strcmp(name, tag_map[ii].tag) == 0)
- {
- id = tag_map[ii].id;
- break;
- }
- }
- if (ii == TAG_MAP_SZ)
- {
- g_warning("Unrecognized start tag (%s)", name);
- return;
- }
- start_id.pid = g_queue_pop_head(pd->tag_stack);
- if (start_id.id != id)
- g_warning("start tag != end tag: (%s %d) %d", name, id, id);
-
- GValue *gval = NULL;
- GValue *current = g_queue_peek_head(pd->stack);
- GType gtype = 0;
- switch (id)
- {
- case R_SECTION:
- {
- g_queue_pop_head(pd->stack);
- } break;
- }
- if (gval)
- {
- // Get the top of the data structure stack and if it's an array
- // or dict, add the current element
- if (current == NULL)
- {
- pd->plist = gval;
- pd->closed_top = TRUE;
- return;
- }
- gtype = G_VALUE_TYPE(current);
- if (gtype == ghb_array_get_type())
- {
- ghb_array_append(current, gval);
- }
- else if (gtype == ghb_dict_get_type())
- {
- if (pd->key == NULL)
- {
- g_warning("No key for dictionary item");
- ghb_value_free(gval);
- }
- else
- {
- ghb_dict_insert(current, g_strdup(pd->key), gval);
- }
- }
- else
- {
- g_error("Invalid container type. This shouldn't happen");
- }
- }
- if (g_queue_is_empty(pd->tag_stack))
- pd->closed_top = TRUE;
+ parse_data_t *pd = (parse_data_t*)ud;
+ gint id;
+ union
+ {
+ gint id;
+ gpointer pid;
+ } start_id;
+ gint ii;
+
+ // Check to see if the first element found has been closed
+ // If so, ignore any junk following it.
+ if (pd->closed_top)
+ return;
+
+ for (ii = 0; ii < TAG_MAP_SZ; ii++)
+ {
+ if (strcmp(name, tag_map[ii].tag) == 0)
+ {
+ id = tag_map[ii].id;
+ break;
+ }
+ }
+ if (ii == TAG_MAP_SZ)
+ {
+ g_warning("Unrecognized start tag (%s)", name);
+ return;
+ }
+ start_id.pid = g_queue_pop_head(pd->tag_stack);
+ if (start_id.id != id)
+ g_warning("start tag != end tag: (%s %d) %d", name, id, id);
+
+ GValue *gval = NULL;
+ GValue *current = g_queue_peek_head(pd->stack);
+ GType gtype = 0;
+ switch (id)
+ {
+ case R_SECTION:
+ {
+ g_queue_pop_head(pd->stack);
+ } break;
+ }
+ if (gval)
+ {
+ // Get the top of the data structure stack and if it's an array
+ // or dict, add the current element
+ if (current == NULL)
+ {
+ pd->plist = gval;
+ pd->closed_top = TRUE;
+ return;
+ }
+ gtype = G_VALUE_TYPE(current);
+ if (gtype == ghb_array_get_type())
+ {
+ ghb_array_append(current, gval);
+ }
+ else if (gtype == ghb_dict_get_type())
+ {
+ if (pd->key == NULL)
+ {
+ g_warning("No key for dictionary item");
+ ghb_value_free(gval);
+ }
+ else
+ {
+ ghb_dict_insert(current, g_strdup(pd->key), gval);
+ }
+ }
+ else
+ {
+ g_error("Invalid container type. This shouldn't happen");
+ }
+ }
+ if (g_queue_is_empty(pd->tag_stack))
+ pd->closed_top = TRUE;
}
static void
text_data(
- GMarkupParseContext *ctx,
- const gchar *text,
- gsize len,
- gpointer ud,
- GError **error)
+ GMarkupParseContext *ctx,
+ const gchar *text,
+ gsize len,
+ gpointer ud,
+ GError **error)
{
- parse_data_t *pd = (parse_data_t*)ud;
- if (pd->value) g_free(pd->value);
- pd->value = g_strdup(text);
+ parse_data_t *pd = (parse_data_t*)ud;
+ if (pd->value) g_free(pd->value);
+ pd->value = g_strdup(text);
}
static void
passthrough(
- GMarkupParseContext *ctx,
- const gchar *text,
- gsize len,
- gpointer ud,
- GError **error)
+ GMarkupParseContext *ctx,
+ const gchar *text,
+ gsize len,
+ gpointer ud,
+ GError **error)
{
- //parse_data_t *pd = (parse_data_t*)ud;
+ //parse_data_t *pd = (parse_data_t*)ud;
- //g_debug("passthrough %s", text);
+ //g_debug("passthrough %s", text);
}
static void
parse_error(GMarkupParseContext *ctx, GError *error, gpointer ud)
{
- g_warning("Resource parse error: %s", error->message);
+ g_warning("Resource parse error: %s", error->message);
}
// This is required or the parser crashes
static void
destroy_notify(gpointer data)
{ // Do nothing
- //g_debug("destroy parser");
+ //g_debug("destroy parser");
}
GValue*
ghb_resource_parse(const gchar *buf, gssize len)
{
- GMarkupParseContext *ctx;
- GMarkupParser parser;
- parse_data_t pd;
- GError *err = NULL;
-
- pd.stack = g_queue_new();
- pd.tag_stack = g_queue_new();
- pd.key = NULL;
- pd.value = NULL;
- pd.plist = ghb_dict_value_new();
- g_queue_push_head(pd.stack, pd.plist);
- pd.closed_top = FALSE;
-
- parser.start_element = start_element;
- parser.end_element = end_element;
- parser.text = text_data;
- parser.passthrough = passthrough;
- parser.error = parse_error;
- ctx = g_markup_parse_context_new(&parser, 0, &pd, destroy_notify);
-
- g_markup_parse_context_parse(ctx, buf, len, &err);
- g_markup_parse_context_end_parse(ctx, &err);
- g_markup_parse_context_free(ctx);
- g_queue_free(pd.stack);
- g_queue_free(pd.tag_stack);
- return pd.plist;
+ GMarkupParseContext *ctx;
+ GMarkupParser parser;
+ parse_data_t pd;
+ GError *err = NULL;
+
+ pd.stack = g_queue_new();
+ pd.tag_stack = g_queue_new();
+ pd.key = NULL;
+ pd.value = NULL;
+ pd.plist = ghb_dict_value_new();
+ g_queue_push_head(pd.stack, pd.plist);
+ pd.closed_top = FALSE;
+
+ parser.start_element = start_element;
+ parser.end_element = end_element;
+ parser.text = text_data;
+ parser.passthrough = passthrough;
+ parser.error = parse_error;
+ ctx = g_markup_parse_context_new(&parser, 0, &pd, destroy_notify);
+
+ g_markup_parse_context_parse(ctx, buf, len, &err);
+ g_markup_parse_context_end_parse(ctx, &err);
+ g_markup_parse_context_free(ctx);
+ g_queue_free(pd.stack);
+ g_queue_free(pd.tag_stack);
+ return pd.plist;
}
GValue*
ghb_resource_parse_file(FILE *fd)
{
- gchar *buffer;
- size_t size;
- GValue *gval;
-
- if (fd == NULL)
- return NULL;
- fseek(fd, 0, SEEK_END);
- size = ftell(fd);
- fseek(fd, 0, SEEK_SET);
- buffer = g_malloc(size+1);
- size = fread(buffer, 1, size, fd);
- buffer[size] = 0;
- gval = ghb_resource_parse(buffer, (gssize)size);
- g_free(buffer);
- return gval;
+ gchar *buffer;
+ size_t size;
+ GValue *gval;
+
+ if (fd == NULL)
+ return NULL;
+ fseek(fd, 0, SEEK_END);
+ size = ftell(fd);
+ fseek(fd, 0, SEEK_SET);
+ buffer = g_malloc(size+1);
+ size = fread(buffer, 1, size, fd);
+ buffer[size] = 0;
+ gval = ghb_resource_parse(buffer, (gssize)size);
+ g_free(buffer);
+ return gval;
}
static void
@@ -495,10 +495,10 @@ usage(char *cmd)
gint
main(gint argc, gchar *argv[])
{
- FILE *file;
- GValue *gval;
+ FILE *file;
+ GValue *gval;
int opt;
- const gchar *src, *dst;
+ const gchar *src, *dst;
do
{
@@ -508,30 +508,30 @@ main(gint argc, gchar *argv[])
case -1: break;
case 'I':
- inc_list = g_list_prepend(inc_list, g_strdup(optarg));
+ inc_list = g_list_prepend(inc_list, g_strdup(optarg));
break;
}
} while (opt != -1);
- if (optind != argc - 2)
- {
- usage(argv[0]);
- return EXIT_FAILURE;
- }
+ if (optind != argc - 2)
+ {
+ usage(argv[0]);
+ return EXIT_FAILURE;
+ }
src = argv[optind++];
dst = argv[optind++];
- g_type_init();
- file = g_fopen(src, "r");
- if (file == NULL)
- {
- fprintf(stderr, "Error: failed to open %s\n", src);
- return EXIT_FAILURE;
- }
-
- gval = ghb_resource_parse_file(file);
- ghb_plist_write_file(dst, gval);
- fclose(file);
- return 0;
+ g_type_init();
+ file = g_fopen(src, "r");
+ if (file == NULL)
+ {
+ fprintf(stderr, "Error: failed to open %s\n", src);
+ return EXIT_FAILURE;
+ }
+
+ gval = ghb_resource_parse_file(file);
+ ghb_plist_write_file(dst, gval);
+ fclose(file);
+ return 0;
}
diff --git a/gtk/src/create_resources.py b/gtk/src/create_resources.py
index 5d21ba809..ba5526361 100644
--- a/gtk/src/create_resources.py
+++ b/gtk/src/create_resources.py
@@ -16,148 +16,148 @@ stack = list()
stack.append(pl)
def top(ss):
- return ss[len(ss)-1]
+ return ss[len(ss)-1]
def end_element_handler(tag):
- global stack
+ global stack
- if tag == "section":
- stack.pop()
+ if tag == "section":
+ stack.pop()
def start_element_handler(tag, attr):
- global pl, stack
-
- current = top(stack)
- key = val = None
- if tag == "section":
- key = attr["name"]
- if key == "icons":
- val = dict()
- stack.append(val)
- elif tag == "icon":
- fbase = attr["file"]
- fname = find_file(fbase)
- key = attr["name"]
- if fname != None and key != None:
- val = dict()
- pb = gdk.pixbuf_new_from_file(fname)
- val["colorspace"] = pb.get_colorspace()
- val["alpha"] = pb.get_has_alpha()
- val["bps"] = pb.get_bits_per_sample()
- val["width"] = pb.get_width()
- val["height"] = pb.get_height()
- val["rowstride"] = pb.get_rowstride()
- val["data"] = plistlib.Data(pb.get_pixels())
- elif fname == None:
- print >> sys.stderr, ( "Error: No such icon file %s" % fbase )
- sys.exit(1)
- elif tag == "plist":
- fbase = attr["file"]
- fname = find_file(fbase)
- key = attr["name"]
- if fname != None and key != None:
- val = plistlib.readPlist(fname)
- elif fname == None:
- print >> sys.stderr, ( "Error: No such plist file %s" % fbase )
- sys.exit(1)
- elif tag == "string":
- fbase = attr["file"]
- fname = find_file(fbase)
- key = attr["name"]
- if fname != None and key != None:
- try:
- ff = open(fname)
- val = ff.read()
- except Exception, err:
- print >> sys.stderr, ( "Error: %s" % str(err) )
- sys.exit(1)
- elif fname == None:
- print >> sys.stderr, ( "Error: No such string file %s" % fbase )
- sys.exit(1)
-
- if val != None:
- if type(current) == types.DictType:
- current[key] = val
- elif type(current) == types.TupleType:
- current.append(val)
+ global pl, stack
+
+ current = top(stack)
+ key = val = None
+ if tag == "section":
+ key = attr["name"]
+ if key == "icons":
+ val = dict()
+ stack.append(val)
+ elif tag == "icon":
+ fbase = attr["file"]
+ fname = find_file(fbase)
+ key = attr["name"]
+ if fname != None and key != None:
+ val = dict()
+ pb = gdk.pixbuf_new_from_file(fname)
+ val["colorspace"] = pb.get_colorspace()
+ val["alpha"] = pb.get_has_alpha()
+ val["bps"] = pb.get_bits_per_sample()
+ val["width"] = pb.get_width()
+ val["height"] = pb.get_height()
+ val["rowstride"] = pb.get_rowstride()
+ val["data"] = plistlib.Data(pb.get_pixels())
+ elif fname == None:
+ print >> sys.stderr, ( "Error: No such icon file %s" % fbase )
+ sys.exit(1)
+ elif tag == "plist":
+ fbase = attr["file"]
+ fname = find_file(fbase)
+ key = attr["name"]
+ if fname != None and key != None:
+ val = plistlib.readPlist(fname)
+ elif fname == None:
+ print >> sys.stderr, ( "Error: No such plist file %s" % fbase )
+ sys.exit(1)
+ elif tag == "string":
+ fbase = attr["file"]
+ fname = find_file(fbase)
+ key = attr["name"]
+ if fname != None and key != None:
+ try:
+ ff = open(fname)
+ val = ff.read()
+ except Exception, err:
+ print >> sys.stderr, ( "Error: %s" % str(err) )
+ sys.exit(1)
+ elif fname == None:
+ print >> sys.stderr, ( "Error: No such string file %s" % fbase )
+ sys.exit(1)
+
+ if val != None:
+ if type(current) == types.DictType:
+ current[key] = val
+ elif type(current) == types.TupleType:
+ current.append(val)
def cdata_handler(str):
- return
+ return
def resource_parse_file(infile):
- parser = expat.ParserCreate()
- parser.StartElementHandler = start_element_handler
- parser.EndElementHandler = end_element_handler
- parser.CharacterDataHandler = cdata_handler
- parser.ParseFile(infile)
+ parser = expat.ParserCreate()
+ parser.StartElementHandler = start_element_handler
+ parser.EndElementHandler = end_element_handler
+ parser.CharacterDataHandler = cdata_handler
+ parser.ParseFile(infile)
def usage():
- print >> sys.stderr, (
- "Usage: %s [-I <inc path>] <resource list> [resource plist]\n"
- "Summary:\n"
- " Creates a resource plist from a resource list\n\n"
- "Options:\n"
- " I - Include path to search for files\n"
- " <resource list> Input resources file\n"
- " <resource plist> Output resources plist file\n"
- % sys.argv[0]
- )
+ print >> sys.stderr, (
+ "Usage: %s [-I <inc path>] <resource list> [resource plist]\n"
+ "Summary:\n"
+ " Creates a resource plist from a resource list\n\n"
+ "Options:\n"
+ " I - Include path to search for files\n"
+ " <resource list> Input resources file\n"
+ " <resource plist> Output resources plist file\n"
+ % sys.argv[0]
+ )
inc_list = list()
def find_file(name):
- global inc_list
+ global inc_list
- for inc_dir in inc_list:
- inc = "%s/%s" % (inc_dir, name)
- if os.path.isfile(inc):
- return inc
+ for inc_dir in inc_list:
+ inc = "%s/%s" % (inc_dir, name)
+ if os.path.isfile(inc):
+ return inc
- if os.path.isfile(name):
- return name
+ if os.path.isfile(name):
+ return name
- return None
+ return None
def main():
- global inc_list
-
- OPTS = "I:"
- try:
- opts, args = getopt.gnu_getopt(sys.argv[1:], OPTS)
- except getopt.GetoptError, err:
- print >> sys.stderr, str(err)
- usage()
- sys.exit(2)
-
- for o, a in opts:
- if o == "-I":
- # add to include list
- inc_list.append(a)
- else:
- assert False, "unhandled option"
-
- if len(args) > 2 or len(args) < 1:
- usage()
- sys.exit(2)
-
- try:
- infile = open(args[0])
- except Exception, err:
- print >> sys.stderr, ( "Error: %s" % str(err) )
- sys.exit(1)
-
- if len(args) > 1:
- try:
- outfile = open(args[1], "w")
- except Exception, err:
- print >> sys.stderr, ( "Error: %s" % str(err))
- sys.exit(1)
- else:
- outfile = sys.stdout
-
- resource_parse_file(infile)
- plistlib.writePlist(pl, outfile)
+ global inc_list
+
+ OPTS = "I:"
+ try:
+ opts, args = getopt.gnu_getopt(sys.argv[1:], OPTS)
+ except getopt.GetoptError, err:
+ print >> sys.stderr, str(err)
+ usage()
+ sys.exit(2)
+
+ for o, a in opts:
+ if o == "-I":
+ # add to include list
+ inc_list.append(a)
+ else:
+ assert False, "unhandled option"
+
+ if len(args) > 2 or len(args) < 1:
+ usage()
+ sys.exit(2)
+
+ try:
+ infile = open(args[0])
+ except Exception, err:
+ print >> sys.stderr, ( "Error: %s" % str(err) )
+ sys.exit(1)
+
+ if len(args) > 1:
+ try:
+ outfile = open(args[1], "w")
+ except Exception, err:
+ print >> sys.stderr, ( "Error: %s" % str(err))
+ sys.exit(1)
+ else:
+ outfile = sys.stdout
+
+ resource_parse_file(infile)
+ plistlib.writePlist(pl, outfile)
main()
diff --git a/gtk/src/ghb-dvd.c b/gtk/src/ghb-dvd.c
index 32f77f27c..297aadb7a 100644
--- a/gtk/src/ghb-dvd.c
+++ b/gtk/src/ghb-dvd.c
@@ -32,9 +32,9 @@
*
* Copyright (C) 2004 Kay Sievers <[email protected]>
*
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation version 2 of the License.
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2 of the License.
*/
#if defined(_WIN32)
@@ -52,52 +52,52 @@
#include <string.h>
#ifndef PACKED
-#define PACKED __attribute__((packed))
+#define PACKED __attribute__((packed))
#endif
struct volume_descriptor {
- struct descriptor_tag {
- guint16 id;
- guint16 version;
- guint8 checksum;
- guint8 reserved;
- guint16 serial;
- guint16 crc;
- guint16 crc_len;
- guint32 location;
- } PACKED tag;
- union {
- struct anchor_descriptor {
- guint32 length;
- guint32 location;
- } PACKED anchor;
- struct primary_descriptor {
- guint32 seq_num;
- guint32 desc_num;
- struct dstring {
- guint8 clen;
- guint8 c[31];
- } PACKED ident;
- } PACKED primary;
- } PACKED type;
+ struct descriptor_tag {
+ guint16 id;
+ guint16 version;
+ guint8 checksum;
+ guint8 reserved;
+ guint16 serial;
+ guint16 crc;
+ guint16 crc_len;
+ guint32 location;
+ } PACKED tag;
+ union {
+ struct anchor_descriptor {
+ guint32 length;
+ guint32 location;
+ } PACKED anchor;
+ struct primary_descriptor {
+ guint32 seq_num;
+ guint32 desc_num;
+ struct dstring {
+ guint8 clen;
+ guint8 c[31];
+ } PACKED ident;
+ } PACKED primary;
+ } PACKED type;
} PACKED;
struct volume_structure_descriptor {
- guint8 type;
- guint8 id[5];
- guint8 version;
+ guint8 type;
+ guint8 id[5];
+ guint8 version;
} PACKED;
-#define VOLUME_ID_LABEL_SIZE 64
+#define VOLUME_ID_LABEL_SIZE 64
typedef struct
{
- gint fd;
- gchar label[VOLUME_ID_LABEL_SIZE+1];
+ gint fd;
+ gchar label[VOLUME_ID_LABEL_SIZE+1];
} udf_info_t;
enum endian {
- LE = 0,
- BE = 1
+ LE = 0,
+ BE = 1
};
#ifdef __BYTE_ORDER
@@ -122,294 +122,294 @@ enum endian {
#endif
#endif /* __BYTE_ORDER */
-#define UDF_VSD_OFFSET 0x8000
+#define UDF_VSD_OFFSET 0x8000
static guint8*
get_buffer(int fd, guint64 off, gsize len)
{
- gint buf_len;
-
- if (lseek(fd, off, SEEK_SET) < 0)
- {
- return NULL;
- }
- guint8 *buffer = g_malloc(len);
- buf_len = read(fd, buffer, len);
- if (buf_len < 0)
- {
- g_free(buffer);
- return NULL;
- }
- return buffer;
+ gint buf_len;
+
+ if (lseek(fd, off, SEEK_SET) < 0)
+ {
+ return NULL;
+ }
+ guint8 *buffer = g_malloc(len);
+ buf_len = read(fd, buffer, len);
+ if (buf_len < 0)
+ {
+ g_free(buffer);
+ return NULL;
+ }
+ return buffer;
}
static gint
set_unicode16(guint8 *str, gsize len, const guint8 *buf, gint endianess, gsize count)
{
- gint ii, jj;
- guint16 c;
-
- jj = 0;
- for (ii = 0; ii + 2 <= count; ii += 2) {
- if (endianess == LE)
- c = (buf[ii+1] << 8) | buf[ii];
- else
- c = (buf[ii] << 8) | buf[ii+1];
- if (c == 0) {
- str[jj] = '\0';
- break;
- } else if (c < 0x80) {
- if (jj+1 >= len)
- break;
- str[jj++] = (guint8) c;
- } else if (c < 0x800) {
- if (jj+2 >= len)
- break;
- str[jj++] = (guint8) (0xc0 | (c >> 6));
- str[jj++] = (guint8) (0x80 | (c & 0x3f));
- } else {
- if (jj+3 >= len)
- break;
- str[jj++] = (guint8) (0xe0 | (c >> 12));
- str[jj++] = (guint8) (0x80 | ((c >> 6) & 0x3f));
- str[jj++] = (guint8) (0x80 | (c & 0x3f));
- }
- }
- str[jj] = '\0';
- return jj;
+ gint ii, jj;
+ guint16 c;
+
+ jj = 0;
+ for (ii = 0; ii + 2 <= count; ii += 2) {
+ if (endianess == LE)
+ c = (buf[ii+1] << 8) | buf[ii];
+ else
+ c = (buf[ii] << 8) | buf[ii+1];
+ if (c == 0) {
+ str[jj] = '\0';
+ break;
+ } else if (c < 0x80) {
+ if (jj+1 >= len)
+ break;
+ str[jj++] = (guint8) c;
+ } else if (c < 0x800) {
+ if (jj+2 >= len)
+ break;
+ str[jj++] = (guint8) (0xc0 | (c >> 6));
+ str[jj++] = (guint8) (0x80 | (c & 0x3f));
+ } else {
+ if (jj+3 >= len)
+ break;
+ str[jj++] = (guint8) (0xe0 | (c >> 12));
+ str[jj++] = (guint8) (0x80 | ((c >> 6) & 0x3f));
+ str[jj++] = (guint8) (0x80 | (c & 0x3f));
+ }
+ }
+ str[jj] = '\0';
+ return jj;
}
static void
set_label_string(guint8 *str, const guint8 *buf, gsize count)
{
- gint ii;
-
- memcpy(str, buf, count);
- str[count] = 0;
-
- /* remove trailing whitespace */
- ii = strlen((gchar*)str);
- while (ii--)
- {
- if (!g_ascii_isspace(str[ii]))
- break;
- }
- str[ii+1] = 0;
+ gint ii;
+
+ memcpy(str, buf, count);
+ str[count] = 0;
+
+ /* remove trailing whitespace */
+ ii = strlen((gchar*)str);
+ while (ii--)
+ {
+ if (!g_ascii_isspace(str[ii]))
+ break;
+ }
+ str[ii+1] = 0;
}
static gint
probe_udf(udf_info_t *id)
{
- struct volume_descriptor *vd;
- struct volume_structure_descriptor *vsd;
- guint bs;
- guint b;
- guint type;
- guint count;
- guint loc;
- guint clen;
- guint64 off = 0;
-
- vsd = (struct volume_structure_descriptor *) get_buffer(id->fd, off + UDF_VSD_OFFSET, 0x200);
- if (vsd == NULL)
- return -1;
-
- if (memcmp(vsd->id, "NSR02", 5) == 0)
- goto blocksize;
- if (memcmp(vsd->id, "NSR03", 5) == 0)
- goto blocksize;
- if (memcmp(vsd->id, "BEA01", 5) == 0)
- goto blocksize;
- if (memcmp(vsd->id, "BOOT2", 5) == 0)
- goto blocksize;
- if (memcmp(vsd->id, "CD001", 5) == 0)
- goto blocksize;
- if (memcmp(vsd->id, "CDW02", 5) == 0)
- goto blocksize;
- if (memcmp(vsd->id, "TEA03", 5) == 0)
- goto blocksize;
- return -1;
+ struct volume_descriptor *vd;
+ struct volume_structure_descriptor *vsd;
+ guint bs;
+ guint b;
+ guint type;
+ guint count;
+ guint loc;
+ guint clen;
+ guint64 off = 0;
+
+ vsd = (struct volume_structure_descriptor *) get_buffer(id->fd, off + UDF_VSD_OFFSET, 0x200);
+ if (vsd == NULL)
+ return -1;
+
+ if (memcmp(vsd->id, "NSR02", 5) == 0)
+ goto blocksize;
+ if (memcmp(vsd->id, "NSR03", 5) == 0)
+ goto blocksize;
+ if (memcmp(vsd->id, "BEA01", 5) == 0)
+ goto blocksize;
+ if (memcmp(vsd->id, "BOOT2", 5) == 0)
+ goto blocksize;
+ if (memcmp(vsd->id, "CD001", 5) == 0)
+ goto blocksize;
+ if (memcmp(vsd->id, "CDW02", 5) == 0)
+ goto blocksize;
+ if (memcmp(vsd->id, "TEA03", 5) == 0)
+ goto blocksize;
+ return -1;
blocksize:
- /* search the next VSD to get the logical block size of the volume */
- for (bs = 0x800; bs < 0x8000; bs += 0x800) {
- vsd = (struct volume_structure_descriptor *) get_buffer(id->fd, off + UDF_VSD_OFFSET + bs, 0x800);
- if (vsd == NULL)
- return -1;
- if (vsd->id[0] != '\0')
- goto nsr;
- }
- return -1;
+ /* search the next VSD to get the logical block size of the volume */
+ for (bs = 0x800; bs < 0x8000; bs += 0x800) {
+ vsd = (struct volume_structure_descriptor *) get_buffer(id->fd, off + UDF_VSD_OFFSET + bs, 0x800);
+ if (vsd == NULL)
+ return -1;
+ if (vsd->id[0] != '\0')
+ goto nsr;
+ }
+ return -1;
nsr:
- /* search the list of VSDs for a NSR descriptor */
- for (b = 0; b < 64; b++) {
- vsd = (struct volume_structure_descriptor *) get_buffer(id->fd, off + UDF_VSD_OFFSET + (b * bs), 0x800);
- if (vsd == NULL)
- return -1;
-
- if (vsd->id[0] == '\0')
- return -1;
- if (memcmp(vsd->id, "NSR02", 5) == 0)
- goto anchor;
- if (memcmp(vsd->id, "NSR03", 5) == 0)
- goto anchor;
- }
- return -1;
+ /* search the list of VSDs for a NSR descriptor */
+ for (b = 0; b < 64; b++) {
+ vsd = (struct volume_structure_descriptor *) get_buffer(id->fd, off + UDF_VSD_OFFSET + (b * bs), 0x800);
+ if (vsd == NULL)
+ return -1;
+
+ if (vsd->id[0] == '\0')
+ return -1;
+ if (memcmp(vsd->id, "NSR02", 5) == 0)
+ goto anchor;
+ if (memcmp(vsd->id, "NSR03", 5) == 0)
+ goto anchor;
+ }
+ return -1;
anchor:
- /* read anchor volume descriptor */
- vd = (struct volume_descriptor *) get_buffer(id->fd, off + (256 * bs), 0x200);
- if (vd == NULL)
- return -1;
-
- type = le16_to_cpu(vd->tag.id);
- if (type != 2) /* TAG_ID_AVDP */
- goto found;
-
- /* get desriptor list address and block count */
- count = le32_to_cpu(vd->type.anchor.length) / bs;
- loc = le32_to_cpu(vd->type.anchor.location);
-
- /* pick the primary descriptor from the list */
- for (b = 0; b < count; b++) {
- vd = (struct volume_descriptor *) get_buffer(id->fd, off + ((loc + b) * bs), 0x200);
- if (vd == NULL)
- return -1;
-
- type = le16_to_cpu(vd->tag.id);
-
- /* check validity */
- if (type == 0)
- goto found;
- if (le32_to_cpu(vd->tag.location) != loc + b)
- goto found;
-
- if (type == 1) /* TAG_ID_PVD */
- goto pvd;
- }
- goto found;
+ /* read anchor volume descriptor */
+ vd = (struct volume_descriptor *) get_buffer(id->fd, off + (256 * bs), 0x200);
+ if (vd == NULL)
+ return -1;
+
+ type = le16_to_cpu(vd->tag.id);
+ if (type != 2) /* TAG_ID_AVDP */
+ goto found;
+
+ /* get desriptor list address and block count */
+ count = le32_to_cpu(vd->type.anchor.length) / bs;
+ loc = le32_to_cpu(vd->type.anchor.location);
+
+ /* pick the primary descriptor from the list */
+ for (b = 0; b < count; b++) {
+ vd = (struct volume_descriptor *) get_buffer(id->fd, off + ((loc + b) * bs), 0x200);
+ if (vd == NULL)
+ return -1;
+
+ type = le16_to_cpu(vd->tag.id);
+
+ /* check validity */
+ if (type == 0)
+ goto found;
+ if (le32_to_cpu(vd->tag.location) != loc + b)
+ goto found;
+
+ if (type == 1) /* TAG_ID_PVD */
+ goto pvd;
+ }
+ goto found;
pvd:
- clen = vd->type.primary.ident.clen;
- if (clen == 8)
- set_label_string((guint8*)id->label, vd->type.primary.ident.c, 31);
- else if (clen == 16)
- set_unicode16((guint8*)id->label, sizeof(id->label), vd->type.primary.ident.c, BE, 31);
+ clen = vd->type.primary.ident.clen;
+ if (clen == 8)
+ set_label_string((guint8*)id->label, vd->type.primary.ident.c, 31);
+ else if (clen == 16)
+ set_unicode16((guint8*)id->label, sizeof(id->label), vd->type.primary.ident.c, BE, 31);
found:
- return 0;
+ return 0;
}
gchar*
ghb_dvd_volname(const gchar *device)
{
- udf_info_t id;
- gchar *buffer = NULL;
-
- id.fd = open(device, O_RDONLY);
- if (id.fd < 0) {
- return NULL;
- }
- if (probe_udf (&id) == 0)
- {
- buffer = g_strdup(id.label);
- }
- return buffer;
+ udf_info_t id;
+ gchar *buffer = NULL;
+
+ id.fd = open(device, O_RDONLY);
+ if (id.fd < 0) {
+ return NULL;
+ }
+ if (probe_udf (&id) == 0)
+ {
+ buffer = g_strdup(id.label);
+ }
+ return buffer;
}
#endif
gchar*
ghb_resolve_symlink(const gchar *name)
{
- gchar *file;
- GFileInfo *info;
- GFile *gfile;
-
- gfile = g_file_new_for_path(name);
- info = g_file_query_info(gfile,
- G_FILE_ATTRIBUTE_STANDARD_NAME ","
- G_FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET ","
- G_FILE_ATTRIBUTE_STANDARD_IS_SYMLINK,
- G_FILE_QUERY_INFO_NONE, NULL, NULL);
- while ((info != NULL) && g_file_info_get_is_symlink(info))
- {
- GFile *parent;
- const gchar *target;
-
- parent = g_file_get_parent(gfile);
- g_object_unref(gfile);
- target = g_file_info_get_symlink_target(info);
- gfile = g_file_resolve_relative_path(parent, target);
- g_object_unref(parent);
-
- g_object_unref(info);
- info = g_file_query_info(gfile,
- G_FILE_ATTRIBUTE_STANDARD_NAME ","
- G_FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET ","
- G_FILE_ATTRIBUTE_STANDARD_IS_SYMLINK,
- G_FILE_QUERY_INFO_NONE, NULL, NULL);
- }
- if (info != NULL)
- {
- file = g_file_get_path(gfile);
- g_object_unref(info);
- }
- else
- {
- file = g_strdup(name);
- }
- g_object_unref(gfile);
- return file;
+ gchar *file;
+ GFileInfo *info;
+ GFile *gfile;
+
+ gfile = g_file_new_for_path(name);
+ info = g_file_query_info(gfile,
+ G_FILE_ATTRIBUTE_STANDARD_NAME ","
+ G_FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET ","
+ G_FILE_ATTRIBUTE_STANDARD_IS_SYMLINK,
+ G_FILE_QUERY_INFO_NONE, NULL, NULL);
+ while ((info != NULL) && g_file_info_get_is_symlink(info))
+ {
+ GFile *parent;
+ const gchar *target;
+
+ parent = g_file_get_parent(gfile);
+ g_object_unref(gfile);
+ target = g_file_info_get_symlink_target(info);
+ gfile = g_file_resolve_relative_path(parent, target);
+ g_object_unref(parent);
+
+ g_object_unref(info);
+ info = g_file_query_info(gfile,
+ G_FILE_ATTRIBUTE_STANDARD_NAME ","
+ G_FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET ","
+ G_FILE_ATTRIBUTE_STANDARD_IS_SYMLINK,
+ G_FILE_QUERY_INFO_NONE, NULL, NULL);
+ }
+ if (info != NULL)
+ {
+ file = g_file_get_path(gfile);
+ g_object_unref(info);
+ }
+ else
+ {
+ file = g_strdup(name);
+ }
+ g_object_unref(gfile);
+ return file;
}
void
ghb_dvd_set_current(const gchar *name, signal_user_data_t *ud)
{
#if !defined(_WIN32)
- GFile *gfile;
- GFileInfo *info;
- gchar *resolved = ghb_resolve_symlink(name);
-
- if (ud->current_dvd_device != NULL)
- {
- g_free(ud->current_dvd_device);
- ud->current_dvd_device = NULL;
- }
- gfile = g_file_new_for_path(resolved);
- info = g_file_query_info(gfile,
- G_FILE_ATTRIBUTE_STANDARD_TYPE,
- G_FILE_QUERY_INFO_NONE, NULL, NULL);
- if (info != NULL)
- {
- if (g_file_info_get_file_type(info) == G_FILE_TYPE_SPECIAL)
- {
- // I could go through the trouble to scan the connected drives and
- // verify that this device is connected and is a DVD. But I don't
- // think its neccessary.
- ud->current_dvd_device = resolved;
- }
- g_object_unref(info);
- }
- else
- {
- g_free(resolved);
- }
- g_object_unref(gfile);
+ GFile *gfile;
+ GFileInfo *info;
+ gchar *resolved = ghb_resolve_symlink(name);
+
+ if (ud->current_dvd_device != NULL)
+ {
+ g_free(ud->current_dvd_device);
+ ud->current_dvd_device = NULL;
+ }
+ gfile = g_file_new_for_path(resolved);
+ info = g_file_query_info(gfile,
+ G_FILE_ATTRIBUTE_STANDARD_TYPE,
+ G_FILE_QUERY_INFO_NONE, NULL, NULL);
+ if (info != NULL)
+ {
+ if (g_file_info_get_file_type(info) == G_FILE_TYPE_SPECIAL)
+ {
+ // I could go through the trouble to scan the connected drives and
+ // verify that this device is connected and is a DVD. But I don't
+ // think its neccessary.
+ ud->current_dvd_device = resolved;
+ }
+ g_object_unref(info);
+ }
+ else
+ {
+ g_free(resolved);
+ }
+ g_object_unref(gfile);
#else
- gchar drive[4];
- guint dtype;
-
- if (ud->current_dvd_device != NULL)
- {
- g_free(ud->current_dvd_device);
- ud->current_dvd_device = NULL;
- }
- g_strlcpy(drive, name, 4);
- dtype = GetDriveType(drive);
- if (dtype == DRIVE_CDROM)
- {
- ud->current_dvd_device = g_strdup(name);
- }
+ gchar drive[4];
+ guint dtype;
+
+ if (ud->current_dvd_device != NULL)
+ {
+ g_free(ud->current_dvd_device);
+ ud->current_dvd_device = NULL;
+ }
+ g_strlcpy(drive, name, 4);
+ dtype = GetDriveType(drive);
+ if (dtype == DRIVE_CDROM)
+ {
+ ud->current_dvd_device = g_strdup(name);
+ }
#endif
}
diff --git a/gtk/src/ghb.ui b/gtk/src/ghb.ui
index 9aca658ff..c7e78383e 100644
--- a/gtk/src/ghb.ui
+++ b/gtk/src/ghb.ui
@@ -1254,417 +1254,417 @@
<property name="top_padding">10</property>
<property name="left_padding">10</property>
- <child>
- <object class="GtkVBox" id="vbox43">
- <property name="orientation">vertical</property>
- <property name="visible">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="spacing">14</property>
- <child>
- <object class="GtkFrame" id="frame5">
- <property name="visible">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="label_xalign">0</property>
- <property name="shadow_type">GTK_SHADOW_NONE</property>
- <child>
- <object class="GtkAlignment" id="alignment9">
- <property name="visible">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="top_padding">6</property>
- <property name="bottom_padding">2</property>
- <property name="left_padding">12</property>
- <child>
- <object class="GtkTable" id="table11">
- <property name="visible">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="n_rows">4</property>
- <property name="n_columns">2</property>
- <property name="homogeneous">True</property>
+ <child>
+ <object class="GtkVBox" id="vbox43">
+ <property name="orientation">vertical</property>
+ <property name="visible">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="spacing">14</property>
+ <child>
+ <object class="GtkFrame" id="frame5">
+ <property name="visible">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="label_xalign">0</property>
+ <property name="shadow_type">GTK_SHADOW_NONE</property>
+ <child>
+ <object class="GtkAlignment" id="alignment9">
+ <property name="visible">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="top_padding">6</property>
+ <property name="bottom_padding">2</property>
+ <property name="left_padding">12</property>
+ <child>
+ <object class="GtkTable" id="table11">
+ <property name="visible">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="n_rows">4</property>
+ <property name="n_columns">2</property>
+ <property name="homogeneous">True</property>
- <child>
- <object class="GtkLabel" id="labela5">
- <property name="visible">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Source Codec:</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">0</property>
- <property name="bottom_attach">1</property>
- <property name="x_options">GTK_EXPAND|GTK_FILL</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="source_codec">
- <property name="visible">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="label" translatable="yes">--</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">0</property>
- <property name="bottom_attach">1</property>
- <property name="x_options">GTK_EXPAND|GTK_FILL</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label23">
- <property name="visible">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Dimensions:</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">GTK_EXPAND|GTK_FILL</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="source_dimensions">
- <property name="visible">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="label" translatable="yes">--</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">GTK_EXPAND|GTK_FILL</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label42">
- <property name="visible">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Aspect: </property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- <property name="x_options">GTK_EXPAND|GTK_FILL</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="source_aspect">
- <property name="visible">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="label" translatable="yes">--</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- <property name="x_options">GTK_EXPAND|GTK_FILL</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label43">
- <property name="visible">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Frame Rate:</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">3</property>
- <property name="bottom_attach">4</property>
- <property name="x_options">GTK_EXPAND|GTK_FILL</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="source_frame_rate">
- <property name="visible">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="label" translatable="yes">--</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">3</property>
- <property name="bottom_attach">4</property>
- <property name="x_options">GTK_EXPAND|GTK_FILL</property>
- </packing>
- </child>
- </object>
- </child>
- </object>
- </child>
- <child type="label">
- <object class="GtkLabel" id="label44">
- <property name="visible">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="label" translatable="yes">&lt;b&gt;Source Picture Parameters&lt;/b&gt;</property>
- <property name="use_markup">True</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="padding">2</property>
- </packing>
- </child>
- <child>
- <object class="GtkFrame" id="Cropping1">
- <property name="visible">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="label_xalign">0</property>
- <property name="shadow_type">GTK_SHADOW_NONE</property>
- <child>
- <object class="GtkAlignment" id="alignment52">
- <property name="visible">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="top_padding">6</property>
- <property name="bottom_padding">2</property>
- <property name="left_padding">12</property>
- <property name="right_padding">2</property>
- <child>
- <object class="GtkTable" id="table12">
- <property name="visible">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="n_rows">3</property>
- <property name="n_columns">2</property>
- <property name="homogeneous">True</property>
- <child>
- <object class="GtkLabel" id="label13">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Autocrop:</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">0</property>
- <property name="bottom_attach">1</property>
- <property name="x_options">GTK_EXPAND|GTK_FILL</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="crop_auto">
- <property name="visible">True</property>
- <property name="label" translatable="yes">On</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">0</property>
- <property name="bottom_attach">1</property>
- <property name="x_options">GTK_EXPAND|GTK_FILL</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label12">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Crop:</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">GTK_EXPAND|GTK_FILL</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="crop_values">
- <property name="visible">True</property>
- <property name="label" translatable="yes">--</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">GTK_EXPAND|GTK_FILL</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label76">
- <property name="visible">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Crop Dimensions:</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- <property name="x_options">GTK_EXPAND|GTK_FILL</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="crop_dimensions">
- <property name="visible">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="label" translatable="yes">--</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- <property name="x_options">GTK_EXPAND|GTK_FILL</property>
- </packing>
- </child>
- </object>
- </child>
- </object>
- </child>
- <child type="label">
- <object class="GtkLabel" id="label16">
- <property name="visible">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="label" translatable="yes">&lt;b&gt;Cropping&lt;/b&gt;</property>
- <property name="use_markup">True</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="padding">2</property>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkFrame" id="frame16">
- <property name="visible">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="label_xalign">0</property>
- <property name="shadow_type">GTK_SHADOW_NONE</property>
- <child>
- <object class="GtkAlignment" id="alignment20">
- <property name="visible">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="top_padding">6</property>
- <property name="bottom_padding">2</property>
- <property name="left_padding">12</property>
- <property name="right_padding">2</property>
- <child>
- <object class="GtkTable" id="table13">
- <property name="visible">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="n_rows">3</property>
- <property name="n_columns">2</property>
- <property name="homogeneous">True</property>
- <child>
- <object class="GtkLabel" id="label14">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Scale Dimensions:</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">0</property>
- <property name="bottom_attach">1</property>
- <property name="x_options">GTK_EXPAND|GTK_FILL</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="scale_dimensions">
- <property name="visible">True</property>
- <property name="label" translatable="yes">--</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">0</property>
- <property name="bottom_attach">1</property>
- <property name="x_options">GTK_EXPAND|GTK_FILL</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label15">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Optimal for Source:</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">GTK_EXPAND|GTK_FILL</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="scale_auto">
- <property name="visible">True</property>
- <property name="label" translatable="yes">On</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">GTK_EXPAND|GTK_FILL</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label17">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Anamorphic:</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- <property name="x_options">GTK_EXPAND|GTK_FILL</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="scale_anamorphic">
- <property name="visible">True</property>
- <property name="label" translatable="yes">On</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- <property name="x_options">GTK_EXPAND|GTK_FILL</property>
- </packing>
- </child>
- </object>
- </child>
- </object>
- </child>
- <child type="label">
- <object class="GtkLabel" id="label19">
- <property name="visible">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="label" translatable="yes">&lt;b&gt;Scaling&lt;/b&gt;</property>
- <property name="use_markup">True</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="padding">2</property>
- </packing>
- </child>
- </object>
- </child>
+ <child>
+ <object class="GtkLabel" id="labela5">
+ <property name="visible">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Source Codec:</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="x_options">GTK_EXPAND|GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="source_codec">
+ <property name="visible">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="label" translatable="yes">--</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="x_options">GTK_EXPAND|GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label23">
+ <property name="visible">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Dimensions:</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">GTK_EXPAND|GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="source_dimensions">
+ <property name="visible">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="label" translatable="yes">--</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">GTK_EXPAND|GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label42">
+ <property name="visible">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Aspect: </property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">GTK_EXPAND|GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="source_aspect">
+ <property name="visible">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="label" translatable="yes">--</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">GTK_EXPAND|GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label43">
+ <property name="visible">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Frame Rate:</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ <property name="x_options">GTK_EXPAND|GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="source_frame_rate">
+ <property name="visible">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="label" translatable="yes">--</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ <property name="x_options">GTK_EXPAND|GTK_FILL</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child type="label">
+ <object class="GtkLabel" id="label44">
+ <property name="visible">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="label" translatable="yes">&lt;b&gt;Source Picture Parameters&lt;/b&gt;</property>
+ <property name="use_markup">True</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="padding">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkFrame" id="Cropping1">
+ <property name="visible">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="label_xalign">0</property>
+ <property name="shadow_type">GTK_SHADOW_NONE</property>
+ <child>
+ <object class="GtkAlignment" id="alignment52">
+ <property name="visible">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="top_padding">6</property>
+ <property name="bottom_padding">2</property>
+ <property name="left_padding">12</property>
+ <property name="right_padding">2</property>
+ <child>
+ <object class="GtkTable" id="table12">
+ <property name="visible">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="n_rows">3</property>
+ <property name="n_columns">2</property>
+ <property name="homogeneous">True</property>
+ <child>
+ <object class="GtkLabel" id="label13">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Autocrop:</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="x_options">GTK_EXPAND|GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="crop_auto">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">On</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="x_options">GTK_EXPAND|GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label12">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Crop:</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">GTK_EXPAND|GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="crop_values">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">--</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">GTK_EXPAND|GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label76">
+ <property name="visible">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Crop Dimensions:</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">GTK_EXPAND|GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="crop_dimensions">
+ <property name="visible">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="label" translatable="yes">--</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">GTK_EXPAND|GTK_FILL</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child type="label">
+ <object class="GtkLabel" id="label16">
+ <property name="visible">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="label" translatable="yes">&lt;b&gt;Cropping&lt;/b&gt;</property>
+ <property name="use_markup">True</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="padding">2</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkFrame" id="frame16">
+ <property name="visible">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="label_xalign">0</property>
+ <property name="shadow_type">GTK_SHADOW_NONE</property>
+ <child>
+ <object class="GtkAlignment" id="alignment20">
+ <property name="visible">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="top_padding">6</property>
+ <property name="bottom_padding">2</property>
+ <property name="left_padding">12</property>
+ <property name="right_padding">2</property>
+ <child>
+ <object class="GtkTable" id="table13">
+ <property name="visible">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="n_rows">3</property>
+ <property name="n_columns">2</property>
+ <property name="homogeneous">True</property>
+ <child>
+ <object class="GtkLabel" id="label14">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Scale Dimensions:</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="x_options">GTK_EXPAND|GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="scale_dimensions">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">--</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="x_options">GTK_EXPAND|GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label15">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Optimal for Source:</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">GTK_EXPAND|GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="scale_auto">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">On</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">GTK_EXPAND|GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label17">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Anamorphic:</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">GTK_EXPAND|GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="scale_anamorphic">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">On</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">GTK_EXPAND|GTK_FILL</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child type="label">
+ <object class="GtkLabel" id="label19">
+ <property name="visible">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="label" translatable="yes">&lt;b&gt;Scaling&lt;/b&gt;</property>
+ <property name="use_markup">True</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="padding">2</property>
+ </packing>
+ </child>
+ </object>
+ </child>
</object>
<packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
@@ -1673,86 +1673,86 @@
<property name="visible">True</property>
<property name="right_padding">12</property>
<property name="top_padding">12</property>
- <child>
- <object class="GtkVBox" id="vbox9">
- <property name="orientation">vertical</property>
- <property name="visible">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <child>
- <object class="GtkFrame" id="frame8">
- <property name="visible">True</property>
- <property name="label_xalign">0</property>
- <property name="shadow_type">none</property>
- <child>
- <object class="GtkAlignment" id="alignment19">
- <property name="visible">True</property>
- <property name="bottom_padding">4</property>
- <property name="left_padding">4</property>
- <property name="right_padding">4</property>
- <child>
- <object class="GtkImage" id="preview_button_image">
- <property name="width_request">448</property>
- <property name="height_request">200</property>
- <property name="visible">True</property>
- <property name="icon_name">hb-icon</property>
- <property name="pixel-size">128</property>
- <signal name="size_allocate" handler="preview_button_size_allocate_cb"/>
- </object>
- </child>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkAlignment" id="picture_summary2">
- <property name="visible">True</property>
- <property name="xscale">0</property>
- <property name="yscale">0</property>
- <child>
- <object class="GtkHBox" id="hbox7">
- <property name="visible">True</property>
- <property name="spacing">4</property>
- <child>
- <object class="GtkLabel" id="label10">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Presentation Dimensions:</property>
- <property name="justify">right</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="preview_dims">
- <property name="width_request">85</property>
- <property name="visible">True</property>
- <property name="xalign">0.2</property>
- <property name="yalign">0</property>
- <property name="label" translatable="yes">--</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="position">1</property>
- </packing>
- </child>
+ <child>
+ <object class="GtkVBox" id="vbox9">
+ <property name="orientation">vertical</property>
+ <property name="visible">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <child>
+ <object class="GtkFrame" id="frame8">
+ <property name="visible">True</property>
+ <property name="label_xalign">0</property>
+ <property name="shadow_type">none</property>
+ <child>
+ <object class="GtkAlignment" id="alignment19">
+ <property name="visible">True</property>
+ <property name="bottom_padding">4</property>
+ <property name="left_padding">4</property>
+ <property name="right_padding">4</property>
+ <child>
+ <object class="GtkImage" id="preview_button_image">
+ <property name="width_request">448</property>
+ <property name="height_request">200</property>
+ <property name="visible">True</property>
+ <property name="icon_name">hb-icon</property>
+ <property name="pixel-size">128</property>
+ <signal name="size_allocate" handler="preview_button_size_allocate_cb"/>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkAlignment" id="picture_summary2">
+ <property name="visible">True</property>
+ <property name="xscale">0</property>
+ <property name="yscale">0</property>
+ <child>
+ <object class="GtkHBox" id="hbox7">
+ <property name="visible">True</property>
+ <property name="spacing">4</property>
+ <child>
+ <object class="GtkLabel" id="label10">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Presentation Dimensions:</property>
+ <property name="justify">right</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="preview_dims">
+ <property name="width_request">85</property>
+ <property name="visible">True</property>
+ <property name="xalign">0.2</property>
+ <property name="yalign">0</property>
+ <property name="label" translatable="yes">--</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">2</property>
- </packing>
- </child>
- </object>
- </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </object>
+ </child>
</object>
<packing>
<property name="expand">False</property>
@@ -3533,7 +3533,7 @@ weather-clear</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">&lt;small&gt;Reference Frames:&lt;/small&gt;</property>
- <property name="use_markup">True</property>
+ <property name="use_markup">True</property>
</object>
<packing>
<property name="x_options">GTK_FILL</property>
@@ -3576,7 +3576,7 @@ weather-clear</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">&lt;small&gt;Maximum B-Frames:&lt;/small&gt;</property>
- <property name="use_markup">True</property>
+ <property name="use_markup">True</property>
</object>
<packing>
<property name="x_options">GTK_FILL</property>
@@ -3617,7 +3617,7 @@ weather-clear</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">&lt;small&gt;Pyramidal B-Frames:&lt;/small&gt;</property>
- <property name="use_markup">True</property>
+ <property name="use_markup">True</property>
</object>
<packing>
<property name="x_options">GTK_FILL</property>
@@ -3628,12 +3628,12 @@ weather-clear</property>
</packing>
</child>
<child>
- <object class="GtkComboBox" id="x264_bpyramid">
- <property name="visible">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <object class="GtkComboBox" id="x264_bpyramid">
+ <property name="visible">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="tooltip-text" translatable="yes">B-pyramid improves compression by creating a pyramidal structure (hence the name) of B-frames, allowing B-frames to reference each other to improve compression. Requires Max B-frames greater than 1; optimal adaptive B-frames is strongly recommended for full compression benefit.</property>
- <signal handler="x264_widget_changed_cb" name="changed"/>
- </object>
+ <signal handler="x264_widget_changed_cb" name="changed"/>
+ </object>
<packing>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
@@ -3648,7 +3648,7 @@ weather-clear</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">&lt;small&gt;Weighted P-Frames:&lt;/small&gt;</property>
- <property name="use_markup">True</property>
+ <property name="use_markup">True</property>
</object>
<packing>
<property name="x_options">GTK_FILL</property>
@@ -3659,12 +3659,12 @@ weather-clear</property>
</packing>
</child>
<child>
- <object class="GtkComboBox" id="x264_weighted_pframes">
- <property name="visible">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <object class="GtkComboBox" id="x264_weighted_pframes">
+ <property name="visible">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="tooltip-text" translatable="yes">Performs extra analysis to decide upon weighting parameters for each frame. This improves overall compression slightly and improves the quality of fades greatly. Baseline profile, as required for iPods and similar devices, requires weighted P-frame prediction to be disabled. Note that some devices and players, even those that support Main Profile, may have problems with Weighted P-frame prediction: the Apple TV is completely incompatible with it, for example.</property>
- <signal handler="x264_widget_changed_cb" name="changed"/>
- </object>
+ <signal handler="x264_widget_changed_cb" name="changed"/>
+ </object>
<packing>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
@@ -3769,7 +3769,7 @@ weather-clear</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">&lt;small&gt;Motion Est. Method:&lt;/small&gt;</property>
- <property name="use_markup">True</property>
+ <property name="use_markup">True</property>
</object>
<packing>
<property name="x_options">GTK_FILL</property>
@@ -3812,7 +3812,7 @@ Transformed Exhaustive: Like exhaustive, but makes even more accurate decisions.
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">&lt;small&gt;Subpel ME &amp;amp; Mode:&lt;/small&gt;</property>
- <property name="use_markup">True</property>
+ <property name="use_markup">True</property>
</object>
<packing>
<property name="x_options">GTK_FILL</property>
@@ -3857,7 +3857,7 @@ SAD is the fastest method, followed by SATD, RD, RD refinement, and the slowest,
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">&lt;small&gt;Motion Est. Range:&lt;/small&gt;</property>
- <property name="use_markup">True</property>
+ <property name="use_markup">True</property>
</object>
<packing>
<property name="x_options">GTK_FILL</property>
@@ -3886,92 +3886,92 @@ SAD is the fastest method, followed by SATD, RD, RD refinement, and the slowest,
<property name="right_attach">2</property>
</packing>
</child>
- <child>
- <object class="GtkLabel" id="label52">
- <property name="visible">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">&lt;small&gt;Adaptive Direct Mode:&lt;/small&gt;</property>
- <property name="use_markup">True</property>
- </object>
- <packing>
- <property name="top_attach">3</property>
- <property name="bottom_attach">4</property>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="x_options">GTK_FILL</property>
- </packing>
- </child>
- <child>
- <object class="GtkAlignment" id="alignment39">
- <property name="visible">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="xalign">0</property>
- <child>
- <object class="GtkComboBox" id="x264_direct">
- <property name="visible">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="tooltip-text" translatable="yes">H.264 allows for two different prediction modes, spatial and temporal, in B-frames.
+ <child>
+ <object class="GtkLabel" id="label52">
+ <property name="visible">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">&lt;small&gt;Adaptive Direct Mode:&lt;/small&gt;</property>
+ <property name="use_markup">True</property>
+ </object>
+ <packing>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="x_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkAlignment" id="alignment39">
+ <property name="visible">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="xalign">0</property>
+ <child>
+ <object class="GtkComboBox" id="x264_direct">
+ <property name="visible">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="tooltip-text" translatable="yes">H.264 allows for two different prediction modes, spatial and temporal, in B-frames.
Spatial, the default, is almost always better, but temporal is sometimes useful too.
x264 can, at the cost of a small amount of speed (and accordingly for a small compression gain), adaptively select which is better for each particular frame.</property>
- <signal handler="x264_widget_changed_cb" name="changed"/>
- </object>
- </child>
- </object>
- <packing>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options">GTK_FILL</property>
- <property name="top_attach">3</property>
- <property name="bottom_attach">4</property>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label84">
- <property name="visible">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">&lt;small&gt;Adaptive B-Frames:&lt;/small&gt;</property>
- <property name="use_markup">True</property>
- </object>
- <packing>
- <property name="top_attach">4</property>
- <property name="bottom_attach">5</property>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="x_options">GTK_FILL</property>
- </packing>
- </child>
- <child>
- <object class="GtkAlignment" id="alignment40">
- <property name="visible">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="xalign">0</property>
- <child>
- <object class="GtkComboBox" id="x264_b_adapt">
- <property name="visible">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="tooltip-markup" translatable="yes">x264 has a variety of algorithms to decide when to use B-frames and how many to use.
+ <signal handler="x264_widget_changed_cb" name="changed"/>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options">GTK_FILL</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label84">
+ <property name="visible">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">&lt;small&gt;Adaptive B-Frames:&lt;/small&gt;</property>
+ <property name="use_markup">True</property>
+ </object>
+ <packing>
+ <property name="top_attach">4</property>
+ <property name="bottom_attach">5</property>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="x_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkAlignment" id="alignment40">
+ <property name="visible">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="xalign">0</property>
+ <child>
+ <object class="GtkComboBox" id="x264_b_adapt">
+ <property name="visible">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="tooltip-markup" translatable="yes">x264 has a variety of algorithms to decide when to use B-frames and how many to use.
Fast mode takes roughly the same amount of time no matter how many B-frames you specify. However, while fast, its decisions are often suboptimal.
Optimal mode gets slower as the maximum number of B-Frames increases, but makes much more accurate decisions, especially when used with B-pyramid.</property>
- <signal handler="x264_widget_changed_cb" name="changed"/>
- </object>
- </child>
- </object>
- <packing>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options">GTK_FILL</property>
- <property name="top_attach">4</property>
- <property name="bottom_attach">5</property>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- </packing>
- </child>
+ <signal handler="x264_widget_changed_cb" name="changed"/>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options">GTK_FILL</property>
+ <property name="top_attach">4</property>
+ <property name="bottom_attach">5</property>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ </packing>
+ </child>
</object>
</child>
</object>
@@ -4001,7 +4001,7 @@ Optimal mode gets slower as the maximum number of B-Frames increases, but makes
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">&lt;small&gt;Partitions:&lt;/small&gt;</property>
- <property name="use_markup">True</property>
+ <property name="use_markup">True</property>
</object>
<packing>
<property name="x_options">GTK_FILL</property>
@@ -4034,7 +4034,7 @@ Optimal mode gets slower as the maximum number of B-Frames increases, but makes
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">&lt;small&gt;Trellis:&lt;/small&gt;</property>
- <property name="use_markup">True</property>
+ <property name="use_markup">True</property>
</object>
<packing>
<property name="x_options">GTK_FILL</property>
@@ -4116,9 +4116,9 @@ Optimal mode gets slower as the maximum number of B-Frames increases, but makes
<object class="GtkLabel" id="label73">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="xalign">0</property>
+ <property name="xalign">0</property>
<property name="label" translatable="yes">&lt;small&gt;Adaptive Quantization Strength:&lt;/small&gt;</property>
- <property name="use_markup">True</property>
+ <property name="use_markup">True</property>
</object>
<packing>
<property name="x_options">GTK_FILL</property>
@@ -4145,9 +4145,9 @@ Optimal mode gets slower as the maximum number of B-Frames increases, but makes
<object class="GtkLabel" id="label82">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="xalign">0</property>
+ <property name="xalign">0</property>
<property name="label" translatable="yes">&lt;small&gt;Psychovisual Rate Distortion:&lt;/small&gt;</property>
- <property name="use_markup">True</property>
+ <property name="use_markup">True</property>
</object>
<packing>
<property name="x_options">GTK_FILL</property>
@@ -4178,9 +4178,9 @@ Optimal mode gets slower as the maximum number of B-Frames increases, but makes
<object class="GtkLabel" id="label83">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="xalign">0</property>
+ <property name="xalign">0</property>
<property name="label" translatable="yes">&lt;small&gt;Psychovisual Trellis:&lt;/small&gt;</property>
- <property name="use_markup">True</property>
+ <property name="use_markup">True</property>
</object>
<packing>
<property name="top_attach">2</property>
@@ -4260,22 +4260,22 @@ The deblocking filter has two adjustable parameters, "strength" (Alpha) and "thr
<property name="position">2</property>
</packing>
</child>
- <child>
- <object class="GtkCheckButton" id="x264_no_dct_decimate">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="tooltip-text" translatable="yes">x264 normally zeroes out nearly-empty data blocks to save bits to be better used for some other purpose in the video. However, this can sometimes have slight negative effects on retention of subtle grain and dither. Don't touch this unless you're having banding issues or other such cases where you are having trouble keeping fine noise.</property>
- <property name="label" translatable="yes">No DCT Decimate</property>
- <property name="active">True</property>
- <property name="draw_indicator">True</property>
- <signal handler="x264_widget_changed_cb" name="toggled"/>
- </object>
- <packing>
- <property name="padding">20</property>
- <property name="position">3</property>
- </packing>
- </child>
+ <child>
+ <object class="GtkCheckButton" id="x264_no_dct_decimate">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="tooltip-text" translatable="yes">x264 normally zeroes out nearly-empty data blocks to save bits to be better used for some other purpose in the video. However, this can sometimes have slight negative effects on retention of subtle grain and dither. Don't touch this unless you're having banding issues or other such cases where you are having trouble keeping fine noise.</property>
+ <property name="label" translatable="yes">No DCT Decimate</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ <signal handler="x264_widget_changed_cb" name="toggled"/>
+ </object>
+ <packing>
+ <property name="padding">20</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
</object>
<packing>
<property name="position">1</property>
@@ -4306,10 +4306,10 @@ The deblocking filter has two adjustable parameters, "strength" (Alpha) and "thr
</packing>
</child>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="position">0</property>
- </packing>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
</child>
<child>
<object class="GtkHBox" id="hbox85">
@@ -4317,10 +4317,10 @@ The deblocking filter has two adjustable parameters, "strength" (Alpha) and "thr
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="spacing">2</property>
</object>
- <packing>
- <property name="expand">True</property>
- <property name="position">1</property>
- </packing>
+ <packing>
+ <property name="expand">True</property>
+ <property name="position">1</property>
+ </packing>
</child>
<child>
<object class="GtkFrame" id="frame11">
@@ -4377,7 +4377,7 @@ no-fast-pskip=0:no-dct-decimate=0:cabac=1</property>
</object>
<packing>
<property name="expand">False</property>
- <property name="fill">True</property>
+ <property name="fill">True</property>
<property name="padding">2</property>
<property name="position">2</property>
</packing>
@@ -6069,7 +6069,7 @@ on the Video tab instead.</property>
</object>
<packing>
<property name="expand">False</property>
- <property name="position">0</property>
+ <property name="position">0</property>
<property name="padding">10</property>
</packing>
</child>
@@ -6209,124 +6209,124 @@ on the Video tab instead.</property>
</object>
<packing>
<property name="expand">False</property>
- <property name="position">0</property>
+ <property name="position">0</property>
<property name="padding">10</property>
</packing>
</child>
- <child>
- <object class="GtkTable" id="PicturePresetBox">
- <property name="visible">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="n_rows">3</property>
- <property name="n_columns">3</property>
- <child>
- <object class="GtkLabel" id="UsingCurrentPicLabel">
- <property name="visible">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="label" translatable="yes">&lt;b&gt;Custom Picture Dimensions&lt;/b&gt;</property>
- <property name="xalign">0</property>
- <property name="use_markup">True</property>
- </object>
- <packing>
- <property name="top_attach">0</property>
- <property name="bottom_attach">1</property>
- <property name="left_attach">0</property>
- <property name="right_attach">3</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="fillerlabel1">
- <property name="visible">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="label" translatable="yes"></property>
- <property name="xalign">0</property>
- </object>
- <packing>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="left_attach">2</property>
- <property name="right_attach">3</property>
+ <child>
+ <object class="GtkTable" id="PicturePresetBox">
+ <property name="visible">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="n_rows">3</property>
+ <property name="n_columns">3</property>
+ <child>
+ <object class="GtkLabel" id="UsingCurrentPicLabel">
+ <property name="visible">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="label" translatable="yes">&lt;b&gt;Custom Picture Dimensions&lt;/b&gt;</property>
+ <property name="xalign">0</property>
+ <property name="use_markup">True</property>
+ </object>
+ <packing>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="left_attach">0</property>
+ <property name="right_attach">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="fillerlabel1">
+ <property name="visible">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="label" translatable="yes"></property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
<property name="x_options">GTK_EXPAND</property>
- </packing>
- </child>
- <child>
- <object class="GtkCheckButton" id="PictureWidthEnable">
- <property name="label" translatable="yes">Maximum Width:</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="tooltip-text" translatable="yes">Enable maximum width limit.</property>
- <property name="draw_indicator">True</property>
- <signal name="toggled" handler="setting_widget_changed_cb"/>
- </object>
- <packing>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="PictureWidthEnable">
+ <property name="label" translatable="yes">Maximum Width:</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="tooltip-text" translatable="yes">Enable maximum width limit.</property>
+ <property name="draw_indicator">True</property>
+ <signal name="toggled" handler="setting_widget_changed_cb"/>
+ </object>
+ <packing>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
<property name="x_options">GTK_FILL</property>
- </packing>
- </child>
- <child>
- <object class="GtkSpinButton" id="PictureWidth">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="tooltip-text" translatable="yes">This is the maximum width that the video will be stored at. Whenever a new source is loaded, this value will be applied if the source width is greater. Setting this to 0 means there is no maximum width.</property>
- <property name="adjustment">adjustment32</property>
- <property name="snap_to_ticks">True</property>
- <signal name="value_changed" handler="setting_widget_changed_cb"/>
- </object>
- <packing>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkSpinButton" id="PictureWidth">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="tooltip-text" translatable="yes">This is the maximum width that the video will be stored at. Whenever a new source is loaded, this value will be applied if the source width is greater. Setting this to 0 means there is no maximum width.</property>
+ <property name="adjustment">adjustment32</property>
+ <property name="snap_to_ticks">True</property>
+ <signal name="value_changed" handler="setting_widget_changed_cb"/>
+ </object>
+ <packing>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
<property name="x_options"></property>
- </packing>
- </child>
- <child>
- <object class="GtkCheckButton" id="PictureHeightEnable">
- <property name="label" translatable="yes">Maximum Height:</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="tooltip-text" translatable="yes">Enable maximum height limit.</property>
- <property name="draw_indicator">True</property>
- <signal name="toggled" handler="setting_widget_changed_cb"/>
- </object>
- <packing>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="PictureHeightEnable">
+ <property name="label" translatable="yes">Maximum Height:</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="tooltip-text" translatable="yes">Enable maximum height limit.</property>
+ <property name="draw_indicator">True</property>
+ <signal name="toggled" handler="setting_widget_changed_cb"/>
+ </object>
+ <packing>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
<property name="x_options">GTK_FILL</property>
- </packing>
- </child>
- <child>
- <object class="GtkSpinButton" id="PictureHeight">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="tooltip-text" translatable="yes">This is the maximum height that the video will be stored at. Whenever a new source is loaded, this value will be applied if the source height is greater. Setting this to 0 means there is no maximum height.</property>
- <property name="adjustment">adjustment33</property>
- <signal name="value_changed" handler="setting_widget_changed_cb"/>
- </object>
- <packing>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkSpinButton" id="PictureHeight">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="tooltip-text" translatable="yes">This is the maximum height that the video will be stored at. Whenever a new source is loaded, this value will be applied if the source height is greater. Setting this to 0 means there is no maximum height.</property>
+ <property name="adjustment">adjustment33</property>
+ <signal name="value_changed" handler="setting_widget_changed_cb"/>
+ </object>
+ <packing>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
<property name="x_options"></property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="position">1</property>
- </packing>
- </child>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
<child>
<object class="GtkFrame" id="frame14">
<property name="visible">True</property>
diff --git a/gtk/src/ghbcellrenderertext.c b/gtk/src/ghbcellrenderertext.c
index c198a5214..4c39f729d 100644
--- a/gtk/src/ghbcellrenderertext.c
+++ b/gtk/src/ghbcellrenderertext.c
@@ -42,35 +42,35 @@
static void ghb_cell_renderer_text_finalize (GObject *object);
static void ghb_cell_renderer_text_get_property (GObject *object,
- guint param_id,
- GValue *value,
- GParamSpec *pspec);
+ guint param_id,
+ GValue *value,
+ GParamSpec *pspec);
static void ghb_cell_renderer_text_set_property (GObject *object,
- guint param_id,
- const GValue *value,
- GParamSpec *pspec);
+ guint param_id,
+ const GValue *value,
+ GParamSpec *pspec);
static void ghb_cell_renderer_text_get_size (GtkCellRenderer *cell,
- GtkWidget *widget,
- GdkRectangle *cell_area,
- gint *x_offset,
- gint *y_offset,
- gint *width,
- gint *height);
+ GtkWidget *widget,
+ GdkRectangle *cell_area,
+ gint *x_offset,
+ gint *y_offset,
+ gint *width,
+ gint *height);
static void ghb_cell_renderer_text_render (GtkCellRenderer *cell,
- GdkWindow *window,
- GtkWidget *widget,
- GdkRectangle *background_area,
- GdkRectangle *cell_area,
- GdkRectangle *expose_area,
- GtkCellRendererState flags);
+ GdkWindow *window,
+ GtkWidget *widget,
+ GdkRectangle *background_area,
+ GdkRectangle *cell_area,
+ GdkRectangle *expose_area,
+ GtkCellRendererState flags);
static GtkCellEditable *ghb_cell_renderer_text_start_editing (GtkCellRenderer *cell,
- GdkEvent *event,
- GtkWidget *widget,
- const gchar *path,
- GdkRectangle *background_area,
- GdkRectangle *cell_area,
- GtkCellRendererState flags);
+ GdkEvent *event,
+ GtkWidget *widget,
+ const gchar *path,
+ GdkRectangle *background_area,
+ GdkRectangle *cell_area,
+ GtkCellRendererState flags);
enum {
EDITED,
@@ -218,12 +218,12 @@ ghb_cell_renderer_text_class_init (GhbCellRendererTextClass *class)
GTK_PARAM_WRITABLE));
g_object_class_install_property (object_class,
- PROP_ATTRIBUTES,
- g_param_spec_boxed ("attributes",
- P_("Attributes"),
- P_("A list of style attributes to apply to the text of the renderer"),
- PANGO_TYPE_ATTR_LIST,
- GTK_PARAM_READWRITE));
+ PROP_ATTRIBUTES,
+ g_param_spec_boxed ("attributes",
+ P_("Attributes"),
+ P_("A list of style attributes to apply to the text of the renderer"),
+ PANGO_TYPE_ATTR_LIST,
+ GTK_PARAM_READWRITE));
g_object_class_install_property (object_class,
PROP_SINGLE_PARAGRAPH_MODE,
@@ -372,7 +372,7 @@ ghb_cell_renderer_text_class_init (GhbCellRendererTextClass *class)
g_param_spec_int ("rise",
P_("Rise"),
P_("Offset of text above the baseline "
- "(below the baseline if rise is negative)"),
+ "(below the baseline if rise is negative)"),
-G_MAXINT,
G_MAXINT,
0,
@@ -401,8 +401,8 @@ ghb_cell_renderer_text_class_init (GhbCellRendererTextClass *class)
g_param_spec_string ("language",
P_("Language"),
P_("The language this text is in, as an ISO code. "
- "Pango can use this as a hint when rendering the text. "
- "If you don't understand this parameter, you probably don't need it"),
+ "Pango can use this as a hint when rendering the text. "
+ "If you don't understand this parameter, you probably don't need it"),
NULL,
GTK_PARAM_READWRITE));
@@ -420,13 +420,13 @@ ghb_cell_renderer_text_class_init (GhbCellRendererTextClass *class)
g_object_class_install_property (object_class,
PROP_ELLIPSIZE,
g_param_spec_enum ("ellipsize",
- P_("Ellipsize"),
- P_("The preferred place to ellipsize the string, "
- "if the cell renderer does not have enough room "
- "to display the entire string"),
- PANGO_TYPE_ELLIPSIZE_MODE,
- PANGO_ELLIPSIZE_NONE,
- GTK_PARAM_READWRITE));
+ P_("Ellipsize"),
+ P_("The preferred place to ellipsize the string, "
+ "if the cell renderer does not have enough room "
+ "to display the entire string"),
+ PANGO_TYPE_ELLIPSIZE_MODE,
+ PANGO_ELLIPSIZE_NONE,
+ GTK_PARAM_READWRITE));
/**
* GhbCellRendererText:width-chars:
@@ -459,13 +459,13 @@ ghb_cell_renderer_text_class_init (GhbCellRendererTextClass *class)
g_object_class_install_property (object_class,
PROP_WRAP_MODE,
g_param_spec_enum ("wrap-mode",
- P_("Wrap mode"),
- P_("How to break the string into multiple lines, "
- "if the cell renderer does not have enough room "
- "to display the entire string"),
- PANGO_TYPE_WRAP_MODE,
- PANGO_WRAP_CHAR,
- GTK_PARAM_READWRITE));
+ P_("Wrap mode"),
+ P_("How to break the string into multiple lines, "
+ "if the cell renderer does not have enough room "
+ "to display the entire string"),
+ PANGO_TYPE_WRAP_MODE,
+ PANGO_WRAP_CHAR,
+ GTK_PARAM_READWRITE));
/**
* GhbCellRendererText:wrap-width:
@@ -477,14 +477,14 @@ ghb_cell_renderer_text_class_init (GhbCellRendererTextClass *class)
* Since: 2.8
*/
g_object_class_install_property (object_class,
- PROP_WRAP_WIDTH,
- g_param_spec_int ("wrap-width",
- P_("Wrap width"),
- P_("The width at which the text is wrapped"),
- -1,
- G_MAXINT,
- -1,
- GTK_PARAM_READWRITE));
+ PROP_WRAP_WIDTH,
+ g_param_spec_int ("wrap-width",
+ P_("Wrap width"),
+ P_("The width at which the text is wrapped"),
+ -1,
+ G_MAXINT,
+ -1,
+ GTK_PARAM_READWRITE));
/**
* GhbCellRendererText:alignment:
@@ -500,11 +500,11 @@ ghb_cell_renderer_text_class_init (GhbCellRendererTextClass *class)
g_object_class_install_property (object_class,
PROP_ALIGN,
g_param_spec_enum ("alignment",
- P_("Alignment"),
- P_("How to align the lines"),
- PANGO_TYPE_ALIGNMENT,
- PANGO_ALIGN_LEFT,
- GTK_PARAM_READWRITE));
+ P_("Alignment"),
+ P_("How to align the lines"),
+ PANGO_TYPE_ALIGNMENT,
+ PANGO_ALIGN_LEFT,
+ GTK_PARAM_READWRITE));
/* Style props are set or not */
@@ -587,24 +587,24 @@ ghb_cell_renderer_text_class_init (GhbCellRendererTextClass *class)
*/
text_cell_renderer_signals [EDITED] =
g_signal_new (I_("edited"),
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GhbCellRendererTextClass, edited),
- NULL, NULL,
- ghb_marshal_VOID__STRING_STRING,
- G_TYPE_NONE, 2,
- G_TYPE_STRING,
- G_TYPE_STRING);
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (GhbCellRendererTextClass, edited),
+ NULL, NULL,
+ ghb_marshal_VOID__STRING_STRING,
+ G_TYPE_NONE, 2,
+ G_TYPE_STRING,
+ G_TYPE_STRING);
text_cell_renderer_signals [KEYPRESS] =
g_signal_new (I_("key-press-event"),
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GhbCellRendererTextClass, keypress),
- NULL, NULL,
- ghb_marshal_BOOLEAN__BOXED,
- G_TYPE_BOOLEAN, 1,
- GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (GhbCellRendererTextClass, keypress),
+ NULL, NULL,
+ ghb_marshal_BOOLEAN__BOXED,
+ G_TYPE_BOOLEAN, 1,
+ GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
g_type_class_add_private (object_class, sizeof (GhbCellRendererTextPrivate));
}
@@ -654,9 +654,9 @@ get_property_font_set_mask (guint prop_id)
static void
ghb_cell_renderer_text_get_property (GObject *object,
- guint param_id,
- GValue *value,
- GParamSpec *pspec)
+ guint param_id,
+ GValue *value,
+ GParamSpec *pspec)
{
GhbCellRendererText *celltext = GHB_CELL_RENDERER_TEXT (object);
GhbCellRendererTextPrivate *priv;
@@ -792,10 +792,10 @@ ghb_cell_renderer_text_get_property (GObject *object,
case PROP_STRETCH_SET:
case PROP_SIZE_SET:
{
- PangoFontMask mask = get_property_font_set_mask (param_id);
- g_value_set_boolean (value, (pango_font_description_get_set_fields (celltext->font) & mask) != 0);
-
- break;
+ PangoFontMask mask = get_property_font_set_mask (param_id);
+ g_value_set_boolean (value, (pango_font_description_get_set_fields (celltext->font) & mask) != 0);
+
+ break;
}
case PROP_SCALE_SET:
@@ -899,7 +899,7 @@ set_fg_color (GhbCellRendererText *celltext,
static PangoFontMask
set_font_desc_fields (PangoFontDescription *desc,
- PangoFontMask to_set)
+ PangoFontMask to_set)
{
PangoFontMask changed_mask = 0;
@@ -907,10 +907,10 @@ set_font_desc_fields (PangoFontDescription *desc,
{
const char *family = pango_font_description_get_family (desc);
if (!family)
- {
- family = "sans";
- changed_mask |= PANGO_FONT_MASK_FAMILY;
- }
+ {
+ family = "sans";
+ changed_mask |= PANGO_FONT_MASK_FAMILY;
+ }
pango_font_description_set_family (desc, family);
}
@@ -926,10 +926,10 @@ set_font_desc_fields (PangoFontDescription *desc,
{
gint size = pango_font_description_get_size (desc);
if (size <= 0)
- {
- size = 10 * PANGO_SCALE;
- changed_mask |= PANGO_FONT_MASK_SIZE;
- }
+ {
+ size = 10 * PANGO_SCALE;
+ changed_mask |= PANGO_FONT_MASK_SIZE;
+ }
pango_font_description_set_size (desc, size);
}
@@ -939,7 +939,7 @@ set_font_desc_fields (PangoFontDescription *desc,
static void
notify_set_changed (GObject *object,
- PangoFontMask changed_mask)
+ PangoFontMask changed_mask)
{
if (changed_mask & PANGO_FONT_MASK_FAMILY)
g_object_notify (object, "family-set");
@@ -957,7 +957,7 @@ notify_set_changed (GObject *object,
static void
notify_fields_changed (GObject *object,
- PangoFontMask changed_mask)
+ PangoFontMask changed_mask)
{
if (changed_mask & PANGO_FONT_MASK_FAMILY)
g_object_notify (object, "family");
@@ -1023,9 +1023,9 @@ set_font_description (GhbCellRendererText *celltext,
static void
ghb_cell_renderer_text_set_property (GObject *object,
- guint param_id,
- const GValue *value,
- GParamSpec *pspec)
+ guint param_id,
+ const GValue *value,
+ GParamSpec *pspec)
{
GhbCellRendererText *celltext = GHB_CELL_RENDERER_TEXT (object);
GhbCellRendererTextPrivate *priv;
@@ -1051,7 +1051,7 @@ ghb_cell_renderer_text_set_property (GObject *object,
case PROP_ATTRIBUTES:
if (celltext->extra_attrs)
- pango_attr_list_unref (celltext->extra_attrs);
+ pango_attr_list_unref (celltext->extra_attrs);
celltext->extra_attrs = g_value_get_boxed (value);
if (celltext->extra_attrs)
@@ -1059,33 +1059,33 @@ ghb_cell_renderer_text_set_property (GObject *object,
break;
case PROP_MARKUP:
{
- const gchar *str;
- gchar *text = NULL;
- GError *error = NULL;
- PangoAttrList *attrs = NULL;
-
- str = g_value_get_string (value);
- if (str && !pango_parse_markup (str,
- -1,
- 0,
- &attrs,
- &text,
- NULL,
- &error))
- {
- g_warning ("Failed to set text from markup due to error parsing markup: %s",
- error->message);
- g_error_free (error);
- return;
- }
-
- g_free (celltext->text);
-
- if (celltext->extra_attrs)
- pango_attr_list_unref (celltext->extra_attrs);
-
- celltext->text = text;
- celltext->extra_attrs = attrs;
+ const gchar *str;
+ gchar *text = NULL;
+ GError *error = NULL;
+ PangoAttrList *attrs = NULL;
+
+ str = g_value_get_string (value);
+ if (str && !pango_parse_markup (str,
+ -1,
+ 0,
+ &attrs,
+ &text,
+ NULL,
+ &error))
+ {
+ g_warning ("Failed to set text from markup due to error parsing markup: %s",
+ error->message);
+ g_error_free (error);
+ return;
+ }
+
+ g_free (celltext->text);
+
+ if (celltext->extra_attrs)
+ pango_attr_list_unref (celltext->extra_attrs);
+
+ celltext->text = text;
+ celltext->extra_attrs = attrs;
priv->markup_set = TRUE;
}
break;
@@ -1146,10 +1146,10 @@ ghb_cell_renderer_text_set_property (GObject *object,
set_font_description (celltext, font_desc);
- pango_font_description_free (font_desc);
+ pango_font_description_free (font_desc);
- if (celltext->fixed_height_rows != -1)
- celltext->calc_fixed_height = TRUE;
+ if (celltext->fixed_height_rows != -1)
+ celltext->calc_fixed_height = TRUE;
}
break;
@@ -1157,7 +1157,7 @@ ghb_cell_renderer_text_set_property (GObject *object,
set_font_description (celltext, g_value_get_boxed (value));
if (celltext->fixed_height_rows != -1)
- celltext->calc_fixed_height = TRUE;
+ celltext->calc_fixed_height = TRUE;
break;
case PROP_FAMILY:
@@ -1168,57 +1168,57 @@ ghb_cell_renderer_text_set_property (GObject *object,
case PROP_SIZE:
case PROP_SIZE_POINTS:
{
- PangoFontMask old_set_mask = pango_font_description_get_set_fields (celltext->font);
-
- switch (param_id)
- {
- case PROP_FAMILY:
- pango_font_description_set_family (celltext->font,
- g_value_get_string (value));
- break;
- case PROP_STYLE:
- pango_font_description_set_style (celltext->font,
- g_value_get_enum (value));
- break;
- case PROP_VARIANT:
- pango_font_description_set_variant (celltext->font,
- g_value_get_enum (value));
- break;
- case PROP_WEIGHT:
- pango_font_description_set_weight (celltext->font,
- g_value_get_int (value));
- break;
- case PROP_STRETCH:
- pango_font_description_set_stretch (celltext->font,
- g_value_get_enum (value));
- break;
- case PROP_SIZE:
- pango_font_description_set_size (celltext->font,
- g_value_get_int (value));
- g_object_notify (object, "size-points");
- break;
- case PROP_SIZE_POINTS:
- pango_font_description_set_size (celltext->font,
- g_value_get_double (value) * PANGO_SCALE);
- g_object_notify (object, "size");
- break;
- }
-
- if (celltext->fixed_height_rows != -1)
- celltext->calc_fixed_height = TRUE;
-
- notify_set_changed (object, old_set_mask & pango_font_description_get_set_fields (celltext->font));
- g_object_notify (object, "font-desc");
- g_object_notify (object, "font");
-
- break;
+ PangoFontMask old_set_mask = pango_font_description_get_set_fields (celltext->font);
+
+ switch (param_id)
+ {
+ case PROP_FAMILY:
+ pango_font_description_set_family (celltext->font,
+ g_value_get_string (value));
+ break;
+ case PROP_STYLE:
+ pango_font_description_set_style (celltext->font,
+ g_value_get_enum (value));
+ break;
+ case PROP_VARIANT:
+ pango_font_description_set_variant (celltext->font,
+ g_value_get_enum (value));
+ break;
+ case PROP_WEIGHT:
+ pango_font_description_set_weight (celltext->font,
+ g_value_get_int (value));
+ break;
+ case PROP_STRETCH:
+ pango_font_description_set_stretch (celltext->font,
+ g_value_get_enum (value));
+ break;
+ case PROP_SIZE:
+ pango_font_description_set_size (celltext->font,
+ g_value_get_int (value));
+ g_object_notify (object, "size-points");
+ break;
+ case PROP_SIZE_POINTS:
+ pango_font_description_set_size (celltext->font,
+ g_value_get_double (value) * PANGO_SCALE);
+ g_object_notify (object, "size");
+ break;
+ }
+
+ if (celltext->fixed_height_rows != -1)
+ celltext->calc_fixed_height = TRUE;
+
+ notify_set_changed (object, old_set_mask & pango_font_description_get_set_fields (celltext->font));
+ g_object_notify (object, "font-desc");
+ g_object_notify (object, "font");
+
+ break;
}
case PROP_SCALE:
celltext->font_scale = g_value_get_double (value);
celltext->scale_set = TRUE;
if (celltext->fixed_height_rows != -1)
- celltext->calc_fixed_height = TRUE;
+ celltext->calc_fixed_height = TRUE;
g_object_notify (object, "scale-set");
break;
@@ -1250,7 +1250,7 @@ ghb_cell_renderer_text_set_property (GObject *object,
celltext->rise_set = TRUE;
g_object_notify (object, "rise-set");
if (celltext->fixed_height_rows != -1)
- celltext->calc_fixed_height = TRUE;
+ celltext->calc_fixed_height = TRUE;
break;
case PROP_LANGUAGE:
@@ -1300,18 +1300,18 @@ ghb_cell_renderer_text_set_property (GObject *object,
case PROP_STRETCH_SET:
case PROP_SIZE_SET:
if (!g_value_get_boolean (value))
- {
- pango_font_description_unset_fields (celltext->font,
- get_property_font_set_mask (param_id));
- }
+ {
+ pango_font_description_unset_fields (celltext->font,
+ get_property_font_set_mask (param_id));
+ }
else
- {
- PangoFontMask changed_mask;
-
- changed_mask = set_font_desc_fields (celltext->font,
- get_property_font_set_mask (param_id));
- notify_fields_changed (G_OBJECT (celltext), changed_mask);
- }
+ {
+ PangoFontMask changed_mask;
+
+ changed_mask = set_font_desc_fields (celltext->font,
+ get_property_font_set_mask (param_id));
+ notify_fields_changed (G_OBJECT (celltext), changed_mask);
+ }
break;
case PROP_SCALE_SET:
@@ -1412,7 +1412,7 @@ get_layout (GhbCellRendererText *celltext,
*/
if (celltext->foreground_set
- && (flags & GTK_CELL_RENDERER_SELECTED) == 0)
+ && (flags & GTK_CELL_RENDERER_SELECTED) == 0)
{
PangoColor color;
@@ -1487,9 +1487,9 @@ get_layout (GhbCellRendererText *celltext,
PangoAlignment align;
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
- align = PANGO_ALIGN_RIGHT;
+ align = PANGO_ALIGN_RIGHT;
else
- align = PANGO_ALIGN_LEFT;
+ align = PANGO_ALIGN_LEFT;
pango_layout_set_alignment (layout, align);
}
@@ -1503,13 +1503,13 @@ get_layout (GhbCellRendererText *celltext,
static void
get_size (GtkCellRenderer *cell,
- GtkWidget *widget,
- GdkRectangle *cell_area,
- PangoLayout *layout,
- gint *x_offset,
- gint *y_offset,
- gint *width,
- gint *height)
+ GtkWidget *widget,
+ GdkRectangle *cell_area,
+ PangoLayout *layout,
+ gint *x_offset,
+ gint *y_offset,
+ gint *width,
+ gint *height)
{
GhbCellRendererText *celltext = (GhbCellRendererText *) cell;
PangoRectangle rect;
@@ -1535,32 +1535,32 @@ get_size (GtkCellRenderer *cell,
pango_font_description_merge_static (font_desc, celltext->font, TRUE);
if (celltext->scale_set)
- pango_font_description_set_size (font_desc,
- celltext->font_scale * pango_font_description_get_size (font_desc));
+ pango_font_description_set_size (font_desc,
+ celltext->font_scale * pango_font_description_get_size (font_desc));
context = gtk_widget_get_pango_context (widget);
metrics = pango_context_get_metrics (context,
- font_desc,
- pango_context_get_language (context));
+ font_desc,
+ pango_context_get_language (context));
row_height = (pango_font_metrics_get_ascent (metrics) +
- pango_font_metrics_get_descent (metrics));
+ pango_font_metrics_get_descent (metrics));
pango_font_metrics_unref (metrics);
pango_font_description_free (font_desc);
gtk_cell_renderer_set_fixed_size (cell,
- cell_width, 2*cell_ypad +
- celltext->fixed_height_rows * PANGO_PIXELS (row_height));
+ cell_width, 2*cell_ypad +
+ celltext->fixed_height_rows * PANGO_PIXELS (row_height));
if (height)
- {
+ {
*height = cell_height;
- height = NULL;
- }
+ height = NULL;
+ }
celltext->calc_fixed_height = FALSE;
if (width == NULL)
- return;
+ return;
}
if (layout)
@@ -1576,20 +1576,20 @@ get_size (GtkCellRenderer *cell,
rect.width = MIN(rect.width, cell_area->width - 2 * cell_xpad);
if (x_offset)
- {
- if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
- *x_offset = (1.0 - cell_xalign) * (cell_area->width - (2 * cell_xpad));
- else
- *x_offset = cell_xalign * (cell_area->width - (2 * cell_xpad));
-
- if ((priv->ellipsize_set && priv->ellipsize != PANGO_ELLIPSIZE_NONE) || priv->wrap_width != -1)
- *x_offset = MAX(*x_offset, 0);
- }
+ {
+ if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
+ *x_offset = (1.0 - cell_xalign) * (cell_area->width - (2 * cell_xpad));
+ else
+ *x_offset = cell_xalign * (cell_area->width - (2 * cell_xpad));
+
+ if ((priv->ellipsize_set && priv->ellipsize != PANGO_ELLIPSIZE_NONE) || priv->wrap_width != -1)
+ *x_offset = MAX(*x_offset, 0);
+ }
if (y_offset)
- {
- *y_offset = cell_yalign * (cell_area->height - (rect.height + (2 * cell_ypad)));
- *y_offset = MAX (*y_offset, 0);
- }
+ {
+ *y_offset = cell_yalign * (cell_area->height - (rect.height + (2 * cell_ypad)));
+ *y_offset = MAX (*y_offset, 0);
+ }
}
else
{
@@ -1609,25 +1609,25 @@ get_size (GtkCellRenderer *cell,
static void
ghb_cell_renderer_text_get_size (GtkCellRenderer *cell,
- GtkWidget *widget,
- GdkRectangle *cell_area,
- gint *x_offset,
- gint *y_offset,
- gint *width,
- gint *height)
+ GtkWidget *widget,
+ GdkRectangle *cell_area,
+ gint *x_offset,
+ gint *y_offset,
+ gint *width,
+ gint *height)
{
get_size (cell, widget, cell_area, NULL,
- x_offset, y_offset, width, height);
+ x_offset, y_offset, width, height);
}
static void
ghb_cell_renderer_text_render (GtkCellRenderer *cell,
- GdkDrawable *window,
- GtkWidget *widget,
- GdkRectangle *background_area,
- GdkRectangle *cell_area,
- GdkRectangle *expose_area,
- GtkCellRendererState flags)
+ GdkDrawable *window,
+ GtkWidget *widget,
+ GdkRectangle *background_area,
+ GdkRectangle *cell_area,
+ GdkRectangle *expose_area,
+ GtkCellRendererState flags)
{
GhbCellRendererText *celltext = (GhbCellRendererText *) cell;
@@ -1653,21 +1653,21 @@ ghb_cell_renderer_text_render (GtkCellRenderer *cell,
else if ((flags & GTK_CELL_RENDERER_SELECTED) == GTK_CELL_RENDERER_SELECTED)
{
if (gtk_widget_has_focus (widget))
- state = GTK_STATE_SELECTED;
+ state = GTK_STATE_SELECTED;
else
- state = GTK_STATE_ACTIVE;
+ state = GTK_STATE_ACTIVE;
}
else if ((flags & GTK_CELL_RENDERER_PRELIT) == GTK_CELL_RENDERER_PRELIT &&
- GTK_WIDGET_STATE (widget) == GTK_STATE_PRELIGHT)
+ GTK_WIDGET_STATE (widget) == GTK_STATE_PRELIGHT)
{
state = GTK_STATE_PRELIGHT;
}
else
{
if (GTK_WIDGET_STATE (widget) == GTK_STATE_INSENSITIVE)
- state = GTK_STATE_INSENSITIVE;
+ state = GTK_STATE_INSENSITIVE;
else
- state = GTK_STATE_NORMAL;
+ state = GTK_STATE_NORMAL;
}
gtk_cell_renderer_get_padding(cell, &xpad, &ypad);
@@ -1678,16 +1678,16 @@ ghb_cell_renderer_text_render (GtkCellRenderer *cell,
cairo_t *cr = gdk_cairo_create (window);
if (expose_area)
- {
- gdk_cairo_rectangle (cr, expose_area);
- cairo_clip (cr);
- }
+ {
+ gdk_cairo_rectangle (cr, expose_area);
+ cairo_clip (cr);
+ }
gdk_cairo_rectangle (cr, background_area);
cairo_set_source_rgb (cr,
- celltext->background.red / 65535.,
- celltext->background.green / 65535.,
- celltext->background.blue / 65535.);
+ celltext->background.red / 65535.,
+ celltext->background.green / 65535.,
+ celltext->background.blue / 65535.);
cairo_fill (cr);
cairo_destroy (cr);
@@ -1695,14 +1695,14 @@ ghb_cell_renderer_text_render (GtkCellRenderer *cell,
if (priv->ellipsize_set && priv->ellipsize != PANGO_ELLIPSIZE_NONE)
pango_layout_set_width (layout,
- (cell_area->width - x_offset - 2 * xpad) * PANGO_SCALE);
+ (cell_area->width - x_offset - 2 * xpad) * PANGO_SCALE);
else if (priv->wrap_width == -1)
pango_layout_set_width (layout, -1);
gtk_paint_layout (widget->style,
window,
state,
- TRUE,
+ TRUE,
expose_area,
widget,
"cellrenderertext",
@@ -1715,19 +1715,19 @@ ghb_cell_renderer_text_render (GtkCellRenderer *cell,
static gboolean
ghb_cell_renderer_text_keypress(
- GtkCellEditable *entry,
- GdkEventKey *event,
- gpointer data)
+ GtkCellEditable *entry,
+ GdkEventKey *event,
+ gpointer data)
{
- gboolean result;
- g_signal_emit(
- data, text_cell_renderer_signals[KEYPRESS], 0, event, &result);
- return result;
+ gboolean result;
+ g_signal_emit(
+ data, text_cell_renderer_signals[KEYPRESS], 0, event, &result);
+ return result;
}
static void
ghb_cell_renderer_text_editing_done (GtkCellEditable *entry,
- gpointer data)
+ gpointer data)
{
const gchar *path;
const gchar *new_text;
@@ -1758,7 +1758,7 @@ ghb_cell_renderer_text_editing_done (GtkCellEditable *entry,
gboolean editing_canceled;
g_object_get(entry, "editing-canceled", &editing_canceled, NULL);
gtk_cell_renderer_stop_editing (GTK_CELL_RENDERER (data),
- editing_canceled);
+ editing_canceled);
if (editing_canceled)
return;
@@ -1823,8 +1823,8 @@ ghb_cell_renderer_text_populate_popup (GtkEntry *entry,
static gboolean
ghb_cell_renderer_text_focus_out_event (GtkWidget *entry,
- GdkEvent *event,
- gpointer data)
+ GdkEvent *event,
+ gpointer data)
{
GhbCellRendererTextPrivate *priv;
@@ -1843,12 +1843,12 @@ ghb_cell_renderer_text_focus_out_event (GtkWidget *entry,
static GtkCellEditable *
ghb_cell_renderer_text_start_editing (GtkCellRenderer *cell,
- GdkEvent *event,
- GtkWidget *widget,
- const gchar *path,
- GdkRectangle *background_area,
- GdkRectangle *cell_area,
- GtkCellRendererState flags)
+ GdkEvent *event,
+ GtkWidget *widget,
+ const gchar *path,
+ GdkRectangle *background_area,
+ GdkRectangle *cell_area,
+ GtkCellRendererState flags)
{
GtkRequisition requisition;
GhbCellRendererText *celltext;
@@ -1864,9 +1864,9 @@ ghb_cell_renderer_text_start_editing (GtkCellRenderer *cell,
gint xalign;
g_object_get(cell, "xalign", &xalign, NULL);
priv->entry = g_object_new (GTK_TYPE_ENTRY,
- "has-frame", FALSE,
- "xalign", xalign,
- NULL);
+ "has-frame", FALSE,
+ "xalign", xalign,
+ NULL);
if (celltext->text)
gtk_entry_set_text (GTK_ENTRY (priv->entry), celltext->text);
@@ -1881,20 +1881,20 @@ ghb_cell_renderer_text_start_editing (GtkCellRenderer *cell,
GtkBorder border;
gtk_widget_style_get (priv->entry,
- "inner-border", &style_border,
- NULL);
+ "inner-border", &style_border,
+ NULL);
if (style_border)
{
- border = *style_border;
- g_boxed_free (GTK_TYPE_BORDER, style_border);
- }
+ border = *style_border;
+ g_boxed_free (GTK_TYPE_BORDER, style_border);
+ }
else
{
- /* Since boxed style properties can't have default values ... */
- border.left = 2;
- border.right = 2;
- }
+ /* Since boxed style properties can't have default values ... */
+ border.left = 2;
+ border.right = 2;
+ }
border.top = (cell_area->height - requisition.height) / 2;
border.bottom = (cell_area->height - requisition.height) / 2;
@@ -1909,16 +1909,16 @@ ghb_cell_renderer_text_start_editing (GtkCellRenderer *cell,
}
g_signal_connect (priv->entry,
- "key-press-event",
- G_CALLBACK (ghb_cell_renderer_text_keypress),
- celltext);
+ "key-press-event",
+ G_CALLBACK (ghb_cell_renderer_text_keypress),
+ celltext);
g_signal_connect (priv->entry,
- "editing_done",
- G_CALLBACK (ghb_cell_renderer_text_editing_done),
- celltext);
+ "editing_done",
+ G_CALLBACK (ghb_cell_renderer_text_editing_done),
+ celltext);
priv->focus_out_id = g_signal_connect_after (priv->entry, "focus_out_event",
- G_CALLBACK (ghb_cell_renderer_text_focus_out_event),
- celltext);
+ G_CALLBACK (ghb_cell_renderer_text_focus_out_event),
+ celltext);
priv->populate_popup_id =
g_signal_connect (priv->entry, "populate_popup",
G_CALLBACK (ghb_cell_renderer_text_populate_popup),
@@ -1944,7 +1944,7 @@ ghb_cell_renderer_text_start_editing (GtkCellRenderer *cell,
**/
void
ghb_cell_renderer_text_set_fixed_height_from_font (GhbCellRendererText *renderer,
- gint number_of_rows)
+ gint number_of_rows)
{
g_return_if_fail (GHB_IS_CELL_RENDERER_TEXT (renderer));
g_return_if_fail (number_of_rows == -1 || number_of_rows > 0);
@@ -1954,8 +1954,8 @@ ghb_cell_renderer_text_set_fixed_height_from_font (GhbCellRendererText *renderer
gint width;
g_object_get(renderer, "width", &width, NULL);
gtk_cell_renderer_set_fixed_size (GTK_CELL_RENDERER (renderer),
- width,
- -1);
+ width,
+ -1);
}
else
{
diff --git a/gtk/src/ghbcellrenderertext.h b/gtk/src/ghbcellrenderertext.h
index ab178ce91..d93c2a48f 100644
--- a/gtk/src/ghbcellrenderertext.h
+++ b/gtk/src/ghbcellrenderertext.h
@@ -27,11 +27,11 @@
G_BEGIN_DECLS
-#define GHB_TYPE_CELL_RENDERER_TEXT (ghb_cell_renderer_text_get_type ())
-#define GHB_CELL_RENDERER_TEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GHB_TYPE_CELL_RENDERER_TEXT, GhbCellRendererText))
-#define GHB_CELL_RENDERER_TEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GHB_TYPE_CELL_RENDERER_TEXT, GhbCellRendererTextClass))
-#define GHB_IS_CELL_RENDERER_TEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GHB_TYPE_CELL_RENDERER_TEXT))
-#define GHB_IS_CELL_RENDERER_TEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GHB_TYPE_CELL_RENDERER_TEXT))
+#define GHB_TYPE_CELL_RENDERER_TEXT (ghb_cell_renderer_text_get_type ())
+#define GHB_CELL_RENDERER_TEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GHB_TYPE_CELL_RENDERER_TEXT, GhbCellRendererText))
+#define GHB_CELL_RENDERER_TEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GHB_TYPE_CELL_RENDERER_TEXT, GhbCellRendererTextClass))
+#define GHB_IS_CELL_RENDERER_TEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GHB_TYPE_CELL_RENDERER_TEXT))
+#define GHB_IS_CELL_RENDERER_TEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GHB_TYPE_CELL_RENDERER_TEXT))
#define GHB_CELL_RENDERER_TEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GHB_TYPE_CELL_RENDERER_TEXT, GhbCellRendererTextClass))
typedef struct _GhbCellRendererText GhbCellRendererText;
@@ -79,11 +79,11 @@ struct _GhbCellRendererTextClass
GtkCellRendererClass parent_class;
void (* edited) (GhbCellRendererText *cell_renderer_text,
- const gchar *path,
- const gchar *new_text);
+ const gchar *path,
+ const gchar *new_text);
gboolean (* keypress) (GhbCellRendererText *cell_renderer_text,
- GdkEventKey *event);
+ GdkEventKey *event);
/* Padding for future expansion */
void (*_gtk_reserved1) (void);
@@ -96,7 +96,7 @@ GType ghb_cell_renderer_text_get_type (void) G_GNUC_CONST;
GtkCellRenderer *ghb_cell_renderer_text_new (void);
void ghb_cell_renderer_text_set_fixed_height_from_font (GhbCellRendererText *renderer,
- gint number_of_rows);
+ gint number_of_rows);
G_END_DECLS
diff --git a/gtk/src/ghbcompat.h b/gtk/src/ghbcompat.h
index bc7fc5094..0c5c6f21e 100644
--- a/gtk/src/ghbcompat.h
+++ b/gtk/src/ghbcompat.h
@@ -20,12 +20,12 @@
// Replace simple accessor functions added to newer gtk versions
static inline void gtk_widget_set_realized(GtkWidget *widget, gboolean realized)
{
- GTK_WIDGET_SET_FLAGS(widget, GTK_REALIZED);
+ GTK_WIDGET_SET_FLAGS(widget, GTK_REALIZED);
}
static inline gboolean gtk_widget_get_realized(GtkWidget *widget)
{
- return GTK_WIDGET_REALIZED(widget);
+ return GTK_WIDGET_REALIZED(widget);
}
#endif
diff --git a/gtk/src/ghbcompositor.c b/gtk/src/ghbcompositor.c
index 48ad9c400..41ea67936 100644
--- a/gtk/src/ghbcompositor.c
+++ b/gtk/src/ghbcompositor.c
@@ -588,8 +588,8 @@ ghb_compositor_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
for (link = compositor->children; link != NULL; link = link->next)
{
cc = (GhbCompositorChild*)link->data;
- if (gtk_widget_get_realized (cc->widget))
- gtk_widget_size_allocate (cc->widget, &child_allocation);
+ if (gtk_widget_get_realized (cc->widget))
+ gtk_widget_size_allocate (cc->widget, &child_allocation);
}
}
diff --git a/gtk/src/hb-backend.c b/gtk/src/hb-backend.c
index 65fa4ae25..560435c49 100644
--- a/gtk/src/hb-backend.c
+++ b/gtk/src/hb-backend.c
@@ -39,16 +39,16 @@
typedef struct
{
- gchar *option;
- const gchar *shortOpt;
- gdouble ivalue;
- const gchar *svalue;
+ gchar *option;
+ const gchar *shortOpt;
+ gdouble ivalue;
+ const gchar *svalue;
} options_map_t;
typedef struct
{
- gint count;
- options_map_t *map;
+ gint count;
+ options_map_t *map;
} combo_opts_t;
static gchar **index_str = NULL;
@@ -57,391 +57,391 @@ static gint index_str_size = 0;
static void
index_str_init(gint max_index)
{
- gint ii;
+ gint ii;
- if (max_index+1 > index_str_size)
- {
- index_str = realloc(index_str, (max_index+1) * sizeof(char*));
- for (ii = index_str_size; ii <= max_index; ii++)
- {
- index_str[ii] = g_strdup_printf("%d", ii);
- }
- index_str_size = max_index + 1;
- }
+ if (max_index+1 > index_str_size)
+ {
+ index_str = realloc(index_str, (max_index+1) * sizeof(char*));
+ for (ii = index_str_size; ii <= max_index; ii++)
+ {
+ index_str[ii] = g_strdup_printf("%d", ii);
+ }
+ index_str_size = max_index + 1;
+ }
}
static options_map_t d_point_to_point_opts[] =
{
- {"Chapters:", "chapter", 0, "0"},
- {"Seconds:", "time", 1, "1"},
- {"Frames:", "frame", 2, "2"},
+ {"Chapters:", "chapter", 0, "0"},
+ {"Seconds:", "time", 1, "1"},
+ {"Frames:", "frame", 2, "2"},
};
combo_opts_t point_to_point_opts =
{
- sizeof(d_point_to_point_opts)/sizeof(options_map_t),
- d_point_to_point_opts
+ sizeof(d_point_to_point_opts)/sizeof(options_map_t),
+ d_point_to_point_opts
};
static options_map_t d_when_complete_opts[] =
{
- {"Do Nothing", "nothing", 0, "0"},
- {"Show Notification", "notify", 1, "1"},
- {"Quit Handbrake", "quit", 4, "4"},
- {"Put Computer To Sleep", "sleep", 2, "2"},
- {"Shutdown Computer", "shutdown", 3, "3"},
+ {"Do Nothing", "nothing", 0, "0"},
+ {"Show Notification", "notify", 1, "1"},
+ {"Quit Handbrake", "quit", 4, "4"},
+ {"Put Computer To Sleep", "sleep", 2, "2"},
+ {"Shutdown Computer", "shutdown", 3, "3"},
};
combo_opts_t when_complete_opts =
{
- sizeof(d_when_complete_opts)/sizeof(options_map_t),
- d_when_complete_opts
+ sizeof(d_when_complete_opts)/sizeof(options_map_t),
+ d_when_complete_opts
};
static options_map_t d_par_opts[] =
{
- {"Off", "0", 0, "0"},
- {"Strict", "1", 1, "1"},
- {"Loose", "2", 2, "2"},
- {"Custom", "3", 3, "3"},
+ {"Off", "0", 0, "0"},
+ {"Strict", "1", 1, "1"},
+ {"Loose", "2", 2, "2"},
+ {"Custom", "3", 3, "3"},
};
combo_opts_t par_opts =
{
- sizeof(d_par_opts)/sizeof(options_map_t),
- d_par_opts
+ sizeof(d_par_opts)/sizeof(options_map_t),
+ d_par_opts
};
static options_map_t d_alignment_opts[] =
{
- {"2", "2", 2, "2"},
- {"4", "4", 4, "4"},
- {"8", "8", 8, "8"},
- {"16", "16", 16, "16"},
+ {"2", "2", 2, "2"},
+ {"4", "4", 4, "4"},
+ {"8", "8", 8, "8"},
+ {"16", "16", 16, "16"},
};
combo_opts_t alignment_opts =
{
- sizeof(d_alignment_opts)/sizeof(options_map_t),
- d_alignment_opts
+ sizeof(d_alignment_opts)/sizeof(options_map_t),
+ d_alignment_opts
};
static options_map_t d_logging_opts[] =
{
- {"0", "0", 0, "0"},
- {"1", "1", 1, "1"},
- {"2", "2", 2, "2"},
+ {"0", "0", 0, "0"},
+ {"1", "1", 1, "1"},
+ {"2", "2", 2, "2"},
};
combo_opts_t logging_opts =
{
- sizeof(d_logging_opts)/sizeof(options_map_t),
- d_logging_opts
+ sizeof(d_logging_opts)/sizeof(options_map_t),
+ d_logging_opts
};
static options_map_t d_log_longevity_opts[] =
{
- {"Week", "week", 7, "7"},
- {"Month", "month", 30, "30"},
- {"Year", "year", 365, "365"},
- {"Immortal", "immortal", 366, "366"},
+ {"Week", "week", 7, "7"},
+ {"Month", "month", 30, "30"},
+ {"Year", "year", 365, "365"},
+ {"Immortal", "immortal", 366, "366"},
};
combo_opts_t log_longevity_opts =
{
- sizeof(d_log_longevity_opts)/sizeof(options_map_t),
- d_log_longevity_opts
+ sizeof(d_log_longevity_opts)/sizeof(options_map_t),
+ d_log_longevity_opts
};
static options_map_t d_appcast_update_opts[] =
{
- {"Never", "never", 0, "never"},
- {"Daily", "daily", 1, "daily"},
- {"Weekly", "weekly", 2, "weekly"},
- {"Monthly", "monthly", 3, "monthly"},
+ {"Never", "never", 0, "never"},
+ {"Daily", "daily", 1, "daily"},
+ {"Weekly", "weekly", 2, "weekly"},
+ {"Monthly", "monthly", 3, "monthly"},
};
combo_opts_t appcast_update_opts =
{
- sizeof(d_appcast_update_opts)/sizeof(options_map_t),
- d_appcast_update_opts
+ sizeof(d_appcast_update_opts)/sizeof(options_map_t),
+ d_appcast_update_opts
};
static options_map_t d_vqual_granularity_opts[] =
{
- {"0.2", "0.2", 0.2, "0.2"},
- {"0.25", "0.25", 0.25, "0.25"},
- {"0.5", "0.5", 0.5, "0.5"},
- {"1", "1", 1, "1"},
+ {"0.2", "0.2", 0.2, "0.2"},
+ {"0.25", "0.25", 0.25, "0.25"},
+ {"0.5", "0.5", 0.5, "0.5"},
+ {"1", "1", 1, "1"},
};
combo_opts_t vqual_granularity_opts =
{
- sizeof(d_vqual_granularity_opts)/sizeof(options_map_t),
- d_vqual_granularity_opts
+ sizeof(d_vqual_granularity_opts)/sizeof(options_map_t),
+ d_vqual_granularity_opts
};
static options_map_t d_container_opts[] =
{
- {"MKV", "mkv", HB_MUX_MKV, "mkv"},
- {"MP4", "mp4", HB_MUX_MP4, "mp4"},
+ {"MKV", "mkv", HB_MUX_MKV, "mkv"},
+ {"MP4", "mp4", HB_MUX_MP4, "mp4"},
};
combo_opts_t container_opts =
{
- sizeof(d_container_opts)/sizeof(options_map_t),
- d_container_opts
+ sizeof(d_container_opts)/sizeof(options_map_t),
+ d_container_opts
};
static options_map_t d_detel_opts[] =
{
- {"Off", "off", 0, ""},
- {"Custom", "custom", 1, ""},
- {"Default","default",2, NULL},
+ {"Off", "off", 0, ""},
+ {"Custom", "custom", 1, ""},
+ {"Default","default",2, NULL},
};
combo_opts_t detel_opts =
{
- sizeof(d_detel_opts)/sizeof(options_map_t),
- d_detel_opts
+ sizeof(d_detel_opts)/sizeof(options_map_t),
+ d_detel_opts
};
static options_map_t d_decomb_opts[] =
{
- {"Off", "off", 0, ""},
- {"Custom", "custom", 1, ""},
- {"Default","default",2, NULL},
- {"Fast", "fast", 3, "7:2:6:9:1:80"},
- {"Bob", "bob", 4, "455"},
+ {"Off", "off", 0, ""},
+ {"Custom", "custom", 1, ""},
+ {"Default","default",2, NULL},
+ {"Fast", "fast", 3, "7:2:6:9:1:80"},
+ {"Bob", "bob", 4, "455"},
};
combo_opts_t decomb_opts =
{
- sizeof(d_decomb_opts)/sizeof(options_map_t),
- d_decomb_opts
+ sizeof(d_decomb_opts)/sizeof(options_map_t),
+ d_decomb_opts
};
static options_map_t d_deint_opts[] =
{
- {"Off", "off", 0, ""},
- {"Custom", "custom", 1, ""},
- {"Fast", "fast", 2, "0:-1:-1:0:1"},
- {"Slow", "slow", 3, "1:-1:-1:0:1"},
- {"Slower", "slower", 4, "3:-1:-1:0:1"},
- {"Bob", "bob", 5, "15:-1:-1:0:1"},
+ {"Off", "off", 0, ""},
+ {"Custom", "custom", 1, ""},
+ {"Fast", "fast", 2, "0:-1:-1:0:1"},
+ {"Slow", "slow", 3, "1:-1:-1:0:1"},
+ {"Slower", "slower", 4, "3:-1:-1:0:1"},
+ {"Bob", "bob", 5, "15:-1:-1:0:1"},
};
combo_opts_t deint_opts =
{
- sizeof(d_deint_opts)/sizeof(options_map_t),
- d_deint_opts
+ sizeof(d_deint_opts)/sizeof(options_map_t),
+ d_deint_opts
};
static options_map_t d_denoise_opts[] =
{
- {"Off", "off", 0, ""},
- {"Custom", "custom", 1, ""},
- {"Weak", "weak", 2, "2:1:2:3"},
- {"Medium", "medium", 3, "3:2:2:3"},
- {"Strong", "strong", 4, "7:7:5:5"},
+ {"Off", "off", 0, ""},
+ {"Custom", "custom", 1, ""},
+ {"Weak", "weak", 2, "2:1:2:3"},
+ {"Medium", "medium", 3, "3:2:2:3"},
+ {"Strong", "strong", 4, "7:7:5:5"},
};
combo_opts_t denoise_opts =
{
- sizeof(d_denoise_opts)/sizeof(options_map_t),
- d_denoise_opts
+ sizeof(d_denoise_opts)/sizeof(options_map_t),
+ d_denoise_opts
};
static options_map_t d_direct_opts[] =
{
- {"None", "none", 0, "none"},
- {"Spatial", "spatial", 1, "spatial"},
- {"Temporal", "temporal", 2, "temporal"},
- {"Automatic", "auto", 3, "auto"},
+ {"None", "none", 0, "none"},
+ {"Spatial", "spatial", 1, "spatial"},
+ {"Temporal", "temporal", 2, "temporal"},
+ {"Automatic", "auto", 3, "auto"},
};
combo_opts_t direct_opts =
{
- sizeof(d_direct_opts)/sizeof(options_map_t),
- d_direct_opts
+ sizeof(d_direct_opts)/sizeof(options_map_t),
+ d_direct_opts
};
static options_map_t d_badapt_opts[] =
{
- {"Off", "0", 0, "0"},
- {"Fast", "1", 1, "1"},
- {"Optimal", "2", 2, "2"},
+ {"Off", "0", 0, "0"},
+ {"Fast", "1", 1, "1"},
+ {"Optimal", "2", 2, "2"},
};
combo_opts_t badapt_opts =
{
- sizeof(d_badapt_opts)/sizeof(options_map_t),
- d_badapt_opts
+ sizeof(d_badapt_opts)/sizeof(options_map_t),
+ d_badapt_opts
};
static options_map_t d_bpyramid_opts[] =
{
- {"Off", "none", 0, "none"},
- {"Strict", "strict", 1, "strict"},
- {"Normal", "normal", 2, "normal"},
+ {"Off", "none", 0, "none"},
+ {"Strict", "strict", 1, "strict"},
+ {"Normal", "normal", 2, "normal"},
};
combo_opts_t bpyramid_opts =
{
- sizeof(d_bpyramid_opts)/sizeof(options_map_t),
- d_bpyramid_opts
+ sizeof(d_bpyramid_opts)/sizeof(options_map_t),
+ d_bpyramid_opts
};
static options_map_t d_weightp_opts[] =
{
- {"Off", "0", 0, "0"},
- {"Simple", "1", 1, "1"},
- {"Smart", "2", 2, "2"},
+ {"Off", "0", 0, "0"},
+ {"Simple", "1", 1, "1"},
+ {"Smart", "2", 2, "2"},
};
combo_opts_t weightp_opts =
{
- sizeof(d_weightp_opts)/sizeof(options_map_t),
- d_weightp_opts
+ sizeof(d_weightp_opts)/sizeof(options_map_t),
+ d_weightp_opts
};
static options_map_t d_me_opts[] =
{
- {"Diamond", "dia", 0, "dia"},
- {"Hexagon", "hex", 1, "hex"},
- {"Uneven Multi-Hexagon", "umh", 2, "umh"},
- {"Exhaustive", "esa", 3, "esa"},
- {"Hadamard Exhaustive", "tesa", 4, "tesa"},
+ {"Diamond", "dia", 0, "dia"},
+ {"Hexagon", "hex", 1, "hex"},
+ {"Uneven Multi-Hexagon", "umh", 2, "umh"},
+ {"Exhaustive", "esa", 3, "esa"},
+ {"Hadamard Exhaustive", "tesa", 4, "tesa"},
};
combo_opts_t me_opts =
{
- sizeof(d_me_opts)/sizeof(options_map_t),
- d_me_opts
+ sizeof(d_me_opts)/sizeof(options_map_t),
+ d_me_opts
};
static options_map_t d_subme_opts[] =
{
- {"0: SAD, no subpel", "0", 0, "0"},
- {"1: SAD, qpel", "1", 1, "1"},
- {"2: SATD, qpel", "2", 2, "2"},
- {"3: SATD: multi-qpel", "3", 3, "3"},
- {"4: SATD, qpel on all", "4", 4, "4"},
- {"5: SATD, multi-qpel on all", "5", 5, "5"},
- {"6: RD in I/P-frames", "6", 6, "6"},
- {"7: RD in all frames", "7", 7, "7"},
- {"8: RD refine in I/P-frames", "8", 8, "8"},
- {"9: RD refine in all frames", "9", 9, "9"},
- {"10: QPRD in all frames", "10", 10, "10"},
- {"11: No early terminations in analysis", "11", 11, "11"},
+ {"0: SAD, no subpel", "0", 0, "0"},
+ {"1: SAD, qpel", "1", 1, "1"},
+ {"2: SATD, qpel", "2", 2, "2"},
+ {"3: SATD: multi-qpel", "3", 3, "3"},
+ {"4: SATD, qpel on all", "4", 4, "4"},
+ {"5: SATD, multi-qpel on all", "5", 5, "5"},
+ {"6: RD in I/P-frames", "6", 6, "6"},
+ {"7: RD in all frames", "7", 7, "7"},
+ {"8: RD refine in I/P-frames", "8", 8, "8"},
+ {"9: RD refine in all frames", "9", 9, "9"},
+ {"10: QPRD in all frames", "10", 10, "10"},
+ {"11: No early terminations in analysis", "11", 11, "11"},
};
combo_opts_t subme_opts =
{
- sizeof(d_subme_opts)/sizeof(options_map_t),
- d_subme_opts
+ sizeof(d_subme_opts)/sizeof(options_map_t),
+ d_subme_opts
};
static options_map_t d_analyse_opts[] =
{
- {"Most", "p8x8,b8x8,i8x8,i4x4", 0, "p8x8,b8x8,i8x8,i4x4"},
- {"None", "none", 1, "none"},
- {"Some", "i4x4,i8x8", 2, "i4x4,i8x8"},
- {"All", "all", 3, "all"},
- {"Custom", "custom", 4, "all"},
+ {"Most", "p8x8,b8x8,i8x8,i4x4", 0, "p8x8,b8x8,i8x8,i4x4"},
+ {"None", "none", 1, "none"},
+ {"Some", "i4x4,i8x8", 2, "i4x4,i8x8"},
+ {"All", "all", 3, "all"},
+ {"Custom", "custom", 4, "all"},
};
combo_opts_t analyse_opts =
{
- sizeof(d_analyse_opts)/sizeof(options_map_t),
- d_analyse_opts
+ sizeof(d_analyse_opts)/sizeof(options_map_t),
+ d_analyse_opts
};
static options_map_t d_trellis_opts[] =
{
- {"Off", "0", 0, "0"},
- {"Encode only", "1", 1, "1"},
- {"Always", "2", 2, "2"},
+ {"Off", "0", 0, "0"},
+ {"Encode only", "1", 1, "1"},
+ {"Always", "2", 2, "2"},
};
combo_opts_t trellis_opts =
{
- sizeof(d_trellis_opts)/sizeof(options_map_t),
- d_trellis_opts
+ sizeof(d_trellis_opts)/sizeof(options_map_t),
+ d_trellis_opts
};
combo_opts_t subtitle_opts =
{
- 0,
- NULL
+ 0,
+ NULL
};
combo_opts_t title_opts =
{
- 0,
- NULL
+ 0,
+ NULL
};
combo_opts_t audio_track_opts =
{
- 0,
- NULL
+ 0,
+ NULL
};
typedef struct
{
- const gchar *name;
- combo_opts_t *opts;
+ const gchar *name;
+ combo_opts_t *opts;
} combo_name_map_t;
combo_name_map_t combo_name_map[] =
{
- {"PtoPType", &point_to_point_opts},
- {"WhenComplete", &when_complete_opts},
- {"PicturePAR", &par_opts},
- {"PictureModulus", &alignment_opts},
- {"LoggingLevel", &logging_opts},
- {"LogLongevity", &log_longevity_opts},
- {"check_updates", &appcast_update_opts},
- {"VideoQualityGranularity", &vqual_granularity_opts},
- {"FileFormat", &container_opts},
- {"PictureDeinterlace", &deint_opts},
- {"PictureDecomb", &decomb_opts},
- {"PictureDetelecine", &detel_opts},
- {"PictureDenoise", &denoise_opts},
- {"x264_direct", &direct_opts},
- {"x264_b_adapt", &badapt_opts},
- {"x264_bpyramid", &bpyramid_opts},
- {"x264_weighted_pframes", &weightp_opts},
- {"x264_me", &me_opts},
- {"x264_subme", &subme_opts},
- {"x264_analyse", &analyse_opts},
- {"x264_trellis", &trellis_opts},
- {"SubtitleTrack", &subtitle_opts},
- {"title", &title_opts},
- {"AudioTrack", &audio_track_opts},
- {NULL, NULL}
+ {"PtoPType", &point_to_point_opts},
+ {"WhenComplete", &when_complete_opts},
+ {"PicturePAR", &par_opts},
+ {"PictureModulus", &alignment_opts},
+ {"LoggingLevel", &logging_opts},
+ {"LogLongevity", &log_longevity_opts},
+ {"check_updates", &appcast_update_opts},
+ {"VideoQualityGranularity", &vqual_granularity_opts},
+ {"FileFormat", &container_opts},
+ {"PictureDeinterlace", &deint_opts},
+ {"PictureDecomb", &decomb_opts},
+ {"PictureDetelecine", &detel_opts},
+ {"PictureDenoise", &denoise_opts},
+ {"x264_direct", &direct_opts},
+ {"x264_b_adapt", &badapt_opts},
+ {"x264_bpyramid", &bpyramid_opts},
+ {"x264_weighted_pframes", &weightp_opts},
+ {"x264_me", &me_opts},
+ {"x264_subme", &subme_opts},
+ {"x264_analyse", &analyse_opts},
+ {"x264_trellis", &trellis_opts},
+ {"SubtitleTrack", &subtitle_opts},
+ {"title", &title_opts},
+ {"AudioTrack", &audio_track_opts},
+ {NULL, NULL}
};
const gchar *srt_codeset_table[] =
{
- "ANSI_X3.4-1968",
- "ANSI_X3.4-1986",
- "ANSI_X3.4",
- "ANSI_X3.110-1983",
- "ANSI_X3.110",
- "ASCII",
- "ECMA-114",
- "ECMA-118",
- "ECMA-128",
- "ECMA-CYRILLIC",
- "IEC_P27-1",
- "ISO-8859-1",
- "ISO-8859-2",
- "ISO-8859-3",
- "ISO-8859-4",
- "ISO-8859-5",
- "ISO-8859-6",
- "ISO-8859-7",
- "ISO-8859-8",
- "ISO-8859-9",
- "ISO-8859-9E",
- "ISO-8859-10",
- "ISO-8859-11",
- "ISO-8859-13",
- "ISO-8859-14",
- "ISO-8859-15",
- "ISO-8859-16",
- "UTF-7",
- "UTF-8",
- "UTF-16",
- "UTF-16LE",
- "UTF-16BE",
- "UTF-32",
- "UTF-32LE",
- "UTF-32BE",
- NULL
+ "ANSI_X3.4-1968",
+ "ANSI_X3.4-1986",
+ "ANSI_X3.4",
+ "ANSI_X3.110-1983",
+ "ANSI_X3.110",
+ "ASCII",
+ "ECMA-114",
+ "ECMA-118",
+ "ECMA-128",
+ "ECMA-CYRILLIC",
+ "IEC_P27-1",
+ "ISO-8859-1",
+ "ISO-8859-2",
+ "ISO-8859-3",
+ "ISO-8859-4",
+ "ISO-8859-5",
+ "ISO-8859-6",
+ "ISO-8859-7",
+ "ISO-8859-8",
+ "ISO-8859-9",
+ "ISO-8859-9E",
+ "ISO-8859-10",
+ "ISO-8859-11",
+ "ISO-8859-13",
+ "ISO-8859-14",
+ "ISO-8859-15",
+ "ISO-8859-16",
+ "UTF-7",
+ "UTF-8",
+ "UTF-16",
+ "UTF-16LE",
+ "UTF-16BE",
+ "UTF-32",
+ "UTF-32LE",
+ "UTF-32BE",
+ NULL
};
-#define SRT_TABLE_SIZE (sizeof(srt_codeset_table)/ sizeof(char*)-1)
+#define SRT_TABLE_SIZE (sizeof(srt_codeset_table)/ sizeof(char*)-1)
#if 0
typedef struct iso639_lang_t
@@ -456,619 +456,619 @@ typedef struct iso639_lang_t
const iso639_lang_t ghb_language_table[] =
{
- { "Any", "", "zz", "und" },
- { "Afar", "", "aa", "aar" },
- { "Abkhazian", "", "ab", "abk" },
- { "Afrikaans", "", "af", "afr" },
- { "Akan", "", "ak", "aka" },
- { "Albanian", "", "sq", "sqi", "alb" },
- { "Amharic", "", "am", "amh" },
- { "Arabic", "", "ar", "ara" },
- { "Aragonese", "", "an", "arg" },
- { "Armenian", "", "hy", "hye", "arm" },
- { "Assamese", "", "as", "asm" },
- { "Avaric", "", "av", "ava" },
- { "Avestan", "", "ae", "ave" },
- { "Aymara", "", "ay", "aym" },
- { "Azerbaijani", "", "az", "aze" },
- { "Bashkir", "", "ba", "bak" },
- { "Bambara", "", "bm", "bam" },
- { "Basque", "", "eu", "eus", "baq" },
- { "Belarusian", "", "be", "bel" },
- { "Bengali", "", "bn", "ben" },
- { "Bihari", "", "bh", "bih" },
- { "Bislama", "", "bi", "bis" },
- { "Bosnian", "", "bs", "bos" },
- { "Breton", "", "br", "bre" },
- { "Bulgarian", "", "bg", "bul" },
- { "Burmese", "", "my", "mya", "bur" },
- { "Catalan", "", "ca", "cat" },
- { "Chamorro", "", "ch", "cha" },
- { "Chechen", "", "ce", "che" },
- { "Chinese", "", "zh", "zho", "chi" },
- { "Church Slavic", "", "cu", "chu" },
- { "Chuvash", "", "cv", "chv" },
- { "Cornish", "", "kw", "cor" },
- { "Corsican", "", "co", "cos" },
- { "Cree", "", "cr", "cre" },
- { "Czech", "", "cs", "ces", "cze" },
- { "Danish", "Dansk", "da", "dan" },
- { "German", "Deutsch", "de", "deu", "ger" },
- { "Divehi", "", "dv", "div" },
- { "Dzongkha", "", "dz", "dzo" },
- { "English", "English", "en", "eng" },
- { "Spanish", "Espanol", "es", "spa" },
- { "Esperanto", "", "eo", "epo" },
- { "Estonian", "", "et", "est" },
- { "Ewe", "", "ee", "ewe" },
- { "Faroese", "", "fo", "fao" },
- { "Fijian", "", "fj", "fij" },
- { "French", "Francais", "fr", "fra", "fre" },
- { "Western Frisian", "", "fy", "fry" },
- { "Fulah", "", "ff", "ful" },
- { "Georgian", "", "ka", "kat", "geo" },
- { "Gaelic (Scots)", "", "gd", "gla" },
- { "Irish", "", "ga", "gle" },
- { "Galician", "", "gl", "glg" },
- { "Manx", "", "gv", "glv" },
- { "Greek, Modern", "", "el", "ell", "gre" },
- { "Guarani", "", "gn", "grn" },
- { "Gujarati", "", "gu", "guj" },
- { "Haitian", "", "ht", "hat" },
- { "Hausa", "", "ha", "hau" },
- { "Hebrew", "", "he", "heb" },
- { "Herero", "", "hz", "her" },
- { "Hindi", "", "hi", "hin" },
- { "Hiri Motu", "", "ho", "hmo" },
- { "Croatian", "Hrvatski", "hr", "hrv", "scr" },
- { "Igbo", "", "ig", "ibo" },
- { "Ido", "", "io", "ido" },
- { "Icelandic", "Islenska", "is", "isl", "ice" },
- { "Sichuan Yi", "", "ii", "iii" },
- { "Inuktitut", "", "iu", "iku" },
- { "Interlingue", "", "ie", "ile" },
- { "Interlingua", "", "ia", "ina" },
- { "Indonesian", "", "id", "ind" },
- { "Inupiaq", "", "ik", "ipk" },
- { "Italian", "Italiano", "it", "ita" },
- { "Javanese", "", "jv", "jav" },
- { "Japanese", "", "ja", "jpn" },
- { "Kalaallisut", "", "kl", "kal" },
- { "Kannada", "", "kn", "kan" },
- { "Kashmiri", "", "ks", "kas" },
- { "Kanuri", "", "kr", "kau" },
- { "Kazakh", "", "kk", "kaz" },
- { "Central Khmer", "", "km", "khm" },
- { "Kikuyu", "", "ki", "kik" },
- { "Kinyarwanda", "", "rw", "kin" },
- { "Kirghiz", "", "ky", "kir" },
- { "Komi", "", "kv", "kom" },
- { "Kongo", "", "kg", "kon" },
- { "Korean", "", "ko", "kor" },
- { "Kuanyama", "", "kj", "kua" },
- { "Kurdish", "", "ku", "kur" },
- { "Lao", "", "lo", "lao" },
- { "Latin", "", "la", "lat" },
- { "Latvian", "", "lv", "lav" },
- { "Limburgan", "", "li", "lim" },
- { "Lingala", "", "ln", "lin" },
- { "Lithuanian", "", "lt", "lit" },
- { "Luxembourgish", "", "lb", "ltz" },
- { "Luba-Katanga", "", "lu", "lub" },
- { "Ganda", "", "lg", "lug" },
- { "Macedonian", "", "mk", "mkd", "mac" },
- { "Hungarian", "Magyar", "hu", "hun" },
- { "Marshallese", "", "mh", "mah" },
- { "Malayalam", "", "ml", "mal" },
- { "Maori", "", "mi", "mri", "mao" },
- { "Marathi", "", "mr", "mar" },
- { "Malay", "", "ms", "msa", "msa" },
- { "Malagasy", "", "mg", "mlg" },
- { "Maltese", "", "mt", "mlt" },
- { "Moldavian", "", "mo", "mol" },
- { "Mongolian", "", "mn", "mon" },
- { "Nauru", "", "na", "nau" },
- { "Navajo", "", "nv", "nav" },
- { "Dutch", "Nederlands", "nl", "nld", "dut" },
- { "Ndebele, South", "", "nr", "nbl" },
- { "Ndebele, North", "", "nd", "nde" },
- { "Ndonga", "", "ng", "ndo" },
- { "Nepali", "", "ne", "nep" },
- { "Norwegian", "Norsk", "no", "nor" },
- { "Norwegian Nynorsk", "", "nn", "nno" },
- { "Norwegian Bokmål", "", "nb", "nob" },
- { "Chichewa; Nyanja", "", "ny", "nya" },
- { "Occitan", "", "oc", "oci" },
- { "Ojibwa", "", "oj", "oji" },
- { "Oriya", "", "or", "ori" },
- { "Oromo", "", "om", "orm" },
- { "Ossetian", "", "os", "oss" },
- { "Panjabi", "", "pa", "pan" },
- { "Persian", "", "fa", "fas", "per" },
- { "Pali", "", "pi", "pli" },
- { "Polish", "", "pl", "pol" },
- { "Portuguese", "Portugues", "pt", "por" },
- { "Pushto", "", "ps", "pus" },
- { "Quechua", "", "qu", "que" },
- { "Romansh", "", "rm", "roh" },
- { "Romanian", "", "ro", "ron", "rum" },
- { "Rundi", "", "rn", "run" },
- { "Russian", "", "ru", "rus" },
- { "Sango", "", "sg", "sag" },
- { "Sanskrit", "", "sa", "san" },
- { "Serbian", "", "sr", "srp", "scc" },
- { "Sinhala", "", "si", "sin" },
- { "Slovak", "", "sk", "slk", "slo" },
- { "Slovenian", "", "sl", "slv" },
- { "Northern Sami", "", "se", "sme" },
- { "Samoan", "", "sm", "smo" },
- { "Shona", "", "sn", "sna" },
- { "Sindhi", "", "sd", "snd" },
- { "Somali", "", "so", "som" },
- { "Sotho, Southern", "", "st", "sot" },
- { "Sardinian", "", "sc", "srd" },
- { "Swati", "", "ss", "ssw" },
- { "Sundanese", "", "su", "sun" },
- { "Finnish", "Suomi", "fi", "fin" },
- { "Swahili", "", "sw", "swa" },
- { "Swedish", "Svenska", "sv", "swe" },
- { "Tahitian", "", "ty", "tah" },
- { "Tamil", "", "ta", "tam" },
- { "Tatar", "", "tt", "tat" },
- { "Telugu", "", "te", "tel" },
- { "Tajik", "", "tg", "tgk" },
- { "Tagalog", "", "tl", "tgl" },
- { "Thai", "", "th", "tha" },
- { "Tibetan", "", "bo", "bod", "tib" },
- { "Tigrinya", "", "ti", "tir" },
- { "Tonga", "", "to", "ton" },
- { "Tswana", "", "tn", "tsn" },
- { "Tsonga", "", "ts", "tso" },
- { "Turkmen", "", "tk", "tuk" },
- { "Turkish", "", "tr", "tur" },
- { "Twi", "", "tw", "twi" },
- { "Uighur", "", "ug", "uig" },
- { "Ukrainian", "", "uk", "ukr" },
- { "Urdu", "", "ur", "urd" },
- { "Uzbek", "", "uz", "uzb" },
- { "Venda", "", "ve", "ven" },
- { "Vietnamese", "", "vi", "vie" },
- { "Volapük", "", "vo", "vol" },
- { "Welsh", "", "cy", "cym", "wel" },
- { "Walloon", "", "wa", "wln" },
- { "Wolof", "", "wo", "wol" },
- { "Xhosa", "", "xh", "xho" },
- { "Yiddish", "", "yi", "yid" },
- { "Yoruba", "", "yo", "yor" },
- { "Zhuang", "", "za", "zha" },
- { "Zulu", "", "zu", "zul" },
- {NULL, NULL, NULL, NULL}
+ { "Any", "", "zz", "und" },
+ { "Afar", "", "aa", "aar" },
+ { "Abkhazian", "", "ab", "abk" },
+ { "Afrikaans", "", "af", "afr" },
+ { "Akan", "", "ak", "aka" },
+ { "Albanian", "", "sq", "sqi", "alb" },
+ { "Amharic", "", "am", "amh" },
+ { "Arabic", "", "ar", "ara" },
+ { "Aragonese", "", "an", "arg" },
+ { "Armenian", "", "hy", "hye", "arm" },
+ { "Assamese", "", "as", "asm" },
+ { "Avaric", "", "av", "ava" },
+ { "Avestan", "", "ae", "ave" },
+ { "Aymara", "", "ay", "aym" },
+ { "Azerbaijani", "", "az", "aze" },
+ { "Bashkir", "", "ba", "bak" },
+ { "Bambara", "", "bm", "bam" },
+ { "Basque", "", "eu", "eus", "baq" },
+ { "Belarusian", "", "be", "bel" },
+ { "Bengali", "", "bn", "ben" },
+ { "Bihari", "", "bh", "bih" },
+ { "Bislama", "", "bi", "bis" },
+ { "Bosnian", "", "bs", "bos" },
+ { "Breton", "", "br", "bre" },
+ { "Bulgarian", "", "bg", "bul" },
+ { "Burmese", "", "my", "mya", "bur" },
+ { "Catalan", "", "ca", "cat" },
+ { "Chamorro", "", "ch", "cha" },
+ { "Chechen", "", "ce", "che" },
+ { "Chinese", "", "zh", "zho", "chi" },
+ { "Church Slavic", "", "cu", "chu" },
+ { "Chuvash", "", "cv", "chv" },
+ { "Cornish", "", "kw", "cor" },
+ { "Corsican", "", "co", "cos" },
+ { "Cree", "", "cr", "cre" },
+ { "Czech", "", "cs", "ces", "cze" },
+ { "Danish", "Dansk", "da", "dan" },
+ { "German", "Deutsch", "de", "deu", "ger" },
+ { "Divehi", "", "dv", "div" },
+ { "Dzongkha", "", "dz", "dzo" },
+ { "English", "English", "en", "eng" },
+ { "Spanish", "Espanol", "es", "spa" },
+ { "Esperanto", "", "eo", "epo" },
+ { "Estonian", "", "et", "est" },
+ { "Ewe", "", "ee", "ewe" },
+ { "Faroese", "", "fo", "fao" },
+ { "Fijian", "", "fj", "fij" },
+ { "French", "Francais", "fr", "fra", "fre" },
+ { "Western Frisian", "", "fy", "fry" },
+ { "Fulah", "", "ff", "ful" },
+ { "Georgian", "", "ka", "kat", "geo" },
+ { "Gaelic (Scots)", "", "gd", "gla" },
+ { "Irish", "", "ga", "gle" },
+ { "Galician", "", "gl", "glg" },
+ { "Manx", "", "gv", "glv" },
+ { "Greek, Modern", "", "el", "ell", "gre" },
+ { "Guarani", "", "gn", "grn" },
+ { "Gujarati", "", "gu", "guj" },
+ { "Haitian", "", "ht", "hat" },
+ { "Hausa", "", "ha", "hau" },
+ { "Hebrew", "", "he", "heb" },
+ { "Herero", "", "hz", "her" },
+ { "Hindi", "", "hi", "hin" },
+ { "Hiri Motu", "", "ho", "hmo" },
+ { "Croatian", "Hrvatski", "hr", "hrv", "scr" },
+ { "Igbo", "", "ig", "ibo" },
+ { "Ido", "", "io", "ido" },
+ { "Icelandic", "Islenska", "is", "isl", "ice" },
+ { "Sichuan Yi", "", "ii", "iii" },
+ { "Inuktitut", "", "iu", "iku" },
+ { "Interlingue", "", "ie", "ile" },
+ { "Interlingua", "", "ia", "ina" },
+ { "Indonesian", "", "id", "ind" },
+ { "Inupiaq", "", "ik", "ipk" },
+ { "Italian", "Italiano", "it", "ita" },
+ { "Javanese", "", "jv", "jav" },
+ { "Japanese", "", "ja", "jpn" },
+ { "Kalaallisut", "", "kl", "kal" },
+ { "Kannada", "", "kn", "kan" },
+ { "Kashmiri", "", "ks", "kas" },
+ { "Kanuri", "", "kr", "kau" },
+ { "Kazakh", "", "kk", "kaz" },
+ { "Central Khmer", "", "km", "khm" },
+ { "Kikuyu", "", "ki", "kik" },
+ { "Kinyarwanda", "", "rw", "kin" },
+ { "Kirghiz", "", "ky", "kir" },
+ { "Komi", "", "kv", "kom" },
+ { "Kongo", "", "kg", "kon" },
+ { "Korean", "", "ko", "kor" },
+ { "Kuanyama", "", "kj", "kua" },
+ { "Kurdish", "", "ku", "kur" },
+ { "Lao", "", "lo", "lao" },
+ { "Latin", "", "la", "lat" },
+ { "Latvian", "", "lv", "lav" },
+ { "Limburgan", "", "li", "lim" },
+ { "Lingala", "", "ln", "lin" },
+ { "Lithuanian", "", "lt", "lit" },
+ { "Luxembourgish", "", "lb", "ltz" },
+ { "Luba-Katanga", "", "lu", "lub" },
+ { "Ganda", "", "lg", "lug" },
+ { "Macedonian", "", "mk", "mkd", "mac" },
+ { "Hungarian", "Magyar", "hu", "hun" },
+ { "Marshallese", "", "mh", "mah" },
+ { "Malayalam", "", "ml", "mal" },
+ { "Maori", "", "mi", "mri", "mao" },
+ { "Marathi", "", "mr", "mar" },
+ { "Malay", "", "ms", "msa", "msa" },
+ { "Malagasy", "", "mg", "mlg" },
+ { "Maltese", "", "mt", "mlt" },
+ { "Moldavian", "", "mo", "mol" },
+ { "Mongolian", "", "mn", "mon" },
+ { "Nauru", "", "na", "nau" },
+ { "Navajo", "", "nv", "nav" },
+ { "Dutch", "Nederlands", "nl", "nld", "dut" },
+ { "Ndebele, South", "", "nr", "nbl" },
+ { "Ndebele, North", "", "nd", "nde" },
+ { "Ndonga", "", "ng", "ndo" },
+ { "Nepali", "", "ne", "nep" },
+ { "Norwegian", "Norsk", "no", "nor" },
+ { "Norwegian Nynorsk", "", "nn", "nno" },
+ { "Norwegian Bokmål", "", "nb", "nob" },
+ { "Chichewa; Nyanja", "", "ny", "nya" },
+ { "Occitan", "", "oc", "oci" },
+ { "Ojibwa", "", "oj", "oji" },
+ { "Oriya", "", "or", "ori" },
+ { "Oromo", "", "om", "orm" },
+ { "Ossetian", "", "os", "oss" },
+ { "Panjabi", "", "pa", "pan" },
+ { "Persian", "", "fa", "fas", "per" },
+ { "Pali", "", "pi", "pli" },
+ { "Polish", "", "pl", "pol" },
+ { "Portuguese", "Portugues", "pt", "por" },
+ { "Pushto", "", "ps", "pus" },
+ { "Quechua", "", "qu", "que" },
+ { "Romansh", "", "rm", "roh" },
+ { "Romanian", "", "ro", "ron", "rum" },
+ { "Rundi", "", "rn", "run" },
+ { "Russian", "", "ru", "rus" },
+ { "Sango", "", "sg", "sag" },
+ { "Sanskrit", "", "sa", "san" },
+ { "Serbian", "", "sr", "srp", "scc" },
+ { "Sinhala", "", "si", "sin" },
+ { "Slovak", "", "sk", "slk", "slo" },
+ { "Slovenian", "", "sl", "slv" },
+ { "Northern Sami", "", "se", "sme" },
+ { "Samoan", "", "sm", "smo" },
+ { "Shona", "", "sn", "sna" },
+ { "Sindhi", "", "sd", "snd" },
+ { "Somali", "", "so", "som" },
+ { "Sotho, Southern", "", "st", "sot" },
+ { "Sardinian", "", "sc", "srd" },
+ { "Swati", "", "ss", "ssw" },
+ { "Sundanese", "", "su", "sun" },
+ { "Finnish", "Suomi", "fi", "fin" },
+ { "Swahili", "", "sw", "swa" },
+ { "Swedish", "Svenska", "sv", "swe" },
+ { "Tahitian", "", "ty", "tah" },
+ { "Tamil", "", "ta", "tam" },
+ { "Tatar", "", "tt", "tat" },
+ { "Telugu", "", "te", "tel" },
+ { "Tajik", "", "tg", "tgk" },
+ { "Tagalog", "", "tl", "tgl" },
+ { "Thai", "", "th", "tha" },
+ { "Tibetan", "", "bo", "bod", "tib" },
+ { "Tigrinya", "", "ti", "tir" },
+ { "Tonga", "", "to", "ton" },
+ { "Tswana", "", "tn", "tsn" },
+ { "Tsonga", "", "ts", "tso" },
+ { "Turkmen", "", "tk", "tuk" },
+ { "Turkish", "", "tr", "tur" },
+ { "Twi", "", "tw", "twi" },
+ { "Uighur", "", "ug", "uig" },
+ { "Ukrainian", "", "uk", "ukr" },
+ { "Urdu", "", "ur", "urd" },
+ { "Uzbek", "", "uz", "uzb" },
+ { "Venda", "", "ve", "ven" },
+ { "Vietnamese", "", "vi", "vie" },
+ { "Volapük", "", "vo", "vol" },
+ { "Welsh", "", "cy", "cym", "wel" },
+ { "Walloon", "", "wa", "wln" },
+ { "Wolof", "", "wo", "wol" },
+ { "Xhosa", "", "xh", "xho" },
+ { "Yiddish", "", "yi", "yid" },
+ { "Yoruba", "", "yo", "yor" },
+ { "Zhuang", "", "za", "zha" },
+ { "Zulu", "", "zu", "zul" },
+ {NULL, NULL, NULL, NULL}
};
-#define LANG_TABLE_SIZE (sizeof(ghb_language_table)/ sizeof(iso639_lang_t)-1)
+#define LANG_TABLE_SIZE (sizeof(ghb_language_table)/ sizeof(iso639_lang_t)-1)
static void audio_bitrate_opts_set(GtkBuilder *builder, const gchar *name);
static void
del_tree(const gchar *name, gboolean del_top)
{
- const gchar *file;
-
- if (g_file_test(name, G_FILE_TEST_IS_DIR))
- {
- GDir *gdir = g_dir_open(name, 0, NULL);
- file = g_dir_read_name(gdir);
- while (file)
- {
- gchar *path;
- path = g_strdup_printf("%s/%s", name, file);
- del_tree(path, TRUE);
- g_free(path);
- file = g_dir_read_name(gdir);
- }
- if (del_top)
- g_rmdir(name);
- g_dir_close(gdir);
- }
- else
- {
- g_unlink(name);
- }
+ const gchar *file;
+
+ if (g_file_test(name, G_FILE_TEST_IS_DIR))
+ {
+ GDir *gdir = g_dir_open(name, 0, NULL);
+ file = g_dir_read_name(gdir);
+ while (file)
+ {
+ gchar *path;
+ path = g_strdup_printf("%s/%s", name, file);
+ del_tree(path, TRUE);
+ g_free(path);
+ file = g_dir_read_name(gdir);
+ }
+ if (del_top)
+ g_rmdir(name);
+ g_dir_close(gdir);
+ }
+ else
+ {
+ g_unlink(name);
+ }
}
const gchar*
ghb_version()
{
- return hb_get_version(NULL);
+ return hb_get_version(NULL);
}
void
ghb_vquality_range(
- signal_user_data_t *ud,
- gdouble *min,
- gdouble *max,
- gdouble *step,
- gdouble *page,
- gint *digits,
- gboolean *inverted)
-{
- gint vcodec = ghb_settings_combo_int(ud->settings, "VideoEncoder");
- *page = 10;
- *digits = 0;
- switch (vcodec)
- {
- case HB_VCODEC_X264:
- {
- *min = 0;
- *max = 51;
- *step = ghb_settings_combo_double(ud->settings,
- "VideoQualityGranularity");
- if (*step == 0.2 || *step == 0.5)
- *digits = 1;
- else if (*step == 0.25)
- *digits = 2;
- *inverted = TRUE;
- } break;
-
- case HB_VCODEC_FFMPEG_MPEG2:
- case HB_VCODEC_FFMPEG_MPEG4:
- {
- *min = 1;
- *max = 31;
- *step = 1;
- *inverted = TRUE;
- } break;
-
- case HB_VCODEC_THEORA:
- {
- *min = 0;
- *max = 63;
- *step = 1;
- *inverted = FALSE;
- } break;
-
- default:
- {
- *min = 0;
- *max = 100;
- *step = 1;
- *inverted = FALSE;
- } break;
- }
+ signal_user_data_t *ud,
+ gdouble *min,
+ gdouble *max,
+ gdouble *step,
+ gdouble *page,
+ gint *digits,
+ gboolean *inverted)
+{
+ gint vcodec = ghb_settings_combo_int(ud->settings, "VideoEncoder");
+ *page = 10;
+ *digits = 0;
+ switch (vcodec)
+ {
+ case HB_VCODEC_X264:
+ {
+ *min = 0;
+ *max = 51;
+ *step = ghb_settings_combo_double(ud->settings,
+ "VideoQualityGranularity");
+ if (*step == 0.2 || *step == 0.5)
+ *digits = 1;
+ else if (*step == 0.25)
+ *digits = 2;
+ *inverted = TRUE;
+ } break;
+
+ case HB_VCODEC_FFMPEG_MPEG2:
+ case HB_VCODEC_FFMPEG_MPEG4:
+ {
+ *min = 1;
+ *max = 31;
+ *step = 1;
+ *inverted = TRUE;
+ } break;
+
+ case HB_VCODEC_THEORA:
+ {
+ *min = 0;
+ *max = 63;
+ *step = 1;
+ *inverted = FALSE;
+ } break;
+
+ default:
+ {
+ *min = 0;
+ *max = 100;
+ *step = 1;
+ *inverted = FALSE;
+ } break;
+ }
}
gint
find_combo_entry(combo_opts_t *opts, const GValue *gval)
{
- gint ii;
-
- if (G_VALUE_TYPE(gval) == G_TYPE_STRING)
- {
- gchar *str;
- str = ghb_value_string(gval);
- for (ii = 0; ii < opts->count; ii++)
- {
- if (strcmp(opts->map[ii].shortOpt, str) == 0)
- {
- break;
- }
- }
- g_free(str);
- return ii;
- }
- else if (G_VALUE_TYPE(gval) == G_TYPE_DOUBLE)
- {
- gdouble val;
- val = ghb_value_double(gval);
- for (ii = 0; ii < opts->count; ii++)
- {
- if (opts->map[ii].ivalue == val)
- {
- break;
- }
- }
- return ii;
- }
- else if (G_VALUE_TYPE(gval) == G_TYPE_INT ||
- G_VALUE_TYPE(gval) == G_TYPE_BOOLEAN ||
- G_VALUE_TYPE(gval) == G_TYPE_INT64)
- {
- gint64 val;
- val = ghb_value_int64(gval);
- for (ii = 0; ii < opts->count; ii++)
- {
- if ((gint64)opts->map[ii].ivalue == val)
- {
- break;
- }
- }
- return ii;
- }
- return opts->count;
+ gint ii;
+
+ if (G_VALUE_TYPE(gval) == G_TYPE_STRING)
+ {
+ gchar *str;
+ str = ghb_value_string(gval);
+ for (ii = 0; ii < opts->count; ii++)
+ {
+ if (strcmp(opts->map[ii].shortOpt, str) == 0)
+ {
+ break;
+ }
+ }
+ g_free(str);
+ return ii;
+ }
+ else if (G_VALUE_TYPE(gval) == G_TYPE_DOUBLE)
+ {
+ gdouble val;
+ val = ghb_value_double(gval);
+ for (ii = 0; ii < opts->count; ii++)
+ {
+ if (opts->map[ii].ivalue == val)
+ {
+ break;
+ }
+ }
+ return ii;
+ }
+ else if (G_VALUE_TYPE(gval) == G_TYPE_INT ||
+ G_VALUE_TYPE(gval) == G_TYPE_BOOLEAN ||
+ G_VALUE_TYPE(gval) == G_TYPE_INT64)
+ {
+ gint64 val;
+ val = ghb_value_int64(gval);
+ for (ii = 0; ii < opts->count; ii++)
+ {
+ if ((gint64)opts->map[ii].ivalue == val)
+ {
+ break;
+ }
+ }
+ return ii;
+ }
+ return opts->count;
}
static const gchar*
lookup_generic_string(combo_opts_t *opts, const GValue *gval)
{
- gint ii;
- const gchar *result = "";
+ gint ii;
+ const gchar *result = "";
- ii = find_combo_entry(opts, gval);
- if (ii < opts->count)
- {
- result = opts->map[ii].svalue;
- }
- return result;
+ ii = find_combo_entry(opts, gval);
+ if (ii < opts->count)
+ {
+ result = opts->map[ii].svalue;
+ }
+ return result;
}
static gint
lookup_generic_int(combo_opts_t *opts, const GValue *gval)
{
- gint ii;
- gint result = -1;
+ gint ii;
+ gint result = -1;
- ii = find_combo_entry(opts, gval);
- if (ii < opts->count)
- {
- result = opts->map[ii].ivalue;
- }
- return result;
+ ii = find_combo_entry(opts, gval);
+ if (ii < opts->count)
+ {
+ result = opts->map[ii].ivalue;
+ }
+ return result;
}
static gdouble
lookup_generic_double(combo_opts_t *opts, const GValue *gval)
{
- gint ii;
- gdouble result = -1;
+ gint ii;
+ gdouble result = -1;
- ii = find_combo_entry(opts, gval);
- if (ii < opts->count)
- {
- result = opts->map[ii].ivalue;
- }
- return result;
+ ii = find_combo_entry(opts, gval);
+ if (ii < opts->count)
+ {
+ result = opts->map[ii].ivalue;
+ }
+ return result;
}
static const gchar*
lookup_generic_option(combo_opts_t *opts, const GValue *gval)
{
- gint ii;
- const gchar *result = "";
+ gint ii;
+ const gchar *result = "";
- ii = find_combo_entry(opts, gval);
- if (ii < opts->count)
- {
- result = opts->map[ii].option;
- }
- return result;
+ ii = find_combo_entry(opts, gval);
+ if (ii < opts->count)
+ {
+ result = opts->map[ii].option;
+ }
+ return result;
}
static gint
lookup_mix_int(const GValue *mix)
{
- gint ii;
- gint result = 0;
-
-
- if (G_VALUE_TYPE(mix) == G_TYPE_STRING)
- {
- gchar * str = ghb_value_string(mix);
- for (ii = 0; ii < hb_audio_mixdowns_count; ii++)
- {
- if (strcmp(hb_audio_mixdowns[ii].short_name, str) == 0)
- {
- result = hb_audio_mixdowns[ii].amixdown;
- break;
- }
- }
- g_free(str);
- }
- else if (G_VALUE_TYPE(mix) == G_TYPE_INT ||
- G_VALUE_TYPE(mix) == G_TYPE_INT64 ||
- G_VALUE_TYPE(mix) == G_TYPE_DOUBLE)
- {
- gint val = ghb_value_int(mix);
- for (ii = 0; ii < hb_audio_mixdowns_count; ii++)
- {
- if (hb_audio_mixdowns[ii].amixdown == val)
- {
- result = hb_audio_mixdowns[ii].amixdown;
- break;
- }
- }
- }
- return result;
+ gint ii;
+ gint result = 0;
+
+
+ if (G_VALUE_TYPE(mix) == G_TYPE_STRING)
+ {
+ gchar * str = ghb_value_string(mix);
+ for (ii = 0; ii < hb_audio_mixdowns_count; ii++)
+ {
+ if (strcmp(hb_audio_mixdowns[ii].short_name, str) == 0)
+ {
+ result = hb_audio_mixdowns[ii].amixdown;
+ break;
+ }
+ }
+ g_free(str);
+ }
+ else if (G_VALUE_TYPE(mix) == G_TYPE_INT ||
+ G_VALUE_TYPE(mix) == G_TYPE_INT64 ||
+ G_VALUE_TYPE(mix) == G_TYPE_DOUBLE)
+ {
+ gint val = ghb_value_int(mix);
+ for (ii = 0; ii < hb_audio_mixdowns_count; ii++)
+ {
+ if (hb_audio_mixdowns[ii].amixdown == val)
+ {
+ result = hb_audio_mixdowns[ii].amixdown;
+ break;
+ }
+ }
+ }
+ return result;
}
static const gchar*
lookup_mix_option(const GValue *mix)
{
- gint ii;
- gchar *result = "None";
-
-
- if (G_VALUE_TYPE(mix) == G_TYPE_STRING)
- {
- gchar *str = ghb_value_string(mix);
- for (ii = 0; ii < hb_audio_mixdowns_count; ii++)
- {
- if (strcmp(hb_audio_mixdowns[ii].short_name, str) == 0)
- {
- result = hb_audio_mixdowns[ii].human_readable_name;
- break;
- }
- }
- g_free(str);
- }
- else if (G_VALUE_TYPE(mix) == G_TYPE_INT ||
- G_VALUE_TYPE(mix) == G_TYPE_INT64 ||
- G_VALUE_TYPE(mix) == G_TYPE_DOUBLE)
- {
- gint val = ghb_value_int(mix);
- for (ii = 0; ii < hb_audio_mixdowns_count; ii++)
- {
- if (hb_audio_mixdowns[ii].amixdown == val)
- {
- result = hb_audio_mixdowns[ii].human_readable_name;
- break;
- }
- }
- }
- return result;
+ gint ii;
+ gchar *result = "None";
+
+
+ if (G_VALUE_TYPE(mix) == G_TYPE_STRING)
+ {
+ gchar *str = ghb_value_string(mix);
+ for (ii = 0; ii < hb_audio_mixdowns_count; ii++)
+ {
+ if (strcmp(hb_audio_mixdowns[ii].short_name, str) == 0)
+ {
+ result = hb_audio_mixdowns[ii].human_readable_name;
+ break;
+ }
+ }
+ g_free(str);
+ }
+ else if (G_VALUE_TYPE(mix) == G_TYPE_INT ||
+ G_VALUE_TYPE(mix) == G_TYPE_INT64 ||
+ G_VALUE_TYPE(mix) == G_TYPE_DOUBLE)
+ {
+ gint val = ghb_value_int(mix);
+ for (ii = 0; ii < hb_audio_mixdowns_count; ii++)
+ {
+ if (hb_audio_mixdowns[ii].amixdown == val)
+ {
+ result = hb_audio_mixdowns[ii].human_readable_name;
+ break;
+ }
+ }
+ }
+ return result;
}
static const gchar*
lookup_mix_string(const GValue *mix)
{
- gint ii;
- gchar *result = "none";
-
-
- if (G_VALUE_TYPE(mix) == G_TYPE_STRING)
- {
- gchar *str = ghb_value_string(mix);
- for (ii = 0; ii < hb_audio_mixdowns_count; ii++)
- {
- if (strcmp(hb_audio_mixdowns[ii].short_name, str) == 0)
- {
- result = hb_audio_mixdowns[ii].short_name;
- break;
- }
- }
- g_free(str);
- }
- else if (G_VALUE_TYPE(mix) == G_TYPE_INT ||
- G_VALUE_TYPE(mix) == G_TYPE_INT64 ||
- G_VALUE_TYPE(mix) == G_TYPE_DOUBLE)
- {
- gint val = ghb_value_int(mix);
- for (ii = 0; ii < hb_audio_mixdowns_count; ii++)
- {
- if (hb_audio_mixdowns[ii].amixdown == val)
- {
- result = hb_audio_mixdowns[ii].short_name;
- break;
- }
- }
- }
- return result;
+ gint ii;
+ gchar *result = "none";
+
+
+ if (G_VALUE_TYPE(mix) == G_TYPE_STRING)
+ {
+ gchar *str = ghb_value_string(mix);
+ for (ii = 0; ii < hb_audio_mixdowns_count; ii++)
+ {
+ if (strcmp(hb_audio_mixdowns[ii].short_name, str) == 0)
+ {
+ result = hb_audio_mixdowns[ii].short_name;
+ break;
+ }
+ }
+ g_free(str);
+ }
+ else if (G_VALUE_TYPE(mix) == G_TYPE_INT ||
+ G_VALUE_TYPE(mix) == G_TYPE_INT64 ||
+ G_VALUE_TYPE(mix) == G_TYPE_DOUBLE)
+ {
+ gint val = ghb_value_int(mix);
+ for (ii = 0; ii < hb_audio_mixdowns_count; ii++)
+ {
+ if (hb_audio_mixdowns[ii].amixdown == val)
+ {
+ result = hb_audio_mixdowns[ii].short_name;
+ break;
+ }
+ }
+ }
+ return result;
}
static gint
lookup_video_rate_int(const GValue *vrate)
{
- gint ii;
- gchar *str;
- gint result = 0;
+ gint ii;
+ gchar *str;
+ gint result = 0;
- str = ghb_value_string(vrate);
- for (ii = 0; ii < hb_video_rates_count; ii++)
- {
- if (strcmp(hb_video_rates[ii].string, str) == 0)
- {
- result = hb_video_rates[ii].rate;
- break;
- }
- }
- g_free(str);
- // Default to "same as source"
- return result;
+ str = ghb_value_string(vrate);
+ for (ii = 0; ii < hb_video_rates_count; ii++)
+ {
+ if (strcmp(hb_video_rates[ii].string, str) == 0)
+ {
+ result = hb_video_rates[ii].rate;
+ break;
+ }
+ }
+ g_free(str);
+ // Default to "same as source"
+ return result;
}
static const gchar*
lookup_video_rate_option(const GValue *vrate)
{
- gint ii;
- gchar *str;
- const gchar *result = "Same as source";
+ gint ii;
+ gchar *str;
+ const gchar *result = "Same as source";
- str = ghb_value_string(vrate);
- for (ii = 0; ii < hb_video_rates_count; ii++)
- {
- if (strcmp(hb_video_rates[ii].string, str) == 0)
- {
- result = hb_video_rates[ii].string;
- break;
- }
- }
- g_free(str);
- // Default to "same as source"
- return result;
+ str = ghb_value_string(vrate);
+ for (ii = 0; ii < hb_video_rates_count; ii++)
+ {
+ if (strcmp(hb_video_rates[ii].string, str) == 0)
+ {
+ result = hb_video_rates[ii].string;
+ break;
+ }
+ }
+ g_free(str);
+ // Default to "same as source"
+ return result;
}
static gint
lookup_audio_rate_int(const GValue *rate)
{
- gint ii;
- gint result = 0;
-
- if (G_VALUE_TYPE(rate) == G_TYPE_STRING)
- {
- // Coincidentally, the string "source" will return 0
- // which is our flag to use "same as source"
- gchar * str = ghb_value_string(rate);
- for (ii = 0; ii < hb_audio_rates_count; ii++)
- {
- if (strcmp(hb_audio_rates[ii].string, str) == 0)
- {
- result = hb_audio_rates[ii].rate;
- break;
- }
- }
- g_free(str);
- }
- else if (G_VALUE_TYPE(rate) == G_TYPE_INT ||
- G_VALUE_TYPE(rate) == G_TYPE_INT64 ||
- G_VALUE_TYPE(rate) == G_TYPE_DOUBLE)
- {
- for (ii = 0; ii < hb_audio_rates_count; ii++)
- {
- gint val = ghb_value_int(rate);
- if (val == hb_audio_rates[ii].rate)
- {
- result = hb_audio_rates[ii].rate;
- break;
- }
- }
- }
- return result;
+ gint ii;
+ gint result = 0;
+
+ if (G_VALUE_TYPE(rate) == G_TYPE_STRING)
+ {
+ // Coincidentally, the string "source" will return 0
+ // which is our flag to use "same as source"
+ gchar * str = ghb_value_string(rate);
+ for (ii = 0; ii < hb_audio_rates_count; ii++)
+ {
+ if (strcmp(hb_audio_rates[ii].string, str) == 0)
+ {
+ result = hb_audio_rates[ii].rate;
+ break;
+ }
+ }
+ g_free(str);
+ }
+ else if (G_VALUE_TYPE(rate) == G_TYPE_INT ||
+ G_VALUE_TYPE(rate) == G_TYPE_INT64 ||
+ G_VALUE_TYPE(rate) == G_TYPE_DOUBLE)
+ {
+ for (ii = 0; ii < hb_audio_rates_count; ii++)
+ {
+ gint val = ghb_value_int(rate);
+ if (val == hb_audio_rates[ii].rate)
+ {
+ result = hb_audio_rates[ii].rate;
+ break;
+ }
+ }
+ }
+ return result;
}
static const gchar*
lookup_audio_rate(const GValue *rate, const char *def)
{
- gint ii;
- const gchar *result = def;
-
- if (G_VALUE_TYPE(rate) == G_TYPE_STRING)
- {
- // Coincidentally, the string "source" will return 0
- // which is our flag to use "same as source"
- gchar *str = ghb_value_string(rate);
- for (ii = 0; ii < hb_audio_rates_count; ii++)
- {
- if (strcmp(hb_audio_rates[ii].string, str) == 0)
- {
- result = hb_audio_rates[ii].string;
- break;
- }
- }
- g_free(str);
- }
- else if (G_VALUE_TYPE(rate) == G_TYPE_INT ||
- G_VALUE_TYPE(rate) == G_TYPE_INT64 ||
- G_VALUE_TYPE(rate) == G_TYPE_DOUBLE)
- {
- for (ii = 0; ii < hb_audio_rates_count; ii++)
- {
- gint val = ghb_value_int(rate);
- if (val == hb_audio_rates[ii].rate)
- {
- result = hb_audio_rates[ii].string;
- break;
- }
- }
- }
- return result;
+ gint ii;
+ const gchar *result = def;
+
+ if (G_VALUE_TYPE(rate) == G_TYPE_STRING)
+ {
+ // Coincidentally, the string "source" will return 0
+ // which is our flag to use "same as source"
+ gchar *str = ghb_value_string(rate);
+ for (ii = 0; ii < hb_audio_rates_count; ii++)
+ {
+ if (strcmp(hb_audio_rates[ii].string, str) == 0)
+ {
+ result = hb_audio_rates[ii].string;
+ break;
+ }
+ }
+ g_free(str);
+ }
+ else if (G_VALUE_TYPE(rate) == G_TYPE_INT ||
+ G_VALUE_TYPE(rate) == G_TYPE_INT64 ||
+ G_VALUE_TYPE(rate) == G_TYPE_DOUBLE)
+ {
+ for (ii = 0; ii < hb_audio_rates_count; ii++)
+ {
+ gint val = ghb_value_int(rate);
+ if (val == hb_audio_rates[ii].rate)
+ {
+ result = hb_audio_rates[ii].string;
+ break;
+ }
+ }
+ }
+ return result;
}
static const gchar*
@@ -1086,19 +1086,19 @@ lookup_audio_rate_string(const GValue *rate)
gint
ghb_find_closest_audio_rate(gint rate)
{
- gint ii;
- gint result;
+ gint ii;
+ gint result;
- result = 0;
- for (ii = 0; ii < hb_audio_rates_count; ii++)
- {
- if (rate <= hb_audio_rates[ii].rate)
- {
- result = hb_audio_rates[ii].rate;
- break;
- }
- }
- return result;
+ result = 0;
+ for (ii = 0; ii < hb_audio_rates_count; ii++)
+ {
+ if (rate <= hb_audio_rates[ii].rate)
+ {
+ result = hb_audio_rates[ii].rate;
+ break;
+ }
+ }
+ return result;
}
hb_rate_t *ghb_audio_bitrates;
@@ -1107,264 +1107,264 @@ int ghb_audio_bitrates_count;
static gint
lookup_audio_bitrate_int(const GValue *rate)
{
- gint ii;
- gint result = 160;
-
- if (G_VALUE_TYPE(rate) == G_TYPE_STRING)
- {
- // Coincidentally, the string "source" will return 0
- // which is our flag to use "same as source"
- gchar *str = ghb_value_string(rate);
- for (ii = 0; ii < ghb_audio_bitrates_count; ii++)
- {
- if (strcmp(ghb_audio_bitrates[ii].string, str) == 0)
- {
- result = ghb_audio_bitrates[ii].rate;
- break;
- }
- }
- g_free(str);
- }
- else if (G_VALUE_TYPE(rate) == G_TYPE_INT ||
- G_VALUE_TYPE(rate) == G_TYPE_INT64 ||
- G_VALUE_TYPE(rate) == G_TYPE_DOUBLE)
- {
- gint val = ghb_value_int(rate);
- for (ii = 0; ii < ghb_audio_bitrates_count; ii++)
- {
- if (ghb_audio_bitrates[ii].rate == val)
- {
- result = ghb_audio_bitrates[ii].rate;
- break;
- }
- }
- }
- return result;
+ gint ii;
+ gint result = 160;
+
+ if (G_VALUE_TYPE(rate) == G_TYPE_STRING)
+ {
+ // Coincidentally, the string "source" will return 0
+ // which is our flag to use "same as source"
+ gchar *str = ghb_value_string(rate);
+ for (ii = 0; ii < ghb_audio_bitrates_count; ii++)
+ {
+ if (strcmp(ghb_audio_bitrates[ii].string, str) == 0)
+ {
+ result = ghb_audio_bitrates[ii].rate;
+ break;
+ }
+ }
+ g_free(str);
+ }
+ else if (G_VALUE_TYPE(rate) == G_TYPE_INT ||
+ G_VALUE_TYPE(rate) == G_TYPE_INT64 ||
+ G_VALUE_TYPE(rate) == G_TYPE_DOUBLE)
+ {
+ gint val = ghb_value_int(rate);
+ for (ii = 0; ii < ghb_audio_bitrates_count; ii++)
+ {
+ if (ghb_audio_bitrates[ii].rate == val)
+ {
+ result = ghb_audio_bitrates[ii].rate;
+ break;
+ }
+ }
+ }
+ return result;
}
static const gchar*
lookup_audio_bitrate_option(const GValue *rate)
{
- gint ii;
- const gchar *result = "160";
-
- if (G_VALUE_TYPE(rate) == G_TYPE_STRING)
- {
- // Coincidentally, the string "source" will return 0
- // which is our flag to use "same as source"
- gchar *str = ghb_value_string(rate);
- for (ii = 0; ii < ghb_audio_bitrates_count; ii++)
- {
- if (strcmp(ghb_audio_bitrates[ii].string, str) == 0)
- {
- result = ghb_audio_bitrates[ii].string;
- break;
- }
- }
- g_free(str);
- }
- else if (G_VALUE_TYPE(rate) == G_TYPE_INT ||
- G_VALUE_TYPE(rate) == G_TYPE_INT64 ||
- G_VALUE_TYPE(rate) == G_TYPE_DOUBLE)
- {
- gint val = ghb_value_int(rate);
- for (ii = 0; ii < ghb_audio_bitrates_count; ii++)
- {
- if (ghb_audio_bitrates[ii].rate == val)
- {
- result = ghb_audio_bitrates[ii].string;
- break;
- }
- }
- }
- return result;
+ gint ii;
+ const gchar *result = "160";
+
+ if (G_VALUE_TYPE(rate) == G_TYPE_STRING)
+ {
+ // Coincidentally, the string "source" will return 0
+ // which is our flag to use "same as source"
+ gchar *str = ghb_value_string(rate);
+ for (ii = 0; ii < ghb_audio_bitrates_count; ii++)
+ {
+ if (strcmp(ghb_audio_bitrates[ii].string, str) == 0)
+ {
+ result = ghb_audio_bitrates[ii].string;
+ break;
+ }
+ }
+ g_free(str);
+ }
+ else if (G_VALUE_TYPE(rate) == G_TYPE_INT ||
+ G_VALUE_TYPE(rate) == G_TYPE_INT64 ||
+ G_VALUE_TYPE(rate) == G_TYPE_DOUBLE)
+ {
+ gint val = ghb_value_int(rate);
+ for (ii = 0; ii < ghb_audio_bitrates_count; ii++)
+ {
+ if (ghb_audio_bitrates[ii].rate == val)
+ {
+ result = ghb_audio_bitrates[ii].string;
+ break;
+ }
+ }
+ }
+ return result;
}
static gint
lookup_hb_encoder_int(const GValue *enc, hb_encoder_t *encoders, int len)
{
- gint ii;
-
- if (G_VALUE_TYPE(enc) == G_TYPE_STRING)
- {
- gchar *str = ghb_value_string(enc);
- for (ii = 0; ii < len; ii++)
- {
- if (strcmp(encoders[ii].human_readable_name, str) == 0 ||
- strcmp(encoders[ii].short_name, str) == 0)
- {
- g_free(str);
- return encoders[ii].encoder;
- }
- }
- g_free(str);
- }
- else if (G_VALUE_TYPE(enc) == G_TYPE_INT ||
- G_VALUE_TYPE(enc) == G_TYPE_INT64 ||
- G_VALUE_TYPE(enc) == G_TYPE_DOUBLE)
- {
- int val = ghb_value_int(enc);
- for (ii = 0; ii < len; ii++)
- {
- if (encoders[ii].encoder == val)
- {
- return encoders[ii].encoder;
- }
- }
- }
- return 0;
+ gint ii;
+
+ if (G_VALUE_TYPE(enc) == G_TYPE_STRING)
+ {
+ gchar *str = ghb_value_string(enc);
+ for (ii = 0; ii < len; ii++)
+ {
+ if (strcmp(encoders[ii].human_readable_name, str) == 0 ||
+ strcmp(encoders[ii].short_name, str) == 0)
+ {
+ g_free(str);
+ return encoders[ii].encoder;
+ }
+ }
+ g_free(str);
+ }
+ else if (G_VALUE_TYPE(enc) == G_TYPE_INT ||
+ G_VALUE_TYPE(enc) == G_TYPE_INT64 ||
+ G_VALUE_TYPE(enc) == G_TYPE_DOUBLE)
+ {
+ int val = ghb_value_int(enc);
+ for (ii = 0; ii < len; ii++)
+ {
+ if (encoders[ii].encoder == val)
+ {
+ return encoders[ii].encoder;
+ }
+ }
+ }
+ return 0;
}
static const gchar*
lookup_hb_encoder_option(const GValue *enc, hb_encoder_t *encoders, int len)
{
- gint ii;
-
- if (G_VALUE_TYPE(enc) == G_TYPE_STRING)
- {
- gchar *str = ghb_value_string(enc);
- for (ii = 0; ii < len; ii++)
- {
- if (strcmp(encoders[ii].human_readable_name, str) == 0 ||
- strcmp(encoders[ii].short_name, str) == 0)
- {
- g_free(str);
- return encoders[ii].human_readable_name;
- }
- }
- g_free(str);
- }
- else if (G_VALUE_TYPE(enc) == G_TYPE_INT ||
- G_VALUE_TYPE(enc) == G_TYPE_INT64 ||
- G_VALUE_TYPE(enc) == G_TYPE_DOUBLE)
- {
- int val = ghb_value_int(enc);
- for (ii = 0; ii < len; ii++)
- {
- if (encoders[ii].encoder == val)
- {
- return encoders[ii].human_readable_name;
- }
- }
- }
- return 0;
+ gint ii;
+
+ if (G_VALUE_TYPE(enc) == G_TYPE_STRING)
+ {
+ gchar *str = ghb_value_string(enc);
+ for (ii = 0; ii < len; ii++)
+ {
+ if (strcmp(encoders[ii].human_readable_name, str) == 0 ||
+ strcmp(encoders[ii].short_name, str) == 0)
+ {
+ g_free(str);
+ return encoders[ii].human_readable_name;
+ }
+ }
+ g_free(str);
+ }
+ else if (G_VALUE_TYPE(enc) == G_TYPE_INT ||
+ G_VALUE_TYPE(enc) == G_TYPE_INT64 ||
+ G_VALUE_TYPE(enc) == G_TYPE_DOUBLE)
+ {
+ int val = ghb_value_int(enc);
+ for (ii = 0; ii < len; ii++)
+ {
+ if (encoders[ii].encoder == val)
+ {
+ return encoders[ii].human_readable_name;
+ }
+ }
+ }
+ return 0;
}
static const gchar*
lookup_hb_encoder_string(const GValue *enc, hb_encoder_t *encoders, int len)
{
- gint ii;
-
- if (G_VALUE_TYPE(enc) == G_TYPE_STRING)
- {
- gchar *str = ghb_value_string(enc);
- for (ii = 0; ii < len; ii++)
- {
- if (strcmp(encoders[ii].human_readable_name, str) == 0 ||
- strcmp(encoders[ii].short_name, str) == 0)
- {
- g_free(str);
- return encoders[ii].short_name;
- }
- }
- g_free(str);
- }
- else if (G_VALUE_TYPE(enc) == G_TYPE_INT ||
- G_VALUE_TYPE(enc) == G_TYPE_INT64 ||
- G_VALUE_TYPE(enc) == G_TYPE_DOUBLE)
- {
- int val = ghb_value_int(enc);
- for (ii = 0; ii < len; ii++)
- {
- if (encoders[ii].encoder == val)
- {
- return encoders[ii].short_name;
- }
- }
- }
- return 0;
+ gint ii;
+
+ if (G_VALUE_TYPE(enc) == G_TYPE_STRING)
+ {
+ gchar *str = ghb_value_string(enc);
+ for (ii = 0; ii < len; ii++)
+ {
+ if (strcmp(encoders[ii].human_readable_name, str) == 0 ||
+ strcmp(encoders[ii].short_name, str) == 0)
+ {
+ g_free(str);
+ return encoders[ii].short_name;
+ }
+ }
+ g_free(str);
+ }
+ else if (G_VALUE_TYPE(enc) == G_TYPE_INT ||
+ G_VALUE_TYPE(enc) == G_TYPE_INT64 ||
+ G_VALUE_TYPE(enc) == G_TYPE_DOUBLE)
+ {
+ int val = ghb_value_int(enc);
+ for (ii = 0; ii < len; ii++)
+ {
+ if (encoders[ii].encoder == val)
+ {
+ return encoders[ii].short_name;
+ }
+ }
+ }
+ return 0;
}
static gint
lookup_audio_lang_int(const GValue *rate)
{
- gint ii;
- gchar *str;
- gint result = 0;
-
- // Coincidentally, the string "source" will return 0
- // which is our flag to use "same as source"
- str = ghb_value_string(rate);
- for (ii = 0; ii < LANG_TABLE_SIZE; ii++)
- {
- if (strcmp(ghb_language_table[ii].iso639_2, str) == 0)
- {
- result = ii;
- break;
- }
- }
- g_free(str);
- return result;
+ gint ii;
+ gchar *str;
+ gint result = 0;
+
+ // Coincidentally, the string "source" will return 0
+ // which is our flag to use "same as source"
+ str = ghb_value_string(rate);
+ for (ii = 0; ii < LANG_TABLE_SIZE; ii++)
+ {
+ if (strcmp(ghb_language_table[ii].iso639_2, str) == 0)
+ {
+ result = ii;
+ break;
+ }
+ }
+ g_free(str);
+ return result;
}
static const gchar*
lookup_audio_lang_option(const GValue *rate)
{
- gint ii;
- gchar *str;
- const gchar *result = "Same as source";
-
- // Coincidentally, the string "source" will return 0
- // which is our flag to use "same as source"
- str = ghb_value_string(rate);
- for (ii = 0; ii < LANG_TABLE_SIZE; ii++)
- {
- if (strcmp(ghb_language_table[ii].iso639_2, str) == 0)
- {
- if (ghb_language_table[ii].native_name[0] != 0)
- result = ghb_language_table[ii].native_name;
- else
- result = ghb_language_table[ii].eng_name;
- break;
- }
- }
- g_free(str);
- return result;
+ gint ii;
+ gchar *str;
+ const gchar *result = "Same as source";
+
+ // Coincidentally, the string "source" will return 0
+ // which is our flag to use "same as source"
+ str = ghb_value_string(rate);
+ for (ii = 0; ii < LANG_TABLE_SIZE; ii++)
+ {
+ if (strcmp(ghb_language_table[ii].iso639_2, str) == 0)
+ {
+ if (ghb_language_table[ii].native_name[0] != 0)
+ result = ghb_language_table[ii].native_name;
+ else
+ result = ghb_language_table[ii].eng_name;
+ break;
+ }
+ }
+ g_free(str);
+ return result;
}
GValue*
ghb_lookup_acodec_value(gint val)
{
- GValue *value = NULL;
- gint ii;
+ GValue *value = NULL;
+ gint ii;
- for (ii = 0; ii < hb_audio_encoders_count; ii++)
- {
- if ((int)hb_audio_encoders[ii].encoder == val)
- {
- value = ghb_string_value_new(hb_audio_encoders[ii].short_name);
- return value;
- }
- }
- value = ghb_string_value_new("copy");
- return value;
+ for (ii = 0; ii < hb_audio_encoders_count; ii++)
+ {
+ if ((int)hb_audio_encoders[ii].encoder == val)
+ {
+ value = ghb_string_value_new(hb_audio_encoders[ii].short_name);
+ return value;
+ }
+ }
+ value = ghb_string_value_new("copy");
+ return value;
}
static GValue*
get_amix_value(gint val)
{
- GValue *value = NULL;
- gint ii;
+ GValue *value = NULL;
+ gint ii;
- for (ii = 0; ii < hb_audio_mixdowns_count; ii++)
- {
- if (hb_audio_mixdowns[ii].amixdown == val)
- {
- value = ghb_string_value_new(hb_audio_mixdowns[ii].short_name);
- break;
- }
- }
- return value;
+ for (ii = 0; ii < hb_audio_mixdowns_count; ii++)
+ {
+ if (hb_audio_mixdowns[ii].amixdown == val)
+ {
+ value = ghb_string_value_new(hb_audio_mixdowns[ii].short_name);
+ break;
+ }
+ }
+ return value;
}
// Handle for libhb. Gets set by ghb_backend_init()
@@ -1376,156 +1376,156 @@ extern void hb_get_temporary_directory(char path[512]);
gchar*
ghb_get_tmp_dir()
{
- char dir[512];
+ char dir[512];
- hb_get_temporary_directory(dir);
- return g_strdup(dir);
+ hb_get_temporary_directory(dir);
+ return g_strdup(dir);
}
void
ghb_hb_cleanup(gboolean partial)
{
- char dir[512];
+ char dir[512];
- hb_get_temporary_directory(dir);
- del_tree(dir, !partial);
+ hb_get_temporary_directory(dir);
+ del_tree(dir, !partial);
}
gint
ghb_subtitle_track_source(GValue *settings, gint track)
{
- gint titleindex;
-
- if (track == -2)
- return SRTSUB;
- if (track < 0)
- return VOBSUB;
- titleindex = ghb_settings_combo_int(settings, "title");
- if (titleindex < 0)
- return VOBSUB;
-
- hb_title_t * title;
- hb_subtitle_t * sub;
-
- if (h_scan == NULL) return VOBSUB;
- title = ghb_get_title_info( titleindex );
- if (title == NULL) return VOBSUB; // Bad titleindex
- sub = hb_list_item( title->list_subtitle, track);
- if (sub != NULL)
- return sub->source;
- else
- return VOBSUB;
+ gint titleindex;
+
+ if (track == -2)
+ return SRTSUB;
+ if (track < 0)
+ return VOBSUB;
+ titleindex = ghb_settings_combo_int(settings, "title");
+ if (titleindex < 0)
+ return VOBSUB;
+
+ hb_title_t * title;
+ hb_subtitle_t * sub;
+
+ if (h_scan == NULL) return VOBSUB;
+ title = ghb_get_title_info( titleindex );
+ if (title == NULL) return VOBSUB; // Bad titleindex
+ sub = hb_list_item( title->list_subtitle, track);
+ if (sub != NULL)
+ return sub->source;
+ else
+ return VOBSUB;
}
const char*
ghb_subtitle_track_source_name(GValue *settings, gint track)
{
- gint titleindex;
- const gchar * name = "Unknown";
-
- if (track == -2)
- {
- name = "SRT";
- goto done;
- }
- if (track == -1)
- {
- name = "Bitmap";
- goto done;
- }
-
- titleindex = ghb_settings_combo_int(settings, "title");
- if (titleindex < 0)
- goto done;
-
- hb_title_t * title;
- hb_subtitle_t * sub;
-
- title = ghb_get_title_info( titleindex );
- if (title == NULL)
- goto done;
-
- sub = hb_list_item( title->list_subtitle, track);
- if (sub != NULL)
- {
- name = hb_subsource_name(sub->source);
- }
+ gint titleindex;
+ const gchar * name = "Unknown";
+
+ if (track == -2)
+ {
+ name = "SRT";
+ goto done;
+ }
+ if (track == -1)
+ {
+ name = "Bitmap";
+ goto done;
+ }
+
+ titleindex = ghb_settings_combo_int(settings, "title");
+ if (titleindex < 0)
+ goto done;
+
+ hb_title_t * title;
+ hb_subtitle_t * sub;
+
+ title = ghb_get_title_info( titleindex );
+ if (title == NULL)
+ goto done;
+
+ sub = hb_list_item( title->list_subtitle, track);
+ if (sub != NULL)
+ {
+ name = hb_subsource_name(sub->source);
+ }
done:
- return name;
+ return name;
}
const gchar*
ghb_subtitle_track_lang(GValue *settings, gint track)
{
- gint titleindex;
-
- titleindex = ghb_settings_combo_int(settings, "title");
- if (titleindex < 0)
- goto fail;
- if (track == -1)
- return ghb_get_user_audio_lang(settings, titleindex, 0);
- if (track < 0)
- goto fail;
-
- hb_title_t * title;
- hb_subtitle_t * sub;
-
- title = ghb_get_title_info( titleindex );
- if (title == NULL) // Bad titleindex
- goto fail;
- sub = hb_list_item( title->list_subtitle, track);
- if (sub != NULL)
- return sub->iso639_2;
+ gint titleindex;
+
+ titleindex = ghb_settings_combo_int(settings, "title");
+ if (titleindex < 0)
+ goto fail;
+ if (track == -1)
+ return ghb_get_user_audio_lang(settings, titleindex, 0);
+ if (track < 0)
+ goto fail;
+
+ hb_title_t * title;
+ hb_subtitle_t * sub;
+
+ title = ghb_get_title_info( titleindex );
+ if (title == NULL) // Bad titleindex
+ goto fail;
+ sub = hb_list_item( title->list_subtitle, track);
+ if (sub != NULL)
+ return sub->iso639_2;
fail:
- return "und";
+ return "und";
}
gint
ghb_get_title_number(gint titleindex)
{
- hb_title_t * title;
-
- title = ghb_get_title_info( titleindex );
- if (title == NULL) return 1; // Bad titleindex
- return title->index;
+ hb_title_t * title;
+
+ title = ghb_get_title_info( titleindex );
+ if (title == NULL) return 1; // Bad titleindex
+ return title->index;
}
static hb_audio_config_t*
get_hb_audio(hb_handle_t *h, gint titleindex, gint track)
{
- hb_list_t * list;
- hb_title_t * title;
+ hb_list_t * list;
+ hb_title_t * title;
hb_audio_config_t *audio = NULL;
-
+
if (h == NULL) return NULL;
- list = hb_get_titles( h );
- if( !hb_list_count( list ) )
- {
- /* No valid title, stop right there */
- return NULL;
- }
+ list = hb_get_titles( h );
+ if( !hb_list_count( list ) )
+ {
+ /* No valid title, stop right there */
+ return NULL;
+ }
title = hb_list_item( list, titleindex );
- if (title == NULL) return NULL; // Bad titleindex
- if (!hb_list_count(title->list_audio))
- {
- return NULL;
- }
+ if (title == NULL) return NULL; // Bad titleindex
+ if (!hb_list_count(title->list_audio))
+ {
+ return NULL;
+ }
audio = (hb_audio_config_t *)hb_list_audio_config_item(title->list_audio, track);
- return audio;
+ return audio;
}
static gint
search_rates(hb_rate_t *rates, gint rate, gint count)
{
- gint ii;
- for (ii = 0; ii < count; ii++)
- {
- if (rates[ii].rate == rate)
- return ii;
- }
- return -1;
+ gint ii;
+ for (ii = 0; ii < count; ii++)
+ {
+ if (rates[ii].rate == rate)
+ return ii;
+ }
+ return -1;
}
static gboolean find_combo_item_by_int(GtkTreeModel *store, gint value, GtkTreeIter *iter);
@@ -1533,394 +1533,394 @@ static gboolean find_combo_item_by_int(GtkTreeModel *store, gint value, GtkTreeI
static GtkListStore*
get_combo_box_store(GtkBuilder *builder, const gchar *name)
{
- GtkComboBox *combo;
- GtkListStore *store;
+ GtkComboBox *combo;
+ GtkListStore *store;
- g_debug("get_combo_box_store() %s\n", name);
- // First modify the combobox model to allow greying out of options
- combo = GTK_COMBO_BOX(GHB_WIDGET(builder, name));
- store = GTK_LIST_STORE(gtk_combo_box_get_model (combo));
- return store;
+ g_debug("get_combo_box_store() %s\n", name);
+ // First modify the combobox model to allow greying out of options
+ combo = GTK_COMBO_BOX(GHB_WIDGET(builder, name));
+ store = GTK_LIST_STORE(gtk_combo_box_get_model (combo));
+ return store;
}
static void
grey_combo_box_item(GtkBuilder *builder, const gchar *name, gint value, gboolean grey)
{
- GtkListStore *store;
- GtkTreeIter iter;
-
- store = get_combo_box_store(builder, name);
- if (find_combo_item_by_int(GTK_TREE_MODEL(store), value, &iter))
- {
- gtk_list_store_set(store, &iter,
- 1, !grey,
- -1);
- }
+ GtkListStore *store;
+ GtkTreeIter iter;
+
+ store = get_combo_box_store(builder, name);
+ if (find_combo_item_by_int(GTK_TREE_MODEL(store), value, &iter))
+ {
+ gtk_list_store_set(store, &iter,
+ 1, !grey,
+ -1);
+ }
}
static void
grey_mix_opts(signal_user_data_t *ud, gint acodec, gint64 layout)
{
- gint ii;
-
- g_debug("grey_mix_opts()\n");
- for (ii = 0; ii < hb_audio_mixdowns_count; ii++)
- {
- grey_combo_box_item(ud->builder, "AudioMixdown",
- hb_audio_mixdowns[ii].amixdown,
- !hb_mixdown_is_supported(hb_audio_mixdowns[ii].amixdown,
- acodec, layout));
- }
+ gint ii;
+
+ g_debug("grey_mix_opts()\n");
+ for (ii = 0; ii < hb_audio_mixdowns_count; ii++)
+ {
+ grey_combo_box_item(ud->builder, "AudioMixdown",
+ hb_audio_mixdowns[ii].amixdown,
+ !hb_mixdown_is_supported(hb_audio_mixdowns[ii].amixdown,
+ acodec, layout));
+ }
}
void
ghb_grey_combo_options(signal_user_data_t *ud)
{
- GtkWidget *widget;
- gint mux, track, titleindex, acodec, fallback;
- hb_audio_config_t *aconfig = NULL;
- GValue *gval;
- int ii;
-
- widget = GHB_WIDGET (ud->builder, "title");
- gval = ghb_widget_value(widget);
- titleindex = ghb_lookup_combo_int("title", gval);
- ghb_value_free(gval);
- widget = GHB_WIDGET (ud->builder, "AudioTrack");
- gval = ghb_widget_value(widget);
- track = ghb_lookup_combo_int("AudioTrack", gval);
- ghb_value_free(gval);
- aconfig = get_hb_audio(h_scan, titleindex, track);
- widget = GHB_WIDGET (ud->builder, "FileFormat");
- gval = ghb_widget_value(widget);
- mux = ghb_lookup_combo_int("FileFormat", gval);
- ghb_value_free(gval);
-
- grey_combo_box_item(ud->builder, "x264_analyse", 4, TRUE);
- for (ii = 0; ii < hb_audio_encoders_count; ii++)
- {
- if (!(mux & hb_audio_encoders[ii].muxers))
- {
- grey_combo_box_item(ud->builder, "AudioEncoder",
- hb_audio_encoders[ii].encoder, TRUE);
- grey_combo_box_item(ud->builder, "AudioEncoderFallback",
- hb_audio_encoders[ii].encoder, TRUE);
- }
+ GtkWidget *widget;
+ gint mux, track, titleindex, acodec, fallback;
+ hb_audio_config_t *aconfig = NULL;
+ GValue *gval;
+ int ii;
+
+ widget = GHB_WIDGET (ud->builder, "title");
+ gval = ghb_widget_value(widget);
+ titleindex = ghb_lookup_combo_int("title", gval);
+ ghb_value_free(gval);
+ widget = GHB_WIDGET (ud->builder, "AudioTrack");
+ gval = ghb_widget_value(widget);
+ track = ghb_lookup_combo_int("AudioTrack", gval);
+ ghb_value_free(gval);
+ aconfig = get_hb_audio(h_scan, titleindex, track);
+ widget = GHB_WIDGET (ud->builder, "FileFormat");
+ gval = ghb_widget_value(widget);
+ mux = ghb_lookup_combo_int("FileFormat", gval);
+ ghb_value_free(gval);
+
+ grey_combo_box_item(ud->builder, "x264_analyse", 4, TRUE);
+ for (ii = 0; ii < hb_audio_encoders_count; ii++)
+ {
+ if (!(mux & hb_audio_encoders[ii].muxers))
+ {
+ grey_combo_box_item(ud->builder, "AudioEncoder",
+ hb_audio_encoders[ii].encoder, TRUE);
+ grey_combo_box_item(ud->builder, "AudioEncoderFallback",
+ hb_audio_encoders[ii].encoder, TRUE);
+ }
else
{
- grey_combo_box_item(ud->builder, "AudioEncoder",
- hb_audio_encoders[ii].encoder, FALSE);
- grey_combo_box_item(ud->builder, "AudioEncoderFallback",
- hb_audio_encoders[ii].encoder, FALSE);
+ grey_combo_box_item(ud->builder, "AudioEncoder",
+ hb_audio_encoders[ii].encoder, FALSE);
+ grey_combo_box_item(ud->builder, "AudioEncoderFallback",
+ hb_audio_encoders[ii].encoder, FALSE);
+ }
+ }
+ for (ii = 0; ii < hb_video_encoders_count; ii++)
+ {
+ if (!(mux & hb_video_encoders[ii].muxers))
+ {
+ grey_combo_box_item(ud->builder, "VideoEncoder",
+ hb_video_encoders[ii].encoder, TRUE);
}
- }
- for (ii = 0; ii < hb_video_encoders_count; ii++)
- {
- if (!(mux & hb_video_encoders[ii].muxers))
- {
- grey_combo_box_item(ud->builder, "VideoEncoder",
- hb_video_encoders[ii].encoder, TRUE);
- }
else
- {
- grey_combo_box_item(ud->builder, "VideoEncoder",
- hb_video_encoders[ii].encoder, FALSE);
- }
- }
-
- if (aconfig && (aconfig->in.codec & HB_ACODEC_MASK) != HB_ACODEC_MP3)
- {
- grey_combo_box_item(ud->builder, "AudioEncoder", HB_ACODEC_MP3_PASS, TRUE);
- }
- if (aconfig && (aconfig->in.codec & HB_ACODEC_MASK) != HB_ACODEC_FFAAC)
- {
- grey_combo_box_item(ud->builder, "AudioEncoder", HB_ACODEC_AAC_PASS, TRUE);
- }
- if (aconfig && (aconfig->in.codec & HB_ACODEC_MASK) != HB_ACODEC_AC3)
- {
- grey_combo_box_item(ud->builder, "AudioEncoder", HB_ACODEC_AC3_PASS, TRUE);
- }
- if (aconfig && (aconfig->in.codec & HB_ACODEC_MASK) != HB_ACODEC_DCA)
- {
- grey_combo_box_item(ud->builder, "AudioEncoder", HB_ACODEC_DCA_PASS, TRUE);
- }
- if (aconfig && (aconfig->in.codec & HB_ACODEC_MASK) != HB_ACODEC_DCA_HD)
- {
- grey_combo_box_item(ud->builder, "AudioEncoder", HB_ACODEC_DCA_HD_PASS, TRUE);
- }
-
- widget = GHB_WIDGET (ud->builder, "AudioEncoder");
- gval = ghb_widget_value(widget);
- acodec = ghb_lookup_combo_int("AudioEncoder", gval);
- ghb_value_free(gval);
-
- gint64 layout = aconfig != NULL ? aconfig->in.channel_layout : ~0;
- fallback = ghb_select_fallback(ud->settings, mux, acodec);
- gint copy_mask = ghb_get_copy_mask(ud->settings);
- acodec = ghb_select_audio_codec(mux, aconfig, acodec, fallback, copy_mask);
- grey_mix_opts(ud, acodec, layout);
+ {
+ grey_combo_box_item(ud->builder, "VideoEncoder",
+ hb_video_encoders[ii].encoder, FALSE);
+ }
+ }
+
+ if (aconfig && (aconfig->in.codec & HB_ACODEC_MASK) != HB_ACODEC_MP3)
+ {
+ grey_combo_box_item(ud->builder, "AudioEncoder", HB_ACODEC_MP3_PASS, TRUE);
+ }
+ if (aconfig && (aconfig->in.codec & HB_ACODEC_MASK) != HB_ACODEC_FFAAC)
+ {
+ grey_combo_box_item(ud->builder, "AudioEncoder", HB_ACODEC_AAC_PASS, TRUE);
+ }
+ if (aconfig && (aconfig->in.codec & HB_ACODEC_MASK) != HB_ACODEC_AC3)
+ {
+ grey_combo_box_item(ud->builder, "AudioEncoder", HB_ACODEC_AC3_PASS, TRUE);
+ }
+ if (aconfig && (aconfig->in.codec & HB_ACODEC_MASK) != HB_ACODEC_DCA)
+ {
+ grey_combo_box_item(ud->builder, "AudioEncoder", HB_ACODEC_DCA_PASS, TRUE);
+ }
+ if (aconfig && (aconfig->in.codec & HB_ACODEC_MASK) != HB_ACODEC_DCA_HD)
+ {
+ grey_combo_box_item(ud->builder, "AudioEncoder", HB_ACODEC_DCA_HD_PASS, TRUE);
+ }
+
+ widget = GHB_WIDGET (ud->builder, "AudioEncoder");
+ gval = ghb_widget_value(widget);
+ acodec = ghb_lookup_combo_int("AudioEncoder", gval);
+ ghb_value_free(gval);
+
+ gint64 layout = aconfig != NULL ? aconfig->in.channel_layout : ~0;
+ fallback = ghb_select_fallback(ud->settings, mux, acodec);
+ gint copy_mask = ghb_get_copy_mask(ud->settings);
+ acodec = ghb_select_audio_codec(mux, aconfig, acodec, fallback, copy_mask);
+ grey_mix_opts(ud, acodec, layout);
}
gint
ghb_get_best_mix(hb_audio_config_t *aconfig, gint acodec, gint mix)
{
- gint layout;
- layout = aconfig ? aconfig->in.channel_layout : AV_CH_LAYOUT_5POINT1;
- return hb_get_best_mixdown( acodec, layout, mix );
+ gint layout;
+ layout = aconfig ? aconfig->in.channel_layout : AV_CH_LAYOUT_5POINT1;
+ return hb_get_best_mixdown( acodec, layout, mix );
}
// Set up the model for the combo box
static void
init_combo_box(GtkBuilder *builder, const gchar *name)
{
- GtkComboBox *combo;
- GtkListStore *store;
- GtkCellRenderer *cell;
-
- g_debug("init_combo_box() %s\n", name);
- // First modify the combobox model to allow greying out of options
- combo = GTK_COMBO_BOX(GHB_WIDGET(builder, name));
- if (combo == NULL)
- return;
- // Store contains:
- // 1 - String to display
- // 2 - bool indicating whether the entry is selectable (grey or not)
- // 3 - String that is used for presets
- // 4 - Int value determined by backend
- // 5 - String value determined by backend
- store = gtk_list_store_new(5, G_TYPE_STRING, G_TYPE_BOOLEAN,
- G_TYPE_STRING, G_TYPE_DOUBLE, G_TYPE_STRING);
- gtk_combo_box_set_model(combo, GTK_TREE_MODEL(store));
-
- if (G_OBJECT_TYPE(combo) == GTK_TYPE_COMBO_BOX)
- {
- gtk_cell_layout_clear(GTK_CELL_LAYOUT(combo));
- cell = GTK_CELL_RENDERER(gtk_cell_renderer_text_new());
- gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(combo), cell, TRUE);
- gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(combo), cell,
- "markup", 0, "sensitive", 1, NULL);
- }
- else
- { // Combo box entry
- gtk_combo_box_entry_set_text_column(GTK_COMBO_BOX_ENTRY(combo), 0);
- }
-}
+ GtkComboBox *combo;
+ GtkListStore *store;
+ GtkCellRenderer *cell;
+
+ g_debug("init_combo_box() %s\n", name);
+ // First modify the combobox model to allow greying out of options
+ combo = GTK_COMBO_BOX(GHB_WIDGET(builder, name));
+ if (combo == NULL)
+ return;
+ // Store contains:
+ // 1 - String to display
+ // 2 - bool indicating whether the entry is selectable (grey or not)
+ // 3 - String that is used for presets
+ // 4 - Int value determined by backend
+ // 5 - String value determined by backend
+ store = gtk_list_store_new(5, G_TYPE_STRING, G_TYPE_BOOLEAN,
+ G_TYPE_STRING, G_TYPE_DOUBLE, G_TYPE_STRING);
+ gtk_combo_box_set_model(combo, GTK_TREE_MODEL(store));
+
+ if (G_OBJECT_TYPE(combo) == GTK_TYPE_COMBO_BOX)
+ {
+ gtk_cell_layout_clear(GTK_CELL_LAYOUT(combo));
+ cell = GTK_CELL_RENDERER(gtk_cell_renderer_text_new());
+ gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(combo), cell, TRUE);
+ gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(combo), cell,
+ "markup", 0, "sensitive", 1, NULL);
+ }
+ else
+ { // Combo box entry
+ gtk_combo_box_entry_set_text_column(GTK_COMBO_BOX_ENTRY(combo), 0);
+ }
+}
static void
audio_samplerate_opts_set(GtkBuilder *builder, const gchar *name, hb_rate_t *rates, gint count)
{
- GtkTreeIter iter;
- GtkListStore *store;
- gint ii;
- gchar *str;
-
- g_debug("audio_samplerate_opts_set ()\n");
- store = get_combo_box_store(builder, name);
- gtk_list_store_clear(store);
- // Add an item for "Same As Source"
- gtk_list_store_append(store, &iter);
- gtk_list_store_set(store, &iter,
- 0, "<small>Same as source</small>",
- 1, TRUE,
- 2, "source",
- 3, 0.0,
- 4, "source",
- -1);
- for (ii = 0; ii < count; ii++)
- {
- gtk_list_store_append(store, &iter);
- str = g_strdup_printf("<small>%s</small>", rates[ii].string);
- gtk_list_store_set(store, &iter,
- 0, str,
- 1, TRUE,
- 2, rates[ii].string,
- 3, (gdouble)rates[ii].rate,
- 4, rates[ii].string,
- -1);
- g_free(str);
- }
+ GtkTreeIter iter;
+ GtkListStore *store;
+ gint ii;
+ gchar *str;
+
+ g_debug("audio_samplerate_opts_set ()\n");
+ store = get_combo_box_store(builder, name);
+ gtk_list_store_clear(store);
+ // Add an item for "Same As Source"
+ gtk_list_store_append(store, &iter);
+ gtk_list_store_set(store, &iter,
+ 0, "<small>Same as source</small>",
+ 1, TRUE,
+ 2, "source",
+ 3, 0.0,
+ 4, "source",
+ -1);
+ for (ii = 0; ii < count; ii++)
+ {
+ gtk_list_store_append(store, &iter);
+ str = g_strdup_printf("<small>%s</small>", rates[ii].string);
+ gtk_list_store_set(store, &iter,
+ 0, str,
+ 1, TRUE,
+ 2, rates[ii].string,
+ 3, (gdouble)rates[ii].rate,
+ 4, rates[ii].string,
+ -1);
+ g_free(str);
+ }
}
static void
video_rate_opts_set(GtkBuilder *builder, const gchar *name, hb_rate_t *rates, gint count)
{
- GtkTreeIter iter;
- GtkListStore *store;
- gint ii;
-
- g_debug("video_rate_opts_set ()\n");
- store = get_combo_box_store(builder, name);
- gtk_list_store_clear(store);
- // Add an item for "Same As Source"
- gtk_list_store_append(store, &iter);
- gtk_list_store_set(store, &iter,
- 0, "Same as source",
- 1, TRUE,
- 2, "source",
- 3, 0.0,
- 4, "source",
- -1);
- for (ii = 0; ii < count; ii++)
- {
- gchar *desc = "";
- gchar *option;
- if (strcmp(rates[ii].string, "23.976") == 0)
- {
- desc = "(NTSC Film)";
- }
- else if (strcmp(rates[ii].string, "25") == 0)
- {
- desc = "(PAL Film/Video)";
- }
- else if (strcmp(rates[ii].string, "29.97") == 0)
- {
- desc = "(NTSC Video)";
- }
- option = g_strdup_printf ("%s %s", rates[ii].string, desc);
- gtk_list_store_append(store, &iter);
- gtk_list_store_set(store, &iter,
- 0, option,
- 1, TRUE,
- 2, rates[ii].string,
- 3, (gdouble)rates[ii].rate,
- 4, rates[ii].string,
- -1);
- g_free(option);
- }
+ GtkTreeIter iter;
+ GtkListStore *store;
+ gint ii;
+
+ g_debug("video_rate_opts_set ()\n");
+ store = get_combo_box_store(builder, name);
+ gtk_list_store_clear(store);
+ // Add an item for "Same As Source"
+ gtk_list_store_append(store, &iter);
+ gtk_list_store_set(store, &iter,
+ 0, "Same as source",
+ 1, TRUE,
+ 2, "source",
+ 3, 0.0,
+ 4, "source",
+ -1);
+ for (ii = 0; ii < count; ii++)
+ {
+ gchar *desc = "";
+ gchar *option;
+ if (strcmp(rates[ii].string, "23.976") == 0)
+ {
+ desc = "(NTSC Film)";
+ }
+ else if (strcmp(rates[ii].string, "25") == 0)
+ {
+ desc = "(PAL Film/Video)";
+ }
+ else if (strcmp(rates[ii].string, "29.97") == 0)
+ {
+ desc = "(NTSC Video)";
+ }
+ option = g_strdup_printf ("%s %s", rates[ii].string, desc);
+ gtk_list_store_append(store, &iter);
+ gtk_list_store_set(store, &iter,
+ 0, option,
+ 1, TRUE,
+ 2, rates[ii].string,
+ 3, (gdouble)rates[ii].rate,
+ 4, rates[ii].string,
+ -1);
+ g_free(option);
+ }
}
static void
hb_encoder_opts_set_with_mask(
- GtkBuilder *builder,
- const gchar *name,
- hb_encoder_t *encoders,
- int len,
- int mask,
- int neg_mask)
-{
- GtkTreeIter iter;
- GtkListStore *store;
- gint ii;
- gchar *str;
-
- g_debug("hb_encoder_opts_set ()\n");
- store = get_combo_box_store(builder, name);
- gtk_list_store_clear(store);
- for (ii = 0; ii < len; ii++)
- {
- if ((mask & encoders[ii].encoder) &&
- !(neg_mask & encoders[ii].encoder))
- {
- gtk_list_store_append(store, &iter);
- str = g_strdup_printf("<small>%s</small>",
- encoders[ii].human_readable_name);
- gtk_list_store_set(store, &iter,
- 0, str,
- 1, TRUE,
- 2, encoders[ii].short_name,
- 3, (gdouble)encoders[ii].encoder,
- 4, encoders[ii].short_name,
- -1);
- g_free(str);
- }
- }
+ GtkBuilder *builder,
+ const gchar *name,
+ hb_encoder_t *encoders,
+ int len,
+ int mask,
+ int neg_mask)
+{
+ GtkTreeIter iter;
+ GtkListStore *store;
+ gint ii;
+ gchar *str;
+
+ g_debug("hb_encoder_opts_set ()\n");
+ store = get_combo_box_store(builder, name);
+ gtk_list_store_clear(store);
+ for (ii = 0; ii < len; ii++)
+ {
+ if ((mask & encoders[ii].encoder) &&
+ !(neg_mask & encoders[ii].encoder))
+ {
+ gtk_list_store_append(store, &iter);
+ str = g_strdup_printf("<small>%s</small>",
+ encoders[ii].human_readable_name);
+ gtk_list_store_set(store, &iter,
+ 0, str,
+ 1, TRUE,
+ 2, encoders[ii].short_name,
+ 3, (gdouble)encoders[ii].encoder,
+ 4, encoders[ii].short_name,
+ -1);
+ g_free(str);
+ }
+ }
}
static void
hb_encoder_opts_set(
- GtkBuilder *builder,
- const gchar *name,
- hb_encoder_t *encoders,
- int len)
+ GtkBuilder *builder,
+ const gchar *name,
+ hb_encoder_t *encoders,
+ int len)
{
- hb_encoder_opts_set_with_mask(builder, name, encoders, len, ~0, 0);
+ hb_encoder_opts_set_with_mask(builder, name, encoders, len, ~0, 0);
}
static void
acodec_fallback_opts_set(GtkBuilder *builder, const gchar *name)
{
- hb_encoder_opts_set_with_mask(builder, name, hb_audio_encoders,
- hb_audio_encoders_count, ~0, HB_ACODEC_PASS_FLAG);
+ hb_encoder_opts_set_with_mask(builder, name, hb_audio_encoders,
+ hb_audio_encoders_count, ~0, HB_ACODEC_PASS_FLAG);
}
static void
mix_opts_set(GtkBuilder *builder, const gchar *name)
{
- GtkTreeIter iter;
- GtkListStore *store;
- gint ii;
- gchar *str;
-
- g_debug("mix_opts_set ()\n");
- store = get_combo_box_store(builder, name);
- gtk_list_store_clear(store);
- for (ii = 0; ii < hb_audio_mixdowns_count; ii++)
- {
- gtk_list_store_append(store, &iter);
- str = g_strdup_printf("<small>%s</small>",
- hb_audio_mixdowns[ii].human_readable_name);
- gtk_list_store_set(store, &iter,
- 0, str,
- 1, TRUE,
- 2, hb_audio_mixdowns[ii].short_name,
- 3, (gdouble)hb_audio_mixdowns[ii].amixdown,
- 4, hb_audio_mixdowns[ii].internal_name,
- -1);
- g_free(str);
- }
+ GtkTreeIter iter;
+ GtkListStore *store;
+ gint ii;
+ gchar *str;
+
+ g_debug("mix_opts_set ()\n");
+ store = get_combo_box_store(builder, name);
+ gtk_list_store_clear(store);
+ for (ii = 0; ii < hb_audio_mixdowns_count; ii++)
+ {
+ gtk_list_store_append(store, &iter);
+ str = g_strdup_printf("<small>%s</small>",
+ hb_audio_mixdowns[ii].human_readable_name);
+ gtk_list_store_set(store, &iter,
+ 0, str,
+ 1, TRUE,
+ 2, hb_audio_mixdowns[ii].short_name,
+ 3, (gdouble)hb_audio_mixdowns[ii].amixdown,
+ 4, hb_audio_mixdowns[ii].internal_name,
+ -1);
+ g_free(str);
+ }
}
static void
srt_codeset_opts_set(GtkBuilder *builder, const gchar *name)
{
- GtkTreeIter iter;
- GtkListStore *store;
- gint ii;
-
- g_debug("srt_codeset_opts_set ()\n");
- store = get_combo_box_store(builder, name);
- gtk_list_store_clear(store);
- for (ii = 0; ii < SRT_TABLE_SIZE; ii++)
- {
- gtk_list_store_append(store, &iter);
- gtk_list_store_set(store, &iter,
- 0, srt_codeset_table[ii],
- 1, TRUE,
- 2, srt_codeset_table[ii],
- 3, (gdouble)ii,
- 4, srt_codeset_table[ii],
- -1);
- }
+ GtkTreeIter iter;
+ GtkListStore *store;
+ gint ii;
+
+ g_debug("srt_codeset_opts_set ()\n");
+ store = get_combo_box_store(builder, name);
+ gtk_list_store_clear(store);
+ for (ii = 0; ii < SRT_TABLE_SIZE; ii++)
+ {
+ gtk_list_store_append(store, &iter);
+ gtk_list_store_set(store, &iter,
+ 0, srt_codeset_table[ii],
+ 1, TRUE,
+ 2, srt_codeset_table[ii],
+ 3, (gdouble)ii,
+ 4, srt_codeset_table[ii],
+ -1);
+ }
}
static void
language_opts_set(GtkBuilder *builder, const gchar *name)
{
- GtkTreeIter iter;
- GtkListStore *store;
- gint ii;
-
- g_debug("language_opts_set ()\n");
- store = get_combo_box_store(builder, name);
- gtk_list_store_clear(store);
- for (ii = 0; ii < LANG_TABLE_SIZE; ii++)
- {
- const gchar *lang;
-
- if (ghb_language_table[ii].native_name[0] != 0)
- lang = ghb_language_table[ii].native_name;
- else
- lang = ghb_language_table[ii].eng_name;
-
- gtk_list_store_append(store, &iter);
- gtk_list_store_set(store, &iter,
- 0, lang,
- 1, TRUE,
- 2, ghb_language_table[ii].iso639_2,
- 3, (gdouble)ii,
- 4, ghb_language_table[ii].iso639_1,
- -1);
- }
+ GtkTreeIter iter;
+ GtkListStore *store;
+ gint ii;
+
+ g_debug("language_opts_set ()\n");
+ store = get_combo_box_store(builder, name);
+ gtk_list_store_clear(store);
+ for (ii = 0; ii < LANG_TABLE_SIZE; ii++)
+ {
+ const gchar *lang;
+
+ if (ghb_language_table[ii].native_name[0] != 0)
+ lang = ghb_language_table[ii].native_name;
+ else
+ lang = ghb_language_table[ii].eng_name;
+
+ gtk_list_store_append(store, &iter);
+ gtk_list_store_set(store, &iter,
+ 0, lang,
+ 1, TRUE,
+ 2, ghb_language_table[ii].iso639_2,
+ 3, (gdouble)ii,
+ 4, ghb_language_table[ii].iso639_1,
+ -1);
+ }
}
static gchar **titles = NULL;
@@ -1928,116 +1928,116 @@ static gchar **titles = NULL;
void
title_opts_set(GtkBuilder *builder, const gchar *name)
{
- GtkTreeIter iter;
- GtkListStore *store;
- hb_list_t * list = NULL;
- hb_title_t * title = NULL;
- gint ii;
- gint count = 0;
-
- g_debug("title_opts_set ()\n");
- store = get_combo_box_store(builder, name);
- gtk_list_store_clear(store);
- if (h_scan != NULL)
- {
- list = hb_get_titles( h_scan );
- count = hb_list_count( list );
- }
- if (titles) g_strfreev(titles);
- if (title_opts.map) g_free(title_opts.map);
- if (count > 0)
- {
- title_opts.count = count;
- title_opts.map = g_malloc(count*sizeof(options_map_t));
- titles = g_malloc((count+1) * sizeof(gchar*));
- }
- else
- {
- title_opts.count = 1;
- title_opts.map = g_malloc(sizeof(options_map_t));
- titles = NULL;
- }
- if( count <= 0 )
- {
- // No titles. Fill in a default.
- gtk_list_store_append(store, &iter);
- gtk_list_store_set(store, &iter,
- 0, "No Titles",
- 1, TRUE,
- 2, "none",
- 3, -1.0,
- 4, "none",
- -1);
- title_opts.map[0].option = "No Titles";
- title_opts.map[0].shortOpt = "none";
- title_opts.map[0].ivalue = -1;
- title_opts.map[0].svalue = "none";
- return;
- }
- for (ii = 0; ii < count; ii++)
- {
- title = (hb_title_t*)hb_list_item(list, ii);
- if (title->type == HB_STREAM_TYPE || title->type == HB_FF_STREAM_TYPE)
- {
- if (title->duration != 0)
- {
+ GtkTreeIter iter;
+ GtkListStore *store;
+ hb_list_t * list = NULL;
+ hb_title_t * title = NULL;
+ gint ii;
+ gint count = 0;
+
+ g_debug("title_opts_set ()\n");
+ store = get_combo_box_store(builder, name);
+ gtk_list_store_clear(store);
+ if (h_scan != NULL)
+ {
+ list = hb_get_titles( h_scan );
+ count = hb_list_count( list );
+ }
+ if (titles) g_strfreev(titles);
+ if (title_opts.map) g_free(title_opts.map);
+ if (count > 0)
+ {
+ title_opts.count = count;
+ title_opts.map = g_malloc(count*sizeof(options_map_t));
+ titles = g_malloc((count+1) * sizeof(gchar*));
+ }
+ else
+ {
+ title_opts.count = 1;
+ title_opts.map = g_malloc(sizeof(options_map_t));
+ titles = NULL;
+ }
+ if( count <= 0 )
+ {
+ // No titles. Fill in a default.
+ gtk_list_store_append(store, &iter);
+ gtk_list_store_set(store, &iter,
+ 0, "No Titles",
+ 1, TRUE,
+ 2, "none",
+ 3, -1.0,
+ 4, "none",
+ -1);
+ title_opts.map[0].option = "No Titles";
+ title_opts.map[0].shortOpt = "none";
+ title_opts.map[0].ivalue = -1;
+ title_opts.map[0].svalue = "none";
+ return;
+ }
+ for (ii = 0; ii < count; ii++)
+ {
+ title = (hb_title_t*)hb_list_item(list, ii);
+ if (title->type == HB_STREAM_TYPE || title->type == HB_FF_STREAM_TYPE)
+ {
+ if (title->duration != 0)
+ {
char *tmp;
- tmp = g_strdup_printf ("%d - %02dh%02dm%02ds - %s",
- title->index, title->hours, title->minutes, title->seconds,
- title->name);
+ tmp = g_strdup_printf ("%d - %02dh%02dm%02ds - %s",
+ title->index, title->hours, title->minutes, title->seconds,
+ title->name);
titles[ii] = g_markup_escape_text(tmp, -1);
g_free(tmp);
- }
- else
- {
+ }
+ else
+ {
char *tmp;
- tmp = g_strdup_printf ("%d - %s",
- title->index, title->name);
+ tmp = g_strdup_printf ("%d - %s",
+ title->index, title->name);
titles[ii] = g_markup_escape_text(tmp, -1);
g_free(tmp);
- }
- }
- else if (title->type == HB_BD_TYPE)
- {
- if (title->duration != 0)
- {
- titles[ii] = g_strdup_printf("%d (%05d.MPLS) - %02dh%02dm%02ds",
- title->index, title->playlist, title->hours,
- title->minutes, title->seconds);
- }
- else
- {
- titles[ii] = g_strdup_printf("%d (%05d.MPLS) - Unknown Length",
- title->index, title->playlist);
- }
- }
- else
- {
- if (title->duration != 0)
- {
- titles[ii] = g_strdup_printf("%d - %02dh%02dm%02ds",
- title->index, title->hours, title->minutes, title->seconds);
- }
- else
- {
- titles[ii] = g_strdup_printf("%d - Unknown Length",
- title->index);
- }
- }
- gtk_list_store_append(store, &iter);
- gtk_list_store_set(store, &iter,
- 0, titles[ii],
- 1, TRUE,
- 2, titles[ii],
- 3, (gdouble)ii,
- 4, titles[ii],
- -1);
- title_opts.map[ii].option = titles[ii];
- title_opts.map[ii].shortOpt = titles[ii];
- title_opts.map[ii].ivalue = ii;
- title_opts.map[ii].svalue = titles[ii];
- }
- titles[ii] = NULL;
+ }
+ }
+ else if (title->type == HB_BD_TYPE)
+ {
+ if (title->duration != 0)
+ {
+ titles[ii] = g_strdup_printf("%d (%05d.MPLS) - %02dh%02dm%02ds",
+ title->index, title->playlist, title->hours,
+ title->minutes, title->seconds);
+ }
+ else
+ {
+ titles[ii] = g_strdup_printf("%d (%05d.MPLS) - Unknown Length",
+ title->index, title->playlist);
+ }
+ }
+ else
+ {
+ if (title->duration != 0)
+ {
+ titles[ii] = g_strdup_printf("%d - %02dh%02dm%02ds",
+ title->index, title->hours, title->minutes, title->seconds);
+ }
+ else
+ {
+ titles[ii] = g_strdup_printf("%d - Unknown Length",
+ title->index);
+ }
+ }
+ gtk_list_store_append(store, &iter);
+ gtk_list_store_set(store, &iter,
+ 0, titles[ii],
+ 1, TRUE,
+ 2, titles[ii],
+ 3, (gdouble)ii,
+ 4, titles[ii],
+ -1);
+ title_opts.map[ii].option = titles[ii];
+ title_opts.map[ii].shortOpt = titles[ii];
+ title_opts.map[ii].ivalue = ii;
+ title_opts.map[ii].svalue = titles[ii];
+ }
+ titles[ii] = NULL;
}
static void
@@ -2163,940 +2163,940 @@ ghb_get_title_count()
static gboolean
find_combo_item_by_int(GtkTreeModel *store, gint value, GtkTreeIter *iter)
{
- gdouble ivalue;
- gboolean foundit = FALSE;
-
- if (gtk_tree_model_get_iter_first (store, iter))
- {
- do
- {
- gtk_tree_model_get(store, iter, 3, &ivalue, -1);
- if (value == (gint)ivalue)
- {
- foundit = TRUE;
- break;
- }
- } while (gtk_tree_model_iter_next (store, iter));
- }
- return foundit;
+ gdouble ivalue;
+ gboolean foundit = FALSE;
+
+ if (gtk_tree_model_get_iter_first (store, iter))
+ {
+ do
+ {
+ gtk_tree_model_get(store, iter, 3, &ivalue, -1);
+ if (value == (gint)ivalue)
+ {
+ foundit = TRUE;
+ break;
+ }
+ } while (gtk_tree_model_iter_next (store, iter));
+ }
+ return foundit;
}
void
audio_track_opts_set(GtkBuilder *builder, const gchar *name, gint titleindex)
{
- GtkTreeIter iter;
- GtkListStore *store;
- hb_title_t * title = NULL;
+ GtkTreeIter iter;
+ GtkListStore *store;
+ hb_title_t * title = NULL;
hb_audio_config_t * audio;
- gint ii;
- gint count = 0;
- gchar *str;
-
- g_debug("audio_track_opts_set ()\n");
- store = get_combo_box_store(builder, name);
- gtk_list_store_clear(store);
- title = ghb_get_title_info(titleindex);
- if (title != NULL)
- {
- count = hb_list_count( title->list_audio );
- }
- if (count > 100) count = 100;
- if (audio_track_opts.map)
- {
- for (ii = 0; ii < audio_track_opts.count; ii++)
- {
- if (audio_track_opts.map[ii].option)
- g_free(audio_track_opts.map[ii].option);
- }
- g_free(audio_track_opts.map);
- }
- if (count > 0)
- {
- audio_track_opts.count = count;
- audio_track_opts.map = g_malloc(count*sizeof(options_map_t));
- }
- else
- {
- audio_track_opts.count = 1;
- audio_track_opts.map = g_malloc(sizeof(options_map_t));
- }
- if( count <= 0 )
- {
- // No audio. set some default
- gtk_list_store_append(store, &iter);
- gtk_list_store_set(store, &iter,
- 0, "<small>No Audio</small>",
- 1, TRUE,
- 2, "none",
- 3, -1.0,
- 4, "none",
- -1);
- audio_track_opts.map[0].option = g_strdup("No Audio");
- audio_track_opts.map[0].shortOpt = "none";
- audio_track_opts.map[0].ivalue = -1;
- audio_track_opts.map[0].svalue = "none";
- return;
- }
- index_str_init(count-1);
- for (ii = 0; ii < count; ii++)
- {
+ gint ii;
+ gint count = 0;
+ gchar *str;
+
+ g_debug("audio_track_opts_set ()\n");
+ store = get_combo_box_store(builder, name);
+ gtk_list_store_clear(store);
+ title = ghb_get_title_info(titleindex);
+ if (title != NULL)
+ {
+ count = hb_list_count( title->list_audio );
+ }
+ if (count > 100) count = 100;
+ if (audio_track_opts.map)
+ {
+ for (ii = 0; ii < audio_track_opts.count; ii++)
+ {
+ if (audio_track_opts.map[ii].option)
+ g_free(audio_track_opts.map[ii].option);
+ }
+ g_free(audio_track_opts.map);
+ }
+ if (count > 0)
+ {
+ audio_track_opts.count = count;
+ audio_track_opts.map = g_malloc(count*sizeof(options_map_t));
+ }
+ else
+ {
+ audio_track_opts.count = 1;
+ audio_track_opts.map = g_malloc(sizeof(options_map_t));
+ }
+ if( count <= 0 )
+ {
+ // No audio. set some default
+ gtk_list_store_append(store, &iter);
+ gtk_list_store_set(store, &iter,
+ 0, "<small>No Audio</small>",
+ 1, TRUE,
+ 2, "none",
+ 3, -1.0,
+ 4, "none",
+ -1);
+ audio_track_opts.map[0].option = g_strdup("No Audio");
+ audio_track_opts.map[0].shortOpt = "none";
+ audio_track_opts.map[0].ivalue = -1;
+ audio_track_opts.map[0].svalue = "none";
+ return;
+ }
+ index_str_init(count-1);
+ for (ii = 0; ii < count; ii++)
+ {
audio = (hb_audio_config_t *) hb_list_audio_config_item( title->list_audio, ii );
- gtk_list_store_append(store, &iter);
- char *tmp = g_strdup_printf("%d - %s", ii + 1, audio->lang.description);
- str = g_strdup_printf("<small>%s</small>", tmp);
- gtk_list_store_set(store, &iter,
- 0, str,
- 1, TRUE,
- 2, index_str[ii],
- 3, (gdouble)ii,
- 4, index_str[ii],
- -1);
- g_free(str);
- audio_track_opts.map[ii].option = g_strdup(tmp);
- g_free(tmp);
- audio_track_opts.map[ii].shortOpt = index_str[ii];
- audio_track_opts.map[ii].ivalue = ii;
- audio_track_opts.map[ii].svalue = index_str[ii];
- }
- GtkComboBox *combo = GTK_COMBO_BOX(GHB_WIDGET(builder, name));
- gtk_combo_box_set_active (combo, 0);
+ gtk_list_store_append(store, &iter);
+ char *tmp = g_strdup_printf("%d - %s", ii + 1, audio->lang.description);
+ str = g_strdup_printf("<small>%s</small>", tmp);
+ gtk_list_store_set(store, &iter,
+ 0, str,
+ 1, TRUE,
+ 2, index_str[ii],
+ 3, (gdouble)ii,
+ 4, index_str[ii],
+ -1);
+ g_free(str);
+ audio_track_opts.map[ii].option = g_strdup(tmp);
+ g_free(tmp);
+ audio_track_opts.map[ii].shortOpt = index_str[ii];
+ audio_track_opts.map[ii].ivalue = ii;
+ audio_track_opts.map[ii].svalue = index_str[ii];
+ }
+ GtkComboBox *combo = GTK_COMBO_BOX(GHB_WIDGET(builder, name));
+ gtk_combo_box_set_active (combo, 0);
}
const gchar*
ghb_audio_track_description(gint track, int titleindex)
{
- hb_title_t * title = NULL;
+ hb_title_t * title = NULL;
hb_audio_config_t * audio;
- gchar * desc = "Unknown";
-
- g_debug("ghb_audio_track_description ()\n");
+ gchar * desc = "Unknown";
+
+ g_debug("ghb_audio_track_description ()\n");
- title = ghb_get_title_info( titleindex );
- if (title == NULL) return desc;
- if (track >= hb_list_count( title->list_audio )) return desc;
+ title = ghb_get_title_info( titleindex );
+ if (title == NULL) return desc;
+ if (track >= hb_list_count( title->list_audio )) return desc;
- audio = hb_list_audio_config_item(title->list_audio, track);
- if (audio == NULL) return desc;
- return audio->lang.description;
+ audio = hb_list_audio_config_item(title->list_audio, track);
+ if (audio == NULL) return desc;
+ return audio->lang.description;
}
void
subtitle_track_opts_set(GtkBuilder *builder, const gchar *name, gint titleindex)
{
- GtkTreeIter iter;
- GtkListStore *store;
- hb_title_t * title = NULL;
- hb_subtitle_t * subtitle;
- gint ii, count = 0;
- static char ** options = NULL;
-
- g_debug("subtitle_track_opts_set ()\n");
- store = get_combo_box_store(builder, name);
- gtk_list_store_clear(store);
- title = ghb_get_title_info(titleindex);
- if (title != NULL)
- {
- count = hb_list_count( title->list_subtitle );
- }
- if (count > 100) count = 100;
- if (subtitle_opts.map) g_free(subtitle_opts.map);
- if (count > 0)
- {
- subtitle_opts.count = count+1;
- subtitle_opts.map = g_malloc((count+1)*sizeof(options_map_t));
- }
- else
- {
- subtitle_opts.count = LANG_TABLE_SIZE+1;
- subtitle_opts.map = g_malloc((LANG_TABLE_SIZE+1)*sizeof(options_map_t));
- }
- gtk_list_store_append(store, &iter);
- gtk_list_store_set(store, &iter,
- 0, "Foreign Audio Search",
- 1, TRUE,
- 2, "-1",
- 3, -1.0,
- 4, "auto",
- -1);
- subtitle_opts.map[0].option = "Foreign Audio Search";
- subtitle_opts.map[0].shortOpt = "-1";
- subtitle_opts.map[0].ivalue = -1;
- subtitle_opts.map[0].svalue = "auto";
- if (count > 0)
- {
- if (options != NULL)
- g_strfreev(options);
- options = g_malloc((count+1)*sizeof(gchar*));
- index_str_init(count-1);
- for (ii = 0; ii < count; ii++)
- {
- subtitle = (hb_subtitle_t *)hb_list_item(title->list_subtitle, ii);
- options[ii] = g_strdup_printf("%d - %s (%s)", ii+1,
- subtitle->lang,
- hb_subsource_name(subtitle->source));
- subtitle_opts.map[ii+1].option = options[ii];
- subtitle_opts.map[ii+1].shortOpt = index_str[ii];
- subtitle_opts.map[ii+1].ivalue = ii;
- subtitle_opts.map[ii+1].svalue = subtitle->iso639_2;
- gtk_list_store_append(store, &iter);
- gtk_list_store_set(store, &iter,
- 0, options[ii],
- 1, TRUE,
- 2, index_str[ii],
- 3, (gdouble)ii,
- 4, subtitle->iso639_2,
- -1);
- }
- options[count] = NULL;
- }
- else
- {
- index_str_init(LANG_TABLE_SIZE-1);
- for (ii = 0; ii < LANG_TABLE_SIZE; ii++)
- {
- const gchar *lang;
-
- if (ghb_language_table[ii].native_name[0] != 0)
- lang = ghb_language_table[ii].native_name;
- else
- lang = ghb_language_table[ii].eng_name;
-
- subtitle_opts.map[ii+1].option = (gchar*)lang;
- subtitle_opts.map[ii+1].shortOpt = index_str[ii];
- subtitle_opts.map[ii+1].ivalue = ii;
- subtitle_opts.map[ii+1].svalue = ghb_language_table[ii].iso639_2;
- gtk_list_store_append(store, &iter);
- gtk_list_store_set(store, &iter,
- 0, lang,
- 1, TRUE,
- 2, index_str[ii],
- 3, (gdouble)ii,
- 4, ghb_language_table[ii].iso639_2,
- -1);
- }
- }
- GtkComboBox *combo = GTK_COMBO_BOX(GHB_WIDGET(builder, name));
- gtk_combo_box_set_active (combo, 0);
+ GtkTreeIter iter;
+ GtkListStore *store;
+ hb_title_t * title = NULL;
+ hb_subtitle_t * subtitle;
+ gint ii, count = 0;
+ static char ** options = NULL;
+
+ g_debug("subtitle_track_opts_set ()\n");
+ store = get_combo_box_store(builder, name);
+ gtk_list_store_clear(store);
+ title = ghb_get_title_info(titleindex);
+ if (title != NULL)
+ {
+ count = hb_list_count( title->list_subtitle );
+ }
+ if (count > 100) count = 100;
+ if (subtitle_opts.map) g_free(subtitle_opts.map);
+ if (count > 0)
+ {
+ subtitle_opts.count = count+1;
+ subtitle_opts.map = g_malloc((count+1)*sizeof(options_map_t));
+ }
+ else
+ {
+ subtitle_opts.count = LANG_TABLE_SIZE+1;
+ subtitle_opts.map = g_malloc((LANG_TABLE_SIZE+1)*sizeof(options_map_t));
+ }
+ gtk_list_store_append(store, &iter);
+ gtk_list_store_set(store, &iter,
+ 0, "Foreign Audio Search",
+ 1, TRUE,
+ 2, "-1",
+ 3, -1.0,
+ 4, "auto",
+ -1);
+ subtitle_opts.map[0].option = "Foreign Audio Search";
+ subtitle_opts.map[0].shortOpt = "-1";
+ subtitle_opts.map[0].ivalue = -1;
+ subtitle_opts.map[0].svalue = "auto";
+ if (count > 0)
+ {
+ if (options != NULL)
+ g_strfreev(options);
+ options = g_malloc((count+1)*sizeof(gchar*));
+ index_str_init(count-1);
+ for (ii = 0; ii < count; ii++)
+ {
+ subtitle = (hb_subtitle_t *)hb_list_item(title->list_subtitle, ii);
+ options[ii] = g_strdup_printf("%d - %s (%s)", ii+1,
+ subtitle->lang,
+ hb_subsource_name(subtitle->source));
+ subtitle_opts.map[ii+1].option = options[ii];
+ subtitle_opts.map[ii+1].shortOpt = index_str[ii];
+ subtitle_opts.map[ii+1].ivalue = ii;
+ subtitle_opts.map[ii+1].svalue = subtitle->iso639_2;
+ gtk_list_store_append(store, &iter);
+ gtk_list_store_set(store, &iter,
+ 0, options[ii],
+ 1, TRUE,
+ 2, index_str[ii],
+ 3, (gdouble)ii,
+ 4, subtitle->iso639_2,
+ -1);
+ }
+ options[count] = NULL;
+ }
+ else
+ {
+ index_str_init(LANG_TABLE_SIZE-1);
+ for (ii = 0; ii < LANG_TABLE_SIZE; ii++)
+ {
+ const gchar *lang;
+
+ if (ghb_language_table[ii].native_name[0] != 0)
+ lang = ghb_language_table[ii].native_name;
+ else
+ lang = ghb_language_table[ii].eng_name;
+
+ subtitle_opts.map[ii+1].option = (gchar*)lang;
+ subtitle_opts.map[ii+1].shortOpt = index_str[ii];
+ subtitle_opts.map[ii+1].ivalue = ii;
+ subtitle_opts.map[ii+1].svalue = ghb_language_table[ii].iso639_2;
+ gtk_list_store_append(store, &iter);
+ gtk_list_store_set(store, &iter,
+ 0, lang,
+ 1, TRUE,
+ 2, index_str[ii],
+ 3, (gdouble)ii,
+ 4, ghb_language_table[ii].iso639_2,
+ -1);
+ }
+ }
+ GtkComboBox *combo = GTK_COMBO_BOX(GHB_WIDGET(builder, name));
+ gtk_combo_box_set_active (combo, 0);
}
gint
ghb_longest_title()
{
- hb_title_set_t * title_set;
- hb_title_t * title;
- gint ii;
- gint count = 0;
- gint feature;
-
- g_debug("ghb_longest_title ()\n");
- if (h_scan == NULL) return 0;
- title_set = hb_get_title_set( h_scan );
- count = hb_list_count( title_set->list_title );
- if (count < 1) return 0;
- title = (hb_title_t*)hb_list_item(title_set->list_title, 0);
- feature = title_set->feature;
- for (ii = 0; ii < count; ii++)
- {
- title = (hb_title_t*)hb_list_item(title_set->list_title, ii);
- if (title->index == feature)
- {
- return ii;
- }
- }
- return 0;
+ hb_title_set_t * title_set;
+ hb_title_t * title;
+ gint ii;
+ gint count = 0;
+ gint feature;
+
+ g_debug("ghb_longest_title ()\n");
+ if (h_scan == NULL) return 0;
+ title_set = hb_get_title_set( h_scan );
+ count = hb_list_count( title_set->list_title );
+ if (count < 1) return 0;
+ title = (hb_title_t*)hb_list_item(title_set->list_title, 0);
+ feature = title_set->feature;
+ for (ii = 0; ii < count; ii++)
+ {
+ title = (hb_title_t*)hb_list_item(title_set->list_title, ii);
+ if (title->index == feature)
+ {
+ return ii;
+ }
+ }
+ return 0;
}
const gchar*
ghb_get_source_audio_lang(gint titleindex, gint track)
{
- hb_title_t * title;
+ hb_title_t * title;
hb_audio_config_t * audio;
- const gchar *lang = "und";
-
- g_debug("ghb_lookup_1st_audio_lang ()\n");
+ const gchar *lang = "und";
+
+ g_debug("ghb_lookup_1st_audio_lang ()\n");
title = ghb_get_title_info( titleindex );
- if (title == NULL)
- return lang;
- if (hb_list_count( title->list_audio ) <= track)
- return lang;
+ if (title == NULL)
+ return lang;
+ if (hb_list_count( title->list_audio ) <= track)
+ return lang;
- audio = hb_list_audio_config_item(title->list_audio, track);
- if (audio == NULL)
- return lang;
+ audio = hb_list_audio_config_item(title->list_audio, track);
+ if (audio == NULL)
+ return lang;
- lang = audio->lang.iso639_2;
- return lang;
+ lang = audio->lang.iso639_2;
+ return lang;
}
static gboolean*
get_track_used(gint acodec, GHashTable *track_indices, gint count)
{
- gboolean *used;
+ gboolean *used;
- used = g_hash_table_lookup(track_indices, &acodec);
- if (used == NULL)
- {
- gint *key;
+ used = g_hash_table_lookup(track_indices, &acodec);
+ if (used == NULL)
+ {
+ gint *key;
- used = g_malloc0(count * sizeof(gboolean));
- key = g_malloc(sizeof(gint));
- *key = acodec;
- g_hash_table_insert(track_indices, key, used);
- }
- return used;
+ used = g_malloc0(count * sizeof(gboolean));
+ key = g_malloc(sizeof(gint));
+ *key = acodec;
+ g_hash_table_insert(track_indices, key, used);
+ }
+ return used;
}
gint
ghb_find_audio_track(
- gint titleindex,
- const gchar *lang,
- gint acodec,
- gint fallback_acodec,
- GHashTable *track_indices)
-{
- hb_title_t * title;
- hb_audio_config_t * audio;
- gint ii;
- gint count = 0;
- gint track = -1;
- gint max_chan;
- gboolean *used = NULL;
- gboolean *passthru_used;
- gint try_acodec;
- gint passthru_acodec;
- gboolean passthru;
- gint channels;
-
- g_debug("find_audio_track ()\n");
- title = ghb_get_title_info( titleindex );
- if (title != NULL)
- {
- count = hb_list_count( title->list_audio );
- }
- if (count > 10) count = 10;
- // Try to find an item that matches the preferred language and
- // the passthru codec type
- max_chan = 0;
- passthru = (acodec & HB_ACODEC_PASS_FLAG) != 0;
- if (passthru)
- {
- for (ii = 0; ii < count; ii++)
- {
- audio = (hb_audio_config_t*)hb_list_audio_config_item(
- title->list_audio, ii );
- passthru_acodec = HB_ACODEC_PASS_MASK & acodec & audio->in.codec;
- // Is the source track use a passthru capable codec?
- if (passthru_acodec == 0)
- continue;
- used = get_track_used(passthru_acodec, track_indices, count);
- // Has the track already been used with this codec?
- if (used[ii])
- continue;
-
- channels = av_get_channel_layout_nb_channels(
- audio->in.channel_layout);
- // Find a track that is not visually impaired or dirctor's
- // commentary, and has the highest channel count.
- if ((audio->lang.type < 2) &&
- ((strcmp(lang, audio->lang.iso639_2) == 0) ||
- (strcmp(lang, "und") == 0)))
- {
- if (channels > max_chan)
- {
- track = ii;
- max_chan = channels;
- }
- }
- }
- try_acodec = fallback_acodec;
- }
- else
- {
- try_acodec = acodec;
- }
- if (track > -1)
- {
- used[track] = TRUE;
- return track;
- }
- // Try to find an item that matches the preferred language
- max_chan = 0;
- used = get_track_used(try_acodec, track_indices, count);
- for (ii = 0; ii < count; ii++)
- {
- // Has the track already been used with this codec?
- if (used[ii])
- continue;
- audio = (hb_audio_config_t*)hb_list_audio_config_item(
- title->list_audio, ii );
- passthru_acodec = HB_ACODEC_PASS_MASK & audio->in.codec;
- if (passthru_acodec && passthru)
- {
- passthru_used = get_track_used(passthru_acodec, track_indices, count);
- // Has the track already been used with this codec for passthru?
- if (passthru_used[ii])
- continue;
- }
- channels = av_get_channel_layout_nb_channels(
- audio->in.channel_layout);
- // Find a track that is not visually impaired or dirctor's commentary
- if ((audio->lang.type < 2) &&
- ((strcmp(lang, audio->lang.iso639_2) == 0) ||
- (strcmp(lang, "und") == 0)))
- {
- if (channels > max_chan)
- {
- track = ii;
- max_chan = channels;
- }
- }
- }
- if (track > -1)
- {
- used[track] = TRUE;
- return track;
- }
- // Try to fine an item that does not match the preferred language and
- // matches the passthru codec type
- max_chan = 0;
- if (passthru)
- {
- for (ii = 0; ii < count; ii++)
- {
- audio = (hb_audio_config_t*)hb_list_audio_config_item(
- title->list_audio, ii );
- passthru_acodec = HB_ACODEC_PASS_MASK & acodec & audio->in.codec;
- // Is the source track use a passthru capable codec?
- if (passthru_acodec == 0)
- continue;
- used = get_track_used(passthru_acodec, track_indices, count);
- // Has the track already been used with this codec?
- if (used[ii])
- continue;
-
- channels = av_get_channel_layout_nb_channels(
- audio->in.channel_layout);
- // Find a track that is not visually impaired or dirctor's
- // commentary, and has the highest channel count.
- if (audio->lang.type < 2)
- {
- if (channels > max_chan)
- {
- track = ii;
- max_chan = channels;
- }
- }
- }
- try_acodec = fallback_acodec;
- }
- else
- {
- try_acodec = acodec;
- }
- if (track > -1)
- {
- used[track] = TRUE;
- return track;
- }
- // Try to fine an item that does not match the preferred language
- max_chan = 0;
- used = get_track_used(try_acodec, track_indices, count);
- for (ii = 0; ii < count; ii++)
- {
- // Has the track already been used with this codec?
- if (used[ii])
- continue;
- audio = (hb_audio_config_t*)hb_list_audio_config_item(
- title->list_audio, ii );
- passthru_acodec = HB_ACODEC_PASS_MASK & audio->in.codec;
- channels = av_get_channel_layout_nb_channels(
- audio->in.channel_layout);
- if (passthru_acodec && passthru)
- {
- passthru_used = get_track_used(passthru_acodec, track_indices, count);
- // Has the track already been used with this codec for passthru?
- if (passthru_used[ii])
- continue;
- }
- // Find a track that is not visually impaired or dirctor's commentary
- if (audio->lang.type < 2)
- {
- if (channels > max_chan)
- {
- track = ii;
- max_chan = channels;
- }
- }
- }
- if (track > -1)
- {
- used[track] = TRUE;
- return track;
- }
- // Last ditch, anything goes
- for (ii = 0; ii < count; ii++)
- {
- audio = (hb_audio_config_t*)hb_list_audio_config_item(
- title->list_audio, ii );
- passthru_acodec = HB_ACODEC_PASS_MASK & audio->in.codec;
- if (passthru_acodec && passthru)
- {
- passthru_used = get_track_used(passthru_acodec, track_indices, count);
- // Has the track already been used with this codec for passthru?
- if (passthru_used[ii])
- continue;
- }
- // Has the track already been used with this codec?
- if (!used[ii])
- {
- track = ii;
- break;
- }
- }
- if (track > -1)
- {
- used[track] = TRUE;
- }
- return track;
+ gint titleindex,
+ const gchar *lang,
+ gint acodec,
+ gint fallback_acodec,
+ GHashTable *track_indices)
+{
+ hb_title_t * title;
+ hb_audio_config_t * audio;
+ gint ii;
+ gint count = 0;
+ gint track = -1;
+ gint max_chan;
+ gboolean *used = NULL;
+ gboolean *passthru_used;
+ gint try_acodec;
+ gint passthru_acodec;
+ gboolean passthru;
+ gint channels;
+
+ g_debug("find_audio_track ()\n");
+ title = ghb_get_title_info( titleindex );
+ if (title != NULL)
+ {
+ count = hb_list_count( title->list_audio );
+ }
+ if (count > 10) count = 10;
+ // Try to find an item that matches the preferred language and
+ // the passthru codec type
+ max_chan = 0;
+ passthru = (acodec & HB_ACODEC_PASS_FLAG) != 0;
+ if (passthru)
+ {
+ for (ii = 0; ii < count; ii++)
+ {
+ audio = (hb_audio_config_t*)hb_list_audio_config_item(
+ title->list_audio, ii );
+ passthru_acodec = HB_ACODEC_PASS_MASK & acodec & audio->in.codec;
+ // Is the source track use a passthru capable codec?
+ if (passthru_acodec == 0)
+ continue;
+ used = get_track_used(passthru_acodec, track_indices, count);
+ // Has the track already been used with this codec?
+ if (used[ii])
+ continue;
+
+ channels = av_get_channel_layout_nb_channels(
+ audio->in.channel_layout);
+ // Find a track that is not visually impaired or dirctor's
+ // commentary, and has the highest channel count.
+ if ((audio->lang.type < 2) &&
+ ((strcmp(lang, audio->lang.iso639_2) == 0) ||
+ (strcmp(lang, "und") == 0)))
+ {
+ if (channels > max_chan)
+ {
+ track = ii;
+ max_chan = channels;
+ }
+ }
+ }
+ try_acodec = fallback_acodec;
+ }
+ else
+ {
+ try_acodec = acodec;
+ }
+ if (track > -1)
+ {
+ used[track] = TRUE;
+ return track;
+ }
+ // Try to find an item that matches the preferred language
+ max_chan = 0;
+ used = get_track_used(try_acodec, track_indices, count);
+ for (ii = 0; ii < count; ii++)
+ {
+ // Has the track already been used with this codec?
+ if (used[ii])
+ continue;
+ audio = (hb_audio_config_t*)hb_list_audio_config_item(
+ title->list_audio, ii );
+ passthru_acodec = HB_ACODEC_PASS_MASK & audio->in.codec;
+ if (passthru_acodec && passthru)
+ {
+ passthru_used = get_track_used(passthru_acodec, track_indices, count);
+ // Has the track already been used with this codec for passthru?
+ if (passthru_used[ii])
+ continue;
+ }
+ channels = av_get_channel_layout_nb_channels(
+ audio->in.channel_layout);
+ // Find a track that is not visually impaired or dirctor's commentary
+ if ((audio->lang.type < 2) &&
+ ((strcmp(lang, audio->lang.iso639_2) == 0) ||
+ (strcmp(lang, "und") == 0)))
+ {
+ if (channels > max_chan)
+ {
+ track = ii;
+ max_chan = channels;
+ }
+ }
+ }
+ if (track > -1)
+ {
+ used[track] = TRUE;
+ return track;
+ }
+ // Try to fine an item that does not match the preferred language and
+ // matches the passthru codec type
+ max_chan = 0;
+ if (passthru)
+ {
+ for (ii = 0; ii < count; ii++)
+ {
+ audio = (hb_audio_config_t*)hb_list_audio_config_item(
+ title->list_audio, ii );
+ passthru_acodec = HB_ACODEC_PASS_MASK & acodec & audio->in.codec;
+ // Is the source track use a passthru capable codec?
+ if (passthru_acodec == 0)
+ continue;
+ used = get_track_used(passthru_acodec, track_indices, count);
+ // Has the track already been used with this codec?
+ if (used[ii])
+ continue;
+
+ channels = av_get_channel_layout_nb_channels(
+ audio->in.channel_layout);
+ // Find a track that is not visually impaired or dirctor's
+ // commentary, and has the highest channel count.
+ if (audio->lang.type < 2)
+ {
+ if (channels > max_chan)
+ {
+ track = ii;
+ max_chan = channels;
+ }
+ }
+ }
+ try_acodec = fallback_acodec;
+ }
+ else
+ {
+ try_acodec = acodec;
+ }
+ if (track > -1)
+ {
+ used[track] = TRUE;
+ return track;
+ }
+ // Try to fine an item that does not match the preferred language
+ max_chan = 0;
+ used = get_track_used(try_acodec, track_indices, count);
+ for (ii = 0; ii < count; ii++)
+ {
+ // Has the track already been used with this codec?
+ if (used[ii])
+ continue;
+ audio = (hb_audio_config_t*)hb_list_audio_config_item(
+ title->list_audio, ii );
+ passthru_acodec = HB_ACODEC_PASS_MASK & audio->in.codec;
+ channels = av_get_channel_layout_nb_channels(
+ audio->in.channel_layout);
+ if (passthru_acodec && passthru)
+ {
+ passthru_used = get_track_used(passthru_acodec, track_indices, count);
+ // Has the track already been used with this codec for passthru?
+ if (passthru_used[ii])
+ continue;
+ }
+ // Find a track that is not visually impaired or dirctor's commentary
+ if (audio->lang.type < 2)
+ {
+ if (channels > max_chan)
+ {
+ track = ii;
+ max_chan = channels;
+ }
+ }
+ }
+ if (track > -1)
+ {
+ used[track] = TRUE;
+ return track;
+ }
+ // Last ditch, anything goes
+ for (ii = 0; ii < count; ii++)
+ {
+ audio = (hb_audio_config_t*)hb_list_audio_config_item(
+ title->list_audio, ii );
+ passthru_acodec = HB_ACODEC_PASS_MASK & audio->in.codec;
+ if (passthru_acodec && passthru)
+ {
+ passthru_used = get_track_used(passthru_acodec, track_indices, count);
+ // Has the track already been used with this codec for passthru?
+ if (passthru_used[ii])
+ continue;
+ }
+ // Has the track already been used with this codec?
+ if (!used[ii])
+ {
+ track = ii;
+ break;
+ }
+ }
+ if (track > -1)
+ {
+ used[track] = TRUE;
+ }
+ return track;
}
gint
ghb_find_pref_subtitle_track(const gchar *lang)
{
- gint ii, count;
- count = subtitle_opts.count;
- for (ii = 0; ii < count; ii++)
- {
- if (strcmp(lang, subtitle_opts.map[ii].svalue) == 0)
- {
- return subtitle_opts.map[ii].ivalue;
- }
- }
- return -2;
+ gint ii, count;
+ count = subtitle_opts.count;
+ for (ii = 0; ii < count; ii++)
+ {
+ if (strcmp(lang, subtitle_opts.map[ii].svalue) == 0)
+ {
+ return subtitle_opts.map[ii].ivalue;
+ }
+ }
+ return -2;
}
gint
ghb_find_cc_track(gint titleindex)
{
- hb_title_t * title;
- hb_subtitle_t * subtitle;
- gint count, ii;
-
- g_debug("ghb_find_cc_track ()\n");
- title = ghb_get_title_info( titleindex );
- if (title != NULL)
- {
- count = hb_list_count( title->list_subtitle );
- // Try to find an item that matches the preferred language
- for (ii = 0; ii < count; ii++)
- {
- subtitle = (hb_subtitle_t*)hb_list_item( title->list_subtitle, ii );
- if (subtitle->source == CC608SUB || subtitle->source == CC708SUB)
- return ii;
- }
- }
- return -2;
+ hb_title_t * title;
+ hb_subtitle_t * subtitle;
+ gint count, ii;
+
+ g_debug("ghb_find_cc_track ()\n");
+ title = ghb_get_title_info( titleindex );
+ if (title != NULL)
+ {
+ count = hb_list_count( title->list_subtitle );
+ // Try to find an item that matches the preferred language
+ for (ii = 0; ii < count; ii++)
+ {
+ subtitle = (hb_subtitle_t*)hb_list_item( title->list_subtitle, ii );
+ if (subtitle->source == CC608SUB || subtitle->source == CC708SUB)
+ return ii;
+ }
+ }
+ return -2;
}
gint
ghb_find_subtitle_track(
- gint titleindex,
- const gchar * lang,
- gboolean burn,
- gboolean force,
- gint source,
- GHashTable * track_indices)
-{
- hb_title_t * title;
- hb_subtitle_t * subtitle;
- gint count, ii;
- gboolean *used;
-
- g_debug("find_subtitle_track ()\n");
- if (strcmp(lang, "auto") == 0)
- return -1;
-
- title = ghb_get_title_info( titleindex );
- if (title == NULL)
- return -2;
-
- count = hb_list_count( title->list_subtitle );
- used = g_hash_table_lookup(track_indices, lang);
- if (used == NULL)
- {
- used = g_malloc0(count * sizeof(gboolean));
- g_hash_table_insert(track_indices, g_strdup(lang), used);
- }
- // Try to find an item that matches the preferred language and source
- for (ii = 0; ii < count; ii++)
- {
- if (used[ii])
- continue;
-
- subtitle = (hb_subtitle_t*)hb_list_item( title->list_subtitle, ii );
- if (source == subtitle->source &&
- ((strcmp(lang, subtitle->iso639_2) == 0) ||
- (strcmp(lang, "und") == 0)))
- {
- used[ii] = TRUE;
- return ii;
- }
- }
- // Try to find an item that matches the preferred language
- for (ii = 0; ii < count; ii++)
- {
- if (used[ii])
- continue;
-
- subtitle = (hb_subtitle_t*)hb_list_item( title->list_subtitle, ii );
- if (((!force || (force && ghb_canForceSub(subtitle->source))) &&
- (!burn || (burn && ghb_canBurnSub(subtitle->source)))) &&
- ((strcmp(lang, subtitle->iso639_2) == 0) ||
- (strcmp(lang, "und") == 0)))
- {
- used[ii] = TRUE;
- return ii;
- }
- }
- return -2;
+ gint titleindex,
+ const gchar * lang,
+ gboolean burn,
+ gboolean force,
+ gint source,
+ GHashTable * track_indices)
+{
+ hb_title_t * title;
+ hb_subtitle_t * subtitle;
+ gint count, ii;
+ gboolean *used;
+
+ g_debug("find_subtitle_track ()\n");
+ if (strcmp(lang, "auto") == 0)
+ return -1;
+
+ title = ghb_get_title_info( titleindex );
+ if (title == NULL)
+ return -2;
+
+ count = hb_list_count( title->list_subtitle );
+ used = g_hash_table_lookup(track_indices, lang);
+ if (used == NULL)
+ {
+ used = g_malloc0(count * sizeof(gboolean));
+ g_hash_table_insert(track_indices, g_strdup(lang), used);
+ }
+ // Try to find an item that matches the preferred language and source
+ for (ii = 0; ii < count; ii++)
+ {
+ if (used[ii])
+ continue;
+
+ subtitle = (hb_subtitle_t*)hb_list_item( title->list_subtitle, ii );
+ if (source == subtitle->source &&
+ ((strcmp(lang, subtitle->iso639_2) == 0) ||
+ (strcmp(lang, "und") == 0)))
+ {
+ used[ii] = TRUE;
+ return ii;
+ }
+ }
+ // Try to find an item that matches the preferred language
+ for (ii = 0; ii < count; ii++)
+ {
+ if (used[ii])
+ continue;
+
+ subtitle = (hb_subtitle_t*)hb_list_item( title->list_subtitle, ii );
+ if (((!force || (force && ghb_canForceSub(subtitle->source))) &&
+ (!burn || (burn && ghb_canBurnSub(subtitle->source)))) &&
+ ((strcmp(lang, subtitle->iso639_2) == 0) ||
+ (strcmp(lang, "und") == 0)))
+ {
+ used[ii] = TRUE;
+ return ii;
+ }
+ }
+ return -2;
}
static void
generic_opts_set(GtkBuilder *builder, const gchar *name, combo_opts_t *opts)
{
- GtkTreeIter iter;
- GtkListStore *store;
- gint ii;
-
- g_debug("generic_opts_set ()\n");
- if (name == NULL || opts == NULL) return;
- store = get_combo_box_store(builder, name);
- gtk_list_store_clear(store);
- for (ii = 0; ii < opts->count; ii++)
- {
- gtk_list_store_append(store, &iter);
- gtk_list_store_set(store, &iter,
- 0, opts->map[ii].option,
- 1, TRUE,
- 2, opts->map[ii].shortOpt,
- 3, opts->map[ii].ivalue,
- 4, opts->map[ii].svalue,
- -1);
- }
+ GtkTreeIter iter;
+ GtkListStore *store;
+ gint ii;
+
+ g_debug("generic_opts_set ()\n");
+ if (name == NULL || opts == NULL) return;
+ store = get_combo_box_store(builder, name);
+ gtk_list_store_clear(store);
+ for (ii = 0; ii < opts->count; ii++)
+ {
+ gtk_list_store_append(store, &iter);
+ gtk_list_store_set(store, &iter,
+ 0, opts->map[ii].option,
+ 1, TRUE,
+ 2, opts->map[ii].shortOpt,
+ 3, opts->map[ii].ivalue,
+ 4, opts->map[ii].svalue,
+ -1);
+ }
}
static void
small_opts_set(GtkBuilder *builder, const gchar *name, combo_opts_t *opts)
{
- GtkTreeIter iter;
- GtkListStore *store;
- gint ii;
- gchar *str;
-
- g_debug("small_opts_set ()\n");
- if (name == NULL || opts == NULL) return;
- store = get_combo_box_store(builder, name);
- gtk_list_store_clear(store);
- for (ii = 0; ii < opts->count; ii++)
- {
- gtk_list_store_append(store, &iter);
- str = g_strdup_printf("<small>%s</small>", opts->map[ii].option);
- gtk_list_store_set(store, &iter,
- 0, str,
- 1, TRUE,
- 2, opts->map[ii].shortOpt,
- 3, opts->map[ii].ivalue,
- 4, opts->map[ii].svalue,
- -1);
- g_free(str);
- }
+ GtkTreeIter iter;
+ GtkListStore *store;
+ gint ii;
+ gchar *str;
+
+ g_debug("small_opts_set ()\n");
+ if (name == NULL || opts == NULL) return;
+ store = get_combo_box_store(builder, name);
+ gtk_list_store_clear(store);
+ for (ii = 0; ii < opts->count; ii++)
+ {
+ gtk_list_store_append(store, &iter);
+ str = g_strdup_printf("<small>%s</small>", opts->map[ii].option);
+ gtk_list_store_set(store, &iter,
+ 0, str,
+ 1, TRUE,
+ 2, opts->map[ii].shortOpt,
+ 3, opts->map[ii].ivalue,
+ 4, opts->map[ii].svalue,
+ -1);
+ g_free(str);
+ }
}
combo_opts_t*
find_combo_table(const gchar *name)
{
- gint ii;
+ gint ii;
- for (ii = 0; combo_name_map[ii].name != NULL; ii++)
- {
- if (strcmp(name, combo_name_map[ii].name) == 0)
- {
- return combo_name_map[ii].opts;
- }
- }
- return NULL;
+ for (ii = 0; combo_name_map[ii].name != NULL; ii++)
+ {
+ if (strcmp(name, combo_name_map[ii].name) == 0)
+ {
+ return combo_name_map[ii].opts;
+ }
+ }
+ return NULL;
}
gint
ghb_lookup_combo_int(const gchar *name, const GValue *gval)
{
- if (gval == NULL)
- return 0;
- if (strcmp(name, "AudioBitrate") == 0)
- return lookup_audio_bitrate_int(gval);
- else if (strcmp(name, "AudioSamplerate") == 0)
- return lookup_audio_rate_int(gval);
- else if (strcmp(name, "VideoFramerate") == 0)
- return lookup_video_rate_int(gval);
- else if (strcmp(name, "AudioMixdown") == 0)
- return lookup_mix_int(gval);
- else if (strcmp(name, "SrtLanguage") == 0)
- return lookup_audio_lang_int(gval);
- else if (strcmp(name, "PreferredLanguage") == 0)
- return lookup_audio_lang_int(gval);
- else if (strcmp(name, "VideoEncoder") == 0)
- return lookup_hb_encoder_int(gval, hb_video_encoders, hb_video_encoders_count);
- else if (strcmp(name, "AudioEncoder") == 0)
- return lookup_hb_encoder_int(gval, hb_audio_encoders, hb_audio_encoders_count);
- else if (strcmp(name, "AudioEncoderFallback") == 0)
- return lookup_hb_encoder_int(gval, hb_audio_encoders, hb_audio_encoders_count);
- else if (strcmp(name, "AudioEncoderActual") == 0)
- return lookup_hb_encoder_int(gval, hb_audio_encoders, hb_audio_encoders_count);
- else
- {
- return lookup_generic_int(find_combo_table(name), gval);
- }
- g_warning("ghb_lookup_combo_int() couldn't find %s", name);
- return 0;
+ if (gval == NULL)
+ return 0;
+ if (strcmp(name, "AudioBitrate") == 0)
+ return lookup_audio_bitrate_int(gval);
+ else if (strcmp(name, "AudioSamplerate") == 0)
+ return lookup_audio_rate_int(gval);
+ else if (strcmp(name, "VideoFramerate") == 0)
+ return lookup_video_rate_int(gval);
+ else if (strcmp(name, "AudioMixdown") == 0)
+ return lookup_mix_int(gval);
+ else if (strcmp(name, "SrtLanguage") == 0)
+ return lookup_audio_lang_int(gval);
+ else if (strcmp(name, "PreferredLanguage") == 0)
+ return lookup_audio_lang_int(gval);
+ else if (strcmp(name, "VideoEncoder") == 0)
+ return lookup_hb_encoder_int(gval, hb_video_encoders, hb_video_encoders_count);
+ else if (strcmp(name, "AudioEncoder") == 0)
+ return lookup_hb_encoder_int(gval, hb_audio_encoders, hb_audio_encoders_count);
+ else if (strcmp(name, "AudioEncoderFallback") == 0)
+ return lookup_hb_encoder_int(gval, hb_audio_encoders, hb_audio_encoders_count);
+ else if (strcmp(name, "AudioEncoderActual") == 0)
+ return lookup_hb_encoder_int(gval, hb_audio_encoders, hb_audio_encoders_count);
+ else
+ {
+ return lookup_generic_int(find_combo_table(name), gval);
+ }
+ g_warning("ghb_lookup_combo_int() couldn't find %s", name);
+ return 0;
}
gdouble
ghb_lookup_combo_double(const gchar *name, const GValue *gval)
{
- if (gval == NULL)
- return 0;
- if (strcmp(name, "AudioBitrate") == 0)
- return lookup_audio_bitrate_int(gval);
- else if (strcmp(name, "AudioSamplerate") == 0)
- return lookup_audio_rate_int(gval);
- else if (strcmp(name, "VideoFramerate") == 0)
- return lookup_video_rate_int(gval);
- else if (strcmp(name, "AudioMixdown") == 0)
- return lookup_mix_int(gval);
- else if (strcmp(name, "SrtLanguage") == 0)
- return lookup_audio_lang_int(gval);
- else if (strcmp(name, "PreferredLanguage") == 0)
- return lookup_audio_lang_int(gval);
- else if (strcmp(name, "VideoEncoder") == 0)
- return lookup_hb_encoder_int(gval, hb_video_encoders, hb_video_encoders_count);
- else if (strcmp(name, "AudioEncoder") == 0)
- return lookup_hb_encoder_int(gval, hb_audio_encoders, hb_audio_encoders_count);
- else if (strcmp(name, "AudioEncoderFallback") == 0)
- return lookup_hb_encoder_int(gval, hb_audio_encoders, hb_audio_encoders_count);
- else if (strcmp(name, "AudioEncoderActual") == 0)
- return lookup_hb_encoder_int(gval, hb_audio_encoders, hb_audio_encoders_count);
- else
- {
- return lookup_generic_double(find_combo_table(name), gval);
- }
- g_warning("ghb_lookup_combo_double() couldn't find %s", name);
- return 0;
+ if (gval == NULL)
+ return 0;
+ if (strcmp(name, "AudioBitrate") == 0)
+ return lookup_audio_bitrate_int(gval);
+ else if (strcmp(name, "AudioSamplerate") == 0)
+ return lookup_audio_rate_int(gval);
+ else if (strcmp(name, "VideoFramerate") == 0)
+ return lookup_video_rate_int(gval);
+ else if (strcmp(name, "AudioMixdown") == 0)
+ return lookup_mix_int(gval);
+ else if (strcmp(name, "SrtLanguage") == 0)
+ return lookup_audio_lang_int(gval);
+ else if (strcmp(name, "PreferredLanguage") == 0)
+ return lookup_audio_lang_int(gval);
+ else if (strcmp(name, "VideoEncoder") == 0)
+ return lookup_hb_encoder_int(gval, hb_video_encoders, hb_video_encoders_count);
+ else if (strcmp(name, "AudioEncoder") == 0)
+ return lookup_hb_encoder_int(gval, hb_audio_encoders, hb_audio_encoders_count);
+ else if (strcmp(name, "AudioEncoderFallback") == 0)
+ return lookup_hb_encoder_int(gval, hb_audio_encoders, hb_audio_encoders_count);
+ else if (strcmp(name, "AudioEncoderActual") == 0)
+ return lookup_hb_encoder_int(gval, hb_audio_encoders, hb_audio_encoders_count);
+ else
+ {
+ return lookup_generic_double(find_combo_table(name), gval);
+ }
+ g_warning("ghb_lookup_combo_double() couldn't find %s", name);
+ return 0;
}
const gchar*
ghb_lookup_combo_option(const gchar *name, const GValue *gval)
{
- if (gval == NULL)
- return NULL;
- if (strcmp(name, "AudioBitrate") == 0)
- return lookup_audio_bitrate_option(gval);
- else if (strcmp(name, "AudioSamplerate") == 0)
- return lookup_audio_rate_option(gval);
- else if (strcmp(name, "VideoFramerate") == 0)
- return lookup_video_rate_option(gval);
- else if (strcmp(name, "AudioMixdown") == 0)
- return lookup_mix_option(gval);
- else if (strcmp(name, "SrtLanguage") == 0)
- return lookup_audio_lang_option(gval);
- else if (strcmp(name, "PreferredLanguage") == 0)
- return lookup_audio_lang_option(gval);
- else if (strcmp(name, "VideoEncoder") == 0)
- return lookup_hb_encoder_option(gval, hb_video_encoders, hb_video_encoders_count);
- else if (strcmp(name, "AudioEncoder") == 0)
- return lookup_hb_encoder_option(gval, hb_audio_encoders, hb_audio_encoders_count);
- else if (strcmp(name, "AudioEncoderFallback") == 0)
- return lookup_hb_encoder_option(gval, hb_audio_encoders, hb_audio_encoders_count);
- else if (strcmp(name, "AudioEncoderActual") == 0)
- return lookup_hb_encoder_option(gval, hb_audio_encoders, hb_audio_encoders_count);
- else
- {
- return lookup_generic_option(find_combo_table(name), gval);
- }
- g_warning("ghb_lookup_combo_int() couldn't find %s", name);
- return NULL;
+ if (gval == NULL)
+ return NULL;
+ if (strcmp(name, "AudioBitrate") == 0)
+ return lookup_audio_bitrate_option(gval);
+ else if (strcmp(name, "AudioSamplerate") == 0)
+ return lookup_audio_rate_option(gval);
+ else if (strcmp(name, "VideoFramerate") == 0)
+ return lookup_video_rate_option(gval);
+ else if (strcmp(name, "AudioMixdown") == 0)
+ return lookup_mix_option(gval);
+ else if (strcmp(name, "SrtLanguage") == 0)
+ return lookup_audio_lang_option(gval);
+ else if (strcmp(name, "PreferredLanguage") == 0)
+ return lookup_audio_lang_option(gval);
+ else if (strcmp(name, "VideoEncoder") == 0)
+ return lookup_hb_encoder_option(gval, hb_video_encoders, hb_video_encoders_count);
+ else if (strcmp(name, "AudioEncoder") == 0)
+ return lookup_hb_encoder_option(gval, hb_audio_encoders, hb_audio_encoders_count);
+ else if (strcmp(name, "AudioEncoderFallback") == 0)
+ return lookup_hb_encoder_option(gval, hb_audio_encoders, hb_audio_encoders_count);
+ else if (strcmp(name, "AudioEncoderActual") == 0)
+ return lookup_hb_encoder_option(gval, hb_audio_encoders, hb_audio_encoders_count);
+ else
+ {
+ return lookup_generic_option(find_combo_table(name), gval);
+ }
+ g_warning("ghb_lookup_combo_int() couldn't find %s", name);
+ return NULL;
}
const gchar*
ghb_lookup_combo_string(const gchar *name, const GValue *gval)
{
- if (gval == NULL)
- return NULL;
- if (strcmp(name, "AudioBitrate") == 0)
- return lookup_audio_bitrate_option(gval);
- else if (strcmp(name, "AudioSamplerate") == 0)
- return lookup_audio_rate_string(gval);
- else if (strcmp(name, "VideoFramerate") == 0)
- return lookup_video_rate_option(gval);
- else if (strcmp(name, "AudioMixdown") == 0)
- return lookup_mix_string(gval);
- else if (strcmp(name, "SrtLanguage") == 0)
- return lookup_audio_lang_option(gval);
- else if (strcmp(name, "PreferredLanguage") == 0)
- return lookup_audio_lang_option(gval);
- else if (strcmp(name, "VideoEncoder") == 0)
- return lookup_hb_encoder_string(gval, hb_video_encoders, hb_video_encoders_count);
- else if (strcmp(name, "AudioEncoder") == 0)
- return lookup_hb_encoder_string(gval, hb_audio_encoders, hb_audio_encoders_count);
- else if (strcmp(name, "AudioEncoderFallback") == 0)
- return lookup_hb_encoder_string(gval, hb_audio_encoders, hb_audio_encoders_count);
- else if (strcmp(name, "AudioEncoderActual") == 0)
- return lookup_hb_encoder_string(gval, hb_audio_encoders, hb_audio_encoders_count);
- else
- {
- return lookup_generic_string(find_combo_table(name), gval);
- }
- g_warning("ghb_lookup_combo_int() couldn't find %s", name);
- return NULL;
+ if (gval == NULL)
+ return NULL;
+ if (strcmp(name, "AudioBitrate") == 0)
+ return lookup_audio_bitrate_option(gval);
+ else if (strcmp(name, "AudioSamplerate") == 0)
+ return lookup_audio_rate_string(gval);
+ else if (strcmp(name, "VideoFramerate") == 0)
+ return lookup_video_rate_option(gval);
+ else if (strcmp(name, "AudioMixdown") == 0)
+ return lookup_mix_string(gval);
+ else if (strcmp(name, "SrtLanguage") == 0)
+ return lookup_audio_lang_option(gval);
+ else if (strcmp(name, "PreferredLanguage") == 0)
+ return lookup_audio_lang_option(gval);
+ else if (strcmp(name, "VideoEncoder") == 0)
+ return lookup_hb_encoder_string(gval, hb_video_encoders, hb_video_encoders_count);
+ else if (strcmp(name, "AudioEncoder") == 0)
+ return lookup_hb_encoder_string(gval, hb_audio_encoders, hb_audio_encoders_count);
+ else if (strcmp(name, "AudioEncoderFallback") == 0)
+ return lookup_hb_encoder_string(gval, hb_audio_encoders, hb_audio_encoders_count);
+ else if (strcmp(name, "AudioEncoderActual") == 0)
+ return lookup_hb_encoder_string(gval, hb_audio_encoders, hb_audio_encoders_count);
+ else
+ {
+ return lookup_generic_string(find_combo_table(name), gval);
+ }
+ g_warning("ghb_lookup_combo_int() couldn't find %s", name);
+ return NULL;
}
void
ghb_update_ui_combo_box(
- signal_user_data_t *ud,
- const gchar *name,
- gint user_data,
- gboolean all)
-{
- GtkComboBox *combo = NULL;
- gint signal_id;
- gint handler_id = 0;
-
- if (name != NULL)
- {
- g_debug("ghb_update_ui_combo_box() %s\n", name);
- // Clearing a combo box causes a rash of "changed" events, even when
- // the active item is -1 (inactive). To control things, I'm disabling
- // the event till things are settled down.
- combo = GTK_COMBO_BOX(GHB_WIDGET(ud->builder, name));
- signal_id = g_signal_lookup("changed", GTK_TYPE_COMBO_BOX);
- if (signal_id > 0)
- {
- // Valid signal id found. This should always succeed.
- handler_id = g_signal_handler_find ((gpointer)combo, G_SIGNAL_MATCH_ID,
- signal_id, 0, 0, 0, 0);
- if (handler_id > 0)
- {
- // This should also always succeed
- g_signal_handler_block ((gpointer)combo, handler_id);
- }
- }
- }
- if (all)
- {
- audio_bitrate_opts_set(ud->builder, "AudioBitrate");
- audio_samplerate_opts_set(ud->builder, "AudioSamplerate", hb_audio_rates, hb_audio_rates_count);
- video_rate_opts_set(ud->builder, "VideoFramerate", hb_video_rates, hb_video_rates_count);
- mix_opts_set(ud->builder, "AudioMixdown");
- hb_encoder_opts_set(ud->builder, "VideoEncoder", hb_video_encoders, hb_video_encoders_count);
- hb_encoder_opts_set(ud->builder, "AudioEncoder", hb_audio_encoders, hb_audio_encoders_count);
- acodec_fallback_opts_set(ud->builder, "AudioEncoderFallback");
- language_opts_set(ud->builder, "SrtLanguage");
- language_opts_set(ud->builder, "PreferredLanguage");
- srt_codeset_opts_set(ud->builder, "SrtCodeset");
- title_opts_set(ud->builder, "title");
- audio_track_opts_set(ud->builder, "AudioTrack", user_data);
- subtitle_track_opts_set(ud->builder, "SubtitleTrack", user_data);
- generic_opts_set(ud->builder, "VideoQualityGranularity", &vqual_granularity_opts);
- generic_opts_set(ud->builder, "PtoPType", &point_to_point_opts);
- generic_opts_set(ud->builder, "WhenComplete", &when_complete_opts);
- generic_opts_set(ud->builder, "PicturePAR", &par_opts);
- generic_opts_set(ud->builder, "PictureModulus", &alignment_opts);
- generic_opts_set(ud->builder, "LoggingLevel", &logging_opts);
- generic_opts_set(ud->builder, "LogLongevity", &log_longevity_opts);
- generic_opts_set(ud->builder, "check_updates", &appcast_update_opts);
- generic_opts_set(ud->builder, "FileFormat", &container_opts);
- generic_opts_set(ud->builder, "PictureDeinterlace", &deint_opts);
- generic_opts_set(ud->builder, "PictureDetelecine", &detel_opts);
- generic_opts_set(ud->builder, "PictureDecomb", &decomb_opts);
- generic_opts_set(ud->builder, "PictureDenoise", &denoise_opts);
- small_opts_set(ud->builder, "x264_direct", &direct_opts);
- small_opts_set(ud->builder, "x264_b_adapt", &badapt_opts);
- small_opts_set(ud->builder, "x264_bpyramid", &bpyramid_opts);
- small_opts_set(ud->builder, "x264_weighted_pframes", &weightp_opts);
- small_opts_set(ud->builder, "x264_me", &me_opts);
- small_opts_set(ud->builder, "x264_subme", &subme_opts);
- small_opts_set(ud->builder, "x264_analyse", &analyse_opts);
- small_opts_set(ud->builder, "x264_trellis", &trellis_opts);
- x264_tune_opts_set(ud->builder, "x264Tune");
- x264_profile_opts_set(ud->builder, "h264Profile");
- x264_level_opts_set(ud->builder, "h264Level");
- }
- else
- {
- if (strcmp(name, "AudioBitrate") == 0)
- audio_bitrate_opts_set(ud->builder, "AudioBitrate");
- else if (strcmp(name, "AudioSamplerate") == 0)
- audio_samplerate_opts_set(ud->builder, "AudioSamplerate", hb_audio_rates, hb_audio_rates_count);
- else if (strcmp(name, "VideoFramerate") == 0)
- video_rate_opts_set(ud->builder, "VideoFramerate", hb_video_rates, hb_video_rates_count);
- else if (strcmp(name, "AudioMixdown") == 0)
- mix_opts_set(ud->builder, "AudioMixdown");
- else if (strcmp(name, "VideoEncoder") == 0)
- hb_encoder_opts_set(ud->builder, "VideoEncoder", hb_video_encoders, hb_video_encoders_count);
- else if (strcmp(name, "AudioEncoder") == 0)
- hb_encoder_opts_set(ud->builder, "AudioEncoder", hb_audio_encoders, hb_audio_encoders_count);
- else if (strcmp(name, "AudioEncoderFallback") == 0)
- acodec_fallback_opts_set(ud->builder, "AudioEncoderFallback");
- else if (strcmp(name, "SrtLanguage") == 0)
- language_opts_set(ud->builder, "SrtLanguage");
- else if (strcmp(name, "PreferredLanguage") == 0)
- language_opts_set(ud->builder, "PreferredLanguage");
- else if (strcmp(name, "SrtCodeset") == 0)
- srt_codeset_opts_set(ud->builder, "SrtCodeset");
- else if (strcmp(name, "title") == 0)
- title_opts_set(ud->builder, "title");
- else if (strcmp(name, "SubtitleTrack") == 0)
- subtitle_track_opts_set(ud->builder, "SubtitleTrack", user_data);
- else if (strcmp(name, "AudioTrack") == 0)
- audio_track_opts_set(ud->builder, "AudioTrack", user_data);
- else if (strcmp(name, "x264Tune") == 0)
- x264_tune_opts_set(ud->builder, "x264Tune");
- else if (strcmp(name, "h264Profile") == 0)
- x264_profile_opts_set(ud->builder, "h264Profile");
- else if (strcmp(name, "h264Level") == 0)
- x264_level_opts_set(ud->builder, "h264Level");
- else
- generic_opts_set(ud->builder, name, find_combo_table(name));
- }
- if (handler_id > 0)
- {
- g_signal_handler_unblock ((gpointer)combo, handler_id);
- }
-}
-
+ signal_user_data_t *ud,
+ const gchar *name,
+ gint user_data,
+ gboolean all)
+{
+ GtkComboBox *combo = NULL;
+ gint signal_id;
+ gint handler_id = 0;
+
+ if (name != NULL)
+ {
+ g_debug("ghb_update_ui_combo_box() %s\n", name);
+ // Clearing a combo box causes a rash of "changed" events, even when
+ // the active item is -1 (inactive). To control things, I'm disabling
+ // the event till things are settled down.
+ combo = GTK_COMBO_BOX(GHB_WIDGET(ud->builder, name));
+ signal_id = g_signal_lookup("changed", GTK_TYPE_COMBO_BOX);
+ if (signal_id > 0)
+ {
+ // Valid signal id found. This should always succeed.
+ handler_id = g_signal_handler_find ((gpointer)combo, G_SIGNAL_MATCH_ID,
+ signal_id, 0, 0, 0, 0);
+ if (handler_id > 0)
+ {
+ // This should also always succeed
+ g_signal_handler_block ((gpointer)combo, handler_id);
+ }
+ }
+ }
+ if (all)
+ {
+ audio_bitrate_opts_set(ud->builder, "AudioBitrate");
+ audio_samplerate_opts_set(ud->builder, "AudioSamplerate", hb_audio_rates, hb_audio_rates_count);
+ video_rate_opts_set(ud->builder, "VideoFramerate", hb_video_rates, hb_video_rates_count);
+ mix_opts_set(ud->builder, "AudioMixdown");
+ hb_encoder_opts_set(ud->builder, "VideoEncoder", hb_video_encoders, hb_video_encoders_count);
+ hb_encoder_opts_set(ud->builder, "AudioEncoder", hb_audio_encoders, hb_audio_encoders_count);
+ acodec_fallback_opts_set(ud->builder, "AudioEncoderFallback");
+ language_opts_set(ud->builder, "SrtLanguage");
+ language_opts_set(ud->builder, "PreferredLanguage");
+ srt_codeset_opts_set(ud->builder, "SrtCodeset");
+ title_opts_set(ud->builder, "title");
+ audio_track_opts_set(ud->builder, "AudioTrack", user_data);
+ subtitle_track_opts_set(ud->builder, "SubtitleTrack", user_data);
+ generic_opts_set(ud->builder, "VideoQualityGranularity", &vqual_granularity_opts);
+ generic_opts_set(ud->builder, "PtoPType", &point_to_point_opts);
+ generic_opts_set(ud->builder, "WhenComplete", &when_complete_opts);
+ generic_opts_set(ud->builder, "PicturePAR", &par_opts);
+ generic_opts_set(ud->builder, "PictureModulus", &alignment_opts);
+ generic_opts_set(ud->builder, "LoggingLevel", &logging_opts);
+ generic_opts_set(ud->builder, "LogLongevity", &log_longevity_opts);
+ generic_opts_set(ud->builder, "check_updates", &appcast_update_opts);
+ generic_opts_set(ud->builder, "FileFormat", &container_opts);
+ generic_opts_set(ud->builder, "PictureDeinterlace", &deint_opts);
+ generic_opts_set(ud->builder, "PictureDetelecine", &detel_opts);
+ generic_opts_set(ud->builder, "PictureDecomb", &decomb_opts);
+ generic_opts_set(ud->builder, "PictureDenoise", &denoise_opts);
+ small_opts_set(ud->builder, "x264_direct", &direct_opts);
+ small_opts_set(ud->builder, "x264_b_adapt", &badapt_opts);
+ small_opts_set(ud->builder, "x264_bpyramid", &bpyramid_opts);
+ small_opts_set(ud->builder, "x264_weighted_pframes", &weightp_opts);
+ small_opts_set(ud->builder, "x264_me", &me_opts);
+ small_opts_set(ud->builder, "x264_subme", &subme_opts);
+ small_opts_set(ud->builder, "x264_analyse", &analyse_opts);
+ small_opts_set(ud->builder, "x264_trellis", &trellis_opts);
+ x264_tune_opts_set(ud->builder, "x264Tune");
+ x264_profile_opts_set(ud->builder, "h264Profile");
+ x264_level_opts_set(ud->builder, "h264Level");
+ }
+ else
+ {
+ if (strcmp(name, "AudioBitrate") == 0)
+ audio_bitrate_opts_set(ud->builder, "AudioBitrate");
+ else if (strcmp(name, "AudioSamplerate") == 0)
+ audio_samplerate_opts_set(ud->builder, "AudioSamplerate", hb_audio_rates, hb_audio_rates_count);
+ else if (strcmp(name, "VideoFramerate") == 0)
+ video_rate_opts_set(ud->builder, "VideoFramerate", hb_video_rates, hb_video_rates_count);
+ else if (strcmp(name, "AudioMixdown") == 0)
+ mix_opts_set(ud->builder, "AudioMixdown");
+ else if (strcmp(name, "VideoEncoder") == 0)
+ hb_encoder_opts_set(ud->builder, "VideoEncoder", hb_video_encoders, hb_video_encoders_count);
+ else if (strcmp(name, "AudioEncoder") == 0)
+ hb_encoder_opts_set(ud->builder, "AudioEncoder", hb_audio_encoders, hb_audio_encoders_count);
+ else if (strcmp(name, "AudioEncoderFallback") == 0)
+ acodec_fallback_opts_set(ud->builder, "AudioEncoderFallback");
+ else if (strcmp(name, "SrtLanguage") == 0)
+ language_opts_set(ud->builder, "SrtLanguage");
+ else if (strcmp(name, "PreferredLanguage") == 0)
+ language_opts_set(ud->builder, "PreferredLanguage");
+ else if (strcmp(name, "SrtCodeset") == 0)
+ srt_codeset_opts_set(ud->builder, "SrtCodeset");
+ else if (strcmp(name, "title") == 0)
+ title_opts_set(ud->builder, "title");
+ else if (strcmp(name, "SubtitleTrack") == 0)
+ subtitle_track_opts_set(ud->builder, "SubtitleTrack", user_data);
+ else if (strcmp(name, "AudioTrack") == 0)
+ audio_track_opts_set(ud->builder, "AudioTrack", user_data);
+ else if (strcmp(name, "x264Tune") == 0)
+ x264_tune_opts_set(ud->builder, "x264Tune");
+ else if (strcmp(name, "h264Profile") == 0)
+ x264_profile_opts_set(ud->builder, "h264Profile");
+ else if (strcmp(name, "h264Level") == 0)
+ x264_level_opts_set(ud->builder, "h264Level");
+ else
+ generic_opts_set(ud->builder, name, find_combo_table(name));
+ }
+ if (handler_id > 0)
+ {
+ g_signal_handler_unblock ((gpointer)combo, handler_id);
+ }
+}
+
static void
init_ui_combo_boxes(GtkBuilder *builder)
{
- gint ii;
-
- init_combo_box(builder, "AudioBitrate");
- init_combo_box(builder, "AudioSamplerate");
- init_combo_box(builder, "VideoFramerate");
- init_combo_box(builder, "AudioMixdown");
- init_combo_box(builder, "SrtLanguage");
- init_combo_box(builder, "PreferredLanguage");
- init_combo_box(builder, "SrtCodeset");
- init_combo_box(builder, "title");
- init_combo_box(builder, "AudioTrack");
- init_combo_box(builder, "VideoEncoder");
- init_combo_box(builder, "AudioEncoder");
- init_combo_box(builder, "AudioEncoderFallback");
- init_combo_box(builder, "x264Tune");
- init_combo_box(builder, "h264Profile");
- init_combo_box(builder, "h264Level");
- for (ii = 0; combo_name_map[ii].name != NULL; ii++)
- {
- init_combo_box(builder, combo_name_map[ii].name);
- }
+ gint ii;
+
+ init_combo_box(builder, "AudioBitrate");
+ init_combo_box(builder, "AudioSamplerate");
+ init_combo_box(builder, "VideoFramerate");
+ init_combo_box(builder, "AudioMixdown");
+ init_combo_box(builder, "SrtLanguage");
+ init_combo_box(builder, "PreferredLanguage");
+ init_combo_box(builder, "SrtCodeset");
+ init_combo_box(builder, "title");
+ init_combo_box(builder, "AudioTrack");
+ init_combo_box(builder, "VideoEncoder");
+ init_combo_box(builder, "AudioEncoder");
+ init_combo_box(builder, "AudioEncoderFallback");
+ init_combo_box(builder, "x264Tune");
+ init_combo_box(builder, "h264Profile");
+ init_combo_box(builder, "h264Level");
+ for (ii = 0; combo_name_map[ii].name != NULL; ii++)
+ {
+ init_combo_box(builder, combo_name_map[ii].name);
+ }
}
// Construct the advanced options string
@@ -3104,46 +3104,46 @@ init_ui_combo_boxes(GtkBuilder *builder)
gchar*
ghb_build_advanced_opts_string(GValue *settings)
{
- gchar *result;
-
- gint vcodec = ghb_settings_combo_int(settings, "VideoEncoder");
-
- switch (vcodec)
- {
- case HB_VCODEC_X264:
- {
- gchar *opts = ghb_settings_get_string(settings, "x264Option");
- if (opts != NULL)
- {
- result = opts;
- }
- else
- {
- result = g_strdup("");
- }
- } break;
-
- case HB_VCODEC_FFMPEG_MPEG2:
- case HB_VCODEC_FFMPEG_MPEG4:
- {
- gchar *opts = ghb_settings_get_string(settings, "lavcOption");
- if (opts != NULL)
- {
- result = opts;
- }
- else
- {
- result = g_strdup("");
- }
- } break;
-
- case HB_VCODEC_THEORA:
- default:
- {
- result = g_strdup("");
- } break;
- }
- return result;
+ gchar *result;
+
+ gint vcodec = ghb_settings_combo_int(settings, "VideoEncoder");
+
+ switch (vcodec)
+ {
+ case HB_VCODEC_X264:
+ {
+ gchar *opts = ghb_settings_get_string(settings, "x264Option");
+ if (opts != NULL)
+ {
+ result = opts;
+ }
+ else
+ {
+ result = g_strdup("");
+ }
+ } break;
+
+ case HB_VCODEC_FFMPEG_MPEG2:
+ case HB_VCODEC_FFMPEG_MPEG4:
+ {
+ gchar *opts = ghb_settings_get_string(settings, "lavcOption");
+ if (opts != NULL)
+ {
+ result = opts;
+ }
+ else
+ {
+ result = g_strdup("");
+ }
+ } break;
+
+ case HB_VCODEC_THEORA:
+ default:
+ {
+ result = g_strdup("");
+ } break;
+ }
+ return result;
}
void ghb_set_video_encoder_opts(hb_job_t *job, GValue *js)
@@ -3224,248 +3224,248 @@ void ghb_set_video_encoder_opts(hb_job_t *job, GValue *js)
void
ghb_part_duration(gint tt, gint sc, gint ec, gint *hh, gint *mm, gint *ss)
{
- hb_title_t * title;
- hb_chapter_t * chapter;
- gint count, c;
- gint64 duration;
-
- *hh = *mm = *ss = 0;
- title = ghb_get_title_info( tt );
- if (title == NULL) return;
+ hb_title_t * title;
+ hb_chapter_t * chapter;
+ gint count, c;
+ gint64 duration;
+
+ *hh = *mm = *ss = 0;
+ title = ghb_get_title_info( tt );
+ if (title == NULL) return;
- *hh = title->hours;
- *mm = title->minutes;
- *ss = title->seconds;
+ *hh = title->hours;
+ *mm = title->minutes;
+ *ss = title->seconds;
- count = hb_list_count(title->list_chapter);
- if (sc > count) sc = count;
- if (ec > count) ec = count;
+ count = hb_list_count(title->list_chapter);
+ if (sc > count) sc = count;
+ if (ec > count) ec = count;
- if (sc == 1 && ec == count)
- return;
+ if (sc == 1 && ec == count)
+ return;
- duration = 0;
- for (c = sc; c <= ec; c++)
- {
- chapter = hb_list_item(title->list_chapter, c-1);
- duration += chapter->duration;
- }
+ duration = 0;
+ for (c = sc; c <= ec; c++)
+ {
+ chapter = hb_list_item(title->list_chapter, c-1);
+ duration += chapter->duration;
+ }
- *hh = duration / 90000 / 3600;
- *mm = ((duration / 90000) % 3600) / 60;
- *ss = (duration / 90000) % 60;
+ *hh = duration / 90000 / 3600;
+ *mm = ((duration / 90000) % 3600) / 60;
+ *ss = (duration / 90000) % 60;
}
void
ghb_get_chapter_duration(gint ti, gint ii, gint *hh, gint *mm, gint *ss)
{
- hb_title_t * title;
- hb_chapter_t * chapter;
- gint count;
-
- g_debug("ghb_get_chapter_duration (title = %d)\n", ti);
- *hh = *mm = *ss = 0;
- title = ghb_get_title_info( ti );
- if (title == NULL) return;
- count = hb_list_count( title->list_chapter );
- if (ii >= count) return;
- chapter = hb_list_item(title->list_chapter, ii);
- if (chapter == NULL) return;
- *hh = chapter->hours;
- *mm = chapter->minutes;
- *ss = chapter->seconds;
+ hb_title_t * title;
+ hb_chapter_t * chapter;
+ gint count;
+
+ g_debug("ghb_get_chapter_duration (title = %d)\n", ti);
+ *hh = *mm = *ss = 0;
+ title = ghb_get_title_info( ti );
+ if (title == NULL) return;
+ count = hb_list_count( title->list_chapter );
+ if (ii >= count) return;
+ chapter = hb_list_item(title->list_chapter, ii);
+ if (chapter == NULL) return;
+ *hh = chapter->hours;
+ *mm = chapter->minutes;
+ *ss = chapter->seconds;
}
GValue*
ghb_get_chapters(gint titleindex)
{
- hb_title_t * title;
- hb_chapter_t * chapter;
- gint count, ii;
- GValue *chapters = NULL;
-
- g_debug("ghb_get_chapters (title = %d)\n", titleindex);
- chapters = ghb_array_value_new(0);
-
- title = ghb_get_title_info( titleindex );
- if (title == NULL) return chapters;
- count = hb_list_count( title->list_chapter );
- for (ii = 0; ii < count; ii++)
- {
- chapter = hb_list_item(title->list_chapter, ii);
- if (chapter == NULL) break;
- if (chapter->title == NULL || chapter->title[0] == 0)
- {
- gchar *str;
- str = g_strdup_printf ("Chapter %2d", ii+1);
- ghb_array_append(chapters, ghb_string_value_new(str));
- g_free(str);
- }
- else
- {
- ghb_array_append(chapters, ghb_string_value_new(chapter->title));
- }
- }
- return chapters;
+ hb_title_t * title;
+ hb_chapter_t * chapter;
+ gint count, ii;
+ GValue *chapters = NULL;
+
+ g_debug("ghb_get_chapters (title = %d)\n", titleindex);
+ chapters = ghb_array_value_new(0);
+
+ title = ghb_get_title_info( titleindex );
+ if (title == NULL) return chapters;
+ count = hb_list_count( title->list_chapter );
+ for (ii = 0; ii < count; ii++)
+ {
+ chapter = hb_list_item(title->list_chapter, ii);
+ if (chapter == NULL) break;
+ if (chapter->title == NULL || chapter->title[0] == 0)
+ {
+ gchar *str;
+ str = g_strdup_printf ("Chapter %2d", ii+1);
+ ghb_array_append(chapters, ghb_string_value_new(str));
+ g_free(str);
+ }
+ else
+ {
+ ghb_array_append(chapters, ghb_string_value_new(chapter->title));
+ }
+ }
+ return chapters;
}
gboolean
ghb_ac3_in_audio_list(const GValue *audio_list)
{
- gint count, ii;
+ gint count, ii;
- count = ghb_array_len(audio_list);
- for (ii = 0; ii < count; ii++)
- {
- GValue *asettings;
- gint acodec;
+ count = ghb_array_len(audio_list);
+ for (ii = 0; ii < count; ii++)
+ {
+ GValue *asettings;
+ gint acodec;
- asettings = ghb_array_get_nth(audio_list, ii);
- acodec = ghb_settings_combo_int(asettings, "AudioEncoder");
- if (acodec & HB_ACODEC_AC3)
- return TRUE;
- }
- return FALSE;
+ asettings = ghb_array_get_nth(audio_list, ii);
+ acodec = ghb_settings_combo_int(asettings, "AudioEncoder");
+ if (acodec & HB_ACODEC_AC3)
+ return TRUE;
+ }
+ return FALSE;
}
static void
audio_bitrate_opts_add(GtkBuilder *builder, const gchar *name, gint rate)
{
- GtkTreeIter iter;
- GtkListStore *store;
- gchar *str;
-
- g_debug("audio_bitrate_opts_add ()\n");
-
- if (rate >= 0 && rate < 8) return;
-
- if (ghb_audio_bitrates[hb_audio_bitrates_count].string)
- {
- g_free(ghb_audio_bitrates[hb_audio_bitrates_count].string);
- }
- ghb_audio_bitrates[hb_audio_bitrates_count].rate = rate;
- if (rate < 0)
- {
- ghb_audio_bitrates[hb_audio_bitrates_count].string =
- g_strdup_printf("N/A");
- }
- else
- {
- ghb_audio_bitrates[hb_audio_bitrates_count].string =
- g_strdup_printf("%d", rate);
- }
- ghb_audio_bitrates_count = hb_audio_bitrates_count + 1;
-
- store = get_combo_box_store(builder, name);
- if (!find_combo_item_by_int(GTK_TREE_MODEL(store), rate, &iter))
- {
- str = g_strdup_printf ("<small>%s</small>",
- ghb_audio_bitrates[hb_audio_bitrates_count].string);
- gtk_list_store_append(store, &iter);
- gtk_list_store_set(store, &iter,
- 0, str,
- 1, TRUE,
- 2, ghb_audio_bitrates[hb_audio_bitrates_count].string,
- 3, (gdouble)rate,
- 4, ghb_audio_bitrates[hb_audio_bitrates_count].string,
- -1);
- g_free(str);
- }
+ GtkTreeIter iter;
+ GtkListStore *store;
+ gchar *str;
+
+ g_debug("audio_bitrate_opts_add ()\n");
+
+ if (rate >= 0 && rate < 8) return;
+
+ if (ghb_audio_bitrates[hb_audio_bitrates_count].string)
+ {
+ g_free(ghb_audio_bitrates[hb_audio_bitrates_count].string);
+ }
+ ghb_audio_bitrates[hb_audio_bitrates_count].rate = rate;
+ if (rate < 0)
+ {
+ ghb_audio_bitrates[hb_audio_bitrates_count].string =
+ g_strdup_printf("N/A");
+ }
+ else
+ {
+ ghb_audio_bitrates[hb_audio_bitrates_count].string =
+ g_strdup_printf("%d", rate);
+ }
+ ghb_audio_bitrates_count = hb_audio_bitrates_count + 1;
+
+ store = get_combo_box_store(builder, name);
+ if (!find_combo_item_by_int(GTK_TREE_MODEL(store), rate, &iter))
+ {
+ str = g_strdup_printf ("<small>%s</small>",
+ ghb_audio_bitrates[hb_audio_bitrates_count].string);
+ gtk_list_store_append(store, &iter);
+ gtk_list_store_set(store, &iter,
+ 0, str,
+ 1, TRUE,
+ 2, ghb_audio_bitrates[hb_audio_bitrates_count].string,
+ 3, (gdouble)rate,
+ 4, ghb_audio_bitrates[hb_audio_bitrates_count].string,
+ -1);
+ g_free(str);
+ }
}
static void
audio_bitrate_opts_update(
- GtkBuilder *builder,
- const gchar *name,
- gint first_rate,
- gint last_rate,
- gint extra_rate)
-{
- GtkTreeIter iter;
- GtkListStore *store;
- gdouble ivalue;
- gboolean done = FALSE;
- gint ii = 0;
- guint last = (guint)last_rate;
- guint first = (guint)first_rate;
-
- ghb_audio_bitrates_count = hb_audio_bitrates_count;
-
- g_debug("audio_bitrate_opts_clean ()\n");
- store = get_combo_box_store(builder, name);
- if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL(store), &iter))
- {
- do
- {
- gtk_tree_model_get(GTK_TREE_MODEL(store), &iter, 3, &ivalue, -1);
- if (ivalue != first_rate && ivalue != last_rate &&
- !(ivalue == extra_rate && extra_rate >= first_rate) &&
- search_rates(
- ghb_audio_bitrates, ivalue, ghb_audio_bitrates_count) < 0)
- {
- done = !gtk_list_store_remove(store, &iter);
- }
- else if ((int)ivalue < first || (int)ivalue > last)
- {
- ii++;
- gtk_list_store_set(store, &iter, 1, FALSE, -1);
- done = !gtk_tree_model_iter_next (GTK_TREE_MODEL(store), &iter);
- }
- else
- {
- ii++;
- gtk_list_store_set(store, &iter, 1, TRUE, -1);
- done = !gtk_tree_model_iter_next (GTK_TREE_MODEL(store), &iter);
- }
- } while (!done);
- }
- if (extra_rate >= first_rate)
- audio_bitrate_opts_add(builder, name, extra_rate);
+ GtkBuilder *builder,
+ const gchar *name,
+ gint first_rate,
+ gint last_rate,
+ gint extra_rate)
+{
+ GtkTreeIter iter;
+ GtkListStore *store;
+ gdouble ivalue;
+ gboolean done = FALSE;
+ gint ii = 0;
+ guint last = (guint)last_rate;
+ guint first = (guint)first_rate;
+
+ ghb_audio_bitrates_count = hb_audio_bitrates_count;
+
+ g_debug("audio_bitrate_opts_clean ()\n");
+ store = get_combo_box_store(builder, name);
+ if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL(store), &iter))
+ {
+ do
+ {
+ gtk_tree_model_get(GTK_TREE_MODEL(store), &iter, 3, &ivalue, -1);
+ if (ivalue != first_rate && ivalue != last_rate &&
+ !(ivalue == extra_rate && extra_rate >= first_rate) &&
+ search_rates(
+ ghb_audio_bitrates, ivalue, ghb_audio_bitrates_count) < 0)
+ {
+ done = !gtk_list_store_remove(store, &iter);
+ }
+ else if ((int)ivalue < first || (int)ivalue > last)
+ {
+ ii++;
+ gtk_list_store_set(store, &iter, 1, FALSE, -1);
+ done = !gtk_tree_model_iter_next (GTK_TREE_MODEL(store), &iter);
+ }
+ else
+ {
+ ii++;
+ gtk_list_store_set(store, &iter, 1, TRUE, -1);
+ done = !gtk_tree_model_iter_next (GTK_TREE_MODEL(store), &iter);
+ }
+ } while (!done);
+ }
+ if (extra_rate >= first_rate)
+ audio_bitrate_opts_add(builder, name, extra_rate);
}
static void
audio_bitrate_opts_set(GtkBuilder *builder, const gchar *name)
{
- GtkTreeIter iter;
- GtkListStore *store;
- gint ii;
- gchar *str;
-
- ghb_audio_bitrates_count = hb_audio_bitrates_count;
- ghb_audio_bitrates = calloc(hb_audio_bitrates_count+1, sizeof(hb_rate_t));
-
- for (ii = 0; ii < hb_audio_bitrates_count; ii++)
- {
- ghb_audio_bitrates[ii] = hb_audio_bitrates[ii];
- }
-
- g_debug("audio_bitrate_opts_set ()\n");
- store = get_combo_box_store(builder, name);
- gtk_list_store_clear(store);
- for (ii = 0; ii < ghb_audio_bitrates_count; ii++)
- {
- gtk_list_store_append(store, &iter);
- str = g_strdup_printf ("<small>%s</small>",
- ghb_audio_bitrates[ii].string);
- gtk_list_store_set(store, &iter,
- 0, str,
- 1, TRUE,
- 2, ghb_audio_bitrates[ii].string,
- 3, (gdouble)ghb_audio_bitrates[ii].rate,
- 4, ghb_audio_bitrates[ii].string,
- -1);
- g_free(str);
- }
+ GtkTreeIter iter;
+ GtkListStore *store;
+ gint ii;
+ gchar *str;
+
+ ghb_audio_bitrates_count = hb_audio_bitrates_count;
+ ghb_audio_bitrates = calloc(hb_audio_bitrates_count+1, sizeof(hb_rate_t));
+
+ for (ii = 0; ii < hb_audio_bitrates_count; ii++)
+ {
+ ghb_audio_bitrates[ii] = hb_audio_bitrates[ii];
+ }
+
+ g_debug("audio_bitrate_opts_set ()\n");
+ store = get_combo_box_store(builder, name);
+ gtk_list_store_clear(store);
+ for (ii = 0; ii < ghb_audio_bitrates_count; ii++)
+ {
+ gtk_list_store_append(store, &iter);
+ str = g_strdup_printf ("<small>%s</small>",
+ ghb_audio_bitrates[ii].string);
+ gtk_list_store_set(store, &iter,
+ 0, str,
+ 1, TRUE,
+ 2, ghb_audio_bitrates[ii].string,
+ 3, (gdouble)ghb_audio_bitrates[ii].rate,
+ 4, ghb_audio_bitrates[ii].string,
+ -1);
+ g_free(str);
+ }
}
void
ghb_set_bitrate_opts(
- GtkBuilder *builder,
- gint first_rate,
- gint last_rate,
- gint extra_rate)
+ GtkBuilder *builder,
+ gint first_rate,
+ gint last_rate,
+ gint extra_rate)
{
- audio_bitrate_opts_update(builder, "AudioBitrate", first_rate, last_rate, extra_rate);
+ audio_bitrate_opts_update(builder, "AudioBitrate", first_rate, last_rate, extra_rate);
}
static ghb_status_t hb_status;
@@ -3473,10 +3473,10 @@ static ghb_status_t hb_status;
void
ghb_combo_init(signal_user_data_t *ud)
{
- // Set up the list model for the combos
- init_ui_combo_boxes(ud->builder);
- // Populate all the combos
- ghb_update_ui_combo_box(ud, NULL, 0, TRUE);
+ // Set up the list model for the combos
+ init_ui_combo_boxes(ud->builder);
+ // Populate all the combos
+ ghb_update_ui_combo_box(ud, NULL, 0, TRUE);
}
void
@@ -3490,9 +3490,9 @@ ghb_backend_init(gint debug)
void
ghb_backend_close()
{
- hb_close(&h_queue);
- hb_close(&h_scan);
- hb_global_close();
+ hb_close(&h_queue);
+ hb_close(&h_scan);
+ hb_global_close();
}
void ghb_backend_scan_stop()
@@ -3504,61 +3504,61 @@ void
ghb_backend_scan(const gchar *path, gint titleindex, gint preview_count, uint64_t min_duration)
{
hb_scan( h_scan, path, titleindex, preview_count, 1, min_duration );
- hb_status.scan.state |= GHB_STATE_SCANNING;
- // initialize count and cur to something that won't cause FPE
- // when computing progress
- hb_status.scan.title_count = 1;
- hb_status.scan.title_cur = 0;
+ hb_status.scan.state |= GHB_STATE_SCANNING;
+ // initialize count and cur to something that won't cause FPE
+ // when computing progress
+ hb_status.scan.title_count = 1;
+ hb_status.scan.title_cur = 0;
}
void
ghb_backend_queue_scan(const gchar *path, gint titlenum)
{
- g_debug("ghb_backend_queue_scan()");
- hb_scan( h_queue, path, titlenum, 10, 0, 0 );
- hb_status.queue.state |= GHB_STATE_SCANNING;
+ g_debug("ghb_backend_queue_scan()");
+ hb_scan( h_queue, path, titlenum, 10, 0, 0 );
+ hb_status.queue.state |= GHB_STATE_SCANNING;
}
gint
ghb_get_scan_state()
{
- return hb_status.scan.state;
+ return hb_status.scan.state;
}
gint
ghb_get_queue_state()
{
- return hb_status.queue.state;
+ return hb_status.queue.state;
}
void
ghb_clear_scan_state(gint state)
{
- hb_status.scan.state &= ~state;
+ hb_status.scan.state &= ~state;
}
void
ghb_clear_queue_state(gint state)
{
- hb_status.queue.state &= ~state;
+ hb_status.queue.state &= ~state;
}
void
ghb_set_scan_state(gint state)
{
- hb_status.scan.state |= state;
+ hb_status.scan.state |= state;
}
void
ghb_set_queue_state(gint state)
{
- hb_status.queue.state |= state;
+ hb_status.queue.state |= state;
}
void
ghb_get_status(ghb_status_t *status)
{
- memcpy(status, &hb_status, sizeof(ghb_status_t));
+ memcpy(status, &hb_status, sizeof(ghb_status_t));
}
void
@@ -3567,170 +3567,170 @@ ghb_track_status()
hb_state_t s_scan;
hb_state_t s_queue;
- if (h_scan == NULL) return;
+ if (h_scan == NULL) return;
hb_get_state( h_scan, &s_scan );
- switch( s_scan.state )
+ switch( s_scan.state )
{
#define p s_scan.param.scanning
case HB_STATE_SCANNING:
- {
- hb_status.scan.state |= GHB_STATE_SCANNING;
- hb_status.scan.title_count = p.title_count;
- hb_status.scan.title_cur = p.title_cur;
- } break;
+ {
+ hb_status.scan.state |= GHB_STATE_SCANNING;
+ hb_status.scan.title_count = p.title_count;
+ hb_status.scan.title_cur = p.title_cur;
+ } break;
#undef p
case HB_STATE_SCANDONE:
{
- hb_status.scan.state &= ~GHB_STATE_SCANNING;
- hb_status.scan.state |= GHB_STATE_SCANDONE;
+ hb_status.scan.state &= ~GHB_STATE_SCANNING;
+ hb_status.scan.state |= GHB_STATE_SCANDONE;
} break;
#define p s_scan.param.working
case HB_STATE_WORKING:
- hb_status.scan.state |= GHB_STATE_WORKING;
- hb_status.scan.state &= ~GHB_STATE_PAUSED;
- hb_status.scan.job_cur = p.job_cur;
- hb_status.scan.job_count = p.job_count;
- hb_status.scan.progress = p.progress;
- hb_status.scan.rate_cur = p.rate_cur;
- hb_status.scan.rate_avg = p.rate_avg;
- hb_status.scan.hours = p.hours;
- hb_status.scan.minutes = p.minutes;
- hb_status.scan.seconds = p.seconds;
- hb_status.scan.unique_id = p.sequence_id & 0xFFFFFF;
+ hb_status.scan.state |= GHB_STATE_WORKING;
+ hb_status.scan.state &= ~GHB_STATE_PAUSED;
+ hb_status.scan.job_cur = p.job_cur;
+ hb_status.scan.job_count = p.job_count;
+ hb_status.scan.progress = p.progress;
+ hb_status.scan.rate_cur = p.rate_cur;
+ hb_status.scan.rate_avg = p.rate_avg;
+ hb_status.scan.hours = p.hours;
+ hb_status.scan.minutes = p.minutes;
+ hb_status.scan.seconds = p.seconds;
+ hb_status.scan.unique_id = p.sequence_id & 0xFFFFFF;
break;
#undef p
case HB_STATE_PAUSED:
- hb_status.scan.state |= GHB_STATE_PAUSED;
+ hb_status.scan.state |= GHB_STATE_PAUSED;
break;
-
+
case HB_STATE_MUXING:
{
- hb_status.scan.state |= GHB_STATE_MUXING;
+ hb_status.scan.state |= GHB_STATE_MUXING;
} break;
#define p s_scan.param.workdone
case HB_STATE_WORKDONE:
- {
+ {
hb_job_t *job;
- hb_status.scan.state |= GHB_STATE_WORKDONE;
- hb_status.scan.state &= ~GHB_STATE_MUXING;
- hb_status.scan.state &= ~GHB_STATE_PAUSED;
- hb_status.scan.state &= ~GHB_STATE_WORKING;
- switch (p.error)
- {
- case HB_ERROR_NONE:
- hb_status.scan.error = GHB_ERROR_NONE;
- break;
- case HB_ERROR_CANCELED:
- hb_status.scan.error = GHB_ERROR_CANCELED;
- break;
- default:
- hb_status.scan.error = GHB_ERROR_FAIL;
- break;
- }
- // Delete all remaining jobs of this encode.
- // An encode can be composed of multiple associated jobs.
- // When a job is stopped, libhb removes it from the job list,
- // but does not remove other jobs that may be associated with it.
- // Associated jobs are taged in the sequence id.
+ hb_status.scan.state |= GHB_STATE_WORKDONE;
+ hb_status.scan.state &= ~GHB_STATE_MUXING;
+ hb_status.scan.state &= ~GHB_STATE_PAUSED;
+ hb_status.scan.state &= ~GHB_STATE_WORKING;
+ switch (p.error)
+ {
+ case HB_ERROR_NONE:
+ hb_status.scan.error = GHB_ERROR_NONE;
+ break;
+ case HB_ERROR_CANCELED:
+ hb_status.scan.error = GHB_ERROR_CANCELED;
+ break;
+ default:
+ hb_status.scan.error = GHB_ERROR_FAIL;
+ break;
+ }
+ // Delete all remaining jobs of this encode.
+ // An encode can be composed of multiple associated jobs.
+ // When a job is stopped, libhb removes it from the job list,
+ // but does not remove other jobs that may be associated with it.
+ // Associated jobs are taged in the sequence id.
while ((job = hb_job(h_scan, 0)) != NULL)
hb_rem( h_scan, job );
- } break;
+ } break;
#undef p
}
hb_get_state( h_queue, &s_queue );
- switch( s_queue.state )
+ switch( s_queue.state )
{
#define p s_queue.param.scanning
case HB_STATE_SCANNING:
- {
- hb_status.queue.state |= GHB_STATE_SCANNING;
- hb_status.queue.title_count = p.title_count;
- hb_status.queue.title_cur = p.title_cur;
- } break;
+ {
+ hb_status.queue.state |= GHB_STATE_SCANNING;
+ hb_status.queue.title_count = p.title_count;
+ hb_status.queue.title_cur = p.title_cur;
+ } break;
#undef p
case HB_STATE_SCANDONE:
{
- hb_status.queue.state &= ~GHB_STATE_SCANNING;
- hb_status.queue.state |= GHB_STATE_SCANDONE;
+ hb_status.queue.state &= ~GHB_STATE_SCANNING;
+ hb_status.queue.state |= GHB_STATE_SCANDONE;
} break;
#define p s_queue.param.working
case HB_STATE_WORKING:
- hb_status.queue.state |= GHB_STATE_WORKING;
- hb_status.queue.state &= ~GHB_STATE_PAUSED;
- hb_status.queue.state &= ~GHB_STATE_SEARCHING;
- hb_status.queue.job_cur = p.job_cur;
- hb_status.queue.job_count = p.job_count;
- hb_status.queue.progress = p.progress;
- hb_status.queue.rate_cur = p.rate_cur;
- hb_status.queue.rate_avg = p.rate_avg;
- hb_status.queue.hours = p.hours;
- hb_status.queue.minutes = p.minutes;
- hb_status.queue.seconds = p.seconds;
- hb_status.queue.unique_id = p.sequence_id & 0xFFFFFF;
+ hb_status.queue.state |= GHB_STATE_WORKING;
+ hb_status.queue.state &= ~GHB_STATE_PAUSED;
+ hb_status.queue.state &= ~GHB_STATE_SEARCHING;
+ hb_status.queue.job_cur = p.job_cur;
+ hb_status.queue.job_count = p.job_count;
+ hb_status.queue.progress = p.progress;
+ hb_status.queue.rate_cur = p.rate_cur;
+ hb_status.queue.rate_avg = p.rate_avg;
+ hb_status.queue.hours = p.hours;
+ hb_status.queue.minutes = p.minutes;
+ hb_status.queue.seconds = p.seconds;
+ hb_status.queue.unique_id = p.sequence_id & 0xFFFFFF;
break;
case HB_STATE_SEARCHING:
- hb_status.queue.state |= GHB_STATE_SEARCHING;
- hb_status.queue.state &= ~GHB_STATE_WORKING;
- hb_status.queue.state &= ~GHB_STATE_PAUSED;
- hb_status.queue.job_cur = p.job_cur;
- hb_status.queue.job_count = p.job_count;
- hb_status.queue.progress = p.progress;
- hb_status.queue.rate_cur = p.rate_cur;
- hb_status.queue.rate_avg = p.rate_avg;
- hb_status.queue.hours = p.hours;
- hb_status.queue.minutes = p.minutes;
- hb_status.queue.seconds = p.seconds;
- hb_status.queue.unique_id = p.sequence_id & 0xFFFFFF;
+ hb_status.queue.state |= GHB_STATE_SEARCHING;
+ hb_status.queue.state &= ~GHB_STATE_WORKING;
+ hb_status.queue.state &= ~GHB_STATE_PAUSED;
+ hb_status.queue.job_cur = p.job_cur;
+ hb_status.queue.job_count = p.job_count;
+ hb_status.queue.progress = p.progress;
+ hb_status.queue.rate_cur = p.rate_cur;
+ hb_status.queue.rate_avg = p.rate_avg;
+ hb_status.queue.hours = p.hours;
+ hb_status.queue.minutes = p.minutes;
+ hb_status.queue.seconds = p.seconds;
+ hb_status.queue.unique_id = p.sequence_id & 0xFFFFFF;
break;
#undef p
case HB_STATE_PAUSED:
- hb_status.queue.state |= GHB_STATE_PAUSED;
+ hb_status.queue.state |= GHB_STATE_PAUSED;
break;
-
+
case HB_STATE_MUXING:
{
- hb_status.queue.state |= GHB_STATE_MUXING;
+ hb_status.queue.state |= GHB_STATE_MUXING;
} break;
#define p s_queue.param.workdone
case HB_STATE_WORKDONE:
- {
+ {
hb_job_t *job;
- hb_status.queue.state |= GHB_STATE_WORKDONE;
- hb_status.queue.state &= ~GHB_STATE_MUXING;
- hb_status.queue.state &= ~GHB_STATE_PAUSED;
- hb_status.queue.state &= ~GHB_STATE_WORKING;
- hb_status.queue.state &= ~GHB_STATE_SEARCHING;
- switch (p.error)
- {
- case HB_ERROR_NONE:
- hb_status.queue.error = GHB_ERROR_NONE;
- break;
- case HB_ERROR_CANCELED:
- hb_status.queue.error = GHB_ERROR_CANCELED;
- break;
- default:
- hb_status.queue.error = GHB_ERROR_FAIL;
- break;
- }
- // Delete all remaining jobs of this encode.
- // An encode can be composed of multiple associated jobs.
- // When a job is stopped, libhb removes it from the job list,
- // but does not remove other jobs that may be associated with it.
- // Associated jobs are taged in the sequence id.
+ hb_status.queue.state |= GHB_STATE_WORKDONE;
+ hb_status.queue.state &= ~GHB_STATE_MUXING;
+ hb_status.queue.state &= ~GHB_STATE_PAUSED;
+ hb_status.queue.state &= ~GHB_STATE_WORKING;
+ hb_status.queue.state &= ~GHB_STATE_SEARCHING;
+ switch (p.error)
+ {
+ case HB_ERROR_NONE:
+ hb_status.queue.error = GHB_ERROR_NONE;
+ break;
+ case HB_ERROR_CANCELED:
+ hb_status.queue.error = GHB_ERROR_CANCELED;
+ break;
+ default:
+ hb_status.queue.error = GHB_ERROR_FAIL;
+ break;
+ }
+ // Delete all remaining jobs of this encode.
+ // An encode can be composed of multiple associated jobs.
+ // When a job is stopped, libhb removes it from the job list,
+ // but does not remove other jobs that may be associated with it.
+ // Associated jobs are taged in the sequence id.
while ((job = hb_job(h_queue, 0)) != NULL)
hb_rem( h_queue, job );
- } break;
+ } break;
#undef p
}
}
@@ -3738,83 +3738,83 @@ ghb_track_status()
hb_title_t *
ghb_get_title_info(gint titleindex)
{
- hb_list_t * list;
+ hb_list_t * list;
- if (h_scan == NULL) return NULL;
- list = hb_get_titles( h_scan );
- if (list == NULL) return NULL;
- return hb_list_item( list, titleindex );
+ if (h_scan == NULL) return NULL;
+ list = hb_get_titles( h_scan );
+ if (list == NULL) return NULL;
+ return hb_list_item( list, titleindex );
}
hb_audio_config_t*
ghb_get_scan_audio_info(gint titleindex, gint audioindex)
{
hb_audio_config_t *aconfig;
-
- aconfig = get_hb_audio(h_scan, titleindex, audioindex);
- return aconfig;
+
+ aconfig = get_hb_audio(h_scan, titleindex, audioindex);
+ return aconfig;
}
gboolean
ghb_audio_is_passthru(gint acodec)
{
- g_debug("ghb_audio_is_passthru () \n");
- return (acodec & HB_ACODEC_PASS_FLAG) != 0;
+ g_debug("ghb_audio_is_passthru () \n");
+ return (acodec & HB_ACODEC_PASS_FLAG) != 0;
}
gboolean
ghb_audio_can_passthru(gint acodec)
{
- g_debug("ghb_audio_can_passthru () \n");
- return (acodec & HB_ACODEC_PASS_MASK) != 0;
+ g_debug("ghb_audio_can_passthru () \n");
+ return (acodec & HB_ACODEC_PASS_MASK) != 0;
}
gint
ghb_get_default_acodec()
{
- return HB_ACODEC_FAAC;
+ return HB_ACODEC_FAAC;
}
static void
picture_settings_deps(signal_user_data_t *ud)
{
- gboolean autoscale, keep_aspect, enable_keep_aspect;
- gboolean enable_scale_width, enable_scale_height;
- gboolean enable_disp_width, enable_disp_height, enable_par;
- gint pic_par;
- GtkWidget *widget;
-
- pic_par = ghb_settings_combo_int(ud->settings, "PicturePAR");
- enable_keep_aspect = (pic_par != 1 && pic_par != 2);
- keep_aspect = ghb_settings_get_boolean(ud->settings, "PictureKeepRatio");
- autoscale = ghb_settings_get_boolean(ud->settings, "autoscale");
-
- enable_scale_width = !autoscale && (pic_par != 1);
- enable_scale_height = !autoscale && (pic_par != 1);
- enable_disp_width = (pic_par == 3) && !keep_aspect;
- enable_par = (pic_par == 3) && !keep_aspect;
- enable_disp_height = FALSE;
-
- widget = GHB_WIDGET(ud->builder, "PictureModulus");
- gtk_widget_set_sensitive(widget, pic_par != 1);
- widget = GHB_WIDGET(ud->builder, "PictureLooseCrop");
- gtk_widget_set_sensitive(widget, pic_par != 1);
- widget = GHB_WIDGET(ud->builder, "scale_width");
- gtk_widget_set_sensitive(widget, enable_scale_width);
- widget = GHB_WIDGET(ud->builder, "scale_height");
- gtk_widget_set_sensitive(widget, enable_scale_height);
- widget = GHB_WIDGET(ud->builder, "PictureDisplayWidth");
- gtk_widget_set_sensitive(widget, enable_disp_width);
- widget = GHB_WIDGET(ud->builder, "PictureDisplayHeight");
- gtk_widget_set_sensitive(widget, enable_disp_height);
- widget = GHB_WIDGET(ud->builder, "PicturePARWidth");
- gtk_widget_set_sensitive(widget, enable_par);
- widget = GHB_WIDGET(ud->builder, "PicturePARHeight");
- gtk_widget_set_sensitive(widget, enable_par);
- widget = GHB_WIDGET(ud->builder, "PictureKeepRatio");
- gtk_widget_set_sensitive(widget, enable_keep_aspect);
- widget = GHB_WIDGET(ud->builder, "autoscale");
- gtk_widget_set_sensitive(widget, pic_par != 1);
+ gboolean autoscale, keep_aspect, enable_keep_aspect;
+ gboolean enable_scale_width, enable_scale_height;
+ gboolean enable_disp_width, enable_disp_height, enable_par;
+ gint pic_par;
+ GtkWidget *widget;
+
+ pic_par = ghb_settings_combo_int(ud->settings, "PicturePAR");
+ enable_keep_aspect = (pic_par != 1 && pic_par != 2);
+ keep_aspect = ghb_settings_get_boolean(ud->settings, "PictureKeepRatio");
+ autoscale = ghb_settings_get_boolean(ud->settings, "autoscale");
+
+ enable_scale_width = !autoscale && (pic_par != 1);
+ enable_scale_height = !autoscale && (pic_par != 1);
+ enable_disp_width = (pic_par == 3) && !keep_aspect;
+ enable_par = (pic_par == 3) && !keep_aspect;
+ enable_disp_height = FALSE;
+
+ widget = GHB_WIDGET(ud->builder, "PictureModulus");
+ gtk_widget_set_sensitive(widget, pic_par != 1);
+ widget = GHB_WIDGET(ud->builder, "PictureLooseCrop");
+ gtk_widget_set_sensitive(widget, pic_par != 1);
+ widget = GHB_WIDGET(ud->builder, "scale_width");
+ gtk_widget_set_sensitive(widget, enable_scale_width);
+ widget = GHB_WIDGET(ud->builder, "scale_height");
+ gtk_widget_set_sensitive(widget, enable_scale_height);
+ widget = GHB_WIDGET(ud->builder, "PictureDisplayWidth");
+ gtk_widget_set_sensitive(widget, enable_disp_width);
+ widget = GHB_WIDGET(ud->builder, "PictureDisplayHeight");
+ gtk_widget_set_sensitive(widget, enable_disp_height);
+ widget = GHB_WIDGET(ud->builder, "PicturePARWidth");
+ gtk_widget_set_sensitive(widget, enable_par);
+ widget = GHB_WIDGET(ud->builder, "PicturePARHeight");
+ gtk_widget_set_sensitive(widget, enable_par);
+ widget = GHB_WIDGET(ud->builder, "PictureKeepRatio");
+ gtk_widget_set_sensitive(widget, enable_keep_aspect);
+ widget = GHB_WIDGET(ud->builder, "autoscale");
+ gtk_widget_set_sensitive(widget, pic_par != 1);
}
void
@@ -3840,1089 +3840,1089 @@ ghb_limit_rational( gint *num, gint *den, gint limit )
void
ghb_set_scale_settings(GValue *settings, gint mode)
{
- hb_title_t * title;
- hb_job_t * job;
- gboolean keep_aspect;
- gint pic_par;
- gboolean autocrop, autoscale, noscale;
- gint crop[4] = {0,};
- gint width, height, par_width, par_height;
- gint crop_width, crop_height;
- gint aspect_n, aspect_d;
- gboolean keep_width = (mode & GHB_PIC_KEEP_WIDTH);
- gboolean keep_height = (mode & GHB_PIC_KEEP_HEIGHT);
- gint mod;
- gint max_width = 0;
- gint max_height = 0;
-
- g_debug("ghb_set_scale ()\n");
-
- pic_par = ghb_settings_combo_int(settings, "PicturePAR");
- if (pic_par == 1)
- {
- ghb_settings_set_boolean(settings, "autoscale", TRUE);
- ghb_settings_set_int(settings, "PictureModulus", 2);
- ghb_settings_set_boolean(settings, "PictureLooseCrop", TRUE);
- }
- if (pic_par == 1 || pic_par == 2)
- {
- ghb_settings_set_boolean(settings, "PictureKeepRatio", TRUE);
- }
-
- gint titleindex;
-
- titleindex = ghb_settings_combo_int(settings, "title");
- title = ghb_get_title_info (titleindex);
- if (title == NULL) return;
-
- job = hb_job_init( title );
- if (job == NULL) return;
-
- // First configure widgets
- mod = ghb_settings_combo_int(settings, "PictureModulus");
- keep_aspect = ghb_settings_get_boolean(settings, "PictureKeepRatio");
- autocrop = ghb_settings_get_boolean(settings, "PictureAutoCrop");
- autoscale = ghb_settings_get_boolean(settings, "autoscale");
- // "Noscale" is a flag that says we prefer to crop extra to satisfy
- // alignment constraints rather than scaling to satisfy them.
- noscale = ghb_settings_get_boolean(settings, "PictureLooseCrop");
- // Align dimensions to either 16 or 2 pixels
- // The scaler crashes if the dimensions are not divisible by 2
- // x264 also will not accept dims that are not multiple of 2
- if (autoscale)
- {
- keep_width = FALSE;
- keep_height = FALSE;
- }
-
- if (autocrop)
- {
- crop[0] = title->crop[0];
- crop[1] = title->crop[1];
- crop[2] = title->crop[2];
- crop[3] = title->crop[3];
- ghb_settings_set_int(settings, "PictureTopCrop", crop[0]);
- ghb_settings_set_int(settings, "PictureBottomCrop", crop[1]);
- ghb_settings_set_int(settings, "PictureLeftCrop", crop[2]);
- ghb_settings_set_int(settings, "PictureRightCrop", crop[3]);
- }
- else
- {
- crop[0] = ghb_settings_get_int(settings, "PictureTopCrop");
- crop[1] = ghb_settings_get_int(settings, "PictureBottomCrop");
- crop[2] = ghb_settings_get_int(settings, "PictureLeftCrop");
- crop[3] = ghb_settings_get_int(settings, "PictureRightCrop");
- }
- if (noscale)
- {
- gint need1, need2;
-
- // Adjust the cropping to accomplish the desired width and height
- crop_width = title->width - crop[2] - crop[3];
- crop_height = title->height - crop[0] - crop[1];
- width = MOD_DOWN(crop_width, mod);
- height = MOD_DOWN(crop_height, mod);
-
- need1 = (crop_height - height) / 2;
- need2 = crop_height - height - need1;
- crop[0] += need1;
- crop[1] += need2;
- need1 = (crop_width - width) / 2;
- need2 = crop_width - width - need1;
- crop[2] += need1;
- crop[3] += need2;
- ghb_settings_set_int(settings, "PictureTopCrop", crop[0]);
- ghb_settings_set_int(settings, "PictureBottomCrop", crop[1]);
- ghb_settings_set_int(settings, "PictureLeftCrop", crop[2]);
- ghb_settings_set_int(settings, "PictureRightCrop", crop[3]);
- }
- hb_reduce(&aspect_n, &aspect_d,
- title->width * title->pixel_aspect_width,
- title->height * title->pixel_aspect_height);
- crop_width = title->width - crop[2] - crop[3];
- crop_height = title->height - crop[0] - crop[1];
- if (autoscale)
- {
- width = crop_width;
- height = crop_height;
- }
- else
- {
- width = ghb_settings_get_int(settings, "scale_width");
- height = ghb_settings_get_int(settings, "scale_height");
- if (mode & GHB_PIC_USE_MAX)
- {
- max_width = MOD_DOWN(
- ghb_settings_get_int(settings, "PictureWidth"), mod);
- max_height = MOD_DOWN(
- ghb_settings_get_int(settings, "PictureHeight"), mod);
- }
- }
- g_debug("max_width %d, max_height %d\n", max_width, max_height);
-
- if (width < 16)
- width = title->width - crop[2] - crop[3];
- if (height < 16)
- height = title->height - crop[0] - crop[1];
-
- width = MOD_ROUND(width, mod);
- height = MOD_ROUND(height, mod);
-
- job->anamorphic.mode = pic_par;
- if (pic_par)
- {
- // The scaler crashes if the dimensions are not divisible by 2
- // Align mod 2. And so does something in x264_encoder_headers()
- job->modulus = mod;
- job->anamorphic.par_width = title->pixel_aspect_width;
- job->anamorphic.par_height = title->pixel_aspect_height;
- job->anamorphic.dar_width = 0;
- job->anamorphic.dar_height = 0;
-
- if (keep_height && pic_par == 2)
- {
- width = ((double)height * crop_width / crop_height);
- width = MOD_ROUND(width, mod);
- }
- job->width = width;
- job->height = height;
- job->maxWidth = max_width;
- job->maxHeight = max_height;
- job->crop[0] = crop[0];
- job->crop[1] = crop[1];
- job->crop[2] = crop[2];
- job->crop[3] = crop[3];
- if (job->anamorphic.mode == 3 && !keep_aspect)
- {
- job->anamorphic.keep_display_aspect = 0;
- if (mode & GHB_PIC_KEEP_PAR)
- {
- job->anamorphic.par_width =
- ghb_settings_get_int(settings, "PicturePARWidth");
- job->anamorphic.par_height =
- ghb_settings_get_int(settings, "PicturePARHeight");
- }
- else
- {
- job->anamorphic.dar_width =
- ghb_settings_get_int(settings, "PictureDisplayWidth");
- job->anamorphic.dar_height = height;
- }
- }
- else
- {
- job->anamorphic.keep_display_aspect = 1;
- }
- // hb_set_anamorphic_size will adjust par, dar, and width/height
- // to conform to job parameters that have been set, including
- // maxWidth and maxHeight
- hb_set_anamorphic_size(job, &width, &height, &par_width, &par_height);
- if (job->anamorphic.mode == 3 && !keep_aspect &&
- mode & GHB_PIC_KEEP_PAR)
- {
- // hb_set_anamorphic_size reduces the par, which we
- // don't want in this case because the user is
- // explicitely specifying it.
- par_width = ghb_settings_get_int(settings, "PicturePARWidth");
- par_height = ghb_settings_get_int(settings, "PicturePARHeight");
- }
- }
- else
- {
- // Adjust dims according to max values
- if (max_height) height = MIN(height, max_height);
- if (max_width) width = MIN(width, max_width);
-
- if (keep_aspect)
- {
- gdouble par;
- gint new_width, new_height;
-
- // Compute pixel aspect ration.
- par = (gdouble)(title->height * aspect_n) / (title->width * aspect_d);
- // Must scale so that par becomes 1:1
- // Try to keep largest dimension
- new_height = (crop_height * ((gdouble)width/crop_width) / par);
- new_width = (crop_width * ((gdouble)height/crop_height) * par);
-
- if (max_width && new_width > max_width)
- {
- height = new_height;
- }
- else if (max_height && new_height > max_height)
- {
- width = new_width;
- }
- else if (keep_width)
- {
- height = new_height;
- }
- else if (keep_height)
- {
- width = new_width;
- }
- else if (width > new_width)
- {
- height = new_height;
- }
- else
- {
- width = new_width;
- }
- g_debug("new w %d h %d\n", width, height);
- }
- width = MOD_ROUND(width, mod);
- height = MOD_ROUND(height, mod);
- if (max_height)
- height = MIN(height, max_height);
- if (max_width)
- width = MIN(width, max_width);
- par_width = par_height = 1;
- }
- ghb_settings_set_int(settings, "scale_width", width);
- ghb_settings_set_int(settings, "scale_height", height);
-
- gint disp_width;
-
- disp_width = ((gdouble)par_width / par_height) * width + 0.5;
+ hb_title_t * title;
+ hb_job_t * job;
+ gboolean keep_aspect;
+ gint pic_par;
+ gboolean autocrop, autoscale, noscale;
+ gint crop[4] = {0,};
+ gint width, height, par_width, par_height;
+ gint crop_width, crop_height;
+ gint aspect_n, aspect_d;
+ gboolean keep_width = (mode & GHB_PIC_KEEP_WIDTH);
+ gboolean keep_height = (mode & GHB_PIC_KEEP_HEIGHT);
+ gint mod;
+ gint max_width = 0;
+ gint max_height = 0;
+
+ g_debug("ghb_set_scale ()\n");
+
+ pic_par = ghb_settings_combo_int(settings, "PicturePAR");
+ if (pic_par == 1)
+ {
+ ghb_settings_set_boolean(settings, "autoscale", TRUE);
+ ghb_settings_set_int(settings, "PictureModulus", 2);
+ ghb_settings_set_boolean(settings, "PictureLooseCrop", TRUE);
+ }
+ if (pic_par == 1 || pic_par == 2)
+ {
+ ghb_settings_set_boolean(settings, "PictureKeepRatio", TRUE);
+ }
+
+ gint titleindex;
+
+ titleindex = ghb_settings_combo_int(settings, "title");
+ title = ghb_get_title_info (titleindex);
+ if (title == NULL) return;
+
+ job = hb_job_init( title );
+ if (job == NULL) return;
+
+ // First configure widgets
+ mod = ghb_settings_combo_int(settings, "PictureModulus");
+ keep_aspect = ghb_settings_get_boolean(settings, "PictureKeepRatio");
+ autocrop = ghb_settings_get_boolean(settings, "PictureAutoCrop");
+ autoscale = ghb_settings_get_boolean(settings, "autoscale");
+ // "Noscale" is a flag that says we prefer to crop extra to satisfy
+ // alignment constraints rather than scaling to satisfy them.
+ noscale = ghb_settings_get_boolean(settings, "PictureLooseCrop");
+ // Align dimensions to either 16 or 2 pixels
+ // The scaler crashes if the dimensions are not divisible by 2
+ // x264 also will not accept dims that are not multiple of 2
+ if (autoscale)
+ {
+ keep_width = FALSE;
+ keep_height = FALSE;
+ }
+
+ if (autocrop)
+ {
+ crop[0] = title->crop[0];
+ crop[1] = title->crop[1];
+ crop[2] = title->crop[2];
+ crop[3] = title->crop[3];
+ ghb_settings_set_int(settings, "PictureTopCrop", crop[0]);
+ ghb_settings_set_int(settings, "PictureBottomCrop", crop[1]);
+ ghb_settings_set_int(settings, "PictureLeftCrop", crop[2]);
+ ghb_settings_set_int(settings, "PictureRightCrop", crop[3]);
+ }
+ else
+ {
+ crop[0] = ghb_settings_get_int(settings, "PictureTopCrop");
+ crop[1] = ghb_settings_get_int(settings, "PictureBottomCrop");
+ crop[2] = ghb_settings_get_int(settings, "PictureLeftCrop");
+ crop[3] = ghb_settings_get_int(settings, "PictureRightCrop");
+ }
+ if (noscale)
+ {
+ gint need1, need2;
+
+ // Adjust the cropping to accomplish the desired width and height
+ crop_width = title->width - crop[2] - crop[3];
+ crop_height = title->height - crop[0] - crop[1];
+ width = MOD_DOWN(crop_width, mod);
+ height = MOD_DOWN(crop_height, mod);
+
+ need1 = (crop_height - height) / 2;
+ need2 = crop_height - height - need1;
+ crop[0] += need1;
+ crop[1] += need2;
+ need1 = (crop_width - width) / 2;
+ need2 = crop_width - width - need1;
+ crop[2] += need1;
+ crop[3] += need2;
+ ghb_settings_set_int(settings, "PictureTopCrop", crop[0]);
+ ghb_settings_set_int(settings, "PictureBottomCrop", crop[1]);
+ ghb_settings_set_int(settings, "PictureLeftCrop", crop[2]);
+ ghb_settings_set_int(settings, "PictureRightCrop", crop[3]);
+ }
+ hb_reduce(&aspect_n, &aspect_d,
+ title->width * title->pixel_aspect_width,
+ title->height * title->pixel_aspect_height);
+ crop_width = title->width - crop[2] - crop[3];
+ crop_height = title->height - crop[0] - crop[1];
+ if (autoscale)
+ {
+ width = crop_width;
+ height = crop_height;
+ }
+ else
+ {
+ width = ghb_settings_get_int(settings, "scale_width");
+ height = ghb_settings_get_int(settings, "scale_height");
+ if (mode & GHB_PIC_USE_MAX)
+ {
+ max_width = MOD_DOWN(
+ ghb_settings_get_int(settings, "PictureWidth"), mod);
+ max_height = MOD_DOWN(
+ ghb_settings_get_int(settings, "PictureHeight"), mod);
+ }
+ }
+ g_debug("max_width %d, max_height %d\n", max_width, max_height);
+
+ if (width < 16)
+ width = title->width - crop[2] - crop[3];
+ if (height < 16)
+ height = title->height - crop[0] - crop[1];
+
+ width = MOD_ROUND(width, mod);
+ height = MOD_ROUND(height, mod);
+
+ job->anamorphic.mode = pic_par;
+ if (pic_par)
+ {
+ // The scaler crashes if the dimensions are not divisible by 2
+ // Align mod 2. And so does something in x264_encoder_headers()
+ job->modulus = mod;
+ job->anamorphic.par_width = title->pixel_aspect_width;
+ job->anamorphic.par_height = title->pixel_aspect_height;
+ job->anamorphic.dar_width = 0;
+ job->anamorphic.dar_height = 0;
+
+ if (keep_height && pic_par == 2)
+ {
+ width = ((double)height * crop_width / crop_height);
+ width = MOD_ROUND(width, mod);
+ }
+ job->width = width;
+ job->height = height;
+ job->maxWidth = max_width;
+ job->maxHeight = max_height;
+ job->crop[0] = crop[0];
+ job->crop[1] = crop[1];
+ job->crop[2] = crop[2];
+ job->crop[3] = crop[3];
+ if (job->anamorphic.mode == 3 && !keep_aspect)
+ {
+ job->anamorphic.keep_display_aspect = 0;
+ if (mode & GHB_PIC_KEEP_PAR)
+ {
+ job->anamorphic.par_width =
+ ghb_settings_get_int(settings, "PicturePARWidth");
+ job->anamorphic.par_height =
+ ghb_settings_get_int(settings, "PicturePARHeight");
+ }
+ else
+ {
+ job->anamorphic.dar_width =
+ ghb_settings_get_int(settings, "PictureDisplayWidth");
+ job->anamorphic.dar_height = height;
+ }
+ }
+ else
+ {
+ job->anamorphic.keep_display_aspect = 1;
+ }
+ // hb_set_anamorphic_size will adjust par, dar, and width/height
+ // to conform to job parameters that have been set, including
+ // maxWidth and maxHeight
+ hb_set_anamorphic_size(job, &width, &height, &par_width, &par_height);
+ if (job->anamorphic.mode == 3 && !keep_aspect &&
+ mode & GHB_PIC_KEEP_PAR)
+ {
+ // hb_set_anamorphic_size reduces the par, which we
+ // don't want in this case because the user is
+ // explicitely specifying it.
+ par_width = ghb_settings_get_int(settings, "PicturePARWidth");
+ par_height = ghb_settings_get_int(settings, "PicturePARHeight");
+ }
+ }
+ else
+ {
+ // Adjust dims according to max values
+ if (max_height) height = MIN(height, max_height);
+ if (max_width) width = MIN(width, max_width);
+
+ if (keep_aspect)
+ {
+ gdouble par;
+ gint new_width, new_height;
+
+ // Compute pixel aspect ration.
+ par = (gdouble)(title->height * aspect_n) / (title->width * aspect_d);
+ // Must scale so that par becomes 1:1
+ // Try to keep largest dimension
+ new_height = (crop_height * ((gdouble)width/crop_width) / par);
+ new_width = (crop_width * ((gdouble)height/crop_height) * par);
+
+ if (max_width && new_width > max_width)
+ {
+ height = new_height;
+ }
+ else if (max_height && new_height > max_height)
+ {
+ width = new_width;
+ }
+ else if (keep_width)
+ {
+ height = new_height;
+ }
+ else if (keep_height)
+ {
+ width = new_width;
+ }
+ else if (width > new_width)
+ {
+ height = new_height;
+ }
+ else
+ {
+ width = new_width;
+ }
+ g_debug("new w %d h %d\n", width, height);
+ }
+ width = MOD_ROUND(width, mod);
+ height = MOD_ROUND(height, mod);
+ if (max_height)
+ height = MIN(height, max_height);
+ if (max_width)
+ width = MIN(width, max_width);
+ par_width = par_height = 1;
+ }
+ ghb_settings_set_int(settings, "scale_width", width);
+ ghb_settings_set_int(settings, "scale_height", height);
+
+ gint disp_width;
+
+ disp_width = ((gdouble)par_width / par_height) * width + 0.5;
ghb_limit_rational(&par_width, &par_height, 65535);
- ghb_settings_set_int(settings, "PicturePARWidth", par_width);
- ghb_settings_set_int(settings, "PicturePARHeight", par_height);
- ghb_settings_set_int(settings, "PictureDisplayWidth", disp_width);
- ghb_settings_set_int(settings, "PictureDisplayHeight", height);
- hb_job_close( &job );
+ ghb_settings_set_int(settings, "PicturePARWidth", par_width);
+ ghb_settings_set_int(settings, "PicturePARHeight", par_height);
+ ghb_settings_set_int(settings, "PictureDisplayWidth", disp_width);
+ ghb_settings_set_int(settings, "PictureDisplayHeight", height);
+ hb_job_close( &job );
}
void
ghb_set_scale(signal_user_data_t *ud, gint mode)
{
- if (ud->scale_busy) return;
- ud->scale_busy = TRUE;
-
- ghb_set_scale_settings(ud->settings, mode);
- picture_settings_deps(ud);
-
- // Step needs to be at least 2 because odd widths cause scaler crash
- // subsampled chroma requires even crop values.
- GtkWidget *widget;
- int mod = ghb_settings_combo_int(ud->settings, "PictureModulus");
- widget = GHB_WIDGET (ud->builder, "scale_width");
- gtk_spin_button_set_increments (GTK_SPIN_BUTTON(widget), mod, 16);
- widget = GHB_WIDGET (ud->builder, "scale_height");
- gtk_spin_button_set_increments (GTK_SPIN_BUTTON(widget), mod, 16);
-
- // "Noscale" is a flag that says we prefer to crop extra to satisfy
- // alignment constraints rather than scaling to satisfy them.
- gboolean noscale = ghb_settings_get_boolean(ud->settings, "PictureLooseCrop");
- if (noscale)
- {
- widget = GHB_WIDGET (ud->builder, "PictureTopCrop");
- gtk_spin_button_set_increments (GTK_SPIN_BUTTON(widget), mod, 16);
- widget = GHB_WIDGET (ud->builder, "PictureBottomCrop");
- gtk_spin_button_set_increments (GTK_SPIN_BUTTON(widget), mod, 16);
- widget = GHB_WIDGET (ud->builder, "PictureLeftCrop");
- gtk_spin_button_set_increments (GTK_SPIN_BUTTON(widget), mod, 16);
- widget = GHB_WIDGET (ud->builder, "PictureRightCrop");
- gtk_spin_button_set_increments (GTK_SPIN_BUTTON(widget), mod, 16);
- }
- else
- {
- widget = GHB_WIDGET (ud->builder, "PictureTopCrop");
- gtk_spin_button_set_increments (GTK_SPIN_BUTTON(widget), 2, 16);
- widget = GHB_WIDGET (ud->builder, "PictureBottomCrop");
- gtk_spin_button_set_increments (GTK_SPIN_BUTTON(widget), 2, 16);
- widget = GHB_WIDGET (ud->builder, "PictureLeftCrop");
- gtk_spin_button_set_increments (GTK_SPIN_BUTTON(widget), 2, 16);
- widget = GHB_WIDGET (ud->builder, "PictureRightCrop");
- gtk_spin_button_set_increments (GTK_SPIN_BUTTON(widget), 2, 16);
- }
-
- ghb_ui_update_from_settings(ud->builder, "autoscale", ud->settings);
- ghb_ui_update_from_settings(ud->builder, "PictureModulus", ud->settings);
- ghb_ui_update_from_settings(ud->builder, "PictureLooseCrop", ud->settings);
- ghb_ui_update_from_settings(ud->builder, "PictureKeepRatio", ud->settings);
-
- ghb_ui_update_from_settings(ud->builder, "PictureTopCrop", ud->settings);
- ghb_ui_update_from_settings(ud->builder, "PictureBottomCrop", ud->settings);
- ghb_ui_update_from_settings(ud->builder, "PictureLeftCrop", ud->settings);
- ghb_ui_update_from_settings(ud->builder, "PictureRightCrop", ud->settings);
-
- ghb_ui_update_from_settings(ud->builder, "scale_width", ud->settings);
- ghb_ui_update_from_settings(ud->builder, "scale_height", ud->settings);
-
- ghb_ui_update_from_settings(ud->builder, "PicturePARWidth", ud->settings);
- ghb_ui_update_from_settings(ud->builder, "PicturePARHeight", ud->settings);
- ghb_ui_update_from_settings(ud->builder, "PictureDisplayWidth", ud->settings);
- ghb_ui_update_from_settings(ud->builder, "PictureDisplayHeight", ud->settings);
- gint disp_width, disp_height, dar_width, dar_height;
- gchar *str;
-
- disp_width = ghb_settings_get_int(ud->settings, "PictureDisplayWidth");
- disp_height = ghb_settings_get_int(ud->settings, "PictureDisplayHeight");
- hb_reduce(&dar_width, &dar_height, disp_width, disp_height);
- gint iaspect = dar_width * 9 / dar_height;
- if (dar_width > 2 * dar_height)
- {
- str = g_strdup_printf("%.2f : 1", (gdouble)dar_width / dar_height);
- }
- else if (iaspect <= 16 && iaspect >= 15)
- {
- str = g_strdup_printf("%.2f : 9", (gdouble)dar_width * 9 / dar_height);
- }
- else if (iaspect <= 12 && iaspect >= 11)
- {
- str = g_strdup_printf("%.2f : 3", (gdouble)dar_width * 3 / dar_height);
- }
- else
- {
- str = g_strdup_printf("%d : %d", dar_width, dar_height);
- }
- ghb_ui_update(ud, "display_aspect", ghb_string_value(str));
- g_free(str);
- ud->scale_busy = FALSE;
+ if (ud->scale_busy) return;
+ ud->scale_busy = TRUE;
+
+ ghb_set_scale_settings(ud->settings, mode);
+ picture_settings_deps(ud);
+
+ // Step needs to be at least 2 because odd widths cause scaler crash
+ // subsampled chroma requires even crop values.
+ GtkWidget *widget;
+ int mod = ghb_settings_combo_int(ud->settings, "PictureModulus");
+ widget = GHB_WIDGET (ud->builder, "scale_width");
+ gtk_spin_button_set_increments (GTK_SPIN_BUTTON(widget), mod, 16);
+ widget = GHB_WIDGET (ud->builder, "scale_height");
+ gtk_spin_button_set_increments (GTK_SPIN_BUTTON(widget), mod, 16);
+
+ // "Noscale" is a flag that says we prefer to crop extra to satisfy
+ // alignment constraints rather than scaling to satisfy them.
+ gboolean noscale = ghb_settings_get_boolean(ud->settings, "PictureLooseCrop");
+ if (noscale)
+ {
+ widget = GHB_WIDGET (ud->builder, "PictureTopCrop");
+ gtk_spin_button_set_increments (GTK_SPIN_BUTTON(widget), mod, 16);
+ widget = GHB_WIDGET (ud->builder, "PictureBottomCrop");
+ gtk_spin_button_set_increments (GTK_SPIN_BUTTON(widget), mod, 16);
+ widget = GHB_WIDGET (ud->builder, "PictureLeftCrop");
+ gtk_spin_button_set_increments (GTK_SPIN_BUTTON(widget), mod, 16);
+ widget = GHB_WIDGET (ud->builder, "PictureRightCrop");
+ gtk_spin_button_set_increments (GTK_SPIN_BUTTON(widget), mod, 16);
+ }
+ else
+ {
+ widget = GHB_WIDGET (ud->builder, "PictureTopCrop");
+ gtk_spin_button_set_increments (GTK_SPIN_BUTTON(widget), 2, 16);
+ widget = GHB_WIDGET (ud->builder, "PictureBottomCrop");
+ gtk_spin_button_set_increments (GTK_SPIN_BUTTON(widget), 2, 16);
+ widget = GHB_WIDGET (ud->builder, "PictureLeftCrop");
+ gtk_spin_button_set_increments (GTK_SPIN_BUTTON(widget), 2, 16);
+ widget = GHB_WIDGET (ud->builder, "PictureRightCrop");
+ gtk_spin_button_set_increments (GTK_SPIN_BUTTON(widget), 2, 16);
+ }
+
+ ghb_ui_update_from_settings(ud->builder, "autoscale", ud->settings);
+ ghb_ui_update_from_settings(ud->builder, "PictureModulus", ud->settings);
+ ghb_ui_update_from_settings(ud->builder, "PictureLooseCrop", ud->settings);
+ ghb_ui_update_from_settings(ud->builder, "PictureKeepRatio", ud->settings);
+
+ ghb_ui_update_from_settings(ud->builder, "PictureTopCrop", ud->settings);
+ ghb_ui_update_from_settings(ud->builder, "PictureBottomCrop", ud->settings);
+ ghb_ui_update_from_settings(ud->builder, "PictureLeftCrop", ud->settings);
+ ghb_ui_update_from_settings(ud->builder, "PictureRightCrop", ud->settings);
+
+ ghb_ui_update_from_settings(ud->builder, "scale_width", ud->settings);
+ ghb_ui_update_from_settings(ud->builder, "scale_height", ud->settings);
+
+ ghb_ui_update_from_settings(ud->builder, "PicturePARWidth", ud->settings);
+ ghb_ui_update_from_settings(ud->builder, "PicturePARHeight", ud->settings);
+ ghb_ui_update_from_settings(ud->builder, "PictureDisplayWidth", ud->settings);
+ ghb_ui_update_from_settings(ud->builder, "PictureDisplayHeight", ud->settings);
+ gint disp_width, disp_height, dar_width, dar_height;
+ gchar *str;
+
+ disp_width = ghb_settings_get_int(ud->settings, "PictureDisplayWidth");
+ disp_height = ghb_settings_get_int(ud->settings, "PictureDisplayHeight");
+ hb_reduce(&dar_width, &dar_height, disp_width, disp_height);
+ gint iaspect = dar_width * 9 / dar_height;
+ if (dar_width > 2 * dar_height)
+ {
+ str = g_strdup_printf("%.2f : 1", (gdouble)dar_width / dar_height);
+ }
+ else if (iaspect <= 16 && iaspect >= 15)
+ {
+ str = g_strdup_printf("%.2f : 9", (gdouble)dar_width * 9 / dar_height);
+ }
+ else if (iaspect <= 12 && iaspect >= 11)
+ {
+ str = g_strdup_printf("%.2f : 3", (gdouble)dar_width * 3 / dar_height);
+ }
+ else
+ {
+ str = g_strdup_printf("%d : %d", dar_width, dar_height);
+ }
+ ghb_ui_update(ud, "display_aspect", ghb_string_value(str));
+ g_free(str);
+ ud->scale_busy = FALSE;
}
static void
set_preview_job_settings(hb_job_t *job, GValue *settings)
{
- job->crop[0] = ghb_settings_get_int(settings, "PictureTopCrop");
- job->crop[1] = ghb_settings_get_int(settings, "PictureBottomCrop");
- job->crop[2] = ghb_settings_get_int(settings, "PictureLeftCrop");
- job->crop[3] = ghb_settings_get_int(settings, "PictureRightCrop");
-
- job->anamorphic.mode = ghb_settings_combo_int(settings, "PicturePAR");
- job->modulus =
- ghb_settings_combo_int(settings, "PictureModulus");
- job->width = ghb_settings_get_int(settings, "scale_width");
- job->height = ghb_settings_get_int(settings, "scale_height");
- if (ghb_settings_get_boolean(settings, "show_crop"))
- {
- gdouble xscale = (gdouble)job->width /
- (gdouble)(job->title->width - job->crop[2] - job->crop[3]);
- gdouble yscale = (gdouble)job->height /
- (gdouble)(job->title->height - job->crop[0] - job->crop[1]);
-
- job->width += xscale * (job->crop[2] + job->crop[3]);
- job->height += yscale * (job->crop[0] + job->crop[1]);
- job->crop[0] = 0;
- job->crop[1] = 0;
- job->crop[2] = 0;
- job->crop[3] = 0;
- job->modulus = 2;
- }
-
- gboolean decomb_deint = ghb_settings_get_boolean(settings, "PictureDecombDeinterlace");
- if (decomb_deint)
- {
- gint decomb = ghb_settings_combo_int(settings, "PictureDecomb");
- job->deinterlace = (decomb == 0) ? 0 : 1;
- }
- else
- {
- gint deint = ghb_settings_combo_int(settings, "PictureDeinterlace");
- job->deinterlace = (deint == 0) ? 0 : 1;
- }
-
- gboolean keep_aspect;
- keep_aspect = ghb_settings_get_boolean(settings, "PictureKeepRatio");
- if (job->anamorphic.mode)
- {
- job->anamorphic.par_width = job->title->pixel_aspect_width;
- job->anamorphic.par_height = job->title->pixel_aspect_height;
- job->anamorphic.dar_width = 0;
- job->anamorphic.dar_height = 0;
-
- if (job->anamorphic.mode == 3 && !keep_aspect)
- {
- job->anamorphic.keep_display_aspect = 0;
- job->anamorphic.par_width =
- ghb_settings_get_int(settings, "PicturePARWidth");
- job->anamorphic.par_height =
- ghb_settings_get_int(settings, "PicturePARHeight");
- }
- else
- {
- job->anamorphic.keep_display_aspect = 1;
- }
- }
+ job->crop[0] = ghb_settings_get_int(settings, "PictureTopCrop");
+ job->crop[1] = ghb_settings_get_int(settings, "PictureBottomCrop");
+ job->crop[2] = ghb_settings_get_int(settings, "PictureLeftCrop");
+ job->crop[3] = ghb_settings_get_int(settings, "PictureRightCrop");
+
+ job->anamorphic.mode = ghb_settings_combo_int(settings, "PicturePAR");
+ job->modulus =
+ ghb_settings_combo_int(settings, "PictureModulus");
+ job->width = ghb_settings_get_int(settings, "scale_width");
+ job->height = ghb_settings_get_int(settings, "scale_height");
+ if (ghb_settings_get_boolean(settings, "show_crop"))
+ {
+ gdouble xscale = (gdouble)job->width /
+ (gdouble)(job->title->width - job->crop[2] - job->crop[3]);
+ gdouble yscale = (gdouble)job->height /
+ (gdouble)(job->title->height - job->crop[0] - job->crop[1]);
+
+ job->width += xscale * (job->crop[2] + job->crop[3]);
+ job->height += yscale * (job->crop[0] + job->crop[1]);
+ job->crop[0] = 0;
+ job->crop[1] = 0;
+ job->crop[2] = 0;
+ job->crop[3] = 0;
+ job->modulus = 2;
+ }
+
+ gboolean decomb_deint = ghb_settings_get_boolean(settings, "PictureDecombDeinterlace");
+ if (decomb_deint)
+ {
+ gint decomb = ghb_settings_combo_int(settings, "PictureDecomb");
+ job->deinterlace = (decomb == 0) ? 0 : 1;
+ }
+ else
+ {
+ gint deint = ghb_settings_combo_int(settings, "PictureDeinterlace");
+ job->deinterlace = (deint == 0) ? 0 : 1;
+ }
+
+ gboolean keep_aspect;
+ keep_aspect = ghb_settings_get_boolean(settings, "PictureKeepRatio");
+ if (job->anamorphic.mode)
+ {
+ job->anamorphic.par_width = job->title->pixel_aspect_width;
+ job->anamorphic.par_height = job->title->pixel_aspect_height;
+ job->anamorphic.dar_width = 0;
+ job->anamorphic.dar_height = 0;
+
+ if (job->anamorphic.mode == 3 && !keep_aspect)
+ {
+ job->anamorphic.keep_display_aspect = 0;
+ job->anamorphic.par_width =
+ ghb_settings_get_int(settings, "PicturePARWidth");
+ job->anamorphic.par_height =
+ ghb_settings_get_int(settings, "PicturePARHeight");
+ }
+ else
+ {
+ job->anamorphic.keep_display_aspect = 1;
+ }
+ }
}
gboolean
ghb_validate_filter_string(const gchar *str, gint max_fields)
{
- gint fields = 0;
- gchar *end;
-
- if (str == NULL || *str == 0) return TRUE;
- while (*str)
- {
- g_strtod(str, &end);
- if (str != end)
- { // Found a numeric value
- fields++;
- // negative max_fields means infinate
- if (max_fields >= 0 && fields > max_fields) return FALSE;
- if (*end == 0)
- return TRUE;
- if (*end != ':')
- return FALSE;
- str = end + 1;
- }
- else
- return FALSE;
- }
- return FALSE;
+ gint fields = 0;
+ gchar *end;
+
+ if (str == NULL || *str == 0) return TRUE;
+ while (*str)
+ {
+ g_strtod(str, &end);
+ if (str != end)
+ { // Found a numeric value
+ fields++;
+ // negative max_fields means infinate
+ if (max_fields >= 0 && fields > max_fields) return FALSE;
+ if (*end == 0)
+ return TRUE;
+ if (*end != ':')
+ return FALSE;
+ str = end + 1;
+ }
+ else
+ return FALSE;
+ }
+ return FALSE;
}
gboolean
ghb_validate_filters(GValue *settings)
{
- gchar *str;
- gint index;
- gchar *message;
-
- gboolean decomb_deint = ghb_settings_get_boolean(settings, "PictureDecombDeinterlace");
- // deinte
- index = ghb_settings_combo_int(settings, "PictureDeinterlace");
- if (!decomb_deint && index == 1)
- {
- str = ghb_settings_get_string(settings, "PictureDeinterlaceCustom");
- if (!ghb_validate_filter_string(str, -1))
- {
- message = g_strdup_printf(
- "Invalid Deinterlace Settings:\n\n%s\n",
- str);
- ghb_message_dialog(GTK_MESSAGE_ERROR, message, "Cancel", NULL);
- g_free(message);
- g_free(str);
- return FALSE;
- }
- g_free(str);
- }
- // detel
- index = ghb_settings_combo_int(settings, "PictureDetelecine");
- if (index == 1)
- {
- str = ghb_settings_get_string(settings, "PictureDetelecineCustom");
- if (!ghb_validate_filter_string(str, -1))
- {
- message = g_strdup_printf(
- "Invalid Detelecine Settings:\n\n%s\n",
- str);
- ghb_message_dialog(GTK_MESSAGE_ERROR, message, "Cancel", NULL);
- g_free(message);
- g_free(str);
- return FALSE;
- }
- g_free(str);
- }
- // decomb
- index = ghb_settings_combo_int(settings, "PictureDecomb");
- if (decomb_deint && index == 1)
- {
- str = ghb_settings_get_string(settings, "PictureDecombCustom");
- if (!ghb_validate_filter_string(str, -1))
- {
- message = g_strdup_printf(
- "Invalid Decomb Settings:\n\n%s\n",
- str);
- ghb_message_dialog(GTK_MESSAGE_ERROR, message, "Cancel", NULL);
- g_free(message);
- g_free(str);
- return FALSE;
- }
- g_free(str);
- }
- // denois
- index = ghb_settings_combo_int(settings, "PictureDenoise");
- if (index == 1)
- {
- str = ghb_settings_get_string(settings, "PictureDenoiseCustom");
- if (!ghb_validate_filter_string(str, -1))
- {
- message = g_strdup_printf(
- "Invalid Denoise Settings:\n\n%s\n",
- str);
- ghb_message_dialog(GTK_MESSAGE_ERROR, message, "Cancel", NULL);
- g_free(str);
- g_free(message);
- return FALSE;
- }
- g_free(str);
- }
- return TRUE;
+ gchar *str;
+ gint index;
+ gchar *message;
+
+ gboolean decomb_deint = ghb_settings_get_boolean(settings, "PictureDecombDeinterlace");
+ // deinte
+ index = ghb_settings_combo_int(settings, "PictureDeinterlace");
+ if (!decomb_deint && index == 1)
+ {
+ str = ghb_settings_get_string(settings, "PictureDeinterlaceCustom");
+ if (!ghb_validate_filter_string(str, -1))
+ {
+ message = g_strdup_printf(
+ "Invalid Deinterlace Settings:\n\n%s\n",
+ str);
+ ghb_message_dialog(GTK_MESSAGE_ERROR, message, "Cancel", NULL);
+ g_free(message);
+ g_free(str);
+ return FALSE;
+ }
+ g_free(str);
+ }
+ // detel
+ index = ghb_settings_combo_int(settings, "PictureDetelecine");
+ if (index == 1)
+ {
+ str = ghb_settings_get_string(settings, "PictureDetelecineCustom");
+ if (!ghb_validate_filter_string(str, -1))
+ {
+ message = g_strdup_printf(
+ "Invalid Detelecine Settings:\n\n%s\n",
+ str);
+ ghb_message_dialog(GTK_MESSAGE_ERROR, message, "Cancel", NULL);
+ g_free(message);
+ g_free(str);
+ return FALSE;
+ }
+ g_free(str);
+ }
+ // decomb
+ index = ghb_settings_combo_int(settings, "PictureDecomb");
+ if (decomb_deint && index == 1)
+ {
+ str = ghb_settings_get_string(settings, "PictureDecombCustom");
+ if (!ghb_validate_filter_string(str, -1))
+ {
+ message = g_strdup_printf(
+ "Invalid Decomb Settings:\n\n%s\n",
+ str);
+ ghb_message_dialog(GTK_MESSAGE_ERROR, message, "Cancel", NULL);
+ g_free(message);
+ g_free(str);
+ return FALSE;
+ }
+ g_free(str);
+ }
+ // denois
+ index = ghb_settings_combo_int(settings, "PictureDenoise");
+ if (index == 1)
+ {
+ str = ghb_settings_get_string(settings, "PictureDenoiseCustom");
+ if (!ghb_validate_filter_string(str, -1))
+ {
+ message = g_strdup_printf(
+ "Invalid Denoise Settings:\n\n%s\n",
+ str);
+ ghb_message_dialog(GTK_MESSAGE_ERROR, message, "Cancel", NULL);
+ g_free(str);
+ g_free(message);
+ return FALSE;
+ }
+ g_free(str);
+ }
+ return TRUE;
}
gboolean
ghb_validate_video(GValue *settings)
{
- gint vcodec, mux;
- gchar *message;
-
- mux = ghb_settings_combo_int(settings, "FileFormat");
- vcodec = ghb_settings_combo_int(settings, "VideoEncoder");
- if ((mux == HB_MUX_MP4) && (vcodec == HB_VCODEC_THEORA))
- {
- // mp4/theora combination is not supported.
- message = g_strdup_printf(
- "Theora is not supported in the MP4 container.\n\n"
- "You should choose a different video codec or container.\n"
- "If you continue, FFMPEG will be chosen for you.");
- if (!ghb_message_dialog(GTK_MESSAGE_WARNING, message, "Cancel", "Continue"))
- {
- g_free(message);
- return FALSE;
- }
- g_free(message);
- ghb_settings_set_int(settings, "VideoEncoder", HB_VCODEC_FFMPEG_MPEG4);
- }
- return TRUE;
+ gint vcodec, mux;
+ gchar *message;
+
+ mux = ghb_settings_combo_int(settings, "FileFormat");
+ vcodec = ghb_settings_combo_int(settings, "VideoEncoder");
+ if ((mux == HB_MUX_MP4) && (vcodec == HB_VCODEC_THEORA))
+ {
+ // mp4/theora combination is not supported.
+ message = g_strdup_printf(
+ "Theora is not supported in the MP4 container.\n\n"
+ "You should choose a different video codec or container.\n"
+ "If you continue, FFMPEG will be chosen for you.");
+ if (!ghb_message_dialog(GTK_MESSAGE_WARNING, message, "Cancel", "Continue"))
+ {
+ g_free(message);
+ return FALSE;
+ }
+ g_free(message);
+ ghb_settings_set_int(settings, "VideoEncoder", HB_VCODEC_FFMPEG_MPEG4);
+ }
+ return TRUE;
}
gboolean
ghb_validate_subtitles(GValue *settings)
{
- hb_title_t * title;
- gchar *message;
-
- gint titleindex;
-
- titleindex = ghb_settings_combo_int(settings, "title");
- title = ghb_get_title_info(titleindex);
- if (title == NULL)
- {
- /* No valid title, stop right there */
- g_message("No title found.\n");
- return FALSE;
- }
-
- const GValue *slist, *subtitle;
- gint count, ii, source;
- gboolean burned, one_burned = FALSE;
-
- slist = ghb_settings_get_value(settings, "subtitle_list");
- count = ghb_array_len(slist);
- for (ii = 0; ii < count; ii++)
- {
- subtitle = ghb_array_get_nth(slist, ii);
- source = ghb_settings_get_int(subtitle, "SubtitleSource");
- burned = ghb_settings_get_boolean(subtitle, "SubtitleBurned");
- if (burned && one_burned)
- {
- // MP4 can only handle burned vobsubs. make sure there isn't
- // already something burned in the list
- message = g_strdup_printf(
- "Only one subtitle may be burned into the video.\n\n"
- "You should change your subtitle selections.\n"
- "If you continue, some subtitles will be lost.");
- if (!ghb_message_dialog(GTK_MESSAGE_WARNING, message, "Cancel", "Continue"))
- {
- g_free(message);
- return FALSE;
- }
- g_free(message);
- break;
- }
- else if (burned)
- {
- one_burned = TRUE;
- }
- if (source == SRTSUB)
- {
- gchar *filename;
-
- filename = ghb_settings_get_string(subtitle, "SrtFile");
- if (!g_file_test(filename, G_FILE_TEST_IS_REGULAR))
- {
- message = g_strdup_printf(
- "Srt file does not exist or not a regular file.\n\n"
- "You should choose a valid file.\n"
- "If you continue, this subtitle will be ignored.");
- if (!ghb_message_dialog(GTK_MESSAGE_WARNING, message,
- "Cancel", "Continue"))
- {
- g_free(message);
- return FALSE;
- }
- g_free(message);
- break;
- }
- }
- }
- return TRUE;
+ hb_title_t * title;
+ gchar *message;
+
+ gint titleindex;
+
+ titleindex = ghb_settings_combo_int(settings, "title");
+ title = ghb_get_title_info(titleindex);
+ if (title == NULL)
+ {
+ /* No valid title, stop right there */
+ g_message("No title found.\n");
+ return FALSE;
+ }
+
+ const GValue *slist, *subtitle;
+ gint count, ii, source;
+ gboolean burned, one_burned = FALSE;
+
+ slist = ghb_settings_get_value(settings, "subtitle_list");
+ count = ghb_array_len(slist);
+ for (ii = 0; ii < count; ii++)
+ {
+ subtitle = ghb_array_get_nth(slist, ii);
+ source = ghb_settings_get_int(subtitle, "SubtitleSource");
+ burned = ghb_settings_get_boolean(subtitle, "SubtitleBurned");
+ if (burned && one_burned)
+ {
+ // MP4 can only handle burned vobsubs. make sure there isn't
+ // already something burned in the list
+ message = g_strdup_printf(
+ "Only one subtitle may be burned into the video.\n\n"
+ "You should change your subtitle selections.\n"
+ "If you continue, some subtitles will be lost.");
+ if (!ghb_message_dialog(GTK_MESSAGE_WARNING, message, "Cancel", "Continue"))
+ {
+ g_free(message);
+ return FALSE;
+ }
+ g_free(message);
+ break;
+ }
+ else if (burned)
+ {
+ one_burned = TRUE;
+ }
+ if (source == SRTSUB)
+ {
+ gchar *filename;
+
+ filename = ghb_settings_get_string(subtitle, "SrtFile");
+ if (!g_file_test(filename, G_FILE_TEST_IS_REGULAR))
+ {
+ message = g_strdup_printf(
+ "Srt file does not exist or not a regular file.\n\n"
+ "You should choose a valid file.\n"
+ "If you continue, this subtitle will be ignored.");
+ if (!ghb_message_dialog(GTK_MESSAGE_WARNING, message,
+ "Cancel", "Continue"))
+ {
+ g_free(message);
+ return FALSE;
+ }
+ g_free(message);
+ break;
+ }
+ }
+ }
+ return TRUE;
}
gboolean
ghb_validate_audio(GValue *settings)
{
- hb_title_t * title;
- gchar *message;
- GValue *value;
-
- gint titleindex;
-
- titleindex = ghb_settings_combo_int(settings, "title");
- title = ghb_get_title_info( titleindex );
- if (title == NULL)
- {
- /* No valid title, stop right there */
- g_message("No title found.\n");
- return FALSE;
- }
- gint mux = ghb_settings_combo_int(settings, "FileFormat");
-
- const GValue *audio_list;
- gint count, ii;
-
- audio_list = ghb_settings_get_value(settings, "audio_list");
- count = ghb_array_len(audio_list);
- for (ii = 0; ii < count; ii++)
- {
- GValue *asettings;
- hb_audio_config_t *aconfig;
-
- asettings = ghb_array_get_nth(audio_list, ii);
- gint track = ghb_settings_combo_int(asettings, "AudioTrack");
- gint codec = ghb_settings_combo_int(asettings, "AudioEncoder");
- if (codec == HB_ACODEC_AUTO_PASS)
- continue;
+ hb_title_t * title;
+ gchar *message;
+ GValue *value;
+
+ gint titleindex;
+
+ titleindex = ghb_settings_combo_int(settings, "title");
+ title = ghb_get_title_info( titleindex );
+ if (title == NULL)
+ {
+ /* No valid title, stop right there */
+ g_message("No title found.\n");
+ return FALSE;
+ }
+ gint mux = ghb_settings_combo_int(settings, "FileFormat");
+
+ const GValue *audio_list;
+ gint count, ii;
+
+ audio_list = ghb_settings_get_value(settings, "audio_list");
+ count = ghb_array_len(audio_list);
+ for (ii = 0; ii < count; ii++)
+ {
+ GValue *asettings;
+ hb_audio_config_t *aconfig;
+
+ asettings = ghb_array_get_nth(audio_list, ii);
+ gint track = ghb_settings_combo_int(asettings, "AudioTrack");
+ gint codec = ghb_settings_combo_int(asettings, "AudioEncoder");
+ if (codec == HB_ACODEC_AUTO_PASS)
+ continue;
aconfig = (hb_audio_config_t *) hb_list_audio_config_item(
- title->list_audio, track );
- if ( ghb_audio_is_passthru(codec) &&
- !(ghb_audio_can_passthru(aconfig->in.codec) &&
- (aconfig->in.codec & codec)))
- {
- // Not supported. AC3 is passthrough only, so input must be AC3
- message = g_strdup_printf(
- "The source does not support Pass-Thru.\n\n"
- "You should choose a different audio codec.\n"
- "If you continue, one will be chosen for you.");
- if (!ghb_message_dialog(GTK_MESSAGE_WARNING, message, "Cancel", "Continue"))
- {
- g_free(message);
- return FALSE;
- }
- g_free(message);
- if ((codec & HB_ACODEC_AC3) ||
- (aconfig->in.codec & HB_ACODEC_MASK) == HB_ACODEC_DCA)
- {
- codec = HB_ACODEC_AC3;
- }
- else if (mux == HB_MUX_MKV)
- {
- codec = HB_ACODEC_LAME;
- }
- else
- {
- codec = HB_ACODEC_FAAC;
- }
- value = ghb_lookup_acodec_value(codec);
- ghb_settings_take_value(asettings, "AudioEncoder", value);
- }
- gchar *a_unsup = NULL;
- gchar *mux_s = NULL;
- if (mux == HB_MUX_MP4)
- {
- mux_s = "MP4";
- // mp4/vorbis|DTS combination is not supported.
- if (codec == HB_ACODEC_VORBIS)
- {
- a_unsup = "Vorbis";
- codec = HB_ACODEC_FAAC;
- }
- }
- if (a_unsup)
- {
- message = g_strdup_printf(
- "%s is not supported in the %s container.\n\n"
- "You should choose a different audio codec.\n"
- "If you continue, one will be chosen for you.", a_unsup, mux_s);
- if (!ghb_message_dialog(GTK_MESSAGE_WARNING, message, "Cancel", "Continue"))
- {
- g_free(message);
- return FALSE;
- }
- g_free(message);
- value = ghb_lookup_acodec_value(codec);
- ghb_settings_take_value(asettings, "AudioEncoder", value);
- }
-
- gint mix = ghb_settings_combo_int (asettings, "AudioMixdown");
-
- gint jj;
- gchar *mix_unsup = NULL;
- if (!hb_mixdown_is_supported(mix, codec, aconfig->in.channel_layout))
- {
- for (jj = 0; jj < hb_audio_mixdowns_count; jj++)
- {
- if (mix == hb_audio_mixdowns[jj].amixdown)
- {
- {
- mix_unsup = hb_audio_mixdowns[jj].human_readable_name;
- }
- }
- }
- }
- if (mix_unsup)
- {
- message = g_strdup_printf(
- "The source audio does not support %s mixdown.\n\n"
- "You should choose a different mixdown.\n"
- "If you continue, one will be chosen for you.", mix_unsup);
- if (!ghb_message_dialog(GTK_MESSAGE_WARNING, message, "Cancel", "Continue"))
- {
- g_free(message);
- return FALSE;
- }
- g_free(message);
- mix = ghb_get_best_mix(aconfig, codec, mix);
- value = get_amix_value(mix);
- ghb_settings_take_value(asettings, "AudioMixdown", value);
- }
- }
- return TRUE;
+ title->list_audio, track );
+ if ( ghb_audio_is_passthru(codec) &&
+ !(ghb_audio_can_passthru(aconfig->in.codec) &&
+ (aconfig->in.codec & codec)))
+ {
+ // Not supported. AC3 is passthrough only, so input must be AC3
+ message = g_strdup_printf(
+ "The source does not support Pass-Thru.\n\n"
+ "You should choose a different audio codec.\n"
+ "If you continue, one will be chosen for you.");
+ if (!ghb_message_dialog(GTK_MESSAGE_WARNING, message, "Cancel", "Continue"))
+ {
+ g_free(message);
+ return FALSE;
+ }
+ g_free(message);
+ if ((codec & HB_ACODEC_AC3) ||
+ (aconfig->in.codec & HB_ACODEC_MASK) == HB_ACODEC_DCA)
+ {
+ codec = HB_ACODEC_AC3;
+ }
+ else if (mux == HB_MUX_MKV)
+ {
+ codec = HB_ACODEC_LAME;
+ }
+ else
+ {
+ codec = HB_ACODEC_FAAC;
+ }
+ value = ghb_lookup_acodec_value(codec);
+ ghb_settings_take_value(asettings, "AudioEncoder", value);
+ }
+ gchar *a_unsup = NULL;
+ gchar *mux_s = NULL;
+ if (mux == HB_MUX_MP4)
+ {
+ mux_s = "MP4";
+ // mp4/vorbis|DTS combination is not supported.
+ if (codec == HB_ACODEC_VORBIS)
+ {
+ a_unsup = "Vorbis";
+ codec = HB_ACODEC_FAAC;
+ }
+ }
+ if (a_unsup)
+ {
+ message = g_strdup_printf(
+ "%s is not supported in the %s container.\n\n"
+ "You should choose a different audio codec.\n"
+ "If you continue, one will be chosen for you.", a_unsup, mux_s);
+ if (!ghb_message_dialog(GTK_MESSAGE_WARNING, message, "Cancel", "Continue"))
+ {
+ g_free(message);
+ return FALSE;
+ }
+ g_free(message);
+ value = ghb_lookup_acodec_value(codec);
+ ghb_settings_take_value(asettings, "AudioEncoder", value);
+ }
+
+ gint mix = ghb_settings_combo_int (asettings, "AudioMixdown");
+
+ gint jj;
+ gchar *mix_unsup = NULL;
+ if (!hb_mixdown_is_supported(mix, codec, aconfig->in.channel_layout))
+ {
+ for (jj = 0; jj < hb_audio_mixdowns_count; jj++)
+ {
+ if (mix == hb_audio_mixdowns[jj].amixdown)
+ {
+ {
+ mix_unsup = hb_audio_mixdowns[jj].human_readable_name;
+ }
+ }
+ }
+ }
+ if (mix_unsup)
+ {
+ message = g_strdup_printf(
+ "The source audio does not support %s mixdown.\n\n"
+ "You should choose a different mixdown.\n"
+ "If you continue, one will be chosen for you.", mix_unsup);
+ if (!ghb_message_dialog(GTK_MESSAGE_WARNING, message, "Cancel", "Continue"))
+ {
+ g_free(message);
+ return FALSE;
+ }
+ g_free(message);
+ mix = ghb_get_best_mix(aconfig, codec, mix);
+ value = get_amix_value(mix);
+ ghb_settings_take_value(asettings, "AudioMixdown", value);
+ }
+ }
+ return TRUE;
}
gboolean
ghb_validate_vquality(GValue *settings)
{
- gint vcodec;
- gchar *message;
- gint min, max;
-
- if (ghb_settings_get_boolean(settings, "nocheckvquality")) return TRUE;
- vcodec = ghb_settings_combo_int(settings, "VideoEncoder");
- gdouble vquality;
- vquality = ghb_settings_get_double(settings, "VideoQualitySlider");
- if (ghb_settings_get_boolean(settings, "vquality_type_constant"))
- {
- switch (vcodec)
- {
- case HB_VCODEC_X264:
- {
- min = 16;
- max = 30;
- } break;
-
- case HB_VCODEC_FFMPEG_MPEG2:
- case HB_VCODEC_FFMPEG_MPEG4:
- {
- min = 1;
- max = 8;
- } break;
-
- case HB_VCODEC_THEORA:
- {
- min = 0;
- max = 63;
- } break;
-
- default:
- {
- min = 48;
- max = 62;
- } break;
- }
- if (vcodec == HB_VCODEC_X264 && vquality == 0.0)
- {
- message = g_strdup_printf(
- "Warning: lossless h.264 selected\n\n"
- "Lossless h.264 is not well supported by\n"
- "many players and editors.\n\n"
+ gint vcodec;
+ gchar *message;
+ gint min, max;
+
+ if (ghb_settings_get_boolean(settings, "nocheckvquality")) return TRUE;
+ vcodec = ghb_settings_combo_int(settings, "VideoEncoder");
+ gdouble vquality;
+ vquality = ghb_settings_get_double(settings, "VideoQualitySlider");
+ if (ghb_settings_get_boolean(settings, "vquality_type_constant"))
+ {
+ switch (vcodec)
+ {
+ case HB_VCODEC_X264:
+ {
+ min = 16;
+ max = 30;
+ } break;
+
+ case HB_VCODEC_FFMPEG_MPEG2:
+ case HB_VCODEC_FFMPEG_MPEG4:
+ {
+ min = 1;
+ max = 8;
+ } break;
+
+ case HB_VCODEC_THEORA:
+ {
+ min = 0;
+ max = 63;
+ } break;
+
+ default:
+ {
+ min = 48;
+ max = 62;
+ } break;
+ }
+ if (vcodec == HB_VCODEC_X264 && vquality == 0.0)
+ {
+ message = g_strdup_printf(
+ "Warning: lossless h.264 selected\n\n"
+ "Lossless h.264 is not well supported by\n"
+ "many players and editors.\n\n"
"It will produce enormous output files.\n\n"
- "Are you sure you wish to use this setting?");
- if (!ghb_message_dialog(GTK_MESSAGE_QUESTION, message,
- "Cancel", "Continue"))
- {
- g_free(message);
- return FALSE;
- }
- g_free(message);
- }
- else if (vquality < min || vquality > max)
- {
- message = g_strdup_printf(
- "Interesting video quality choice: %d\n\n"
- "Typical values range from %d to %d.\n\n"
- "Are you sure you wish to use this setting?",
- (gint)vquality, min, max);
- if (!ghb_message_dialog(GTK_MESSAGE_QUESTION, message,
- "Cancel", "Continue"))
- {
- g_free(message);
- return FALSE;
- }
- g_free(message);
- }
- }
- return TRUE;
+ "Are you sure you wish to use this setting?");
+ if (!ghb_message_dialog(GTK_MESSAGE_QUESTION, message,
+ "Cancel", "Continue"))
+ {
+ g_free(message);
+ return FALSE;
+ }
+ g_free(message);
+ }
+ else if (vquality < min || vquality > max)
+ {
+ message = g_strdup_printf(
+ "Interesting video quality choice: %d\n\n"
+ "Typical values range from %d to %d.\n\n"
+ "Are you sure you wish to use this setting?",
+ (gint)vquality, min, max);
+ if (!ghb_message_dialog(GTK_MESSAGE_QUESTION, message,
+ "Cancel", "Continue"))
+ {
+ g_free(message);
+ return FALSE;
+ }
+ g_free(message);
+ }
+ }
+ return TRUE;
}
static void
add_job(hb_handle_t *h, GValue *js, gint unique_id, gint titleindex)
{
- hb_list_t * list;
- hb_title_t * title;
- hb_job_t * job;
- gint sub_id = 0;
- hb_filter_object_t * filter;
- gchar *filter_str;
- gchar *dest_str = NULL;
-
- g_debug("add_job()\n");
- if (h == NULL) return;
- list = hb_get_titles( h );
- if( !hb_list_count( list ) )
- {
- /* No valid title, stop right there */
- return;
- }
+ hb_list_t * list;
+ hb_title_t * title;
+ hb_job_t * job;
+ gint sub_id = 0;
+ hb_filter_object_t * filter;
+ gchar *filter_str;
+ gchar *dest_str = NULL;
+
+ g_debug("add_job()\n");
+ if (h == NULL) return;
+ list = hb_get_titles( h );
+ if( !hb_list_count( list ) )
+ {
+ /* No valid title, stop right there */
+ return;
+ }
title = hb_list_item( list, titleindex );
- if (title == NULL) return;
-
- /* Set job settings */
- job = hb_job_init( title );
- if (job == NULL) return;
-
- job->angle = ghb_settings_get_int(js, "angle");
- job->start_at_preview = ghb_settings_get_int(js, "start_frame") + 1;
- if (job->start_at_preview)
- {
- job->seek_points = ghb_settings_get_int(js, "preview_count");
- job->pts_to_stop = ghb_settings_get_int(js, "live_duration") * 90000LL;
- }
-
- job->mux = ghb_settings_combo_int(js, "FileFormat");
- if (job->mux == HB_MUX_MP4)
- {
- job->largeFileSize = ghb_settings_get_boolean(js, "Mp4LargeFile");
- job->mp4_optimize = ghb_settings_get_boolean(js, "Mp4HttpOptimize");
- }
- else
- {
- job->largeFileSize = FALSE;
- job->mp4_optimize = FALSE;
- }
- if (!job->start_at_preview)
- {
- gint start, end;
- gint num_chapters = hb_list_count(title->list_chapter);
- gint duration = title->duration / 90000;
- job->chapter_markers = FALSE;
- job->chapter_start = 1;
- job->chapter_end = num_chapters;
-
- if (ghb_settings_combo_int(js, "PtoPType") == 0)
- {
- start = ghb_settings_get_int(js, "start_point");
- end = ghb_settings_get_int(js, "end_point");
- job->chapter_start = MIN( num_chapters, start );
- job->chapter_end = MAX( job->chapter_start, end );
-
- }
- if (ghb_settings_combo_int(js, "PtoPType") == 1)
- {
- start = ghb_settings_get_int(js, "start_point");
- end = ghb_settings_get_int(js, "end_point");
- job->pts_to_start = (int64_t)MIN(duration-1, start) * 90000;
- job->pts_to_stop = (int64_t)MAX(start+1, end) * 90000 -
- job->pts_to_start;
- }
- if (ghb_settings_combo_int(js, "PtoPType") == 2)
- {
- start = ghb_settings_get_int(js, "start_point");
- end = ghb_settings_get_int(js, "end_point");
- gint64 max_frames;
- max_frames = (gint64)duration * title->rate / title->rate_base;
- job->frame_to_start = (int64_t)MIN(max_frames-1, start-1);
- job->frame_to_stop = (int64_t)MAX(start, end-1) -
- job->frame_to_start;
- }
- if (job->chapter_start != job->chapter_end)
- {
- job->chapter_markers = ghb_settings_get_boolean(js, "ChapterMarkers");
- }
- if (job->chapter_start == job->chapter_end)
- job->chapter_markers = 0;
- if ( job->chapter_markers )
- {
- GValue *chapters;
- GValue *chapter;
- gint chap;
- gint count;
-
- chapters = ghb_settings_get_value(js, "chapter_list");
- count = ghb_array_len(chapters);
- for(chap = 0; chap < count; chap++)
- {
- hb_chapter_t * chapter_s;
- gchar *name;
-
- name = NULL;
- chapter = ghb_array_get_nth(chapters, chap);
- name = ghb_value_string(chapter);
- if (name == NULL)
- {
- name = g_strdup_printf ("Chapter %2d", chap+1);
- }
- chapter_s = hb_list_item( job->list_chapter, chap);
- hb_chapter_set_title(chapter_s, name);
- g_free(name);
- }
- }
- }
-
- gboolean decomb_deint = ghb_settings_get_boolean(js, "PictureDecombDeinterlace");
- gint decomb = ghb_settings_combo_int(js, "PictureDecomb");
- gint deint = ghb_settings_combo_int(js, "PictureDeinterlace");
- if (!decomb_deint)
- job->deinterlace = (deint != 0) ? 1 : 0;
- else
- job->deinterlace = 0;
+ if (title == NULL) return;
+
+ /* Set job settings */
+ job = hb_job_init( title );
+ if (job == NULL) return;
+
+ job->angle = ghb_settings_get_int(js, "angle");
+ job->start_at_preview = ghb_settings_get_int(js, "start_frame") + 1;
+ if (job->start_at_preview)
+ {
+ job->seek_points = ghb_settings_get_int(js, "preview_count");
+ job->pts_to_stop = ghb_settings_get_int(js, "live_duration") * 90000LL;
+ }
+
+ job->mux = ghb_settings_combo_int(js, "FileFormat");
+ if (job->mux == HB_MUX_MP4)
+ {
+ job->largeFileSize = ghb_settings_get_boolean(js, "Mp4LargeFile");
+ job->mp4_optimize = ghb_settings_get_boolean(js, "Mp4HttpOptimize");
+ }
+ else
+ {
+ job->largeFileSize = FALSE;
+ job->mp4_optimize = FALSE;
+ }
+ if (!job->start_at_preview)
+ {
+ gint start, end;
+ gint num_chapters = hb_list_count(title->list_chapter);
+ gint duration = title->duration / 90000;
+ job->chapter_markers = FALSE;
+ job->chapter_start = 1;
+ job->chapter_end = num_chapters;
+
+ if (ghb_settings_combo_int(js, "PtoPType") == 0)
+ {
+ start = ghb_settings_get_int(js, "start_point");
+ end = ghb_settings_get_int(js, "end_point");
+ job->chapter_start = MIN( num_chapters, start );
+ job->chapter_end = MAX( job->chapter_start, end );
+
+ }
+ if (ghb_settings_combo_int(js, "PtoPType") == 1)
+ {
+ start = ghb_settings_get_int(js, "start_point");
+ end = ghb_settings_get_int(js, "end_point");
+ job->pts_to_start = (int64_t)MIN(duration-1, start) * 90000;
+ job->pts_to_stop = (int64_t)MAX(start+1, end) * 90000 -
+ job->pts_to_start;
+ }
+ if (ghb_settings_combo_int(js, "PtoPType") == 2)
+ {
+ start = ghb_settings_get_int(js, "start_point");
+ end = ghb_settings_get_int(js, "end_point");
+ gint64 max_frames;
+ max_frames = (gint64)duration * title->rate / title->rate_base;
+ job->frame_to_start = (int64_t)MIN(max_frames-1, start-1);
+ job->frame_to_stop = (int64_t)MAX(start, end-1) -
+ job->frame_to_start;
+ }
+ if (job->chapter_start != job->chapter_end)
+ {
+ job->chapter_markers = ghb_settings_get_boolean(js, "ChapterMarkers");
+ }
+ if (job->chapter_start == job->chapter_end)
+ job->chapter_markers = 0;
+ if ( job->chapter_markers )
+ {
+ GValue *chapters;
+ GValue *chapter;
+ gint chap;
+ gint count;
+
+ chapters = ghb_settings_get_value(js, "chapter_list");
+ count = ghb_array_len(chapters);
+ for(chap = 0; chap < count; chap++)
+ {
+ hb_chapter_t * chapter_s;
+ gchar *name;
+
+ name = NULL;
+ chapter = ghb_array_get_nth(chapters, chap);
+ name = ghb_value_string(chapter);
+ if (name == NULL)
+ {
+ name = g_strdup_printf ("Chapter %2d", chap+1);
+ }
+ chapter_s = hb_list_item( job->list_chapter, chap);
+ hb_chapter_set_title(chapter_s, name);
+ g_free(name);
+ }
+ }
+ }
+
+ gboolean decomb_deint = ghb_settings_get_boolean(js, "PictureDecombDeinterlace");
+ gint decomb = ghb_settings_combo_int(js, "PictureDecomb");
+ gint deint = ghb_settings_combo_int(js, "PictureDeinterlace");
+ if (!decomb_deint)
+ job->deinterlace = (deint != 0) ? 1 : 0;
+ else
+ job->deinterlace = 0;
job->grayscale = ghb_settings_get_boolean(js, "VideoGrayScale");
- gboolean keep_aspect;
- keep_aspect = ghb_settings_get_boolean(js, "PictureKeepRatio");
- job->anamorphic.mode = ghb_settings_combo_int(js, "PicturePAR");
- job->modulus = ghb_settings_combo_int(js, "PictureModulus");
- if (job->anamorphic.mode)
- {
- job->anamorphic.par_width =
- ghb_settings_get_int(js, "PicturePARWidth");
- job->anamorphic.par_height =
- ghb_settings_get_int(js, "PicturePARHeight");
- job->anamorphic.dar_width = 0;
- job->anamorphic.dar_height = 0;
-
- if (job->anamorphic.mode == 3 && !keep_aspect)
- {
- job->anamorphic.keep_display_aspect = 0;
- }
- else
- {
- job->anamorphic.keep_display_aspect = 1;
- }
- }
-
- int width, height, crop[4];
- width = ghb_settings_get_int(js, "scale_width");
- height = ghb_settings_get_int(js, "scale_height");
-
- crop[0] = ghb_settings_get_int(js, "PictureTopCrop");
- crop[1] = ghb_settings_get_int(js, "PictureBottomCrop");
- crop[2] = ghb_settings_get_int(js, "PictureLeftCrop");
- crop[3] = ghb_settings_get_int(js, "PictureRightCrop");
-
- filter_str = g_strdup_printf("%d:%d:%d:%d:%d:%d",
- width, height, crop[0], crop[1], crop[2], crop[3]);
- filter = hb_filter_init(HB_FILTER_CROP_SCALE);
- hb_add_filter( job, filter, filter_str );
- g_free(filter_str);
-
- /* Add selected filters */
- gint detel = ghb_settings_combo_int(js, "PictureDetelecine");
- if ( detel )
- {
- filter_str = NULL;
- if (detel != 1)
- {
- if (detel_opts.map[detel].svalue != NULL)
- filter_str = g_strdup(detel_opts.map[detel].svalue);
- }
- else
- filter_str = ghb_settings_get_string(js, "PictureDetelecineCustom");
- filter = hb_filter_init(HB_FILTER_DETELECINE);
- hb_add_filter( job, filter, filter_str );
- g_free(filter_str);
- }
- if ( decomb_deint && decomb )
- {
- filter_str = NULL;
- if (decomb != 1)
- {
- if (decomb_opts.map[decomb].svalue != NULL)
- filter_str = g_strdup(decomb_opts.map[decomb].svalue);
- }
- else
- filter_str = ghb_settings_get_string(js, "PictureDecombCustom");
- filter = hb_filter_init(HB_FILTER_DECOMB);
- hb_add_filter( job, filter, filter_str );
- g_free(filter_str);
- }
- if( job->deinterlace )
- {
- filter_str = NULL;
- if (deint != 1)
- {
- if (deint_opts.map[deint].svalue != NULL)
- filter_str = g_strdup(deint_opts.map[deint].svalue);
- }
- else
- filter_str = ghb_settings_get_string(js, "PictureDeinterlaceCustom");
- filter = hb_filter_init(HB_FILTER_DEINTERLACE);
- hb_add_filter( job, filter, filter_str );
- g_free(filter_str);
- }
- gint denoise = ghb_settings_combo_int(js, "PictureDenoise");
- if( denoise )
- {
- filter_str = NULL;
- if (denoise != 1)
- {
- if (denoise_opts.map[denoise].svalue != NULL)
- filter_str = g_strdup(denoise_opts.map[denoise].svalue);
- }
- else
- filter_str = ghb_settings_get_string(js, "PictureDenoiseCustom");
- filter = hb_filter_init(HB_FILTER_DENOISE);
- hb_add_filter( job, filter, filter_str );
- g_free(filter_str);
- }
- gint deblock = ghb_settings_get_int(js, "PictureDeblock");
- if( deblock >= 5 )
- {
- filter_str = NULL;
- filter_str = g_strdup_printf("%d", deblock);
- filter = hb_filter_init(HB_FILTER_DEBLOCK);
- hb_add_filter( job, filter, filter_str );
- g_free(filter_str);
- }
-
- job->vcodec = ghb_settings_combo_int(js, "VideoEncoder");
- if ((job->mux == HB_MUX_MP4 ) && (job->vcodec == HB_VCODEC_THEORA))
- {
- // mp4/theora combination is not supported.
- job->vcodec = HB_VCODEC_FFMPEG_MPEG4;
- }
- if ((job->vcodec == HB_VCODEC_X264) && (job->mux == HB_MUX_MP4))
- {
- job->ipod_atom = ghb_settings_get_boolean(js, "Mp4iPodCompatible");
- }
- if (ghb_settings_get_boolean(js, "vquality_type_constant"))
- {
- gdouble vquality;
- vquality = ghb_settings_get_double(js, "VideoQualitySlider");
- job->vquality = vquality;
- job->vbitrate = 0;
- }
- else if (ghb_settings_get_boolean(js, "vquality_type_bitrate"))
- {
- job->vquality = -1.0;
- job->vbitrate = ghb_settings_get_int(js, "VideoAvgBitrate");
- }
-
- gint vrate;
- gint vrate_base = ghb_settings_combo_int(js, "VideoFramerate");
- gint cfr;
- if (ghb_settings_get_boolean(js, "VideoFrameratePFR"))
- cfr = 2;
- else if (ghb_settings_get_boolean(js, "VideoFramerateCFR"))
- cfr = 1;
- else
- cfr = 0;
+ gboolean keep_aspect;
+ keep_aspect = ghb_settings_get_boolean(js, "PictureKeepRatio");
+ job->anamorphic.mode = ghb_settings_combo_int(js, "PicturePAR");
+ job->modulus = ghb_settings_combo_int(js, "PictureModulus");
+ if (job->anamorphic.mode)
+ {
+ job->anamorphic.par_width =
+ ghb_settings_get_int(js, "PicturePARWidth");
+ job->anamorphic.par_height =
+ ghb_settings_get_int(js, "PicturePARHeight");
+ job->anamorphic.dar_width = 0;
+ job->anamorphic.dar_height = 0;
+
+ if (job->anamorphic.mode == 3 && !keep_aspect)
+ {
+ job->anamorphic.keep_display_aspect = 0;
+ }
+ else
+ {
+ job->anamorphic.keep_display_aspect = 1;
+ }
+ }
+
+ int width, height, crop[4];
+ width = ghb_settings_get_int(js, "scale_width");
+ height = ghb_settings_get_int(js, "scale_height");
+
+ crop[0] = ghb_settings_get_int(js, "PictureTopCrop");
+ crop[1] = ghb_settings_get_int(js, "PictureBottomCrop");
+ crop[2] = ghb_settings_get_int(js, "PictureLeftCrop");
+ crop[3] = ghb_settings_get_int(js, "PictureRightCrop");
+
+ filter_str = g_strdup_printf("%d:%d:%d:%d:%d:%d",
+ width, height, crop[0], crop[1], crop[2], crop[3]);
+ filter = hb_filter_init(HB_FILTER_CROP_SCALE);
+ hb_add_filter( job, filter, filter_str );
+ g_free(filter_str);
+
+ /* Add selected filters */
+ gint detel = ghb_settings_combo_int(js, "PictureDetelecine");
+ if ( detel )
+ {
+ filter_str = NULL;
+ if (detel != 1)
+ {
+ if (detel_opts.map[detel].svalue != NULL)
+ filter_str = g_strdup(detel_opts.map[detel].svalue);
+ }
+ else
+ filter_str = ghb_settings_get_string(js, "PictureDetelecineCustom");
+ filter = hb_filter_init(HB_FILTER_DETELECINE);
+ hb_add_filter( job, filter, filter_str );
+ g_free(filter_str);
+ }
+ if ( decomb_deint && decomb )
+ {
+ filter_str = NULL;
+ if (decomb != 1)
+ {
+ if (decomb_opts.map[decomb].svalue != NULL)
+ filter_str = g_strdup(decomb_opts.map[decomb].svalue);
+ }
+ else
+ filter_str = ghb_settings_get_string(js, "PictureDecombCustom");
+ filter = hb_filter_init(HB_FILTER_DECOMB);
+ hb_add_filter( job, filter, filter_str );
+ g_free(filter_str);
+ }
+ if( job->deinterlace )
+ {
+ filter_str = NULL;
+ if (deint != 1)
+ {
+ if (deint_opts.map[deint].svalue != NULL)
+ filter_str = g_strdup(deint_opts.map[deint].svalue);
+ }
+ else
+ filter_str = ghb_settings_get_string(js, "PictureDeinterlaceCustom");
+ filter = hb_filter_init(HB_FILTER_DEINTERLACE);
+ hb_add_filter( job, filter, filter_str );
+ g_free(filter_str);
+ }
+ gint denoise = ghb_settings_combo_int(js, "PictureDenoise");
+ if( denoise )
+ {
+ filter_str = NULL;
+ if (denoise != 1)
+ {
+ if (denoise_opts.map[denoise].svalue != NULL)
+ filter_str = g_strdup(denoise_opts.map[denoise].svalue);
+ }
+ else
+ filter_str = ghb_settings_get_string(js, "PictureDenoiseCustom");
+ filter = hb_filter_init(HB_FILTER_DENOISE);
+ hb_add_filter( job, filter, filter_str );
+ g_free(filter_str);
+ }
+ gint deblock = ghb_settings_get_int(js, "PictureDeblock");
+ if( deblock >= 5 )
+ {
+ filter_str = NULL;
+ filter_str = g_strdup_printf("%d", deblock);
+ filter = hb_filter_init(HB_FILTER_DEBLOCK);
+ hb_add_filter( job, filter, filter_str );
+ g_free(filter_str);
+ }
+
+ job->vcodec = ghb_settings_combo_int(js, "VideoEncoder");
+ if ((job->mux == HB_MUX_MP4 ) && (job->vcodec == HB_VCODEC_THEORA))
+ {
+ // mp4/theora combination is not supported.
+ job->vcodec = HB_VCODEC_FFMPEG_MPEG4;
+ }
+ if ((job->vcodec == HB_VCODEC_X264) && (job->mux == HB_MUX_MP4))
+ {
+ job->ipod_atom = ghb_settings_get_boolean(js, "Mp4iPodCompatible");
+ }
+ if (ghb_settings_get_boolean(js, "vquality_type_constant"))
+ {
+ gdouble vquality;
+ vquality = ghb_settings_get_double(js, "VideoQualitySlider");
+ job->vquality = vquality;
+ job->vbitrate = 0;
+ }
+ else if (ghb_settings_get_boolean(js, "vquality_type_bitrate"))
+ {
+ job->vquality = -1.0;
+ job->vbitrate = ghb_settings_get_int(js, "VideoAvgBitrate");
+ }
+
+ gint vrate;
+ gint vrate_base = ghb_settings_combo_int(js, "VideoFramerate");
+ gint cfr;
+ if (ghb_settings_get_boolean(js, "VideoFrameratePFR"))
+ cfr = 2;
+ else if (ghb_settings_get_boolean(js, "VideoFramerateCFR"))
+ cfr = 1;
+ else
+ cfr = 0;
// x264 zero latency requires CFR encode
if (ghb_settings_get_boolean(js, "x264ZeroLatency"))
@@ -4931,351 +4931,351 @@ add_job(hb_handle_t *h, GValue *js, gint unique_id, gint titleindex)
ghb_log("zerolatency x264 tune selected, forcing constant framerate");
}
- if( vrate_base == 0 )
- {
- vrate = title->rate;
- vrate_base = title->rate_base;
- }
- else
- {
- vrate = 27000000;
- }
- filter_str = g_strdup_printf("%d:%d:%d", cfr, vrate, vrate_base);
- filter = hb_filter_init(HB_FILTER_VFR);
- hb_add_filter( job, filter, filter_str );
- g_free(filter_str);
-
- const GValue *audio_list;
- gint count, ii;
- gint tcount = 0;
-
- audio_list = ghb_settings_get_value(js, "audio_list");
- count = ghb_array_len(audio_list);
- for (ii = 0; ii < count; ii++)
- {
- GValue *asettings;
- hb_audio_config_t audio;
- hb_audio_config_t *aconfig;
- gint acodec, fallback;
-
- hb_audio_config_init(&audio);
- asettings = ghb_array_get_nth(audio_list, ii);
- audio.in.track = ghb_settings_get_int(asettings, "AudioTrack");
- audio.out.track = tcount;
-
- char * aname = ghb_settings_get_string(asettings, "AudioTrackName");
- if (aname && *aname)
- {
- // This leaks, but there is no easy way to clean up
- // presently
- audio.out.name = aname;
- }
- else
- {
- g_free(aname);
- }
+ if( vrate_base == 0 )
+ {
+ vrate = title->rate;
+ vrate_base = title->rate_base;
+ }
+ else
+ {
+ vrate = 27000000;
+ }
+ filter_str = g_strdup_printf("%d:%d:%d", cfr, vrate, vrate_base);
+ filter = hb_filter_init(HB_FILTER_VFR);
+ hb_add_filter( job, filter, filter_str );
+ g_free(filter_str);
+
+ const GValue *audio_list;
+ gint count, ii;
+ gint tcount = 0;
+
+ audio_list = ghb_settings_get_value(js, "audio_list");
+ count = ghb_array_len(audio_list);
+ for (ii = 0; ii < count; ii++)
+ {
+ GValue *asettings;
+ hb_audio_config_t audio;
+ hb_audio_config_t *aconfig;
+ gint acodec, fallback;
+
+ hb_audio_config_init(&audio);
+ asettings = ghb_array_get_nth(audio_list, ii);
+ audio.in.track = ghb_settings_get_int(asettings, "AudioTrack");
+ audio.out.track = tcount;
+
+ char * aname = ghb_settings_get_string(asettings, "AudioTrackName");
+ if (aname && *aname)
+ {
+ // This leaks, but there is no easy way to clean up
+ // presently
+ audio.out.name = aname;
+ }
+ else
+ {
+ g_free(aname);
+ }
aconfig = (hb_audio_config_t *) hb_list_audio_config_item(
- title->list_audio, audio.in.track );
+ title->list_audio, audio.in.track );
- acodec = ghb_settings_combo_int(asettings, "AudioEncoder");
+ acodec = ghb_settings_combo_int(asettings, "AudioEncoder");
- fallback = ghb_settings_combo_int(js, "AudioEncoderFallback");
- gint copy_mask = ghb_get_copy_mask(js);
- audio.out.codec = ghb_select_audio_codec(job->mux, aconfig, acodec, fallback, copy_mask);
+ fallback = ghb_settings_combo_int(js, "AudioEncoderFallback");
+ gint copy_mask = ghb_get_copy_mask(js);
+ audio.out.codec = ghb_select_audio_codec(job->mux, aconfig, acodec, fallback, copy_mask);
- audio.out.gain =
- ghb_settings_get_double(asettings, "AudioTrackGain");
+ audio.out.gain =
+ ghb_settings_get_double(asettings, "AudioTrackGain");
audio.out.dynamic_range_compression =
- ghb_settings_get_double(asettings, "AudioTrackDRCSlider");
+ ghb_settings_get_double(asettings, "AudioTrackDRCSlider");
if (audio.out.dynamic_range_compression < 1.0)
- audio.out.dynamic_range_compression = 0.0;
-
- // It would be better if this were done in libhb for us, but its not yet.
- if (ghb_audio_is_passthru(audio.out.codec))
- {
- audio.out.mixdown = 0;
- }
- else
- {
- audio.out.mixdown = ghb_settings_combo_int(asettings, "AudioMixdown");
- // Make sure the mixdown is valid and pick a new one if not.
- audio.out.mixdown = ghb_get_best_mix(aconfig, audio.out.codec,
- audio.out.mixdown);
- gint srate = ghb_settings_combo_int(asettings, "AudioSamplerate");
- if (srate == 0) // 0 is same as source
- audio.out.samplerate = aconfig->in.samplerate;
- else
- audio.out.samplerate = srate;
- double quality = ghb_settings_get_double(asettings, "AudioTrackQuality");
- if (ghb_settings_get_boolean(asettings, "AudioTrackQualityEnable") &&
- quality != HB_INVALID_AUDIO_QUALITY)
- {
- audio.out.quality = quality;
- audio.out.bitrate = -1;
- }
- else
- {
- audio.out.quality = HB_INVALID_AUDIO_QUALITY;
- audio.out.bitrate =
- ghb_settings_combo_int(asettings, "AudioBitrate");
-
- audio.out.bitrate = hb_get_best_audio_bitrate(
- audio.out.codec, audio.out.bitrate,
- audio.out.samplerate, audio.out.mixdown);
- }
- }
-
- // Add it to the jobs audio list
+ audio.out.dynamic_range_compression = 0.0;
+
+ // It would be better if this were done in libhb for us, but its not yet.
+ if (ghb_audio_is_passthru(audio.out.codec))
+ {
+ audio.out.mixdown = 0;
+ }
+ else
+ {
+ audio.out.mixdown = ghb_settings_combo_int(asettings, "AudioMixdown");
+ // Make sure the mixdown is valid and pick a new one if not.
+ audio.out.mixdown = ghb_get_best_mix(aconfig, audio.out.codec,
+ audio.out.mixdown);
+ gint srate = ghb_settings_combo_int(asettings, "AudioSamplerate");
+ if (srate == 0) // 0 is same as source
+ audio.out.samplerate = aconfig->in.samplerate;
+ else
+ audio.out.samplerate = srate;
+ double quality = ghb_settings_get_double(asettings, "AudioTrackQuality");
+ if (ghb_settings_get_boolean(asettings, "AudioTrackQualityEnable") &&
+ quality != HB_INVALID_AUDIO_QUALITY)
+ {
+ audio.out.quality = quality;
+ audio.out.bitrate = -1;
+ }
+ else
+ {
+ audio.out.quality = HB_INVALID_AUDIO_QUALITY;
+ audio.out.bitrate =
+ ghb_settings_combo_int(asettings, "AudioBitrate");
+
+ audio.out.bitrate = hb_get_best_audio_bitrate(
+ audio.out.codec, audio.out.bitrate,
+ audio.out.samplerate, audio.out.mixdown);
+ }
+ }
+
+ // Add it to the jobs audio list
hb_audio_add( job, &audio );
- tcount++;
- }
-
- dest_str = ghb_settings_get_string(js, "destination");
- hb_job_set_file( job, dest_str);
- g_free(dest_str);
-
- const GValue *subtitle_list;
- gint subtitle;
- gboolean force, burned, def, one_burned = FALSE;
-
- ghb_settings_set_boolean(js, "subtitle_scan", FALSE);
- subtitle_list = ghb_settings_get_value(js, "subtitle_list");
- count = ghb_array_len(subtitle_list);
- for (ii = 0; ii < count; ii++)
- {
- GValue *ssettings;
- gint source;
-
- ssettings = ghb_array_get_nth(subtitle_list, ii);
-
- force = ghb_settings_get_boolean(ssettings, "SubtitleForced");
- burned = ghb_settings_get_boolean(ssettings, "SubtitleBurned");
- def = ghb_settings_get_boolean(ssettings, "SubtitleDefaultTrack");
- source = ghb_settings_get_int(ssettings, "SubtitleSource");
-
- if (source == SRTSUB)
- {
- hb_subtitle_config_t sub_config;
- gchar *filename, *lang, *code;
-
- filename = ghb_settings_get_string(ssettings, "SrtFile");
- if (!g_file_test(filename, G_FILE_TEST_IS_REGULAR))
- {
- continue;
- }
- sub_config.offset = ghb_settings_get_int(ssettings, "SrtOffset");
- lang = ghb_settings_get_string(ssettings, "SrtLanguage");
- code = ghb_settings_get_string(ssettings, "SrtCodeset");
- strncpy(sub_config.src_filename, filename, 255);
- sub_config.src_filename[255] = 0;
- strncpy(sub_config.src_codeset, code, 39);
- sub_config.src_codeset[39] = 0;
- sub_config.force = 0;
- sub_config.dest = PASSTHRUSUB;
- sub_config.default_track = def;
-
- hb_srt_add( job, &sub_config, lang);
-
- g_free(filename);
- g_free(lang);
- g_free(code);
- continue;
- }
-
- subtitle = ghb_settings_get_int(ssettings, "SubtitleTrack");
- if (subtitle == -1)
- {
- if (!burned)
- {
- job->select_subtitle_config.dest = PASSTHRUSUB;
- }
- else if (burned)
- {
- // Only allow one subtitle to be burned into the video
- if (one_burned)
- continue;
- job->select_subtitle_config.dest = RENDERSUB;
- one_burned = TRUE;
- }
- job->select_subtitle_config.force = force;
- job->select_subtitle_config.default_track = def;
- job->indepth_scan = 1;
- ghb_settings_set_boolean(js, "subtitle_scan", TRUE);
- }
- else if (subtitle >= 0)
- {
- hb_subtitle_t * subt;
- hb_subtitle_config_t sub_config;
-
- subt = (hb_subtitle_t *)hb_list_item(title->list_subtitle, subtitle);
- if (subt != NULL)
- {
- sub_config = subt->config;
- if (!burned)
- {
- sub_config.dest = PASSTHRUSUB;
- }
- else if ( burned && ghb_canBurnSub(subt->source) )
- {
- // Only allow one subtitle to be burned into the video
- if (one_burned)
- continue;
- sub_config.dest = RENDERSUB;
- one_burned = TRUE;
- }
- sub_config.force = force;
- sub_config.default_track = def;
- hb_subtitle_add( job, &sub_config, subtitle );
- }
- }
- }
- if (one_burned)
- {
- // Add filter that renders vobsubs
- filter = hb_filter_init(HB_FILTER_RENDER_SUB);
- filter_str = g_strdup_printf("%d:%d:%d:%d",
- crop[0], crop[1], crop[2], crop[3]);
- hb_add_filter( job, filter, filter_str );
- g_free(filter_str);
- }
-
-
- char * meta;
-
- meta = ghb_settings_get_string(js, "MetaName");
- if (meta && *meta)
- {
- hb_metadata_set_name(job->metadata, meta);
- }
- free(meta);
- meta = ghb_settings_get_string(js, "MetaArtist");
- if (meta && *meta)
- {
- hb_metadata_set_artist(job->metadata, meta);
- }
- free(meta);
- meta = ghb_settings_get_string(js, "MetaAlbumArtist");
- if (meta && *meta)
- {
- hb_metadata_set_album_artist(job->metadata, meta);
- }
- free(meta);
- meta = ghb_settings_get_string(js, "MetaReleaseDate");
- if (meta && *meta)
- {
- hb_metadata_set_release_date(job->metadata, meta);
- }
- free(meta);
- meta = ghb_settings_get_string(js, "MetaComment");
- if (meta && *meta)
- {
- hb_metadata_set_comment(job->metadata, meta);
- }
- free(meta);
- meta = ghb_settings_get_string(js, "MetaGenre");
- if (meta && *meta)
- {
- hb_metadata_set_genre(job->metadata, meta);
- }
- free(meta);
- meta = ghb_settings_get_string(js, "MetaDescription");
- if (meta && *meta)
- {
- hb_metadata_set_description(job->metadata, meta);
- }
- free(meta);
- meta = ghb_settings_get_string(js, "MetaLongDescription");
- if (meta && *meta)
- {
- hb_metadata_set_long_description(job->metadata, meta);
- }
- free(meta);
-
- if (job->indepth_scan == 1)
- {
- // Subtitle scan. Look for subtitle matching audio language
-
- /*
- * When subtitle scan is enabled do a fast pre-scan job
- * which will determine which subtitles to enable, if any.
- */
- job->pass = -1;
- job->indepth_scan = 1;
- hb_job_set_advanced_opts(job, NULL);
-
- /*
- * Add the pre-scan job
- */
- job->sequence_id = (unique_id & 0xFFFFFF) | (sub_id++ << 24);
- hb_add( h, job );
- }
-
- if( ghb_settings_get_boolean(js, "VideoTwoPass") &&
- !ghb_settings_get_boolean(js, "vquality_type_constant"))
- {
- /*
- * If subtitle_scan is enabled then only turn it on
- * for the second pass and then off again for the
- * second.
- */
- job->pass = 1;
- job->indepth_scan = 0;
+ tcount++;
+ }
+
+ dest_str = ghb_settings_get_string(js, "destination");
+ hb_job_set_file( job, dest_str);
+ g_free(dest_str);
+
+ const GValue *subtitle_list;
+ gint subtitle;
+ gboolean force, burned, def, one_burned = FALSE;
+
+ ghb_settings_set_boolean(js, "subtitle_scan", FALSE);
+ subtitle_list = ghb_settings_get_value(js, "subtitle_list");
+ count = ghb_array_len(subtitle_list);
+ for (ii = 0; ii < count; ii++)
+ {
+ GValue *ssettings;
+ gint source;
+
+ ssettings = ghb_array_get_nth(subtitle_list, ii);
+
+ force = ghb_settings_get_boolean(ssettings, "SubtitleForced");
+ burned = ghb_settings_get_boolean(ssettings, "SubtitleBurned");
+ def = ghb_settings_get_boolean(ssettings, "SubtitleDefaultTrack");
+ source = ghb_settings_get_int(ssettings, "SubtitleSource");
+
+ if (source == SRTSUB)
+ {
+ hb_subtitle_config_t sub_config;
+ gchar *filename, *lang, *code;
+
+ filename = ghb_settings_get_string(ssettings, "SrtFile");
+ if (!g_file_test(filename, G_FILE_TEST_IS_REGULAR))
+ {
+ continue;
+ }
+ sub_config.offset = ghb_settings_get_int(ssettings, "SrtOffset");
+ lang = ghb_settings_get_string(ssettings, "SrtLanguage");
+ code = ghb_settings_get_string(ssettings, "SrtCodeset");
+ strncpy(sub_config.src_filename, filename, 255);
+ sub_config.src_filename[255] = 0;
+ strncpy(sub_config.src_codeset, code, 39);
+ sub_config.src_codeset[39] = 0;
+ sub_config.force = 0;
+ sub_config.dest = PASSTHRUSUB;
+ sub_config.default_track = def;
+
+ hb_srt_add( job, &sub_config, lang);
+
+ g_free(filename);
+ g_free(lang);
+ g_free(code);
+ continue;
+ }
+
+ subtitle = ghb_settings_get_int(ssettings, "SubtitleTrack");
+ if (subtitle == -1)
+ {
+ if (!burned)
+ {
+ job->select_subtitle_config.dest = PASSTHRUSUB;
+ }
+ else if (burned)
+ {
+ // Only allow one subtitle to be burned into the video
+ if (one_burned)
+ continue;
+ job->select_subtitle_config.dest = RENDERSUB;
+ one_burned = TRUE;
+ }
+ job->select_subtitle_config.force = force;
+ job->select_subtitle_config.default_track = def;
+ job->indepth_scan = 1;
+ ghb_settings_set_boolean(js, "subtitle_scan", TRUE);
+ }
+ else if (subtitle >= 0)
+ {
+ hb_subtitle_t * subt;
+ hb_subtitle_config_t sub_config;
+
+ subt = (hb_subtitle_t *)hb_list_item(title->list_subtitle, subtitle);
+ if (subt != NULL)
+ {
+ sub_config = subt->config;
+ if (!burned)
+ {
+ sub_config.dest = PASSTHRUSUB;
+ }
+ else if ( burned && ghb_canBurnSub(subt->source) )
+ {
+ // Only allow one subtitle to be burned into the video
+ if (one_burned)
+ continue;
+ sub_config.dest = RENDERSUB;
+ one_burned = TRUE;
+ }
+ sub_config.force = force;
+ sub_config.default_track = def;
+ hb_subtitle_add( job, &sub_config, subtitle );
+ }
+ }
+ }
+ if (one_burned)
+ {
+ // Add filter that renders vobsubs
+ filter = hb_filter_init(HB_FILTER_RENDER_SUB);
+ filter_str = g_strdup_printf("%d:%d:%d:%d",
+ crop[0], crop[1], crop[2], crop[3]);
+ hb_add_filter( job, filter, filter_str );
+ g_free(filter_str);
+ }
+
+
+ char * meta;
+
+ meta = ghb_settings_get_string(js, "MetaName");
+ if (meta && *meta)
+ {
+ hb_metadata_set_name(job->metadata, meta);
+ }
+ free(meta);
+ meta = ghb_settings_get_string(js, "MetaArtist");
+ if (meta && *meta)
+ {
+ hb_metadata_set_artist(job->metadata, meta);
+ }
+ free(meta);
+ meta = ghb_settings_get_string(js, "MetaAlbumArtist");
+ if (meta && *meta)
+ {
+ hb_metadata_set_album_artist(job->metadata, meta);
+ }
+ free(meta);
+ meta = ghb_settings_get_string(js, "MetaReleaseDate");
+ if (meta && *meta)
+ {
+ hb_metadata_set_release_date(job->metadata, meta);
+ }
+ free(meta);
+ meta = ghb_settings_get_string(js, "MetaComment");
+ if (meta && *meta)
+ {
+ hb_metadata_set_comment(job->metadata, meta);
+ }
+ free(meta);
+ meta = ghb_settings_get_string(js, "MetaGenre");
+ if (meta && *meta)
+ {
+ hb_metadata_set_genre(job->metadata, meta);
+ }
+ free(meta);
+ meta = ghb_settings_get_string(js, "MetaDescription");
+ if (meta && *meta)
+ {
+ hb_metadata_set_description(job->metadata, meta);
+ }
+ free(meta);
+ meta = ghb_settings_get_string(js, "MetaLongDescription");
+ if (meta && *meta)
+ {
+ hb_metadata_set_long_description(job->metadata, meta);
+ }
+ free(meta);
+
+ if (job->indepth_scan == 1)
+ {
+ // Subtitle scan. Look for subtitle matching audio language
+
+ /*
+ * When subtitle scan is enabled do a fast pre-scan job
+ * which will determine which subtitles to enable, if any.
+ */
+ job->pass = -1;
+ job->indepth_scan = 1;
+ hb_job_set_advanced_opts(job, NULL);
+
+ /*
+ * Add the pre-scan job
+ */
+ job->sequence_id = (unique_id & 0xFFFFFF) | (sub_id++ << 24);
+ hb_add( h, job );
+ }
+
+ if( ghb_settings_get_boolean(js, "VideoTwoPass") &&
+ !ghb_settings_get_boolean(js, "vquality_type_constant"))
+ {
+ /*
+ * If subtitle_scan is enabled then only turn it on
+ * for the second pass and then off again for the
+ * second.
+ */
+ job->pass = 1;
+ job->indepth_scan = 0;
ghb_set_video_encoder_opts(job, js);
- /*
- * If turbo options have been selected then set job->fastfirstpass
- */
- if( ghb_settings_get_boolean(js, "VideoTurboTwoPass") &&
- job->vcodec == HB_VCODEC_X264 )
- {
- job->fastfirstpass = 1;
- }
- else
- {
- job->fastfirstpass = 0;
- }
-
- job->sequence_id = (unique_id & 0xFFFFFF) | (sub_id++ << 24);
- hb_add( h, job );
-
- job->pass = 2;
- /*
- * On the second pass we turn off subtitle scan so that we
- * can actually encode using any subtitles that were auto
- * selected in the first pass (using the whacky select-subtitle
- * attribute of the job).
- */
- job->indepth_scan = 0;
- job->sequence_id = (unique_id & 0xFFFFFF) | (sub_id++ << 24);
- hb_add( h, job );
- }
- else
- {
+ /*
+ * If turbo options have been selected then set job->fastfirstpass
+ */
+ if( ghb_settings_get_boolean(js, "VideoTurboTwoPass") &&
+ job->vcodec == HB_VCODEC_X264 )
+ {
+ job->fastfirstpass = 1;
+ }
+ else
+ {
+ job->fastfirstpass = 0;
+ }
+
+ job->sequence_id = (unique_id & 0xFFFFFF) | (sub_id++ << 24);
+ hb_add( h, job );
+
+ job->pass = 2;
+ /*
+ * On the second pass we turn off subtitle scan so that we
+ * can actually encode using any subtitles that were auto
+ * selected in the first pass (using the whacky select-subtitle
+ * attribute of the job).
+ */
+ job->indepth_scan = 0;
+ job->sequence_id = (unique_id & 0xFFFFFF) | (sub_id++ << 24);
+ hb_add( h, job );
+ }
+ else
+ {
ghb_set_video_encoder_opts(job, js);
- job->indepth_scan = 0;
- job->pass = 0;
- job->sequence_id = (unique_id & 0xFFFFFF) | (sub_id++ << 24);
- hb_add( h, job );
- }
+ job->indepth_scan = 0;
+ job->pass = 0;
+ job->sequence_id = (unique_id & 0xFFFFFF) | (sub_id++ << 24);
+ hb_add( h, job );
+ }
- hb_job_close(&job);
+ hb_job_close(&job);
}
void
ghb_add_job(GValue *js, gint unique_id)
{
- // Since I'm doing a scan of the single title I want just prior
- // to adding the job, there is only the one title to choose from.
- add_job(h_queue, js, unique_id, 0);
+ // Since I'm doing a scan of the single title I want just prior
+ // to adding the job, there is only the one title to choose from.
+ add_job(h_queue, js, unique_id, 0);
}
void
ghb_add_live_job(GValue *js, gint unique_id)
{
- gint titleindex = ghb_settings_combo_int(js, "title");
- add_job(h_scan, js, unique_id, titleindex);
+ gint titleindex = ghb_settings_combo_int(js, "title");
+ add_job(h_scan, js, unique_id, titleindex);
}
void
@@ -5283,40 +5283,40 @@ ghb_remove_job(gint unique_id)
{
hb_job_t * job;
gint ii;
-
- // Multiples passes all get the same id
- // remove them all.
- // Go backwards through list, so reordering doesn't screw me.
- ii = hb_count(h_queue) - 1;
+
+ // Multiples passes all get the same id
+ // remove them all.
+ // Go backwards through list, so reordering doesn't screw me.
+ ii = hb_count(h_queue) - 1;
while ((job = hb_job(h_queue, ii--)) != NULL)
{
if ((job->sequence_id & 0xFFFFFF) == unique_id)
- hb_rem(h_queue, job);
+ hb_rem(h_queue, job);
}
}
void
ghb_start_queue()
{
- hb_start( h_queue );
+ hb_start( h_queue );
}
void
ghb_stop_queue()
{
- hb_stop( h_queue );
+ hb_stop( h_queue );
}
void
ghb_start_live_encode()
{
- hb_start( h_scan );
+ hb_start( h_scan );
}
void
ghb_stop_live_encode()
{
- hb_stop( h_scan );
+ hb_stop( h_scan );
}
void
@@ -5327,296 +5327,296 @@ ghb_pause_queue()
if( s.state == HB_STATE_PAUSED )
{
- hb_status.queue.state &= ~GHB_STATE_PAUSED;
- hb_resume( h_queue );
+ hb_status.queue.state &= ~GHB_STATE_PAUSED;
+ hb_resume( h_queue );
}
else
{
- hb_status.queue.state |= GHB_STATE_PAUSED;
- hb_pause( h_queue );
+ hb_status.queue.state |= GHB_STATE_PAUSED;
+ hb_pause( h_queue );
}
}
static void
vert_line(
- GdkPixbuf * pb,
- guint8 r,
- guint8 g,
- guint8 b,
- gint x,
- gint y,
- gint len,
- gint width)
-{
- guint8 *pixels = gdk_pixbuf_get_pixels (pb);
- guint8 *dst;
- gint ii, jj;
- gint channels = gdk_pixbuf_get_n_channels (pb);
- gint stride = gdk_pixbuf_get_rowstride (pb);
-
- for (jj = 0; jj < width; jj++)
- {
- dst = pixels + y * stride + (x+jj) * channels;
- for (ii = 0; ii < len; ii++)
- {
- dst[0] = r;
- dst[1] = g;
- dst[2] = b;
- dst += stride;
- }
- }
+ GdkPixbuf * pb,
+ guint8 r,
+ guint8 g,
+ guint8 b,
+ gint x,
+ gint y,
+ gint len,
+ gint width)
+{
+ guint8 *pixels = gdk_pixbuf_get_pixels (pb);
+ guint8 *dst;
+ gint ii, jj;
+ gint channels = gdk_pixbuf_get_n_channels (pb);
+ gint stride = gdk_pixbuf_get_rowstride (pb);
+
+ for (jj = 0; jj < width; jj++)
+ {
+ dst = pixels + y * stride + (x+jj) * channels;
+ for (ii = 0; ii < len; ii++)
+ {
+ dst[0] = r;
+ dst[1] = g;
+ dst[2] = b;
+ dst += stride;
+ }
+ }
}
static void
horz_line(
- GdkPixbuf * pb,
- guint8 r,
- guint8 g,
- guint8 b,
- gint x,
- gint y,
- gint len,
- gint width)
-{
- guint8 *pixels = gdk_pixbuf_get_pixels (pb);
- guint8 *dst;
- gint ii, jj;
- gint channels = gdk_pixbuf_get_n_channels (pb);
- gint stride = gdk_pixbuf_get_rowstride (pb);
-
- for (jj = 0; jj < width; jj++)
- {
- dst = pixels + (y+jj) * stride + x * channels;
- for (ii = 0; ii < len; ii++)
- {
- dst[0] = r;
- dst[1] = g;
- dst[2] = b;
- dst += channels;
- }
- }
+ GdkPixbuf * pb,
+ guint8 r,
+ guint8 g,
+ guint8 b,
+ gint x,
+ gint y,
+ gint len,
+ gint width)
+{
+ guint8 *pixels = gdk_pixbuf_get_pixels (pb);
+ guint8 *dst;
+ gint ii, jj;
+ gint channels = gdk_pixbuf_get_n_channels (pb);
+ gint stride = gdk_pixbuf_get_rowstride (pb);
+
+ for (jj = 0; jj < width; jj++)
+ {
+ dst = pixels + (y+jj) * stride + x * channels;
+ for (ii = 0; ii < len; ii++)
+ {
+ dst[0] = r;
+ dst[1] = g;
+ dst[2] = b;
+ dst += channels;
+ }
+ }
}
static void
hash_pixbuf(
- GdkPixbuf * pb,
- gint x,
- gint y,
- gint w,
- gint h,
- gint step,
- gint orientation)
-{
- gint ii, jj;
- gint line_width = 8;
- struct
- {
- guint8 r;
- guint8 g;
- guint8 b;
- } c[4] =
- {{0x80, 0x80, 0x80},{0xC0, 0x80, 0x70},{0x80, 0xA0, 0x80},{0x70, 0x80, 0xA0}};
-
- if (!orientation)
- {
- // vertical lines
- for (ii = x, jj = 0; ii+line_width < x+w; ii += step, jj++)
- {
- vert_line(pb, c[jj&3].r, c[jj&3].g, c[jj&3].b, ii, y, h, line_width);
- }
- }
- else
- {
- // horizontal lines
- for (ii = y, jj = 0; ii+line_width < y+h; ii += step, jj++)
- {
- horz_line(pb, c[jj&3].r, c[jj&3].g, c[jj&3].b, x, ii, w, line_width);
- }
- }
+ GdkPixbuf * pb,
+ gint x,
+ gint y,
+ gint w,
+ gint h,
+ gint step,
+ gint orientation)
+{
+ gint ii, jj;
+ gint line_width = 8;
+ struct
+ {
+ guint8 r;
+ guint8 g;
+ guint8 b;
+ } c[4] =
+ {{0x80, 0x80, 0x80},{0xC0, 0x80, 0x70},{0x80, 0xA0, 0x80},{0x70, 0x80, 0xA0}};
+
+ if (!orientation)
+ {
+ // vertical lines
+ for (ii = x, jj = 0; ii+line_width < x+w; ii += step, jj++)
+ {
+ vert_line(pb, c[jj&3].r, c[jj&3].g, c[jj&3].b, ii, y, h, line_width);
+ }
+ }
+ else
+ {
+ // horizontal lines
+ for (ii = y, jj = 0; ii+line_width < y+h; ii += step, jj++)
+ {
+ horz_line(pb, c[jj&3].r, c[jj&3].g, c[jj&3].b, x, ii, w, line_width);
+ }
+ }
}
GdkPixbuf*
ghb_get_preview_image(
- gint titleindex,
- gint index,
- signal_user_data_t *ud,
- gint *out_width,
- gint *out_height)
-{
- GValue *settings;
- hb_title_t *title;
- hb_job_t *job;
-
- settings = ud->settings;
- title = ghb_get_title_info( titleindex );
- if( title == NULL ) return NULL;
-
- job = hb_job_init( title );
- if (job == NULL) return NULL;
-
- set_preview_job_settings(job, settings);
-
- // hb_get_preview doesn't compensate for anamorphic, so lets
- // calculate scale factors
- gint width, height, par_width = 1, par_height = 1;
- gint pic_par = ghb_settings_combo_int(settings, "PicturePAR");
- if (pic_par)
- {
- hb_set_anamorphic_size( job, &width, &height,
- &par_width, &par_height );
- }
-
- // Make sure we have a big enough buffer to receive the image from libhb
- gint dstWidth = job->width;
- gint dstHeight= job->height;
-
- static guint8 *buffer = NULL;
- static gint bufferSize = 0;
- gint newSize;
-
- newSize = dstWidth * dstHeight * 4;
- if( bufferSize < newSize )
- {
- bufferSize = newSize;
- buffer = (guint8*) g_realloc( buffer, bufferSize );
- }
- hb_get_preview( h_scan, job, index, buffer );
- hb_job_close( &job );
-
- // Create an GdkPixbuf and copy the libhb image into it, converting it from
- // libhb's format something suitable.
-
- // The image data returned by hb_get_preview is 4 bytes per pixel,
- // BGRA format. Alpha is ignored.
-
- GdkPixbuf *preview = gdk_pixbuf_new(GDK_COLORSPACE_RGB, FALSE, 8, dstWidth, dstHeight);
- guint8 *pixels = gdk_pixbuf_get_pixels (preview);
-
- guint32 *src = (guint32*)buffer;
- guint8 *dst = pixels;
-
- gint ii, jj;
- gint channels = gdk_pixbuf_get_n_channels (preview);
- gint stride = gdk_pixbuf_get_rowstride (preview);
- guint8 *tmp;
-
- for (ii = 0; ii < dstHeight; ii++)
- {
- tmp = dst;
- for (jj = 0; jj < dstWidth; jj++)
- {
- tmp[0] = src[0] >> 16;
- tmp[1] = src[0] >> 8;
- tmp[2] = src[0] >> 0;
- tmp += channels;
- src++;
- }
- dst += stride;
- }
- gint w = ghb_settings_get_int(settings, "scale_width");
- gint h = ghb_settings_get_int(settings, "scale_height");
- ghb_par_scale(ud, &w, &h, par_width, par_height);
-
- gint c0, c1, c2, c3;
- c0 = ghb_settings_get_int(settings, "PictureTopCrop");
- c1 = ghb_settings_get_int(settings, "PictureBottomCrop");
- c2 = ghb_settings_get_int(settings, "PictureLeftCrop");
- c3 = ghb_settings_get_int(settings, "PictureRightCrop");
-
- gdouble xscale = (gdouble)w / (gdouble)(title->width - c2 - c3);
- gdouble yscale = (gdouble)h / (gdouble)(title->height - c0 - c1);
-
- ghb_par_scale(ud, &dstWidth, &dstHeight, par_width, par_height);
- *out_width = w;
- *out_height = h;
- if (ghb_settings_get_boolean(settings, "reduce_hd_preview"))
- {
- GdkScreen *ss;
- gint s_w, s_h;
- gint orig_w, orig_h;
- gint factor = 80;
-
- if (ghb_settings_get_boolean(settings, "preview_fullscreen"))
- {
- factor = 100;
- }
- ss = gdk_screen_get_default();
- s_w = gdk_screen_get_width(ss);
- s_h = gdk_screen_get_height(ss);
- orig_w = dstWidth;
- orig_h = dstHeight;
-
- if (dstWidth > s_w * factor / 100)
- {
- dstWidth = s_w * factor / 100;
- dstHeight = dstHeight * dstWidth / orig_w;
- }
- if (dstHeight > s_h * factor / 100)
- {
- dstHeight = s_h * factor / 100;
- dstWidth = orig_w * dstHeight / orig_h;
- }
- xscale *= (gdouble)dstWidth / orig_w;
- yscale *= (gdouble)dstHeight / orig_h;
- w *= (gdouble)dstWidth / orig_w;
- h *= (gdouble)dstHeight / orig_h;
- }
- GdkPixbuf *scaled_preview;
- scaled_preview = gdk_pixbuf_scale_simple(preview, dstWidth, dstHeight, GDK_INTERP_HYPER);
- if (ghb_settings_get_boolean(settings, "show_crop"))
- {
- c0 *= yscale;
- c1 *= yscale;
- c2 *= xscale;
- c3 *= xscale;
- // Top
- hash_pixbuf(scaled_preview, c2, 0, w, c0, 32, 0);
- // Bottom
- hash_pixbuf(scaled_preview, c2, dstHeight-c1, w, c1, 32, 0);
- // Left
- hash_pixbuf(scaled_preview, 0, c0, c2, h, 32, 1);
- // Right
- hash_pixbuf(scaled_preview, dstWidth-c3, c0, c3, h, 32, 1);
- }
- g_object_unref (preview);
- return scaled_preview;
+ gint titleindex,
+ gint index,
+ signal_user_data_t *ud,
+ gint *out_width,
+ gint *out_height)
+{
+ GValue *settings;
+ hb_title_t *title;
+ hb_job_t *job;
+
+ settings = ud->settings;
+ title = ghb_get_title_info( titleindex );
+ if( title == NULL ) return NULL;
+
+ job = hb_job_init( title );
+ if (job == NULL) return NULL;
+
+ set_preview_job_settings(job, settings);
+
+ // hb_get_preview doesn't compensate for anamorphic, so lets
+ // calculate scale factors
+ gint width, height, par_width = 1, par_height = 1;
+ gint pic_par = ghb_settings_combo_int(settings, "PicturePAR");
+ if (pic_par)
+ {
+ hb_set_anamorphic_size( job, &width, &height,
+ &par_width, &par_height );
+ }
+
+ // Make sure we have a big enough buffer to receive the image from libhb
+ gint dstWidth = job->width;
+ gint dstHeight= job->height;
+
+ static guint8 *buffer = NULL;
+ static gint bufferSize = 0;
+ gint newSize;
+
+ newSize = dstWidth * dstHeight * 4;
+ if( bufferSize < newSize )
+ {
+ bufferSize = newSize;
+ buffer = (guint8*) g_realloc( buffer, bufferSize );
+ }
+ hb_get_preview( h_scan, job, index, buffer );
+ hb_job_close( &job );
+
+ // Create an GdkPixbuf and copy the libhb image into it, converting it from
+ // libhb's format something suitable.
+
+ // The image data returned by hb_get_preview is 4 bytes per pixel,
+ // BGRA format. Alpha is ignored.
+
+ GdkPixbuf *preview = gdk_pixbuf_new(GDK_COLORSPACE_RGB, FALSE, 8, dstWidth, dstHeight);
+ guint8 *pixels = gdk_pixbuf_get_pixels (preview);
+
+ guint32 *src = (guint32*)buffer;
+ guint8 *dst = pixels;
+
+ gint ii, jj;
+ gint channels = gdk_pixbuf_get_n_channels (preview);
+ gint stride = gdk_pixbuf_get_rowstride (preview);
+ guint8 *tmp;
+
+ for (ii = 0; ii < dstHeight; ii++)
+ {
+ tmp = dst;
+ for (jj = 0; jj < dstWidth; jj++)
+ {
+ tmp[0] = src[0] >> 16;
+ tmp[1] = src[0] >> 8;
+ tmp[2] = src[0] >> 0;
+ tmp += channels;
+ src++;
+ }
+ dst += stride;
+ }
+ gint w = ghb_settings_get_int(settings, "scale_width");
+ gint h = ghb_settings_get_int(settings, "scale_height");
+ ghb_par_scale(ud, &w, &h, par_width, par_height);
+
+ gint c0, c1, c2, c3;
+ c0 = ghb_settings_get_int(settings, "PictureTopCrop");
+ c1 = ghb_settings_get_int(settings, "PictureBottomCrop");
+ c2 = ghb_settings_get_int(settings, "PictureLeftCrop");
+ c3 = ghb_settings_get_int(settings, "PictureRightCrop");
+
+ gdouble xscale = (gdouble)w / (gdouble)(title->width - c2 - c3);
+ gdouble yscale = (gdouble)h / (gdouble)(title->height - c0 - c1);
+
+ ghb_par_scale(ud, &dstWidth, &dstHeight, par_width, par_height);
+ *out_width = w;
+ *out_height = h;
+ if (ghb_settings_get_boolean(settings, "reduce_hd_preview"))
+ {
+ GdkScreen *ss;
+ gint s_w, s_h;
+ gint orig_w, orig_h;
+ gint factor = 80;
+
+ if (ghb_settings_get_boolean(settings, "preview_fullscreen"))
+ {
+ factor = 100;
+ }
+ ss = gdk_screen_get_default();
+ s_w = gdk_screen_get_width(ss);
+ s_h = gdk_screen_get_height(ss);
+ orig_w = dstWidth;
+ orig_h = dstHeight;
+
+ if (dstWidth > s_w * factor / 100)
+ {
+ dstWidth = s_w * factor / 100;
+ dstHeight = dstHeight * dstWidth / orig_w;
+ }
+ if (dstHeight > s_h * factor / 100)
+ {
+ dstHeight = s_h * factor / 100;
+ dstWidth = orig_w * dstHeight / orig_h;
+ }
+ xscale *= (gdouble)dstWidth / orig_w;
+ yscale *= (gdouble)dstHeight / orig_h;
+ w *= (gdouble)dstWidth / orig_w;
+ h *= (gdouble)dstHeight / orig_h;
+ }
+ GdkPixbuf *scaled_preview;
+ scaled_preview = gdk_pixbuf_scale_simple(preview, dstWidth, dstHeight, GDK_INTERP_HYPER);
+ if (ghb_settings_get_boolean(settings, "show_crop"))
+ {
+ c0 *= yscale;
+ c1 *= yscale;
+ c2 *= xscale;
+ c3 *= xscale;
+ // Top
+ hash_pixbuf(scaled_preview, c2, 0, w, c0, 32, 0);
+ // Bottom
+ hash_pixbuf(scaled_preview, c2, dstHeight-c1, w, c1, 32, 0);
+ // Left
+ hash_pixbuf(scaled_preview, 0, c0, c2, h, 32, 1);
+ // Right
+ hash_pixbuf(scaled_preview, dstWidth-c3, c0, c3, h, 32, 1);
+ }
+ g_object_unref (preview);
+ return scaled_preview;
}
static void
sanitize_volname(gchar *name)
{
- gchar *a, *b;
-
- a = b = name;
- while (*b)
- {
- switch(*b)
- {
- case '<':
- b++;
- break;
- case '>':
- b++;
- break;
- default:
- *a = *b & 0x7f;
- a++; b++;
- break;
- }
- }
- *a = 0;
+ gchar *a, *b;
+
+ a = b = name;
+ while (*b)
+ {
+ switch(*b)
+ {
+ case '<':
+ b++;
+ break;
+ case '>':
+ b++;
+ break;
+ default:
+ *a = *b & 0x7f;
+ a++; b++;
+ break;
+ }
+ }
+ *a = 0;
}
gchar*
ghb_dvd_volname(const gchar *device)
{
- gchar *name;
- name = hb_dvd_name((gchar*)device);
- if (name != NULL && name[0] != 0)
- {
- name = g_strdup(name);
- sanitize_volname(name);
- return name;
- }
- return NULL;
+ gchar *name;
+ name = hb_dvd_name((gchar*)device);
+ if (name != NULL && name[0] != 0)
+ {
+ name = g_strdup(name);
+ sanitize_volname(name);
+ return name;
+ }
+ return NULL;
}
diff --git a/gtk/src/hb-backend.h b/gtk/src/hb-backend.h
index ded2fd8c0..e07bcb4cc 100644
--- a/gtk/src/hb-backend.h
+++ b/gtk/src/hb-backend.h
@@ -22,36 +22,36 @@
enum
{
- GHB_ERROR_NONE,
- GHB_ERROR_CANCELED,
- GHB_ERROR_FAIL,
+ GHB_ERROR_NONE,
+ GHB_ERROR_CANCELED,
+ GHB_ERROR_FAIL,
};
typedef struct
{
- gint state;
+ gint state;
- // SCANNING
- gint title_count;
- gint title_cur;
+ // SCANNING
+ gint title_count;
+ gint title_cur;
- // WORKING
- gint unique_id;
- gint job_cur;
- gint job_count;
- gdouble progress;
- gdouble rate_cur;
- gdouble rate_avg;
- gint hours;
- gint minutes;
- gint seconds;
- gint error;
+ // WORKING
+ gint unique_id;
+ gint job_cur;
+ gint job_count;
+ gdouble progress;
+ gdouble rate_cur;
+ gdouble rate_avg;
+ gint hours;
+ gint minutes;
+ gint seconds;
+ gint error;
} ghb_instance_status_t;
typedef struct
{
- ghb_instance_status_t scan;
- ghb_instance_status_t queue;
+ ghb_instance_status_t scan;
+ ghb_instance_status_t queue;
} ghb_status_t;
#define GHB_PIC_KEEP_WIDTH 0x01
@@ -68,13 +68,13 @@ typedef struct
const gchar* ghb_version(void);
void ghb_vquality_range(
- signal_user_data_t *ud,
- gdouble *min,
- gdouble *max,
- gdouble *step,
- gdouble *page,
- gint *digits,
- gboolean *inverted);
+ signal_user_data_t *ud,
+ gdouble *min,
+ gdouble *max,
+ gdouble *step,
+ gdouble *page,
+ gint *digits,
+ gboolean *inverted);
//const gchar* ghb_get_rate_string(gint rate, gint type);
void ghb_combo_init(signal_user_data_t *ud);
void ghb_backend_init(gint debug);
@@ -114,27 +114,27 @@ gboolean ghb_audio_can_passthru(gint acodec);
gint ghb_get_default_acodec(void);
hb_audio_config_t* ghb_get_scan_audio_info(gint titleindex, gint audioindex);
void ghb_set_bitrate_opts(
- GtkBuilder *builder, gint first_rate, gint last_rate, gint extra_rate);
+ GtkBuilder *builder, gint first_rate, gint last_rate, gint extra_rate);
void ghb_grey_combo_options(signal_user_data_t *ud);
void ghb_update_ui_combo_box(
- signal_user_data_t *ud, const gchar *name, gint user_data, gboolean all);
+ signal_user_data_t *ud, const gchar *name, gint user_data, gboolean all);
const gchar* ghb_get_source_audio_lang(gint titleindex, gint track);
gint ghb_find_audio_track(
- gint titleindex, const gchar *lang, gint acodec,
- gint fallback_acodec, GHashTable *track_indices);
+ gint titleindex, const gchar *lang, gint acodec,
+ gint fallback_acodec, GHashTable *track_indices);
const gchar* ghb_audio_track_description(gint track, int titleindex);
void ghb_add_all_subtitles(signal_user_data_t *ud, gint titleindex);
gint ghb_find_pref_subtitle_track(const gchar *lang);
gint ghb_find_subtitle_track(
- gint titleindex, const gchar *lang, gboolean burn,
- gboolean force, gint source, GHashTable *track_indices);
+ gint titleindex, const gchar *lang, gboolean burn,
+ gboolean force, gint source, GHashTable *track_indices);
gint ghb_pick_subtitle_track(signal_user_data_t *ud);
gint ghb_find_cc_track(gint titleindex);
gint ghb_longest_title(void);
gchar* ghb_build_advanced_opts_string(GValue *settings);
GdkPixbuf* ghb_get_preview_image(
- gint titleindex, gint index, signal_user_data_t *ud,
- gint *width, gint *height);
+ gint titleindex, gint index, signal_user_data_t *ud,
+ gint *width, gint *height);
gchar* ghb_dvd_volname(const gchar *device);
gint ghb_get_title_number(gint titleindex);
int ghb_get_title_count();
diff --git a/gtk/src/icon_tools.c b/gtk/src/icon_tools.c
index 7fd0479e6..66ce20226 100644
--- a/gtk/src/icon_tools.c
+++ b/gtk/src/icon_tools.c
@@ -19,84 +19,84 @@
GdkPixbuf*
icon_deserialize(const guint8 *sd, guint len)
{
- GdkPixdata pd;
- GdkPixbuf *pb;
- GError *err = NULL;
+ GdkPixdata pd;
+ GdkPixbuf *pb;
+ GError *err = NULL;
- gdk_pixdata_deserialize(&pd, len, sd, &err);
- pb = gdk_pixbuf_from_pixdata(&pd, TRUE, &err);
- return pb;
+ gdk_pixdata_deserialize(&pd, len, sd, &err);
+ pb = gdk_pixbuf_from_pixdata(&pd, TRUE, &err);
+ return pb;
}
guint8*
icon_serialize(const GdkPixbuf *pixbuf, guint *len)
{
- GdkPixdata pd;
- guint8 *sd;
+ GdkPixdata pd;
+ guint8 *sd;
- gdk_pixdata_from_pixbuf(&pd, pixbuf, FALSE);
- sd = gdk_pixdata_serialize(&pd, len);
- return sd;
+ gdk_pixdata_from_pixbuf(&pd, pixbuf, FALSE);
+ sd = gdk_pixdata_serialize(&pd, len);
+ return sd;
}
guint8*
icon_file_serialize(const gchar *filename, guint *len)
{
- GdkPixbuf *pb;
- GError *err = NULL;
+ GdkPixbuf *pb;
+ GError *err = NULL;
- pb = gdk_pixbuf_new_from_file(filename, &err);
- if (pb == NULL)
- {
- g_warning("Failed to open icon file %s: %s", filename, err->message);
- return NULL;
- }
- return icon_serialize(pb, len);
+ pb = gdk_pixbuf_new_from_file(filename, &err);
+ if (pb == NULL)
+ {
+ g_warning("Failed to open icon file %s: %s", filename, err->message);
+ return NULL;
+ }
+ return icon_serialize(pb, len);
}
GdkPixbuf*
base64_to_icon(const gchar *bd)
{
- guchar *sd;
- gsize len;
- GdkPixdata pd;
- GdkPixbuf *pb;
- GError *err = NULL;
+ guchar *sd;
+ gsize len;
+ GdkPixdata pd;
+ GdkPixbuf *pb;
+ GError *err = NULL;
- sd = g_base64_decode(bd, &len);
- gdk_pixdata_deserialize(&pd, len, sd, &err);
- pb = gdk_pixbuf_from_pixdata(&pd, TRUE, &err);
- g_free(sd);
- return pb;
+ sd = g_base64_decode(bd, &len);
+ gdk_pixdata_deserialize(&pd, len, sd, &err);
+ pb = gdk_pixbuf_from_pixdata(&pd, TRUE, &err);
+ g_free(sd);
+ return pb;
}
gchar*
icon_to_base64(const GdkPixbuf *pixbuf)
{
- GdkPixdata pd;
- guint len;
- guint8 *sd;
- gchar *bd;
+ GdkPixdata pd;
+ guint len;
+ guint8 *sd;
+ gchar *bd;
- gdk_pixdata_from_pixbuf(&pd, pixbuf, FALSE);
- sd = gdk_pixdata_serialize(&pd, &len);
- bd = g_base64_encode(sd, len);
- g_free(sd);
- return bd;
+ gdk_pixdata_from_pixbuf(&pd, pixbuf, FALSE);
+ sd = gdk_pixdata_serialize(&pd, &len);
+ bd = g_base64_encode(sd, len);
+ g_free(sd);
+ return bd;
}
gchar*
icon_file_to_base64(const gchar *filename)
{
- GdkPixbuf *pb;
- GError *err = NULL;
+ GdkPixbuf *pb;
+ GError *err = NULL;
- pb = gdk_pixbuf_new_from_file(filename, &err);
- if (pb == NULL)
- {
- g_warning("Failed to open icon file %s: %s", filename, err->message);
- return NULL;
- }
- return icon_to_base64(pb);
+ pb = gdk_pixbuf_new_from_file(filename, &err);
+ if (pb == NULL)
+ {
+ g_warning("Failed to open icon file %s: %s", filename, err->message);
+ return NULL;
+ }
+ return icon_to_base64(pb);
}
diff --git a/gtk/src/icons.c b/gtk/src/icons.c
index 042525592..56555a154 100644
--- a/gtk/src/icons.c
+++ b/gtk/src/icons.c
@@ -6,43 +6,43 @@
void
ghb_load_icons()
{
- GHashTableIter iter;
- gchar *key;
- GValue *gval;
+ GHashTableIter iter;
+ gchar *key;
+ GValue *gval;
- GValue *icons = ghb_resource_get("icons");
- ghb_dict_iter_init(&iter, icons);
- // middle (void*) cast prevents gcc warning "defreferencing type-punned
- // pointer will break strict-aliasing rules"
- while (g_hash_table_iter_next(
- &iter, (gpointer*)(void*)&key, (gpointer*)(void*)&gval))
- {
- gint colorspace, bps, width, height, rowstride;
- gboolean alpha;
- ghb_rawdata_t *rd;
- gint size;
- GdkPixbuf *pb;
- char *name = g_strdup(key);
- char *pos;
+ GValue *icons = ghb_resource_get("icons");
+ ghb_dict_iter_init(&iter, icons);
+ // middle (void*) cast prevents gcc warning "defreferencing type-punned
+ // pointer will break strict-aliasing rules"
+ while (g_hash_table_iter_next(
+ &iter, (gpointer*)(void*)&key, (gpointer*)(void*)&gval))
+ {
+ gint colorspace, bps, width, height, rowstride;
+ gboolean alpha;
+ ghb_rawdata_t *rd;
+ gint size;
+ GdkPixbuf *pb;
+ char *name = g_strdup(key);
+ char *pos;
- pos = g_strstr_len(name, -1, ".");
- if (pos != NULL)
- *pos = '\0';
+ pos = g_strstr_len(name, -1, ".");
+ if (pos != NULL)
+ *pos = '\0';
- colorspace = ghb_value_int(ghb_dict_lookup(gval, "colorspace"));
- alpha = ghb_value_boolean(ghb_dict_lookup(gval, "alpha"));
- bps = ghb_value_int(ghb_dict_lookup(gval, "bps"));
- width = ghb_value_int(ghb_dict_lookup(gval, "width"));
- height = ghb_value_int(ghb_dict_lookup(gval, "height"));
- rowstride = ghb_value_int(ghb_dict_lookup(gval, "rowstride"));
- rd = g_value_get_boxed(ghb_dict_lookup(gval, "data"));
- pb = gdk_pixbuf_new_from_data(
- rd->data, colorspace, alpha, bps,
- width, height, rowstride,
- NULL, NULL);
- size = gdk_pixbuf_get_height(pb);
- gtk_icon_theme_add_builtin_icon(name, size, pb);
- g_object_unref(pb);
- g_free(name);
- }
+ colorspace = ghb_value_int(ghb_dict_lookup(gval, "colorspace"));
+ alpha = ghb_value_boolean(ghb_dict_lookup(gval, "alpha"));
+ bps = ghb_value_int(ghb_dict_lookup(gval, "bps"));
+ width = ghb_value_int(ghb_dict_lookup(gval, "width"));
+ height = ghb_value_int(ghb_dict_lookup(gval, "height"));
+ rowstride = ghb_value_int(ghb_dict_lookup(gval, "rowstride"));
+ rd = g_value_get_boxed(ghb_dict_lookup(gval, "data"));
+ pb = gdk_pixbuf_new_from_data(
+ rd->data, colorspace, alpha, bps,
+ width, height, rowstride,
+ NULL, NULL);
+ size = gdk_pixbuf_get_height(pb);
+ gtk_icon_theme_add_builtin_icon(name, size, pb);
+ g_object_unref(pb);
+ g_free(name);
+ }
}
diff --git a/gtk/src/ini_to_plist.c b/gtk/src/ini_to_plist.c
index d0d441d8d..fd20323b3 100644
--- a/gtk/src/ini_to_plist.c
+++ b/gtk/src/ini_to_plist.c
@@ -8,97 +8,97 @@
gboolean
string_is_true(const gchar *str)
{
- return (strcmp(str, "enable") == 0);
+ return (strcmp(str, "enable") == 0);
}
gboolean
string_is_bool(const gchar *str)
{
- return (strcmp(str, "enable") == 0) || (strcmp(str, "disable") == 0);
+ return (strcmp(str, "enable") == 0) || (strcmp(str, "disable") == 0);
}
GType
guess_type(const gchar *str)
{
- gchar *end;
- gdouble dval;
+ gchar *end;
+ gdouble dval;
- if (*str == 0)
- return G_TYPE_STRING;
- if (string_is_bool(str))
- return G_TYPE_BOOLEAN;
- dval = g_strtod(str, &end);
- if (*end == 0)
- {
- if (strchr(str, '.') == NULL)
- return G_TYPE_INT64;
- else
- return G_TYPE_DOUBLE;
- }
+ if (*str == 0)
+ return G_TYPE_STRING;
+ if (string_is_bool(str))
+ return G_TYPE_BOOLEAN;
+ dval = g_strtod(str, &end);
+ if (*end == 0)
+ {
+ if (strchr(str, '.') == NULL)
+ return G_TYPE_INT64;
+ else
+ return G_TYPE_DOUBLE;
+ }
- return G_TYPE_STRING;
+ return G_TYPE_STRING;
}
void
set_value(GValue *gval, const gchar *str, GType gtype)
{
- if (gtype == G_TYPE_STRING)
- {
- g_value_set_string(gval, str);
- }
- else if (gtype == G_TYPE_INT64)
- {
- gint64 val = g_strtod(str, NULL);
- g_value_set_int64(gval, val);
- }
- else if (gtype == G_TYPE_DOUBLE)
- {
- gdouble val = g_strtod(str, NULL);
- g_value_set_double(gval, val);
- }
- else if (gtype == G_TYPE_BOOLEAN)
- {
- if (string_is_true(str))
- g_value_set_boolean(gval, TRUE);
- else
- g_value_set_boolean(gval, FALSE);
- }
+ if (gtype == G_TYPE_STRING)
+ {
+ g_value_set_string(gval, str);
+ }
+ else if (gtype == G_TYPE_INT64)
+ {
+ gint64 val = g_strtod(str, NULL);
+ g_value_set_int64(gval, val);
+ }
+ else if (gtype == G_TYPE_DOUBLE)
+ {
+ gdouble val = g_strtod(str, NULL);
+ g_value_set_double(gval, val);
+ }
+ else if (gtype == G_TYPE_BOOLEAN)
+ {
+ if (string_is_true(str))
+ g_value_set_boolean(gval, TRUE);
+ else
+ g_value_set_boolean(gval, FALSE);
+ }
}
int
main(gint argc, gchar *argv[])
{
- GKeyFile *kf;
- gchar **groups;
- gchar **keys;
- gint ii, jj;
- GValue *top;
- GValue *dict;
+ GKeyFile *kf;
+ gchar **groups;
+ gchar **keys;
+ gint ii, jj;
+ GValue *top;
+ GValue *dict;
- g_type_init();
- top = ghb_dict_value_new();
- kf = g_key_file_new();
- g_key_file_load_from_file(kf, argv[1], 0, NULL);
- groups = g_key_file_get_groups(kf, NULL);
- for (ii = 0; groups[ii]; ii++)
- {
- dict = ghb_dict_value_new();
- ghb_dict_insert(top, , g_strdup(groups[ii]), dict);
- keys = g_key_file_get_keys(kf, groups[ii], NULL, NULL);
- for (jj = 0; keys[jj]; jj++)
- {
- gchar *str;
- GValue *gval;
- GType gtype;
+ g_type_init();
+ top = ghb_dict_value_new();
+ kf = g_key_file_new();
+ g_key_file_load_from_file(kf, argv[1], 0, NULL);
+ groups = g_key_file_get_groups(kf, NULL);
+ for (ii = 0; groups[ii]; ii++)
+ {
+ dict = ghb_dict_value_new();
+ ghb_dict_insert(top, , g_strdup(groups[ii]), dict);
+ keys = g_key_file_get_keys(kf, groups[ii], NULL, NULL);
+ for (jj = 0; keys[jj]; jj++)
+ {
+ gchar *str;
+ GValue *gval;
+ GType gtype;
- str = g_key_file_get_string(kf, groups[ii], keys[jj], NULL);
- gtype = guess_type(str);
- gval = g_malloc0(sizeof(GValue));
- g_value_init(gval, gtype);
- set_value(gval, str, gtype);
- ghb_dict_insert(dict, g_strdup(keys[jj]), gval);
- }
- }
- ghb_plist_write_file("a_p_list", top);
+ str = g_key_file_get_string(kf, groups[ii], keys[jj], NULL);
+ gtype = guess_type(str);
+ gval = g_malloc0(sizeof(GValue));
+ g_value_init(gval, gtype);
+ set_value(gval, str, gtype);
+ ghb_dict_insert(dict, g_strdup(keys[jj]), gval);
+ }
+ }
+ ghb_plist_write_file("a_p_list", top);
}
diff --git a/gtk/src/internal_defaults.xml b/gtk/src/internal_defaults.xml
index 466c4234c..f403b763d 100644
--- a/gtk/src/internal_defaults.xml
+++ b/gtk/src/internal_defaults.xml
@@ -2,421 +2,421 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
- <key>Initialization</key>
- <dict>
- <key>AudioTrackName</key>
- <string></string>
- <key>AudioEncoderActual</key>
- <string></string>
- <key>angle_count</key>
- <integer>1</integer>
- <key>angle</key>
- <integer>1</integer>
- <key>anamorphic</key>
- <true />
- <key>autoscale</key>
- <false />
- <key>dest_dir</key>
- <string></string>
- <key>dest_file</key>
- <string>new_video.mp4</string>
- <key>end_point</key>
- <integer>100</integer>
- <key>folder</key>
- <string></string>
- <key>MetaName</key>
- <string></string>
- <key>MetaArtist</key>
- <string></string>
- <key>MetaAlbumArtist</key>
- <string></string>
- <key>MetaReleaseDate</key>
- <string></string>
- <key>MetaComment</key>
- <string></string>
- <key>MetaGenre</key>
- <string></string>
- <key>MetaDescription</key>
- <string></string>
- <key>MetaLongDescription</key>
- <string></string>
- <key>preset</key>
- <array>
- <string>Normal</string>
- </array>
- <key>preset_selection</key>
- <array>
- <string>Normal</string>
- </array>
- <key>PictureDisplayWidth</key>
- <integer>720</integer>
- <key>PictureDisplayHeight</key>
- <integer>480</integer>
- <key>PtoPType</key>
- <string>chapter</string>
- <key>scale_height</key>
- <integer>0</integer>
- <key>scale_width</key>
- <integer>0</integer>
- <key>show_crop</key>
- <false />
- <key>hide_settings</key>
- <false />
- <key>show_picture</key>
- <false />
- <key>single_title</key>
- <integer>1</integer>
- <key>start_point</key>
- <integer>1</integer>
- <key>start_frame</key>
- <integer>-1</integer>
- <key>title_no</key>
- <integer>0</integer>
- <key>title</key>
- <string>none</string>
- <key>volume_label</key>
- <string>New Video</string>
- <key>x264_8x8dct</key>
- <false />
- <key>x264_analyse</key>
- <string>some</string>
- <key>x264_bframes</key>
- <integer>0</integer>
- <key>x264_mbtree</key>
- <true />
- <key>x264_bpyramid</key>
- <false />
- <key>x264_cabac</key>
- <true />
- <key>x264_deblock_alpha</key>
- <integer>0</integer>
- <key>x264_deblock_beta</key>
- <integer>0</integer>
- <key>x264_direct</key>
- <string>spatial</string>
- <key>x264_b_adapt</key>
- <string>1</string>
- <key>x264_me</key>
- <string>hex</string>
- <key>x264_merange</key>
- <integer>16</integer>
- <key>x264_mixed_refs</key>
- <false />
- <key>x264_no_dct_decimate</key>
- <false />
- <key>x264_no_fast_pskip</key>
- <false />
- <key>x264_refs</key>
- <integer>1</integer>
- <key>x264_subme</key>
- <integer>6</integer>
- <key>x264_trellis</key>
- <integer>0</integer>
- <key>x264_weighted_bframes</key>
- <false />
- <key>audio_list</key>
- <array>
- </array>
- <key>subtitle_list</key>
- <array>
- </array>
- <key>vquality_type_bitrate</key>
- <false />
- <key>vquality_type_constant</key>
- <false />
- <key>SrtLanguage</key>
- <string>und</string>
- <key>SrtCodeset</key>
- <string>ISO-8859-1</string>
- <key>SrtFile</key>
- <string></string>
- <key>SrtOffset</key>
- <integer>0</integer>
- <key>VideoFramerateCFR</key>
- <false />
- <key>VideoFrameratePFR</key>
- <false />
- <key>VideoFramerateVFR</key>
- <false />
- </dict>
- <key>Preferences</key>
- <dict>
- <key>HideAdvancedVideoSettings</key>
- <false />
- <key>AdvancedAutoPassthru</key>
- <false />
- <key>AutoScan</key>
- <false />
- <key>AddCC</key>
- <false />
- <key>EncodeLogLocation</key>
- <false />
- <key>show_status</key>
- <true />
- <key>allow_tweaks</key>
- <false />
- <key>title_no_in_destination</key>
- <false />
- <key>last_update_check</key>
- <integer>0</integer>
- <key>check_updates</key>
- <string>weekly</string>
- <key>chapters_in_destination</key>
- <false />
- <key>default_source</key>
- <string>/dev/dvd</string>
- <key>ExportDirectory</key>
- <string></string>
- <key>destination_dir</key>
- <string></string>
- <key>hbfd</key>
- <false />
- <key>hbfd_feature</key>
- <false />
- <key>live_duration</key>
- <integer>15</integer>
- <key>LoggingLevel</key>
- <string>1</string>
- <key>LogLongevity</key>
- <string>immortal</string>
- <key>nocheckvquality</key>
- <false />
- <key>use_dvdnav</key>
- <true />
- <key>reduce_hd_preview</key>
- <true />
- <key>MinTitleDuration</key>
- <integer>10</integer>
- <key>preview_count</key>
- <integer>10</integer>
- <key>preview_fullscreen</key>
- <false />
- <key>preview_x</key>
- <integer>-1</integer>
- <key>preview_y</key>
- <integer>-1</integer>
- <key>settings_x</key>
- <integer>-1</integer>
- <key>settings_y</key>
- <integer>-1</integer>
- <key>show_presets</key>
- <true />
- <key>show_preview</key>
- <true />
- <key>UseM4v</key>
- <true />
- <key>use_source_name</key>
- <true />
- <key>update_skip_version</key>
- <integer>0</integer>
- <key>VideoQualityGranularity</key>
- <string>1</string>
- <key>version</key>
- <string>0.1</string>
- <key>PreferredLanguage</key>
- <string>und</string>
- <key>AudioDUB</key>
- <false />
- <key>NotAudioDUB</key>
- <true />
- <key>constant_rate_factor</key>
- <true />
- <key>WhenComplete</key>
- <string>notify</string>
- <key>SrtDir</key>
- <string></string>
- <key>window_width</key>
- <integer>1</integer>
- <key>window_height</key>
- <integer>1</integer>
- </dict>
- <key>XlatPresets</key>
- <dict>
- <key>autoscale</key>
- <false />
- <key>vquality_type_bitrate</key>
- <false />
- <key>vquality_type_constant</key>
- <false />
- <key>VideoFramerateCFR</key>
- <false />
- <key>VideoFrameratePFR</key>
- <false />
- <key>VideoFramerateVFR</key>
- <false />
- <key>PictureDeinterlaceDecomb</key>
- <false />
- <key>x264PresetSlider</key>
- <integer>0</integer>
- <key>x264ZeroLatency</key>
- <false />
- <key>x264FastDecode</key>
- <false />
- </dict>
- <key>Presets</key>
- <dict>
- <key>PresetBuildNumber</key>
- <string></string>
- <key>PictureAutoCrop</key>
- <true />
- <key>ChapterMarkers</key>
- <true />
- <key>FileFormat</key>
- <string>mp4</string>
- <key>Folder</key>
- <false />
- <key>PictureLooseCrop</key>
- <false />
- <key>PictureModulus</key>
- <integer>16</integer>
- <key>PictureDeblock</key>
- <integer>0</integer>
- <key>PictureDecombDeinterlace</key>
- <true />
- <key>PictureDecomb</key>
- <string>off</string>
- <key>PictureDecombCustom</key>
- <string></string>
- <key>Default</key>
- <false />
- <key>PictureBottomCrop</key>
- <integer>0</integer>
- <key>PictureLeftCrop</key>
- <integer>0</integer>
- <key>PictureRightCrop</key>
- <integer>0</integer>
- <key>PictureTopCrop</key>
- <integer>0</integer>
- <key>PictureDeinterlace</key>
- <string>off</string>
- <key>PictureDeinterlaceCustom</key>
- <string></string>
- <key>PictureDenoise</key>
- <string>off</string>
- <key>PictureDenoiseCustom</key>
- <string></string>
- <key>PictureDetelecine</key>
- <string>off</string>
- <key>PictureDetelecineCustom</key>
- <string></string>
- <key>PicturePAR</key>
- <integer>2</integer>
- <key>PicturePARWidth</key>
- <integer>853</integer>
- <key>PicturePARHeight</key>
- <integer>720</integer>
- <key>PictureHeight</key>
- <integer>0</integer>
- <key>PictureWidth</key>
- <integer>0</integer>
- <key>VideoFramerate</key>
- <string>source</string>
- <key>VideoFramerateMode</key>
- <string>vfr</string>
- <key>VideoGrayScale</key>
- <false />
- <key>Mp4HttpOptimize</key>
- <false />
- <key>Mp4iPodCompatible</key>
- <false />
- <key>PictureKeepRatio</key>
- <true />
- <key>Mp4LargeFile</key>
- <false />
- <key>AudioAllowMP3Pass</key>
- <true />
- <key>AudioAllowAACPass</key>
- <true />
- <key>AudioAllowAC3Pass</key>
- <true />
- <key>AudioAllowDTSPass</key>
- <true />
- <key>AudioAllowDTSHDPass</key>
- <true />
- <key>AudioEncoderFallback</key>
- <string>ffac3</string>
- <key>AudioList</key>
- <array>
- <dict>
- <key>AudioBitrate</key>
- <string>192</string>
- <key>AudioEncoder</key>
- <string>copy:ac3</string>
- <key>AudioTrack</key>
- <integer>1</integer>
- <key>AudioTrackDescription</key>
- <string></string>
- <key>AudioTrackQualityEnable</key>
- <false />
- <key>AudioTrackQuality</key>
- <real>-1</real>
- <key>AudioTrackGain</key>
- <real>0</real>
- <key>AudioTrackDRCSlider</key>
- <real>0</real>
- <key>AudioMixdown</key>
- <string>dpl2</string>
- <key>AudioSamplerate</key>
- <string>source</string>
- </dict>
- </array>
- <key>PresetDescription</key>
- <string></string>
- <key>PresetName</key>
- <string>Name Missing</string>
- <key>Type</key>
- <integer>1</integer>
- <key>SubtitleList</key>
- <array>
- <dict>
- <key>SubtitleLanguage</key>
- <string>und</string>
- <key>SubtitleForced</key>
- <true />
- <key>SubtitleSource</key>
- <integer>0</integer>
- <key>SubtitleBurned</key>
- <true />
- <key>SubtitleDefaultTrack</key>
- <false />
- </dict>
- </array>
- <key>VideoTurboTwoPass</key>
- <false />
- <key>UsesPictureFilters</key>
- <true />
- <key>UsesPictureSettings</key>
- <integer>2</integer>
- <key>UsesMaxPictureSettings</key>
- <false />
- <key>VideoTwoPass</key>
- <false />
- <key>VideoAvgBitrate</key>
- <integer>1800</integer>
- <key>VideoEncoder</key>
- <string>x264</string>
- <key>VideoQualityType</key>
- <integer>2</integer>
- <key>VideoQualitySlider</key>
- <real>0.60</real>
- <key>VideoTargetSize</key>
- <integer>700</integer>
- <key>lavcOption</key>
- <string></string>
- <key>x264Option</key>
- <string></string>
- <key>x264Preset</key>
- <string>custom</string>
- <key>x264Tune</key>
- <string></string>
- <key>h264Profile</key>
- <string></string>
- <key>h264Level</key>
- <string></string>
- <key>x264UseAdvancedOptions</key>
- <true />
- <key>x264OptionExtra</key>
- <string></string>
- </dict>
+ <key>Initialization</key>
+ <dict>
+ <key>AudioTrackName</key>
+ <string></string>
+ <key>AudioEncoderActual</key>
+ <string></string>
+ <key>angle_count</key>
+ <integer>1</integer>
+ <key>angle</key>
+ <integer>1</integer>
+ <key>anamorphic</key>
+ <true />
+ <key>autoscale</key>
+ <false />
+ <key>dest_dir</key>
+ <string></string>
+ <key>dest_file</key>
+ <string>new_video.mp4</string>
+ <key>end_point</key>
+ <integer>100</integer>
+ <key>folder</key>
+ <string></string>
+ <key>MetaName</key>
+ <string></string>
+ <key>MetaArtist</key>
+ <string></string>
+ <key>MetaAlbumArtist</key>
+ <string></string>
+ <key>MetaReleaseDate</key>
+ <string></string>
+ <key>MetaComment</key>
+ <string></string>
+ <key>MetaGenre</key>
+ <string></string>
+ <key>MetaDescription</key>
+ <string></string>
+ <key>MetaLongDescription</key>
+ <string></string>
+ <key>preset</key>
+ <array>
+ <string>Normal</string>
+ </array>
+ <key>preset_selection</key>
+ <array>
+ <string>Normal</string>
+ </array>
+ <key>PictureDisplayWidth</key>
+ <integer>720</integer>
+ <key>PictureDisplayHeight</key>
+ <integer>480</integer>
+ <key>PtoPType</key>
+ <string>chapter</string>
+ <key>scale_height</key>
+ <integer>0</integer>
+ <key>scale_width</key>
+ <integer>0</integer>
+ <key>show_crop</key>
+ <false />
+ <key>hide_settings</key>
+ <false />
+ <key>show_picture</key>
+ <false />
+ <key>single_title</key>
+ <integer>1</integer>
+ <key>start_point</key>
+ <integer>1</integer>
+ <key>start_frame</key>
+ <integer>-1</integer>
+ <key>title_no</key>
+ <integer>0</integer>
+ <key>title</key>
+ <string>none</string>
+ <key>volume_label</key>
+ <string>New Video</string>
+ <key>x264_8x8dct</key>
+ <false />
+ <key>x264_analyse</key>
+ <string>some</string>
+ <key>x264_bframes</key>
+ <integer>0</integer>
+ <key>x264_mbtree</key>
+ <true />
+ <key>x264_bpyramid</key>
+ <false />
+ <key>x264_cabac</key>
+ <true />
+ <key>x264_deblock_alpha</key>
+ <integer>0</integer>
+ <key>x264_deblock_beta</key>
+ <integer>0</integer>
+ <key>x264_direct</key>
+ <string>spatial</string>
+ <key>x264_b_adapt</key>
+ <string>1</string>
+ <key>x264_me</key>
+ <string>hex</string>
+ <key>x264_merange</key>
+ <integer>16</integer>
+ <key>x264_mixed_refs</key>
+ <false />
+ <key>x264_no_dct_decimate</key>
+ <false />
+ <key>x264_no_fast_pskip</key>
+ <false />
+ <key>x264_refs</key>
+ <integer>1</integer>
+ <key>x264_subme</key>
+ <integer>6</integer>
+ <key>x264_trellis</key>
+ <integer>0</integer>
+ <key>x264_weighted_bframes</key>
+ <false />
+ <key>audio_list</key>
+ <array>
+ </array>
+ <key>subtitle_list</key>
+ <array>
+ </array>
+ <key>vquality_type_bitrate</key>
+ <false />
+ <key>vquality_type_constant</key>
+ <false />
+ <key>SrtLanguage</key>
+ <string>und</string>
+ <key>SrtCodeset</key>
+ <string>ISO-8859-1</string>
+ <key>SrtFile</key>
+ <string></string>
+ <key>SrtOffset</key>
+ <integer>0</integer>
+ <key>VideoFramerateCFR</key>
+ <false />
+ <key>VideoFrameratePFR</key>
+ <false />
+ <key>VideoFramerateVFR</key>
+ <false />
+ </dict>
+ <key>Preferences</key>
+ <dict>
+ <key>HideAdvancedVideoSettings</key>
+ <false />
+ <key>AdvancedAutoPassthru</key>
+ <false />
+ <key>AutoScan</key>
+ <false />
+ <key>AddCC</key>
+ <false />
+ <key>EncodeLogLocation</key>
+ <false />
+ <key>show_status</key>
+ <true />
+ <key>allow_tweaks</key>
+ <false />
+ <key>title_no_in_destination</key>
+ <false />
+ <key>last_update_check</key>
+ <integer>0</integer>
+ <key>check_updates</key>
+ <string>weekly</string>
+ <key>chapters_in_destination</key>
+ <false />
+ <key>default_source</key>
+ <string>/dev/dvd</string>
+ <key>ExportDirectory</key>
+ <string></string>
+ <key>destination_dir</key>
+ <string></string>
+ <key>hbfd</key>
+ <false />
+ <key>hbfd_feature</key>
+ <false />
+ <key>live_duration</key>
+ <integer>15</integer>
+ <key>LoggingLevel</key>
+ <string>1</string>
+ <key>LogLongevity</key>
+ <string>immortal</string>
+ <key>nocheckvquality</key>
+ <false />
+ <key>use_dvdnav</key>
+ <true />
+ <key>reduce_hd_preview</key>
+ <true />
+ <key>MinTitleDuration</key>
+ <integer>10</integer>
+ <key>preview_count</key>
+ <integer>10</integer>
+ <key>preview_fullscreen</key>
+ <false />
+ <key>preview_x</key>
+ <integer>-1</integer>
+ <key>preview_y</key>
+ <integer>-1</integer>
+ <key>settings_x</key>
+ <integer>-1</integer>
+ <key>settings_y</key>
+ <integer>-1</integer>
+ <key>show_presets</key>
+ <true />
+ <key>show_preview</key>
+ <true />
+ <key>UseM4v</key>
+ <true />
+ <key>use_source_name</key>
+ <true />
+ <key>update_skip_version</key>
+ <integer>0</integer>
+ <key>VideoQualityGranularity</key>
+ <string>1</string>
+ <key>version</key>
+ <string>0.1</string>
+ <key>PreferredLanguage</key>
+ <string>und</string>
+ <key>AudioDUB</key>
+ <false />
+ <key>NotAudioDUB</key>
+ <true />
+ <key>constant_rate_factor</key>
+ <true />
+ <key>WhenComplete</key>
+ <string>notify</string>
+ <key>SrtDir</key>
+ <string></string>
+ <key>window_width</key>
+ <integer>1</integer>
+ <key>window_height</key>
+ <integer>1</integer>
+ </dict>
+ <key>XlatPresets</key>
+ <dict>
+ <key>autoscale</key>
+ <false />
+ <key>vquality_type_bitrate</key>
+ <false />
+ <key>vquality_type_constant</key>
+ <false />
+ <key>VideoFramerateCFR</key>
+ <false />
+ <key>VideoFrameratePFR</key>
+ <false />
+ <key>VideoFramerateVFR</key>
+ <false />
+ <key>PictureDeinterlaceDecomb</key>
+ <false />
+ <key>x264PresetSlider</key>
+ <integer>0</integer>
+ <key>x264ZeroLatency</key>
+ <false />
+ <key>x264FastDecode</key>
+ <false />
+ </dict>
+ <key>Presets</key>
+ <dict>
+ <key>PresetBuildNumber</key>
+ <string></string>
+ <key>PictureAutoCrop</key>
+ <true />
+ <key>ChapterMarkers</key>
+ <true />
+ <key>FileFormat</key>
+ <string>mp4</string>
+ <key>Folder</key>
+ <false />
+ <key>PictureLooseCrop</key>
+ <false />
+ <key>PictureModulus</key>
+ <integer>16</integer>
+ <key>PictureDeblock</key>
+ <integer>0</integer>
+ <key>PictureDecombDeinterlace</key>
+ <true />
+ <key>PictureDecomb</key>
+ <string>off</string>
+ <key>PictureDecombCustom</key>
+ <string></string>
+ <key>Default</key>
+ <false />
+ <key>PictureBottomCrop</key>
+ <integer>0</integer>
+ <key>PictureLeftCrop</key>
+ <integer>0</integer>
+ <key>PictureRightCrop</key>
+ <integer>0</integer>
+ <key>PictureTopCrop</key>
+ <integer>0</integer>
+ <key>PictureDeinterlace</key>
+ <string>off</string>
+ <key>PictureDeinterlaceCustom</key>
+ <string></string>
+ <key>PictureDenoise</key>
+ <string>off</string>
+ <key>PictureDenoiseCustom</key>
+ <string></string>
+ <key>PictureDetelecine</key>
+ <string>off</string>
+ <key>PictureDetelecineCustom</key>
+ <string></string>
+ <key>PicturePAR</key>
+ <integer>2</integer>
+ <key>PicturePARWidth</key>
+ <integer>853</integer>
+ <key>PicturePARHeight</key>
+ <integer>720</integer>
+ <key>PictureHeight</key>
+ <integer>0</integer>
+ <key>PictureWidth</key>
+ <integer>0</integer>
+ <key>VideoFramerate</key>
+ <string>source</string>
+ <key>VideoFramerateMode</key>
+ <string>vfr</string>
+ <key>VideoGrayScale</key>
+ <false />
+ <key>Mp4HttpOptimize</key>
+ <false />
+ <key>Mp4iPodCompatible</key>
+ <false />
+ <key>PictureKeepRatio</key>
+ <true />
+ <key>Mp4LargeFile</key>
+ <false />
+ <key>AudioAllowMP3Pass</key>
+ <true />
+ <key>AudioAllowAACPass</key>
+ <true />
+ <key>AudioAllowAC3Pass</key>
+ <true />
+ <key>AudioAllowDTSPass</key>
+ <true />
+ <key>AudioAllowDTSHDPass</key>
+ <true />
+ <key>AudioEncoderFallback</key>
+ <string>ffac3</string>
+ <key>AudioList</key>
+ <array>
+ <dict>
+ <key>AudioBitrate</key>
+ <string>192</string>
+ <key>AudioEncoder</key>
+ <string>copy:ac3</string>
+ <key>AudioTrack</key>
+ <integer>1</integer>
+ <key>AudioTrackDescription</key>
+ <string></string>
+ <key>AudioTrackQualityEnable</key>
+ <false />
+ <key>AudioTrackQuality</key>
+ <real>-1</real>
+ <key>AudioTrackGain</key>
+ <real>0</real>
+ <key>AudioTrackDRCSlider</key>
+ <real>0</real>
+ <key>AudioMixdown</key>
+ <string>dpl2</string>
+ <key>AudioSamplerate</key>
+ <string>source</string>
+ </dict>
+ </array>
+ <key>PresetDescription</key>
+ <string></string>
+ <key>PresetName</key>
+ <string>Name Missing</string>
+ <key>Type</key>
+ <integer>1</integer>
+ <key>SubtitleList</key>
+ <array>
+ <dict>
+ <key>SubtitleLanguage</key>
+ <string>und</string>
+ <key>SubtitleForced</key>
+ <true />
+ <key>SubtitleSource</key>
+ <integer>0</integer>
+ <key>SubtitleBurned</key>
+ <true />
+ <key>SubtitleDefaultTrack</key>
+ <false />
+ </dict>
+ </array>
+ <key>VideoTurboTwoPass</key>
+ <false />
+ <key>UsesPictureFilters</key>
+ <true />
+ <key>UsesPictureSettings</key>
+ <integer>2</integer>
+ <key>UsesMaxPictureSettings</key>
+ <false />
+ <key>VideoTwoPass</key>
+ <false />
+ <key>VideoAvgBitrate</key>
+ <integer>1800</integer>
+ <key>VideoEncoder</key>
+ <string>x264</string>
+ <key>VideoQualityType</key>
+ <integer>2</integer>
+ <key>VideoQualitySlider</key>
+ <real>0.60</real>
+ <key>VideoTargetSize</key>
+ <integer>700</integer>
+ <key>lavcOption</key>
+ <string></string>
+ <key>x264Option</key>
+ <string></string>
+ <key>x264Preset</key>
+ <string>custom</string>
+ <key>x264Tune</key>
+ <string></string>
+ <key>h264Profile</key>
+ <string></string>
+ <key>h264Level</key>
+ <string></string>
+ <key>x264UseAdvancedOptions</key>
+ <true />
+ <key>x264OptionExtra</key>
+ <string></string>
+ </dict>
</dict>
</plist>
diff --git a/gtk/src/main.c b/gtk/src/main.c
index 0d84725f5..6a85e607f 100644
--- a/gtk/src/main.c
+++ b/gtk/src/main.c
@@ -17,9 +17,9 @@
*
* You should have received a copy of the GNU General Public License
* along with main.c. If not, write to:
- * The Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301, USA.
+ * The Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301, USA.
*/
#include <sys/types.h>
@@ -44,7 +44,7 @@
#else
#include <windows.h>
#include <io.h>
-#define pipe(phandles) _pipe (phandles, 4096, _O_BINARY)
+#define pipe(phandles) _pipe (phandles, 4096, _O_BINARY)
#endif
#if defined(_USE_APP_IND)
@@ -98,24 +98,24 @@
GtkBuilder*
create_builder_or_die(const gchar * name)
{
- guint res = 0;
- GValue *gval;
- GError *error = NULL;
- const gchar *ghb_ui;
+ guint res = 0;
+ GValue *gval;
+ GError *error = NULL;
+ const gchar *ghb_ui;
const gchar *markup =
N_("<b><big>Unable to create %s.</big></b>\n"
"\n"
"Internal error. Could not parse UI description.\n"
- "%s");
- g_debug("create_builder_or_die ()\n");
- GtkBuilder *xml = gtk_builder_new();
- gval = ghb_resource_get("ghb-ui");
- ghb_ui = g_value_get_string(gval);
- if (xml != NULL)
- res = gtk_builder_add_from_string(xml, ghb_ui, -1, &error);
+ "%s");
+ g_debug("create_builder_or_die ()\n");
+ GtkBuilder *xml = gtk_builder_new();
+ gval = ghb_resource_get("ghb-ui");
+ ghb_ui = g_value_get_string(gval);
+ if (xml != NULL)
+ res = gtk_builder_add_from_string(xml, ghb_ui, -1, &error);
if (!xml || !res)
- {
+ {
GtkWidget *dialog = gtk_message_dialog_new_with_markup(NULL,
GTK_DIALOG_MODAL,
GTK_MESSAGE_ERROR,
@@ -145,44 +145,44 @@ self_symbol_lookup(const gchar * symbol_name)
static void
MyConnect(
- GtkBuilder *builder,
- GObject *object,
- const gchar *signal_name,
- const gchar *handler_name,
- GObject *connect_object,
- GConnectFlags flags,
- gpointer user_data)
+ GtkBuilder *builder,
+ GObject *object,
+ const gchar *signal_name,
+ const gchar *handler_name,
+ GObject *connect_object,
+ GConnectFlags flags,
+ gpointer user_data)
{
- GCallback callback;
+ GCallback callback;
g_return_if_fail(object != NULL);
g_return_if_fail(handler_name != NULL);
g_return_if_fail(signal_name != NULL);
- //const gchar *name = ghb_get_setting_key((GtkWidget*)object);
- //g_message("\n\nname %s", name);
- g_debug("handler_name %s", handler_name);
- g_debug("signal_name %s", signal_name);
+ //const gchar *name = ghb_get_setting_key((GtkWidget*)object);
+ //g_message("\n\nname %s", name);
+ g_debug("handler_name %s", handler_name);
+ g_debug("signal_name %s", signal_name);
callback = self_symbol_lookup(handler_name);
if (!callback)
- {
+ {
g_message("Signal handler (%s) not found", handler_name);
return;
}
if (connect_object)
- {
+ {
g_signal_connect_object(object, signal_name, callback, connect_object, flags);
}
else
- {
+ {
if (flags & G_CONNECT_AFTER)
- {
+ {
g_signal_connect_after( object, signal_name, callback, user_data);
- }
+ }
else
- {
+ {
g_signal_connect(object, signal_name, callback, user_data);
- }
+ }
}
}
@@ -217,34 +217,34 @@ extern G_MODULE_EXPORT void chapter_keypress_cb(void);
static void
bind_chapter_tree_model (signal_user_data_t *ud)
{
- GtkCellRenderer *cell;
- GtkTreeViewColumn *column;
- GtkListStore *treestore;
- GtkTreeView *treeview;
-
- g_debug("bind_chapter_tree_model ()\n");
- treeview = GTK_TREE_VIEW(GHB_WIDGET (ud->builder, "chapters_list"));
- treestore = gtk_list_store_new(4, G_TYPE_INT, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN);
- gtk_tree_view_set_model(treeview, GTK_TREE_MODEL(treestore));
-
- cell = ghb_cell_renderer_text_new();
- column = gtk_tree_view_column_new_with_attributes(
- _("Index"), cell, "text", 0, NULL);
+ GtkCellRenderer *cell;
+ GtkTreeViewColumn *column;
+ GtkListStore *treestore;
+ GtkTreeView *treeview;
+
+ g_debug("bind_chapter_tree_model ()\n");
+ treeview = GTK_TREE_VIEW(GHB_WIDGET (ud->builder, "chapters_list"));
+ treestore = gtk_list_store_new(4, G_TYPE_INT, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN);
+ gtk_tree_view_set_model(treeview, GTK_TREE_MODEL(treestore));
+
+ cell = ghb_cell_renderer_text_new();
+ column = gtk_tree_view_column_new_with_attributes(
+ _("Index"), cell, "text", 0, NULL);
gtk_tree_view_append_column(treeview, GTK_TREE_VIEW_COLUMN(column));
- cell = ghb_cell_renderer_text_new();
- column = gtk_tree_view_column_new_with_attributes(
- _("Duration"), cell, "text", 1, NULL);
+ cell = ghb_cell_renderer_text_new();
+ column = gtk_tree_view_column_new_with_attributes(
+ _("Duration"), cell, "text", 1, NULL);
gtk_tree_view_append_column(treeview, GTK_TREE_VIEW_COLUMN(column));
- cell = ghb_cell_renderer_text_new();
- column = gtk_tree_view_column_new_with_attributes(
- _("Title"), cell, "text", 2, "editable", 3, NULL);
+ cell = ghb_cell_renderer_text_new();
+ column = gtk_tree_view_column_new_with_attributes(
+ _("Title"), cell, "text", 2, "editable", 3, NULL);
gtk_tree_view_append_column(treeview, GTK_TREE_VIEW_COLUMN(column));
- g_signal_connect(cell, "key-press-event", chapter_keypress_cb, ud);
- g_signal_connect(cell, "edited", chapter_edited_cb, ud);
- g_debug("Done\n");
+ g_signal_connect(cell, "key-press-event", chapter_keypress_cb, ud);
+ g_signal_connect(cell, "edited", chapter_edited_cb, ud);
+ g_debug("Done\n");
}
@@ -259,54 +259,54 @@ extern G_MODULE_EXPORT void queue_drag_motion_cb(void);
static void
bind_queue_tree_model (signal_user_data_t *ud)
{
- GtkCellRenderer *cell, *textcell;
- GtkTreeViewColumn *column;
- GtkTreeStore *treestore;
- GtkTreeView *treeview;
- GtkTreeSelection *selection;
- GtkTargetEntry SrcEntry;
- SrcEntry.target = "DATA";
- SrcEntry.flags = GTK_TARGET_SAME_WIDGET;
-
- g_debug("bind_queue_tree_model ()\n");
- treeview = GTK_TREE_VIEW(GHB_WIDGET (ud->builder, "queue_list"));
- selection = gtk_tree_view_get_selection (treeview);
- treestore = gtk_tree_store_new(3, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
- gtk_tree_view_set_model(treeview, GTK_TREE_MODEL(treestore));
-
- column = gtk_tree_view_column_new();
- gtk_tree_view_column_set_title (column, _("Job Information"));
- cell = gtk_cell_renderer_pixbuf_new();
- g_object_set(cell, "yalign", 0.0, NULL);
- gtk_tree_view_column_pack_start (column, cell, FALSE);
- gtk_tree_view_column_add_attribute (column, cell, "icon-name", 0);
- textcell = gtk_cell_renderer_text_new();
- g_object_set(textcell, "wrap-mode", PANGO_WRAP_CHAR, NULL);
- g_object_set(textcell, "wrap-width", 500, NULL);
- gtk_tree_view_column_pack_start (column, textcell, TRUE);
- gtk_tree_view_column_add_attribute (column, textcell, "markup", 1);
+ GtkCellRenderer *cell, *textcell;
+ GtkTreeViewColumn *column;
+ GtkTreeStore *treestore;
+ GtkTreeView *treeview;
+ GtkTreeSelection *selection;
+ GtkTargetEntry SrcEntry;
+ SrcEntry.target = "DATA";
+ SrcEntry.flags = GTK_TARGET_SAME_WIDGET;
+
+ g_debug("bind_queue_tree_model ()\n");
+ treeview = GTK_TREE_VIEW(GHB_WIDGET (ud->builder, "queue_list"));
+ selection = gtk_tree_view_get_selection (treeview);
+ treestore = gtk_tree_store_new(3, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
+ gtk_tree_view_set_model(treeview, GTK_TREE_MODEL(treestore));
+
+ column = gtk_tree_view_column_new();
+ gtk_tree_view_column_set_title (column, _("Job Information"));
+ cell = gtk_cell_renderer_pixbuf_new();
+ g_object_set(cell, "yalign", 0.0, NULL);
+ gtk_tree_view_column_pack_start (column, cell, FALSE);
+ gtk_tree_view_column_add_attribute (column, cell, "icon-name", 0);
+ textcell = gtk_cell_renderer_text_new();
+ g_object_set(textcell, "wrap-mode", PANGO_WRAP_CHAR, NULL);
+ g_object_set(textcell, "wrap-width", 500, NULL);
+ gtk_tree_view_column_pack_start (column, textcell, TRUE);
+ gtk_tree_view_column_add_attribute (column, textcell, "markup", 1);
gtk_tree_view_append_column(treeview, GTK_TREE_VIEW_COLUMN(column));
- gtk_tree_view_column_set_expand (column, TRUE);
- gtk_tree_view_column_set_max_width (column, 550);
-
- cell = custom_cell_renderer_button_new();
- g_object_set(cell, "yalign", 0.0, NULL);
- column = gtk_tree_view_column_new_with_attributes(
- _(""), cell, "icon-name", 2, NULL);
- gtk_tree_view_column_set_min_width (column, 24);
+ gtk_tree_view_column_set_expand (column, TRUE);
+ gtk_tree_view_column_set_max_width (column, 550);
+
+ cell = custom_cell_renderer_button_new();
+ g_object_set(cell, "yalign", 0.0, NULL);
+ column = gtk_tree_view_column_new_with_attributes(
+ _(""), cell, "icon-name", 2, NULL);
+ gtk_tree_view_column_set_min_width (column, 24);
gtk_tree_view_append_column(treeview, GTK_TREE_VIEW_COLUMN(column));
- gtk_tree_view_enable_model_drag_dest (treeview, &SrcEntry, 1,
- GDK_ACTION_MOVE);
- gtk_tree_view_enable_model_drag_source (treeview, GDK_BUTTON1_MASK,
- &SrcEntry, 1, GDK_ACTION_MOVE);
-
- g_signal_connect(selection, "changed", queue_list_selection_changed_cb, ud);
- g_signal_connect(cell, "clicked", queue_remove_clicked_cb, ud);
- g_signal_connect(treeview, "size-allocate", queue_list_size_allocate_cb,
- textcell);
- g_signal_connect(treeview, "drag_data_received", queue_drag_cb, ud);
- g_signal_connect(treeview, "drag_motion", queue_drag_motion_cb, ud);
+ gtk_tree_view_enable_model_drag_dest (treeview, &SrcEntry, 1,
+ GDK_ACTION_MOVE);
+ gtk_tree_view_enable_model_drag_source (treeview, GDK_BUTTON1_MASK,
+ &SrcEntry, 1, GDK_ACTION_MOVE);
+
+ g_signal_connect(selection, "changed", queue_list_selection_changed_cb, ud);
+ g_signal_connect(cell, "clicked", queue_remove_clicked_cb, ud);
+ g_signal_connect(treeview, "size-allocate", queue_list_size_allocate_cb,
+ textcell);
+ g_signal_connect(treeview, "drag_data_received", queue_drag_cb, ud);
+ g_signal_connect(treeview, "drag_motion", queue_drag_motion_cb, ud);
}
extern G_MODULE_EXPORT void audio_list_selection_changed_cb(void);
@@ -316,70 +316,70 @@ extern G_MODULE_EXPORT void audio_list_selection_changed_cb(void);
static void
bind_audio_tree_model (signal_user_data_t *ud)
{
- GtkCellRenderer *cell;
- GtkTreeViewColumn *column;
- GtkListStore *treestore;
- GtkTreeView *treeview;
- GtkTreeSelection *selection;
- GtkWidget *widget;
-
- g_debug("bind_audio_tree_model ()\n");
- treeview = GTK_TREE_VIEW(GHB_WIDGET (ud->builder, "audio_list"));
- selection = gtk_tree_view_get_selection (treeview);
- // 12 columns in model. 6 are visible, the other 6 are for storing
- // values that I need
- treestore = gtk_list_store_new(7, G_TYPE_STRING, G_TYPE_STRING,
- G_TYPE_STRING, G_TYPE_STRING,
- G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
- gtk_tree_view_set_model(treeview, GTK_TREE_MODEL(treestore));
-
- cell = gtk_cell_renderer_text_new();
- column = gtk_tree_view_column_new_with_attributes(
- _("Track"), cell, "text", 0, NULL);
+ GtkCellRenderer *cell;
+ GtkTreeViewColumn *column;
+ GtkListStore *treestore;
+ GtkTreeView *treeview;
+ GtkTreeSelection *selection;
+ GtkWidget *widget;
+
+ g_debug("bind_audio_tree_model ()\n");
+ treeview = GTK_TREE_VIEW(GHB_WIDGET (ud->builder, "audio_list"));
+ selection = gtk_tree_view_get_selection (treeview);
+ // 12 columns in model. 6 are visible, the other 6 are for storing
+ // values that I need
+ treestore = gtk_list_store_new(7, G_TYPE_STRING, G_TYPE_STRING,
+ G_TYPE_STRING, G_TYPE_STRING,
+ G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
+ gtk_tree_view_set_model(treeview, GTK_TREE_MODEL(treestore));
+
+ cell = gtk_cell_renderer_text_new();
+ column = gtk_tree_view_column_new_with_attributes(
+ _("Track"), cell, "text", 0, NULL);
gtk_tree_view_append_column(treeview, GTK_TREE_VIEW_COLUMN(column));
- gtk_tree_view_column_set_min_width (column, 200);
- gtk_tree_view_column_set_max_width (column, 200);
+ gtk_tree_view_column_set_min_width (column, 200);
+ gtk_tree_view_column_set_max_width (column, 200);
- cell = gtk_cell_renderer_text_new();
- column = gtk_tree_view_column_new_with_attributes(
- _("Codec"), cell, "text", 1, NULL);
+ cell = gtk_cell_renderer_text_new();
+ column = gtk_tree_view_column_new_with_attributes(
+ _("Codec"), cell, "text", 1, NULL);
gtk_tree_view_append_column(treeview, GTK_TREE_VIEW_COLUMN(column));
- gtk_tree_view_column_set_min_width (column, 110);
+ gtk_tree_view_column_set_min_width (column, 110);
- cell = gtk_cell_renderer_text_new();
- column = gtk_tree_view_column_new_with_attributes(
- _("Bitrate"), cell, "text", 2, NULL);
+ cell = gtk_cell_renderer_text_new();
+ column = gtk_tree_view_column_new_with_attributes(
+ _("Bitrate"), cell, "text", 2, NULL);
gtk_tree_view_append_column(treeview, GTK_TREE_VIEW_COLUMN(column));
- gtk_tree_view_column_set_min_width (column, 50);
+ gtk_tree_view_column_set_min_width (column, 50);
- cell = gtk_cell_renderer_text_new();
- column = gtk_tree_view_column_new_with_attributes(
- _("Sample Rate"), cell, "text", 3, NULL);
+ cell = gtk_cell_renderer_text_new();
+ column = gtk_tree_view_column_new_with_attributes(
+ _("Sample Rate"), cell, "text", 3, NULL);
gtk_tree_view_append_column(treeview, GTK_TREE_VIEW_COLUMN(column));
- gtk_tree_view_column_set_min_width (column, 100);
+ gtk_tree_view_column_set_min_width (column, 100);
- cell = gtk_cell_renderer_text_new();
- column = gtk_tree_view_column_new_with_attributes(
- _("Mix"), cell, "text", 4, NULL);
+ cell = gtk_cell_renderer_text_new();
+ column = gtk_tree_view_column_new_with_attributes(
+ _("Mix"), cell, "text", 4, NULL);
gtk_tree_view_append_column(treeview, GTK_TREE_VIEW_COLUMN(column));
- gtk_tree_view_column_set_min_width (column, 115);
+ gtk_tree_view_column_set_min_width (column, 115);
- cell = gtk_cell_renderer_text_new();
- column = gtk_tree_view_column_new_with_attributes(
- _("Gain"), cell, "text", 5, NULL);
+ cell = gtk_cell_renderer_text_new();
+ column = gtk_tree_view_column_new_with_attributes(
+ _("Gain"), cell, "text", 5, NULL);
gtk_tree_view_append_column(treeview, GTK_TREE_VIEW_COLUMN(column));
- cell = gtk_cell_renderer_text_new();
- column = gtk_tree_view_column_new_with_attributes(
- _("DRC"), cell, "text", 6, NULL);
+ cell = gtk_cell_renderer_text_new();
+ column = gtk_tree_view_column_new_with_attributes(
+ _("DRC"), cell, "text", 6, NULL);
gtk_tree_view_append_column(treeview, GTK_TREE_VIEW_COLUMN(column));
- g_signal_connect(selection, "changed", audio_list_selection_changed_cb, ud);
- // Need to disable remove and update buttons since there are initially
- // no selections
- widget = GHB_WIDGET (ud->builder, "audio_remove");
- gtk_widget_set_sensitive(widget, FALSE);
- g_debug("Done\n");
+ g_signal_connect(selection, "changed", audio_list_selection_changed_cb, ud);
+ // Need to disable remove and update buttons since there are initially
+ // no selections
+ widget = GHB_WIDGET (ud->builder, "audio_remove");
+ gtk_widget_set_sensitive(widget, FALSE);
+ g_debug("Done\n");
}
extern G_MODULE_EXPORT void subtitle_list_selection_changed_cb(void);
@@ -392,69 +392,69 @@ extern G_MODULE_EXPORT void subtitle_default_toggled_cb(void);
static void
bind_subtitle_tree_model (signal_user_data_t *ud)
{
- GtkCellRenderer *cell;
- GtkTreeViewColumn *column;
- GtkListStore *treestore;
- GtkTreeView *treeview;
- GtkTreeSelection *selection;
- GtkWidget *widget;
-
- g_debug("bind_subtitle_tree_model ()\n");
- treeview = GTK_TREE_VIEW(GHB_WIDGET (ud->builder, "subtitle_list"));
- selection = gtk_tree_view_get_selection (treeview);
- // 6 columns in model. 5 are visible, the other 1 is for storing
- // values that I need
- // Track, force, burn, default, type, srt offset, track short, source
- // force visible, burn visible, offset visible
- treestore = gtk_list_store_new(10,
- G_TYPE_STRING,
- G_TYPE_BOOLEAN, G_TYPE_BOOLEAN,
- G_TYPE_BOOLEAN,
- G_TYPE_INT, G_TYPE_STRING,
- G_TYPE_INT,
- G_TYPE_BOOLEAN, G_TYPE_BOOLEAN,
- G_TYPE_BOOLEAN);
- gtk_tree_view_set_model(treeview, GTK_TREE_MODEL(treestore));
-
- cell = gtk_cell_renderer_text_new();
- column = gtk_tree_view_column_new_with_attributes(
- _("Track"), cell, "text", 0, NULL);
- gtk_tree_view_append_column(treeview, GTK_TREE_VIEW_COLUMN(column));
- gtk_tree_view_column_set_min_width (column, 350);
- gtk_tree_view_column_set_max_width (column, 350);
-
- cell = gtk_cell_renderer_toggle_new();
- column = gtk_tree_view_column_new_with_attributes(
- _("Forced Only"), cell, "active", 1, "visible", 7, NULL);
- gtk_tree_view_append_column(treeview, GTK_TREE_VIEW_COLUMN(column));
- g_signal_connect(cell, "toggled", subtitle_forced_toggled_cb, ud);
-
- cell = gtk_cell_renderer_toggle_new();
- gtk_cell_renderer_toggle_set_radio(GTK_CELL_RENDERER_TOGGLE(cell), TRUE);
- column = gtk_tree_view_column_new_with_attributes(
- _("Burned In"), cell, "active", 2, "visible", 8, NULL);
- gtk_tree_view_append_column(treeview, GTK_TREE_VIEW_COLUMN(column));
- g_signal_connect(cell, "toggled", subtitle_burned_toggled_cb, ud);
-
- cell = gtk_cell_renderer_toggle_new();
- gtk_cell_renderer_toggle_set_radio(GTK_CELL_RENDERER_TOGGLE(cell), TRUE);
- column = gtk_tree_view_column_new_with_attributes(
- _("Default"), cell, "active", 3, NULL);
- gtk_tree_view_append_column(treeview, GTK_TREE_VIEW_COLUMN(column));
- g_signal_connect(cell, "toggled", subtitle_default_toggled_cb, ud);
-
- cell = gtk_cell_renderer_text_new();
- column = gtk_tree_view_column_new_with_attributes(
- _("Srt Offset"), cell, "text", 4, "visible", 9, NULL);
- gtk_tree_view_append_column(treeview, GTK_TREE_VIEW_COLUMN(column));
-
-
- g_signal_connect(selection, "changed", subtitle_list_selection_changed_cb, ud);
- // Need to disable remove and update buttons since there are initially
- // no selections
- widget = GHB_WIDGET (ud->builder, "subtitle_remove");
- gtk_widget_set_sensitive(widget, FALSE);
- g_debug("Done\n");
+ GtkCellRenderer *cell;
+ GtkTreeViewColumn *column;
+ GtkListStore *treestore;
+ GtkTreeView *treeview;
+ GtkTreeSelection *selection;
+ GtkWidget *widget;
+
+ g_debug("bind_subtitle_tree_model ()\n");
+ treeview = GTK_TREE_VIEW(GHB_WIDGET (ud->builder, "subtitle_list"));
+ selection = gtk_tree_view_get_selection (treeview);
+ // 6 columns in model. 5 are visible, the other 1 is for storing
+ // values that I need
+ // Track, force, burn, default, type, srt offset, track short, source
+ // force visible, burn visible, offset visible
+ treestore = gtk_list_store_new(10,
+ G_TYPE_STRING,
+ G_TYPE_BOOLEAN, G_TYPE_BOOLEAN,
+ G_TYPE_BOOLEAN,
+ G_TYPE_INT, G_TYPE_STRING,
+ G_TYPE_INT,
+ G_TYPE_BOOLEAN, G_TYPE_BOOLEAN,
+ G_TYPE_BOOLEAN);
+ gtk_tree_view_set_model(treeview, GTK_TREE_MODEL(treestore));
+
+ cell = gtk_cell_renderer_text_new();
+ column = gtk_tree_view_column_new_with_attributes(
+ _("Track"), cell, "text", 0, NULL);
+ gtk_tree_view_append_column(treeview, GTK_TREE_VIEW_COLUMN(column));
+ gtk_tree_view_column_set_min_width (column, 350);
+ gtk_tree_view_column_set_max_width (column, 350);
+
+ cell = gtk_cell_renderer_toggle_new();
+ column = gtk_tree_view_column_new_with_attributes(
+ _("Forced Only"), cell, "active", 1, "visible", 7, NULL);
+ gtk_tree_view_append_column(treeview, GTK_TREE_VIEW_COLUMN(column));
+ g_signal_connect(cell, "toggled", subtitle_forced_toggled_cb, ud);
+
+ cell = gtk_cell_renderer_toggle_new();
+ gtk_cell_renderer_toggle_set_radio(GTK_CELL_RENDERER_TOGGLE(cell), TRUE);
+ column = gtk_tree_view_column_new_with_attributes(
+ _("Burned In"), cell, "active", 2, "visible", 8, NULL);
+ gtk_tree_view_append_column(treeview, GTK_TREE_VIEW_COLUMN(column));
+ g_signal_connect(cell, "toggled", subtitle_burned_toggled_cb, ud);
+
+ cell = gtk_cell_renderer_toggle_new();
+ gtk_cell_renderer_toggle_set_radio(GTK_CELL_RENDERER_TOGGLE(cell), TRUE);
+ column = gtk_tree_view_column_new_with_attributes(
+ _("Default"), cell, "active", 3, NULL);
+ gtk_tree_view_append_column(treeview, GTK_TREE_VIEW_COLUMN(column));
+ g_signal_connect(cell, "toggled", subtitle_default_toggled_cb, ud);
+
+ cell = gtk_cell_renderer_text_new();
+ column = gtk_tree_view_column_new_with_attributes(
+ _("Srt Offset"), cell, "text", 4, "visible", 9, NULL);
+ gtk_tree_view_append_column(treeview, GTK_TREE_VIEW_COLUMN(column));
+
+
+ g_signal_connect(selection, "changed", subtitle_list_selection_changed_cb, ud);
+ // Need to disable remove and update buttons since there are initially
+ // no selections
+ widget = GHB_WIDGET (ud->builder, "subtitle_remove");
+ gtk_widget_set_sensitive(widget, FALSE);
+ g_debug("Done\n");
}
extern G_MODULE_EXPORT void presets_list_selection_changed_cb(void);
@@ -468,208 +468,208 @@ extern void presets_row_expanded_cb(void);
static void
bind_presets_tree_model (signal_user_data_t *ud)
{
- GtkCellRenderer *cell;
- GtkTreeViewColumn *column;
- GtkTreeStore *treestore;
- GtkTreeView *treeview;
- GtkTreeSelection *selection;
- GtkWidget *widget;
- GtkTargetEntry SrcEntry;
- SrcEntry.target = "DATA";
- SrcEntry.flags = GTK_TARGET_SAME_WIDGET;
-
- g_debug("bind_presets_tree_model ()\n");
- treeview = GTK_TREE_VIEW(GHB_WIDGET (ud->builder, "presets_list"));
- selection = gtk_tree_view_get_selection (treeview);
- treestore = gtk_tree_store_new(6, G_TYPE_STRING, G_TYPE_INT, G_TYPE_INT,
- G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN);
- gtk_tree_view_set_model(treeview, GTK_TREE_MODEL(treestore));
-
- cell = gtk_cell_renderer_text_new();
- column = gtk_tree_view_column_new_with_attributes(_("Preset Name"), cell,
- "text", 0, "weight", 1, "style", 2,
- "foreground", 3, "editable", 5, NULL);
-
- g_signal_connect(cell, "edited", preset_edited_cb, ud);
+ GtkCellRenderer *cell;
+ GtkTreeViewColumn *column;
+ GtkTreeStore *treestore;
+ GtkTreeView *treeview;
+ GtkTreeSelection *selection;
+ GtkWidget *widget;
+ GtkTargetEntry SrcEntry;
+ SrcEntry.target = "DATA";
+ SrcEntry.flags = GTK_TARGET_SAME_WIDGET;
+
+ g_debug("bind_presets_tree_model ()\n");
+ treeview = GTK_TREE_VIEW(GHB_WIDGET (ud->builder, "presets_list"));
+ selection = gtk_tree_view_get_selection (treeview);
+ treestore = gtk_tree_store_new(6, G_TYPE_STRING, G_TYPE_INT, G_TYPE_INT,
+ G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN);
+ gtk_tree_view_set_model(treeview, GTK_TREE_MODEL(treestore));
+
+ cell = gtk_cell_renderer_text_new();
+ column = gtk_tree_view_column_new_with_attributes(_("Preset Name"), cell,
+ "text", 0, "weight", 1, "style", 2,
+ "foreground", 3, "editable", 5, NULL);
+
+ g_signal_connect(cell, "edited", preset_edited_cb, ud);
gtk_tree_view_append_column(treeview, GTK_TREE_VIEW_COLUMN(column));
- gtk_tree_view_column_set_expand (column, TRUE);
- gtk_tree_view_set_tooltip_column (treeview, 4);
-
- gtk_tree_view_enable_model_drag_dest (treeview, &SrcEntry, 1,
- GDK_ACTION_MOVE);
- gtk_tree_view_enable_model_drag_source (treeview, GDK_BUTTON1_MASK,
- &SrcEntry, 1, GDK_ACTION_MOVE);
-
- g_signal_connect(treeview, "drag_data_received", presets_drag_cb, ud);
- g_signal_connect(treeview, "drag_motion", presets_drag_motion_cb, ud);
- g_signal_connect(treeview, "row_expanded", presets_row_expanded_cb, ud);
- g_signal_connect(treeview, "row_collapsed", presets_row_expanded_cb, ud);
- g_signal_connect(selection, "changed", presets_list_selection_changed_cb, ud);
- widget = GHB_WIDGET (ud->builder, "presets_remove");
- gtk_widget_set_sensitive(widget, FALSE);
- g_debug("Done\n");
+ gtk_tree_view_column_set_expand (column, TRUE);
+ gtk_tree_view_set_tooltip_column (treeview, 4);
+
+ gtk_tree_view_enable_model_drag_dest (treeview, &SrcEntry, 1,
+ GDK_ACTION_MOVE);
+ gtk_tree_view_enable_model_drag_source (treeview, GDK_BUTTON1_MASK,
+ &SrcEntry, 1, GDK_ACTION_MOVE);
+
+ g_signal_connect(treeview, "drag_data_received", presets_drag_cb, ud);
+ g_signal_connect(treeview, "drag_motion", presets_drag_motion_cb, ud);
+ g_signal_connect(treeview, "row_expanded", presets_row_expanded_cb, ud);
+ g_signal_connect(treeview, "row_collapsed", presets_row_expanded_cb, ud);
+ g_signal_connect(selection, "changed", presets_list_selection_changed_cb, ud);
+ widget = GHB_WIDGET (ud->builder, "presets_remove");
+ gtk_widget_set_sensitive(widget, FALSE);
+ g_debug("Done\n");
}
static void
clean_old_logs()
{
#if !defined(_WIN32)
- const gchar *file;
- gchar *config;
-
- config = ghb_get_user_config_dir(NULL);
-
- if (g_file_test(config, G_FILE_TEST_IS_DIR))
- {
- GDir *gdir = g_dir_open(config, 0, NULL);
- file = g_dir_read_name(gdir);
- while (file)
- {
- if (strncmp(file, "Activity.log.", 13) == 0)
- {
- gchar *path;
- int fd, lock = 1;
- int pid;
-
- sscanf(file, "Activity.log.%d", &pid);
-
- path = g_strdup_printf("%s/ghb.pid.%d", config, pid);
- if (g_file_test(path, G_FILE_TEST_EXISTS))
- {
- fd = open(path, O_RDWR);
- if (fd >= 0)
- {
- lock = lockf(fd, F_TLOCK, 0);
- }
- g_free(path);
- close(fd);
- if (lock == 0)
- {
- path = g_strdup_printf("%s/%s", config, file);
- g_unlink(path);
- g_free(path);
- }
- }
- else
- {
- g_free(path);
- path = g_strdup_printf("%s/%s", config, file);
- g_unlink(path);
- g_free(path);
- }
- }
- file = g_dir_read_name(gdir);
- }
- g_dir_close(gdir);
- }
- g_free(config);
+ const gchar *file;
+ gchar *config;
+
+ config = ghb_get_user_config_dir(NULL);
+
+ if (g_file_test(config, G_FILE_TEST_IS_DIR))
+ {
+ GDir *gdir = g_dir_open(config, 0, NULL);
+ file = g_dir_read_name(gdir);
+ while (file)
+ {
+ if (strncmp(file, "Activity.log.", 13) == 0)
+ {
+ gchar *path;
+ int fd, lock = 1;
+ int pid;
+
+ sscanf(file, "Activity.log.%d", &pid);
+
+ path = g_strdup_printf("%s/ghb.pid.%d", config, pid);
+ if (g_file_test(path, G_FILE_TEST_EXISTS))
+ {
+ fd = open(path, O_RDWR);
+ if (fd >= 0)
+ {
+ lock = lockf(fd, F_TLOCK, 0);
+ }
+ g_free(path);
+ close(fd);
+ if (lock == 0)
+ {
+ path = g_strdup_printf("%s/%s", config, file);
+ g_unlink(path);
+ g_free(path);
+ }
+ }
+ else
+ {
+ g_free(path);
+ path = g_strdup_printf("%s/%s", config, file);
+ g_unlink(path);
+ g_free(path);
+ }
+ }
+ file = g_dir_read_name(gdir);
+ }
+ g_dir_close(gdir);
+ }
+ g_free(config);
#else
- const gchar *file;
- gchar *config;
+ const gchar *file;
+ gchar *config;
- config = ghb_get_user_config_dir(NULL);
+ config = ghb_get_user_config_dir(NULL);
- if (g_file_test(config, G_FILE_TEST_IS_DIR))
- {
- GDir *gdir = g_dir_open(config, 0, NULL);
- file = g_dir_read_name(gdir);
- while (file)
- {
- if (strncmp(file, "Activity.log.", 13) == 0)
- {
- gchar *path;
- int pid;
+ if (g_file_test(config, G_FILE_TEST_IS_DIR))
+ {
+ GDir *gdir = g_dir_open(config, 0, NULL);
+ file = g_dir_read_name(gdir);
+ while (file)
+ {
+ if (strncmp(file, "Activity.log.", 13) == 0)
+ {
+ gchar *path;
+ int pid;
- sscanf(file, "Activity.log.%d", &pid);
+ sscanf(file, "Activity.log.%d", &pid);
#if 0
- int fd, lock = 1;
-
- path = g_strdup_printf("%s/ghb.pid.%d", config, pid);
- if (g_file_test(path, G_FILE_TEST_EXISTS))
- {
- fd = open(path, O_RDWR);
- if (fd >= 0)
- {
- lock = lockf(fd, F_TLOCK, 0);
- }
- g_free(path);
- close(fd);
- if (lock == 0)
- {
- path = g_strdup_printf("%s/%s", config, file);
- g_unlink(path);
- g_free(path);
- }
- }
- else
+ int fd, lock = 1;
+
+ path = g_strdup_printf("%s/ghb.pid.%d", config, pid);
+ if (g_file_test(path, G_FILE_TEST_EXISTS))
+ {
+ fd = open(path, O_RDWR);
+ if (fd >= 0)
+ {
+ lock = lockf(fd, F_TLOCK, 0);
+ }
+ g_free(path);
+ close(fd);
+ if (lock == 0)
+ {
+ path = g_strdup_printf("%s/%s", config, file);
+ g_unlink(path);
+ g_free(path);
+ }
+ }
+ else
#endif
- {
- //g_free(path);
- path = g_strdup_printf("%s/%s", config, file);
- g_unlink(path);
- g_free(path);
- }
- }
- file = g_dir_read_name(gdir);
- }
- g_dir_close(gdir);
- }
- g_free(config);
+ {
+ //g_free(path);
+ path = g_strdup_printf("%s/%s", config, file);
+ g_unlink(path);
+ g_free(path);
+ }
+ }
+ file = g_dir_read_name(gdir);
+ }
+ g_dir_close(gdir);
+ }
+ g_free(config);
#endif
}
static void
IoRedirect(signal_user_data_t *ud)
{
- GIOChannel *channel;
- gint pfd[2];
- gchar *config, *path, *str;
- pid_t pid;
-
- // I'm opening a pipe and attaching the writer end to stderr
- // The reader end will be polled by main event loop and I'll get
- // a callback when there is data available.
- if (pipe( pfd ) < 0)
- {
- g_warning("Failed to redirect IO. Logging impaired\n");
- return;
- }
- clean_old_logs();
- // Open activity log.
- config = ghb_get_user_config_dir(NULL);
- pid = getpid();
- path = g_strdup_printf("%s/Activity.log.%d", config, pid);
- ud->activity_log = g_io_channel_new_file (path, "w", NULL);
- ud->job_activity_log = NULL;
- str = g_strdup_printf("<big><b>%s</b></big>", path);
- ghb_ui_update(ud, "activity_location", ghb_string_value(str));
- g_free(str);
- g_free(path);
- g_free(config);
- // Set encoding to raw.
- g_io_channel_set_encoding (ud->activity_log, NULL, NULL);
- // redirect stderr to the writer end of the pipe
+ GIOChannel *channel;
+ gint pfd[2];
+ gchar *config, *path, *str;
+ pid_t pid;
+
+ // I'm opening a pipe and attaching the writer end to stderr
+ // The reader end will be polled by main event loop and I'll get
+ // a callback when there is data available.
+ if (pipe( pfd ) < 0)
+ {
+ g_warning("Failed to redirect IO. Logging impaired\n");
+ return;
+ }
+ clean_old_logs();
+ // Open activity log.
+ config = ghb_get_user_config_dir(NULL);
+ pid = getpid();
+ path = g_strdup_printf("%s/Activity.log.%d", config, pid);
+ ud->activity_log = g_io_channel_new_file (path, "w", NULL);
+ ud->job_activity_log = NULL;
+ str = g_strdup_printf("<big><b>%s</b></big>", path);
+ ghb_ui_update(ud, "activity_location", ghb_string_value(str));
+ g_free(str);
+ g_free(path);
+ g_free(config);
+ // Set encoding to raw.
+ g_io_channel_set_encoding (ud->activity_log, NULL, NULL);
+ // redirect stderr to the writer end of the pipe
#if defined(_WIN32)
- // dup2 doesn't work on windows for some stupid reason
- stderr->_file = pfd[1];
+ // dup2 doesn't work on windows for some stupid reason
+ stderr->_file = pfd[1];
#else
- dup2(pfd[1], /*stderr*/2);
+ dup2(pfd[1], /*stderr*/2);
#endif
- setvbuf(stderr, NULL, _IONBF, 0);
- channel = g_io_channel_unix_new (pfd[0]);
- // I was getting an this error:
- // "Invalid byte sequence in conversion input"
- // Set disable encoding on the channel.
- g_io_channel_set_encoding (channel, NULL, NULL);
- g_io_add_watch (channel, G_IO_IN, ghb_log_cb, (gpointer)ud );
+ setvbuf(stderr, NULL, _IONBF, 0);
+ channel = g_io_channel_unix_new (pfd[0]);
+ // I was getting an this error:
+ // "Invalid byte sequence in conversion input"
+ // Set disable encoding on the channel.
+ g_io_channel_set_encoding (channel, NULL, NULL);
+ g_io_add_watch (channel, G_IO_IN, ghb_log_cb, (gpointer)ud );
}
typedef struct
{
- gchar *filename;
- gchar *iconname;
+ gchar *filename;
+ gchar *iconname;
} icon_map_t;
static gchar *dvd_device = NULL;
@@ -678,10 +678,10 @@ static gboolean ghb_debug = FALSE;
static GOptionEntry entries[] =
{
- { "device", 'd', 0, G_OPTION_ARG_FILENAME, &dvd_device, "The device or file to encode", NULL },
- { "preset", 'p', 0, G_OPTION_ARG_STRING, &arg_preset, "The preset values to use for encoding", NULL },
- { "debug", 'x', 0, G_OPTION_ARG_NONE, &ghb_debug, "Spam a lot", NULL },
- { NULL }
+ { "device", 'd', 0, G_OPTION_ARG_FILENAME, &dvd_device, "The device or file to encode", NULL },
+ { "preset", 'p', 0, G_OPTION_ARG_STRING, &arg_preset, "The preset values to use for encoding", NULL },
+ { "debug", 'x', 0, G_OPTION_ARG_NONE, &ghb_debug, "Spam a lot", NULL },
+ { NULL }
};
G_MODULE_EXPORT void drive_changed_cb(GVolumeMonitor *gvm, GDrive *gd, signal_user_data_t *ud);
@@ -690,14 +690,14 @@ G_MODULE_EXPORT void drive_changed_cb(GVolumeMonitor *gvm, GDrive *gd, signal_us
G_MODULE_EXPORT GdkFilterReturn
win_message_cb(GdkXEvent *wmevent, GdkEvent *event, gpointer data)
{
- signal_user_data_t *ud = (signal_user_data_t*)data;
- MSG *msg = (MSG*)wmevent;
-
- if (msg->message == WM_DEVICECHANGE)
- {
- wm_drive_changed(wmevent, ud);
- }
- return GDK_FILTER_CONTINUE;
+ signal_user_data_t *ud = (signal_user_data_t*)data;
+ MSG *msg = (MSG*)wmevent;
+
+ if (msg->message == WM_DEVICECHANGE)
+ {
+ wm_drive_changed(wmevent, ud);
+ }
+ return GDK_FILTER_CONTINUE;
}
#endif
@@ -705,17 +705,17 @@ void
watch_volumes(signal_user_data_t *ud)
{
#if !defined(_WIN32)
- GVolumeMonitor *gvm;
- gvm = g_volume_monitor_get ();
+ GVolumeMonitor *gvm;
+ gvm = g_volume_monitor_get ();
- g_signal_connect(gvm, "drive-changed", (GCallback)drive_changed_cb, ud);
+ g_signal_connect(gvm, "drive-changed", (GCallback)drive_changed_cb, ud);
#else
- GdkWindow *window;
- GtkWidget *widget;
+ GdkWindow *window;
+ GtkWidget *widget;
- widget = GHB_WIDGET (ud->builder, "hb_window");
- window = gtk_widget_get_parent_window(widget);
- gdk_window_add_filter(window, win_message_cb, ud);
+ widget = GHB_WIDGET (ud->builder, "hb_window");
+ window = gtk_widget_get_parent_window(widget);
+ gdk_window_add_filter(window, win_message_cb, ud);
#endif
}
@@ -760,124 +760,124 @@ extern G_MODULE_EXPORT void status_icon_query_tooltip_cb(void);
int
main (int argc, char *argv[])
{
- signal_user_data_t *ud;
- GValue *preset;
- GError *error = NULL;
- GOptionContext *context;
+ signal_user_data_t *ud;
+ GValue *preset;
+ GError *error = NULL;
+ GOptionContext *context;
#ifdef ENABLE_NLS
- bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
- bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
- textdomain (GETTEXT_PACKAGE);
+ bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
+ bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+ textdomain (GETTEXT_PACKAGE);
#endif
- if (!g_thread_supported())
- g_thread_init(NULL);
- context = g_option_context_new ("- Transcode media formats");
- g_option_context_add_main_entries (context, entries, GETTEXT_PACKAGE);
- g_option_context_add_group (context, gtk_get_option_group (TRUE));
+ if (!g_thread_supported())
+ g_thread_init(NULL);
+ context = g_option_context_new ("- Transcode media formats");
+ g_option_context_add_main_entries (context, entries, GETTEXT_PACKAGE);
+ g_option_context_add_group (context, gtk_get_option_group (TRUE));
#if defined(_ENABLE_GST)
- g_option_context_add_group (context, gst_init_get_option_group ());
+ g_option_context_add_group (context, gst_init_get_option_group ());
#endif
- g_option_context_parse (context, &argc, &argv, &error);
- g_option_context_free(context);
-
- if (argc > 1 && dvd_device == NULL && argv[1][0] != '-')
- {
- dvd_device = argv[1];
- }
-
- gtk_init (&argc, &argv);
- gtk_rc_parse_string(hud_rcstyle);
- g_type_class_unref(g_type_class_ref(GTK_TYPE_BUTTON));
- g_object_set(gtk_settings_get_default(), "gtk-button-images", TRUE, NULL);
+ g_option_context_parse (context, &argc, &argv, &error);
+ g_option_context_free(context);
+
+ if (argc > 1 && dvd_device == NULL && argv[1][0] != '-')
+ {
+ dvd_device = argv[1];
+ }
+
+ gtk_init (&argc, &argv);
+ gtk_rc_parse_string(hud_rcstyle);
+ g_type_class_unref(g_type_class_ref(GTK_TYPE_BUTTON));
+ g_object_set(gtk_settings_get_default(), "gtk-button-images", TRUE, NULL);
#if !defined(_WIN32)
- notify_init("HandBrake");
+ notify_init("HandBrake");
#endif
- ghb_register_transforms();
- ghb_resource_init();
- ghb_load_icons();
+ ghb_register_transforms();
+ ghb_resource_init();
+ ghb_load_icons();
#if !defined(_WIN32)
- dbus_g_thread_init();
+ dbus_g_thread_init();
#endif
- ghb_udev_init();
-
- ghb_write_pid_file();
- ud = g_malloc0(sizeof(signal_user_data_t));
- ud->debug = ghb_debug;
- g_log_set_handler (NULL, G_LOG_LEVEL_DEBUG, debug_log_handler, ud);
- g_log_set_handler ("Gtk", G_LOG_LEVEL_WARNING, warn_log_handler, ud);
- //g_log_set_handler ("Gtk", G_LOG_LEVEL_CRITICAL, warn_log_handler, ud);
- ud->settings = ghb_settings_new();
- ud->builder = create_builder_or_die (BUILDER_NAME);
- // Enable events that alert us to media change events
- watch_volumes (ud);
-
- //GtkWidget *widget = GHB_WIDGET(ud->builder, "PictureDetelecineCustom");
- //gtk_entry_set_inner_border(widget, 2);
-
- // Since GtkBuilder no longer assigns object ids to widget names
- // Assign a few that are necessary for style overrides to work
- GtkWidget *widget;
+ ghb_udev_init();
+
+ ghb_write_pid_file();
+ ud = g_malloc0(sizeof(signal_user_data_t));
+ ud->debug = ghb_debug;
+ g_log_set_handler (NULL, G_LOG_LEVEL_DEBUG, debug_log_handler, ud);
+ g_log_set_handler ("Gtk", G_LOG_LEVEL_WARNING, warn_log_handler, ud);
+ //g_log_set_handler ("Gtk", G_LOG_LEVEL_CRITICAL, warn_log_handler, ud);
+ ud->settings = ghb_settings_new();
+ ud->builder = create_builder_or_die (BUILDER_NAME);
+ // Enable events that alert us to media change events
+ watch_volumes (ud);
+
+ //GtkWidget *widget = GHB_WIDGET(ud->builder, "PictureDetelecineCustom");
+ //gtk_entry_set_inner_border(widget, 2);
+
+ // Since GtkBuilder no longer assigns object ids to widget names
+ // Assign a few that are necessary for style overrides to work
+ GtkWidget *widget;
#if defined(_NO_UPDATE_CHECK)
- widget = GHB_WIDGET(ud->builder, "check_updates_box");
- gtk_widget_hide(widget);
+ widget = GHB_WIDGET(ud->builder, "check_updates_box");
+ gtk_widget_hide(widget);
#endif
- widget = GHB_WIDGET(ud->builder, "preview_hud");
- gtk_widget_set_name(widget, "preview_hud");
- widget = GHB_WIDGET(ud->builder, "preview_window");
- gtk_widget_set_name(widget, "preview_window");
-
- // Set up the "hud" control overlay for the preview window
- GtkWidget *draw, *hud, *blender, *align;
-
- align = GHB_WIDGET(ud->builder, "preview_window_alignment");
- draw = GHB_WIDGET(ud->builder, "preview_image_align");
- hud = GHB_WIDGET(ud->builder, "preview_hud");
-
- // Set up compositing for hud
- blender = ghb_compositor_new();
-
- gtk_container_add(GTK_CONTAINER(align), blender);
- ghb_compositor_zlist_insert(GHB_COMPOSITOR(blender), draw, 1, 1);
- ghb_compositor_zlist_insert(GHB_COMPOSITOR(blender), hud, 2, .85);
- gtk_widget_show(blender);
-
- // Redirect stderr to the activity window
- ghb_preview_init(ud);
- IoRedirect(ud);
- ghb_log( "%s - %s - %s",
- HB_PROJECT_TITLE, HB_PROJECT_BUILD_TITLE, HB_PROJECT_URL_WEBSITE );
- ghb_init_dep_map();
-
- // Need to connect x264_options textview buffer to the changed signal
- // since it can't be done automatically
- GtkTextView *textview;
- GtkTextBuffer *buffer;
- textview = GTK_TEXT_VIEW(GHB_WIDGET (ud->builder, "x264Option"));
- buffer = gtk_text_view_get_buffer (textview);
- g_signal_connect(buffer, "changed", (GCallback)x264_entry_changed_cb, ud);
-
- textview = GTK_TEXT_VIEW(GHB_WIDGET (ud->builder, "x264OptionExtra"));
- buffer = gtk_text_view_get_buffer (textview);
- g_signal_connect(buffer, "changed", (GCallback)x264_option_changed_cb, ud);
-
- ghb_combo_init(ud);
-
- g_debug("ud %p\n", ud);
- g_debug("ud->builder %p\n", ud->builder);
-
- bind_audio_tree_model(ud);
- bind_subtitle_tree_model(ud);
- bind_presets_tree_model(ud);
- bind_queue_tree_model(ud);
- bind_chapter_tree_model(ud);
- // Connect up the signals to their callbacks
- // I wrote my own connector so that I could pass user data
- // to the callbacks. Builder's standard autoconnect doesn't all this.
- gtk_builder_connect_signals_full (ud->builder, MyConnect, ud);
+ widget = GHB_WIDGET(ud->builder, "preview_hud");
+ gtk_widget_set_name(widget, "preview_hud");
+ widget = GHB_WIDGET(ud->builder, "preview_window");
+ gtk_widget_set_name(widget, "preview_window");
+
+ // Set up the "hud" control overlay for the preview window
+ GtkWidget *draw, *hud, *blender, *align;
+
+ align = GHB_WIDGET(ud->builder, "preview_window_alignment");
+ draw = GHB_WIDGET(ud->builder, "preview_image_align");
+ hud = GHB_WIDGET(ud->builder, "preview_hud");
+
+ // Set up compositing for hud
+ blender = ghb_compositor_new();
+
+ gtk_container_add(GTK_CONTAINER(align), blender);
+ ghb_compositor_zlist_insert(GHB_COMPOSITOR(blender), draw, 1, 1);
+ ghb_compositor_zlist_insert(GHB_COMPOSITOR(blender), hud, 2, .85);
+ gtk_widget_show(blender);
+
+ // Redirect stderr to the activity window
+ ghb_preview_init(ud);
+ IoRedirect(ud);
+ ghb_log( "%s - %s - %s",
+ HB_PROJECT_TITLE, HB_PROJECT_BUILD_TITLE, HB_PROJECT_URL_WEBSITE );
+ ghb_init_dep_map();
+
+ // Need to connect x264_options textview buffer to the changed signal
+ // since it can't be done automatically
+ GtkTextView *textview;
+ GtkTextBuffer *buffer;
+ textview = GTK_TEXT_VIEW(GHB_WIDGET (ud->builder, "x264Option"));
+ buffer = gtk_text_view_get_buffer (textview);
+ g_signal_connect(buffer, "changed", (GCallback)x264_entry_changed_cb, ud);
+
+ textview = GTK_TEXT_VIEW(GHB_WIDGET (ud->builder, "x264OptionExtra"));
+ buffer = gtk_text_view_get_buffer (textview);
+ g_signal_connect(buffer, "changed", (GCallback)x264_option_changed_cb, ud);
+
+ ghb_combo_init(ud);
+
+ g_debug("ud %p\n", ud);
+ g_debug("ud->builder %p\n", ud->builder);
+
+ bind_audio_tree_model(ud);
+ bind_subtitle_tree_model(ud);
+ bind_presets_tree_model(ud);
+ bind_queue_tree_model(ud);
+ bind_chapter_tree_model(ud);
+ // Connect up the signals to their callbacks
+ // I wrote my own connector so that I could pass user data
+ // to the callbacks. Builder's standard autoconnect doesn't all this.
+ gtk_builder_connect_signals_full (ud->builder, MyConnect, ud);
GtkWidget *presetSlider = GHB_WIDGET(ud->builder, "x264PresetSlider");
const char * const *x264_presets;
@@ -886,250 +886,250 @@ main (int argc, char *argv[])
while (x264_presets && x264_presets[count]) count++;
gtk_range_set_range (GTK_RANGE(presetSlider), 0, count-1);
- // Load all internal settings
- ghb_settings_init(ud);
- // Load the presets files
- ghb_presets_load(ud);
- ghb_prefs_load(ud);
-
- ghb_prefs_to_ui(ud);
-
- gint logLevel;
- logLevel = ghb_settings_get_int(ud->settings, "LoggingLevel");
- ghb_backend_init(logLevel);
-
- if (ghb_settings_get_boolean(ud->settings, "hbfd"))
- {
- ghb_hbfd(ud, TRUE);
- }
- gchar *source = ghb_settings_get_string(ud->settings, "default_source");
- ghb_dvd_set_current(source, ud);
- g_free(source);
-
- // Parsing x264 options "" initializes x264 widgets to proper defaults
- ghb_x264_parse_options(ud, "");
-
- // Populate the presets tree view
- ghb_presets_list_init(ud, NULL, 0);
- // Get the first preset name
- if (arg_preset != NULL)
- {
- preset = ghb_parse_preset_path(arg_preset);
- if (preset)
- {
- ghb_select_preset(ud->builder, preset);
- ghb_value_free(preset);
- }
- }
- else
- {
- ghb_select_default_preset(ud->builder);
- }
-
- // Grey out widgets that are dependent on a disabled feature
- ghb_check_all_depencencies (ud);
-
- if (dvd_device != NULL)
- {
- // Source overridden from command line option
- ghb_settings_set_string(ud->settings, "scan_source", dvd_device);
- g_idle_add((GSourceFunc)ghb_idle_scan, ud);
- }
- // Reload and check status of the last saved queue
- g_idle_add((GSourceFunc)ghb_reload_queue, ud);
-
- // Start timer for monitoring libhb status, 500ms
- g_timeout_add (500, ghb_timer_cb, (gpointer)ud);
-
- // Add dvd devices to File menu
- ghb_volname_cache_init();
- g_thread_create((GThreadFunc)ghb_cache_volnames, ud, FALSE, NULL);
+ // Load all internal settings
+ ghb_settings_init(ud);
+ // Load the presets files
+ ghb_presets_load(ud);
+ ghb_prefs_load(ud);
+
+ ghb_prefs_to_ui(ud);
+
+ gint logLevel;
+ logLevel = ghb_settings_get_int(ud->settings, "LoggingLevel");
+ ghb_backend_init(logLevel);
+
+ if (ghb_settings_get_boolean(ud->settings, "hbfd"))
+ {
+ ghb_hbfd(ud, TRUE);
+ }
+ gchar *source = ghb_settings_get_string(ud->settings, "default_source");
+ ghb_dvd_set_current(source, ud);
+ g_free(source);
+
+ // Parsing x264 options "" initializes x264 widgets to proper defaults
+ ghb_x264_parse_options(ud, "");
+
+ // Populate the presets tree view
+ ghb_presets_list_init(ud, NULL, 0);
+ // Get the first preset name
+ if (arg_preset != NULL)
+ {
+ preset = ghb_parse_preset_path(arg_preset);
+ if (preset)
+ {
+ ghb_select_preset(ud->builder, preset);
+ ghb_value_free(preset);
+ }
+ }
+ else
+ {
+ ghb_select_default_preset(ud->builder);
+ }
+
+ // Grey out widgets that are dependent on a disabled feature
+ ghb_check_all_depencencies (ud);
+
+ if (dvd_device != NULL)
+ {
+ // Source overridden from command line option
+ ghb_settings_set_string(ud->settings, "scan_source", dvd_device);
+ g_idle_add((GSourceFunc)ghb_idle_scan, ud);
+ }
+ // Reload and check status of the last saved queue
+ g_idle_add((GSourceFunc)ghb_reload_queue, ud);
+
+ // Start timer for monitoring libhb status, 500ms
+ g_timeout_add (500, ghb_timer_cb, (gpointer)ud);
+
+ // Add dvd devices to File menu
+ ghb_volname_cache_init();
+ g_thread_create((GThreadFunc)ghb_cache_volnames, ud, FALSE, NULL);
#if defined(_USE_APP_IND)
- GtkUIManager * uim = GTK_UI_MANAGER(GHB_OBJECT(ud->builder, "uimanager1"));
-
- GtkMenu *ai_menu = GTK_MENU(gtk_ui_manager_get_widget(uim, "/ui/tray_menu"));
- ud->ai = app_indicator_new("HandBrake", "hb-icon", APP_INDICATOR_CATEGORY_APPLICATION_STATUS);
- app_indicator_set_menu( ud->ai, ai_menu );
- app_indicator_set_label( ud->ai, "", "99.99%");
- if (ghb_settings_get_boolean(ud->settings, "show_status"))
- {
- app_indicator_set_status( ud->ai, APP_INDICATOR_STATUS_ACTIVE );
- }
- else
- {
- app_indicator_set_status( ud->ai, APP_INDICATOR_STATUS_PASSIVE );
- }
- GtkStatusIcon *si;
- si = GTK_STATUS_ICON(GHB_OBJECT(ud->builder, "hb_status"));
-
- gtk_status_icon_set_visible(si, FALSE );
+ GtkUIManager * uim = GTK_UI_MANAGER(GHB_OBJECT(ud->builder, "uimanager1"));
+
+ GtkMenu *ai_menu = GTK_MENU(gtk_ui_manager_get_widget(uim, "/ui/tray_menu"));
+ ud->ai = app_indicator_new("HandBrake", "hb-icon", APP_INDICATOR_CATEGORY_APPLICATION_STATUS);
+ app_indicator_set_menu( ud->ai, ai_menu );
+ app_indicator_set_label( ud->ai, "", "99.99%");
+ if (ghb_settings_get_boolean(ud->settings, "show_status"))
+ {
+ app_indicator_set_status( ud->ai, APP_INDICATOR_STATUS_ACTIVE );
+ }
+ else
+ {
+ app_indicator_set_status( ud->ai, APP_INDICATOR_STATUS_PASSIVE );
+ }
+ GtkStatusIcon *si;
+ si = GTK_STATUS_ICON(GHB_OBJECT(ud->builder, "hb_status"));
+
+ gtk_status_icon_set_visible(si, FALSE );
#else
- GtkStatusIcon *si;
- si = GTK_STATUS_ICON(GHB_OBJECT(ud->builder, "hb_status"));
+ GtkStatusIcon *si;
+ si = GTK_STATUS_ICON(GHB_OBJECT(ud->builder, "hb_status"));
- gtk_status_icon_set_visible(si,
- ghb_settings_get_boolean(ud->settings, "show_status"));
+ gtk_status_icon_set_visible(si,
+ ghb_settings_get_boolean(ud->settings, "show_status"));
#if GTK_CHECK_VERSION(2, 16, 0)
- gtk_status_icon_set_has_tooltip(si, TRUE);
- g_signal_connect(si, "query-tooltip",
- status_icon_query_tooltip_cb, ud);
+ gtk_status_icon_set_has_tooltip(si, TRUE);
+ g_signal_connect(si, "query-tooltip",
+ status_icon_query_tooltip_cb, ud);
#else
- gtk_status_icon_set_tooltip(si, "HandBrake");
+ gtk_status_icon_set_tooltip(si, "HandBrake");
#endif
#endif
- // Ugly hack to keep subtitle table from bouncing around as I change
- // which set of controls are visible
- GtkRequisition req;
- gint width, height;
-
- widget = GHB_WIDGET(ud->builder, "SrtCodeset");
- gtk_widget_size_request( widget, &req );
- height = req.height;
- widget = GHB_WIDGET(ud->builder, "srt_code_label");
- gtk_widget_size_request( widget, &req );
- height += req.height;
- widget = GHB_WIDGET(ud->builder, "subtitle_table");
- gtk_widget_set_size_request(widget, -1, height);
-
- widget = GHB_WIDGET (ud->builder, "hb_window");
-
- GdkGeometry geo = {
- -1, -1, 1024, 768, -1, -1, 10, 10, 0, 0, GDK_GRAVITY_NORTH_WEST
- };
- GdkWindowHints geo_mask;
- geo_mask = GDK_HINT_MIN_SIZE | GDK_HINT_MAX_SIZE | GDK_HINT_BASE_SIZE;
- gtk_window_set_geometry_hints( GTK_WINDOW(widget), widget, &geo, geo_mask);
- width = ghb_settings_get_int(ud->settings, "window_width");
- height = ghb_settings_get_int(ud->settings, "window_height");
- gtk_window_resize(GTK_WINDOW(widget), width, height);
- gtk_widget_show(widget);
-
- /*
- * Filter objects in GtkBuilder xml
- * Unfortunately, GtkFilter is poorly supported by GtkBuilder,
- * so a lot of the setup must happen in code.
- SourceFilterAll
- SourceFilterVideo
- SourceFilterTS
- SourceFilterMPG
- SourceFilterEVO
- SourceFilterVOB
- SourceFilterMKV
- SourceFilterMP4
- SourceFilterAVI
- SourceFilterMOV
- SourceFilterOGG
- SourceFilterFLV
- SourceFilterWMV
- */
- // Add filters to source chooser
- GtkFileFilter *filter;
- GtkFileChooser *chooser;
- chooser = GTK_FILE_CHOOSER(GHB_WIDGET(ud->builder, "source_dialog"));
- filter = GTK_FILE_FILTER(GHB_OBJECT(ud->builder, "SourceFilterAll"));
- gtk_file_filter_set_name(filter, "All");
- gtk_file_filter_add_pattern(filter, "*");
- gtk_file_chooser_add_filter(chooser, filter);
- filter = GTK_FILE_FILTER(GHB_OBJECT(ud->builder, "SourceFilterVideo"));
- gtk_file_filter_set_name(filter, "Video");
- gtk_file_filter_add_mime_type(filter, "video/*");
- gtk_file_chooser_add_filter(chooser, filter);
- filter = GTK_FILE_FILTER(GHB_OBJECT(ud->builder, "SourceFilterTS"));
- gtk_file_filter_set_name(filter, "TS");
- gtk_file_filter_add_pattern(filter, "*.ts");
- gtk_file_filter_add_pattern(filter, "*.TS");
- gtk_file_filter_add_pattern(filter, "*.m2ts");
- gtk_file_filter_add_pattern(filter, "*.M2TS");
- gtk_file_chooser_add_filter(chooser, filter);
- filter = GTK_FILE_FILTER(GHB_OBJECT(ud->builder, "SourceFilterMPG"));
- gtk_file_filter_set_name(filter, "MPG");
- gtk_file_filter_add_pattern(filter, "*.mpg");
- gtk_file_filter_add_pattern(filter, "*.MPG");
- gtk_file_filter_add_pattern(filter, "*.mepg");
- gtk_file_filter_add_pattern(filter, "*.MEPG");
- gtk_file_chooser_add_filter(chooser, filter);
- filter = GTK_FILE_FILTER(GHB_OBJECT(ud->builder, "SourceFilterEVO"));
- gtk_file_filter_set_name(filter, "EVO");
- gtk_file_filter_add_pattern(filter, "*.evo");
- gtk_file_filter_add_pattern(filter, "*.EVO");
- gtk_file_chooser_add_filter(chooser, filter);
- filter = GTK_FILE_FILTER(GHB_OBJECT(ud->builder, "SourceFilterVOB"));
- gtk_file_filter_set_name(filter, "VOB");
- gtk_file_filter_add_pattern(filter, "*.vob");
- gtk_file_filter_add_pattern(filter, "*.VOB");
- gtk_file_chooser_add_filter(chooser, filter);
- filter = GTK_FILE_FILTER(GHB_OBJECT(ud->builder, "SourceFilterMKV"));
- gtk_file_filter_set_name(filter, "MKV");
- gtk_file_filter_add_pattern(filter, "*.mkv");
- gtk_file_filter_add_pattern(filter, "*.MKV");
- gtk_file_chooser_add_filter(chooser, filter);
- filter = GTK_FILE_FILTER(GHB_OBJECT(ud->builder, "SourceFilterMP4"));
- gtk_file_filter_set_name(filter, "MP4");
- gtk_file_filter_add_pattern(filter, "*.mp4");
- gtk_file_filter_add_pattern(filter, "*.MP4");
- gtk_file_filter_add_pattern(filter, "*.m4v");
- gtk_file_filter_add_pattern(filter, "*.M4V");
- gtk_file_chooser_add_filter(chooser, filter);
- filter = GTK_FILE_FILTER(GHB_OBJECT(ud->builder, "SourceFilterMOV"));
- gtk_file_filter_set_name(filter, "MOV");
- gtk_file_filter_add_pattern(filter, "*.mov");
- gtk_file_filter_add_pattern(filter, "*.MOV");
- gtk_file_chooser_add_filter(chooser, filter);
- filter = GTK_FILE_FILTER(GHB_OBJECT(ud->builder, "SourceFilterAVI"));
- gtk_file_filter_set_name(filter, "AVI");
- gtk_file_filter_add_pattern(filter, "*.avi");
- gtk_file_filter_add_pattern(filter, "*.AVI");
- gtk_file_chooser_add_filter(chooser, filter);
- filter = GTK_FILE_FILTER(GHB_OBJECT(ud->builder, "SourceFilterOGG"));
- gtk_file_filter_set_name(filter, "OGG");
- gtk_file_filter_add_pattern(filter, "*.ogg");
- gtk_file_filter_add_pattern(filter, "*.OGG");
- gtk_file_filter_add_pattern(filter, "*.ogv");
- gtk_file_filter_add_pattern(filter, "*.OGV");
- gtk_file_filter_add_pattern(filter, "*.ogm");
- gtk_file_filter_add_pattern(filter, "*.OGM");
- gtk_file_chooser_add_filter(chooser, filter);
- filter = GTK_FILE_FILTER(GHB_OBJECT(ud->builder, "SourceFilterFLV"));
- gtk_file_filter_set_name(filter, "FLV");
- gtk_file_filter_add_pattern(filter, "*.flv");
- gtk_file_filter_add_pattern(filter, "*.FLV");
- gtk_file_chooser_add_filter(chooser, filter);
- filter = GTK_FILE_FILTER(GHB_OBJECT(ud->builder, "SourceFilterWMV"));
- gtk_file_filter_set_name(filter, "WMV");
- gtk_file_filter_add_pattern(filter, "*.wmv");
- gtk_file_filter_add_pattern(filter, "*.WMV");
- gtk_file_chooser_add_filter(chooser, filter);
-
- // Gtk has a really stupid bug. If the file chooser is showing
- // hidden files AND there is no filter set, it will not select
- // the filename when gtk_file_chooser_set_filename is called.
- // So add a completely unnessary filter to prevent this behavior.
- filter = GTK_FILE_FILTER(GHB_OBJECT(ud->builder, "SourceFilterAll"));
- gtk_file_chooser_set_filter(chooser, filter);
-
- PangoFontDescription *font_desc;
- font_desc = pango_font_description_from_string ("monospace 10");
- textview = GTK_TEXT_VIEW(GHB_WIDGET (ud->builder, "activity_view"));
- gtk_widget_modify_font(GTK_WIDGET(textview), font_desc);
- pango_font_description_free (font_desc);
-
- // Everything should be go-to-go. Lets rock!
-
- gtk_main ();
- gtk_status_icon_set_visible(si, FALSE);
- ghb_backend_close();
- if (ud->queue)
- ghb_value_free(ud->queue);
- ghb_value_free(ud->settings);
- g_io_channel_unref(ud->activity_log);
- ghb_settings_close();
+ // Ugly hack to keep subtitle table from bouncing around as I change
+ // which set of controls are visible
+ GtkRequisition req;
+ gint width, height;
+
+ widget = GHB_WIDGET(ud->builder, "SrtCodeset");
+ gtk_widget_size_request( widget, &req );
+ height = req.height;
+ widget = GHB_WIDGET(ud->builder, "srt_code_label");
+ gtk_widget_size_request( widget, &req );
+ height += req.height;
+ widget = GHB_WIDGET(ud->builder, "subtitle_table");
+ gtk_widget_set_size_request(widget, -1, height);
+
+ widget = GHB_WIDGET (ud->builder, "hb_window");
+
+ GdkGeometry geo = {
+ -1, -1, 1024, 768, -1, -1, 10, 10, 0, 0, GDK_GRAVITY_NORTH_WEST
+ };
+ GdkWindowHints geo_mask;
+ geo_mask = GDK_HINT_MIN_SIZE | GDK_HINT_MAX_SIZE | GDK_HINT_BASE_SIZE;
+ gtk_window_set_geometry_hints( GTK_WINDOW(widget), widget, &geo, geo_mask);
+ width = ghb_settings_get_int(ud->settings, "window_width");
+ height = ghb_settings_get_int(ud->settings, "window_height");
+ gtk_window_resize(GTK_WINDOW(widget), width, height);
+ gtk_widget_show(widget);
+
+ /*
+ * Filter objects in GtkBuilder xml
+ * Unfortunately, GtkFilter is poorly supported by GtkBuilder,
+ * so a lot of the setup must happen in code.
+ SourceFilterAll
+ SourceFilterVideo
+ SourceFilterTS
+ SourceFilterMPG
+ SourceFilterEVO
+ SourceFilterVOB
+ SourceFilterMKV
+ SourceFilterMP4
+ SourceFilterAVI
+ SourceFilterMOV
+ SourceFilterOGG
+ SourceFilterFLV
+ SourceFilterWMV
+ */
+ // Add filters to source chooser
+ GtkFileFilter *filter;
+ GtkFileChooser *chooser;
+ chooser = GTK_FILE_CHOOSER(GHB_WIDGET(ud->builder, "source_dialog"));
+ filter = GTK_FILE_FILTER(GHB_OBJECT(ud->builder, "SourceFilterAll"));
+ gtk_file_filter_set_name(filter, "All");
+ gtk_file_filter_add_pattern(filter, "*");
+ gtk_file_chooser_add_filter(chooser, filter);
+ filter = GTK_FILE_FILTER(GHB_OBJECT(ud->builder, "SourceFilterVideo"));
+ gtk_file_filter_set_name(filter, "Video");
+ gtk_file_filter_add_mime_type(filter, "video/*");
+ gtk_file_chooser_add_filter(chooser, filter);
+ filter = GTK_FILE_FILTER(GHB_OBJECT(ud->builder, "SourceFilterTS"));
+ gtk_file_filter_set_name(filter, "TS");
+ gtk_file_filter_add_pattern(filter, "*.ts");
+ gtk_file_filter_add_pattern(filter, "*.TS");
+ gtk_file_filter_add_pattern(filter, "*.m2ts");
+ gtk_file_filter_add_pattern(filter, "*.M2TS");
+ gtk_file_chooser_add_filter(chooser, filter);
+ filter = GTK_FILE_FILTER(GHB_OBJECT(ud->builder, "SourceFilterMPG"));
+ gtk_file_filter_set_name(filter, "MPG");
+ gtk_file_filter_add_pattern(filter, "*.mpg");
+ gtk_file_filter_add_pattern(filter, "*.MPG");
+ gtk_file_filter_add_pattern(filter, "*.mepg");
+ gtk_file_filter_add_pattern(filter, "*.MEPG");
+ gtk_file_chooser_add_filter(chooser, filter);
+ filter = GTK_FILE_FILTER(GHB_OBJECT(ud->builder, "SourceFilterEVO"));
+ gtk_file_filter_set_name(filter, "EVO");
+ gtk_file_filter_add_pattern(filter, "*.evo");
+ gtk_file_filter_add_pattern(filter, "*.EVO");
+ gtk_file_chooser_add_filter(chooser, filter);
+ filter = GTK_FILE_FILTER(GHB_OBJECT(ud->builder, "SourceFilterVOB"));
+ gtk_file_filter_set_name(filter, "VOB");
+ gtk_file_filter_add_pattern(filter, "*.vob");
+ gtk_file_filter_add_pattern(filter, "*.VOB");
+ gtk_file_chooser_add_filter(chooser, filter);
+ filter = GTK_FILE_FILTER(GHB_OBJECT(ud->builder, "SourceFilterMKV"));
+ gtk_file_filter_set_name(filter, "MKV");
+ gtk_file_filter_add_pattern(filter, "*.mkv");
+ gtk_file_filter_add_pattern(filter, "*.MKV");
+ gtk_file_chooser_add_filter(chooser, filter);
+ filter = GTK_FILE_FILTER(GHB_OBJECT(ud->builder, "SourceFilterMP4"));
+ gtk_file_filter_set_name(filter, "MP4");
+ gtk_file_filter_add_pattern(filter, "*.mp4");
+ gtk_file_filter_add_pattern(filter, "*.MP4");
+ gtk_file_filter_add_pattern(filter, "*.m4v");
+ gtk_file_filter_add_pattern(filter, "*.M4V");
+ gtk_file_chooser_add_filter(chooser, filter);
+ filter = GTK_FILE_FILTER(GHB_OBJECT(ud->builder, "SourceFilterMOV"));
+ gtk_file_filter_set_name(filter, "MOV");
+ gtk_file_filter_add_pattern(filter, "*.mov");
+ gtk_file_filter_add_pattern(filter, "*.MOV");
+ gtk_file_chooser_add_filter(chooser, filter);
+ filter = GTK_FILE_FILTER(GHB_OBJECT(ud->builder, "SourceFilterAVI"));
+ gtk_file_filter_set_name(filter, "AVI");
+ gtk_file_filter_add_pattern(filter, "*.avi");
+ gtk_file_filter_add_pattern(filter, "*.AVI");
+ gtk_file_chooser_add_filter(chooser, filter);
+ filter = GTK_FILE_FILTER(GHB_OBJECT(ud->builder, "SourceFilterOGG"));
+ gtk_file_filter_set_name(filter, "OGG");
+ gtk_file_filter_add_pattern(filter, "*.ogg");
+ gtk_file_filter_add_pattern(filter, "*.OGG");
+ gtk_file_filter_add_pattern(filter, "*.ogv");
+ gtk_file_filter_add_pattern(filter, "*.OGV");
+ gtk_file_filter_add_pattern(filter, "*.ogm");
+ gtk_file_filter_add_pattern(filter, "*.OGM");
+ gtk_file_chooser_add_filter(chooser, filter);
+ filter = GTK_FILE_FILTER(GHB_OBJECT(ud->builder, "SourceFilterFLV"));
+ gtk_file_filter_set_name(filter, "FLV");
+ gtk_file_filter_add_pattern(filter, "*.flv");
+ gtk_file_filter_add_pattern(filter, "*.FLV");
+ gtk_file_chooser_add_filter(chooser, filter);
+ filter = GTK_FILE_FILTER(GHB_OBJECT(ud->builder, "SourceFilterWMV"));
+ gtk_file_filter_set_name(filter, "WMV");
+ gtk_file_filter_add_pattern(filter, "*.wmv");
+ gtk_file_filter_add_pattern(filter, "*.WMV");
+ gtk_file_chooser_add_filter(chooser, filter);
+
+ // Gtk has a really stupid bug. If the file chooser is showing
+ // hidden files AND there is no filter set, it will not select
+ // the filename when gtk_file_chooser_set_filename is called.
+ // So add a completely unnessary filter to prevent this behavior.
+ filter = GTK_FILE_FILTER(GHB_OBJECT(ud->builder, "SourceFilterAll"));
+ gtk_file_chooser_set_filter(chooser, filter);
+
+ PangoFontDescription *font_desc;
+ font_desc = pango_font_description_from_string ("monospace 10");
+ textview = GTK_TEXT_VIEW(GHB_WIDGET (ud->builder, "activity_view"));
+ gtk_widget_modify_font(GTK_WIDGET(textview), font_desc);
+ pango_font_description_free (font_desc);
+
+ // Everything should be go-to-go. Lets rock!
+
+ gtk_main ();
+ gtk_status_icon_set_visible(si, FALSE);
+ ghb_backend_close();
+ if (ud->queue)
+ ghb_value_free(ud->queue);
+ ghb_value_free(ud->settings);
+ g_io_channel_unref(ud->activity_log);
+ ghb_settings_close();
#if !defined(_WIN32)
- notify_uninit();
+ notify_uninit();
#endif
- g_free(ud);
+ g_free(ud);
- return 0;
+ return 0;
}
diff --git a/gtk/src/makedeps.py b/gtk/src/makedeps.py
index 604527a2f..9fecd37fe 100644
--- a/gtk/src/makedeps.py
+++ b/gtk/src/makedeps.py
@@ -5,128 +5,128 @@ import plistlib
DepEntry = collections.namedtuple('DepEntry', 'widget dep enable die hide')
dep_map = (
- DepEntry("title", "queue_add", "none", True, False),
- DepEntry("title", "queue_add_menu", "none", True, False),
- DepEntry("title", "preview_frame", "none", True, False),
- DepEntry("title", "picture_summary", "none", True, False),
- DepEntry("title", "picture_summary2", "none", True, False),
- DepEntry("title", "chapters_label", "none", True, False),
- DepEntry("title", "chapters_tab", "none", True, False),
- DepEntry("title", "start_point", "none", True, False),
- DepEntry("title", "end_point", "none", True, False),
- DepEntry("title", "angle", "none", True, False),
- DepEntry("title", "angle_label", "1", True, False),
- DepEntry("use_dvdnav", "angle", "FALSE", True, True),
- DepEntry("use_dvdnav", "angle_label", "FALSE", True, True),
- DepEntry("angle_count", "angle", "1", True, True),
- DepEntry("angle_count", "angle_label", "1", True, True),
- DepEntry("vquality_type_bitrate", "VideoAvgBitrate", "TRUE", False, False),
- DepEntry("vquality_type_constant", "VideoQualitySlider", "TRUE", False, False),
- DepEntry("vquality_type_constant", "VideoTwoPass", "TRUE", True, False),
- DepEntry("vquality_type_constant", "VideoTurboTwoPass", "TRUE", True, False),
- DepEntry("VideoFramerate", "VideoFrameratePFR", "source", True, True),
- DepEntry("VideoFramerate", "VideoFramerateVFR", "source", False, True),
- DepEntry("VideoTwoPass", "VideoTurboTwoPass", "TRUE", False, False),
- DepEntry("FileFormat", "Mp4LargeFile", "mp4", False, True),
- DepEntry("FileFormat", "Mp4HttpOptimize", "mp4", False, True),
- DepEntry("FileFormat", "Mp4iPodCompatible", "mp4", False, True),
- DepEntry("PictureDecombDeinterlace", "PictureDeinterlace", "TRUE", True, True),
- DepEntry("PictureDecombDeinterlace", "PictureDeinterlaceCustom", "TRUE", True, True),
- DepEntry("PictureDecombDeinterlace", "PictureDeinterlaceLabel", "TRUE", True, True),
- DepEntry("PictureDecombDeinterlace", "PictureDecomb", "FALSE", True, True),
- DepEntry("PictureDecombDeinterlace", "PictureDecombCustom", "FALSE", True, True),
- DepEntry("PictureDecombDeinterlace", "PictureDecombLabel", "FALSE", True, True),
- DepEntry("PictureDeinterlace", "PictureDeinterlaceCustom", "custom", False, True),
- DepEntry("PictureDenoise", "PictureDenoiseCustom", "custom", False, True),
- DepEntry("PictureDecomb", "PictureDecombCustom", "custom", False, True),
- DepEntry("PictureDetelecine", "PictureDetelecineCustom", "custom", False, True),
- DepEntry("PictureWidthEnable", "PictureWidth", "TRUE", False, False),
- DepEntry("PictureHeightEnable", "PictureHeight", "TRUE", False, False),
- DepEntry("PictureAutoCrop", "PictureTopCrop", "FALSE", False, False),
- DepEntry("PictureAutoCrop", "PictureBottomCrop", "FALSE", False, False),
- DepEntry("PictureAutoCrop", "PictureLeftCrop", "FALSE", False, False),
- DepEntry("PictureAutoCrop", "PictureRightCrop", "FALSE", False, False),
- DepEntry("VideoEncoder", "x264_tab", "x264", False, True),
- DepEntry("VideoEncoder", "x264VideoSettings", "x264", False, True),
- DepEntry("VideoEncoder", "lavc_mpeg4_tab", "ffmpeg|ffmpeg4|ffmpeg2", False, True),
- DepEntry("VideoEncoder", "Mp4iPodCompatible", "x264", False, False),
- DepEntry("AudioTrackQualityEnable", "AudioTrackQuality", "FALSE", True, False),
- DepEntry("AudioTrackQualityEnable", "AudioTrackQualityValue", "FALSE", True, False),
- DepEntry("AudioTrackQualityEnable", "AudioBitrateLabel", "TRUE", True, False),
- DepEntry("AudioTrackQualityEnable", "AudioBitrate", "TRUE", True, False),
- DepEntry("AudioEncoderActual", "AudioTrackQualityEnable", "lame|vorbis", False, True),
- DepEntry("AudioEncoderActual", "AudioTrackQuality", "lame|vorbis", False, True),
- DepEntry("AudioEncoderActual", "AudioTrackQualityValue", "lame|vorbis", False, True),
- DepEntry("AudioEncoderActual", "AudioBitrateLabel", "copy:mp3|copy:aac|copy:ac3|copy:dts|copy:dtshd", True, False),
- DepEntry("AudioEncoderActual", "AudioBitrate", "copy:mp3|copy:aac|copy:ac3|copy:dts|copy:dtshd", True, False),
- DepEntry("AudioEncoderActual", "AudioSamplerateLabel", "copy:mp3|copy:aac|copy:ac3|copy:dts|copy:dtshd", True, False),
- DepEntry("AudioEncoderActual", "AudioSamplerate", "copy:mp3|copy:aac|copy:ac3|copy:dts|copy:dtshd", True, False),
- DepEntry("AudioEncoderActual", "AudioMixdownLabel", "copy:mp3|copy:aac|copy:ac3|copy:dts|copy:dtshd", True, False),
- DepEntry("AudioEncoderActual", "AudioMixdown", "copy:mp3|copy:aac|copy:ac3|copy:dts|copy:dtshd", True, False),
- DepEntry("AudioEncoderActual", "AudioTrackDRCSliderLabel", "copy:mp3|copy:aac|copy:ac3|copy:dts|copy:dtshd", True, False),
- DepEntry("AudioEncoderActual", "AudioTrackDRCSlider", "copy:mp3|copy:aac|copy:ac3|copy:dts|copy:dtshd", True, False),
- DepEntry("AudioEncoderActual", "AudioTrackDRCValue", "copy:mp3|copy:aac|copy:ac3|copy:dts|copy:dtshd", True, False),
- DepEntry("AudioEncoderActual", "AudioTrackGainLabel", "copy:mp3|copy:aac|copy:ac3|copy:dts|copy:dtshd", True, False),
- DepEntry("AudioEncoderActual", "AudioTrackGain", "copy:mp3|copy:aac|copy:ac3|copy:dts|copy:dtshd", True, False),
- DepEntry("AudioEncoderActual", "AudioTrackGainValue", "copy:mp3|copy:aac|copy:ac3|copy:dts|copy:dtshd", True, False),
- DepEntry("AudioEncoder", "AudioAllowMP3Pass", "copy", False, False),
- DepEntry("AudioEncoder", "AudioAllowAACPass", "copy", False, False),
- DepEntry("AudioEncoder", "AudioAllowAC3Pass", "copy", False, False),
- DepEntry("AudioEncoder", "AudioAllowDTSPass", "copy", False, False),
- DepEntry("AudioEncoder", "AudioAllowDTSHDPass", "copy", False, False),
- DepEntry("x264_bframes", "x264_bpyramid", "<2", True, False),
- DepEntry("x264_bframes", "x264_direct", "0", True, False),
- DepEntry("x264_bframes", "x264_b_adapt", "0", True, False),
- DepEntry("x264_subme", "x264_psy_rd", "<6", True, False),
- DepEntry("x264_subme", "x264_psy_trell", "<6", True, False),
- DepEntry("x264_trellis", "x264_psy_trell", "0", True, False),
- DepEntry("x264UseAdvancedOptions", "x264VideoSettingsTable", "TRUE", True, False),
- DepEntry("x264UseAdvancedOptions", "x264_tab", "FALSE", True, False),
- DepEntry("HideAdvancedVideoSettings", "x264UseAdvancedOptions", "TRUE", True, True),
- DepEntry("use_source_name", "chapters_in_destination", "TRUE", False, False),
- DepEntry("use_source_name", "title_no_in_destination", "TRUE", False, False),
- )
+ DepEntry("title", "queue_add", "none", True, False),
+ DepEntry("title", "queue_add_menu", "none", True, False),
+ DepEntry("title", "preview_frame", "none", True, False),
+ DepEntry("title", "picture_summary", "none", True, False),
+ DepEntry("title", "picture_summary2", "none", True, False),
+ DepEntry("title", "chapters_label", "none", True, False),
+ DepEntry("title", "chapters_tab", "none", True, False),
+ DepEntry("title", "start_point", "none", True, False),
+ DepEntry("title", "end_point", "none", True, False),
+ DepEntry("title", "angle", "none", True, False),
+ DepEntry("title", "angle_label", "1", True, False),
+ DepEntry("use_dvdnav", "angle", "FALSE", True, True),
+ DepEntry("use_dvdnav", "angle_label", "FALSE", True, True),
+ DepEntry("angle_count", "angle", "1", True, True),
+ DepEntry("angle_count", "angle_label", "1", True, True),
+ DepEntry("vquality_type_bitrate", "VideoAvgBitrate", "TRUE", False, False),
+ DepEntry("vquality_type_constant", "VideoQualitySlider", "TRUE", False, False),
+ DepEntry("vquality_type_constant", "VideoTwoPass", "TRUE", True, False),
+ DepEntry("vquality_type_constant", "VideoTurboTwoPass", "TRUE", True, False),
+ DepEntry("VideoFramerate", "VideoFrameratePFR", "source", True, True),
+ DepEntry("VideoFramerate", "VideoFramerateVFR", "source", False, True),
+ DepEntry("VideoTwoPass", "VideoTurboTwoPass", "TRUE", False, False),
+ DepEntry("FileFormat", "Mp4LargeFile", "mp4", False, True),
+ DepEntry("FileFormat", "Mp4HttpOptimize", "mp4", False, True),
+ DepEntry("FileFormat", "Mp4iPodCompatible", "mp4", False, True),
+ DepEntry("PictureDecombDeinterlace", "PictureDeinterlace", "TRUE", True, True),
+ DepEntry("PictureDecombDeinterlace", "PictureDeinterlaceCustom", "TRUE", True, True),
+ DepEntry("PictureDecombDeinterlace", "PictureDeinterlaceLabel", "TRUE", True, True),
+ DepEntry("PictureDecombDeinterlace", "PictureDecomb", "FALSE", True, True),
+ DepEntry("PictureDecombDeinterlace", "PictureDecombCustom", "FALSE", True, True),
+ DepEntry("PictureDecombDeinterlace", "PictureDecombLabel", "FALSE", True, True),
+ DepEntry("PictureDeinterlace", "PictureDeinterlaceCustom", "custom", False, True),
+ DepEntry("PictureDenoise", "PictureDenoiseCustom", "custom", False, True),
+ DepEntry("PictureDecomb", "PictureDecombCustom", "custom", False, True),
+ DepEntry("PictureDetelecine", "PictureDetelecineCustom", "custom", False, True),
+ DepEntry("PictureWidthEnable", "PictureWidth", "TRUE", False, False),
+ DepEntry("PictureHeightEnable", "PictureHeight", "TRUE", False, False),
+ DepEntry("PictureAutoCrop", "PictureTopCrop", "FALSE", False, False),
+ DepEntry("PictureAutoCrop", "PictureBottomCrop", "FALSE", False, False),
+ DepEntry("PictureAutoCrop", "PictureLeftCrop", "FALSE", False, False),
+ DepEntry("PictureAutoCrop", "PictureRightCrop", "FALSE", False, False),
+ DepEntry("VideoEncoder", "x264_tab", "x264", False, True),
+ DepEntry("VideoEncoder", "x264VideoSettings", "x264", False, True),
+ DepEntry("VideoEncoder", "lavc_mpeg4_tab", "ffmpeg|ffmpeg4|ffmpeg2", False, True),
+ DepEntry("VideoEncoder", "Mp4iPodCompatible", "x264", False, False),
+ DepEntry("AudioTrackQualityEnable", "AudioTrackQuality", "FALSE", True, False),
+ DepEntry("AudioTrackQualityEnable", "AudioTrackQualityValue", "FALSE", True, False),
+ DepEntry("AudioTrackQualityEnable", "AudioBitrateLabel", "TRUE", True, False),
+ DepEntry("AudioTrackQualityEnable", "AudioBitrate", "TRUE", True, False),
+ DepEntry("AudioEncoderActual", "AudioTrackQualityEnable", "lame|vorbis", False, True),
+ DepEntry("AudioEncoderActual", "AudioTrackQuality", "lame|vorbis", False, True),
+ DepEntry("AudioEncoderActual", "AudioTrackQualityValue", "lame|vorbis", False, True),
+ DepEntry("AudioEncoderActual", "AudioBitrateLabel", "copy:mp3|copy:aac|copy:ac3|copy:dts|copy:dtshd", True, False),
+ DepEntry("AudioEncoderActual", "AudioBitrate", "copy:mp3|copy:aac|copy:ac3|copy:dts|copy:dtshd", True, False),
+ DepEntry("AudioEncoderActual", "AudioSamplerateLabel", "copy:mp3|copy:aac|copy:ac3|copy:dts|copy:dtshd", True, False),
+ DepEntry("AudioEncoderActual", "AudioSamplerate", "copy:mp3|copy:aac|copy:ac3|copy:dts|copy:dtshd", True, False),
+ DepEntry("AudioEncoderActual", "AudioMixdownLabel", "copy:mp3|copy:aac|copy:ac3|copy:dts|copy:dtshd", True, False),
+ DepEntry("AudioEncoderActual", "AudioMixdown", "copy:mp3|copy:aac|copy:ac3|copy:dts|copy:dtshd", True, False),
+ DepEntry("AudioEncoderActual", "AudioTrackDRCSliderLabel", "copy:mp3|copy:aac|copy:ac3|copy:dts|copy:dtshd", True, False),
+ DepEntry("AudioEncoderActual", "AudioTrackDRCSlider", "copy:mp3|copy:aac|copy:ac3|copy:dts|copy:dtshd", True, False),
+ DepEntry("AudioEncoderActual", "AudioTrackDRCValue", "copy:mp3|copy:aac|copy:ac3|copy:dts|copy:dtshd", True, False),
+ DepEntry("AudioEncoderActual", "AudioTrackGainLabel", "copy:mp3|copy:aac|copy:ac3|copy:dts|copy:dtshd", True, False),
+ DepEntry("AudioEncoderActual", "AudioTrackGain", "copy:mp3|copy:aac|copy:ac3|copy:dts|copy:dtshd", True, False),
+ DepEntry("AudioEncoderActual", "AudioTrackGainValue", "copy:mp3|copy:aac|copy:ac3|copy:dts|copy:dtshd", True, False),
+ DepEntry("AudioEncoder", "AudioAllowMP3Pass", "copy", False, False),
+ DepEntry("AudioEncoder", "AudioAllowAACPass", "copy", False, False),
+ DepEntry("AudioEncoder", "AudioAllowAC3Pass", "copy", False, False),
+ DepEntry("AudioEncoder", "AudioAllowDTSPass", "copy", False, False),
+ DepEntry("AudioEncoder", "AudioAllowDTSHDPass", "copy", False, False),
+ DepEntry("x264_bframes", "x264_bpyramid", "<2", True, False),
+ DepEntry("x264_bframes", "x264_direct", "0", True, False),
+ DepEntry("x264_bframes", "x264_b_adapt", "0", True, False),
+ DepEntry("x264_subme", "x264_psy_rd", "<6", True, False),
+ DepEntry("x264_subme", "x264_psy_trell", "<6", True, False),
+ DepEntry("x264_trellis", "x264_psy_trell", "0", True, False),
+ DepEntry("x264UseAdvancedOptions", "x264VideoSettingsTable", "TRUE", True, False),
+ DepEntry("x264UseAdvancedOptions", "x264_tab", "FALSE", True, False),
+ DepEntry("HideAdvancedVideoSettings", "x264UseAdvancedOptions", "TRUE", True, True),
+ DepEntry("use_source_name", "chapters_in_destination", "TRUE", False, False),
+ DepEntry("use_source_name", "title_no_in_destination", "TRUE", False, False),
+ )
def main():
- try:
- depsfile = open("widget.deps", "w")
- except Exception, err:
- print >> sys.stderr, ( "Error: %s" % str(err) )
- sys.exit(1)
+ try:
+ depsfile = open("widget.deps", "w")
+ except Exception, err:
+ print >> sys.stderr, ( "Error: %s" % str(err) )
+ sys.exit(1)
- try:
- revfile = open("widget_reverse.deps", "w")
- except Exception, err:
- print >> sys.stderr, ( "Error: %s" % str(err))
- sys.exit(1)
+ try:
+ revfile = open("widget_reverse.deps", "w")
+ except Exception, err:
+ print >> sys.stderr, ( "Error: %s" % str(err))
+ sys.exit(1)
- top = dict()
- for ii in dep_map:
- if ii.widget in top:
- continue
- deps = list()
- for jj in dep_map:
- if jj.widget == ii.widget:
- deps.append(jj.dep)
- top[ii.widget] = deps
- plistlib.writePlist(top, depsfile)
+ top = dict()
+ for ii in dep_map:
+ if ii.widget in top:
+ continue
+ deps = list()
+ for jj in dep_map:
+ if jj.widget == ii.widget:
+ deps.append(jj.dep)
+ top[ii.widget] = deps
+ plistlib.writePlist(top, depsfile)
- top = dict()
- for ii in dep_map:
- if ii.dep in top:
- continue
- deps = list()
- for jj in dep_map:
- if ii.dep == jj.dep:
- rec = list()
- rec.append(jj.widget)
- rec.append(jj.enable)
- rec.append(jj.die)
- rec.append(jj.hide)
- deps.append(rec)
- top[ii.dep] = deps
- plistlib.writePlist(top, revfile)
-
+ top = dict()
+ for ii in dep_map:
+ if ii.dep in top:
+ continue
+ deps = list()
+ for jj in dep_map:
+ if ii.dep == jj.dep:
+ rec = list()
+ rec.append(jj.widget)
+ rec.append(jj.enable)
+ rec.append(jj.die)
+ rec.append(jj.hide)
+ deps.append(rec)
+ top[ii.dep] = deps
+ plistlib.writePlist(top, revfile)
+
main()
diff --git a/gtk/src/marshalers.c b/gtk/src/marshalers.c
index 832c98cfc..39c6d363b 100644
--- a/gtk/src/marshalers.c
+++ b/gtk/src/marshalers.c
@@ -1,5 +1,5 @@
-#include <glib-object.h>
+#include <glib-object.h>
#ifdef G_ENABLE_DEBUG
diff --git a/gtk/src/marshalers.h b/gtk/src/marshalers.h
index 3c93a4957..0eec752f9 100644
--- a/gtk/src/marshalers.h
+++ b/gtk/src/marshalers.h
@@ -2,12 +2,12 @@
#ifndef __ghb_marshal_MARSHAL_H__
#define __ghb_marshal_MARSHAL_H__
-#include <glib-object.h>
+#include <glib-object.h>
G_BEGIN_DECLS
/* VOID:STRING (/home/jstebbins/Source/hb/HandBrake/build.dbg/../gtk/src/marshalers.list:1) */
-#define ghb_marshal_VOID__STRING g_cclosure_marshal_VOID__STRING
+#define ghb_marshal_VOID__STRING g_cclosure_marshal_VOID__STRING
/* VOID:STRING,STRING (/home/jstebbins/Source/hb/HandBrake/build.dbg/../gtk/src/marshalers.list:2) */
extern void ghb_marshal_VOID__STRING_STRING (GClosure *closure,
diff --git a/gtk/src/plist.c b/gtk/src/plist.c
index 05d6fdd8e..61e9d263e 100644
--- a/gtk/src/plist.c
+++ b/gtk/src/plist.c
@@ -9,575 +9,575 @@
#include "plist.h"
#include "values.h"
-#define BUF_SZ (128*1024)
+#define BUF_SZ (128*1024)
static gchar *preamble =
- "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
- "<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n"
- "<plist version=\"1.0\">\n";
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+ "<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n"
+ "<plist version=\"1.0\">\n";
static gchar *postfix =
- "</plist>\n";
+ "</plist>\n";
enum
{
- P_NONE = 0,
- P_PLIST,
- P_KEY,
- P_ARRAY,
- P_DICT,
- P_INTEGER,
- P_REAL,
- P_STRING,
- P_DATE,
- P_TRUE,
- P_FALSE,
- P_DATA,
+ P_NONE = 0,
+ P_PLIST,
+ P_KEY,
+ P_ARRAY,
+ P_DICT,
+ P_INTEGER,
+ P_REAL,
+ P_STRING,
+ P_DATE,
+ P_TRUE,
+ P_FALSE,
+ P_DATA,
};
typedef struct
{
- gchar *tag;
- gint id;
+ gchar *tag;
+ gint id;
} tag_map_t;
static tag_map_t tag_map[] =
{
- {"plist", P_PLIST},
- {"key", P_KEY},
- {"array", P_ARRAY},
- {"dict", P_DICT},
- {"integer", P_INTEGER},
- {"real", P_REAL},
- {"string", P_STRING},
- {"date", P_DATE},
- {"true", P_TRUE},
- {"false", P_FALSE},
- {"data", P_DATA},
+ {"plist", P_PLIST},
+ {"key", P_KEY},
+ {"array", P_ARRAY},
+ {"dict", P_DICT},
+ {"integer", P_INTEGER},
+ {"real", P_REAL},
+ {"string", P_STRING},
+ {"date", P_DATE},
+ {"true", P_TRUE},
+ {"false", P_FALSE},
+ {"data", P_DATA},
};
-#define TAG_MAP_SZ (sizeof(tag_map)/sizeof(tag_map_t))
+#define TAG_MAP_SZ (sizeof(tag_map)/sizeof(tag_map_t))
typedef struct
{
- gchar *key;
- gchar *value;
- GValue *plist;
- GQueue *stack;
- GQueue *tag_stack;
- gboolean closed_top;
+ gchar *key;
+ gchar *value;
+ GValue *plist;
+ GQueue *stack;
+ GQueue *tag_stack;
+ gboolean closed_top;
} parse_data_t;
static void
start_element(
- GMarkupParseContext *ctx,
- const gchar *name,
- const gchar **attr_names,
- const gchar **attr_values,
- gpointer ud,
- GError **error)
+ GMarkupParseContext *ctx,
+ const gchar *name,
+ const gchar **attr_names,
+ const gchar **attr_values,
+ gpointer ud,
+ GError **error)
{
- parse_data_t *pd = (parse_data_t*)ud;
- union
- {
- gint id;
- gpointer pid;
- } id;
- gint ii;
-
- // Check to see if the first element found has been closed
- // If so, ignore any junk following it.
- if (pd->closed_top)
- return;
-
- for (ii = 0; ii < TAG_MAP_SZ; ii++)
- {
- if (strcmp(name, tag_map[ii].tag) == 0)
- {
- id.id = tag_map[ii].id;
- break;
- }
- }
- if (ii == TAG_MAP_SZ)
- {
- g_warning("Unrecognized start tag (%s)", name);
- return;
- }
- g_queue_push_head(pd->tag_stack, id.pid);
- GType gtype = 0;
- GValue *gval = NULL;
- GValue *current = g_queue_peek_head(pd->stack);
- switch (id.id)
- {
- case P_PLIST:
- { // Ignore
- } break;
- case P_KEY:
- {
- if (pd->key) g_free(pd->key);
- pd->key = NULL;
- } break;
- case P_DICT:
- {
- gval = ghb_dict_value_new();
- g_queue_push_head(pd->stack, gval);
- } break;
- case P_ARRAY:
- {
- gval = ghb_array_value_new(128);
- g_queue_push_head(pd->stack, gval);
- } break;
- case P_INTEGER:
- {
- } break;
- case P_REAL:
- {
- } break;
- case P_STRING:
- {
- } break;
- case P_DATE:
- {
- } break;
- case P_TRUE:
- {
- } break;
- case P_FALSE:
- {
- } break;
- case P_DATA:
- {
- } break;
- }
- // Add the element to the current container
- if (gval)
- { // There's an element to add
- if (current == NULL)
- {
- pd->plist = gval;
- return;
- }
- gtype = G_VALUE_TYPE(current);
- if (gtype == ghb_array_get_type())
- {
- ghb_array_append(current, gval);
- }
- else if (gtype == ghb_dict_get_type())
- {
- if (pd->key == NULL)
- {
- g_warning("No key for dictionary item");
- ghb_value_free(gval);
- }
- else
- {
- ghb_dict_insert(current, g_strdup(pd->key), gval);
- }
- }
- else
- {
- g_error("Invalid container type. This shouldn't happen");
- }
- }
+ parse_data_t *pd = (parse_data_t*)ud;
+ union
+ {
+ gint id;
+ gpointer pid;
+ } id;
+ gint ii;
+
+ // Check to see if the first element found has been closed
+ // If so, ignore any junk following it.
+ if (pd->closed_top)
+ return;
+
+ for (ii = 0; ii < TAG_MAP_SZ; ii++)
+ {
+ if (strcmp(name, tag_map[ii].tag) == 0)
+ {
+ id.id = tag_map[ii].id;
+ break;
+ }
+ }
+ if (ii == TAG_MAP_SZ)
+ {
+ g_warning("Unrecognized start tag (%s)", name);
+ return;
+ }
+ g_queue_push_head(pd->tag_stack, id.pid);
+ GType gtype = 0;
+ GValue *gval = NULL;
+ GValue *current = g_queue_peek_head(pd->stack);
+ switch (id.id)
+ {
+ case P_PLIST:
+ { // Ignore
+ } break;
+ case P_KEY:
+ {
+ if (pd->key) g_free(pd->key);
+ pd->key = NULL;
+ } break;
+ case P_DICT:
+ {
+ gval = ghb_dict_value_new();
+ g_queue_push_head(pd->stack, gval);
+ } break;
+ case P_ARRAY:
+ {
+ gval = ghb_array_value_new(128);
+ g_queue_push_head(pd->stack, gval);
+ } break;
+ case P_INTEGER:
+ {
+ } break;
+ case P_REAL:
+ {
+ } break;
+ case P_STRING:
+ {
+ } break;
+ case P_DATE:
+ {
+ } break;
+ case P_TRUE:
+ {
+ } break;
+ case P_FALSE:
+ {
+ } break;
+ case P_DATA:
+ {
+ } break;
+ }
+ // Add the element to the current container
+ if (gval)
+ { // There's an element to add
+ if (current == NULL)
+ {
+ pd->plist = gval;
+ return;
+ }
+ gtype = G_VALUE_TYPE(current);
+ if (gtype == ghb_array_get_type())
+ {
+ ghb_array_append(current, gval);
+ }
+ else if (gtype == ghb_dict_get_type())
+ {
+ if (pd->key == NULL)
+ {
+ g_warning("No key for dictionary item");
+ ghb_value_free(gval);
+ }
+ else
+ {
+ ghb_dict_insert(current, g_strdup(pd->key), gval);
+ }
+ }
+ else
+ {
+ g_error("Invalid container type. This shouldn't happen");
+ }
+ }
}
static void
end_element(
- GMarkupParseContext *ctx,
- const gchar *name,
- gpointer ud,
- GError **error)
+ GMarkupParseContext *ctx,
+ const gchar *name,
+ gpointer ud,
+ GError **error)
{
- parse_data_t *pd = (parse_data_t*)ud;
- gint id;
- union
- {
- gint id;
- gpointer pid;
- } start_id;
- gint ii;
-
- // Check to see if the first element found has been closed
- // If so, ignore any junk following it.
- if (pd->closed_top)
- return;
-
- for (ii = 0; ii < TAG_MAP_SZ; ii++)
- {
- if (strcmp(name, tag_map[ii].tag) == 0)
- {
- id = tag_map[ii].id;
- break;
- }
- }
- if (ii == TAG_MAP_SZ)
- {
- g_warning("Unrecognized start tag (%s)", name);
- return;
- }
- start_id.pid = g_queue_pop_head(pd->tag_stack);
- if (start_id.id != id)
- g_warning("start tag != end tag: (%s %d) %d", name, id, id);
-
- GValue *gval = NULL;
- GValue *current = g_queue_peek_head(pd->stack);
- GType gtype = 0;
- switch (id)
- {
- case P_PLIST:
- { // Ignore
- } break;
- case P_KEY:
- {
- if (pd->key) g_free(pd->key);
- pd->key = g_strdup(pd->value);
- return;
- } break;
- case P_DICT:
- {
- g_queue_pop_head(pd->stack);
- } break;
- case P_ARRAY:
- {
- g_queue_pop_head(pd->stack);
- } break;
- case P_INTEGER:
- {
- gint64 val = g_strtod(pd->value, NULL);
- gval = ghb_int64_value_new(val);
- } break;
- case P_REAL:
- {
- gdouble val = g_strtod(pd->value, NULL);
- gval = ghb_double_value_new(val);
- } break;
- case P_STRING:
- {
- gval = ghb_string_value_new(pd->value);
- } break;
- case P_DATE:
- {
- GDate date;
- GTimeVal time;
- g_time_val_from_iso8601(pd->value, &time);
- g_date_set_time_val(&date, &time);
- gval = ghb_date_value_new(&date);
- } break;
- case P_TRUE:
- {
- gval = ghb_boolean_value_new(TRUE);
- } break;
- case P_FALSE:
- {
- gval = ghb_boolean_value_new(FALSE);
- } break;
- case P_DATA:
- {
- ghb_rawdata_t *data;
- data = g_malloc(sizeof(ghb_rawdata_t));
- data->data = g_base64_decode(pd->value, &(data->size));
- gval = ghb_rawdata_value_new(data);
- } break;
- }
- if (gval)
- {
- // Get the top of the data structure stack and if it's an array
- // or dict, add the current element
- if (current == NULL)
- {
- pd->plist = gval;
- pd->closed_top = TRUE;
- return;
- }
- gtype = G_VALUE_TYPE(current);
- if (gtype == ghb_array_get_type())
- {
- ghb_array_append(current, gval);
- }
- else if (gtype == ghb_dict_get_type())
- {
- if (pd->key == NULL)
- {
- g_warning("No key for dictionary item");
- ghb_value_free(gval);
- }
- else
- {
- ghb_dict_insert(current, g_strdup(pd->key), gval);
- }
- }
- else
- {
- g_error("Invalid container type. This shouldn't happen");
- }
- }
- if (g_queue_is_empty(pd->stack))
- pd->closed_top = TRUE;
+ parse_data_t *pd = (parse_data_t*)ud;
+ gint id;
+ union
+ {
+ gint id;
+ gpointer pid;
+ } start_id;
+ gint ii;
+
+ // Check to see if the first element found has been closed
+ // If so, ignore any junk following it.
+ if (pd->closed_top)
+ return;
+
+ for (ii = 0; ii < TAG_MAP_SZ; ii++)
+ {
+ if (strcmp(name, tag_map[ii].tag) == 0)
+ {
+ id = tag_map[ii].id;
+ break;
+ }
+ }
+ if (ii == TAG_MAP_SZ)
+ {
+ g_warning("Unrecognized start tag (%s)", name);
+ return;
+ }
+ start_id.pid = g_queue_pop_head(pd->tag_stack);
+ if (start_id.id != id)
+ g_warning("start tag != end tag: (%s %d) %d", name, id, id);
+
+ GValue *gval = NULL;
+ GValue *current = g_queue_peek_head(pd->stack);
+ GType gtype = 0;
+ switch (id)
+ {
+ case P_PLIST:
+ { // Ignore
+ } break;
+ case P_KEY:
+ {
+ if (pd->key) g_free(pd->key);
+ pd->key = g_strdup(pd->value);
+ return;
+ } break;
+ case P_DICT:
+ {
+ g_queue_pop_head(pd->stack);
+ } break;
+ case P_ARRAY:
+ {
+ g_queue_pop_head(pd->stack);
+ } break;
+ case P_INTEGER:
+ {
+ gint64 val = g_strtod(pd->value, NULL);
+ gval = ghb_int64_value_new(val);
+ } break;
+ case P_REAL:
+ {
+ gdouble val = g_strtod(pd->value, NULL);
+ gval = ghb_double_value_new(val);
+ } break;
+ case P_STRING:
+ {
+ gval = ghb_string_value_new(pd->value);
+ } break;
+ case P_DATE:
+ {
+ GDate date;
+ GTimeVal time;
+ g_time_val_from_iso8601(pd->value, &time);
+ g_date_set_time_val(&date, &time);
+ gval = ghb_date_value_new(&date);
+ } break;
+ case P_TRUE:
+ {
+ gval = ghb_boolean_value_new(TRUE);
+ } break;
+ case P_FALSE:
+ {
+ gval = ghb_boolean_value_new(FALSE);
+ } break;
+ case P_DATA:
+ {
+ ghb_rawdata_t *data;
+ data = g_malloc(sizeof(ghb_rawdata_t));
+ data->data = g_base64_decode(pd->value, &(data->size));
+ gval = ghb_rawdata_value_new(data);
+ } break;
+ }
+ if (gval)
+ {
+ // Get the top of the data structure stack and if it's an array
+ // or dict, add the current element
+ if (current == NULL)
+ {
+ pd->plist = gval;
+ pd->closed_top = TRUE;
+ return;
+ }
+ gtype = G_VALUE_TYPE(current);
+ if (gtype == ghb_array_get_type())
+ {
+ ghb_array_append(current, gval);
+ }
+ else if (gtype == ghb_dict_get_type())
+ {
+ if (pd->key == NULL)
+ {
+ g_warning("No key for dictionary item");
+ ghb_value_free(gval);
+ }
+ else
+ {
+ ghb_dict_insert(current, g_strdup(pd->key), gval);
+ }
+ }
+ else
+ {
+ g_error("Invalid container type. This shouldn't happen");
+ }
+ }
+ if (g_queue_is_empty(pd->stack))
+ pd->closed_top = TRUE;
}
static void
text_data(
- GMarkupParseContext *ctx,
- const gchar *text,
- gsize len,
- gpointer ud,
- GError **error)
+ GMarkupParseContext *ctx,
+ const gchar *text,
+ gsize len,
+ gpointer ud,
+ GError **error)
{
- parse_data_t *pd = (parse_data_t*)ud;
- if (pd->value) g_free(pd->value);
- pd->value = g_strdup(text);
+ parse_data_t *pd = (parse_data_t*)ud;
+ if (pd->value) g_free(pd->value);
+ pd->value = g_strdup(text);
}
static void
passthrough(
- GMarkupParseContext *ctx,
- const gchar *text,
- gsize len,
- gpointer ud,
- GError **error)
+ GMarkupParseContext *ctx,
+ const gchar *text,
+ gsize len,
+ gpointer ud,
+ GError **error)
{
- //parse_data_t *pd = (parse_data_t*)ud;
+ //parse_data_t *pd = (parse_data_t*)ud;
- //g_debug("passthrough %s", text);
+ //g_debug("passthrough %s", text);
}
static void
parse_error(GMarkupParseContext *ctx, GError *error, gpointer ud)
{
- g_warning("Plist parse error: %s", error->message);
+ g_warning("Plist parse error: %s", error->message);
}
// This is required or the parser crashes
static void
destroy_notify(gpointer data)
{ // Do nothing
- //g_debug("destroy parser");
+ //g_debug("destroy parser");
}
GValue*
ghb_plist_parse(const gchar *buf, gssize len)
{
- GMarkupParseContext *ctx;
- GMarkupParser parser;
- parse_data_t pd;
- GError *err = NULL;
-
- pd.stack = g_queue_new();
- pd.tag_stack = g_queue_new();
- pd.key = NULL;
- pd.value = NULL;
- pd.plist = NULL;
- pd.closed_top = FALSE;
-
- parser.start_element = start_element;
- parser.end_element = end_element;
- parser.text = text_data;
- parser.passthrough = passthrough;
- parser.error = parse_error;
- ctx = g_markup_parse_context_new(&parser, 0, &pd, destroy_notify);
-
- g_markup_parse_context_parse(ctx, buf, len, &err);
- g_markup_parse_context_end_parse(ctx, &err);
- g_markup_parse_context_free(ctx);
- if (pd.key) g_free(pd.key);
- if (pd.value) g_free(pd.value);
- g_queue_free(pd.stack);
- g_queue_free(pd.tag_stack);
- return pd.plist;
+ GMarkupParseContext *ctx;
+ GMarkupParser parser;
+ parse_data_t pd;
+ GError *err = NULL;
+
+ pd.stack = g_queue_new();
+ pd.tag_stack = g_queue_new();
+ pd.key = NULL;
+ pd.value = NULL;
+ pd.plist = NULL;
+ pd.closed_top = FALSE;
+
+ parser.start_element = start_element;
+ parser.end_element = end_element;
+ parser.text = text_data;
+ parser.passthrough = passthrough;
+ parser.error = parse_error;
+ ctx = g_markup_parse_context_new(&parser, 0, &pd, destroy_notify);
+
+ g_markup_parse_context_parse(ctx, buf, len, &err);
+ g_markup_parse_context_end_parse(ctx, &err);
+ g_markup_parse_context_free(ctx);
+ if (pd.key) g_free(pd.key);
+ if (pd.value) g_free(pd.value);
+ g_queue_free(pd.stack);
+ g_queue_free(pd.tag_stack);
+ return pd.plist;
}
GValue*
ghb_plist_parse_file(const gchar *filename)
{
- gchar *buffer;
- size_t size;
- GValue *gval;
- FILE *fd;
-
- fd = g_fopen(filename, "r");
- if (fd == NULL)
- {
- g_warning("Plist parse: failed to open %s", filename);
- return NULL;
- }
- fseek(fd, 0, SEEK_END);
- size = ftell(fd);
- fseek(fd, 0, SEEK_SET);
- buffer = g_malloc(size+1);
- size = fread(buffer, 1, size, fd);
- buffer[size] = 0;
- gval = ghb_plist_parse(buffer, (gssize)size);
- g_free(buffer);
- fclose(fd);
- return gval;
+ gchar *buffer;
+ size_t size;
+ GValue *gval;
+ FILE *fd;
+
+ fd = g_fopen(filename, "r");
+ if (fd == NULL)
+ {
+ g_warning("Plist parse: failed to open %s", filename);
+ return NULL;
+ }
+ fseek(fd, 0, SEEK_END);
+ size = ftell(fd);
+ fseek(fd, 0, SEEK_SET);
+ buffer = g_malloc(size+1);
+ size = fread(buffer, 1, size, fd);
+ buffer[size] = 0;
+ gval = ghb_plist_parse(buffer, (gssize)size);
+ g_free(buffer);
+ fclose(fd);
+ return gval;
}
static void
indent_fprintf(FILE *file, gint indent, const gchar *fmt, ...)
{
- va_list ap;
+ va_list ap;
- for (; indent; indent--)
- putc('\t', file);
- va_start(ap, fmt);
- vfprintf(file, fmt, ap);
- va_end(ap);
+ for (; indent; indent--)
+ putc('\t', file);
+ va_start(ap, fmt);
+ vfprintf(file, fmt, ap);
+ va_end(ap);
}
// Used for sorting dictionaries.
static gint
key_cmp(gconstpointer a, gconstpointer b)
{
- gchar *stra = (gchar*)a;
- gchar *strb = (gchar*)b;
+ gchar *stra = (gchar*)a;
+ gchar *strb = (gchar*)b;
- return strcmp(stra, strb);
+ return strcmp(stra, strb);
}
static void
gval_write(FILE *file, GValue *gval)
{
- static gint indent = 0;
- gint ii;
- GType gtype;
-
- if (gval == NULL) return;
- gtype = G_VALUE_TYPE(gval);
- if (gtype == ghb_array_get_type())
- {
- GValue *val;
- gint count;
-
- indent_fprintf(file, indent, "<array>\n");
- indent++;
- count = ghb_array_len(gval);
- for (ii = 0; ii < count; ii++)
- {
- val = ghb_array_get_nth(gval, ii);
- gval_write(file, val);
- }
- indent--;
- indent_fprintf(file, indent, "</array>\n");
- }
- else if (gtype == ghb_dict_get_type())
- {
- GValue *val;
- GHashTable *dict = g_value_get_boxed(gval);
- GList *link, *keys;
- keys = g_hash_table_get_keys(dict);
- // Sort the dictionary. Not really necessray, but it makes
- // finding things easier
- keys = g_list_sort(keys, key_cmp);
- link = keys;
- indent_fprintf(file, indent, "<dict>\n");
- indent++;
- while (link)
- {
- gchar *key = (gchar*)link->data;
- val = g_hash_table_lookup(dict, key);
- indent_fprintf(file, indent, "<key>%s</key>\n", key);
- gval_write(file, val);
- link = link->next;
- }
- indent--;
- indent_fprintf(file, indent, "</dict>\n");
- g_list_free(keys);
- }
- else if (gtype == G_TYPE_BOOLEAN)
- {
- gchar *tag;
- if (g_value_get_boolean(gval))
- {
- tag = "true";
- }
- else
- {
- tag = "false";
- }
- indent_fprintf(file, indent, "<%s />\n", tag);
- }
- else if (gtype == g_date_get_type())
- {
- GDate *date;
- date = g_value_get_boxed(gval);
- indent_fprintf(file, indent, "<date>%d-%d-%d</date>\n",
- g_date_get_year(date),
- g_date_get_month(date),
- g_date_get_day(date)
- );
- }
- else if (gtype == ghb_rawdata_get_type())
- {
- ghb_rawdata_t *data;
- gchar *base64;
- data = g_value_get_boxed(gval);
- base64 = g_base64_encode(data->data, data->size);
- indent_fprintf(file, indent, "<data>\n");
- indent_fprintf(file, 0, "%s\n", base64);
- indent_fprintf(file, indent, "</data>\n");
- g_free(base64);
- }
- else if (gtype == G_TYPE_DOUBLE)
- {
- gdouble val = g_value_get_double(gval);
- indent_fprintf(file, indent, "<real>%.17g</real>\n", val);
- }
- else if (gtype == G_TYPE_INT64)
- {
- gint val = g_value_get_int64(gval);
- indent_fprintf(file, indent, "<integer>%d</integer>\n", val);
- }
- else if (gtype == G_TYPE_INT)
- {
- gint val = g_value_get_int(gval);
- indent_fprintf(file, indent, "<integer>%d</integer>\n", val);
- }
- else if (gtype == G_TYPE_STRING)
- {
- const gchar *str = g_value_get_string(gval);
- gchar *esc = g_markup_escape_text(str, -1);
- indent_fprintf(file, indent, "<string>%s</string>\n", esc);
- g_free(esc);
- }
- else
- {
- // Try to make anything thats unrecognized into a string
- const gchar *str;
- GValue val = {0,};
- g_value_init(&val, G_TYPE_STRING);
- if (g_value_transform(gval, &val))
- {
- str = g_value_get_string(&val);
- gchar *esc = g_markup_escape_text(str, -1);
- indent_fprintf(file, indent, "<string>%s</string>\n", esc);
- g_free(esc);
- }
- else
- {
- g_message("failed to transform");
- }
- g_value_unset(&val);
- }
+ static gint indent = 0;
+ gint ii;
+ GType gtype;
+
+ if (gval == NULL) return;
+ gtype = G_VALUE_TYPE(gval);
+ if (gtype == ghb_array_get_type())
+ {
+ GValue *val;
+ gint count;
+
+ indent_fprintf(file, indent, "<array>\n");
+ indent++;
+ count = ghb_array_len(gval);
+ for (ii = 0; ii < count; ii++)
+ {
+ val = ghb_array_get_nth(gval, ii);
+ gval_write(file, val);
+ }
+ indent--;
+ indent_fprintf(file, indent, "</array>\n");
+ }
+ else if (gtype == ghb_dict_get_type())
+ {
+ GValue *val;
+ GHashTable *dict = g_value_get_boxed(gval);
+ GList *link, *keys;
+ keys = g_hash_table_get_keys(dict);
+ // Sort the dictionary. Not really necessray, but it makes
+ // finding things easier
+ keys = g_list_sort(keys, key_cmp);
+ link = keys;
+ indent_fprintf(file, indent, "<dict>\n");
+ indent++;
+ while (link)
+ {
+ gchar *key = (gchar*)link->data;
+ val = g_hash_table_lookup(dict, key);
+ indent_fprintf(file, indent, "<key>%s</key>\n", key);
+ gval_write(file, val);
+ link = link->next;
+ }
+ indent--;
+ indent_fprintf(file, indent, "</dict>\n");
+ g_list_free(keys);
+ }
+ else if (gtype == G_TYPE_BOOLEAN)
+ {
+ gchar *tag;
+ if (g_value_get_boolean(gval))
+ {
+ tag = "true";
+ }
+ else
+ {
+ tag = "false";
+ }
+ indent_fprintf(file, indent, "<%s />\n", tag);
+ }
+ else if (gtype == g_date_get_type())
+ {
+ GDate *date;
+ date = g_value_get_boxed(gval);
+ indent_fprintf(file, indent, "<date>%d-%d-%d</date>\n",
+ g_date_get_year(date),
+ g_date_get_month(date),
+ g_date_get_day(date)
+ );
+ }
+ else if (gtype == ghb_rawdata_get_type())
+ {
+ ghb_rawdata_t *data;
+ gchar *base64;
+ data = g_value_get_boxed(gval);
+ base64 = g_base64_encode(data->data, data->size);
+ indent_fprintf(file, indent, "<data>\n");
+ indent_fprintf(file, 0, "%s\n", base64);
+ indent_fprintf(file, indent, "</data>\n");
+ g_free(base64);
+ }
+ else if (gtype == G_TYPE_DOUBLE)
+ {
+ gdouble val = g_value_get_double(gval);
+ indent_fprintf(file, indent, "<real>%.17g</real>\n", val);
+ }
+ else if (gtype == G_TYPE_INT64)
+ {
+ gint val = g_value_get_int64(gval);
+ indent_fprintf(file, indent, "<integer>%d</integer>\n", val);
+ }
+ else if (gtype == G_TYPE_INT)
+ {
+ gint val = g_value_get_int(gval);
+ indent_fprintf(file, indent, "<integer>%d</integer>\n", val);
+ }
+ else if (gtype == G_TYPE_STRING)
+ {
+ const gchar *str = g_value_get_string(gval);
+ gchar *esc = g_markup_escape_text(str, -1);
+ indent_fprintf(file, indent, "<string>%s</string>\n", esc);
+ g_free(esc);
+ }
+ else
+ {
+ // Try to make anything thats unrecognized into a string
+ const gchar *str;
+ GValue val = {0,};
+ g_value_init(&val, G_TYPE_STRING);
+ if (g_value_transform(gval, &val))
+ {
+ str = g_value_get_string(&val);
+ gchar *esc = g_markup_escape_text(str, -1);
+ indent_fprintf(file, indent, "<string>%s</string>\n", esc);
+ g_free(esc);
+ }
+ else
+ {
+ g_message("failed to transform");
+ }
+ g_value_unset(&val);
+ }
}
void
ghb_plist_write(FILE *file, GValue *gval)
{
- fprintf(file, "%s", preamble);
- gval_write(file, gval);
- fprintf(file, "%s", postfix);
+ fprintf(file, "%s", preamble);
+ gval_write(file, gval);
+ fprintf(file, "%s", postfix);
}
void
ghb_plist_write_file(const gchar *filename, GValue *gval)
{
- FILE *file;
+ FILE *file;
- file = fopen(filename, "w");
- if (file == NULL)
- return;
+ file = fopen(filename, "w");
+ if (file == NULL)
+ return;
- fprintf(file, "%s", preamble);
- gval_write(file, gval);
- fprintf(file, "%s", postfix);
+ fprintf(file, "%s", preamble);
+ gval_write(file, gval);
+ fprintf(file, "%s", postfix);
}
@@ -585,17 +585,17 @@ ghb_plist_write_file(const gchar *filename, GValue *gval)
gint
main(gint argc, gchar *argv[])
{
- GValue *gval;
-
- g_type_init();
-
- file = g_fopen(argv[1], "r");
- gval = ghb_plist_parse_file(file);
- if (argc > 2)
- ghb_plist_write_file(argv[2], gval);
- else
- ghb_plist_write(stdout, gval);
- if (file) fclose (file);
- return 0;
+ GValue *gval;
+
+ g_type_init();
+
+ file = g_fopen(argv[1], "r");
+ gval = ghb_plist_parse_file(file);
+ if (argc > 2)
+ ghb_plist_write_file(argv[2], gval);
+ else
+ ghb_plist_write(stdout, gval);
+ if (file) fclose (file);
+ return 0;
}
#endif
diff --git a/gtk/src/preset_xlat.c b/gtk/src/preset_xlat.c
index 990ea58d7..8d242fa6b 100644
--- a/gtk/src/preset_xlat.c
+++ b/gtk/src/preset_xlat.c
@@ -9,499 +9,499 @@ static GValue *defaults;
typedef struct
{
- gchar *mac_val;
- gchar *lin_val;
+ gchar *mac_val;
+ gchar *lin_val;
} value_map_t;
#if 0
static value_map_t subtitle_xlat[] =
{
- { "None", "none" },
- { "Auto", "auto" },
- { "Any", "und" },
- { "Afar", "aar" },
- { "Abkhazian", "abk" },
- { "Afrikaans", "afr" },
- { "Akan", "aka" },
- { "Albanian", "sqi" },
- { "Amharic", "amh" },
- { "Arabic", "ara" },
- { "Aragonese", "arg" },
- { "Armenian", "hye" },
- { "Assamese", "asm" },
- { "Avaric", "ava" },
- { "Avestan", "ave" },
- { "Aymara", "aym" },
- { "Azerbaijani", "aze" },
- { "Bashkir", "bak" },
- { "Bambara", "bam" },
- { "Basque", "eus" },
- { "Belarusian", "bel" },
- { "Bengali", "ben" },
- { "Bihari", "bih" },
- { "Bislama", "bis" },
- { "Bosnian", "bos" },
- { "Breton", "bre" },
- { "Bulgarian", "bul" },
- { "Burmese", "mya" },
- { "Catalan", "cat" },
- { "Chamorro", "cha" },
- { "Chechen", "che" },
- { "Chinese", "zho" },
- { "Church Slavic", "chu" },
- { "Chuvash", "chv" },
- { "Cornish", "cor" },
- { "Corsican", "cos" },
- { "Cree", "cre" },
- { "Czech", "ces" },
- { "Danish", "dan" },
- { "Divehi", "div" },
- { "Dutch", "nld" },
- { "Dzongkha", "dzo" },
- { "English", "eng" },
- { "Esperanto", "epo" },
- { "Estonian", "est" },
- { "Ewe", "ewe" },
- { "Faroese", "fao" },
- { "Fijian", "fij" },
- { "Finnish", "fin" },
- { "French", "fra" },
- { "Western Frisian", "fry" },
- { "Fulah", "ful" },
- { "Georgian", "kat" },
- { "German", "deu" },
- { "Gaelic (Scots)", "gla" },
- { "Irish", "gle" },
- { "Galician", "glg" },
- { "Manx", "glv" },
- { "Greek, Modern", "ell" },
- { "Guarani", "grn" },
- { "Gujarati", "guj" },
- { "Haitian", "hat" },
- { "Hausa", "hau" },
- { "Hebrew", "heb" },
- { "Herero", "her" },
- { "Hindi", "hin" },
- { "Hiri Motu", "hmo" },
- { "Hungarian", "hun" },
- { "Igbo", "ibo" },
- { "Icelandic", "isl" },
- { "Ido", "ido" },
- { "Sichuan Yi", "iii" },
- { "Inuktitut", "iku" },
- { "Interlingue", "ile" },
- { "Interlingua", "ina" },
- { "Indonesian", "ind" },
- { "Inupiaq", "ipk" },
- { "Italian", "ita" },
- { "Javanese", "jav" },
- { "Japanese", "jpn" },
- { "Kalaallisut", "kal" },
- { "Kannada", "kan" },
- { "Kashmiri", "kas" },
- { "Kanuri", "kau" },
- { "Kazakh", "kaz" },
- { "Central Khmer", "khm" },
- { "Kikuyu", "kik" },
- { "Kinyarwanda", "kin" },
- { "Kirghiz", "kir" },
- { "Komi", "kom" },
- { "Kongo", "kon" },
- { "Korean", "kor" },
- { "Kuanyama", "kua" },
- { "Kurdish", "kur" },
- { "Lao", "lao" },
- { "Latin", "lat" },
- { "Latvian", "lav" },
- { "Limburgan", "lim" },
- { "Lingala", "lin" },
- { "Lithuanian", "lit" },
- { "Luxembourgish", "ltz" },
- { "Luba-Katanga", "lub" },
- { "Ganda", "lug" },
- { "Macedonian", "mkd" },
- { "Marshallese", "mah" },
- { "Malayalam", "mal" },
- { "Maori", "mri" },
- { "Marathi", "mar" },
- { "Malay", "msa" },
- { "Malagasy", "mlg" },
- { "Maltese", "mlt" },
- { "Moldavian", "mol" },
- { "Mongolian", "mon" },
- { "Nauru", "nau" },
- { "Navajo", "nav" },
- { "Ndebele, South", "nbl" },
- { "Ndebele, North", "nde" },
- { "Ndonga", "ndo" },
- { "Nepali", "nep" },
- { "Norwegian Nynorsk", "nno" },
- { "Norwegian Bokmål", "nob" },
- { "Norwegian", "nor" },
- { "Chichewa; Nyanja", "nya" },
- { "Occitan", "oci" },
- { "Ojibwa", "oji" },
- { "Oriya", "ori" },
- { "Oromo", "orm" },
- { "Ossetian", "oss" },
- { "Panjabi", "pan" },
- { "Persian", "fas" },
- { "Pali", "pli" },
- { "Polish", "pol" },
- { "Portuguese", "por" },
- { "Pushto", "pus" },
- { "Quechua", "que" },
- { "Romansh", "roh" },
- { "Romanian", "ron" },
- { "Rundi", "run" },
- { "Russian", "rus" },
- { "Sango", "sag" },
- { "Sanskrit", "san" },
- { "Serbian", "srp" },
- { "Croatian", "hrv" },
- { "Sinhala", "sin" },
- { "Slovak", "slk" },
- { "Slovenian", "slv" },
- { "Northern Sami", "sme" },
- { "Samoan", "smo" },
- { "Shona", "sna" },
- { "Sindhi", "snd" },
- { "Somali", "som" },
- { "Sotho, Southern", "sot" },
- { "Spanish", "spa" },
- { "Sardinian", "srd" },
- { "Swati", "ssw" },
- { "Sundanese", "sun" },
- { "Swahili", "swa" },
- { "Swedish", "swe" },
- { "Tahitian", "tah" },
- { "Tamil", "tam" },
- { "Tatar", "tat" },
- { "Telugu", "tel" },
- { "Tajik", "tgk" },
- { "Tagalog", "tgl" },
- { "Thai", "tha" },
- { "Tibetan", "bod" },
- { "Tigrinya", "tir" },
- { "Tonga", "ton" },
- { "Tswana", "tsn" },
- { "Tsonga", "tso" },
- { "Turkmen", "tuk" },
- { "Turkish", "tur" },
- { "Twi", "twi" },
- { "Uighur", "uig" },
- { "Ukrainian", "ukr" },
- { "Urdu", "urd" },
- { "Uzbek", "uzb" },
- { "Venda", "ven" },
- { "Vietnamese", "vie" },
- { "Volapük", "vol" },
- { "Welsh", "cym" },
- { "Walloon", "wln" },
- { "Wolof", "wol" },
- { "Xhosa", "xho" },
- { "Yiddish", "yid" },
- { "Yoruba", "yor" },
- { "Zhuang", "zha" },
- { "Zulu", "zul" },
- {NULL, NULL}
+ { "None", "none" },
+ { "Auto", "auto" },
+ { "Any", "und" },
+ { "Afar", "aar" },
+ { "Abkhazian", "abk" },
+ { "Afrikaans", "afr" },
+ { "Akan", "aka" },
+ { "Albanian", "sqi" },
+ { "Amharic", "amh" },
+ { "Arabic", "ara" },
+ { "Aragonese", "arg" },
+ { "Armenian", "hye" },
+ { "Assamese", "asm" },
+ { "Avaric", "ava" },
+ { "Avestan", "ave" },
+ { "Aymara", "aym" },
+ { "Azerbaijani", "aze" },
+ { "Bashkir", "bak" },
+ { "Bambara", "bam" },
+ { "Basque", "eus" },
+ { "Belarusian", "bel" },
+ { "Bengali", "ben" },
+ { "Bihari", "bih" },
+ { "Bislama", "bis" },
+ { "Bosnian", "bos" },
+ { "Breton", "bre" },
+ { "Bulgarian", "bul" },
+ { "Burmese", "mya" },
+ { "Catalan", "cat" },
+ { "Chamorro", "cha" },
+ { "Chechen", "che" },
+ { "Chinese", "zho" },
+ { "Church Slavic", "chu" },
+ { "Chuvash", "chv" },
+ { "Cornish", "cor" },
+ { "Corsican", "cos" },
+ { "Cree", "cre" },
+ { "Czech", "ces" },
+ { "Danish", "dan" },
+ { "Divehi", "div" },
+ { "Dutch", "nld" },
+ { "Dzongkha", "dzo" },
+ { "English", "eng" },
+ { "Esperanto", "epo" },
+ { "Estonian", "est" },
+ { "Ewe", "ewe" },
+ { "Faroese", "fao" },
+ { "Fijian", "fij" },
+ { "Finnish", "fin" },
+ { "French", "fra" },
+ { "Western Frisian", "fry" },
+ { "Fulah", "ful" },
+ { "Georgian", "kat" },
+ { "German", "deu" },
+ { "Gaelic (Scots)", "gla" },
+ { "Irish", "gle" },
+ { "Galician", "glg" },
+ { "Manx", "glv" },
+ { "Greek, Modern", "ell" },
+ { "Guarani", "grn" },
+ { "Gujarati", "guj" },
+ { "Haitian", "hat" },
+ { "Hausa", "hau" },
+ { "Hebrew", "heb" },
+ { "Herero", "her" },
+ { "Hindi", "hin" },
+ { "Hiri Motu", "hmo" },
+ { "Hungarian", "hun" },
+ { "Igbo", "ibo" },
+ { "Icelandic", "isl" },
+ { "Ido", "ido" },
+ { "Sichuan Yi", "iii" },
+ { "Inuktitut", "iku" },
+ { "Interlingue", "ile" },
+ { "Interlingua", "ina" },
+ { "Indonesian", "ind" },
+ { "Inupiaq", "ipk" },
+ { "Italian", "ita" },
+ { "Javanese", "jav" },
+ { "Japanese", "jpn" },
+ { "Kalaallisut", "kal" },
+ { "Kannada", "kan" },
+ { "Kashmiri", "kas" },
+ { "Kanuri", "kau" },
+ { "Kazakh", "kaz" },
+ { "Central Khmer", "khm" },
+ { "Kikuyu", "kik" },
+ { "Kinyarwanda", "kin" },
+ { "Kirghiz", "kir" },
+ { "Komi", "kom" },
+ { "Kongo", "kon" },
+ { "Korean", "kor" },
+ { "Kuanyama", "kua" },
+ { "Kurdish", "kur" },
+ { "Lao", "lao" },
+ { "Latin", "lat" },
+ { "Latvian", "lav" },
+ { "Limburgan", "lim" },
+ { "Lingala", "lin" },
+ { "Lithuanian", "lit" },
+ { "Luxembourgish", "ltz" },
+ { "Luba-Katanga", "lub" },
+ { "Ganda", "lug" },
+ { "Macedonian", "mkd" },
+ { "Marshallese", "mah" },
+ { "Malayalam", "mal" },
+ { "Maori", "mri" },
+ { "Marathi", "mar" },
+ { "Malay", "msa" },
+ { "Malagasy", "mlg" },
+ { "Maltese", "mlt" },
+ { "Moldavian", "mol" },
+ { "Mongolian", "mon" },
+ { "Nauru", "nau" },
+ { "Navajo", "nav" },
+ { "Ndebele, South", "nbl" },
+ { "Ndebele, North", "nde" },
+ { "Ndonga", "ndo" },
+ { "Nepali", "nep" },
+ { "Norwegian Nynorsk", "nno" },
+ { "Norwegian Bokmål", "nob" },
+ { "Norwegian", "nor" },
+ { "Chichewa; Nyanja", "nya" },
+ { "Occitan", "oci" },
+ { "Ojibwa", "oji" },
+ { "Oriya", "ori" },
+ { "Oromo", "orm" },
+ { "Ossetian", "oss" },
+ { "Panjabi", "pan" },
+ { "Persian", "fas" },
+ { "Pali", "pli" },
+ { "Polish", "pol" },
+ { "Portuguese", "por" },
+ { "Pushto", "pus" },
+ { "Quechua", "que" },
+ { "Romansh", "roh" },
+ { "Romanian", "ron" },
+ { "Rundi", "run" },
+ { "Russian", "rus" },
+ { "Sango", "sag" },
+ { "Sanskrit", "san" },
+ { "Serbian", "srp" },
+ { "Croatian", "hrv" },
+ { "Sinhala", "sin" },
+ { "Slovak", "slk" },
+ { "Slovenian", "slv" },
+ { "Northern Sami", "sme" },
+ { "Samoan", "smo" },
+ { "Shona", "sna" },
+ { "Sindhi", "snd" },
+ { "Somali", "som" },
+ { "Sotho, Southern", "sot" },
+ { "Spanish", "spa" },
+ { "Sardinian", "srd" },
+ { "Swati", "ssw" },
+ { "Sundanese", "sun" },
+ { "Swahili", "swa" },
+ { "Swedish", "swe" },
+ { "Tahitian", "tah" },
+ { "Tamil", "tam" },
+ { "Tatar", "tat" },
+ { "Telugu", "tel" },
+ { "Tajik", "tgk" },
+ { "Tagalog", "tgl" },
+ { "Thai", "tha" },
+ { "Tibetan", "bod" },
+ { "Tigrinya", "tir" },
+ { "Tonga", "ton" },
+ { "Tswana", "tsn" },
+ { "Tsonga", "tso" },
+ { "Turkmen", "tuk" },
+ { "Turkish", "tur" },
+ { "Twi", "twi" },
+ { "Uighur", "uig" },
+ { "Ukrainian", "ukr" },
+ { "Urdu", "urd" },
+ { "Uzbek", "uzb" },
+ { "Venda", "ven" },
+ { "Vietnamese", "vie" },
+ { "Volapük", "vol" },
+ { "Welsh", "cym" },
+ { "Walloon", "wln" },
+ { "Wolof", "wol" },
+ { "Xhosa", "xho" },
+ { "Yiddish", "yid" },
+ { "Yoruba", "yor" },
+ { "Zhuang", "zha" },
+ { "Zulu", "zul" },
+ {NULL, NULL}
};
static value_map_t vcodec_xlat[] =
{
- {"MPEG-4 (FFmpeg)", "ffmpeg"},
- {"MPEG-4 (XviD)", "ffmpeg"},
- {"H.264 (x264)", "x264"},
- {"VP3 (Theora)", "theora"},
- {NULL,NULL}
+ {"MPEG-4 (FFmpeg)", "ffmpeg"},
+ {"MPEG-4 (XviD)", "ffmpeg"},
+ {"H.264 (x264)", "x264"},
+ {"VP3 (Theora)", "theora"},
+ {NULL,NULL}
};
value_map_t container_xlat[] =
{
- {"MP4 file", "mp4"},
- {"M4V file", "m4v"},
- {"MKV file", "mkv"},
- {"AVI file", "avi"},
- {"OGM file", "ogm"},
- {NULL, NULL}
+ {"MP4 file", "mp4"},
+ {"M4V file", "m4v"},
+ {"MKV file", "mkv"},
+ {"AVI file", "avi"},
+ {"OGM file", "ogm"},
+ {NULL, NULL}
};
value_map_t framerate_xlat[] =
{
- {"Same as source", "source"},
- {"5", "5"},
- {"10", "10"},
- {"12", "12"},
- {"15", "15"},
- {"23.976", "23.976"},
- {"24", "24"},
- {"25", "25"},
- {"29.97", "29.97"},
- {NULL, NULL}
+ {"Same as source", "source"},
+ {"5", "5"},
+ {"10", "10"},
+ {"12", "12"},
+ {"15", "15"},
+ {"23.976", "23.976"},
+ {"24", "24"},
+ {"25", "25"},
+ {"29.97", "29.97"},
+ {NULL, NULL}
};
value_map_t deint_xlat[] =
{
- {"0", "none"},
- {"1", "fast"},
- {"2", "slow"},
- {"3", "slower"},
- {NULL, NULL}
+ {"0", "none"},
+ {"1", "fast"},
+ {"2", "slow"},
+ {"3", "slower"},
+ {NULL, NULL}
};
value_map_t denoise_xlat[] =
{
- {"0", "none"},
- {"1", "weak"},
- {"2", "medium"},
- {"3", "strong"},
- {NULL, NULL}
+ {"0", "none"},
+ {"1", "weak"},
+ {"2", "medium"},
+ {"3", "strong"},
+ {NULL, NULL}
};
static value_map_t acodec_xlat[] =
{
- {"AAC (faac)", "faac"},
- {"AC3 Passthru", "ac3"},
- {"MP3 (lame)", "lame"},
- {"Vorbis (vorbis)", "vorbis"},
- {NULL,NULL}
+ {"AAC (faac)", "faac"},
+ {"AC3 Passthru", "ac3"},
+ {"MP3 (lame)", "lame"},
+ {"Vorbis (vorbis)", "vorbis"},
+ {NULL,NULL}
};
value_map_t samplerate_xlat[] =
{
- {"Auto", "source"},
- {"22.05", "22.05"},
- {"24", "24"},
- {"32", "32"},
- {"44.1", "44.1"},
- {"48", "48"},
- {NULL, NULL}
+ {"Auto", "source"},
+ {"22.05", "22.05"},
+ {"24", "24"},
+ {"32", "32"},
+ {"44.1", "44.1"},
+ {"48", "48"},
+ {NULL, NULL}
};
value_map_t mix_xlat[] =
{
- {"Mono", "mono"},
- {"Stereo", "stereo"},
- {"Dolby Surround", "dpl1"},
- {"Dolby Pro Logic II", "dpl2"},
- {"6-channel discrete", "6ch"},
- {"AC3 Passthru", "none"},
- {NULL, NULL}
+ {"Mono", "mono"},
+ {"Stereo", "stereo"},
+ {"Dolby Surround", "dpl1"},
+ {"Dolby Pro Logic II", "dpl2"},
+ {"6-channel discrete", "6ch"},
+ {"AC3 Passthru", "none"},
+ {NULL, NULL}
};
#endif
typedef struct
{
- gchar *mac_key;
- gchar *lin_key;
- value_map_t *value_map;
- gboolean same;
- gboolean ignore;
+ gchar *mac_key;
+ gchar *lin_key;
+ value_map_t *value_map;
+ gboolean same;
+ gboolean ignore;
} key_map_t;
key_map_t key_map[] =
{
- {"Audio1Bitrate", NULL, NULL, FALSE, FALSE},
- {"Audio1Encoder", NULL, NULL, FALSE, FALSE},
- {"Audio1Mixdown", NULL, NULL, FALSE, FALSE},
- {"Audio1Samplerate", NULL, NULL, FALSE, FALSE},
- {"Audio1Track", NULL, NULL, FALSE, FALSE},
- {"Audio1TrackDescription", NULL, NULL, FALSE, FALSE},
- {"Audio1TrackDRCSlider", NULL, NULL, FALSE, FALSE},
- {"Audio2Bitrate", NULL, NULL, FALSE, FALSE},
- {"Audio2Encoder", NULL, NULL, FALSE, FALSE},
- {"Audio2Mixdown", NULL, NULL, FALSE, FALSE},
- {"Audio2Samplerate", NULL, NULL, FALSE, FALSE},
- {"Audio2Track", NULL, NULL, FALSE, FALSE},
- {"Audio2TrackDescription", NULL, NULL, FALSE, FALSE},
- {"Audio2TrackDRCSlider", NULL, NULL, FALSE, FALSE},
- {"ChapterMarkers", NULL, NULL, TRUE, FALSE},
- {"Default", NULL, NULL, TRUE, FALSE},
- {"FileFormat", NULL, NULL, TRUE, FALSE},
- {"Folder", NULL, NULL, TRUE, FALSE},
- {"Mp4HttpOptimize", NULL, NULL, TRUE, FALSE},
- {"Mp4iPodCompatible", NULL, NULL, TRUE, FALSE},
- {"Mp4LargeFile", NULL, NULL, TRUE, FALSE},
- {"PictureAutoCrop", NULL, NULL, TRUE, FALSE},
- {"PictureBottomCrop", NULL, NULL, TRUE, FALSE},
- {"PictureDeblock", NULL, NULL, TRUE, FALSE},
- {"PictureDecomb", NULL, NULL, TRUE, FALSE},
- {"PictureDeinterlace", NULL, NULL, TRUE, FALSE},
- {"PictureDenoise", NULL, NULL, TRUE, FALSE},
- {"PictureDetelecine", NULL, NULL, TRUE, FALSE},
- {"PictureHeight", NULL, NULL, TRUE, FALSE},
- {"PictureKeepRatio", NULL, NULL, TRUE, FALSE},
- {"PictureLeftCrop", NULL, NULL, TRUE, FALSE},
- {"PicturePAR", NULL, NULL, TRUE, FALSE},
- {"PictureRightCrop", NULL, NULL, TRUE, FALSE},
- {"PictureTopCrop", NULL, NULL, TRUE, FALSE},
- {"PictureWidth", NULL, NULL, TRUE, FALSE},
- {"PresetDescription", NULL, NULL, TRUE, FALSE},
- {"PresetName", NULL, NULL, TRUE, FALSE},
- {"Subtitles", NULL, NULL, TRUE, FALSE},
- {"SubtitlesForced", NULL, NULL, TRUE, FALSE},
- {"Type", NULL, NULL, TRUE, FALSE},
- {"UsesMaxPictureSettings", NULL, NULL, TRUE, FALSE},
- {"UsesPictureFilters", NULL, NULL, TRUE, FALSE},
- {"UsesPictureSettings", NULL, NULL, TRUE, FALSE},
- {"VFR", NULL, NULL, FALSE, TRUE},
- {"VideoAvgBitrate", NULL, NULL, TRUE, FALSE},
- {"VideoEncoder", NULL, NULL, TRUE, FALSE},
- {"VideoFramerate", NULL, NULL, TRUE, FALSE},
- {"VideoGrayScale", NULL, NULL, TRUE, FALSE},
- {"VideoQualitySlider", NULL, NULL, TRUE, FALSE},
- {"VideoQualityType", NULL, NULL, TRUE, FALSE},
- {"VideoTargetSize", NULL, NULL, TRUE, FALSE},
- {"VideoTwoPass", NULL, NULL, TRUE, FALSE},
- {"VideoTurboTwoPass", NULL, NULL, TRUE, FALSE},
- {"x264Option", NULL, NULL, TRUE, FALSE},
- {NULL, NULL}
+ {"Audio1Bitrate", NULL, NULL, FALSE, FALSE},
+ {"Audio1Encoder", NULL, NULL, FALSE, FALSE},
+ {"Audio1Mixdown", NULL, NULL, FALSE, FALSE},
+ {"Audio1Samplerate", NULL, NULL, FALSE, FALSE},
+ {"Audio1Track", NULL, NULL, FALSE, FALSE},
+ {"Audio1TrackDescription", NULL, NULL, FALSE, FALSE},
+ {"Audio1TrackDRCSlider", NULL, NULL, FALSE, FALSE},
+ {"Audio2Bitrate", NULL, NULL, FALSE, FALSE},
+ {"Audio2Encoder", NULL, NULL, FALSE, FALSE},
+ {"Audio2Mixdown", NULL, NULL, FALSE, FALSE},
+ {"Audio2Samplerate", NULL, NULL, FALSE, FALSE},
+ {"Audio2Track", NULL, NULL, FALSE, FALSE},
+ {"Audio2TrackDescription", NULL, NULL, FALSE, FALSE},
+ {"Audio2TrackDRCSlider", NULL, NULL, FALSE, FALSE},
+ {"ChapterMarkers", NULL, NULL, TRUE, FALSE},
+ {"Default", NULL, NULL, TRUE, FALSE},
+ {"FileFormat", NULL, NULL, TRUE, FALSE},
+ {"Folder", NULL, NULL, TRUE, FALSE},
+ {"Mp4HttpOptimize", NULL, NULL, TRUE, FALSE},
+ {"Mp4iPodCompatible", NULL, NULL, TRUE, FALSE},
+ {"Mp4LargeFile", NULL, NULL, TRUE, FALSE},
+ {"PictureAutoCrop", NULL, NULL, TRUE, FALSE},
+ {"PictureBottomCrop", NULL, NULL, TRUE, FALSE},
+ {"PictureDeblock", NULL, NULL, TRUE, FALSE},
+ {"PictureDecomb", NULL, NULL, TRUE, FALSE},
+ {"PictureDeinterlace", NULL, NULL, TRUE, FALSE},
+ {"PictureDenoise", NULL, NULL, TRUE, FALSE},
+ {"PictureDetelecine", NULL, NULL, TRUE, FALSE},
+ {"PictureHeight", NULL, NULL, TRUE, FALSE},
+ {"PictureKeepRatio", NULL, NULL, TRUE, FALSE},
+ {"PictureLeftCrop", NULL, NULL, TRUE, FALSE},
+ {"PicturePAR", NULL, NULL, TRUE, FALSE},
+ {"PictureRightCrop", NULL, NULL, TRUE, FALSE},
+ {"PictureTopCrop", NULL, NULL, TRUE, FALSE},
+ {"PictureWidth", NULL, NULL, TRUE, FALSE},
+ {"PresetDescription", NULL, NULL, TRUE, FALSE},
+ {"PresetName", NULL, NULL, TRUE, FALSE},
+ {"Subtitles", NULL, NULL, TRUE, FALSE},
+ {"SubtitlesForced", NULL, NULL, TRUE, FALSE},
+ {"Type", NULL, NULL, TRUE, FALSE},
+ {"UsesMaxPictureSettings", NULL, NULL, TRUE, FALSE},
+ {"UsesPictureFilters", NULL, NULL, TRUE, FALSE},
+ {"UsesPictureSettings", NULL, NULL, TRUE, FALSE},
+ {"VFR", NULL, NULL, FALSE, TRUE},
+ {"VideoAvgBitrate", NULL, NULL, TRUE, FALSE},
+ {"VideoEncoder", NULL, NULL, TRUE, FALSE},
+ {"VideoFramerate", NULL, NULL, TRUE, FALSE},
+ {"VideoGrayScale", NULL, NULL, TRUE, FALSE},
+ {"VideoQualitySlider", NULL, NULL, TRUE, FALSE},
+ {"VideoQualityType", NULL, NULL, TRUE, FALSE},
+ {"VideoTargetSize", NULL, NULL, TRUE, FALSE},
+ {"VideoTwoPass", NULL, NULL, TRUE, FALSE},
+ {"VideoTurboTwoPass", NULL, NULL, TRUE, FALSE},
+ {"x264Option", NULL, NULL, TRUE, FALSE},
+ {NULL, NULL}
};
const gint
key_xlat(key_map_t *key_map, const gchar *mac_key)
{
- gint ii;
-
- for (ii = 0; key_map[ii].mac_key; ii++)
- {
- if (strcmp(mac_key, key_map[ii].mac_key) == 0)
- {
- if (key_map[ii].ignore)
- return -1;
- return ii;
- }
- }
- g_warning("Unrecognized key: (%s)", mac_key);
- return -1;
+ gint ii;
+
+ for (ii = 0; key_map[ii].mac_key; ii++)
+ {
+ if (strcmp(mac_key, key_map[ii].mac_key) == 0)
+ {
+ if (key_map[ii].ignore)
+ return -1;
+ return ii;
+ }
+ }
+ g_warning("Unrecognized key: (%s)", mac_key);
+ return -1;
}
static GValue*
value_xlat(
- GValue *defaults,
- key_map_t *key_map,
- gint key_index,
- GValue *mac_val)
+ GValue *defaults,
+ key_map_t *key_map,
+ gint key_index,
+ GValue *mac_val)
{
- GValue *gval, *def_val;
- const gchar *lin_key;
- if (key_map[key_index].same)
- lin_key = key_map[key_index].mac_key;
- else
- lin_key = key_map[key_index].lin_key;
- value_map_t *value_map = key_map[key_index].value_map;
-
- def_val = ghb_dict_lookup(defaults, lin_key);
- if (def_val)
- {
- if (value_map)
- {
- gint ii;
- gchar *str;
- GValue *sval;
-
- str = ghb_value_string(mac_val);
- for (ii = 0; value_map[ii].mac_val; ii++)
- {
- if (strcmp(str, value_map[ii].mac_val) == 0)
- {
- sval = ghb_string_value_new(value_map[ii].lin_val);
- g_free(str);
- gval = ghb_value_new(G_VALUE_TYPE(def_val));
- if (!g_value_transform(sval, gval))
- {
- g_warning("1 can't transform");
- ghb_value_free(gval);
- ghb_value_free(sval);
- return NULL;
- }
- ghb_value_free(sval);
- return gval;
- }
- }
- g_warning("Can't map value: (%s)", str);
- g_free(str);
- }
- else
- {
- gval = ghb_value_new(G_VALUE_TYPE(def_val));
- if (!g_value_transform(mac_val, gval))
- {
- g_warning("2 can't transform");
- ghb_value_free(gval);
- return NULL;
- }
- return gval;
- }
- }
- else
- {
- g_warning("Bad key: (%s)", lin_key);
- return NULL;
- }
- return NULL;
+ GValue *gval, *def_val;
+ const gchar *lin_key;
+ if (key_map[key_index].same)
+ lin_key = key_map[key_index].mac_key;
+ else
+ lin_key = key_map[key_index].lin_key;
+ value_map_t *value_map = key_map[key_index].value_map;
+
+ def_val = ghb_dict_lookup(defaults, lin_key);
+ if (def_val)
+ {
+ if (value_map)
+ {
+ gint ii;
+ gchar *str;
+ GValue *sval;
+
+ str = ghb_value_string(mac_val);
+ for (ii = 0; value_map[ii].mac_val; ii++)
+ {
+ if (strcmp(str, value_map[ii].mac_val) == 0)
+ {
+ sval = ghb_string_value_new(value_map[ii].lin_val);
+ g_free(str);
+ gval = ghb_value_new(G_VALUE_TYPE(def_val));
+ if (!g_value_transform(sval, gval))
+ {
+ g_warning("1 can't transform");
+ ghb_value_free(gval);
+ ghb_value_free(sval);
+ return NULL;
+ }
+ ghb_value_free(sval);
+ return gval;
+ }
+ }
+ g_warning("Can't map value: (%s)", str);
+ g_free(str);
+ }
+ else
+ {
+ gval = ghb_value_new(G_VALUE_TYPE(def_val));
+ if (!g_value_transform(mac_val, gval))
+ {
+ g_warning("2 can't transform");
+ ghb_value_free(gval);
+ return NULL;
+ }
+ return gval;
+ }
+ }
+ else
+ {
+ g_warning("Bad key: (%s)", lin_key);
+ return NULL;
+ }
+ return NULL;
}
key_map_t audio_key_map[] =
{
- {"Audio1Bitrate", "AudioBitrate", NULL, FALSE, FALSE},
- {"Audio1Encoder", "AudioEncoder", NULL, FALSE, FALSE},
- {"Audio1Mixdown", "AudioMixdown", NULL, FALSE},
- {"Audio1Samplerate", "AudioSamplerate", NULL, FALSE, FALSE},
- {"Audio1Track", "AudioTrack", NULL, FALSE, FALSE},
- {"Audio1TrackDescription", "AudioTrackDescription", NULL, FALSE, FALSE},
- {"Audio1TrackDRCSlider", "AudioTrackDRCSlider", NULL, FALSE, FALSE},
- {"Audio2Bitrate", "AudioBitrate", NULL, FALSE, FALSE},
- {"Audio2Encoder", "AudioEncoder", NULL, FALSE, FALSE},
- {"Audio2Mixdown", "AudioMixdown", NULL, FALSE, FALSE},
- {"Audio2Samplerate", "AudioSamplerate", NULL, FALSE, FALSE},
- {"Audio2Track", "AudioTrack", NULL, FALSE, FALSE},
- {"Audio2TrackDescription", "AudioTrackDescription", NULL, FALSE, FALSE},
- {"Audio2TrackDRCSlider", "AudioTrackDRCSlider", NULL, FALSE, FALSE},
- {NULL, NULL}
+ {"Audio1Bitrate", "AudioBitrate", NULL, FALSE, FALSE},
+ {"Audio1Encoder", "AudioEncoder", NULL, FALSE, FALSE},
+ {"Audio1Mixdown", "AudioMixdown", NULL, FALSE},
+ {"Audio1Samplerate", "AudioSamplerate", NULL, FALSE, FALSE},
+ {"Audio1Track", "AudioTrack", NULL, FALSE, FALSE},
+ {"Audio1TrackDescription", "AudioTrackDescription", NULL, FALSE, FALSE},
+ {"Audio1TrackDRCSlider", "AudioTrackDRCSlider", NULL, FALSE, FALSE},
+ {"Audio2Bitrate", "AudioBitrate", NULL, FALSE, FALSE},
+ {"Audio2Encoder", "AudioEncoder", NULL, FALSE, FALSE},
+ {"Audio2Mixdown", "AudioMixdown", NULL, FALSE, FALSE},
+ {"Audio2Samplerate", "AudioSamplerate", NULL, FALSE, FALSE},
+ {"Audio2Track", "AudioTrack", NULL, FALSE, FALSE},
+ {"Audio2TrackDescription", "AudioTrackDescription", NULL, FALSE, FALSE},
+ {"Audio2TrackDRCSlider", "AudioTrackDRCSlider", NULL, FALSE, FALSE},
+ {NULL, NULL}
};
static void
hard_value_xlat(GValue *lin_dict, const gchar *mac_key, GValue *mac_val)
{
- {
- gint key_index;
- GValue *audio_defaults;
-
- audio_defaults = ghb_array_get_nth(
- ghb_dict_lookup(defaults, "AudioList"), 0);
- key_index = key_xlat(audio_key_map, mac_key);
- if (key_index >= 0)
- {
- gint audio_index, count, ii;
- GValue *alist, *adict, *val;
- const gchar *lin_key;
-
- if (audio_key_map[key_index].same)
- lin_key = audio_key_map[key_index].mac_key;
- else
- lin_key = audio_key_map[key_index].lin_key;
- audio_index = mac_key[5] - '1';
- alist = ghb_dict_lookup(lin_dict, "AudioList");
- if (alist == NULL)
- {
- alist = ghb_array_value_new(8);
- ghb_dict_insert(lin_dict, "AudioList", alist);
- }
- count = ghb_array_len(alist);
- for (ii = count; ii <= audio_index; ii++)
- {
- adict = ghb_value_dup(audio_defaults);
- ghb_array_append(alist, adict);
- }
- adict = ghb_array_get_nth(alist, audio_index);
- val = value_xlat(audio_defaults, audio_key_map, key_index, mac_val);
- if (val)
- {
- ghb_dict_insert(adict, g_strdup(lin_key), val);
- }
- }
- }
+ {
+ gint key_index;
+ GValue *audio_defaults;
+
+ audio_defaults = ghb_array_get_nth(
+ ghb_dict_lookup(defaults, "AudioList"), 0);
+ key_index = key_xlat(audio_key_map, mac_key);
+ if (key_index >= 0)
+ {
+ gint audio_index, count, ii;
+ GValue *alist, *adict, *val;
+ const gchar *lin_key;
+
+ if (audio_key_map[key_index].same)
+ lin_key = audio_key_map[key_index].mac_key;
+ else
+ lin_key = audio_key_map[key_index].lin_key;
+ audio_index = mac_key[5] - '1';
+ alist = ghb_dict_lookup(lin_dict, "AudioList");
+ if (alist == NULL)
+ {
+ alist = ghb_array_value_new(8);
+ ghb_dict_insert(lin_dict, "AudioList", alist);
+ }
+ count = ghb_array_len(alist);
+ for (ii = count; ii <= audio_index; ii++)
+ {
+ adict = ghb_value_dup(audio_defaults);
+ ghb_array_append(alist, adict);
+ }
+ adict = ghb_array_get_nth(alist, audio_index);
+ val = value_xlat(audio_defaults, audio_key_map, key_index, mac_val);
+ if (val)
+ {
+ ghb_dict_insert(adict, g_strdup(lin_key), val);
+ }
+ }
+ }
}
static void
@@ -514,114 +514,114 @@ parse_preset_dict(GValue *mac_dict, GValue *lin_dict)
ghb_dict_iter_init(&iter, mac_dict);
// middle (void*) cast prevents gcc warning "defreferencing type-punned
// pointer will break strict-aliasing rules"
- while (g_hash_table_iter_next(
- &iter, (gpointer*)(void*)&key, (gpointer*)(void*)&mac_val))
- {
- gint key_index;
-
- key_index = key_xlat(key_map, key);
- if (key_index >= 0)
- { // The simple translations
- const gchar *lin_key;
-
- if (key_map[key_index].same)
- lin_key = key_map[key_index].mac_key;
- else
- lin_key = key_map[key_index].lin_key;
- if (lin_key)
- {
- val = value_xlat(defaults, key_map, key_index, mac_val);
- if (val)
- {
- ghb_dict_insert(lin_dict, g_strdup(lin_key), val);
- }
- }
- else
- {
- hard_value_xlat(lin_dict, key, mac_val);
- }
- }
- }
+ while (g_hash_table_iter_next(
+ &iter, (gpointer*)(void*)&key, (gpointer*)(void*)&mac_val))
+ {
+ gint key_index;
+
+ key_index = key_xlat(key_map, key);
+ if (key_index >= 0)
+ { // The simple translations
+ const gchar *lin_key;
+
+ if (key_map[key_index].same)
+ lin_key = key_map[key_index].mac_key;
+ else
+ lin_key = key_map[key_index].lin_key;
+ if (lin_key)
+ {
+ val = value_xlat(defaults, key_map, key_index, mac_val);
+ if (val)
+ {
+ ghb_dict_insert(lin_dict, g_strdup(lin_key), val);
+ }
+ }
+ else
+ {
+ hard_value_xlat(lin_dict, key, mac_val);
+ }
+ }
+ }
}
static void
parse_preset_array(GValue *mac_array, GValue *lin_array)
{
- gint count, ii;
- GValue *mac_dict, *lin_dict, *gval;
-
- count = ghb_array_len(mac_array);
- for (ii = 0; ii < count; ii++)
- {
- mac_dict = ghb_array_get_nth(mac_array, ii);
-
- // Only process builtin types
- if (ghb_value_int(ghb_dict_lookup(mac_dict, "Type")) != 0)
- continue;
-
- lin_dict = ghb_dict_value_new();
- ghb_array_append(lin_array, lin_dict);
- gval = ghb_dict_lookup(mac_dict, "PresetName");
- if (gval)
- {
- ghb_dict_insert(lin_dict, g_strdup("PresetName"),
- ghb_value_dup(gval));
- }
- gval = ghb_dict_lookup(mac_dict, "PresetDescription");
- if (gval)
- {
- ghb_dict_insert(lin_dict, g_strdup("PresetDescription"),
- ghb_value_dup(gval));
- }
- gval = ghb_dict_lookup(mac_dict, "Folder");
- if (gval && ghb_value_boolean(gval))
- { // Folder
- GValue *mval, *lval;
-
- mval = ghb_dict_lookup(mac_dict, "ChildrenArray");
- lval = ghb_array_value_new(32);
- ghb_dict_insert(lin_dict, g_strdup("ChildrenArray"), lval);
- ghb_dict_insert(lin_dict, g_strdup("Folder"),
- ghb_boolean_value_new(TRUE));
- ghb_dict_insert(lin_dict, g_strdup("Type"),
- ghb_int_value_new(0));
- parse_preset_array(mval, lval);
- }
- else
- { // Normal preset
- ghb_dict_insert(lin_dict, g_strdup("Type"),
- ghb_int_value_new(0));
- parse_preset_dict(mac_dict, lin_dict);
- }
- }
+ gint count, ii;
+ GValue *mac_dict, *lin_dict, *gval;
+
+ count = ghb_array_len(mac_array);
+ for (ii = 0; ii < count; ii++)
+ {
+ mac_dict = ghb_array_get_nth(mac_array, ii);
+
+ // Only process builtin types
+ if (ghb_value_int(ghb_dict_lookup(mac_dict, "Type")) != 0)
+ continue;
+
+ lin_dict = ghb_dict_value_new();
+ ghb_array_append(lin_array, lin_dict);
+ gval = ghb_dict_lookup(mac_dict, "PresetName");
+ if (gval)
+ {
+ ghb_dict_insert(lin_dict, g_strdup("PresetName"),
+ ghb_value_dup(gval));
+ }
+ gval = ghb_dict_lookup(mac_dict, "PresetDescription");
+ if (gval)
+ {
+ ghb_dict_insert(lin_dict, g_strdup("PresetDescription"),
+ ghb_value_dup(gval));
+ }
+ gval = ghb_dict_lookup(mac_dict, "Folder");
+ if (gval && ghb_value_boolean(gval))
+ { // Folder
+ GValue *mval, *lval;
+
+ mval = ghb_dict_lookup(mac_dict, "ChildrenArray");
+ lval = ghb_array_value_new(32);
+ ghb_dict_insert(lin_dict, g_strdup("ChildrenArray"), lval);
+ ghb_dict_insert(lin_dict, g_strdup("Folder"),
+ ghb_boolean_value_new(TRUE));
+ ghb_dict_insert(lin_dict, g_strdup("Type"),
+ ghb_int_value_new(0));
+ parse_preset_array(mval, lval);
+ }
+ else
+ { // Normal preset
+ ghb_dict_insert(lin_dict, g_strdup("Type"),
+ ghb_int_value_new(0));
+ parse_preset_dict(mac_dict, lin_dict);
+ }
+ }
}
static void
xlat(GValue *mac, GValue *lin)
{
- return parse_preset_array(mac, lin);
+ return parse_preset_array(mac, lin);
}
gint
main(gint argc, gchar *argv[])
{
- GValue *mac_plist, *lin_plist;
- GValue *internal;
-
- if (argc < 3)
- {
- fprintf(stderr, "Usage: <mac plist> <lin plist>\n");
- return 1;
- }
- g_type_init();
-
- ghb_register_transforms();
- internal = ghb_plist_parse_file("internal_defaults.xml");
- defaults = ghb_dict_lookup(internal, "Presets");
- mac_plist = ghb_plist_parse_file(argv[1]);
- lin_plist = ghb_array_value_new(32);
- xlat(mac_plist, lin_plist);
- ghb_plist_write_file(argv[2], lin_plist);
- return 0;
+ GValue *mac_plist, *lin_plist;
+ GValue *internal;
+
+ if (argc < 3)
+ {
+ fprintf(stderr, "Usage: <mac plist> <lin plist>\n");
+ return 1;
+ }
+ g_type_init();
+
+ ghb_register_transforms();
+ internal = ghb_plist_parse_file("internal_defaults.xml");
+ defaults = ghb_dict_lookup(internal, "Presets");
+ mac_plist = ghb_plist_parse_file(argv[1]);
+ lin_plist = ghb_array_value_new(32);
+ xlat(mac_plist, lin_plist);
+ ghb_plist_write_file(argv[2], lin_plist);
+ return 0;
}
diff --git a/gtk/src/presets.c b/gtk/src/presets.c
index 43d83eb9b..2adcfdead 100644
--- a/gtk/src/presets.c
+++ b/gtk/src/presets.c
@@ -36,8 +36,8 @@
enum
{
- PRESETS_BUILTIN = 0,
- PRESETS_CUSTOM
+ PRESETS_BUILTIN = 0,
+ PRESETS_CUSTOM
};
static GValue *presetsPlist = NULL;
@@ -53,814 +53,814 @@ static void store_prefs(void);
gint
preset_path_cmp(gint *indices1, gint len1, gint *indices2, gint len2)
{
- gint ii;
- for (ii = 0; ii < len1 && ii < len2; ii++)
- {
- if (indices1[ii] != indices2[ii])
- return indices1[ii] - indices2[ii];
- }
- return len1 - len2;
+ gint ii;
+ for (ii = 0; ii < len1 && ii < len2; ii++)
+ {
+ if (indices1[ii] != indices2[ii])
+ return indices1[ii] - indices2[ii];
+ }
+ return len1 - len2;
}
// This only handle limited depth
GtkTreePath*
ghb_tree_path_new_from_indices(gint *indices, gint len)
{
- switch (len)
- {
- case 1:
- return gtk_tree_path_new_from_indices(
- indices[0], -1);
- case 2:
- return gtk_tree_path_new_from_indices(
- indices[0], indices[1], -1);
- case 3:
- return gtk_tree_path_new_from_indices(
- indices[0], indices[1], indices[2], -1);
- case 4:
- return gtk_tree_path_new_from_indices(
- indices[0], indices[1], indices[2], indices[3], -1);
- case 5:
- return gtk_tree_path_new_from_indices(
- indices[0], indices[1], indices[2], indices[3], indices[4], -1);
- default:
- return NULL;
- }
+ switch (len)
+ {
+ case 1:
+ return gtk_tree_path_new_from_indices(
+ indices[0], -1);
+ case 2:
+ return gtk_tree_path_new_from_indices(
+ indices[0], indices[1], -1);
+ case 3:
+ return gtk_tree_path_new_from_indices(
+ indices[0], indices[1], indices[2], -1);
+ case 4:
+ return gtk_tree_path_new_from_indices(
+ indices[0], indices[1], indices[2], indices[3], -1);
+ case 5:
+ return gtk_tree_path_new_from_indices(
+ indices[0], indices[1], indices[2], indices[3], indices[4], -1);
+ default:
+ return NULL;
+ }
}
GValue*
ghb_parse_preset_path(const gchar *path)
{
- gchar **split;
- GValue *preset;
- gint ii;
-
- preset = ghb_array_value_new(MAX_NESTED_PRESET);
- split = g_strsplit(path, "#", MAX_NESTED_PRESET);
- for (ii = 0; split[ii] != NULL; ii++)
- {
- ghb_array_append(preset, ghb_string_value_new(split[ii]));
- }
- g_strfreev(split);
- return preset;
+ gchar **split;
+ GValue *preset;
+ gint ii;
+
+ preset = ghb_array_value_new(MAX_NESTED_PRESET);
+ split = g_strsplit(path, "#", MAX_NESTED_PRESET);
+ for (ii = 0; split[ii] != NULL; ii++)
+ {
+ ghb_array_append(preset, ghb_string_value_new(split[ii]));
+ }
+ g_strfreev(split);
+ return preset;
}
static GValue*
preset_path_from_indices(GValue *presets, gint *indices, gint len)
{
- gint ii;
- GValue *path;
-
- g_debug("preset_path_from_indices");
- path = ghb_array_value_new(MAX_NESTED_PRESET);
- for (ii = 0; ii < len; ii++)
- {
- GValue *dict;
- gint count, folder;
- const GValue *name;
-
- count = ghb_array_len(presets);
- if (indices[ii] >= count) break;
- dict = ghb_array_get_nth(presets, indices[ii]);
- name = ghb_dict_lookup(dict, "PresetName");
- if (name)
- ghb_array_append(path, ghb_value_dup(name));
- folder = ghb_value_boolean(preset_dict_get_value(dict, "Folder"));
- if (!folder)
- break;
- presets = ghb_dict_lookup(dict, "ChildrenArray");
- }
- return path;
+ gint ii;
+ GValue *path;
+
+ g_debug("preset_path_from_indices");
+ path = ghb_array_value_new(MAX_NESTED_PRESET);
+ for (ii = 0; ii < len; ii++)
+ {
+ GValue *dict;
+ gint count, folder;
+ const GValue *name;
+
+ count = ghb_array_len(presets);
+ if (indices[ii] >= count) break;
+ dict = ghb_array_get_nth(presets, indices[ii]);
+ name = ghb_dict_lookup(dict, "PresetName");
+ if (name)
+ ghb_array_append(path, ghb_value_dup(name));
+ folder = ghb_value_boolean(preset_dict_get_value(dict, "Folder"));
+ if (!folder)
+ break;
+ presets = ghb_dict_lookup(dict, "ChildrenArray");
+ }
+ return path;
}
gchar*
ghb_preset_path_string(const GValue *path)
{
- gint count, ii;
- GString *gstr;
- GValue *val;
- gchar *str;
-
- gstr = g_string_new("");
- if (path != NULL)
- {
- count = ghb_array_len(path);
- for (ii = 0; ii < count; ii++)
- {
- val = ghb_array_get_nth(path, ii);
- str = ghb_value_string(val);
- g_string_append(gstr, str);
- if (ii < count-1)
- g_string_append(gstr, "->");
- g_free(str);
- }
- }
- str = g_string_free(gstr, FALSE);
- return str;
+ gint count, ii;
+ GString *gstr;
+ GValue *val;
+ gchar *str;
+
+ gstr = g_string_new("");
+ if (path != NULL)
+ {
+ count = ghb_array_len(path);
+ for (ii = 0; ii < count; ii++)
+ {
+ val = ghb_array_get_nth(path, ii);
+ str = ghb_value_string(val);
+ g_string_append(gstr, str);
+ if (ii < count-1)
+ g_string_append(gstr, "->");
+ g_free(str);
+ }
+ }
+ str = g_string_free(gstr, FALSE);
+ return str;
}
void
dump_preset_path(const gchar *msg, const GValue *path)
{
- gchar *str;
+ gchar *str;
- if (path)
- debug_show_type (G_VALUE_TYPE(path));
- str = ghb_preset_path_string(path);
- g_message("%s path: (%s)", msg, str);
- g_free(str);
+ if (path)
+ debug_show_type (G_VALUE_TYPE(path));
+ str = ghb_preset_path_string(path);
+ g_message("%s path: (%s)", msg, str);
+ g_free(str);
}
void
dump_preset_indices(const gchar *msg, gint *indices, gint len)
{
- gint ii;
+ gint ii;
- g_message("%s indices: len %d", msg, len);
- for (ii = 0; ii < len; ii++)
- {
- printf("%d ", indices[ii]);
- }
- printf("\n");
+ g_message("%s indices: len %d", msg, len);
+ for (ii = 0; ii < len; ii++)
+ {
+ printf("%d ", indices[ii]);
+ }
+ printf("\n");
}
#if 0
static gint
preset_path_cmp(const GValue *path1, const GValue *path2)
{
- gint count, ii;
- GValue *val;
- gchar *str1, *str2;
- gint result;
-
- count = ghb_array_len(path1);
- ii = ghb_array_len(path2);
- if (ii != count)
- return ii - count;
- for (ii = 0; ii < count; ii++)
- {
- val = ghb_array_get_nth(path1, ii);
- str1 = ghb_value_string(val);
- val = ghb_array_get_nth(path2, ii);
- str2 = ghb_value_string(val);
- result = strcmp(str1, str2);
- if (result != 0)
- return result;
- g_free(str1);
- g_free(str2);
- }
- return 0;
+ gint count, ii;
+ GValue *val;
+ gchar *str1, *str2;
+ gint result;
+
+ count = ghb_array_len(path1);
+ ii = ghb_array_len(path2);
+ if (ii != count)
+ return ii - count;
+ for (ii = 0; ii < count; ii++)
+ {
+ val = ghb_array_get_nth(path1, ii);
+ str1 = ghb_value_string(val);
+ val = ghb_array_get_nth(path2, ii);
+ str2 = ghb_value_string(val);
+ result = strcmp(str1, str2);
+ if (result != 0)
+ return result;
+ g_free(str1);
+ g_free(str2);
+ }
+ return 0;
}
#endif
static GValue*
presets_get_dict(GValue *presets, gint *indices, gint len)
{
- gint ii, count, folder;
- GValue *dict = NULL;
-
- g_debug("presets_get_dict ()");
- for (ii = 0; ii < len; ii++)
- {
- count = ghb_array_len(presets);
- if (indices[ii] >= count) return NULL;
- dict = ghb_array_get_nth(presets, indices[ii]);
- if (ii < len-1)
- {
- folder = ghb_value_boolean(preset_dict_get_value(dict, "Folder"));
- if (!folder)
- return NULL;
- presets = ghb_dict_lookup(dict, "ChildrenArray");
- }
- }
- if (ii < len)
- return NULL;
- return dict;
+ gint ii, count, folder;
+ GValue *dict = NULL;
+
+ g_debug("presets_get_dict ()");
+ for (ii = 0; ii < len; ii++)
+ {
+ count = ghb_array_len(presets);
+ if (indices[ii] >= count) return NULL;
+ dict = ghb_array_get_nth(presets, indices[ii]);
+ if (ii < len-1)
+ {
+ folder = ghb_value_boolean(preset_dict_get_value(dict, "Folder"));
+ if (!folder)
+ return NULL;
+ presets = ghb_dict_lookup(dict, "ChildrenArray");
+ }
+ }
+ if (ii < len)
+ return NULL;
+ return dict;
}
static GValue*
presets_get_folder(GValue *presets, gint *indices, gint len)
{
- gint ii, count, folder;
- GValue *dict;
-
- g_debug("presets_get_folder ()");
- for (ii = 0; ii < len; ii++)
- {
- count = ghb_array_len(presets);
- if (indices[ii] >= count) return NULL;
- dict = ghb_array_get_nth(presets, indices[ii]);
- folder = ghb_value_boolean(preset_dict_get_value(dict, "Folder"));
- if (!folder)
- break;
- presets = ghb_dict_lookup(dict, "ChildrenArray");
- }
- if (ii < len)
- return NULL;
- return presets;
+ gint ii, count, folder;
+ GValue *dict;
+
+ g_debug("presets_get_folder ()");
+ for (ii = 0; ii < len; ii++)
+ {
+ count = ghb_array_len(presets);
+ if (indices[ii] >= count) return NULL;
+ dict = ghb_array_get_nth(presets, indices[ii]);
+ folder = ghb_value_boolean(preset_dict_get_value(dict, "Folder"));
+ if (!folder)
+ break;
+ presets = ghb_dict_lookup(dict, "ChildrenArray");
+ }
+ if (ii < len)
+ return NULL;
+ return presets;
}
static GValue*
plist_get_dict(GValue *presets, const gchar *name)
{
- if (presets == NULL || name == NULL) return NULL;
- return ghb_dict_lookup(presets, name);
+ if (presets == NULL || name == NULL) return NULL;
+ return ghb_dict_lookup(presets, name);
}
static const gchar*
preset_get_name(GValue *dict)
{
- return g_value_get_string(preset_dict_get_value(dict, "PresetName"));
+ return g_value_get_string(preset_dict_get_value(dict, "PresetName"));
}
static gboolean
preset_folder_is_open(GValue *dict)
{
- const GValue *gval;
+ const GValue *gval;
- gval = preset_dict_get_value(dict, "FolderOpen");
- if (gval != NULL)
- return g_value_get_boolean(gval);
- return FALSE;
+ gval = preset_dict_get_value(dict, "FolderOpen");
+ if (gval != NULL)
+ return g_value_get_boolean(gval);
+ return FALSE;
}
gboolean
ghb_preset_folder(GValue *dict)
{
- return ghb_value_int(preset_dict_get_value(dict, "Folder"));
+ return ghb_value_int(preset_dict_get_value(dict, "Folder"));
}
gint
ghb_preset_type(GValue *dict)
{
- return ghb_value_int(preset_dict_get_value(dict, "Type"));
+ return ghb_value_int(preset_dict_get_value(dict, "Type"));
}
static void
presets_remove_nth(GValue *presets, gint pos)
{
- GValue *dict;
- gint count;
-
- if (presets == NULL || pos < 0) return;
- count = ghb_array_len(presets);
- if (pos >= count) return;
- dict = ghb_array_get_nth(presets, pos);
- ghb_array_remove(presets, pos);
- ghb_value_free(dict);
+ GValue *dict;
+ gint count;
+
+ if (presets == NULL || pos < 0) return;
+ count = ghb_array_len(presets);
+ if (pos >= count) return;
+ dict = ghb_array_get_nth(presets, pos);
+ ghb_array_remove(presets, pos);
+ ghb_value_free(dict);
}
gboolean
ghb_presets_remove(
- GValue *presets,
- gint *indices,
- gint len)
-{
- GValue *folder = NULL;
-
- folder = presets_get_folder(presets, indices, len-1);
- if (folder)
- presets_remove_nth(folder, indices[len-1]);
- else
- {
- g_warning("ghb_presets_remove (): internal preset lookup error");
- return FALSE;
- }
- return TRUE;
+ GValue *presets,
+ gint *indices,
+ gint len)
+{
+ GValue *folder = NULL;
+
+ folder = presets_get_folder(presets, indices, len-1);
+ if (folder)
+ presets_remove_nth(folder, indices[len-1]);
+ else
+ {
+ g_warning("ghb_presets_remove (): internal preset lookup error");
+ return FALSE;
+ }
+ return TRUE;
}
static void
ghb_presets_replace(
- GValue *presets,
- GValue *dict,
- gint *indices,
- gint len)
-{
- GValue *folder = NULL;
-
- folder = presets_get_folder(presets, indices, len-1);
- if (folder)
- ghb_array_replace(folder, indices[len-1], dict);
- else
- {
- g_warning("ghb_presets_replace (): internal preset lookup error");
- }
+ GValue *presets,
+ GValue *dict,
+ gint *indices,
+ gint len)
+{
+ GValue *folder = NULL;
+
+ folder = presets_get_folder(presets, indices, len-1);
+ if (folder)
+ ghb_array_replace(folder, indices[len-1], dict);
+ else
+ {
+ g_warning("ghb_presets_replace (): internal preset lookup error");
+ }
}
static void
ghb_presets_insert(
- GValue *presets,
- GValue *dict,
- gint *indices,
- gint len)
-{
- GValue *folder = NULL;
-
- folder = presets_get_folder(presets, indices, len-1);
- if (folder)
- ghb_array_insert(folder, indices[len-1], dict);
- else
- {
- g_warning("ghb_presets_insert (): internal preset lookup error");
- }
+ GValue *presets,
+ GValue *dict,
+ gint *indices,
+ gint len)
+{
+ GValue *folder = NULL;
+
+ folder = presets_get_folder(presets, indices, len-1);
+ if (folder)
+ ghb_array_insert(folder, indices[len-1], dict);
+ else
+ {
+ g_warning("ghb_presets_insert (): internal preset lookup error");
+ }
}
static gint
presets_find_element(GValue *presets, const gchar *name)
{
- GValue *dict;
- gint count, ii;
-
- g_debug("presets_find_element () (%s)", name);
- if (presets == NULL || name == NULL) return -1;
- count = ghb_array_len(presets);
- for (ii = 0; ii < count; ii++)
- {
- const gchar *str;
- dict = ghb_array_get_nth(presets, ii);
- str = preset_get_name(dict);
- if (strcmp(name, str) == 0)
- {
- return ii;
- }
- }
- return -1;
+ GValue *dict;
+ gint count, ii;
+
+ g_debug("presets_find_element () (%s)", name);
+ if (presets == NULL || name == NULL) return -1;
+ count = ghb_array_len(presets);
+ for (ii = 0; ii < count; ii++)
+ {
+ const gchar *str;
+ dict = ghb_array_get_nth(presets, ii);
+ str = preset_get_name(dict);
+ if (strcmp(name, str) == 0)
+ {
+ return ii;
+ }
+ }
+ return -1;
}
static gint
single_find_pos(GValue *presets, const gchar *name, gint type)
{
- GValue *dict;
- gint count, ii, ptype, last;
-
- if (presets == NULL || name == NULL) return -1;
- last = count = ghb_array_len(presets);
- for (ii = 0; ii < count; ii++)
- {
- const gchar *str;
- dict = ghb_array_get_nth(presets, ii);
- str = preset_get_name(dict);
- ptype = ghb_value_int(preset_dict_get_value(dict, "Type"));
- if (strcasecmp(name, str) <= 0 && ptype == type)
- {
- return ii;
- }
- if (ptype == type)
- last = ii+1;
- }
- return last;
+ GValue *dict;
+ gint count, ii, ptype, last;
+
+ if (presets == NULL || name == NULL) return -1;
+ last = count = ghb_array_len(presets);
+ for (ii = 0; ii < count; ii++)
+ {
+ const gchar *str;
+ dict = ghb_array_get_nth(presets, ii);
+ str = preset_get_name(dict);
+ ptype = ghb_value_int(preset_dict_get_value(dict, "Type"));
+ if (strcasecmp(name, str) <= 0 && ptype == type)
+ {
+ return ii;
+ }
+ if (ptype == type)
+ last = ii+1;
+ }
+ return last;
}
static gint*
presets_find_pos(const GValue *path, gint type, gint *len)
{
- GValue *nested;
- GValue *val;
- gint count, ii;
- gboolean folder;
- gint *indices = NULL;
- const gchar *name;
- GValue *dict;
-
- g_debug("presets_find_pos () ");
- nested = presetsPlist;
- count = ghb_array_len(path);
- indices = g_malloc(MAX_NESTED_PRESET * sizeof(gint));
- for (ii = 0; ii < count-1; ii++)
- {
- val = ghb_array_get_nth(path, ii);
- name = g_value_get_string(val);
- indices[ii] = presets_find_element(nested, name);
- if (indices[ii] == -1) {
- g_free(indices);
- return NULL;
- }
- dict = ghb_array_get_nth(nested, indices[ii]);
- folder = ghb_value_boolean(preset_dict_get_value(dict, "Folder"));
- nested = NULL;
- if (!folder)
- break;
- nested = ghb_dict_lookup(dict, "ChildrenArray");
- }
- if (nested)
- {
- const gchar *name;
-
- name = g_value_get_string(ghb_array_get_nth(path, count-1));
- indices[ii] = single_find_pos(nested, name, type);
- ii++;
- }
- *len = ii;
- return indices;
+ GValue *nested;
+ GValue *val;
+ gint count, ii;
+ gboolean folder;
+ gint *indices = NULL;
+ const gchar *name;
+ GValue *dict;
+
+ g_debug("presets_find_pos () ");
+ nested = presetsPlist;
+ count = ghb_array_len(path);
+ indices = g_malloc(MAX_NESTED_PRESET * sizeof(gint));
+ for (ii = 0; ii < count-1; ii++)
+ {
+ val = ghb_array_get_nth(path, ii);
+ name = g_value_get_string(val);
+ indices[ii] = presets_find_element(nested, name);
+ if (indices[ii] == -1) {
+ g_free(indices);
+ return NULL;
+ }
+ dict = ghb_array_get_nth(nested, indices[ii]);
+ folder = ghb_value_boolean(preset_dict_get_value(dict, "Folder"));
+ nested = NULL;
+ if (!folder)
+ break;
+ nested = ghb_dict_lookup(dict, "ChildrenArray");
+ }
+ if (nested)
+ {
+ const gchar *name;
+
+ name = g_value_get_string(ghb_array_get_nth(path, count-1));
+ indices[ii] = single_find_pos(nested, name, type);
+ ii++;
+ }
+ *len = ii;
+ return indices;
}
static gint
preset_tree_depth(GValue *dict)
{
- gboolean folder;
-
- folder = ghb_value_boolean(preset_dict_get_value(dict, "Folder"));
- if (folder)
- {
- gint depth = 0;
- gint count, ii;
- GValue *presets;
-
- presets = ghb_dict_lookup(dict, "ChildrenArray");
- count = ghb_array_len(presets);
- for (ii = 0; ii < count; ii++)
- {
- gint tmp;
-
- dict = ghb_array_get_nth(presets, ii);
- tmp = preset_tree_depth(dict);
- depth = MAX(depth, tmp);
- }
- return depth + 1;
- }
- else
- {
- return 1;
- }
+ gboolean folder;
+
+ folder = ghb_value_boolean(preset_dict_get_value(dict, "Folder"));
+ if (folder)
+ {
+ gint depth = 0;
+ gint count, ii;
+ GValue *presets;
+
+ presets = ghb_dict_lookup(dict, "ChildrenArray");
+ count = ghb_array_len(presets);
+ for (ii = 0; ii < count; ii++)
+ {
+ gint tmp;
+
+ dict = ghb_array_get_nth(presets, ii);
+ tmp = preset_tree_depth(dict);
+ depth = MAX(depth, tmp);
+ }
+ return depth + 1;
+ }
+ else
+ {
+ return 1;
+ }
}
static gboolean
preset_is_default(GValue *dict)
{
- const GValue *val;
+ const GValue *val;
- val = preset_dict_get_value(dict, "Default");
- return ghb_value_boolean(val);
+ val = preset_dict_get_value(dict, "Default");
+ return ghb_value_boolean(val);
}
static void
presets_clear_default(GValue *presets)
{
- gint count, ii;
-
- count = ghb_array_len(presets);
- for (ii = 0; ii < count; ii++)
- {
- GValue *dict;
- gboolean folder;
-
- dict = ghb_array_get_nth(presets, ii);
- folder = ghb_value_boolean(preset_dict_get_value(dict, "Folder"));
- if (folder)
- {
- GValue *nested;
-
- nested = ghb_dict_lookup(dict, "ChildrenArray");
- presets_clear_default(nested);
- }
- else
- {
- if (preset_is_default(dict))
- {
- ghb_dict_insert(dict, g_strdup("Default"),
- ghb_boolean_value_new(FALSE));
- }
- }
- }
+ gint count, ii;
+
+ count = ghb_array_len(presets);
+ for (ii = 0; ii < count; ii++)
+ {
+ GValue *dict;
+ gboolean folder;
+
+ dict = ghb_array_get_nth(presets, ii);
+ folder = ghb_value_boolean(preset_dict_get_value(dict, "Folder"));
+ if (folder)
+ {
+ GValue *nested;
+
+ nested = ghb_dict_lookup(dict, "ChildrenArray");
+ presets_clear_default(nested);
+ }
+ else
+ {
+ if (preset_is_default(dict))
+ {
+ ghb_dict_insert(dict, g_strdup("Default"),
+ ghb_boolean_value_new(FALSE));
+ }
+ }
+ }
}
static void
presets_customize(GValue *presets)
{
- gint count, ii;
-
- count = ghb_array_len(presets);
- for (ii = 0; ii < count; ii++)
- {
- GValue *dict;
- gboolean folder;
- gint ptype;
-
- dict = ghb_array_get_nth(presets, ii);
-
- ptype = ghb_value_int(preset_dict_get_value(dict, "Type"));
- if (ptype != PRESETS_CUSTOM)
- {
- ghb_dict_insert(dict, g_strdup("Type"),
- ghb_int64_value_new(PRESETS_CUSTOM));
- }
- folder = ghb_value_boolean(preset_dict_get_value(dict, "Folder"));
- if (folder)
- {
- GValue *nested;
-
- nested = ghb_dict_lookup(dict, "ChildrenArray");
- presets_customize(nested);
- }
- }
+ gint count, ii;
+
+ count = ghb_array_len(presets);
+ for (ii = 0; ii < count; ii++)
+ {
+ GValue *dict;
+ gboolean folder;
+ gint ptype;
+
+ dict = ghb_array_get_nth(presets, ii);
+
+ ptype = ghb_value_int(preset_dict_get_value(dict, "Type"));
+ if (ptype != PRESETS_CUSTOM)
+ {
+ ghb_dict_insert(dict, g_strdup("Type"),
+ ghb_int64_value_new(PRESETS_CUSTOM));
+ }
+ folder = ghb_value_boolean(preset_dict_get_value(dict, "Folder"));
+ if (folder)
+ {
+ GValue *nested;
+
+ nested = ghb_dict_lookup(dict, "ChildrenArray");
+ presets_customize(nested);
+ }
+ }
}
static gint*
presets_find_default2(GValue *presets, gint *len)
{
- gint count, ii;
- gint *indices;
-
- count = ghb_array_len(presets);
- for (ii = 0; ii < count; ii++)
- {
- GValue *dict;
- gboolean folder;
-
- dict = ghb_array_get_nth(presets, ii);
- folder = ghb_value_boolean(preset_dict_get_value(dict, "Folder"));
- if (folder)
- {
- GValue *nested;
- gint pos = *len;
-
- nested = ghb_dict_lookup(dict, "ChildrenArray");
- (*len)++;
- indices = presets_find_default2(nested, len);
- if (indices)
- {
- indices[pos] = ii;
- return indices;
- }
- else
- *len = pos;
- }
- else
- {
- if (preset_is_default(dict))
- {
- indices = g_malloc(MAX_NESTED_PRESET * sizeof(gint));
- indices[*len] = ii;
- (*len)++;
- return indices;
- }
- }
- }
- return NULL;
+ gint count, ii;
+ gint *indices;
+
+ count = ghb_array_len(presets);
+ for (ii = 0; ii < count; ii++)
+ {
+ GValue *dict;
+ gboolean folder;
+
+ dict = ghb_array_get_nth(presets, ii);
+ folder = ghb_value_boolean(preset_dict_get_value(dict, "Folder"));
+ if (folder)
+ {
+ GValue *nested;
+ gint pos = *len;
+
+ nested = ghb_dict_lookup(dict, "ChildrenArray");
+ (*len)++;
+ indices = presets_find_default2(nested, len);
+ if (indices)
+ {
+ indices[pos] = ii;
+ return indices;
+ }
+ else
+ *len = pos;
+ }
+ else
+ {
+ if (preset_is_default(dict))
+ {
+ indices = g_malloc(MAX_NESTED_PRESET * sizeof(gint));
+ indices[*len] = ii;
+ (*len)++;
+ return indices;
+ }
+ }
+ }
+ return NULL;
}
static gint*
presets_find_default(GValue *presets, gint *len)
{
- *len = 0;
- return presets_find_default2(presets, len);
+ *len = 0;
+ return presets_find_default2(presets, len);
}
gint*
ghb_preset_indices_from_path(
- GValue *presets,
- const GValue *path,
- gint *len)
-{
- GValue *nested;
- GValue *val;
- gint count, ii;
- gint *indices = NULL;
- const gchar *name;
- GValue *dict;
- gboolean folder;
-
- g_debug("ghb_preset_indices_from_path () ");
- nested = presets;
- count = ghb_array_len(path);
- if (count)
- indices = g_malloc(MAX_NESTED_PRESET * sizeof(gint));
- *len = 0;
- for (ii = 0; ii < count; ii++)
- {
- val = ghb_array_get_nth(path, ii);
- name = g_value_get_string(val);
- indices[ii] = presets_find_element(nested, name);
- if (indices[ii] == -1)
- {
- g_free(indices);
- return NULL;
- }
- if (ii < count-1)
- {
- dict = ghb_array_get_nth(nested, indices[ii]);
- folder = ghb_value_boolean(preset_dict_get_value(dict, "Folder"));
- if (!folder)
- {
- g_free(indices);
- return NULL;
- }
- nested = ghb_dict_lookup(dict, "ChildrenArray");
- }
- }
- *len = ii;
- return indices;
+ GValue *presets,
+ const GValue *path,
+ gint *len)
+{
+ GValue *nested;
+ GValue *val;
+ gint count, ii;
+ gint *indices = NULL;
+ const gchar *name;
+ GValue *dict;
+ gboolean folder;
+
+ g_debug("ghb_preset_indices_from_path () ");
+ nested = presets;
+ count = ghb_array_len(path);
+ if (count)
+ indices = g_malloc(MAX_NESTED_PRESET * sizeof(gint));
+ *len = 0;
+ for (ii = 0; ii < count; ii++)
+ {
+ val = ghb_array_get_nth(path, ii);
+ name = g_value_get_string(val);
+ indices[ii] = presets_find_element(nested, name);
+ if (indices[ii] == -1)
+ {
+ g_free(indices);
+ return NULL;
+ }
+ if (ii < count-1)
+ {
+ dict = ghb_array_get_nth(nested, indices[ii]);
+ folder = ghb_value_boolean(preset_dict_get_value(dict, "Folder"));
+ if (!folder)
+ {
+ g_free(indices);
+ return NULL;
+ }
+ nested = ghb_dict_lookup(dict, "ChildrenArray");
+ }
+ }
+ *len = ii;
+ return indices;
}
static gint
ghb_presets_get_type(
- GValue *presets,
- gint *indices,
- gint len)
-{
- GValue *dict;
- gint type = 0;
-
- dict = presets_get_dict(presets, indices, len);
- if (dict)
- {
- type = ghb_preset_type(dict);
- }
- else
- {
- g_warning("ghb_presets_get_type (): internal preset lookup error");
- }
- return type;
+ GValue *presets,
+ gint *indices,
+ gint len)
+{
+ GValue *dict;
+ gint type = 0;
+
+ dict = presets_get_dict(presets, indices, len);
+ if (dict)
+ {
+ type = ghb_preset_type(dict);
+ }
+ else
+ {
+ g_warning("ghb_presets_get_type (): internal preset lookup error");
+ }
+ return type;
}
static gboolean
ghb_presets_get_folder(
- GValue *presets,
- gint *indices,
- gint len)
-{
- GValue *dict;
- gboolean folder = FALSE;
-
- dict = presets_get_dict(presets, indices, len);
- if (dict)
- {
- folder = ghb_preset_folder(dict);
- }
- else
- {
- g_warning("ghb_presets_get_folder (): internal preset lookup error");
- }
- return folder;
+ GValue *presets,
+ gint *indices,
+ gint len)
+{
+ GValue *dict;
+ gboolean folder = FALSE;
+
+ dict = presets_get_dict(presets, indices, len);
+ if (dict)
+ {
+ folder = ghb_preset_folder(dict);
+ }
+ else
+ {
+ g_warning("ghb_presets_get_folder (): internal preset lookup error");
+ }
+ return folder;
}
void
presets_set_default(gint *indices, gint len)
{
- GValue *dict;
-
- g_debug("presets_set_default ()");
- presets_clear_default(presetsPlist);
- dict = presets_get_dict(presetsPlist, indices, len);
- if (dict)
- {
- ghb_dict_insert(dict, g_strdup("Default"), ghb_boolean_value_new(TRUE));
- }
- store_presets();
+ GValue *dict;
+
+ g_debug("presets_set_default ()");
+ presets_clear_default(presetsPlist);
+ dict = presets_get_dict(presetsPlist, indices, len);
+ if (dict)
+ {
+ ghb_dict_insert(dict, g_strdup("Default"), ghb_boolean_value_new(TRUE));
+ }
+ store_presets();
}
static void
presets_set_folder_open(gboolean open, gint *indices, gint len)
{
- GValue *dict;
-
- g_debug("presets_set_folder_open ()");
- dict = presets_get_dict(presetsPlist, indices, len);
- if (dict)
- {
- ghb_dict_insert(dict, g_strdup("FolderOpen"),
- ghb_boolean_value_new(open));
- }
+ GValue *dict;
+
+ g_debug("presets_set_folder_open ()");
+ dict = presets_get_dict(presetsPlist, indices, len);
+ if (dict)
+ {
+ ghb_dict_insert(dict, g_strdup("FolderOpen"),
+ ghb_boolean_value_new(open));
+ }
}
// Used for sorting dictionaries.
gint
key_cmp(gconstpointer a, gconstpointer b)
{
- gchar *stra = (gchar*)a;
- gchar *strb = (gchar*)b;
+ gchar *stra = (gchar*)a;
+ gchar *strb = (gchar*)b;
- return strcmp(stra, strb);
+ return strcmp(stra, strb);
}
static const GValue*
preset_dict_get_value(GValue *dict, const gchar *key)
{
- const GValue *gval = NULL;
-
- if (dict)
- {
- gval = ghb_dict_lookup(dict, key);
- }
- if (internalPlist == NULL) return NULL;
- if (gval == NULL)
- {
- dict = plist_get_dict(internalPlist, "Presets");
- if (dict == NULL) return NULL;
- gval = ghb_dict_lookup(dict, key);
- }
- return gval;
+ const GValue *gval = NULL;
+
+ if (dict)
+ {
+ gval = ghb_dict_lookup(dict, key);
+ }
+ if (internalPlist == NULL) return NULL;
+ if (gval == NULL)
+ {
+ dict = plist_get_dict(internalPlist, "Presets");
+ if (dict == NULL) return NULL;
+ gval = ghb_dict_lookup(dict, key);
+ }
+ return gval;
}
const gchar*
ghb_presets_get_description(GValue *pdict)
{
- const gchar *desc;
+ const gchar *desc;
- if (pdict == NULL) return NULL;
- desc = g_value_get_string(
- preset_dict_get_value(pdict, "PresetDescription"));
- if (desc[0] == 0) return NULL;
- return desc;
+ if (pdict == NULL) return NULL;
+ desc = g_value_get_string(
+ preset_dict_get_value(pdict, "PresetDescription"));
+ if (desc[0] == 0) return NULL;
+ return desc;
}
static void init_settings_from_dict(
- GValue *dest, GValue *internal, GValue *dict);
+ GValue *dest, GValue *internal, GValue *dict);
static void
init_settings_from_array(
- GValue *dest,
- GValue *internal,
- GValue *array)
-{
- GValue *gval, *val;
- gint count, ii;
-
- count = ghb_array_len(array);
- // The first element of the internal version is always the
- // template for the allowed values
- gval = ghb_array_get_nth(internal, 0);
- for (ii = 0; ii < count; ii++)
- {
- val = NULL;
- val = ghb_array_get_nth(array, ii);
- if (val == NULL)
- val = gval;
- if (G_VALUE_TYPE(gval) == ghb_dict_get_type())
- {
- GValue *new_dict;
- new_dict = ghb_dict_value_new();
- ghb_array_append(dest, new_dict);
- if (G_VALUE_TYPE(val) == ghb_dict_get_type())
- init_settings_from_dict(new_dict, gval, val);
- else
- init_settings_from_dict(new_dict, gval, gval);
- }
- else if (G_VALUE_TYPE(gval) == ghb_array_get_type())
- {
- GValue *new_array;
- new_array = ghb_array_value_new(8);
- ghb_array_append(dest, new_array);
- if (G_VALUE_TYPE(val) == ghb_array_get_type())
- init_settings_from_array(new_array, gval, val);
- else
- init_settings_from_array(new_array, gval, gval);
- }
- else
- {
- ghb_array_append(dest, val);
- }
- }
+ GValue *dest,
+ GValue *internal,
+ GValue *array)
+{
+ GValue *gval, *val;
+ gint count, ii;
+
+ count = ghb_array_len(array);
+ // The first element of the internal version is always the
+ // template for the allowed values
+ gval = ghb_array_get_nth(internal, 0);
+ for (ii = 0; ii < count; ii++)
+ {
+ val = NULL;
+ val = ghb_array_get_nth(array, ii);
+ if (val == NULL)
+ val = gval;
+ if (G_VALUE_TYPE(gval) == ghb_dict_get_type())
+ {
+ GValue *new_dict;
+ new_dict = ghb_dict_value_new();
+ ghb_array_append(dest, new_dict);
+ if (G_VALUE_TYPE(val) == ghb_dict_get_type())
+ init_settings_from_dict(new_dict, gval, val);
+ else
+ init_settings_from_dict(new_dict, gval, gval);
+ }
+ else if (G_VALUE_TYPE(gval) == ghb_array_get_type())
+ {
+ GValue *new_array;
+ new_array = ghb_array_value_new(8);
+ ghb_array_append(dest, new_array);
+ if (G_VALUE_TYPE(val) == ghb_array_get_type())
+ init_settings_from_array(new_array, gval, val);
+ else
+ init_settings_from_array(new_array, gval, gval);
+ }
+ else
+ {
+ ghb_array_append(dest, val);
+ }
+ }
}
static void
init_settings_from_dict(
- GValue *dest,
- GValue *internal,
- GValue *dict)
-{
- GHashTableIter iter;
- gchar *key;
- GValue *gval, *val;
-
- ghb_dict_iter_init(&iter, internal);
- // middle (void*) cast prevents gcc warning "defreferencing type-punned
- // pointer will break strict-aliasing rules"
- while (g_hash_table_iter_next(
- &iter, (gpointer*)(void*)&key, (gpointer*)(void*)&gval))
- {
- val = NULL;
- if (dict)
- val = ghb_dict_lookup(dict, key);
- if (val == NULL)
- val = gval;
- if (G_VALUE_TYPE(gval) == ghb_dict_get_type())
- {
- GValue *new_dict;
- new_dict = ghb_dict_value_new();
- ghb_settings_take_value(dest, key, new_dict);
- if (G_VALUE_TYPE(val) == ghb_dict_get_type())
- init_settings_from_dict(new_dict, gval, val);
- else
- init_settings_from_dict(new_dict, gval, gval);
- }
- else if (G_VALUE_TYPE(gval) == ghb_array_get_type())
- {
- GValue *new_array;
- new_array = ghb_array_value_new(8);
- ghb_settings_take_value(dest, key, new_array);
- if (G_VALUE_TYPE(val) == ghb_array_get_type())
- init_settings_from_array(new_array, gval, val);
- else
- init_settings_from_array(new_array, gval, gval);
-
- }
- else
- {
- ghb_settings_set_value(dest, key, val);
- }
- }
+ GValue *dest,
+ GValue *internal,
+ GValue *dict)
+{
+ GHashTableIter iter;
+ gchar *key;
+ GValue *gval, *val;
+
+ ghb_dict_iter_init(&iter, internal);
+ // middle (void*) cast prevents gcc warning "defreferencing type-punned
+ // pointer will break strict-aliasing rules"
+ while (g_hash_table_iter_next(
+ &iter, (gpointer*)(void*)&key, (gpointer*)(void*)&gval))
+ {
+ val = NULL;
+ if (dict)
+ val = ghb_dict_lookup(dict, key);
+ if (val == NULL)
+ val = gval;
+ if (G_VALUE_TYPE(gval) == ghb_dict_get_type())
+ {
+ GValue *new_dict;
+ new_dict = ghb_dict_value_new();
+ ghb_settings_take_value(dest, key, new_dict);
+ if (G_VALUE_TYPE(val) == ghb_dict_get_type())
+ init_settings_from_dict(new_dict, gval, val);
+ else
+ init_settings_from_dict(new_dict, gval, gval);
+ }
+ else if (G_VALUE_TYPE(gval) == ghb_array_get_type())
+ {
+ GValue *new_array;
+ new_array = ghb_array_value_new(8);
+ ghb_settings_take_value(dest, key, new_array);
+ if (G_VALUE_TYPE(val) == ghb_array_get_type())
+ init_settings_from_array(new_array, gval, val);
+ else
+ init_settings_from_array(new_array, gval, gval);
+
+ }
+ else
+ {
+ ghb_settings_set_value(dest, key, val);
+ }
+ }
}
static const char * dict_get_string(GValue *dict, const char *key)
@@ -883,29 +883,29 @@ static gboolean dict_get_boolean(GValue *dict, const char *key)
void
init_ui_from_dict(
- signal_user_data_t *ud,
- GValue *internal,
- GValue *dict)
-{
- GHashTableIter iter;
- gchar *key;
- GValue *gval, *val;
-
- ghb_dict_iter_init(&iter, internal);
- // middle (void*) cast prevents gcc warning "defreferencing type-punned
- // pointer will break strict-aliasing rules"
- while (g_hash_table_iter_next(
- &iter, (gpointer*)(void*)&key, (gpointer*)(void*)&gval))
- {
- if (!strcmp(key, "x264Option"))
+ signal_user_data_t *ud,
+ GValue *internal,
+ GValue *dict)
+{
+ GHashTableIter iter;
+ gchar *key;
+ GValue *gval, *val;
+
+ ghb_dict_iter_init(&iter, internal);
+ // middle (void*) cast prevents gcc warning "defreferencing type-punned
+ // pointer will break strict-aliasing rules"
+ while (g_hash_table_iter_next(
+ &iter, (gpointer*)(void*)&key, (gpointer*)(void*)&gval))
+ {
+ if (!strcmp(key, "x264Option"))
continue;
- val = NULL;
- if (dict)
- val = ghb_dict_lookup(dict, key);
- if (val == NULL)
- val = gval;
- ghb_ui_update(ud, key, val);
- }
+ val = NULL;
+ if (dict)
+ val = ghb_dict_lookup(dict, key);
+ if (val == NULL)
+ val = gval;
+ ghb_ui_update(ud, key, val);
+ }
if (ghb_value_boolean(preset_dict_get_value(dict, "x264UseAdvancedOptions")))
@@ -919,53 +919,53 @@ init_ui_from_dict(
static void
preset_to_ui(signal_user_data_t *ud, GValue *dict)
{
- g_debug("preset_to_ui()\n");
- // Initialize the ui from presets file.
- GValue *internal, *hidden;
-
- // Get key list from internal default presets. This way we do not
- // load any unknown keys.
- if (internalPlist == NULL) return;
- internal = plist_get_dict(internalPlist, "Presets");
- hidden = plist_get_dict(internalPlist, "XlatPresets");
- // Setting a ui widget will cause the corresponding setting
- // to be set, but it also triggers a callback that can
- // have the side effect of using other settings values
- // that have not yet been set. So set *all* settings first
- // then update the ui.
- init_settings_from_dict(ud->settings, internal, dict);
- init_settings_from_dict(ud->settings, hidden, dict);
- init_ui_from_dict(ud, internal, dict);
- init_ui_from_dict(ud, hidden, dict);
-
- if (dict != NULL)
- {
- GValue *val;
- gboolean dd;
-
- val = ghb_dict_lookup(dict, "PictureDecombDeinterlace");
- if (val != NULL)
- {
- dd = ghb_value_boolean(val);
- ghb_ui_update(ud, "PictureDeinterlaceDecomb", ghb_boolean_value(!dd));
- }
- val = ghb_dict_lookup(dict, "PictureHeight");
- if (val != NULL)
- {
- ghb_ui_update(ud, "scale_height", val);
- }
- val = ghb_dict_lookup(dict, "PictureWidth");
- if (val != NULL)
- {
- ghb_ui_update(ud, "scale_width", val);
- }
- }
+ g_debug("preset_to_ui()\n");
+ // Initialize the ui from presets file.
+ GValue *internal, *hidden;
+
+ // Get key list from internal default presets. This way we do not
+ // load any unknown keys.
+ if (internalPlist == NULL) return;
+ internal = plist_get_dict(internalPlist, "Presets");
+ hidden = plist_get_dict(internalPlist, "XlatPresets");
+ // Setting a ui widget will cause the corresponding setting
+ // to be set, but it also triggers a callback that can
+ // have the side effect of using other settings values
+ // that have not yet been set. So set *all* settings first
+ // then update the ui.
+ init_settings_from_dict(ud->settings, internal, dict);
+ init_settings_from_dict(ud->settings, hidden, dict);
+ init_ui_from_dict(ud, internal, dict);
+ init_ui_from_dict(ud, hidden, dict);
+
+ if (dict != NULL)
+ {
+ GValue *val;
+ gboolean dd;
+
+ val = ghb_dict_lookup(dict, "PictureDecombDeinterlace");
+ if (val != NULL)
+ {
+ dd = ghb_value_boolean(val);
+ ghb_ui_update(ud, "PictureDeinterlaceDecomb", ghb_boolean_value(!dd));
+ }
+ val = ghb_dict_lookup(dict, "PictureHeight");
+ if (val != NULL)
+ {
+ ghb_ui_update(ud, "scale_height", val);
+ }
+ val = ghb_dict_lookup(dict, "PictureWidth");
+ if (val != NULL)
+ {
+ ghb_ui_update(ud, "scale_width", val);
+ }
+ }
}
void
ghb_settings_to_ui(signal_user_data_t *ud, GValue *dict)
{
- init_ui_from_dict(ud, dict, dict);
+ init_ui_from_dict(ud, dict, dict);
}
static GValue *current_preset = NULL;
@@ -973,222 +973,222 @@ static GValue *current_preset = NULL;
gboolean
ghb_preset_is_custom()
{
- const GValue *val;
+ const GValue *val;
- if (current_preset == NULL) return FALSE;
- val = preset_dict_get_value(current_preset, "Type");
- return (ghb_value_int(val) == 1);
+ if (current_preset == NULL) return FALSE;
+ val = preset_dict_get_value(current_preset, "Type");
+ return (ghb_value_int(val) == 1);
}
void
ghb_set_preset_from_indices(signal_user_data_t *ud, gint *indices, gint len)
{
- GValue *dict = NULL;
- gint fallback[2] = {0, -1};
-
- if (indices)
- dict = presets_get_dict(presetsPlist, indices, len);
- if (dict == NULL)
- {
- indices = fallback;
- len = 1;
- dict = presets_get_dict(presetsPlist, indices, len);
- }
- if (dict == NULL)
- {
- preset_to_ui(ud, NULL);
- current_preset = NULL;
- }
- else
- {
- GValue *path;
- gboolean folder;
-
- current_preset = dict;
- folder = ghb_value_boolean(preset_dict_get_value(dict, "Folder"));
- if (folder)
- preset_to_ui(ud, NULL);
- else
- preset_to_ui(ud, dict);
- path = preset_path_from_indices(presetsPlist, indices, len);
- ghb_settings_set_value(ud->settings, "preset", path);
- ghb_value_free(path);
- }
+ GValue *dict = NULL;
+ gint fallback[2] = {0, -1};
+
+ if (indices)
+ dict = presets_get_dict(presetsPlist, indices, len);
+ if (dict == NULL)
+ {
+ indices = fallback;
+ len = 1;
+ dict = presets_get_dict(presetsPlist, indices, len);
+ }
+ if (dict == NULL)
+ {
+ preset_to_ui(ud, NULL);
+ current_preset = NULL;
+ }
+ else
+ {
+ GValue *path;
+ gboolean folder;
+
+ current_preset = dict;
+ folder = ghb_value_boolean(preset_dict_get_value(dict, "Folder"));
+ if (folder)
+ preset_to_ui(ud, NULL);
+ else
+ preset_to_ui(ud, dict);
+ path = preset_path_from_indices(presetsPlist, indices, len);
+ ghb_settings_set_value(ud->settings, "preset", path);
+ ghb_value_free(path);
+ }
}
static const GValue*
curr_preset_get_value(const gchar *key)
{
- if (current_preset == NULL) return NULL;
- return preset_dict_get_value(current_preset, key);
+ if (current_preset == NULL) return NULL;
+ return preset_dict_get_value(current_preset, key);
}
void
ghb_update_from_preset(
- signal_user_data_t *ud,
- const gchar *key)
-{
- const GValue *gval;
-
- g_debug("ghb_update_from_preset() %s", key);
- gval = curr_preset_get_value(key);
- if (gval != NULL)
- {
- ghb_ui_update(ud, key, gval);
- }
+ signal_user_data_t *ud,
+ const gchar *key)
+{
+ const GValue *gval;
+
+ g_debug("ghb_update_from_preset() %s", key);
+ gval = curr_preset_get_value(key);
+ if (gval != NULL)
+ {
+ ghb_ui_update(ud, key, gval);
+ }
}
static void
ghb_select_preset2(
- GtkBuilder *builder,
- gint *indices,
- gint len)
-{
- GtkTreeView *treeview;
- GtkTreeSelection *selection;
- GtkTreeModel *store;
- GtkTreeIter iter;
- GtkTreePath *path;
-
- g_debug("ghb_select_preset2()");
- treeview = GTK_TREE_VIEW(GHB_WIDGET(builder, "presets_list"));
- selection = gtk_tree_view_get_selection (treeview);
- store = gtk_tree_view_get_model (treeview);
- path = ghb_tree_path_new_from_indices(indices, len);
- if (path)
- {
- if (gtk_tree_model_get_iter(store, &iter, path))
- {
- gtk_tree_selection_select_iter (selection, &iter);
- }
- else
- {
- if (gtk_tree_model_get_iter_first(store, &iter))
- gtk_tree_selection_select_iter (selection, &iter);
- }
- gtk_tree_path_free(path);
- }
+ GtkBuilder *builder,
+ gint *indices,
+ gint len)
+{
+ GtkTreeView *treeview;
+ GtkTreeSelection *selection;
+ GtkTreeModel *store;
+ GtkTreeIter iter;
+ GtkTreePath *path;
+
+ g_debug("ghb_select_preset2()");
+ treeview = GTK_TREE_VIEW(GHB_WIDGET(builder, "presets_list"));
+ selection = gtk_tree_view_get_selection (treeview);
+ store = gtk_tree_view_get_model (treeview);
+ path = ghb_tree_path_new_from_indices(indices, len);
+ if (path)
+ {
+ if (gtk_tree_model_get_iter(store, &iter, path))
+ {
+ gtk_tree_selection_select_iter (selection, &iter);
+ }
+ else
+ {
+ if (gtk_tree_model_get_iter_first(store, &iter))
+ gtk_tree_selection_select_iter (selection, &iter);
+ }
+ gtk_tree_path_free(path);
+ }
}
void
ghb_select_preset(GtkBuilder *builder, const GValue *path)
{
- gint *indices, len;
+ gint *indices, len;
- g_debug("ghb_select_preset()");
- indices = ghb_preset_indices_from_path(presetsPlist, path, &len);
- if (indices)
- {
- ghb_select_preset2(builder, indices, len);
- g_free(indices);
- }
+ g_debug("ghb_select_preset()");
+ indices = ghb_preset_indices_from_path(presetsPlist, path, &len);
+ if (indices)
+ {
+ ghb_select_preset2(builder, indices, len);
+ g_free(indices);
+ }
}
void
ghb_select_default_preset(GtkBuilder *builder)
{
- gint *indices, len;
+ gint *indices, len;
- g_debug("ghb_select_default_preset()");
- indices = presets_find_default(presetsPlist, &len);
- if (indices)
- {
- ghb_select_preset2(builder, indices, len);
- g_free(indices);
- }
+ g_debug("ghb_select_default_preset()");
+ indices = presets_find_default(presetsPlist, &len);
+ if (indices)
+ {
+ ghb_select_preset2(builder, indices, len);
+ g_free(indices);
+ }
}
gchar*
ghb_get_user_config_dir(gchar *subdir)
{
- const gchar *dir;
- gchar *config;
-
- dir = g_get_user_config_dir();
- if (!g_file_test(dir, G_FILE_TEST_IS_DIR))
- {
- dir = g_get_home_dir();
- config = g_strdup_printf ("%s/.ghb", dir);
- if (!g_file_test(config, G_FILE_TEST_IS_DIR))
- g_mkdir (config, 0755);
- }
- else
- {
- config = g_strdup_printf ("%s/ghb", dir);
- if (!g_file_test(config, G_FILE_TEST_IS_DIR))
- g_mkdir (config, 0755);
- }
- if (subdir)
- {
- gchar **split;
- gint ii;
-
- split = g_strsplit(subdir, G_DIR_SEPARATOR_S, -1);
- for (ii = 0; split[ii] != NULL; ii++)
- {
- gchar *tmp;
-
- tmp = g_strdup_printf ("%s/%s", config, split[ii]);
- g_free(config);
- config = tmp;
- if (!g_file_test(config, G_FILE_TEST_IS_DIR))
- g_mkdir (config, 0755);
- }
- }
- return config;
+ const gchar *dir;
+ gchar *config;
+
+ dir = g_get_user_config_dir();
+ if (!g_file_test(dir, G_FILE_TEST_IS_DIR))
+ {
+ dir = g_get_home_dir();
+ config = g_strdup_printf ("%s/.ghb", dir);
+ if (!g_file_test(config, G_FILE_TEST_IS_DIR))
+ g_mkdir (config, 0755);
+ }
+ else
+ {
+ config = g_strdup_printf ("%s/ghb", dir);
+ if (!g_file_test(config, G_FILE_TEST_IS_DIR))
+ g_mkdir (config, 0755);
+ }
+ if (subdir)
+ {
+ gchar **split;
+ gint ii;
+
+ split = g_strsplit(subdir, G_DIR_SEPARATOR_S, -1);
+ for (ii = 0; split[ii] != NULL; ii++)
+ {
+ gchar *tmp;
+
+ tmp = g_strdup_printf ("%s/%s", config, split[ii]);
+ g_free(config);
+ config = tmp;
+ if (!g_file_test(config, G_FILE_TEST_IS_DIR))
+ g_mkdir (config, 0755);
+ }
+ }
+ return config;
}
static void
store_plist(GValue *plist, const gchar *name)
{
- gchar *config, *path;
- FILE *file;
+ gchar *config, *path;
+ FILE *file;
- config = ghb_get_user_config_dir(NULL);
- path = g_strdup_printf ("%s/%s", config, name);
- file = g_fopen(path, "w");
- g_free(config);
- g_free(path);
- ghb_plist_write(file, plist);
- fclose(file);
+ config = ghb_get_user_config_dir(NULL);
+ path = g_strdup_printf ("%s/%s", config, name);
+ file = g_fopen(path, "w");
+ g_free(config);
+ g_free(path);
+ ghb_plist_write(file, plist);
+ fclose(file);
}
static GValue*
load_plist(const gchar *name)
{
- gchar *config, *path;
- GValue *plist = NULL;
-
- config = ghb_get_user_config_dir(NULL);
- path = g_strdup_printf ("%s/%s", config, name);
- if (g_file_test(path, G_FILE_TEST_IS_REGULAR))
- {
- plist = ghb_plist_parse_file(path);
- }
- g_free(config);
- g_free(path);
- return plist;
+ gchar *config, *path;
+ GValue *plist = NULL;
+
+ config = ghb_get_user_config_dir(NULL);
+ path = g_strdup_printf ("%s/%s", config, name);
+ if (g_file_test(path, G_FILE_TEST_IS_REGULAR))
+ {
+ plist = ghb_plist_parse_file(path);
+ }
+ g_free(config);
+ g_free(path);
+ return plist;
}
gboolean
ghb_lock_file(const gchar *name)
{
#if !defined(_WIN32)
- gchar *config, *path;
- int fd, lock = 0;
-
- config = ghb_get_user_config_dir(NULL);
- path = g_strdup_printf ("%s/%s", config, name);
- fd = open(path, O_RDWR|O_CREAT, S_IRUSR|S_IWUSR);
- if (fd >= 0)
- lock = lockf(fd, F_TLOCK, 0);
- if (lock)
- close(fd);
- g_free(config);
- g_free(path);
- return !lock;
+ gchar *config, *path;
+ int fd, lock = 0;
+
+ config = ghb_get_user_config_dir(NULL);
+ path = g_strdup_printf ("%s/%s", config, name);
+ fd = open(path, O_RDWR|O_CREAT, S_IRUSR|S_IWUSR);
+ if (fd >= 0)
+ lock = lockf(fd, F_TLOCK, 0);
+ if (lock)
+ close(fd);
+ g_free(config);
+ g_free(path);
+ return !lock;
#else
- return 1;
+ return 1;
#endif
}
@@ -1196,122 +1196,122 @@ void
ghb_write_pid_file()
{
#if !defined(_WIN32)
- gchar *config, *path;
- pid_t pid;
- FILE *fp;
- int fd;
+ gchar *config, *path;
+ pid_t pid;
+ FILE *fp;
+ int fd;
- pid = getpid();
+ pid = getpid();
- config = ghb_get_user_config_dir(NULL);
- path = g_strdup_printf ("%s/ghb.pid.%d", config, pid);
+ config = ghb_get_user_config_dir(NULL);
+ path = g_strdup_printf ("%s/ghb.pid.%d", config, pid);
- fp = g_fopen(path, "w");
- fprintf(fp, "%d\n", pid);
- fclose(fp);
+ fp = g_fopen(path, "w");
+ fprintf(fp, "%d\n", pid);
+ fclose(fp);
- fd = open(path, O_RDWR|O_CREAT, S_IRUSR|S_IWUSR);
- lockf(fd, F_TLOCK, 0);
+ fd = open(path, O_RDWR|O_CREAT, S_IRUSR|S_IWUSR);
+ lockf(fd, F_TLOCK, 0);
- g_free(config);
- g_free(path);
+ g_free(config);
+ g_free(path);
#endif
}
void
ghb_unlink_pid_file(int pid)
{
- gchar *config, *path;
+ gchar *config, *path;
- config = ghb_get_user_config_dir(NULL);
- path = g_strdup_printf ("%s/ghb.pid.%d", config, pid);
+ config = ghb_get_user_config_dir(NULL);
+ path = g_strdup_printf ("%s/ghb.pid.%d", config, pid);
- if (g_file_test(path, G_FILE_TEST_IS_REGULAR))
- {
- g_unlink(path);
- }
+ if (g_file_test(path, G_FILE_TEST_IS_REGULAR))
+ {
+ g_unlink(path);
+ }
- g_free(config);
- g_free(path);
+ g_free(config);
+ g_free(path);
}
int
ghb_find_pid_file()
{
- const gchar *file;
- gchar *config;
-
- config = ghb_get_user_config_dir(NULL);
-
- if (g_file_test(config, G_FILE_TEST_IS_DIR))
- {
- GDir *gdir = g_dir_open(config, 0, NULL);
- file = g_dir_read_name(gdir);
- while (file)
- {
- if (strncmp(file, "ghb.pid.", 8) == 0)
- {
- gchar *path;
- pid_t my_pid;
- int pid;
-
- sscanf(file, "ghb.pid.%d", &pid);
- my_pid = getpid();
- if (my_pid == pid)
- {
- file = g_dir_read_name(gdir);
- continue;
- }
- path = g_strdup_printf("%s/%s", config, file);
+ const gchar *file;
+ gchar *config;
+
+ config = ghb_get_user_config_dir(NULL);
+
+ if (g_file_test(config, G_FILE_TEST_IS_DIR))
+ {
+ GDir *gdir = g_dir_open(config, 0, NULL);
+ file = g_dir_read_name(gdir);
+ while (file)
+ {
+ if (strncmp(file, "ghb.pid.", 8) == 0)
+ {
+ gchar *path;
+ pid_t my_pid;
+ int pid;
+
+ sscanf(file, "ghb.pid.%d", &pid);
+ my_pid = getpid();
+ if (my_pid == pid)
+ {
+ file = g_dir_read_name(gdir);
+ continue;
+ }
+ path = g_strdup_printf("%s/%s", config, file);
#if !defined(_WIN32)
- int fd, lock = 1;
-
- fd = open(path, O_RDWR);
- if (fd >= 0)
- {
- lock = lockf(fd, F_TLOCK, 0);
- }
- if (lock == 0)
- {
- close(fd);
- g_dir_close(gdir);
- g_unlink(path);
- g_free(path);
- g_free(config);
- return pid;
- }
- g_free(path);
- close(fd);
+ int fd, lock = 1;
+
+ fd = open(path, O_RDWR);
+ if (fd >= 0)
+ {
+ lock = lockf(fd, F_TLOCK, 0);
+ }
+ if (lock == 0)
+ {
+ close(fd);
+ g_dir_close(gdir);
+ g_unlink(path);
+ g_free(path);
+ g_free(config);
+ return pid;
+ }
+ g_free(path);
+ close(fd);
#else
- g_dir_close(gdir);
- g_unlink(path);
- g_free(path);
- g_free(config);
- return pid;
+ g_dir_close(gdir);
+ g_unlink(path);
+ g_free(path);
+ g_free(config);
+ return pid;
#endif
- }
- file = g_dir_read_name(gdir);
- }
- g_dir_close(gdir);
- }
- g_free(config);
- return -1;
+ }
+ file = g_dir_read_name(gdir);
+ }
+ g_dir_close(gdir);
+ }
+ g_free(config);
+ return -1;
}
static void
remove_plist(const gchar *name)
{
- gchar *config, *path;
+ gchar *config, *path;
- config = ghb_get_user_config_dir(NULL);
- path = g_strdup_printf ("%s/%s", config, name);
- if (g_file_test(path, G_FILE_TEST_IS_REGULAR))
- {
- g_unlink(path);
- }
- g_free(path);
- g_free(config);
+ config = ghb_get_user_config_dir(NULL);
+ path = g_strdup_printf ("%s/%s", config, name);
+ if (g_file_test(path, G_FILE_TEST_IS_REGULAR))
+ {
+ g_unlink(path);
+ }
+ g_free(path);
+ g_free(config);
}
static gboolean prefs_initializing = FALSE;
@@ -1319,780 +1319,780 @@ static gboolean prefs_initializing = FALSE;
void
ghb_prefs_to_ui(signal_user_data_t *ud)
{
- const GValue *gval;
- gchar *key;
- gchar *str;
- GValue *internal, *dict;
- GHashTableIter iter;
-
-
- g_debug("ghb_prefs_to_ui");
- prefs_initializing = TRUE;
-
- // Setting a ui widget will cause the corresponding setting
- // to be set, but it also triggers a callback that can
- // have the side effect of using other settings values
- // that have not yet been set. So set *all* settings first
- // then update the ui.
- internal = plist_get_dict(internalPlist, "Initialization");
- ghb_dict_iter_init(&iter, internal);
- // middle (void*) cast prevents gcc warning "defreferencing type-punned
- // pointer will break strict-aliasing rules"
- while (g_hash_table_iter_next(
- &iter, (gpointer*)(void*)&key, (gpointer*)(void*)&gval))
- {
- ghb_ui_update(ud, key, gval);
- }
-
- dict = plist_get_dict(prefsPlist, "Preferences");
- internal = plist_get_dict(internalPlist, "Preferences");
- ghb_dict_iter_init(&iter, internal);
- // middle (void*) cast prevents gcc warning "defreferencing type-punned
- // pointer will break strict-aliasing rules"
- while (g_hash_table_iter_next(
- &iter, (gpointer*)(void*)&key, (gpointer*)(void*)&gval))
- {
- const GValue *value = NULL;
- if (dict)
- value = ghb_dict_lookup(dict, key);
- if (value == NULL)
- value = gval;
- ghb_settings_set_value(ud->settings, key, value);
- }
- internal = plist_get_dict(internalPlist, "Preferences");
- ghb_dict_iter_init(&iter, internal);
- // middle (void*) cast prevents gcc warning "defreferencing type-punned
- // pointer will break strict-aliasing rules"
- while (g_hash_table_iter_next(
- &iter, (gpointer*)(void*)&key, (gpointer*)(void*)&gval))
- {
- const GValue *value = NULL;
- if (dict)
- value = ghb_dict_lookup(dict, key);
- if (value == NULL)
- value = gval;
- ghb_ui_update(ud, key, value);
- }
- const GValue *val;
- val = ghb_settings_get_value(ud->settings, "show_presets");
- ghb_ui_update(ud, "show_presets", val);
- if (ghb_settings_get_boolean(ud->settings, "hbfd_feature"))
- {
- GtkAction *action;
- val = ghb_settings_get_value(ud->settings, "hbfd");
- ghb_ui_update(ud, "hbfd", val);
- action = GHB_ACTION (ud->builder, "hbfd");
- gtk_action_set_visible(action, TRUE);
- }
- else
- {
- ghb_ui_update(ud, "hbfd", ghb_int64_value(0));
- }
- gval = ghb_settings_get_value(ud->settings, "default_source");
- ghb_settings_set_value (ud->settings, "scan_source", gval);
-
- str = ghb_settings_get_string(ud->settings, "destination_dir");
- ghb_ui_update(ud, "dest_dir", ghb_string_value(str));
-
- gchar *file = g_strdup_printf ("new_video.mp4");
- ghb_ui_update(ud, "dest_file", ghb_string_value(file));
- g_free(str);
- g_free(file);
-
- prefs_initializing = FALSE;
+ const GValue *gval;
+ gchar *key;
+ gchar *str;
+ GValue *internal, *dict;
+ GHashTableIter iter;
+
+
+ g_debug("ghb_prefs_to_ui");
+ prefs_initializing = TRUE;
+
+ // Setting a ui widget will cause the corresponding setting
+ // to be set, but it also triggers a callback that can
+ // have the side effect of using other settings values
+ // that have not yet been set. So set *all* settings first
+ // then update the ui.
+ internal = plist_get_dict(internalPlist, "Initialization");
+ ghb_dict_iter_init(&iter, internal);
+ // middle (void*) cast prevents gcc warning "defreferencing type-punned
+ // pointer will break strict-aliasing rules"
+ while (g_hash_table_iter_next(
+ &iter, (gpointer*)(void*)&key, (gpointer*)(void*)&gval))
+ {
+ ghb_ui_update(ud, key, gval);
+ }
+
+ dict = plist_get_dict(prefsPlist, "Preferences");
+ internal = plist_get_dict(internalPlist, "Preferences");
+ ghb_dict_iter_init(&iter, internal);
+ // middle (void*) cast prevents gcc warning "defreferencing type-punned
+ // pointer will break strict-aliasing rules"
+ while (g_hash_table_iter_next(
+ &iter, (gpointer*)(void*)&key, (gpointer*)(void*)&gval))
+ {
+ const GValue *value = NULL;
+ if (dict)
+ value = ghb_dict_lookup(dict, key);
+ if (value == NULL)
+ value = gval;
+ ghb_settings_set_value(ud->settings, key, value);
+ }
+ internal = plist_get_dict(internalPlist, "Preferences");
+ ghb_dict_iter_init(&iter, internal);
+ // middle (void*) cast prevents gcc warning "defreferencing type-punned
+ // pointer will break strict-aliasing rules"
+ while (g_hash_table_iter_next(
+ &iter, (gpointer*)(void*)&key, (gpointer*)(void*)&gval))
+ {
+ const GValue *value = NULL;
+ if (dict)
+ value = ghb_dict_lookup(dict, key);
+ if (value == NULL)
+ value = gval;
+ ghb_ui_update(ud, key, value);
+ }
+ const GValue *val;
+ val = ghb_settings_get_value(ud->settings, "show_presets");
+ ghb_ui_update(ud, "show_presets", val);
+ if (ghb_settings_get_boolean(ud->settings, "hbfd_feature"))
+ {
+ GtkAction *action;
+ val = ghb_settings_get_value(ud->settings, "hbfd");
+ ghb_ui_update(ud, "hbfd", val);
+ action = GHB_ACTION (ud->builder, "hbfd");
+ gtk_action_set_visible(action, TRUE);
+ }
+ else
+ {
+ ghb_ui_update(ud, "hbfd", ghb_int64_value(0));
+ }
+ gval = ghb_settings_get_value(ud->settings, "default_source");
+ ghb_settings_set_value (ud->settings, "scan_source", gval);
+
+ str = ghb_settings_get_string(ud->settings, "destination_dir");
+ ghb_ui_update(ud, "dest_dir", ghb_string_value(str));
+
+ gchar *file = g_strdup_printf ("new_video.mp4");
+ ghb_ui_update(ud, "dest_file", ghb_string_value(file));
+ g_free(str);
+ g_free(file);
+
+ prefs_initializing = FALSE;
}
void
ghb_prefs_save(GValue *settings)
{
- GValue *dict;
- GValue *pref_dict;
- GHashTableIter iter;
- gchar *key;
- const GValue *value;
-
- if (prefs_initializing) return;
- dict = plist_get_dict(internalPlist, "Preferences");
- if (dict == NULL) return;
- pref_dict = plist_get_dict(prefsPlist, "Preferences");
- if (pref_dict == NULL) return;
- ghb_dict_iter_init(&iter, dict);
- // middle (void*) cast prevents gcc warning "defreferencing type-punned
- // pointer will break strict-aliasing rules"
- while (g_hash_table_iter_next(
- &iter, (gpointer*)(void*)&key, (gpointer*)(void*)&value))
- {
- value = ghb_settings_get_value(settings, key);
- if (value != NULL)
- {
- ghb_dict_insert(pref_dict, g_strdup(key), ghb_value_dup(value));
- }
- }
- store_prefs();
- prefs_modified = FALSE;
+ GValue *dict;
+ GValue *pref_dict;
+ GHashTableIter iter;
+ gchar *key;
+ const GValue *value;
+
+ if (prefs_initializing) return;
+ dict = plist_get_dict(internalPlist, "Preferences");
+ if (dict == NULL) return;
+ pref_dict = plist_get_dict(prefsPlist, "Preferences");
+ if (pref_dict == NULL) return;
+ ghb_dict_iter_init(&iter, dict);
+ // middle (void*) cast prevents gcc warning "defreferencing type-punned
+ // pointer will break strict-aliasing rules"
+ while (g_hash_table_iter_next(
+ &iter, (gpointer*)(void*)&key, (gpointer*)(void*)&value))
+ {
+ value = ghb_settings_get_value(settings, key);
+ if (value != NULL)
+ {
+ ghb_dict_insert(pref_dict, g_strdup(key), ghb_value_dup(value));
+ }
+ }
+ store_prefs();
+ prefs_modified = FALSE;
}
void
ghb_pref_set(GValue *settings, const gchar *key)
{
- const GValue *value, *value2;
-
- if (prefs_initializing) return;
- value = ghb_settings_get_value(settings, key);
- if (value != NULL)
- {
- GValue *dict;
- dict = plist_get_dict(prefsPlist, "Preferences");
- if (dict == NULL) return;
- value2 = ghb_dict_lookup(dict, key);
- if (ghb_value_cmp(value, value2) != 0)
- {
- ghb_dict_insert(dict, g_strdup(key), ghb_value_dup(value));
- store_prefs();
- prefs_modified = TRUE;
- }
- }
+ const GValue *value, *value2;
+
+ if (prefs_initializing) return;
+ value = ghb_settings_get_value(settings, key);
+ if (value != NULL)
+ {
+ GValue *dict;
+ dict = plist_get_dict(prefsPlist, "Preferences");
+ if (dict == NULL) return;
+ value2 = ghb_dict_lookup(dict, key);
+ if (ghb_value_cmp(value, value2) != 0)
+ {
+ ghb_dict_insert(dict, g_strdup(key), ghb_value_dup(value));
+ store_prefs();
+ prefs_modified = TRUE;
+ }
+ }
}
void
ghb_pref_save(GValue *settings, const gchar *key)
{
- const GValue *value, *value2;
-
- if (prefs_initializing) return;
- value = ghb_settings_get_value(settings, key);
- if (value != NULL)
- {
- GValue *dict;
- dict = plist_get_dict(prefsPlist, "Preferences");
- if (dict == NULL) return;
- value2 = ghb_dict_lookup(dict, key);
- if (ghb_value_cmp(value, value2) != 0)
- {
- ghb_dict_insert(dict, g_strdup(key), ghb_value_dup(value));
- store_prefs();
- prefs_modified = FALSE;
- }
- }
+ const GValue *value, *value2;
+
+ if (prefs_initializing) return;
+ value = ghb_settings_get_value(settings, key);
+ if (value != NULL)
+ {
+ GValue *dict;
+ dict = plist_get_dict(prefsPlist, "Preferences");
+ if (dict == NULL) return;
+ value2 = ghb_dict_lookup(dict, key);
+ if (ghb_value_cmp(value, value2) != 0)
+ {
+ ghb_dict_insert(dict, g_strdup(key), ghb_value_dup(value));
+ store_prefs();
+ prefs_modified = FALSE;
+ }
+ }
}
void
ghb_prefs_store(void)
{
- if (prefs_modified)
- {
- store_prefs();
- prefs_modified = FALSE;
- }
+ if (prefs_modified)
+ {
+ store_prefs();
+ prefs_modified = FALSE;
+ }
}
void
ghb_settings_init(signal_user_data_t *ud)
{
- GValue *internal;
- GHashTableIter iter;
- gchar *key;
- GValue *gval;
-
-
- g_debug("ghb_settings_init");
- prefs_initializing = TRUE;
-
- internalPlist = ghb_resource_get("internal-defaults");
- // Setting a ui widget will cause the corresponding setting
- // to be set, but it also triggers a callback that can
- // have the side effect of using other settings values
- // that have not yet been set. So set *all* settings first
- // then update the ui.
- internal = plist_get_dict(internalPlist, "Initialization");
- ghb_dict_iter_init(&iter, internal);
- // middle (void*) cast prevents gcc warning "defreferencing type-punned
- // pointer will break strict-aliasing rules"
- while (g_hash_table_iter_next(
- &iter, (gpointer*)(void*)&key, (gpointer*)(void*)&gval))
- {
- ghb_settings_set_value(ud->settings, key, gval);
- }
-
- internal = plist_get_dict(internalPlist, "Presets");
- ghb_dict_iter_init(&iter, internal);
- // middle (void*) cast prevents gcc warning "defreferencing type-punned
- // pointer will break strict-aliasing rules"
- while (g_hash_table_iter_next(
- &iter, (gpointer*)(void*)&key, (gpointer*)(void*)&gval))
- {
- ghb_settings_set_value(ud->settings, key, gval);
- }
-
- internal = plist_get_dict(internalPlist, "Preferences");
- ghb_dict_iter_init(&iter, internal);
- // middle (void*) cast prevents gcc warning "defreferencing type-punned
- // pointer will break strict-aliasing rules"
- while (g_hash_table_iter_next(
- &iter, (gpointer*)(void*)&key, (gpointer*)(void*)&gval))
- {
- ghb_settings_set_value(ud->settings, key, gval);
- }
- prefs_initializing = FALSE;
+ GValue *internal;
+ GHashTableIter iter;
+ gchar *key;
+ GValue *gval;
+
+
+ g_debug("ghb_settings_init");
+ prefs_initializing = TRUE;
+
+ internalPlist = ghb_resource_get("internal-defaults");
+ // Setting a ui widget will cause the corresponding setting
+ // to be set, but it also triggers a callback that can
+ // have the side effect of using other settings values
+ // that have not yet been set. So set *all* settings first
+ // then update the ui.
+ internal = plist_get_dict(internalPlist, "Initialization");
+ ghb_dict_iter_init(&iter, internal);
+ // middle (void*) cast prevents gcc warning "defreferencing type-punned
+ // pointer will break strict-aliasing rules"
+ while (g_hash_table_iter_next(
+ &iter, (gpointer*)(void*)&key, (gpointer*)(void*)&gval))
+ {
+ ghb_settings_set_value(ud->settings, key, gval);
+ }
+
+ internal = plist_get_dict(internalPlist, "Presets");
+ ghb_dict_iter_init(&iter, internal);
+ // middle (void*) cast prevents gcc warning "defreferencing type-punned
+ // pointer will break strict-aliasing rules"
+ while (g_hash_table_iter_next(
+ &iter, (gpointer*)(void*)&key, (gpointer*)(void*)&gval))
+ {
+ ghb_settings_set_value(ud->settings, key, gval);
+ }
+
+ internal = plist_get_dict(internalPlist, "Preferences");
+ ghb_dict_iter_init(&iter, internal);
+ // middle (void*) cast prevents gcc warning "defreferencing type-punned
+ // pointer will break strict-aliasing rules"
+ while (g_hash_table_iter_next(
+ &iter, (gpointer*)(void*)&key, (gpointer*)(void*)&gval))
+ {
+ ghb_settings_set_value(ud->settings, key, gval);
+ }
+ prefs_initializing = FALSE;
}
void
ghb_settings_close()
{
- if (internalPlist)
- ghb_value_free(internalPlist);
- if (presetsPlist)
- ghb_value_free(presetsPlist);
- if (prefsPlist)
- ghb_value_free(prefsPlist);
+ if (internalPlist)
+ ghb_value_free(internalPlist);
+ if (presetsPlist)
+ ghb_value_free(presetsPlist);
+ if (prefsPlist)
+ ghb_value_free(prefsPlist);
}
#if defined(_WIN32)
gchar*
FindFirstCDROM(void)
{
- gint ii, drives;
- gchar drive[5];
-
- strcpy(drive, "A:" G_DIR_SEPARATOR_S);
- drives = GetLogicalDrives();
- for (ii = 0; ii < 26; ii++)
- {
- if (drives & 0x01)
- {
- guint dtype;
-
- drive[0] = 'A' + ii;
- dtype = GetDriveType(drive);
- if (dtype == DRIVE_CDROM)
- {
- return g_strdup(drive);
- }
- }
- drives >>= 1;
- }
- return NULL;
+ gint ii, drives;
+ gchar drive[5];
+
+ strcpy(drive, "A:" G_DIR_SEPARATOR_S);
+ drives = GetLogicalDrives();
+ for (ii = 0; ii < 26; ii++)
+ {
+ if (drives & 0x01)
+ {
+ guint dtype;
+
+ drive[0] = 'A' + ii;
+ dtype = GetDriveType(drive);
+ if (dtype == DRIVE_CDROM)
+ {
+ return g_strdup(drive);
+ }
+ }
+ drives >>= 1;
+ }
+ return NULL;
}
#endif
void
ghb_prefs_load(signal_user_data_t *ud)
{
- GValue *dict, *internal;
- GHashTableIter iter;
- gchar *key;
- GValue *gval, *path;
-
- g_debug("ghb_prefs_load");
- prefsPlist = load_plist("preferences");
- if (prefsPlist == NULL)
- prefsPlist = ghb_dict_value_new();
- dict = plist_get_dict(prefsPlist, "Preferences");
- internal = plist_get_dict(internalPlist, "Preferences");
- if (dict == NULL && internal)
- {
- dict = ghb_dict_value_new();
- ghb_dict_insert(prefsPlist, g_strdup("Preferences"), dict);
-
- // Get defaults from internal defaults
- ghb_dict_iter_init(&iter, internal);
- // middle (void*) cast prevents gcc warning "defreferencing type-punned
- // pointer will break strict-aliasing rules"
- while (g_hash_table_iter_next(
- &iter, (gpointer*)(void*)&key, (gpointer*)(void*)&gval))
- {
- ghb_dict_insert(dict, g_strdup(key), ghb_value_dup(gval));
- }
-
- const gchar *dir = g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP);
- if (dir == NULL)
- {
- dir = ".";
- }
- ghb_dict_insert(dict,
- g_strdup("ExportDirectory"), ghb_value_dup(ghb_string_value(dir)));
-
- dir = g_get_user_special_dir (G_USER_DIRECTORY_VIDEOS);
- if (dir == NULL)
- {
- dir = ".";
- }
- ghb_dict_insert(dict,
- g_strdup("destination_dir"), ghb_value_dup(ghb_string_value(dir)));
-
- ghb_dict_insert(dict,
- g_strdup("SrtDir"), ghb_value_dup(ghb_string_value(dir)));
+ GValue *dict, *internal;
+ GHashTableIter iter;
+ gchar *key;
+ GValue *gval, *path;
+
+ g_debug("ghb_prefs_load");
+ prefsPlist = load_plist("preferences");
+ if (prefsPlist == NULL)
+ prefsPlist = ghb_dict_value_new();
+ dict = plist_get_dict(prefsPlist, "Preferences");
+ internal = plist_get_dict(internalPlist, "Preferences");
+ if (dict == NULL && internal)
+ {
+ dict = ghb_dict_value_new();
+ ghb_dict_insert(prefsPlist, g_strdup("Preferences"), dict);
+
+ // Get defaults from internal defaults
+ ghb_dict_iter_init(&iter, internal);
+ // middle (void*) cast prevents gcc warning "defreferencing type-punned
+ // pointer will break strict-aliasing rules"
+ while (g_hash_table_iter_next(
+ &iter, (gpointer*)(void*)&key, (gpointer*)(void*)&gval))
+ {
+ ghb_dict_insert(dict, g_strdup(key), ghb_value_dup(gval));
+ }
+
+ const gchar *dir = g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP);
+ if (dir == NULL)
+ {
+ dir = ".";
+ }
+ ghb_dict_insert(dict,
+ g_strdup("ExportDirectory"), ghb_value_dup(ghb_string_value(dir)));
+
+ dir = g_get_user_special_dir (G_USER_DIRECTORY_VIDEOS);
+ if (dir == NULL)
+ {
+ dir = ".";
+ }
+ ghb_dict_insert(dict,
+ g_strdup("destination_dir"), ghb_value_dup(ghb_string_value(dir)));
+
+ ghb_dict_insert(dict,
+ g_strdup("SrtDir"), ghb_value_dup(ghb_string_value(dir)));
#if defined(_WIN32)
- gchar *source;
-
- source = FindFirstCDROM();
- if (source == NULL)
- {
- source = g_strdup("C:" G_DIR_SEPARATOR_S);
- }
- ghb_dict_insert(dict, g_strdup("default_source"),
- ghb_value_dup(ghb_string_value(source)));
- g_free(source);
+ gchar *source;
+
+ source = FindFirstCDROM();
+ if (source == NULL)
+ {
+ source = g_strdup("C:" G_DIR_SEPARATOR_S);
+ }
+ ghb_dict_insert(dict, g_strdup("default_source"),
+ ghb_value_dup(ghb_string_value(source)));
+ g_free(source);
#endif
- store_prefs();
- }
- // Read legacy default_preset preference and update accordingly
- path = ghb_dict_lookup(dict, "default_preset");
- if (path)
- {
- gint *indices, len;
-
- if (G_VALUE_TYPE(path) == G_TYPE_STRING)
- {
- GValue *str = path;
-
- path = ghb_array_value_new(1);
- ghb_array_append(path, ghb_value_dup(str));
- indices = ghb_preset_indices_from_path(presetsPlist, path, &len);
- ghb_value_free(path);
- }
- else
- indices = ghb_preset_indices_from_path(presetsPlist, path, &len);
-
- if (indices)
- {
- presets_set_default(indices, len);
- g_free(indices);
- }
- ghb_dict_remove(dict, "default_preset");
- store_prefs();
- }
+ store_prefs();
+ }
+ // Read legacy default_preset preference and update accordingly
+ path = ghb_dict_lookup(dict, "default_preset");
+ if (path)
+ {
+ gint *indices, len;
+
+ if (G_VALUE_TYPE(path) == G_TYPE_STRING)
+ {
+ GValue *str = path;
+
+ path = ghb_array_value_new(1);
+ ghb_array_append(path, ghb_value_dup(str));
+ indices = ghb_preset_indices_from_path(presetsPlist, path, &len);
+ ghb_value_free(path);
+ }
+ else
+ indices = ghb_preset_indices_from_path(presetsPlist, path, &len);
+
+ if (indices)
+ {
+ presets_set_default(indices, len);
+ g_free(indices);
+ }
+ ghb_dict_remove(dict, "default_preset");
+ store_prefs();
+ }
}
static const gchar*
get_preset_color(gint type, gboolean folder)
{
- const gchar *color;
-
- if (type == PRESETS_CUSTOM)
- {
- color = "DimGray";
- if (folder)
- {
- color = "black";
- }
- }
- else
- {
- color = "blue";
- if (folder)
- {
- color = "Navy";
- }
- }
- return color;
+ const gchar *color;
+
+ if (type == PRESETS_CUSTOM)
+ {
+ color = "DimGray";
+ if (folder)
+ {
+ color = "black";
+ }
+ }
+ else
+ {
+ color = "blue";
+ if (folder)
+ {
+ color = "Navy";
+ }
+ }
+ return color;
}
void
ghb_presets_list_init(
- signal_user_data_t *ud,
- gint *indices,
- gint len)
-{
- GtkTreeView *treeview;
- GtkTreeIter iter, titer, *piter;
-
- GtkTreeStore *store;
- const gchar *preset;
- GtkTreePath *parent_path;
- const gchar *description;
- gboolean def;
- gint count, ii;
- GValue *dict;
- gint *more_indices;
- GValue *presets = NULL;
-
- g_debug("ghb_presets_list_init ()");
- more_indices = g_malloc((len+1)*sizeof(gint));
- memcpy(more_indices, indices, len*sizeof(gint));
- presets = presets_get_folder(presetsPlist, indices, len);
- if (presets == NULL)
- {
- g_warning("Failed to find parent folder when adding child.");
- g_free(more_indices);
- return;
- }
- count = ghb_array_len(presets);
- treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "presets_list"));
- store = GTK_TREE_STORE(gtk_tree_view_get_model(treeview));
- parent_path = ghb_tree_path_new_from_indices(indices, len);
- if (parent_path)
- {
- gtk_tree_model_get_iter(GTK_TREE_MODEL(store), &titer, parent_path);
- piter = &titer;
- gtk_tree_path_free(parent_path);
- }
- else
- {
- piter = NULL;
- }
- for (ii = 0; ii < count; ii++)
- {
- const gchar *color;
- gint type;
- gboolean folder;
-
- // Additional settings, add row
- dict = ghb_array_get_nth(presets, ii);
- preset = preset_get_name(dict);
- more_indices[len] = ii;
- def = preset_is_default(dict);
-
- description = ghb_presets_get_description(dict);
- gtk_tree_store_append(store, &iter, piter);
- type = ghb_preset_type(dict);
- folder = ghb_preset_folder(dict);
- color = get_preset_color(type, folder);
- gtk_tree_store_set(store, &iter, 0, preset,
- 1, def ? 800 : 400,
- 2, def ? 2 : 0,
- 3, color,
- 4, description,
- 5, type == PRESETS_BUILTIN ? 0 : 1,
- -1);
- if (def && piter)
- {
- GtkTreePath *path;
- GtkTreeIter ppiter;
-
- if (gtk_tree_model_iter_parent(
- GTK_TREE_MODEL(store), &ppiter, piter))
- {
- path = gtk_tree_model_get_path(GTK_TREE_MODEL(store), &ppiter);
- gtk_tree_view_expand_row(treeview, path, FALSE);
- gtk_tree_path_free(path);
- }
- path = gtk_tree_model_get_path(GTK_TREE_MODEL(store), piter);
- gtk_tree_view_expand_row(treeview, path, FALSE);
- gtk_tree_path_free(path);
- }
- if (folder)
- {
- ghb_presets_list_init(ud, more_indices, len+1);
- if (preset_folder_is_open(dict))
- {
- GtkTreePath *path;
-
- if (piter != NULL)
- {
- path = gtk_tree_model_get_path(GTK_TREE_MODEL(store), piter);
- gtk_tree_view_expand_row(treeview, path, FALSE);
- gtk_tree_path_free(path);
- }
- path = gtk_tree_model_get_path(GTK_TREE_MODEL(store), &iter);
- gtk_tree_view_expand_row(treeview, path, FALSE);
- gtk_tree_path_free(path);
- }
- }
- }
- g_free(more_indices);
+ signal_user_data_t *ud,
+ gint *indices,
+ gint len)
+{
+ GtkTreeView *treeview;
+ GtkTreeIter iter, titer, *piter;
+
+ GtkTreeStore *store;
+ const gchar *preset;
+ GtkTreePath *parent_path;
+ const gchar *description;
+ gboolean def;
+ gint count, ii;
+ GValue *dict;
+ gint *more_indices;
+ GValue *presets = NULL;
+
+ g_debug("ghb_presets_list_init ()");
+ more_indices = g_malloc((len+1)*sizeof(gint));
+ memcpy(more_indices, indices, len*sizeof(gint));
+ presets = presets_get_folder(presetsPlist, indices, len);
+ if (presets == NULL)
+ {
+ g_warning("Failed to find parent folder when adding child.");
+ g_free(more_indices);
+ return;
+ }
+ count = ghb_array_len(presets);
+ treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "presets_list"));
+ store = GTK_TREE_STORE(gtk_tree_view_get_model(treeview));
+ parent_path = ghb_tree_path_new_from_indices(indices, len);
+ if (parent_path)
+ {
+ gtk_tree_model_get_iter(GTK_TREE_MODEL(store), &titer, parent_path);
+ piter = &titer;
+ gtk_tree_path_free(parent_path);
+ }
+ else
+ {
+ piter = NULL;
+ }
+ for (ii = 0; ii < count; ii++)
+ {
+ const gchar *color;
+ gint type;
+ gboolean folder;
+
+ // Additional settings, add row
+ dict = ghb_array_get_nth(presets, ii);
+ preset = preset_get_name(dict);
+ more_indices[len] = ii;
+ def = preset_is_default(dict);
+
+ description = ghb_presets_get_description(dict);
+ gtk_tree_store_append(store, &iter, piter);
+ type = ghb_preset_type(dict);
+ folder = ghb_preset_folder(dict);
+ color = get_preset_color(type, folder);
+ gtk_tree_store_set(store, &iter, 0, preset,
+ 1, def ? 800 : 400,
+ 2, def ? 2 : 0,
+ 3, color,
+ 4, description,
+ 5, type == PRESETS_BUILTIN ? 0 : 1,
+ -1);
+ if (def && piter)
+ {
+ GtkTreePath *path;
+ GtkTreeIter ppiter;
+
+ if (gtk_tree_model_iter_parent(
+ GTK_TREE_MODEL(store), &ppiter, piter))
+ {
+ path = gtk_tree_model_get_path(GTK_TREE_MODEL(store), &ppiter);
+ gtk_tree_view_expand_row(treeview, path, FALSE);
+ gtk_tree_path_free(path);
+ }
+ path = gtk_tree_model_get_path(GTK_TREE_MODEL(store), piter);
+ gtk_tree_view_expand_row(treeview, path, FALSE);
+ gtk_tree_path_free(path);
+ }
+ if (folder)
+ {
+ ghb_presets_list_init(ud, more_indices, len+1);
+ if (preset_folder_is_open(dict))
+ {
+ GtkTreePath *path;
+
+ if (piter != NULL)
+ {
+ path = gtk_tree_model_get_path(GTK_TREE_MODEL(store), piter);
+ gtk_tree_view_expand_row(treeview, path, FALSE);
+ gtk_tree_path_free(path);
+ }
+ path = gtk_tree_model_get_path(GTK_TREE_MODEL(store), &iter);
+ gtk_tree_view_expand_row(treeview, path, FALSE);
+ gtk_tree_path_free(path);
+ }
+ }
+ }
+ g_free(more_indices);
}
static void
presets_list_update_item(
- signal_user_data_t *ud,
- gint *indices,
- gint len,
- gboolean recurse)
-{
- GtkTreeView *treeview;
- GtkTreeStore *store;
- GtkTreeIter iter;
- GtkTreePath *treepath;
- const gchar *name;
- const gchar *description;
- gint type;
- gboolean def, folder;
- GValue *dict;
- const gchar *color;
-
- g_debug("presets_list_update_item ()");
- dict = presets_get_dict(presetsPlist, indices, len);
- if (dict == NULL)
- return;
- treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "presets_list"));
- store = GTK_TREE_STORE(gtk_tree_view_get_model(treeview));
- treepath = ghb_tree_path_new_from_indices(indices, len);
- gtk_tree_model_get_iter(GTK_TREE_MODEL(store), &iter, treepath);
- // Additional settings, add row
- name = preset_get_name(dict);
- def = preset_is_default(dict);
-
- description = ghb_presets_get_description(dict);
- type = ghb_preset_type(dict);
- folder = ghb_preset_folder(dict);
- color = get_preset_color(type, folder);
- gtk_tree_store_set(store, &iter, 0, name,
- 1, def ? 800 : 400,
- 2, def ? 2 : 0,
- 3, color,
- 4, description,
- 5, type == PRESETS_BUILTIN ? 0 : 1,
- -1);
- if (recurse && folder)
- {
- ghb_presets_list_init(ud, indices, len);
- }
+ signal_user_data_t *ud,
+ gint *indices,
+ gint len,
+ gboolean recurse)
+{
+ GtkTreeView *treeview;
+ GtkTreeStore *store;
+ GtkTreeIter iter;
+ GtkTreePath *treepath;
+ const gchar *name;
+ const gchar *description;
+ gint type;
+ gboolean def, folder;
+ GValue *dict;
+ const gchar *color;
+
+ g_debug("presets_list_update_item ()");
+ dict = presets_get_dict(presetsPlist, indices, len);
+ if (dict == NULL)
+ return;
+ treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "presets_list"));
+ store = GTK_TREE_STORE(gtk_tree_view_get_model(treeview));
+ treepath = ghb_tree_path_new_from_indices(indices, len);
+ gtk_tree_model_get_iter(GTK_TREE_MODEL(store), &iter, treepath);
+ // Additional settings, add row
+ name = preset_get_name(dict);
+ def = preset_is_default(dict);
+
+ description = ghb_presets_get_description(dict);
+ type = ghb_preset_type(dict);
+ folder = ghb_preset_folder(dict);
+ color = get_preset_color(type, folder);
+ gtk_tree_store_set(store, &iter, 0, name,
+ 1, def ? 800 : 400,
+ 2, def ? 2 : 0,
+ 3, color,
+ 4, description,
+ 5, type == PRESETS_BUILTIN ? 0 : 1,
+ -1);
+ if (recurse && folder)
+ {
+ ghb_presets_list_init(ud, indices, len);
+ }
}
static void
presets_list_insert(
- signal_user_data_t *ud,
- gint *indices,
- gint len)
-{
- GtkTreeView *treeview;
- GtkTreeIter iter, titer, *piter;
- GtkTreeStore *store;
- const gchar *preset;
- const gchar *description;
- gint type;
- gboolean def, folder;
- gint count;
- GValue *presets;
- GtkTreePath *parent_path;
- GValue *dict;
- const gchar *color;
-
- g_debug("presets_list_insert ()");
- treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "presets_list"));
- store = GTK_TREE_STORE(gtk_tree_view_get_model(treeview));
- presets = presets_get_folder(presetsPlist, indices, len-1);
- if (presets == NULL)
- {
- g_warning("Failed to find parent folder while adding child.");
- return;
- }
- parent_path = ghb_tree_path_new_from_indices(indices, len-1);
- if (parent_path)
- {
- gtk_tree_model_get_iter(GTK_TREE_MODEL(store), &titer, parent_path);
- piter = &titer;
- gtk_tree_path_free(parent_path);
- }
- else
- {
- piter = NULL;
- }
- count = ghb_array_len(presets);
- if (indices[len-1] >= count)
- return;
- // Additional settings, add row
- dict = ghb_array_get_nth(presets, indices[len-1]);
- preset = preset_get_name(dict);
- def = preset_is_default(dict);
-
- description = ghb_presets_get_description(dict);
- gtk_tree_store_insert(store, &iter, piter, indices[len-1]);
- type = ghb_preset_type(dict);
- folder = ghb_preset_folder(dict);
- color = get_preset_color(type, folder);
- gtk_tree_store_set(store, &iter, 0, preset,
- 1, def ? 800 : 400,
- 2, def ? 2 : 0,
- 3, color,
- 4, description,
- 5, type == PRESETS_BUILTIN ? 0 : 1,
- -1);
- if (folder)
- {
- ghb_presets_list_init(ud, indices, len);
- }
+ signal_user_data_t *ud,
+ gint *indices,
+ gint len)
+{
+ GtkTreeView *treeview;
+ GtkTreeIter iter, titer, *piter;
+ GtkTreeStore *store;
+ const gchar *preset;
+ const gchar *description;
+ gint type;
+ gboolean def, folder;
+ gint count;
+ GValue *presets;
+ GtkTreePath *parent_path;
+ GValue *dict;
+ const gchar *color;
+
+ g_debug("presets_list_insert ()");
+ treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "presets_list"));
+ store = GTK_TREE_STORE(gtk_tree_view_get_model(treeview));
+ presets = presets_get_folder(presetsPlist, indices, len-1);
+ if (presets == NULL)
+ {
+ g_warning("Failed to find parent folder while adding child.");
+ return;
+ }
+ parent_path = ghb_tree_path_new_from_indices(indices, len-1);
+ if (parent_path)
+ {
+ gtk_tree_model_get_iter(GTK_TREE_MODEL(store), &titer, parent_path);
+ piter = &titer;
+ gtk_tree_path_free(parent_path);
+ }
+ else
+ {
+ piter = NULL;
+ }
+ count = ghb_array_len(presets);
+ if (indices[len-1] >= count)
+ return;
+ // Additional settings, add row
+ dict = ghb_array_get_nth(presets, indices[len-1]);
+ preset = preset_get_name(dict);
+ def = preset_is_default(dict);
+
+ description = ghb_presets_get_description(dict);
+ gtk_tree_store_insert(store, &iter, piter, indices[len-1]);
+ type = ghb_preset_type(dict);
+ folder = ghb_preset_folder(dict);
+ color = get_preset_color(type, folder);
+ gtk_tree_store_set(store, &iter, 0, preset,
+ 1, def ? 800 : 400,
+ 2, def ? 2 : 0,
+ 3, color,
+ 4, description,
+ 5, type == PRESETS_BUILTIN ? 0 : 1,
+ -1);
+ if (folder)
+ {
+ ghb_presets_list_init(ud, indices, len);
+ }
}
static void
presets_list_remove(
- signal_user_data_t *ud,
- gint *indices,
- gint len)
-{
- GtkTreeView *treeview;
- GtkTreePath *treepath;
- GtkTreeIter iter;
- GtkTreeStore *store;
-
- g_debug("presets_list_remove ()");
- treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "presets_list"));
- store = GTK_TREE_STORE(gtk_tree_view_get_model(treeview));
- treepath = ghb_tree_path_new_from_indices(indices, len);
- if (treepath)
- {
- if (gtk_tree_model_get_iter(GTK_TREE_MODEL(store), &iter, treepath))
- gtk_tree_store_remove(store, &iter);
- gtk_tree_path_free(treepath);
- }
+ signal_user_data_t *ud,
+ gint *indices,
+ gint len)
+{
+ GtkTreeView *treeview;
+ GtkTreePath *treepath;
+ GtkTreeIter iter;
+ GtkTreeStore *store;
+
+ g_debug("presets_list_remove ()");
+ treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "presets_list"));
+ store = GTK_TREE_STORE(gtk_tree_view_get_model(treeview));
+ treepath = ghb_tree_path_new_from_indices(indices, len);
+ if (treepath)
+ {
+ if (gtk_tree_model_get_iter(GTK_TREE_MODEL(store), &iter, treepath))
+ gtk_tree_store_remove(store, &iter);
+ gtk_tree_path_free(treepath);
+ }
}
static void
remove_std_presets(signal_user_data_t *ud)
{
- gint count, ii;
- gint indices = 0;
-
- count = ghb_array_len(presetsPlist);
- for (ii = count-1; ii >= 0; ii--)
- {
- GValue *dict;
- gint ptype;
-
- dict = ghb_array_get_nth(presetsPlist, ii);
- ptype = ghb_value_int(preset_dict_get_value(dict, "Type"));
- if (ptype == PRESETS_BUILTIN)
- {
- if (ghb_presets_remove(presetsPlist, &indices, 1))
- {
- presets_list_remove(ud, &indices, 1);
- }
- }
- }
+ gint count, ii;
+ gint indices = 0;
+
+ count = ghb_array_len(presetsPlist);
+ for (ii = count-1; ii >= 0; ii--)
+ {
+ GValue *dict;
+ gint ptype;
+
+ dict = ghb_array_get_nth(presetsPlist, ii);
+ ptype = ghb_value_int(preset_dict_get_value(dict, "Type"));
+ if (ptype == PRESETS_BUILTIN)
+ {
+ if (ghb_presets_remove(presetsPlist, &indices, 1))
+ {
+ presets_list_remove(ud, &indices, 1);
+ }
+ }
+ }
}
void
ghb_save_queue(GValue *queue)
{
- pid_t pid;
- char *path;
+ pid_t pid;
+ char *path;
- pid = getpid();
- path = g_strdup_printf ("queue.%d", pid);
- store_plist(queue, path);
- g_free(path);
+ pid = getpid();
+ path = g_strdup_printf ("queue.%d", pid);
+ store_plist(queue, path);
+ g_free(path);
}
GValue*
ghb_load_queue()
{
- GValue *queue;
- pid_t pid;
- char *path;
+ GValue *queue;
+ pid_t pid;
+ char *path;
- pid = getpid();
- path = g_strdup_printf ("queue.%d", pid);
- queue = load_plist(path);
- g_free(path);
- return queue;
+ pid = getpid();
+ path = g_strdup_printf ("queue.%d", pid);
+ queue = load_plist(path);
+ g_free(path);
+ return queue;
}
GValue*
ghb_load_old_queue(int pid)
{
- GValue *queue;
- char *path;
+ GValue *queue;
+ char *path;
- path = g_strdup_printf ("queue.%d", pid);
- queue = load_plist(path);
- g_free(path);
- return queue;
+ path = g_strdup_printf ("queue.%d", pid);
+ queue = load_plist(path);
+ g_free(path);
+ return queue;
}
void
ghb_remove_old_queue_file(int pid)
{
- char *path;
+ char *path;
- path = g_strdup_printf ("queue.%d", pid);
- remove_plist(path);
- g_free(path);
+ path = g_strdup_printf ("queue.%d", pid);
+ remove_plist(path);
+ g_free(path);
}
void
ghb_remove_queue_file()
{
- pid_t pid;
- char *path;
+ pid_t pid;
+ char *path;
- pid = getpid();
- path = g_strdup_printf ("queue.%d", pid);
- remove_plist(path);
- g_free(path);
+ pid = getpid();
+ path = g_strdup_printf ("queue.%d", pid);
+ remove_plist(path);
+ g_free(path);
}
typedef struct
{
- gchar *mac_val;
- gchar *lin_val;
+ gchar *mac_val;
+ gchar *lin_val;
} value_map_t;
static value_map_t vcodec_xlat[] =
{
- {"MPEG-2 (FFmpeg)", "ffmpeg2"},
- {"MPEG-4 (FFmpeg)", "ffmpeg4"},
- {"MPEG-4 (FFmpeg)", "ffmpeg"},
- {"MPEG-4 (XviD)", "ffmpeg4"},
- {"H.264 (x264)", "x264"},
- {"VP3 (Theora)", "theora"},
- {NULL,NULL}
+ {"MPEG-2 (FFmpeg)", "ffmpeg2"},
+ {"MPEG-4 (FFmpeg)", "ffmpeg4"},
+ {"MPEG-4 (FFmpeg)", "ffmpeg"},
+ {"MPEG-4 (XviD)", "ffmpeg4"},
+ {"H.264 (x264)", "x264"},
+ {"VP3 (Theora)", "theora"},
+ {NULL,NULL}
};
static value_map_t acodec_xlat[] =
{
- {"AAC (ffmpeg)", "ffaac"},
- {"AAC (faac)", "faac"},
- {"AAC (CoreAudio)", "faac"},
- {"HE-AAC (CoreAudio)", "faac"},
- {"AC3 (ffmpeg)", "ffac3"},
- {"AC3 (ffmpeg)", "ac3"},
- {"AC3", "ac3"}, // Backwards compatibility with mac ui
- {"MP3 Passthru", "copy:mp3"},
- {"MP3 Passthru", "mp3pass"},
- {"AAC Passthru", "copy:aac"},
- {"AAC Passthru", "aacpass"},
- {"AC3 Passthru", "copy:ac3"},
- {"AC3 Passthru", "ac3pass"},
- {"DTS Passthru", "copy:dts"},
- {"DTS Passthru", "dtspass"},
- {"DTS-HD Passthru", "copy:dtshd"},
- {"DTS-HD Passthru", "dtshdpass"},
- {"Auto Passthru", "copy"},
- {"Auto Passthru", "auto"},
- {"MP3 (lame)", "lame"},
- {"FLAC (ffmpeg)", "ffflac"},
- {"Vorbis (vorbis)", "vorbis"},
- {NULL,NULL}
+ {"AAC (ffmpeg)", "ffaac"},
+ {"AAC (faac)", "faac"},
+ {"AAC (CoreAudio)", "faac"},
+ {"HE-AAC (CoreAudio)", "faac"},
+ {"AC3 (ffmpeg)", "ffac3"},
+ {"AC3 (ffmpeg)", "ac3"},
+ {"AC3", "ac3"}, // Backwards compatibility with mac ui
+ {"MP3 Passthru", "copy:mp3"},
+ {"MP3 Passthru", "mp3pass"},
+ {"AAC Passthru", "copy:aac"},
+ {"AAC Passthru", "aacpass"},
+ {"AC3 Passthru", "copy:ac3"},
+ {"AC3 Passthru", "ac3pass"},
+ {"DTS Passthru", "copy:dts"},
+ {"DTS Passthru", "dtspass"},
+ {"DTS-HD Passthru", "copy:dtshd"},
+ {"DTS-HD Passthru", "dtshdpass"},
+ {"Auto Passthru", "copy"},
+ {"Auto Passthru", "auto"},
+ {"MP3 (lame)", "lame"},
+ {"FLAC (ffmpeg)", "ffflac"},
+ {"Vorbis (vorbis)", "vorbis"},
+ {NULL,NULL}
};
value_map_t container_xlat[] =
{
- {"MP4 file", "mp4"},
- {"M4V file", "mp4"},
- {"MKV file", "mkv"},
- {"AVI file", "mkv"},
- {"OGM file", "mkv"},
- {NULL, NULL}
+ {"MP4 file", "mp4"},
+ {"M4V file", "mp4"},
+ {"MKV file", "mkv"},
+ {"AVI file", "mkv"},
+ {"OGM file", "mkv"},
+ {NULL, NULL}
};
value_map_t framerate_xlat[] =
{
- {"Same as source", "source"},
- {"5", "5"},
- {"10", "10"},
- {"12", "12"},
- {"15", "15"},
- {"23.976 (NTSC Film)", "23.976"},
- {"24", "24"},
- {"25 (PAL Film/Video)", "25"},
- {"29.97 (NTSC Video)", "29.97"},
- {"30", "30"},
- {"50", "50"},
- {"59.94", "59.94"},
- {"60", "60"},
- {NULL, NULL}
+ {"Same as source", "source"},
+ {"5", "5"},
+ {"10", "10"},
+ {"12", "12"},
+ {"15", "15"},
+ {"23.976 (NTSC Film)", "23.976"},
+ {"24", "24"},
+ {"25 (PAL Film/Video)", "25"},
+ {"29.97 (NTSC Video)", "29.97"},
+ {"30", "30"},
+ {"50", "50"},
+ {"59.94", "59.94"},
+ {"60", "60"},
+ {NULL, NULL}
};
value_map_t samplerate_xlat[] =
{
- {"Auto", "source"},
- {"22.05", "22.05"},
- {"24", "24"},
- {"32", "32"},
- {"44.1", "44.1"},
- {"48", "48"},
- {NULL, NULL}
+ {"Auto", "source"},
+ {"22.05", "22.05"},
+ {"24", "24"},
+ {"32", "32"},
+ {"44.1", "44.1"},
+ {"48", "48"},
+ {NULL, NULL}
};
// mix translation table filed in with hb_audio_mixdowns table contents
@@ -2101,50 +2101,50 @@ value_map_t *mix_xlat;
// Backwards compatibility mappings for audio mix
value_map_t mix_xlat_compat[] =
{
- {"6-channel discrete", "5point1"},
- {"AC3 Passthru", "none"},
- {"DTS Passthru", "none"},
- {"DTS-HD Passthru", "none"},
- {NULL, NULL}
+ {"6-channel discrete", "5point1"},
+ {"AC3 Passthru", "none"},
+ {"DTS Passthru", "none"},
+ {"DTS-HD Passthru", "none"},
+ {NULL, NULL}
};
value_map_t deint_xlat[] =
{
- {"0", "off"},
- {"1", "custom"},
- {"2", "fast"},
- {"3", "slow"},
- {"4", "slower"},
- {"5", "bob"},
- {NULL, NULL}
+ {"0", "off"},
+ {"1", "custom"},
+ {"2", "fast"},
+ {"3", "slow"},
+ {"4", "slower"},
+ {"5", "bob"},
+ {NULL, NULL}
};
value_map_t denoise_xlat[] =
{
- {"0", "off"},
- {"1", "custom"},
- {"2", "weak"},
- {"3", "medium"},
- {"4", "strong"},
- {NULL, NULL}
+ {"0", "off"},
+ {"1", "custom"},
+ {"2", "weak"},
+ {"3", "medium"},
+ {"4", "strong"},
+ {NULL, NULL}
};
value_map_t detel_xlat[] =
{
- {"0", "off"},
- {"1", "custom"},
- {"2", "default"},
- {NULL, NULL}
+ {"0", "off"},
+ {"1", "custom"},
+ {"2", "default"},
+ {NULL, NULL}
};
value_map_t decomb_xlat[] =
{
- {"0", "off"},
- {"1", "custom"},
- {"2", "default"},
- {"3", "fast"},
- {"4", "bob"},
- {NULL, NULL}
+ {"0", "off"},
+ {"1", "custom"},
+ {"2", "default"},
+ {"3", "fast"},
+ {"4", "bob"},
+ {NULL, NULL}
};
extern iso639_lang_t ghb_language_table[];
@@ -2152,675 +2152,675 @@ extern iso639_lang_t ghb_language_table[];
static GValue*
export_lang_xlat2(GValue *lin_val)
{
- GValue *gval;
-
- if (lin_val == NULL) return NULL;
- gint ii;
- gchar *str;
-
- str = ghb_value_string(lin_val);
- for (ii = 0; ghb_language_table[ii].eng_name; ii++)
- {
- if (strcmp(str, ghb_language_table[ii].iso639_2) == 0)
- {
- const gchar *lang;
-
- if (ghb_language_table[ii].native_name[0] != 0)
- lang = ghb_language_table[ii].native_name;
- else
- lang = ghb_language_table[ii].eng_name;
-
- gval = ghb_string_value_new(lang);
- g_free(str);
- return gval;
- }
- }
- g_debug("Can't map language value: (%s)", str);
- g_free(str);
- return NULL;
+ GValue *gval;
+
+ if (lin_val == NULL) return NULL;
+ gint ii;
+ gchar *str;
+
+ str = ghb_value_string(lin_val);
+ for (ii = 0; ghb_language_table[ii].eng_name; ii++)
+ {
+ if (strcmp(str, ghb_language_table[ii].iso639_2) == 0)
+ {
+ const gchar *lang;
+
+ if (ghb_language_table[ii].native_name[0] != 0)
+ lang = ghb_language_table[ii].native_name;
+ else
+ lang = ghb_language_table[ii].eng_name;
+
+ gval = ghb_string_value_new(lang);
+ g_free(str);
+ return gval;
+ }
+ }
+ g_debug("Can't map language value: (%s)", str);
+ g_free(str);
+ return NULL;
}
static GValue*
export_subtitle_xlat2(GValue *lin_val)
{
- gchar *str;
- GValue *gval;
-
- if (lin_val == NULL) return NULL;
- str = ghb_value_string(lin_val);
- if (strcmp(str, "none") == 0)
- {
- gval = ghb_string_value_new("None");
- }
- else if (strcmp(str, "auto") == 0)
- {
- gval = ghb_string_value_new("Autoselect");
- }
- else
- {
- gval = export_lang_xlat2(lin_val);
- }
- g_free(str);
- return gval;
+ gchar *str;
+ GValue *gval;
+
+ if (lin_val == NULL) return NULL;
+ str = ghb_value_string(lin_val);
+ if (strcmp(str, "none") == 0)
+ {
+ gval = ghb_string_value_new("None");
+ }
+ else if (strcmp(str, "auto") == 0)
+ {
+ gval = ghb_string_value_new("Autoselect");
+ }
+ else
+ {
+ gval = export_lang_xlat2(lin_val);
+ }
+ g_free(str);
+ return gval;
}
static GValue*
import_lang_xlat2(GValue *mac_val)
{
- GValue *gval;
-
- if (mac_val == NULL) return NULL;
- gint ii;
- gchar *str;
-
- str = ghb_value_string(mac_val);
- for (ii = 0; ghb_language_table[ii].eng_name; ii++)
- {
- if ((strcmp(str, ghb_language_table[ii].eng_name) == 0) ||
- (strcmp(str, ghb_language_table[ii].native_name) == 0))
- {
- gval = ghb_string_value_new(ghb_language_table[ii].iso639_2);
- g_free(str);
- return gval;
- }
- }
- g_debug("Can't map language value: (%s)", str);
- g_free(str);
- return NULL;
+ GValue *gval;
+
+ if (mac_val == NULL) return NULL;
+ gint ii;
+ gchar *str;
+
+ str = ghb_value_string(mac_val);
+ for (ii = 0; ghb_language_table[ii].eng_name; ii++)
+ {
+ if ((strcmp(str, ghb_language_table[ii].eng_name) == 0) ||
+ (strcmp(str, ghb_language_table[ii].native_name) == 0))
+ {
+ gval = ghb_string_value_new(ghb_language_table[ii].iso639_2);
+ g_free(str);
+ return gval;
+ }
+ }
+ g_debug("Can't map language value: (%s)", str);
+ g_free(str);
+ return NULL;
}
static GValue*
import_subtitle_xlat2(GValue *mac_val)
{
- gchar *str;
- GValue *gval;
-
- if (mac_val == NULL) return NULL;
- str = ghb_value_string(mac_val);
- if (strcmp(str, "None") == 0)
- {
- gval = ghb_string_value_new("none");
- }
- else if (strcmp(str, "Autoselect") == 0)
- {
- gval = ghb_string_value_new("auto");
- }
- else
- {
- gval = import_lang_xlat2(mac_val);
- }
- g_free(str);
- return gval;
+ gchar *str;
+ GValue *gval;
+
+ if (mac_val == NULL) return NULL;
+ str = ghb_value_string(mac_val);
+ if (strcmp(str, "None") == 0)
+ {
+ gval = ghb_string_value_new("none");
+ }
+ else if (strcmp(str, "Autoselect") == 0)
+ {
+ gval = ghb_string_value_new("auto");
+ }
+ else
+ {
+ gval = import_lang_xlat2(mac_val);
+ }
+ g_free(str);
+ return gval;
}
static GValue*
export_audio_track_xlat2(GValue *lin_val)
{
- gchar *str;
- GValue *gval = NULL;
-
- if (lin_val == NULL) return NULL;
- str = ghb_value_string(lin_val);
- if (strcmp(str, "none") == 0)
- {
- gval = ghb_int_value_new(1);
- }
- else
- {
- gint val = ghb_value_int(lin_val) + 1;
- gval = ghb_int_value_new(val);
- }
- g_free(str);
- return gval;
+ gchar *str;
+ GValue *gval = NULL;
+
+ if (lin_val == NULL) return NULL;
+ str = ghb_value_string(lin_val);
+ if (strcmp(str, "none") == 0)
+ {
+ gval = ghb_int_value_new(1);
+ }
+ else
+ {
+ gint val = ghb_value_int(lin_val) + 1;
+ gval = ghb_int_value_new(val);
+ }
+ g_free(str);
+ return gval;
}
static GValue*
import_audio_track_xlat2(GValue *mac_val)
{
- gint val;
- gchar *str;
- GValue *gval;
-
- if (mac_val == NULL) return NULL;
- val = ghb_value_int(mac_val);
- if (val <= 0)
- {
- val = 0;
- }
- else
- {
- val--;
- }
- str = g_strdup_printf("%d", val);
- gval = ghb_string_value_new(str);
- g_free(str);
- return gval;
+ gint val;
+ gchar *str;
+ GValue *gval;
+
+ if (mac_val == NULL) return NULL;
+ val = ghb_value_int(mac_val);
+ if (val <= 0)
+ {
+ val = 0;
+ }
+ else
+ {
+ val--;
+ }
+ str = g_strdup_printf("%d", val);
+ gval = ghb_string_value_new(str);
+ g_free(str);
+ return gval;
}
static GValue*
export_value_xlat2(value_map_t *value_map, GValue *lin_val, GType mac_type)
{
- GValue *gval;
-
- if (lin_val == NULL) return NULL;
- gint ii;
- gchar *str;
- GValue *sval;
-
- str = ghb_value_string(lin_val);
- for (ii = 0; value_map[ii].mac_val; ii++)
- {
- if (strcmp(str, value_map[ii].lin_val) == 0)
- {
- sval = ghb_string_value_new(value_map[ii].mac_val);
- g_free(str);
- gval = ghb_value_new(mac_type);
- if (!g_value_transform(sval, gval))
- {
- g_warning("can't transform");
- ghb_value_free(gval);
- ghb_value_free(sval);
- return NULL;
- }
- ghb_value_free(sval);
- return gval;
- }
- }
- g_debug("Can't map value: (%s)", str);
- g_free(str);
- return NULL;
+ GValue *gval;
+
+ if (lin_val == NULL) return NULL;
+ gint ii;
+ gchar *str;
+ GValue *sval;
+
+ str = ghb_value_string(lin_val);
+ for (ii = 0; value_map[ii].mac_val; ii++)
+ {
+ if (strcmp(str, value_map[ii].lin_val) == 0)
+ {
+ sval = ghb_string_value_new(value_map[ii].mac_val);
+ g_free(str);
+ gval = ghb_value_new(mac_type);
+ if (!g_value_transform(sval, gval))
+ {
+ g_warning("can't transform");
+ ghb_value_free(gval);
+ ghb_value_free(sval);
+ return NULL;
+ }
+ ghb_value_free(sval);
+ return gval;
+ }
+ }
+ g_debug("Can't map value: (%s)", str);
+ g_free(str);
+ return NULL;
}
static void
export_value_xlat(GValue *dict)
{
- GValue *lin_val, *gval;
- const gchar *key;
-
- key = "VideoEncoder";
- lin_val = ghb_dict_lookup(dict, key);
- gval = export_value_xlat2(vcodec_xlat, lin_val, G_TYPE_STRING);
- if (gval)
- ghb_dict_insert(dict, g_strdup(key), gval);
- key = "FileFormat";
- lin_val = ghb_dict_lookup(dict, key);
- gval = export_value_xlat2(container_xlat, lin_val, G_TYPE_STRING);
- if (gval)
- ghb_dict_insert(dict, g_strdup(key), gval);
- key = "VideoFramerate";
- lin_val = ghb_dict_lookup(dict, key);
- gval = export_value_xlat2(framerate_xlat, lin_val, G_TYPE_STRING);
- if (gval)
- ghb_dict_insert(dict, g_strdup(key), gval);
- key = "PictureDetelecine";
- lin_val = ghb_dict_lookup(dict, key);
- gval = export_value_xlat2(detel_xlat, lin_val, G_TYPE_INT);
- if (gval)
- ghb_dict_insert(dict, g_strdup(key), gval);
- key = "PictureDecomb";
- lin_val = ghb_dict_lookup(dict, key);
- gval = export_value_xlat2(decomb_xlat, lin_val, G_TYPE_INT);
- if (gval)
- ghb_dict_insert(dict, g_strdup(key), gval);
- key = "PictureDeinterlace";
- lin_val = ghb_dict_lookup(dict, key);
- gval = export_value_xlat2(deint_xlat, lin_val, G_TYPE_INT);
- if (gval)
- ghb_dict_insert(dict, g_strdup(key), gval);
- key = "PictureDenoise";
- lin_val = ghb_dict_lookup(dict, key);
- gval = export_value_xlat2(denoise_xlat, lin_val, G_TYPE_INT);
- if (gval)
- ghb_dict_insert(dict, g_strdup(key), gval);
-
- GValue *slist;
- GValue *sdict;
- gint count, ii;
-
- slist = ghb_dict_lookup(dict, "SubtitleList");
- count = ghb_array_len(slist);
- for (ii = 0; ii < count; ii++)
- {
- sdict = ghb_array_get_nth(slist, ii);
- key = "SubtitleLanguage";
- lin_val = ghb_dict_lookup(sdict, key);
- gval = export_subtitle_xlat2(lin_val);
- if (gval)
- ghb_dict_insert(sdict, g_strdup(key), gval);
- }
-
- GValue *alist;
- GValue *adict;
-
- key = "AudioEncoderFallback";
- lin_val = ghb_dict_lookup(dict, key);
- gval = export_value_xlat2(acodec_xlat, lin_val, G_TYPE_STRING);
- if (gval)
- ghb_dict_insert(dict, g_strdup(key), gval);
-
- alist = ghb_dict_lookup(dict, "AudioList");
- count = ghb_array_len(alist);
- for (ii = 0; ii < count; ii++)
- {
- adict = ghb_array_get_nth(alist, ii);
- key = "AudioTrack";
- lin_val = ghb_dict_lookup(adict, key);
- gval = export_audio_track_xlat2(lin_val);
- if (gval)
- ghb_dict_insert(adict, g_strdup(key), gval);
- key = "AudioEncoder";
- lin_val = ghb_dict_lookup(adict, key);
- gval = export_value_xlat2(acodec_xlat, lin_val, G_TYPE_STRING);
- if (gval)
- ghb_dict_insert(adict, g_strdup(key), gval);
- key = "AudioSamplerate";
- lin_val = ghb_dict_lookup(adict, key);
- gval = export_value_xlat2(samplerate_xlat, lin_val, G_TYPE_STRING);
- if (gval)
- ghb_dict_insert(adict, g_strdup(key), gval);
- key = "AudioMixdown";
- lin_val = ghb_dict_lookup(adict, key);
- gval = export_value_xlat2(mix_xlat, lin_val, G_TYPE_STRING);
- if (gval)
- ghb_dict_insert(adict, g_strdup(key), gval);
- }
+ GValue *lin_val, *gval;
+ const gchar *key;
+
+ key = "VideoEncoder";
+ lin_val = ghb_dict_lookup(dict, key);
+ gval = export_value_xlat2(vcodec_xlat, lin_val, G_TYPE_STRING);
+ if (gval)
+ ghb_dict_insert(dict, g_strdup(key), gval);
+ key = "FileFormat";
+ lin_val = ghb_dict_lookup(dict, key);
+ gval = export_value_xlat2(container_xlat, lin_val, G_TYPE_STRING);
+ if (gval)
+ ghb_dict_insert(dict, g_strdup(key), gval);
+ key = "VideoFramerate";
+ lin_val = ghb_dict_lookup(dict, key);
+ gval = export_value_xlat2(framerate_xlat, lin_val, G_TYPE_STRING);
+ if (gval)
+ ghb_dict_insert(dict, g_strdup(key), gval);
+ key = "PictureDetelecine";
+ lin_val = ghb_dict_lookup(dict, key);
+ gval = export_value_xlat2(detel_xlat, lin_val, G_TYPE_INT);
+ if (gval)
+ ghb_dict_insert(dict, g_strdup(key), gval);
+ key = "PictureDecomb";
+ lin_val = ghb_dict_lookup(dict, key);
+ gval = export_value_xlat2(decomb_xlat, lin_val, G_TYPE_INT);
+ if (gval)
+ ghb_dict_insert(dict, g_strdup(key), gval);
+ key = "PictureDeinterlace";
+ lin_val = ghb_dict_lookup(dict, key);
+ gval = export_value_xlat2(deint_xlat, lin_val, G_TYPE_INT);
+ if (gval)
+ ghb_dict_insert(dict, g_strdup(key), gval);
+ key = "PictureDenoise";
+ lin_val = ghb_dict_lookup(dict, key);
+ gval = export_value_xlat2(denoise_xlat, lin_val, G_TYPE_INT);
+ if (gval)
+ ghb_dict_insert(dict, g_strdup(key), gval);
+
+ GValue *slist;
+ GValue *sdict;
+ gint count, ii;
+
+ slist = ghb_dict_lookup(dict, "SubtitleList");
+ count = ghb_array_len(slist);
+ for (ii = 0; ii < count; ii++)
+ {
+ sdict = ghb_array_get_nth(slist, ii);
+ key = "SubtitleLanguage";
+ lin_val = ghb_dict_lookup(sdict, key);
+ gval = export_subtitle_xlat2(lin_val);
+ if (gval)
+ ghb_dict_insert(sdict, g_strdup(key), gval);
+ }
+
+ GValue *alist;
+ GValue *adict;
+
+ key = "AudioEncoderFallback";
+ lin_val = ghb_dict_lookup(dict, key);
+ gval = export_value_xlat2(acodec_xlat, lin_val, G_TYPE_STRING);
+ if (gval)
+ ghb_dict_insert(dict, g_strdup(key), gval);
+
+ alist = ghb_dict_lookup(dict, "AudioList");
+ count = ghb_array_len(alist);
+ for (ii = 0; ii < count; ii++)
+ {
+ adict = ghb_array_get_nth(alist, ii);
+ key = "AudioTrack";
+ lin_val = ghb_dict_lookup(adict, key);
+ gval = export_audio_track_xlat2(lin_val);
+ if (gval)
+ ghb_dict_insert(adict, g_strdup(key), gval);
+ key = "AudioEncoder";
+ lin_val = ghb_dict_lookup(adict, key);
+ gval = export_value_xlat2(acodec_xlat, lin_val, G_TYPE_STRING);
+ if (gval)
+ ghb_dict_insert(adict, g_strdup(key), gval);
+ key = "AudioSamplerate";
+ lin_val = ghb_dict_lookup(adict, key);
+ gval = export_value_xlat2(samplerate_xlat, lin_val, G_TYPE_STRING);
+ if (gval)
+ ghb_dict_insert(adict, g_strdup(key), gval);
+ key = "AudioMixdown";
+ lin_val = ghb_dict_lookup(adict, key);
+ gval = export_value_xlat2(mix_xlat, lin_val, G_TYPE_STRING);
+ if (gval)
+ ghb_dict_insert(adict, g_strdup(key), gval);
+ }
}
static GValue*
import_value_xlat2(
- GValue *defaults,
- value_map_t *value_map,
- const gchar *key,
- GValue *mac_val)
-{
- GValue *gval, *def_val;
-
- if (mac_val == NULL) return NULL;
- def_val = ghb_dict_lookup(defaults, key);
- if (def_val)
- {
- gint ii;
- gchar *str;
- GValue *sval;
-
- str = ghb_value_string(mac_val);
- for (ii = 0; value_map[ii].mac_val; ii++)
- {
- if (strcmp(str, value_map[ii].mac_val) == 0 ||
- strcmp(str, value_map[ii].lin_val) == 0)
- {
- sval = ghb_string_value_new(value_map[ii].lin_val);
- g_free(str);
- gval = ghb_value_new(G_VALUE_TYPE(def_val));
- if (!g_value_transform(sval, gval))
- {
- g_warning("can't transform");
- ghb_value_free(gval);
- ghb_value_free(sval);
- return NULL;
- }
- ghb_value_free(sval);
- return gval;
- }
- }
- g_free(str);
- return ghb_value_dup(def_val);
- }
- else
- {
- gint ii;
- gchar *str;
- GValue *sval;
-
- str = ghb_value_string(mac_val);
- for (ii = 0; value_map[ii].mac_val; ii++)
- {
- if (strcmp(str, value_map[ii].mac_val) == 0 ||
- strcmp(str, value_map[ii].lin_val) == 0)
- {
- sval = ghb_string_value_new(value_map[ii].lin_val);
- g_free(str);
- gval = ghb_value_new(G_VALUE_TYPE(mac_val));
- if (!g_value_transform(sval, gval))
- {
- g_warning("can't transform");
- ghb_value_free(gval);
- ghb_value_free(sval);
- return NULL;
- }
- ghb_value_free(sval);
- return gval;
- }
- }
- g_free(str);
- }
- return NULL;
+ GValue *defaults,
+ value_map_t *value_map,
+ const gchar *key,
+ GValue *mac_val)
+{
+ GValue *gval, *def_val;
+
+ if (mac_val == NULL) return NULL;
+ def_val = ghb_dict_lookup(defaults, key);
+ if (def_val)
+ {
+ gint ii;
+ gchar *str;
+ GValue *sval;
+
+ str = ghb_value_string(mac_val);
+ for (ii = 0; value_map[ii].mac_val; ii++)
+ {
+ if (strcmp(str, value_map[ii].mac_val) == 0 ||
+ strcmp(str, value_map[ii].lin_val) == 0)
+ {
+ sval = ghb_string_value_new(value_map[ii].lin_val);
+ g_free(str);
+ gval = ghb_value_new(G_VALUE_TYPE(def_val));
+ if (!g_value_transform(sval, gval))
+ {
+ g_warning("can't transform");
+ ghb_value_free(gval);
+ ghb_value_free(sval);
+ return NULL;
+ }
+ ghb_value_free(sval);
+ return gval;
+ }
+ }
+ g_free(str);
+ return ghb_value_dup(def_val);
+ }
+ else
+ {
+ gint ii;
+ gchar *str;
+ GValue *sval;
+
+ str = ghb_value_string(mac_val);
+ for (ii = 0; value_map[ii].mac_val; ii++)
+ {
+ if (strcmp(str, value_map[ii].mac_val) == 0 ||
+ strcmp(str, value_map[ii].lin_val) == 0)
+ {
+ sval = ghb_string_value_new(value_map[ii].lin_val);
+ g_free(str);
+ gval = ghb_value_new(G_VALUE_TYPE(mac_val));
+ if (!g_value_transform(sval, gval))
+ {
+ g_warning("can't transform");
+ ghb_value_free(gval);
+ ghb_value_free(sval);
+ return NULL;
+ }
+ ghb_value_free(sval);
+ return gval;
+ }
+ }
+ g_free(str);
+ }
+ return NULL;
}
static void
import_value_xlat(GValue *dict)
{
- GValue *defaults, *mac_val, *gval;
- const gchar *key;
-
- defaults = plist_get_dict(internalPlist, "Presets");
- key = "VideoEncoder";
- mac_val = ghb_dict_lookup(dict, key);
- gval = import_value_xlat2(defaults, vcodec_xlat, key, mac_val);
- if (gval)
- ghb_dict_insert(dict, g_strdup(key), gval);
- key = "FileFormat";
- mac_val = ghb_dict_lookup(dict, key);
- gval = import_value_xlat2(defaults, container_xlat, key, mac_val);
- if (gval)
- ghb_dict_insert(dict, g_strdup(key), gval);
- key = "VideoFramerate";
- mac_val = ghb_dict_lookup(dict, key);
- gval = import_value_xlat2(defaults, framerate_xlat, key, mac_val);
- if (gval)
- ghb_dict_insert(dict, g_strdup(key), gval);
- key = "PictureDetelecine";
- mac_val = ghb_dict_lookup(dict, key);
- gval = import_value_xlat2(defaults, detel_xlat, key, mac_val);
- if (gval)
- ghb_dict_insert(dict, g_strdup(key), gval);
- key = "PictureDecomb";
- mac_val = ghb_dict_lookup(dict, key);
- gval = import_value_xlat2(defaults, decomb_xlat, key, mac_val);
- if (gval)
- ghb_dict_insert(dict, g_strdup(key), gval);
- key = "PictureDeinterlace";
- mac_val = ghb_dict_lookup(dict, key);
- gval = import_value_xlat2(defaults, deint_xlat, key, mac_val);
- if (gval)
- ghb_dict_insert(dict, g_strdup(key), gval);
- key = "PictureDenoise";
- mac_val = ghb_dict_lookup(dict, key);
- gval = import_value_xlat2(defaults, denoise_xlat, key, mac_val);
- if (gval)
- ghb_dict_insert(dict, g_strdup(key), gval);
-
- GValue *sdeflist;
- GValue *slist;
- GValue *sdict;
- gint count, ii;
-
- sdeflist = ghb_dict_lookup(defaults, "SubtitleList");
- if (sdeflist)
- {
- slist = ghb_dict_lookup(dict, "SubtitleList");
- if (slist)
- {
- count = ghb_array_len(slist);
- for (ii = 0; ii < count; ii++)
- {
- sdict = ghb_array_get_nth(slist, ii);
- key = "SubtitleLanguage";
- mac_val = ghb_dict_lookup(sdict, key);
- gval = import_subtitle_xlat2(mac_val);
- if (gval)
- ghb_dict_insert(sdict, g_strdup(key), gval);
- }
-
- }
- else
- {
- key = "Subtitles";
- mac_val = ghb_dict_lookup(dict, key);
- slist = ghb_array_value_new(8);
- ghb_dict_insert(dict, g_strdup("SubtitleList"), slist);
- if (mac_val)
- {
- gchar *lang;
-
- gval = import_subtitle_xlat2(mac_val);
- lang = ghb_value_string(gval);
- if (lang && strcasecmp(lang, "none") != 0 && !slist)
- {
- sdict = ghb_dict_value_new();
- ghb_array_append(slist, sdict);
- ghb_dict_insert(sdict, g_strdup("SubtitleLanguage"), gval);
- gval = ghb_dict_lookup(dict, "SubtitlesForced");
- if (gval != NULL)
- {
- ghb_dict_insert(sdict, g_strdup("SubtitleForced"),
- ghb_value_dup(gval));
- }
- else
- {
- ghb_dict_insert(sdict, g_strdup("SubtitleForced"),
- ghb_boolean_value_new(FALSE));
- }
- ghb_dict_insert(sdict, g_strdup("SubtitleBurned"),
- ghb_boolean_value_new(TRUE));
- ghb_dict_insert(sdict, g_strdup("SubtitleDefaultTrack"),
- ghb_boolean_value_new(FALSE));
- }
- else
- {
- ghb_value_free(gval);
- }
- if (lang)
- g_free(lang);
- }
- }
- }
- ghb_dict_remove(dict, "Subtitles");
- ghb_dict_remove(dict, "SubtitlesForced");
-
-
- GValue *alist;
- GValue *adict;
- GValue *adefaults;
- GValue *adeflist;
-
- key = "AudioEncoderFallback";
- mac_val = ghb_dict_lookup(dict, key);
- gval = import_value_xlat2(defaults, acodec_xlat, key, mac_val);
- if (gval)
- ghb_dict_insert(dict, g_strdup(key), gval);
-
- adeflist = ghb_dict_lookup(defaults, "AudioList");
- if (adeflist)
- {
- adefaults = ghb_array_get_nth(adeflist, 0);
- alist = ghb_dict_lookup(dict, "AudioList");
- count = ghb_array_len(alist);
- for (ii = 0; ii < count; ii++)
- {
- adict = ghb_array_get_nth(alist, ii);
- key = "AudioTrack";
- mac_val = ghb_dict_lookup(adict, key);
- gval = import_audio_track_xlat2(mac_val);
- if (gval)
- ghb_dict_insert(adict, g_strdup(key), gval);
- key = "AudioEncoder";
- mac_val = ghb_dict_lookup(adict, key);
- gval = import_value_xlat2(adefaults, acodec_xlat, key, mac_val);
- if (gval)
- ghb_dict_insert(adict, g_strdup(key), gval);
- key = "AudioSamplerate";
- mac_val = ghb_dict_lookup(adict, key);
- gval = import_value_xlat2(adefaults, samplerate_xlat, key, mac_val);
- if (gval)
- ghb_dict_insert(adict, g_strdup(key), gval);
- key = "AudioMixdown";
- mac_val = ghb_dict_lookup(adict, key);
- gval = import_value_xlat2(adefaults, mix_xlat, key, mac_val);
- if (gval)
- ghb_dict_insert(adict, g_strdup(key), gval);
-
- mac_val = ghb_dict_lookup(adict, "AudioTrackDRCSlider");
- if (mac_val != NULL)
- {
- gdouble drc;
- drc = ghb_value_double(mac_val);
- if (drc < 1.0 && drc > 0.0)
- {
- ghb_dict_insert(adict, g_strdup("AudioTrackDRCSlider"),
- ghb_double_value_new(0.0));
- }
- }
- }
- }
+ GValue *defaults, *mac_val, *gval;
+ const gchar *key;
+
+ defaults = plist_get_dict(internalPlist, "Presets");
+ key = "VideoEncoder";
+ mac_val = ghb_dict_lookup(dict, key);
+ gval = import_value_xlat2(defaults, vcodec_xlat, key, mac_val);
+ if (gval)
+ ghb_dict_insert(dict, g_strdup(key), gval);
+ key = "FileFormat";
+ mac_val = ghb_dict_lookup(dict, key);
+ gval = import_value_xlat2(defaults, container_xlat, key, mac_val);
+ if (gval)
+ ghb_dict_insert(dict, g_strdup(key), gval);
+ key = "VideoFramerate";
+ mac_val = ghb_dict_lookup(dict, key);
+ gval = import_value_xlat2(defaults, framerate_xlat, key, mac_val);
+ if (gval)
+ ghb_dict_insert(dict, g_strdup(key), gval);
+ key = "PictureDetelecine";
+ mac_val = ghb_dict_lookup(dict, key);
+ gval = import_value_xlat2(defaults, detel_xlat, key, mac_val);
+ if (gval)
+ ghb_dict_insert(dict, g_strdup(key), gval);
+ key = "PictureDecomb";
+ mac_val = ghb_dict_lookup(dict, key);
+ gval = import_value_xlat2(defaults, decomb_xlat, key, mac_val);
+ if (gval)
+ ghb_dict_insert(dict, g_strdup(key), gval);
+ key = "PictureDeinterlace";
+ mac_val = ghb_dict_lookup(dict, key);
+ gval = import_value_xlat2(defaults, deint_xlat, key, mac_val);
+ if (gval)
+ ghb_dict_insert(dict, g_strdup(key), gval);
+ key = "PictureDenoise";
+ mac_val = ghb_dict_lookup(dict, key);
+ gval = import_value_xlat2(defaults, denoise_xlat, key, mac_val);
+ if (gval)
+ ghb_dict_insert(dict, g_strdup(key), gval);
+
+ GValue *sdeflist;
+ GValue *slist;
+ GValue *sdict;
+ gint count, ii;
+
+ sdeflist = ghb_dict_lookup(defaults, "SubtitleList");
+ if (sdeflist)
+ {
+ slist = ghb_dict_lookup(dict, "SubtitleList");
+ if (slist)
+ {
+ count = ghb_array_len(slist);
+ for (ii = 0; ii < count; ii++)
+ {
+ sdict = ghb_array_get_nth(slist, ii);
+ key = "SubtitleLanguage";
+ mac_val = ghb_dict_lookup(sdict, key);
+ gval = import_subtitle_xlat2(mac_val);
+ if (gval)
+ ghb_dict_insert(sdict, g_strdup(key), gval);
+ }
+
+ }
+ else
+ {
+ key = "Subtitles";
+ mac_val = ghb_dict_lookup(dict, key);
+ slist = ghb_array_value_new(8);
+ ghb_dict_insert(dict, g_strdup("SubtitleList"), slist);
+ if (mac_val)
+ {
+ gchar *lang;
+
+ gval = import_subtitle_xlat2(mac_val);
+ lang = ghb_value_string(gval);
+ if (lang && strcasecmp(lang, "none") != 0 && !slist)
+ {
+ sdict = ghb_dict_value_new();
+ ghb_array_append(slist, sdict);
+ ghb_dict_insert(sdict, g_strdup("SubtitleLanguage"), gval);
+ gval = ghb_dict_lookup(dict, "SubtitlesForced");
+ if (gval != NULL)
+ {
+ ghb_dict_insert(sdict, g_strdup("SubtitleForced"),
+ ghb_value_dup(gval));
+ }
+ else
+ {
+ ghb_dict_insert(sdict, g_strdup("SubtitleForced"),
+ ghb_boolean_value_new(FALSE));
+ }
+ ghb_dict_insert(sdict, g_strdup("SubtitleBurned"),
+ ghb_boolean_value_new(TRUE));
+ ghb_dict_insert(sdict, g_strdup("SubtitleDefaultTrack"),
+ ghb_boolean_value_new(FALSE));
+ }
+ else
+ {
+ ghb_value_free(gval);
+ }
+ if (lang)
+ g_free(lang);
+ }
+ }
+ }
+ ghb_dict_remove(dict, "Subtitles");
+ ghb_dict_remove(dict, "SubtitlesForced");
+
+
+ GValue *alist;
+ GValue *adict;
+ GValue *adefaults;
+ GValue *adeflist;
+
+ key = "AudioEncoderFallback";
+ mac_val = ghb_dict_lookup(dict, key);
+ gval = import_value_xlat2(defaults, acodec_xlat, key, mac_val);
+ if (gval)
+ ghb_dict_insert(dict, g_strdup(key), gval);
+
+ adeflist = ghb_dict_lookup(defaults, "AudioList");
+ if (adeflist)
+ {
+ adefaults = ghb_array_get_nth(adeflist, 0);
+ alist = ghb_dict_lookup(dict, "AudioList");
+ count = ghb_array_len(alist);
+ for (ii = 0; ii < count; ii++)
+ {
+ adict = ghb_array_get_nth(alist, ii);
+ key = "AudioTrack";
+ mac_val = ghb_dict_lookup(adict, key);
+ gval = import_audio_track_xlat2(mac_val);
+ if (gval)
+ ghb_dict_insert(adict, g_strdup(key), gval);
+ key = "AudioEncoder";
+ mac_val = ghb_dict_lookup(adict, key);
+ gval = import_value_xlat2(adefaults, acodec_xlat, key, mac_val);
+ if (gval)
+ ghb_dict_insert(adict, g_strdup(key), gval);
+ key = "AudioSamplerate";
+ mac_val = ghb_dict_lookup(adict, key);
+ gval = import_value_xlat2(adefaults, samplerate_xlat, key, mac_val);
+ if (gval)
+ ghb_dict_insert(adict, g_strdup(key), gval);
+ key = "AudioMixdown";
+ mac_val = ghb_dict_lookup(adict, key);
+ gval = import_value_xlat2(adefaults, mix_xlat, key, mac_val);
+ if (gval)
+ ghb_dict_insert(adict, g_strdup(key), gval);
+
+ mac_val = ghb_dict_lookup(adict, "AudioTrackDRCSlider");
+ if (mac_val != NULL)
+ {
+ gdouble drc;
+ drc = ghb_value_double(mac_val);
+ if (drc < 1.0 && drc > 0.0)
+ {
+ ghb_dict_insert(adict, g_strdup("AudioTrackDRCSlider"),
+ ghb_double_value_new(0.0));
+ }
+ }
+ }
+ }
}
static void
import_xlat_preset(GValue *dict)
{
- gboolean uses_max;
- gint uses_pic;
- gint par;
- gint vqtype;
-
- g_debug("import_xlat_preset ()");
-
- uses_max = ghb_value_boolean(
- preset_dict_get_value(dict, "UsesMaxPictureSettings"));
- uses_pic = ghb_value_int(
- preset_dict_get_value(dict, "UsesPictureSettings"));
- par = ghb_value_int(preset_dict_get_value(dict, "PicturePAR"));
- vqtype = ghb_value_int(preset_dict_get_value(dict, "VideoQualityType"));
-
- if (uses_max || uses_pic == 2)
- {
- ghb_dict_insert(dict, g_strdup("autoscale"),
- ghb_boolean_value_new(TRUE));
- }
- switch (par)
- {
- case 0:
- {
- if (ghb_dict_lookup(dict, "PictureModulus") == NULL)
- ghb_dict_insert(dict, g_strdup("PictureModulus"),
- ghb_int_value_new(16));
- } break;
- case 1:
- {
- ghb_dict_insert(dict, g_strdup("PictureModulus"),
- ghb_int_value_new(1));
- } break;
- case 2:
- {
- if (ghb_dict_lookup(dict, "PictureModulus") == NULL)
- ghb_dict_insert(dict, g_strdup("PictureModulus"),
- ghb_int_value_new(16));
- } break;
- default:
- {
- if (ghb_dict_lookup(dict, "PictureModulus") == NULL)
- ghb_dict_insert(dict, g_strdup("PictureModulus"),
- ghb_int_value_new(16));
- } break;
- }
- // VideoQualityType/0/1/2 - vquality_type_/target/bitrate/constant
- // *note: target is no longer used
- switch (vqtype)
- {
- case 0:
- {
- ghb_dict_insert(dict, g_strdup("vquality_type_bitrate"),
- ghb_boolean_value_new(TRUE));
- ghb_dict_insert(dict, g_strdup("vquality_type_constant"),
- ghb_boolean_value_new(FALSE));
- } break;
- case 1:
- {
- ghb_dict_insert(dict, g_strdup("vquality_type_bitrate"),
- ghb_boolean_value_new(TRUE));
- ghb_dict_insert(dict, g_strdup("vquality_type_constant"),
- ghb_boolean_value_new(FALSE));
- } break;
- case 2:
- {
- ghb_dict_insert(dict, g_strdup("vquality_type_bitrate"),
- ghb_boolean_value_new(FALSE));
- ghb_dict_insert(dict, g_strdup("vquality_type_constant"),
- ghb_boolean_value_new(TRUE));
- } break;
- default:
- {
- ghb_dict_insert(dict, g_strdup("vquality_type_bitrate"),
- ghb_boolean_value_new(FALSE));
- ghb_dict_insert(dict, g_strdup("vquality_type_constant"),
- ghb_boolean_value_new(TRUE));
- } break;
- }
-
- import_value_xlat(dict);
-
- GValue *mode = ghb_dict_lookup(dict, "VideoFramerateMode");
- if (mode == NULL)
- {
- GValue *fr = ghb_dict_lookup(dict, "VideoFramerate");
- if (fr)
- {
- gchar *str;
- gboolean pfr = FALSE;
- GValue *pfr_val = ghb_dict_lookup(dict, "VideoFrameratePFR");
- if (pfr_val)
- {
- pfr = ghb_value_boolean(pfr_val);
- }
- str = ghb_value_string(fr);
- if (strcmp(str, "source") == 0)
- {
- ghb_dict_insert(dict, g_strdup("VideoFramerateCFR"),
- ghb_boolean_value_new(FALSE));
- ghb_dict_insert(dict, g_strdup("VideoFramerateVFR"),
- ghb_boolean_value_new(TRUE));
- }
- else if (!pfr)
- {
- ghb_dict_insert(dict, g_strdup("VideoFramerateCFR"),
- ghb_boolean_value_new(TRUE));
- ghb_dict_insert(dict, g_strdup("VideoFramerateVFR"),
- ghb_boolean_value_new(FALSE));
- }
- else
- {
- ghb_dict_insert(dict, g_strdup("VideoFramerateCFR"),
- ghb_boolean_value_new(FALSE));
- ghb_dict_insert(dict, g_strdup("VideoFramerateVFR"),
- ghb_boolean_value_new(FALSE));
- }
+ gboolean uses_max;
+ gint uses_pic;
+ gint par;
+ gint vqtype;
+
+ g_debug("import_xlat_preset ()");
+
+ uses_max = ghb_value_boolean(
+ preset_dict_get_value(dict, "UsesMaxPictureSettings"));
+ uses_pic = ghb_value_int(
+ preset_dict_get_value(dict, "UsesPictureSettings"));
+ par = ghb_value_int(preset_dict_get_value(dict, "PicturePAR"));
+ vqtype = ghb_value_int(preset_dict_get_value(dict, "VideoQualityType"));
+
+ if (uses_max || uses_pic == 2)
+ {
+ ghb_dict_insert(dict, g_strdup("autoscale"),
+ ghb_boolean_value_new(TRUE));
+ }
+ switch (par)
+ {
+ case 0:
+ {
+ if (ghb_dict_lookup(dict, "PictureModulus") == NULL)
+ ghb_dict_insert(dict, g_strdup("PictureModulus"),
+ ghb_int_value_new(16));
+ } break;
+ case 1:
+ {
+ ghb_dict_insert(dict, g_strdup("PictureModulus"),
+ ghb_int_value_new(1));
+ } break;
+ case 2:
+ {
+ if (ghb_dict_lookup(dict, "PictureModulus") == NULL)
+ ghb_dict_insert(dict, g_strdup("PictureModulus"),
+ ghb_int_value_new(16));
+ } break;
+ default:
+ {
+ if (ghb_dict_lookup(dict, "PictureModulus") == NULL)
+ ghb_dict_insert(dict, g_strdup("PictureModulus"),
+ ghb_int_value_new(16));
+ } break;
+ }
+ // VideoQualityType/0/1/2 - vquality_type_/target/bitrate/constant
+ // *note: target is no longer used
+ switch (vqtype)
+ {
+ case 0:
+ {
+ ghb_dict_insert(dict, g_strdup("vquality_type_bitrate"),
+ ghb_boolean_value_new(TRUE));
+ ghb_dict_insert(dict, g_strdup("vquality_type_constant"),
+ ghb_boolean_value_new(FALSE));
+ } break;
+ case 1:
+ {
+ ghb_dict_insert(dict, g_strdup("vquality_type_bitrate"),
+ ghb_boolean_value_new(TRUE));
+ ghb_dict_insert(dict, g_strdup("vquality_type_constant"),
+ ghb_boolean_value_new(FALSE));
+ } break;
+ case 2:
+ {
+ ghb_dict_insert(dict, g_strdup("vquality_type_bitrate"),
+ ghb_boolean_value_new(FALSE));
+ ghb_dict_insert(dict, g_strdup("vquality_type_constant"),
+ ghb_boolean_value_new(TRUE));
+ } break;
+ default:
+ {
+ ghb_dict_insert(dict, g_strdup("vquality_type_bitrate"),
+ ghb_boolean_value_new(FALSE));
+ ghb_dict_insert(dict, g_strdup("vquality_type_constant"),
+ ghb_boolean_value_new(TRUE));
+ } break;
+ }
+
+ import_value_xlat(dict);
+
+ GValue *mode = ghb_dict_lookup(dict, "VideoFramerateMode");
+ if (mode == NULL)
+ {
+ GValue *fr = ghb_dict_lookup(dict, "VideoFramerate");
+ if (fr)
+ {
+ gchar *str;
+ gboolean pfr = FALSE;
+ GValue *pfr_val = ghb_dict_lookup(dict, "VideoFrameratePFR");
+ if (pfr_val)
+ {
+ pfr = ghb_value_boolean(pfr_val);
+ }
+ str = ghb_value_string(fr);
+ if (strcmp(str, "source") == 0)
+ {
+ ghb_dict_insert(dict, g_strdup("VideoFramerateCFR"),
+ ghb_boolean_value_new(FALSE));
+ ghb_dict_insert(dict, g_strdup("VideoFramerateVFR"),
+ ghb_boolean_value_new(TRUE));
+ }
+ else if (!pfr)
+ {
+ ghb_dict_insert(dict, g_strdup("VideoFramerateCFR"),
+ ghb_boolean_value_new(TRUE));
+ ghb_dict_insert(dict, g_strdup("VideoFramerateVFR"),
+ ghb_boolean_value_new(FALSE));
+ }
+ else
+ {
+ ghb_dict_insert(dict, g_strdup("VideoFramerateCFR"),
+ ghb_boolean_value_new(FALSE));
+ ghb_dict_insert(dict, g_strdup("VideoFramerateVFR"),
+ ghb_boolean_value_new(FALSE));
+ }
g_free(str);
- }
- }
- else
- {
- gchar *str;
- str = ghb_value_string(mode);
- if (strcmp(str, "cfr") == 0)
- {
- ghb_dict_insert(dict, g_strdup("VideoFramerateCFR"),
- ghb_boolean_value_new(TRUE));
- ghb_dict_insert(dict, g_strdup("VideoFrameratePFR"),
- ghb_boolean_value_new(FALSE));
- ghb_dict_insert(dict, g_strdup("VideoFramerateVFR"),
- ghb_boolean_value_new(FALSE));
- }
- else if (strcmp(str, "pfr") == 0)
- {
- ghb_dict_insert(dict, g_strdup("VideoFramerateCFR"),
- ghb_boolean_value_new(FALSE));
- ghb_dict_insert(dict, g_strdup("VideoFrameratePFR"),
- ghb_boolean_value_new(TRUE));
- ghb_dict_insert(dict, g_strdup("VideoFramerateVFR"),
- ghb_boolean_value_new(FALSE));
- }
- else
- {
- ghb_dict_insert(dict, g_strdup("VideoFramerateCFR"),
- ghb_boolean_value_new(FALSE));
- ghb_dict_insert(dict, g_strdup("VideoFrameratePFR"),
- ghb_boolean_value_new(FALSE));
- ghb_dict_insert(dict, g_strdup("VideoFramerateVFR"),
- ghb_boolean_value_new(TRUE));
- }
- g_free(str);
- }
+ }
+ }
+ else
+ {
+ gchar *str;
+ str = ghb_value_string(mode);
+ if (strcmp(str, "cfr") == 0)
+ {
+ ghb_dict_insert(dict, g_strdup("VideoFramerateCFR"),
+ ghb_boolean_value_new(TRUE));
+ ghb_dict_insert(dict, g_strdup("VideoFrameratePFR"),
+ ghb_boolean_value_new(FALSE));
+ ghb_dict_insert(dict, g_strdup("VideoFramerateVFR"),
+ ghb_boolean_value_new(FALSE));
+ }
+ else if (strcmp(str, "pfr") == 0)
+ {
+ ghb_dict_insert(dict, g_strdup("VideoFramerateCFR"),
+ ghb_boolean_value_new(FALSE));
+ ghb_dict_insert(dict, g_strdup("VideoFrameratePFR"),
+ ghb_boolean_value_new(TRUE));
+ ghb_dict_insert(dict, g_strdup("VideoFramerateVFR"),
+ ghb_boolean_value_new(FALSE));
+ }
+ else
+ {
+ ghb_dict_insert(dict, g_strdup("VideoFramerateCFR"),
+ ghb_boolean_value_new(FALSE));
+ ghb_dict_insert(dict, g_strdup("VideoFrameratePFR"),
+ ghb_boolean_value_new(FALSE));
+ ghb_dict_insert(dict, g_strdup("VideoFramerateVFR"),
+ ghb_boolean_value_new(TRUE));
+ }
+ g_free(str);
+ }
const char * const *preset = hb_x264_presets();
if (ghb_value_boolean(preset_dict_get_value(dict, "x264UseAdvancedOptions")))
@@ -2910,97 +2910,97 @@ import_xlat_preset(GValue *dict)
static void
import_xlat_presets(GValue *presets)
{
- gint count, ii;
- GValue *dict;
- gboolean folder;
-
- g_debug("import_xlat_presets ()");
- if (presets == NULL) return;
- count = ghb_array_len(presets);
- for (ii = 0; ii < count; ii++)
- {
- dict = ghb_array_get_nth(presets, ii);
- folder = ghb_value_boolean(preset_dict_get_value(dict, "Folder"));
- if (folder)
- {
- GValue *nested;
-
- nested = ghb_dict_lookup(dict, "ChildrenArray");
- import_xlat_presets(nested);
- }
- else
- {
- import_xlat_preset(dict);
- }
- }
+ gint count, ii;
+ GValue *dict;
+ gboolean folder;
+
+ g_debug("import_xlat_presets ()");
+ if (presets == NULL) return;
+ count = ghb_array_len(presets);
+ for (ii = 0; ii < count; ii++)
+ {
+ dict = ghb_array_get_nth(presets, ii);
+ folder = ghb_value_boolean(preset_dict_get_value(dict, "Folder"));
+ if (folder)
+ {
+ GValue *nested;
+
+ nested = ghb_dict_lookup(dict, "ChildrenArray");
+ import_xlat_presets(nested);
+ }
+ else
+ {
+ import_xlat_preset(dict);
+ }
+ }
}
static void
export_xlat_preset(GValue *dict)
{
- gboolean autoscale, br, constant;
-
- g_debug("export_xlat_prest ()");
- autoscale = ghb_value_boolean(preset_dict_get_value(dict, "autoscale"));
- br = ghb_value_boolean(
- preset_dict_get_value(dict, "vquality_type_bitrate"));
- constant = ghb_value_boolean(
- preset_dict_get_value(dict, "vquality_type_constant"));
-
- if (autoscale)
- ghb_dict_insert(dict, g_strdup("UsesPictureSettings"),
- ghb_int_value_new(2));
- else
- ghb_dict_insert(dict, g_strdup("UsesPictureSettings"),
- ghb_int_value_new(1));
-
- // VideoQualityType/0/1/2 - vquality_type_/target/bitrate/constant
- // *note: target is no longer used
- if (br)
- {
- ghb_dict_insert(dict, g_strdup("VideoQualityType"),
- ghb_int_value_new(1));
- }
- else if (constant)
- {
- ghb_dict_insert(dict, g_strdup("VideoQualityType"),
- ghb_int_value_new(2));
- }
-
- if (ghb_value_boolean(preset_dict_get_value(dict, "VideoFramerateCFR")))
- {
- ghb_dict_insert(dict, g_strdup("VideoFramerateMode"),
- ghb_string_value_new("cfr"));
- }
- else if (ghb_value_boolean(preset_dict_get_value(dict, "VideoFrameratePFR")))
- {
- ghb_dict_insert(dict, g_strdup("VideoFramerateMode"),
- ghb_string_value_new("pfr"));
- }
- else
- {
- ghb_dict_insert(dict, g_strdup("VideoFramerateMode"),
- ghb_string_value_new("vfr"));
- }
-
- GValue *alist, *adict;
- gint count, ii;
-
- alist = ghb_dict_lookup(dict, "AudioList");
- count = ghb_array_len(alist);
- for (ii = 0; ii < count; ii++)
- {
- gdouble drc;
-
- adict = ghb_array_get_nth(alist, ii);
- drc = ghb_value_double(
- preset_dict_get_value(adict, "AudioTrackDRCSlider"));
- if (drc < 1.0 && drc > 0.0)
- {
- ghb_dict_insert(adict, g_strdup("AudioTrackDRCSlider"),
- ghb_double_value_new(0.0));
- }
- }
+ gboolean autoscale, br, constant;
+
+ g_debug("export_xlat_prest ()");
+ autoscale = ghb_value_boolean(preset_dict_get_value(dict, "autoscale"));
+ br = ghb_value_boolean(
+ preset_dict_get_value(dict, "vquality_type_bitrate"));
+ constant = ghb_value_boolean(
+ preset_dict_get_value(dict, "vquality_type_constant"));
+
+ if (autoscale)
+ ghb_dict_insert(dict, g_strdup("UsesPictureSettings"),
+ ghb_int_value_new(2));
+ else
+ ghb_dict_insert(dict, g_strdup("UsesPictureSettings"),
+ ghb_int_value_new(1));
+
+ // VideoQualityType/0/1/2 - vquality_type_/target/bitrate/constant
+ // *note: target is no longer used
+ if (br)
+ {
+ ghb_dict_insert(dict, g_strdup("VideoQualityType"),
+ ghb_int_value_new(1));
+ }
+ else if (constant)
+ {
+ ghb_dict_insert(dict, g_strdup("VideoQualityType"),
+ ghb_int_value_new(2));
+ }
+
+ if (ghb_value_boolean(preset_dict_get_value(dict, "VideoFramerateCFR")))
+ {
+ ghb_dict_insert(dict, g_strdup("VideoFramerateMode"),
+ ghb_string_value_new("cfr"));
+ }
+ else if (ghb_value_boolean(preset_dict_get_value(dict, "VideoFrameratePFR")))
+ {
+ ghb_dict_insert(dict, g_strdup("VideoFramerateMode"),
+ ghb_string_value_new("pfr"));
+ }
+ else
+ {
+ ghb_dict_insert(dict, g_strdup("VideoFramerateMode"),
+ ghb_string_value_new("vfr"));
+ }
+
+ GValue *alist, *adict;
+ gint count, ii;
+
+ alist = ghb_dict_lookup(dict, "AudioList");
+ count = ghb_array_len(alist);
+ for (ii = 0; ii < count; ii++)
+ {
+ gdouble drc;
+
+ adict = ghb_array_get_nth(alist, ii);
+ drc = ghb_value_double(
+ preset_dict_get_value(adict, "AudioTrackDRCSlider"));
+ if (drc < 1.0 && drc > 0.0)
+ {
+ ghb_dict_insert(adict, g_strdup("AudioTrackDRCSlider"),
+ ghb_double_value_new(0.0));
+ }
+ }
const char *tune = dict_get_string(dict, "x264Tune");
if (tune != NULL)
@@ -3024,53 +3024,53 @@ export_xlat_preset(GValue *dict)
g_free(tunes);
}
- GValue *internal;
- GHashTableIter iter;
- gchar *key;
- GValue *value;
- internal = plist_get_dict(internalPlist, "XlatPresets");
- ghb_dict_iter_init(&iter, internal);
- // middle (void*) cast prevents gcc warning "defreferencing type-punned
- // pointer will break strict-aliasing rules"
- while (g_hash_table_iter_next(
- &iter, (gpointer*)(void*)&key, (gpointer*)(void*)&value))
- {
- ghb_dict_remove(dict, key);
- }
-
- // remove obsolete keys
- ghb_dict_remove(dict, "UsesMaxPictureSettings");
- ghb_dict_remove(dict, "VFR");
- ghb_dict_remove(dict, "VideoFrameratePFR");
-
- export_value_xlat(dict);
+ GValue *internal;
+ GHashTableIter iter;
+ gchar *key;
+ GValue *value;
+ internal = plist_get_dict(internalPlist, "XlatPresets");
+ ghb_dict_iter_init(&iter, internal);
+ // middle (void*) cast prevents gcc warning "defreferencing type-punned
+ // pointer will break strict-aliasing rules"
+ while (g_hash_table_iter_next(
+ &iter, (gpointer*)(void*)&key, (gpointer*)(void*)&value))
+ {
+ ghb_dict_remove(dict, key);
+ }
+
+ // remove obsolete keys
+ ghb_dict_remove(dict, "UsesMaxPictureSettings");
+ ghb_dict_remove(dict, "VFR");
+ ghb_dict_remove(dict, "VideoFrameratePFR");
+
+ export_value_xlat(dict);
}
static void
export_xlat_presets(GValue *presets)
{
- gint count, ii;
- GValue *dict;
- gboolean folder;
-
- if (presets == NULL) return;
- count = ghb_array_len(presets);
- for (ii = 0; ii < count; ii++)
- {
- dict = ghb_array_get_nth(presets, ii);
- folder = ghb_value_boolean(preset_dict_get_value(dict, "Folder"));
- if (folder)
- {
- GValue *nested;
-
- nested = ghb_dict_lookup(dict, "ChildrenArray");
- export_xlat_presets(nested);
- }
- else
- {
- export_xlat_preset(dict);
- }
- }
+ gint count, ii;
+ GValue *dict;
+ gboolean folder;
+
+ if (presets == NULL) return;
+ count = ghb_array_len(presets);
+ for (ii = 0; ii < count; ii++)
+ {
+ dict = ghb_array_get_nth(presets, ii);
+ folder = ghb_value_boolean(preset_dict_get_value(dict, "Folder"));
+ if (folder)
+ {
+ GValue *nested;
+
+ nested = ghb_dict_lookup(dict, "ChildrenArray");
+ export_xlat_presets(nested);
+ }
+ else
+ {
+ export_xlat_preset(dict);
+ }
+ }
}
static guint prefs_timeout_id = 0;
@@ -3078,1562 +3078,1562 @@ static guint prefs_timeout_id = 0;
static gboolean
delayed_store_prefs(gpointer data)
{
- store_plist(prefsPlist, "preferences");
- prefs_timeout_id = 0;
- return FALSE;
+ store_plist(prefsPlist, "preferences");
+ prefs_timeout_id = 0;
+ return FALSE;
}
static void
store_presets()
{
- GValue *export;
+ GValue *export;
- export = ghb_value_dup(presetsPlist);
- export_xlat_presets(export);
- store_plist(export, "presets");
- ghb_value_free(export);
+ export = ghb_value_dup(presetsPlist);
+ export_xlat_presets(export);
+ store_plist(export, "presets");
+ ghb_value_free(export);
}
static void
store_prefs(void)
{
- if (prefs_timeout_id != 0)
- {
- GMainContext *mc;
- GSource *source;
-
- mc = g_main_context_default();
- source = g_main_context_find_source_by_id(mc, prefs_timeout_id);
- if (source != NULL)
- g_source_destroy(source);
- }
- prefs_timeout_id = g_timeout_add_seconds(1, (GSourceFunc)delayed_store_prefs, NULL);
+ if (prefs_timeout_id != 0)
+ {
+ GMainContext *mc;
+ GSource *source;
+
+ mc = g_main_context_default();
+ source = g_main_context_find_source_by_id(mc, prefs_timeout_id);
+ if (source != NULL)
+ g_source_destroy(source);
+ }
+ prefs_timeout_id = g_timeout_add_seconds(1, (GSourceFunc)delayed_store_prefs, NULL);
}
void
ghb_presets_reload(signal_user_data_t *ud)
{
- GValue *std_presets;
- gint count, ii;
- int *indices, len;
-
- g_debug("ghb_presets_reload()\n");
- std_presets = ghb_resource_get("standard-presets");
- if (std_presets == NULL) return;
-
- remove_std_presets(ud);
- indices = presets_find_default(presetsPlist, &len);
- if (indices)
- {
- presets_clear_default(std_presets);
- g_free(indices);
- }
- // Merge the keyfile contents into our presets
- count = ghb_array_len(std_presets);
- for (ii = count-1; ii >= 0; ii--)
- {
- GValue *std_dict;
- GValue *copy_dict;
- gint indices = 0;
-
- std_dict = ghb_array_get_nth(std_presets, ii);
- copy_dict = ghb_value_dup(std_dict);
- ghb_dict_insert(copy_dict, g_strdup("PresetBuildNumber"),
- ghb_int64_value_new(hb_get_build(NULL)));
- ghb_presets_insert(presetsPlist, copy_dict, &indices, 1);
- presets_list_insert(ud, &indices, 1);
- }
- import_xlat_presets(presetsPlist);
- store_presets();
+ GValue *std_presets;
+ gint count, ii;
+ int *indices, len;
+
+ g_debug("ghb_presets_reload()\n");
+ std_presets = ghb_resource_get("standard-presets");
+ if (std_presets == NULL) return;
+
+ remove_std_presets(ud);
+ indices = presets_find_default(presetsPlist, &len);
+ if (indices)
+ {
+ presets_clear_default(std_presets);
+ g_free(indices);
+ }
+ // Merge the keyfile contents into our presets
+ count = ghb_array_len(std_presets);
+ for (ii = count-1; ii >= 0; ii--)
+ {
+ GValue *std_dict;
+ GValue *copy_dict;
+ gint indices = 0;
+
+ std_dict = ghb_array_get_nth(std_presets, ii);
+ copy_dict = ghb_value_dup(std_dict);
+ ghb_dict_insert(copy_dict, g_strdup("PresetBuildNumber"),
+ ghb_int64_value_new(hb_get_build(NULL)));
+ ghb_presets_insert(presetsPlist, copy_dict, &indices, 1);
+ presets_list_insert(ud, &indices, 1);
+ }
+ import_xlat_presets(presetsPlist);
+ store_presets();
}
static gboolean
check_old_presets()
{
- gint count, ii;
+ gint count, ii;
- count = ghb_array_len(presetsPlist);
- for (ii = count-1; ii >= 0; ii--)
- {
- GValue *dict;
- GValue *type;
+ count = ghb_array_len(presetsPlist);
+ for (ii = count-1; ii >= 0; ii--)
+ {
+ GValue *dict;
+ GValue *type;
- dict = ghb_array_get_nth(presetsPlist, ii);
- type = ghb_dict_lookup(dict, "Type");
- if (type == NULL)
- return TRUE;
- }
- return FALSE;
+ dict = ghb_array_get_nth(presetsPlist, ii);
+ type = ghb_dict_lookup(dict, "Type");
+ if (type == NULL)
+ return TRUE;
+ }
+ return FALSE;
}
static void
replace_standard_presets()
{
- GValue *std_presets;
- int *indices, len;
- gint count, ii;
-
- count = ghb_array_len(presetsPlist);
- for (ii = count-1; ii >= 0; ii--)
- {
- GValue *dict;
- gint ptype;
-
- dict = ghb_array_get_nth(presetsPlist, ii);
- ptype = ghb_value_int(preset_dict_get_value(dict, "Type"));
- if (ptype == PRESETS_BUILTIN)
- {
- gint indices = 0;
- ghb_presets_remove(presetsPlist, &indices, 1);
- }
- }
-
- std_presets = ghb_resource_get("standard-presets");
- if (std_presets == NULL) return;
-
- indices = presets_find_default(presetsPlist, &len);
- if (indices)
- {
- presets_clear_default(std_presets);
- g_free(indices);
- }
- // Merge the keyfile contents into our presets
- count = ghb_array_len(std_presets);
- for (ii = count-1; ii >= 0; ii--)
- {
- GValue *std_dict;
- GValue *copy_dict;
- gint indices = 0;
-
- std_dict = ghb_array_get_nth(std_presets, ii);
- copy_dict = ghb_value_dup(std_dict);
- ghb_dict_insert(copy_dict, g_strdup("PresetBuildNumber"),
- ghb_int64_value_new(hb_get_build(NULL)));
- ghb_presets_insert(presetsPlist, copy_dict, &indices, 1);
- }
- import_xlat_presets(presetsPlist);
- store_presets();
+ GValue *std_presets;
+ int *indices, len;
+ gint count, ii;
+
+ count = ghb_array_len(presetsPlist);
+ for (ii = count-1; ii >= 0; ii--)
+ {
+ GValue *dict;
+ gint ptype;
+
+ dict = ghb_array_get_nth(presetsPlist, ii);
+ ptype = ghb_value_int(preset_dict_get_value(dict, "Type"));
+ if (ptype == PRESETS_BUILTIN)
+ {
+ gint indices = 0;
+ ghb_presets_remove(presetsPlist, &indices, 1);
+ }
+ }
+
+ std_presets = ghb_resource_get("standard-presets");
+ if (std_presets == NULL) return;
+
+ indices = presets_find_default(presetsPlist, &len);
+ if (indices)
+ {
+ presets_clear_default(std_presets);
+ g_free(indices);
+ }
+ // Merge the keyfile contents into our presets
+ count = ghb_array_len(std_presets);
+ for (ii = count-1; ii >= 0; ii--)
+ {
+ GValue *std_dict;
+ GValue *copy_dict;
+ gint indices = 0;
+
+ std_dict = ghb_array_get_nth(std_presets, ii);
+ copy_dict = ghb_value_dup(std_dict);
+ ghb_dict_insert(copy_dict, g_strdup("PresetBuildNumber"),
+ ghb_int64_value_new(hb_get_build(NULL)));
+ ghb_presets_insert(presetsPlist, copy_dict, &indices, 1);
+ }
+ import_xlat_presets(presetsPlist);
+ store_presets();
}
static int
update_standard_presets(signal_user_data_t *ud)
{
- gint count, ii;
-
- count = ghb_array_len(presetsPlist);
- for (ii = count-1; ii >= 0; ii--)
- {
- GValue *dict;
- const GValue *gval;
- gint64 build;
- gint type;
-
- dict = ghb_array_get_nth(presetsPlist, ii);
- gval = ghb_dict_lookup(dict, "Type");
- if (gval == NULL)
- {
- // Old preset that doesn't have a Type
- replace_standard_presets();
- return 1;
- }
-
- type = ghb_value_int(gval);
- if (type == 0)
- {
- gval = ghb_dict_lookup(dict, "PresetBuildNumber");
- if (gval == NULL)
- {
- // Old preset that doesn't have a build number
- replace_standard_presets();
- return 1;
- }
-
- build = ghb_value_int64(gval);
- if (build != hb_get_build(NULL))
- {
- // Build number does not match
- replace_standard_presets();
- return 1;
- }
- }
- }
- return 0;
+ gint count, ii;
+
+ count = ghb_array_len(presetsPlist);
+ for (ii = count-1; ii >= 0; ii--)
+ {
+ GValue *dict;
+ const GValue *gval;
+ gint64 build;
+ gint type;
+
+ dict = ghb_array_get_nth(presetsPlist, ii);
+ gval = ghb_dict_lookup(dict, "Type");
+ if (gval == NULL)
+ {
+ // Old preset that doesn't have a Type
+ replace_standard_presets();
+ return 1;
+ }
+
+ type = ghb_value_int(gval);
+ if (type == 0)
+ {
+ gval = ghb_dict_lookup(dict, "PresetBuildNumber");
+ if (gval == NULL)
+ {
+ // Old preset that doesn't have a build number
+ replace_standard_presets();
+ return 1;
+ }
+
+ build = ghb_value_int64(gval);
+ if (build != hb_get_build(NULL))
+ {
+ // Build number does not match
+ replace_standard_presets();
+ return 1;
+ }
+ }
+ }
+ return 0;
}
void
ghb_presets_load(signal_user_data_t *ud)
{
- int ii, jj;
-
- // Create audio mixdown translation table
- mix_xlat = malloc(sizeof(value_map_t) *
- (hb_audio_mixdowns_count +
- sizeof(mix_xlat_compat) / sizeof(value_map_t)));
- for (ii = 0; ii < hb_audio_mixdowns_count; ii++)
- {
- mix_xlat[ii].mac_val = hb_audio_mixdowns[ii].human_readable_name;
- mix_xlat[ii].lin_val = hb_audio_mixdowns[ii].short_name;
- }
- for (jj = 0; mix_xlat_compat[jj].mac_val != NULL; jj++, ii++)
- {
- mix_xlat[ii] = mix_xlat_compat[jj];
- }
- mix_xlat[ii].mac_val = NULL;
- mix_xlat[ii].lin_val = NULL;
-
- presetsPlist = load_plist("presets");
- if (presetsPlist == NULL)
- {
- presetsPlist = ghb_value_dup(ghb_resource_get("standard-presets"));
- import_xlat_presets(presetsPlist);
- store_presets();
- }
- else if (G_VALUE_TYPE(presetsPlist) == ghb_dict_get_type())
- { // Presets is older dictionary format. Convert to array
- ghb_value_free(presetsPlist);
- presetsPlist = ghb_value_dup(ghb_resource_get("standard-presets"));
- import_xlat_presets(presetsPlist);
- store_presets();
- }
- else if (check_old_presets())
- {
- ghb_value_free(presetsPlist);
- presetsPlist = ghb_value_dup(ghb_resource_get("standard-presets"));
- import_xlat_presets(presetsPlist);
- store_presets();
- }
- else
- {
- if (!update_standard_presets(ud))
- import_xlat_presets(presetsPlist);
- }
+ int ii, jj;
+
+ // Create audio mixdown translation table
+ mix_xlat = malloc(sizeof(value_map_t) *
+ (hb_audio_mixdowns_count +
+ sizeof(mix_xlat_compat) / sizeof(value_map_t)));
+ for (ii = 0; ii < hb_audio_mixdowns_count; ii++)
+ {
+ mix_xlat[ii].mac_val = hb_audio_mixdowns[ii].human_readable_name;
+ mix_xlat[ii].lin_val = hb_audio_mixdowns[ii].short_name;
+ }
+ for (jj = 0; mix_xlat_compat[jj].mac_val != NULL; jj++, ii++)
+ {
+ mix_xlat[ii] = mix_xlat_compat[jj];
+ }
+ mix_xlat[ii].mac_val = NULL;
+ mix_xlat[ii].lin_val = NULL;
+
+ presetsPlist = load_plist("presets");
+ if (presetsPlist == NULL)
+ {
+ presetsPlist = ghb_value_dup(ghb_resource_get("standard-presets"));
+ import_xlat_presets(presetsPlist);
+ store_presets();
+ }
+ else if (G_VALUE_TYPE(presetsPlist) == ghb_dict_get_type())
+ { // Presets is older dictionary format. Convert to array
+ ghb_value_free(presetsPlist);
+ presetsPlist = ghb_value_dup(ghb_resource_get("standard-presets"));
+ import_xlat_presets(presetsPlist);
+ store_presets();
+ }
+ else if (check_old_presets())
+ {
+ ghb_value_free(presetsPlist);
+ presetsPlist = ghb_value_dup(ghb_resource_get("standard-presets"));
+ import_xlat_presets(presetsPlist);
+ store_presets();
+ }
+ else
+ {
+ if (!update_standard_presets(ud))
+ import_xlat_presets(presetsPlist);
+ }
}
static void
settings_save(signal_user_data_t *ud, const GValue *path)
{
- GValue *dict, *internal;
- GHashTableIter iter;
- gchar *key;
- GValue *value;
- gint *indices, len, count;
- gint *def_indices, def_len;
- const gchar *name;
- gboolean replace = FALSE;
-
- g_debug("settings_save");
- if (internalPlist == NULL) return;
- count = ghb_array_len(path);
- name = g_value_get_string(ghb_array_get_nth(path, count-1));
- indices = ghb_preset_indices_from_path(presetsPlist, path, &len);
- if (indices)
- {
- if (ghb_presets_get_folder(presetsPlist, indices, len))
- {
- gchar *message;
- message = g_strdup_printf(
- "%s: Folder already exists.\n"
- "You can not replace it with a preset.",
- name);
- ghb_message_dialog(GTK_MESSAGE_ERROR, message, "Cancel", NULL);
- g_free(message);
- return;
- }
- dict = ghb_dict_value_new();
- ghb_presets_replace(presetsPlist, dict, indices, len);
- replace = TRUE;
- }
- else
- {
- indices = presets_find_pos(path, PRESETS_CUSTOM, &len);
- if (indices)
- {
- dict = ghb_dict_value_new();
- ghb_presets_insert(presetsPlist, dict, indices, len);
- }
- else
- {
- g_warning("failed to find insert path");
- return;
- }
- }
- current_preset = dict;
- ghb_settings_set_int64(ud->settings, "Type", PRESETS_CUSTOM);
- ghb_settings_set_int64(ud->settings, "PresetBuildNumber", hb_get_build(NULL));
-
- internal = plist_get_dict(internalPlist, "Presets");
- ghb_dict_iter_init(&iter, internal);
- // middle (void*) cast prevents gcc warning "defreferencing type-punned
- // pointer will break strict-aliasing rules"
- while (g_hash_table_iter_next(
- &iter, (gpointer*)(void*)&key, (gpointer*)(void*)&value))
- {
- const GValue *gval;
-
- gval = ghb_settings_get_value(ud->settings, key);
- if (gval == NULL)
- {
- continue;
- }
- ghb_dict_insert(dict, g_strdup(key), ghb_value_dup(gval));
- }
- internal = plist_get_dict(internalPlist, "XlatPresets");
- ghb_dict_iter_init(&iter, internal);
- // middle (void*) cast prevents gcc warning "defreferencing type-punned
- // pointer will break strict-aliasing rules"
- while (g_hash_table_iter_next(
- &iter, (gpointer*)(void*)&key, (gpointer*)(void*)&value))
- {
- const GValue *gval;
-
- gval = ghb_settings_get_value(ud->settings, key);
- if (gval == NULL)
- {
- continue;
- }
- ghb_dict_insert(dict, g_strdup(key), ghb_value_dup(gval));
- }
- ghb_dict_insert(dict, g_strdup("PresetName"), ghb_string_value_new(name));
- if (replace)
- {
- def_indices = presets_find_default(presetsPlist, &def_len);
- if (def_indices != NULL &&
- preset_path_cmp(indices, len, def_indices, def_len) != 0)
- {
- ghb_dict_insert(dict, g_strdup("Default"),
- ghb_boolean_value_new(FALSE));
- }
- presets_list_update_item(ud, indices, len, FALSE);
- }
- else
- {
- ghb_dict_insert(dict, g_strdup("Default"),
- ghb_boolean_value_new(FALSE));
- presets_list_insert(ud, indices, len);
- }
- if (!ghb_settings_get_boolean( ud->settings, "PictureWidthEnable"))
- {
- ghb_dict_remove(dict, "PictureWidth");
- }
- if (!ghb_settings_get_boolean( ud->settings, "PictureHeightEnable"))
- {
- ghb_dict_remove(dict, "PictureHeight");
- }
- ghb_dict_insert(dict, g_strdup("autoscale"),
- ghb_boolean_value_new(
- !ghb_settings_get_boolean( ud->settings, "PictureWidthEnable") &&
- !ghb_settings_get_boolean( ud->settings, "PictureHeightEnable")
- )
- );
-
- store_presets();
- ud->dont_clear_presets = TRUE;
- // Make the new preset the selected item
- ghb_select_preset2(ud->builder, indices, len);
- g_free(indices);
- ud->dont_clear_presets = FALSE;
- return;
+ GValue *dict, *internal;
+ GHashTableIter iter;
+ gchar *key;
+ GValue *value;
+ gint *indices, len, count;
+ gint *def_indices, def_len;
+ const gchar *name;
+ gboolean replace = FALSE;
+
+ g_debug("settings_save");
+ if (internalPlist == NULL) return;
+ count = ghb_array_len(path);
+ name = g_value_get_string(ghb_array_get_nth(path, count-1));
+ indices = ghb_preset_indices_from_path(presetsPlist, path, &len);
+ if (indices)
+ {
+ if (ghb_presets_get_folder(presetsPlist, indices, len))
+ {
+ gchar *message;
+ message = g_strdup_printf(
+ "%s: Folder already exists.\n"
+ "You can not replace it with a preset.",
+ name);
+ ghb_message_dialog(GTK_MESSAGE_ERROR, message, "Cancel", NULL);
+ g_free(message);
+ return;
+ }
+ dict = ghb_dict_value_new();
+ ghb_presets_replace(presetsPlist, dict, indices, len);
+ replace = TRUE;
+ }
+ else
+ {
+ indices = presets_find_pos(path, PRESETS_CUSTOM, &len);
+ if (indices)
+ {
+ dict = ghb_dict_value_new();
+ ghb_presets_insert(presetsPlist, dict, indices, len);
+ }
+ else
+ {
+ g_warning("failed to find insert path");
+ return;
+ }
+ }
+ current_preset = dict;
+ ghb_settings_set_int64(ud->settings, "Type", PRESETS_CUSTOM);
+ ghb_settings_set_int64(ud->settings, "PresetBuildNumber", hb_get_build(NULL));
+
+ internal = plist_get_dict(internalPlist, "Presets");
+ ghb_dict_iter_init(&iter, internal);
+ // middle (void*) cast prevents gcc warning "defreferencing type-punned
+ // pointer will break strict-aliasing rules"
+ while (g_hash_table_iter_next(
+ &iter, (gpointer*)(void*)&key, (gpointer*)(void*)&value))
+ {
+ const GValue *gval;
+
+ gval = ghb_settings_get_value(ud->settings, key);
+ if (gval == NULL)
+ {
+ continue;
+ }
+ ghb_dict_insert(dict, g_strdup(key), ghb_value_dup(gval));
+ }
+ internal = plist_get_dict(internalPlist, "XlatPresets");
+ ghb_dict_iter_init(&iter, internal);
+ // middle (void*) cast prevents gcc warning "defreferencing type-punned
+ // pointer will break strict-aliasing rules"
+ while (g_hash_table_iter_next(
+ &iter, (gpointer*)(void*)&key, (gpointer*)(void*)&value))
+ {
+ const GValue *gval;
+
+ gval = ghb_settings_get_value(ud->settings, key);
+ if (gval == NULL)
+ {
+ continue;
+ }
+ ghb_dict_insert(dict, g_strdup(key), ghb_value_dup(gval));
+ }
+ ghb_dict_insert(dict, g_strdup("PresetName"), ghb_string_value_new(name));
+ if (replace)
+ {
+ def_indices = presets_find_default(presetsPlist, &def_len);
+ if (def_indices != NULL &&
+ preset_path_cmp(indices, len, def_indices, def_len) != 0)
+ {
+ ghb_dict_insert(dict, g_strdup("Default"),
+ ghb_boolean_value_new(FALSE));
+ }
+ presets_list_update_item(ud, indices, len, FALSE);
+ }
+ else
+ {
+ ghb_dict_insert(dict, g_strdup("Default"),
+ ghb_boolean_value_new(FALSE));
+ presets_list_insert(ud, indices, len);
+ }
+ if (!ghb_settings_get_boolean( ud->settings, "PictureWidthEnable"))
+ {
+ ghb_dict_remove(dict, "PictureWidth");
+ }
+ if (!ghb_settings_get_boolean( ud->settings, "PictureHeightEnable"))
+ {
+ ghb_dict_remove(dict, "PictureHeight");
+ }
+ ghb_dict_insert(dict, g_strdup("autoscale"),
+ ghb_boolean_value_new(
+ !ghb_settings_get_boolean( ud->settings, "PictureWidthEnable") &&
+ !ghb_settings_get_boolean( ud->settings, "PictureHeightEnable")
+ )
+ );
+
+ store_presets();
+ ud->dont_clear_presets = TRUE;
+ // Make the new preset the selected item
+ ghb_select_preset2(ud->builder, indices, len);
+ g_free(indices);
+ ud->dont_clear_presets = FALSE;
+ return;
}
static void
folder_save(signal_user_data_t *ud, const GValue *path)
{
- GValue *dict, *folder;
- gint *indices, len, count;
- const gchar *name;
-
- count = ghb_array_len(path);
- name = g_value_get_string(ghb_array_get_nth(path, count-1));
- indices = ghb_preset_indices_from_path(presetsPlist, path, &len);
- if (indices)
- {
- if (!ghb_presets_get_folder(presetsPlist, indices, len))
- {
- gchar *message;
- message = g_strdup_printf(
- "%s: Preset already exists.\n"
- "You can not replace it with a folder.",
- name);
- ghb_message_dialog(GTK_MESSAGE_ERROR, message, "Cancel", NULL);
- g_free(message);
- g_free(indices);
- return;
- }
- // Already exists, update its description
- dict = presets_get_dict(presetsPlist, indices, len);
- ghb_dict_insert(dict, g_strdup("PresetDescription"),
- ghb_value_dup(preset_dict_get_value(
- ud->settings, "PresetDescription")));
- presets_list_update_item(ud, indices, len, FALSE);
- g_free(indices);
- store_presets();
- return;
- }
- else
- {
- indices = presets_find_pos(path, PRESETS_CUSTOM, &len);
- if (indices)
- {
- dict = ghb_dict_value_new();
- ghb_presets_insert(presetsPlist, dict, indices, len);
- }
- else
- {
- g_warning("failed to find insert path");
- return;
- }
- }
- ghb_dict_insert(dict, g_strdup("PresetDescription"),
- ghb_value_dup(preset_dict_get_value(
- ud->settings, "PresetDescription")));
- ghb_dict_insert(dict, g_strdup("PresetName"), ghb_string_value_new(name));
- folder = ghb_array_value_new(8);
- ghb_dict_insert(dict, g_strdup("ChildrenArray"), folder);
- ghb_dict_insert(dict, g_strdup("Type"),
- ghb_int64_value_new(PRESETS_CUSTOM));
- ghb_dict_insert(dict, g_strdup("Folder"), ghb_boolean_value_new(TRUE));
-
- presets_list_insert(ud, indices, len);
- g_free(indices);
- store_presets();
- return;
+ GValue *dict, *folder;
+ gint *indices, len, count;
+ const gchar *name;
+
+ count = ghb_array_len(path);
+ name = g_value_get_string(ghb_array_get_nth(path, count-1));
+ indices = ghb_preset_indices_from_path(presetsPlist, path, &len);
+ if (indices)
+ {
+ if (!ghb_presets_get_folder(presetsPlist, indices, len))
+ {
+ gchar *message;
+ message = g_strdup_printf(
+ "%s: Preset already exists.\n"
+ "You can not replace it with a folder.",
+ name);
+ ghb_message_dialog(GTK_MESSAGE_ERROR, message, "Cancel", NULL);
+ g_free(message);
+ g_free(indices);
+ return;
+ }
+ // Already exists, update its description
+ dict = presets_get_dict(presetsPlist, indices, len);
+ ghb_dict_insert(dict, g_strdup("PresetDescription"),
+ ghb_value_dup(preset_dict_get_value(
+ ud->settings, "PresetDescription")));
+ presets_list_update_item(ud, indices, len, FALSE);
+ g_free(indices);
+ store_presets();
+ return;
+ }
+ else
+ {
+ indices = presets_find_pos(path, PRESETS_CUSTOM, &len);
+ if (indices)
+ {
+ dict = ghb_dict_value_new();
+ ghb_presets_insert(presetsPlist, dict, indices, len);
+ }
+ else
+ {
+ g_warning("failed to find insert path");
+ return;
+ }
+ }
+ ghb_dict_insert(dict, g_strdup("PresetDescription"),
+ ghb_value_dup(preset_dict_get_value(
+ ud->settings, "PresetDescription")));
+ ghb_dict_insert(dict, g_strdup("PresetName"), ghb_string_value_new(name));
+ folder = ghb_array_value_new(8);
+ ghb_dict_insert(dict, g_strdup("ChildrenArray"), folder);
+ ghb_dict_insert(dict, g_strdup("Type"),
+ ghb_int64_value_new(PRESETS_CUSTOM));
+ ghb_dict_insert(dict, g_strdup("Folder"), ghb_boolean_value_new(TRUE));
+
+ presets_list_insert(ud, indices, len);
+ g_free(indices);
+ store_presets();
+ return;
}
void
ghb_presets_list_default(signal_user_data_t *ud)
{
- GtkTreeView *treeview;
- GtkTreePath *treepath;
- GtkTreeIter iter;
- GtkTreeStore *store;
- gint *indices, len;
-
- g_debug("ghb_presets_list_default ()");
- treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "presets_list"));
- store = GTK_TREE_STORE(gtk_tree_view_get_model(treeview));
- indices = presets_find_default(presetsPlist, &len);
- if (indices == NULL) return;
- treepath = ghb_tree_path_new_from_indices(indices, len);
- if (treepath)
- {
- if (gtk_tree_model_get_iter(GTK_TREE_MODEL(store), &iter, treepath))
- {
- gtk_tree_store_set(store, &iter,
- 1, 800,
- 2, 2 ,
- -1);
- }
- gtk_tree_path_free(treepath);
- }
- g_free(indices);
+ GtkTreeView *treeview;
+ GtkTreePath *treepath;
+ GtkTreeIter iter;
+ GtkTreeStore *store;
+ gint *indices, len;
+
+ g_debug("ghb_presets_list_default ()");
+ treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "presets_list"));
+ store = GTK_TREE_STORE(gtk_tree_view_get_model(treeview));
+ indices = presets_find_default(presetsPlist, &len);
+ if (indices == NULL) return;
+ treepath = ghb_tree_path_new_from_indices(indices, len);
+ if (treepath)
+ {
+ if (gtk_tree_model_get_iter(GTK_TREE_MODEL(store), &iter, treepath))
+ {
+ gtk_tree_store_set(store, &iter,
+ 1, 800,
+ 2, 2 ,
+ -1);
+ }
+ gtk_tree_path_free(treepath);
+ }
+ g_free(indices);
}
void
ghb_presets_list_clear_default(signal_user_data_t *ud)
{
- GtkTreeView *treeview;
- GtkTreePath *treepath;
- GtkTreeIter iter;
- GtkTreeStore *store;
- gint *indices, len;
-
- g_debug("ghb_presets_list_clear_default ()");
- treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "presets_list"));
- store = GTK_TREE_STORE(gtk_tree_view_get_model(treeview));
- indices = presets_find_default(presetsPlist, &len);
- if (indices == NULL) return;
- treepath = ghb_tree_path_new_from_indices(indices, len);
- if (treepath)
- {
- if (gtk_tree_model_get_iter(GTK_TREE_MODEL(store), &iter, treepath))
- {
- gtk_tree_store_set(store, &iter,
- 1, 400,
- 2, 0 ,
- -1);
- }
- gtk_tree_path_free(treepath);
- }
- g_free(indices);
+ GtkTreeView *treeview;
+ GtkTreePath *treepath;
+ GtkTreeIter iter;
+ GtkTreeStore *store;
+ gint *indices, len;
+
+ g_debug("ghb_presets_list_clear_default ()");
+ treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "presets_list"));
+ store = GTK_TREE_STORE(gtk_tree_view_get_model(treeview));
+ indices = presets_find_default(presetsPlist, &len);
+ if (indices == NULL) return;
+ treepath = ghb_tree_path_new_from_indices(indices, len);
+ if (treepath)
+ {
+ if (gtk_tree_model_get_iter(GTK_TREE_MODEL(store), &iter, treepath))
+ {
+ gtk_tree_store_set(store, &iter,
+ 1, 400,
+ 2, 0 ,
+ -1);
+ }
+ gtk_tree_path_free(treepath);
+ }
+ g_free(indices);
}
static void
update_audio_presets(signal_user_data_t *ud)
{
- g_debug("update_audio_presets");
- const GValue *audio_list;
+ g_debug("update_audio_presets");
+ const GValue *audio_list;
- audio_list = ghb_settings_get_value(ud->settings, "audio_list");
- ghb_settings_set_value(ud->settings, "AudioList", audio_list);
+ audio_list = ghb_settings_get_value(ud->settings, "audio_list");
+ ghb_settings_set_value(ud->settings, "AudioList", audio_list);
}
static void
update_subtitle_presets(signal_user_data_t *ud)
{
- g_debug("update_subtitle_presets");
- const GValue *subtitle_list, *subtitle;
- GValue *slist, *dict;
- gint count, ii, source;
-
- subtitle_list = ghb_settings_get_value(ud->settings, "subtitle_list");
- slist = ghb_array_value_new(8);
- count = ghb_array_len(subtitle_list);
- for (ii = 0; ii < count; ii++)
- {
- subtitle = ghb_array_get_nth(subtitle_list, ii);
- source = ghb_settings_get_int(subtitle, "SubtitleSource");
- if (source != SRTSUB)
- {
- dict = ghb_value_dup(subtitle);
- ghb_array_append(slist, dict);
- }
- }
- ghb_settings_take_value(ud->settings, "SubtitleList", slist);
+ g_debug("update_subtitle_presets");
+ const GValue *subtitle_list, *subtitle;
+ GValue *slist, *dict;
+ gint count, ii, source;
+
+ subtitle_list = ghb_settings_get_value(ud->settings, "subtitle_list");
+ slist = ghb_array_value_new(8);
+ count = ghb_array_len(subtitle_list);
+ for (ii = 0; ii < count; ii++)
+ {
+ subtitle = ghb_array_get_nth(subtitle_list, ii);
+ source = ghb_settings_get_int(subtitle, "SubtitleSource");
+ if (source != SRTSUB)
+ {
+ dict = ghb_value_dup(subtitle);
+ ghb_array_append(slist, dict);
+ }
+ }
+ ghb_settings_take_value(ud->settings, "SubtitleList", slist);
}
G_MODULE_EXPORT void
presets_menu_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud)
{
- GtkMenu *menu;
+ GtkMenu *menu;
- menu = GTK_MENU(GHB_WIDGET(ud->builder, "presets_menu"));
- gtk_menu_popup(menu, NULL, NULL, NULL, NULL, 1,
- gtk_get_current_event_time());
+ menu = GTK_MENU(GHB_WIDGET(ud->builder, "presets_menu"));
+ gtk_menu_popup(menu, NULL, NULL, NULL, NULL, 1,
+ gtk_get_current_event_time());
}
G_MODULE_EXPORT void
preset_import_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud)
{
- GtkWidget *dialog;
- GtkResponseType response;
- gchar *exportDir;
- gchar *filename;
- GtkFileFilter *filter;
-
- g_debug("preset_import_clicked_cb ()");
-
- dialog = gtk_file_chooser_dialog_new("Import Preset", NULL,
- GTK_FILE_CHOOSER_ACTION_OPEN,
- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
- GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
- NULL);
-
- filter = gtk_file_filter_new();
- gtk_file_filter_set_name(filter, "All (*)");
- gtk_file_filter_add_pattern(filter, "*");
- gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(dialog), filter);
-
- filter = gtk_file_filter_new();
- gtk_file_filter_set_name(filter, "Presets (*.plist)");
- gtk_file_filter_add_pattern(filter, "*.plist");
- gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(dialog), filter);
- gtk_file_chooser_set_filter(GTK_FILE_CHOOSER(dialog), filter);
-
- exportDir = ghb_settings_get_string(ud->settings, "ExportDirectory");
- if (exportDir == NULL || exportDir[0] == '\0')
- {
- exportDir = g_strdup(".");
- }
- gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog), exportDir);
- g_free(exportDir);
-
- response = gtk_dialog_run(GTK_DIALOG(dialog));
- gtk_widget_hide(dialog);
- if (response == GTK_RESPONSE_ACCEPT)
- {
- GValue *dict, *array;
- gchar *dir;
- gint count, ii;
-
- filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
-
- // import the preset
- if (!g_file_test(filename, G_FILE_TEST_IS_REGULAR))
- {
- gtk_widget_destroy(dialog);
- g_free(filename);
- return;
- }
- array = ghb_plist_parse_file(filename);
-
- import_xlat_presets(array);
- presets_clear_default(array);
- presets_customize(array);
-
- count = ghb_array_len(array);
- for (ii = 0; ii < count; ii++)
- {
- GValue *path, *name;
- gint *indices, len;
- gint index = 1;
-
- dict = ghb_array_get_nth(array, ii);
- path = ghb_array_value_new(1);
- name = ghb_value_dup(ghb_dict_lookup(dict, "PresetName"));
- ghb_array_append(path, name);
- indices = ghb_preset_indices_from_path(presetsPlist, path, &len);
- // Modify the preset name till we make it unique
- while (indices != NULL)
- {
- gchar *str = ghb_value_string(name);
-
- ghb_value_free(path);
- g_free(indices);
-
- str = g_strdup_printf("%s %d", str, index);
- path = ghb_array_value_new(1);
- name = ghb_string_value_new(str);
- ghb_array_append(path, name);
- g_free(str);
-
- index++;
- indices = ghb_preset_indices_from_path(presetsPlist, path, &len);
- }
- ghb_dict_insert(dict, g_strdup("PresetName"), ghb_value_dup(name));
- indices = presets_find_pos(path, PRESETS_CUSTOM, &len);
- ghb_presets_insert(presetsPlist, ghb_value_dup(dict), indices, len);
- presets_list_insert(ud, indices, len);
- ghb_value_free(path);
- }
- ghb_value_free(array);
-
- exportDir = ghb_settings_get_string(ud->settings, "ExportDirectory");
- dir = g_path_get_dirname(filename);
- if (strcmp(dir, exportDir) != 0)
- {
- ghb_settings_set_string(ud->settings, "ExportDirectory", dir);
- ghb_pref_save(ud->settings, "ExportDirectory");
- }
- g_free(filename);
- g_free(exportDir);
- g_free(dir);
- store_presets();
- }
- gtk_widget_destroy(dialog);
+ GtkWidget *dialog;
+ GtkResponseType response;
+ gchar *exportDir;
+ gchar *filename;
+ GtkFileFilter *filter;
+
+ g_debug("preset_import_clicked_cb ()");
+
+ dialog = gtk_file_chooser_dialog_new("Import Preset", NULL,
+ GTK_FILE_CHOOSER_ACTION_OPEN,
+ GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+ GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
+ NULL);
+
+ filter = gtk_file_filter_new();
+ gtk_file_filter_set_name(filter, "All (*)");
+ gtk_file_filter_add_pattern(filter, "*");
+ gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(dialog), filter);
+
+ filter = gtk_file_filter_new();
+ gtk_file_filter_set_name(filter, "Presets (*.plist)");
+ gtk_file_filter_add_pattern(filter, "*.plist");
+ gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(dialog), filter);
+ gtk_file_chooser_set_filter(GTK_FILE_CHOOSER(dialog), filter);
+
+ exportDir = ghb_settings_get_string(ud->settings, "ExportDirectory");
+ if (exportDir == NULL || exportDir[0] == '\0')
+ {
+ exportDir = g_strdup(".");
+ }
+ gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog), exportDir);
+ g_free(exportDir);
+
+ response = gtk_dialog_run(GTK_DIALOG(dialog));
+ gtk_widget_hide(dialog);
+ if (response == GTK_RESPONSE_ACCEPT)
+ {
+ GValue *dict, *array;
+ gchar *dir;
+ gint count, ii;
+
+ filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
+
+ // import the preset
+ if (!g_file_test(filename, G_FILE_TEST_IS_REGULAR))
+ {
+ gtk_widget_destroy(dialog);
+ g_free(filename);
+ return;
+ }
+ array = ghb_plist_parse_file(filename);
+
+ import_xlat_presets(array);
+ presets_clear_default(array);
+ presets_customize(array);
+
+ count = ghb_array_len(array);
+ for (ii = 0; ii < count; ii++)
+ {
+ GValue *path, *name;
+ gint *indices, len;
+ gint index = 1;
+
+ dict = ghb_array_get_nth(array, ii);
+ path = ghb_array_value_new(1);
+ name = ghb_value_dup(ghb_dict_lookup(dict, "PresetName"));
+ ghb_array_append(path, name);
+ indices = ghb_preset_indices_from_path(presetsPlist, path, &len);
+ // Modify the preset name till we make it unique
+ while (indices != NULL)
+ {
+ gchar *str = ghb_value_string(name);
+
+ ghb_value_free(path);
+ g_free(indices);
+
+ str = g_strdup_printf("%s %d", str, index);
+ path = ghb_array_value_new(1);
+ name = ghb_string_value_new(str);
+ ghb_array_append(path, name);
+ g_free(str);
+
+ index++;
+ indices = ghb_preset_indices_from_path(presetsPlist, path, &len);
+ }
+ ghb_dict_insert(dict, g_strdup("PresetName"), ghb_value_dup(name));
+ indices = presets_find_pos(path, PRESETS_CUSTOM, &len);
+ ghb_presets_insert(presetsPlist, ghb_value_dup(dict), indices, len);
+ presets_list_insert(ud, indices, len);
+ ghb_value_free(path);
+ }
+ ghb_value_free(array);
+
+ exportDir = ghb_settings_get_string(ud->settings, "ExportDirectory");
+ dir = g_path_get_dirname(filename);
+ if (strcmp(dir, exportDir) != 0)
+ {
+ ghb_settings_set_string(ud->settings, "ExportDirectory", dir);
+ ghb_pref_save(ud->settings, "ExportDirectory");
+ }
+ g_free(filename);
+ g_free(exportDir);
+ g_free(dir);
+ store_presets();
+ }
+ gtk_widget_destroy(dialog);
}
G_MODULE_EXPORT void
preset_export_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud)
{
- GtkWidget *dialog;
- GtkResponseType response;
- GValue *preset;
- const gchar *name = "";
- gint count, *indices, len;
- gchar *exportDir;
- gchar *filename;
-
- g_debug("preset_export_clicked_cb ()");
- preset = ghb_settings_get_value (ud->settings, "preset_selection");
- if (preset == NULL)
- return;
-
- count = ghb_array_len(preset);
- if (count <= 0)
- return;
-
- name = g_value_get_string(ghb_array_get_nth(preset, count-1));
-
- dialog = gtk_file_chooser_dialog_new("Export Preset", NULL,
- GTK_FILE_CHOOSER_ACTION_SAVE,
- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
- GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
- NULL);
-
- exportDir = ghb_settings_get_string(ud->settings, "ExportDirectory");
- if (exportDir == NULL || exportDir[0] == '\0')
- {
- exportDir = g_strdup(".");
- }
- filename = g_strdup_printf("%s.plist", name);
- gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog), exportDir);
- gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(dialog), filename);
- g_free(filename);
- g_free(exportDir);
-
- indices = ghb_preset_indices_from_path(presetsPlist, preset, &len);
- if (indices == NULL)
- return;
-
- response = gtk_dialog_run(GTK_DIALOG(dialog));
- gtk_widget_hide(dialog);
- if (response == GTK_RESPONSE_ACCEPT)
- {
- GValue *export, *dict, *array;
- FILE *file;
- gchar *dir;
-
- filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
-
- // export the preset
- dict = presets_get_dict(presetsPlist, indices, len);
-
- export = ghb_value_dup(dict);
- array = ghb_array_value_new(1);
- ghb_array_append(array, export);
- presets_clear_default(array);
- presets_customize(array);
- export_xlat_presets(array);
-
- file = g_fopen(filename, "w");
- if (file != NULL)
- {
- ghb_plist_write(file, array);
- fclose(file);
- }
- ghb_value_free(array);
-
- exportDir = ghb_settings_get_string(ud->settings, "ExportDirectory");
- dir = g_path_get_dirname(filename);
- if (strcmp(dir, exportDir) != 0)
- {
- ghb_settings_set_string(ud->settings, "ExportDirectory", dir);
- ghb_pref_save(ud->settings, "ExportDirectory");
- }
- g_free(exportDir);
- g_free(dir);
- g_free(filename);
- }
- gtk_widget_destroy(dialog);
- g_free(indices);
+ GtkWidget *dialog;
+ GtkResponseType response;
+ GValue *preset;
+ const gchar *name = "";
+ gint count, *indices, len;
+ gchar *exportDir;
+ gchar *filename;
+
+ g_debug("preset_export_clicked_cb ()");
+ preset = ghb_settings_get_value (ud->settings, "preset_selection");
+ if (preset == NULL)
+ return;
+
+ count = ghb_array_len(preset);
+ if (count <= 0)
+ return;
+
+ name = g_value_get_string(ghb_array_get_nth(preset, count-1));
+
+ dialog = gtk_file_chooser_dialog_new("Export Preset", NULL,
+ GTK_FILE_CHOOSER_ACTION_SAVE,
+ GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+ GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
+ NULL);
+
+ exportDir = ghb_settings_get_string(ud->settings, "ExportDirectory");
+ if (exportDir == NULL || exportDir[0] == '\0')
+ {
+ exportDir = g_strdup(".");
+ }
+ filename = g_strdup_printf("%s.plist", name);
+ gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog), exportDir);
+ gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(dialog), filename);
+ g_free(filename);
+ g_free(exportDir);
+
+ indices = ghb_preset_indices_from_path(presetsPlist, preset, &len);
+ if (indices == NULL)
+ return;
+
+ response = gtk_dialog_run(GTK_DIALOG(dialog));
+ gtk_widget_hide(dialog);
+ if (response == GTK_RESPONSE_ACCEPT)
+ {
+ GValue *export, *dict, *array;
+ FILE *file;
+ gchar *dir;
+
+ filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
+
+ // export the preset
+ dict = presets_get_dict(presetsPlist, indices, len);
+
+ export = ghb_value_dup(dict);
+ array = ghb_array_value_new(1);
+ ghb_array_append(array, export);
+ presets_clear_default(array);
+ presets_customize(array);
+ export_xlat_presets(array);
+
+ file = g_fopen(filename, "w");
+ if (file != NULL)
+ {
+ ghb_plist_write(file, array);
+ fclose(file);
+ }
+ ghb_value_free(array);
+
+ exportDir = ghb_settings_get_string(ud->settings, "ExportDirectory");
+ dir = g_path_get_dirname(filename);
+ if (strcmp(dir, exportDir) != 0)
+ {
+ ghb_settings_set_string(ud->settings, "ExportDirectory", dir);
+ ghb_pref_save(ud->settings, "ExportDirectory");
+ }
+ g_free(exportDir);
+ g_free(dir);
+ g_free(filename);
+ }
+ gtk_widget_destroy(dialog);
+ g_free(indices);
}
G_MODULE_EXPORT void
presets_new_folder_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud)
{
- GtkWidget *dialog;
- GtkEntry *entry;
- GtkTextView *desc;
- GtkResponseType response;
- GValue *preset, *dict;
- const gchar *name = "";
- const gchar *description = "";
- gint count, *indices, len;
-
- g_debug("presets_new_folder_clicked_cb ()");
- preset = ghb_settings_get_value (ud->settings, "preset_selection");
-
- count = ghb_array_len(preset);
- if (count > 0)
- name = g_value_get_string(ghb_array_get_nth(preset, count-1));
- else
- count = 1;
-
- indices = ghb_preset_indices_from_path(presetsPlist, preset, &len);
- dict = presets_get_dict(presetsPlist, indices, len);
- if (dict != NULL)
- {
- description = g_value_get_string(
- ghb_dict_lookup(dict, "PresetDescription"));
- ghb_ui_update(ud, "FolderDescription", ghb_string_value(description));
- }
-
- desc = GTK_TEXT_VIEW(GHB_WIDGET(ud->builder, "FolderDescription"));
- dialog = GHB_WIDGET(ud->builder, "preset_new_folder_dialog");
- entry = GTK_ENTRY(GHB_WIDGET(ud->builder, "FolderName"));
- gtk_entry_set_text(entry, name);
- response = gtk_dialog_run(GTK_DIALOG(dialog));
- gtk_widget_hide(dialog);
- if (response == GTK_RESPONSE_OK)
- {
- // save the preset
- const gchar *name = gtk_entry_get_text(entry);
- GValue *dest;
-
- if (count > MAX_NESTED_PRESET-1)
- count = MAX_NESTED_PRESET-1;
-
- dest = ghb_array_value_new(MAX_NESTED_PRESET);
- if (indices != NULL)
- {
- gint ptype;
-
- ptype = ghb_presets_get_type(presetsPlist, indices, len);
- if (ptype == PRESETS_CUSTOM)
- {
- ghb_array_copy(dest, preset, count-1);
- }
- }
- ghb_array_append(dest, ghb_string_value_new(name));
- GValue *val = ghb_widget_value(GTK_WIDGET(desc));
- ghb_settings_set_value(ud->settings, "PresetDescription", val);
- folder_save(ud, dest);
- ghb_value_free(dest);
- }
- if (indices != NULL)
- g_free(indices);
+ GtkWidget *dialog;
+ GtkEntry *entry;
+ GtkTextView *desc;
+ GtkResponseType response;
+ GValue *preset, *dict;
+ const gchar *name = "";
+ const gchar *description = "";
+ gint count, *indices, len;
+
+ g_debug("presets_new_folder_clicked_cb ()");
+ preset = ghb_settings_get_value (ud->settings, "preset_selection");
+
+ count = ghb_array_len(preset);
+ if (count > 0)
+ name = g_value_get_string(ghb_array_get_nth(preset, count-1));
+ else
+ count = 1;
+
+ indices = ghb_preset_indices_from_path(presetsPlist, preset, &len);
+ dict = presets_get_dict(presetsPlist, indices, len);
+ if (dict != NULL)
+ {
+ description = g_value_get_string(
+ ghb_dict_lookup(dict, "PresetDescription"));
+ ghb_ui_update(ud, "FolderDescription", ghb_string_value(description));
+ }
+
+ desc = GTK_TEXT_VIEW(GHB_WIDGET(ud->builder, "FolderDescription"));
+ dialog = GHB_WIDGET(ud->builder, "preset_new_folder_dialog");
+ entry = GTK_ENTRY(GHB_WIDGET(ud->builder, "FolderName"));
+ gtk_entry_set_text(entry, name);
+ response = gtk_dialog_run(GTK_DIALOG(dialog));
+ gtk_widget_hide(dialog);
+ if (response == GTK_RESPONSE_OK)
+ {
+ // save the preset
+ const gchar *name = gtk_entry_get_text(entry);
+ GValue *dest;
+
+ if (count > MAX_NESTED_PRESET-1)
+ count = MAX_NESTED_PRESET-1;
+
+ dest = ghb_array_value_new(MAX_NESTED_PRESET);
+ if (indices != NULL)
+ {
+ gint ptype;
+
+ ptype = ghb_presets_get_type(presetsPlist, indices, len);
+ if (ptype == PRESETS_CUSTOM)
+ {
+ ghb_array_copy(dest, preset, count-1);
+ }
+ }
+ ghb_array_append(dest, ghb_string_value_new(name));
+ GValue *val = ghb_widget_value(GTK_WIDGET(desc));
+ ghb_settings_set_value(ud->settings, "PresetDescription", val);
+ folder_save(ud, dest);
+ ghb_value_free(dest);
+ }
+ if (indices != NULL)
+ g_free(indices);
}
G_MODULE_EXPORT void
presets_save_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud)
{
- GtkWidget *dialog;
- GtkEntry *entry;
- GtkTextView *desc;
- GtkResponseType response;
- GValue *preset;
- const gchar *name = "";
- gint count, *indices, len;
-
- g_debug("presets_save_clicked_cb ()");
- preset = ghb_settings_get_value (ud->settings, "preset_selection");
-
- count = ghb_array_len(preset);
- if (count > 0)
- name = g_value_get_string(ghb_array_get_nth(preset, count-1));
- else
- count = 1;
-
- desc = GTK_TEXT_VIEW(GHB_WIDGET(ud->builder, "PresetDescription"));
- int width = ghb_settings_get_int(ud->settings, "PictureWidth");
- int height = ghb_settings_get_int(ud->settings, "PictureHeight");
- gboolean autoscale = ghb_settings_get_boolean(ud->settings, "autoscale");
- ghb_ui_update(ud, "PictureWidthEnable",
- ghb_boolean_value(width!=0&&!autoscale));
- ghb_ui_update(ud, "PictureHeightEnable",
- ghb_boolean_value(height!=0&&!autoscale));
- if (!width)
- {
- width = ghb_settings_get_int(ud->settings, "scale_width");
- ghb_ui_update(ud, "PictureWidth", ghb_int_value(width));
- }
- if (!height)
- {
- height = ghb_settings_get_int(ud->settings, "scale_height");
- ghb_ui_update(ud, "PictureHeight", ghb_int_value(height));
- }
- dialog = GHB_WIDGET(ud->builder, "preset_save_dialog");
- entry = GTK_ENTRY(GHB_WIDGET(ud->builder, "PresetName"));
- gtk_entry_set_text(entry, name);
- response = gtk_dialog_run(GTK_DIALOG(dialog));
- gtk_widget_hide(dialog);
- if (response == GTK_RESPONSE_OK)
- {
- // save the preset
- const gchar *name = gtk_entry_get_text(entry);
- GValue *dest;
-
- dest = ghb_array_value_new(MAX_NESTED_PRESET);
- indices = ghb_preset_indices_from_path(presetsPlist, preset, &len);
- if (indices)
- {
- gint ptype;
-
- ptype = ghb_presets_get_type(presetsPlist, indices, len);
- if (ptype == PRESETS_CUSTOM)
- {
- ghb_array_copy(dest, preset, count-1);
- }
- g_free(indices);
- }
- ghb_array_append(dest, ghb_string_value_new(name));
-
- ghb_widget_to_setting(ud->settings, GTK_WIDGET(desc));
-
- // Construct the audio settings presets from the current audio list
- update_audio_presets(ud);
- update_subtitle_presets(ud);
- settings_save(ud, dest);
- ghb_value_free(dest);
- }
+ GtkWidget *dialog;
+ GtkEntry *entry;
+ GtkTextView *desc;
+ GtkResponseType response;
+ GValue *preset;
+ const gchar *name = "";
+ gint count, *indices, len;
+
+ g_debug("presets_save_clicked_cb ()");
+ preset = ghb_settings_get_value (ud->settings, "preset_selection");
+
+ count = ghb_array_len(preset);
+ if (count > 0)
+ name = g_value_get_string(ghb_array_get_nth(preset, count-1));
+ else
+ count = 1;
+
+ desc = GTK_TEXT_VIEW(GHB_WIDGET(ud->builder, "PresetDescription"));
+ int width = ghb_settings_get_int(ud->settings, "PictureWidth");
+ int height = ghb_settings_get_int(ud->settings, "PictureHeight");
+ gboolean autoscale = ghb_settings_get_boolean(ud->settings, "autoscale");
+ ghb_ui_update(ud, "PictureWidthEnable",
+ ghb_boolean_value(width!=0&&!autoscale));
+ ghb_ui_update(ud, "PictureHeightEnable",
+ ghb_boolean_value(height!=0&&!autoscale));
+ if (!width)
+ {
+ width = ghb_settings_get_int(ud->settings, "scale_width");
+ ghb_ui_update(ud, "PictureWidth", ghb_int_value(width));
+ }
+ if (!height)
+ {
+ height = ghb_settings_get_int(ud->settings, "scale_height");
+ ghb_ui_update(ud, "PictureHeight", ghb_int_value(height));
+ }
+ dialog = GHB_WIDGET(ud->builder, "preset_save_dialog");
+ entry = GTK_ENTRY(GHB_WIDGET(ud->builder, "PresetName"));
+ gtk_entry_set_text(entry, name);
+ response = gtk_dialog_run(GTK_DIALOG(dialog));
+ gtk_widget_hide(dialog);
+ if (response == GTK_RESPONSE_OK)
+ {
+ // save the preset
+ const gchar *name = gtk_entry_get_text(entry);
+ GValue *dest;
+
+ dest = ghb_array_value_new(MAX_NESTED_PRESET);
+ indices = ghb_preset_indices_from_path(presetsPlist, preset, &len);
+ if (indices)
+ {
+ gint ptype;
+
+ ptype = ghb_presets_get_type(presetsPlist, indices, len);
+ if (ptype == PRESETS_CUSTOM)
+ {
+ ghb_array_copy(dest, preset, count-1);
+ }
+ g_free(indices);
+ }
+ ghb_array_append(dest, ghb_string_value_new(name));
+
+ ghb_widget_to_setting(ud->settings, GTK_WIDGET(desc));
+
+ // Construct the audio settings presets from the current audio list
+ update_audio_presets(ud);
+ update_subtitle_presets(ud);
+ settings_save(ud, dest);
+ ghb_value_free(dest);
+ }
}
G_MODULE_EXPORT void
preset_type_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
{
- ghb_widget_to_setting(ud->settings, widget);
+ ghb_widget_to_setting(ud->settings, widget);
}
G_MODULE_EXPORT void
presets_restore_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud)
{
- GValue *preset;
+ GValue *preset;
- g_debug("presets_restore_clicked_cb ()");
- // Reload only the standard presets
- ghb_presets_reload(ud);
- // Updating the presets list shuffles things around
- // need to make sure the proper preset is selected
- preset = ghb_settings_get_value (ud->settings, "preset");
- ghb_select_preset(ud->builder, preset);
+ g_debug("presets_restore_clicked_cb ()");
+ // Reload only the standard presets
+ ghb_presets_reload(ud);
+ // Updating the presets list shuffles things around
+ // need to make sure the proper preset is selected
+ preset = ghb_settings_get_value (ud->settings, "preset");
+ ghb_select_preset(ud->builder, preset);
}
G_MODULE_EXPORT void
presets_remove_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud)
{
- GtkTreeView *treeview;
- GtkTreeSelection *selection;
- GtkTreeModel *store;
- GtkTreeIter iter;
- gchar *preset;
- GtkResponseType response;
-
- g_debug("presets_remove_clicked_cb ()");
- treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "presets_list"));
- selection = gtk_tree_view_get_selection (treeview);
- if (gtk_tree_selection_get_selected(selection, &store, &iter))
- {
- GtkWidget *dialog;
- GtkTreePath *path;
- gint *indices, len;
- gboolean folder;
-
- gtk_tree_model_get(store, &iter, 0, &preset, -1);
- path = gtk_tree_model_get_path(store, &iter);
- indices = gtk_tree_path_get_indices(path);
- len = gtk_tree_path_get_depth(path);
-
- folder = ghb_presets_get_folder(presetsPlist, indices, len);
- dialog = gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL,
- GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO,
- "Confirm deletion of %s:\n\n%s",
- folder ? "folder" : "preset",
- preset);
- response = gtk_dialog_run(GTK_DIALOG(dialog));
- gtk_widget_destroy (dialog);
- if (response == GTK_RESPONSE_YES)
- {
- GtkTreeIter nextIter = iter;
- gboolean valid = TRUE;
- if (!gtk_tree_model_iter_next(store, &nextIter))
- {
- if (!gtk_tree_model_iter_parent(store, &nextIter, &iter))
- {
- valid = FALSE;
- }
- }
- // Remove the selected item
- // First unselect it so that selecting the new item works properly
- gtk_tree_selection_unselect_iter (selection, &iter);
- if (ghb_presets_remove(presetsPlist, indices, len))
- {
- store_presets();
- presets_list_remove(ud, indices, len);
- }
- if (!valid)
- valid = gtk_tree_model_get_iter_first(store, &nextIter);
- if (valid)
- {
- gtk_tree_path_free(path);
- path = gtk_tree_model_get_path(store, &nextIter);
- indices = gtk_tree_path_get_indices(path);
- len = gtk_tree_path_get_depth(path);
- ghb_select_preset2(ud->builder, indices, len);
- }
- }
- g_free(preset);
- gtk_tree_path_free(path);
- }
+ GtkTreeView *treeview;
+ GtkTreeSelection *selection;
+ GtkTreeModel *store;
+ GtkTreeIter iter;
+ gchar *preset;
+ GtkResponseType response;
+
+ g_debug("presets_remove_clicked_cb ()");
+ treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "presets_list"));
+ selection = gtk_tree_view_get_selection (treeview);
+ if (gtk_tree_selection_get_selected(selection, &store, &iter))
+ {
+ GtkWidget *dialog;
+ GtkTreePath *path;
+ gint *indices, len;
+ gboolean folder;
+
+ gtk_tree_model_get(store, &iter, 0, &preset, -1);
+ path = gtk_tree_model_get_path(store, &iter);
+ indices = gtk_tree_path_get_indices(path);
+ len = gtk_tree_path_get_depth(path);
+
+ folder = ghb_presets_get_folder(presetsPlist, indices, len);
+ dialog = gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL,
+ GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO,
+ "Confirm deletion of %s:\n\n%s",
+ folder ? "folder" : "preset",
+ preset);
+ response = gtk_dialog_run(GTK_DIALOG(dialog));
+ gtk_widget_destroy (dialog);
+ if (response == GTK_RESPONSE_YES)
+ {
+ GtkTreeIter nextIter = iter;
+ gboolean valid = TRUE;
+ if (!gtk_tree_model_iter_next(store, &nextIter))
+ {
+ if (!gtk_tree_model_iter_parent(store, &nextIter, &iter))
+ {
+ valid = FALSE;
+ }
+ }
+ // Remove the selected item
+ // First unselect it so that selecting the new item works properly
+ gtk_tree_selection_unselect_iter (selection, &iter);
+ if (ghb_presets_remove(presetsPlist, indices, len))
+ {
+ store_presets();
+ presets_list_remove(ud, indices, len);
+ }
+ if (!valid)
+ valid = gtk_tree_model_get_iter_first(store, &nextIter);
+ if (valid)
+ {
+ gtk_tree_path_free(path);
+ path = gtk_tree_model_get_path(store, &nextIter);
+ indices = gtk_tree_path_get_indices(path);
+ len = gtk_tree_path_get_depth(path);
+ ghb_select_preset2(ud->builder, indices, len);
+ }
+ }
+ g_free(preset);
+ gtk_tree_path_free(path);
+ }
}
// controls where valid drop locations are
G_MODULE_EXPORT gboolean
presets_drag_motion_cb(
- GtkTreeView *tv,
- GdkDragContext *ctx,
- gint x,
- gint y,
- guint time,
- signal_user_data_t *ud)
-{
- GtkTreePath *path = NULL;
- GtkTreeViewDropPosition drop_pos;
- gint *indices, len;
- GtkTreeIter iter;
- GtkTreeView *srctv;
- GtkTreeModel *model;
- GtkTreeSelection *select;
- gint src_ptype, dst_ptype;
- gboolean src_folder, dst_folder;
- GValue *preset;
- gint tree_depth, ii;
- GtkWidget *widget;
-
- widget = gtk_drag_get_source_widget(ctx);
- if (widget == NULL || widget != GTK_WIDGET(tv))
- return TRUE;
-
- // Get the type of the object being dragged
- srctv = GTK_TREE_VIEW(gtk_drag_get_source_widget(ctx));
- select = gtk_tree_view_get_selection (srctv);
- gtk_tree_selection_get_selected (select, &model, &iter);
- path = gtk_tree_model_get_path (model, &iter);
- indices = gtk_tree_path_get_indices(path);
- len = gtk_tree_path_get_depth(path);
-
- preset = presets_get_dict(presetsPlist, indices, len);
- tree_depth = preset_tree_depth(preset);
-
- src_ptype = ghb_presets_get_type(presetsPlist, indices, len);
- src_folder = ghb_presets_get_folder(presetsPlist, indices, len);
- gtk_tree_path_free(path);
-
- if (src_folder && tree_depth == 1)
- tree_depth = 2;
-
- // The rest checks that the destination is a valid position
- // in the list.
- gtk_tree_view_get_dest_row_at_pos (tv, x, y, &path, &drop_pos);
- if (path == NULL)
- {
- gdk_drag_status(ctx, 0, time);
- return TRUE;
- }
- // Don't allow repositioning of builtin presets
- if (src_ptype != PRESETS_CUSTOM)
- {
- gdk_drag_status(ctx, 0, time);
- return TRUE;
- }
-
- len = gtk_tree_path_get_depth(path);
- if (len+tree_depth-1 >= MAX_NESTED_PRESET)
- {
- if (drop_pos == GTK_TREE_VIEW_DROP_INTO_OR_BEFORE)
- drop_pos = GTK_TREE_VIEW_DROP_BEFORE;
- if (drop_pos == GTK_TREE_VIEW_DROP_INTO_OR_AFTER)
- drop_pos = GTK_TREE_VIEW_DROP_AFTER;
- }
- for (ii = len+tree_depth-1; ii > MAX_NESTED_PRESET; ii--)
- gtk_tree_path_up(path);
- indices = gtk_tree_path_get_indices(path);
- len = gtk_tree_path_get_depth(path);
- dst_ptype = ghb_presets_get_type(presetsPlist, indices, len);
- dst_folder = ghb_presets_get_folder(presetsPlist, indices, len);
- // Don't allow mixing custom presets in the builtins
- if (dst_ptype != PRESETS_CUSTOM)
- {
- gdk_drag_status(ctx, 0, time);
- return TRUE;
- }
-
- // Only allow *drop into* for folders
- if (!dst_folder)
- {
- if (drop_pos == GTK_TREE_VIEW_DROP_INTO_OR_BEFORE)
- drop_pos = GTK_TREE_VIEW_DROP_BEFORE;
- if (drop_pos == GTK_TREE_VIEW_DROP_INTO_OR_AFTER)
- drop_pos = GTK_TREE_VIEW_DROP_AFTER;
- }
-
- len = gtk_tree_path_get_depth(path);
- gtk_tree_view_set_drag_dest_row(tv, path, drop_pos);
- gtk_tree_path_free(path);
- gdk_drag_status(ctx, GDK_ACTION_MOVE, time);
- return TRUE;
+ GtkTreeView *tv,
+ GdkDragContext *ctx,
+ gint x,
+ gint y,
+ guint time,
+ signal_user_data_t *ud)
+{
+ GtkTreePath *path = NULL;
+ GtkTreeViewDropPosition drop_pos;
+ gint *indices, len;
+ GtkTreeIter iter;
+ GtkTreeView *srctv;
+ GtkTreeModel *model;
+ GtkTreeSelection *select;
+ gint src_ptype, dst_ptype;
+ gboolean src_folder, dst_folder;
+ GValue *preset;
+ gint tree_depth, ii;
+ GtkWidget *widget;
+
+ widget = gtk_drag_get_source_widget(ctx);
+ if (widget == NULL || widget != GTK_WIDGET(tv))
+ return TRUE;
+
+ // Get the type of the object being dragged
+ srctv = GTK_TREE_VIEW(gtk_drag_get_source_widget(ctx));
+ select = gtk_tree_view_get_selection (srctv);
+ gtk_tree_selection_get_selected (select, &model, &iter);
+ path = gtk_tree_model_get_path (model, &iter);
+ indices = gtk_tree_path_get_indices(path);
+ len = gtk_tree_path_get_depth(path);
+
+ preset = presets_get_dict(presetsPlist, indices, len);
+ tree_depth = preset_tree_depth(preset);
+
+ src_ptype = ghb_presets_get_type(presetsPlist, indices, len);
+ src_folder = ghb_presets_get_folder(presetsPlist, indices, len);
+ gtk_tree_path_free(path);
+
+ if (src_folder && tree_depth == 1)
+ tree_depth = 2;
+
+ // The rest checks that the destination is a valid position
+ // in the list.
+ gtk_tree_view_get_dest_row_at_pos (tv, x, y, &path, &drop_pos);
+ if (path == NULL)
+ {
+ gdk_drag_status(ctx, 0, time);
+ return TRUE;
+ }
+ // Don't allow repositioning of builtin presets
+ if (src_ptype != PRESETS_CUSTOM)
+ {
+ gdk_drag_status(ctx, 0, time);
+ return TRUE;
+ }
+
+ len = gtk_tree_path_get_depth(path);
+ if (len+tree_depth-1 >= MAX_NESTED_PRESET)
+ {
+ if (drop_pos == GTK_TREE_VIEW_DROP_INTO_OR_BEFORE)
+ drop_pos = GTK_TREE_VIEW_DROP_BEFORE;
+ if (drop_pos == GTK_TREE_VIEW_DROP_INTO_OR_AFTER)
+ drop_pos = GTK_TREE_VIEW_DROP_AFTER;
+ }
+ for (ii = len+tree_depth-1; ii > MAX_NESTED_PRESET; ii--)
+ gtk_tree_path_up(path);
+ indices = gtk_tree_path_get_indices(path);
+ len = gtk_tree_path_get_depth(path);
+ dst_ptype = ghb_presets_get_type(presetsPlist, indices, len);
+ dst_folder = ghb_presets_get_folder(presetsPlist, indices, len);
+ // Don't allow mixing custom presets in the builtins
+ if (dst_ptype != PRESETS_CUSTOM)
+ {
+ gdk_drag_status(ctx, 0, time);
+ return TRUE;
+ }
+
+ // Only allow *drop into* for folders
+ if (!dst_folder)
+ {
+ if (drop_pos == GTK_TREE_VIEW_DROP_INTO_OR_BEFORE)
+ drop_pos = GTK_TREE_VIEW_DROP_BEFORE;
+ if (drop_pos == GTK_TREE_VIEW_DROP_INTO_OR_AFTER)
+ drop_pos = GTK_TREE_VIEW_DROP_AFTER;
+ }
+
+ len = gtk_tree_path_get_depth(path);
+ gtk_tree_view_set_drag_dest_row(tv, path, drop_pos);
+ gtk_tree_path_free(path);
+ gdk_drag_status(ctx, GDK_ACTION_MOVE, time);
+ return TRUE;
}
G_MODULE_EXPORT void
presets_drag_cb(
- GtkTreeView *dstwidget,
- GdkDragContext *dc,
- gint x, gint y,
- GtkSelectionData *selection_data,
- guint info, guint t,
- signal_user_data_t *ud)
-{
- GtkTreePath *path = NULL;
- GtkTreeViewDropPosition drop_pos;
- GtkTreeIter dstiter, srciter;
- gint *dst_indices, dst_len, *src_indices, src_len;
- gint src_ptype;
- gboolean src_folder, dst_folder;
-
- GtkTreeModel *dstmodel = gtk_tree_view_get_model(dstwidget);
-
- g_debug("preset_drag_cb ()");
- // This doesn't work here for some reason...
- // gtk_tree_view_get_drag_dest_row(dstwidget, &path, &drop_pos);
- gtk_tree_view_get_dest_row_at_pos (dstwidget, x, y, &path, &drop_pos);
- // This little hack is needed because attempting to drop after
- // the last item gives us no path or drop_pos.
- if (path == NULL)
- {
- gint n_children;
-
- n_children = gtk_tree_model_iter_n_children(dstmodel, NULL);
- if (n_children)
- {
- drop_pos = GTK_TREE_VIEW_DROP_AFTER;
- path = gtk_tree_path_new_from_indices(n_children-1, -1);
- }
- else
- {
- drop_pos = GTK_TREE_VIEW_DROP_BEFORE;
- path = gtk_tree_path_new_from_indices(0, -1);
- }
- }
- if (path)
- {
- GtkTreeView *srcwidget;
- GtkTreeModel *srcmodel;
- GtkTreeSelection *select;
- GtkTreePath *srcpath = NULL;
- GValue *preset;
- gint tree_depth, ii;
-
- srcwidget = GTK_TREE_VIEW(gtk_drag_get_source_widget(dc));
- select = gtk_tree_view_get_selection (srcwidget);
- gtk_tree_selection_get_selected (select, &srcmodel, &srciter);
-
- srcpath = gtk_tree_model_get_path (srcmodel, &srciter);
- src_indices = gtk_tree_path_get_indices(srcpath);
- src_len = gtk_tree_path_get_depth(srcpath);
- src_ptype = ghb_presets_get_type(presetsPlist, src_indices, src_len);
- src_folder = ghb_presets_get_folder(presetsPlist, src_indices, src_len);
- preset = ghb_value_dup(
- presets_get_dict(presetsPlist, src_indices, src_len));
- gtk_tree_path_free(srcpath);
-
- // Don't allow repositioning of builtin presets
- if (src_ptype != PRESETS_CUSTOM)
- return;
-
- tree_depth = preset_tree_depth(preset);
- if (src_folder && tree_depth == 1)
- tree_depth = 2;
-
- dst_len = gtk_tree_path_get_depth(path);
- if (dst_len+tree_depth-1 >= MAX_NESTED_PRESET)
- {
- if (drop_pos == GTK_TREE_VIEW_DROP_INTO_OR_BEFORE)
- drop_pos = GTK_TREE_VIEW_DROP_BEFORE;
- if (drop_pos == GTK_TREE_VIEW_DROP_INTO_OR_AFTER)
- drop_pos = GTK_TREE_VIEW_DROP_AFTER;
- }
-
- for (ii = dst_len+tree_depth-1; ii > MAX_NESTED_PRESET; ii--)
- gtk_tree_path_up(path);
- dst_indices = gtk_tree_path_get_indices(path);
- dst_len = gtk_tree_path_get_depth(path);
- dst_folder = ghb_presets_get_folder(presetsPlist, dst_indices, dst_len);
- // Only allow *drop into* for folders
- if (!dst_folder)
- {
- if (drop_pos == GTK_TREE_VIEW_DROP_INTO_OR_BEFORE)
- drop_pos = GTK_TREE_VIEW_DROP_BEFORE;
- if (drop_pos == GTK_TREE_VIEW_DROP_INTO_OR_AFTER)
- drop_pos = GTK_TREE_VIEW_DROP_AFTER;
- }
- if (gtk_tree_model_get_iter (dstmodel, &dstiter, path))
- {
- GtkTreeIter iter;
- GtkTreePath *dstpath = NULL;
-
- switch (drop_pos)
- {
- case GTK_TREE_VIEW_DROP_BEFORE:
- gtk_tree_store_insert_before(GTK_TREE_STORE (dstmodel),
- &iter, NULL, &dstiter);
- break;
-
- case GTK_TREE_VIEW_DROP_INTO_OR_BEFORE:
- gtk_tree_store_insert(GTK_TREE_STORE (dstmodel),
- &iter, &dstiter, 0);
- break;
-
- case GTK_TREE_VIEW_DROP_AFTER:
- gtk_tree_store_insert_after(GTK_TREE_STORE (dstmodel),
- &iter, NULL, &dstiter);
- break;
-
- case GTK_TREE_VIEW_DROP_INTO_OR_AFTER:
- gtk_tree_store_insert_after(GTK_TREE_STORE (dstmodel),
- &iter, &dstiter, 0);
- break;
-
- default:
- break;
- }
-
- dstpath = gtk_tree_model_get_path (dstmodel, &iter);
- dst_indices = gtk_tree_path_get_indices(dstpath);
- dst_len = gtk_tree_path_get_depth(dstpath);
- ghb_presets_insert(presetsPlist, preset, dst_indices, dst_len);
- gtk_tree_path_free(dstpath);
-
- srcpath = gtk_tree_model_get_path (srcmodel, &srciter);
- src_indices = gtk_tree_path_get_indices(srcpath);
- src_len = gtk_tree_path_get_depth(srcpath);
- ghb_presets_remove(presetsPlist, src_indices, src_len);
- gtk_tree_path_free(srcpath);
-
- gtk_tree_store_remove (GTK_TREE_STORE (srcmodel), &srciter);
-
- dstpath = gtk_tree_model_get_path (dstmodel, &iter);
- dst_indices = gtk_tree_path_get_indices(dstpath);
- dst_len = gtk_tree_path_get_depth(dstpath);
- presets_list_update_item(ud, dst_indices, dst_len, TRUE);
- gtk_tree_path_free(dstpath);
-
- store_presets();
- }
- gtk_tree_path_free(path);
- }
+ GtkTreeView *dstwidget,
+ GdkDragContext *dc,
+ gint x, gint y,
+ GtkSelectionData *selection_data,
+ guint info, guint t,
+ signal_user_data_t *ud)
+{
+ GtkTreePath *path = NULL;
+ GtkTreeViewDropPosition drop_pos;
+ GtkTreeIter dstiter, srciter;
+ gint *dst_indices, dst_len, *src_indices, src_len;
+ gint src_ptype;
+ gboolean src_folder, dst_folder;
+
+ GtkTreeModel *dstmodel = gtk_tree_view_get_model(dstwidget);
+
+ g_debug("preset_drag_cb ()");
+ // This doesn't work here for some reason...
+ // gtk_tree_view_get_drag_dest_row(dstwidget, &path, &drop_pos);
+ gtk_tree_view_get_dest_row_at_pos (dstwidget, x, y, &path, &drop_pos);
+ // This little hack is needed because attempting to drop after
+ // the last item gives us no path or drop_pos.
+ if (path == NULL)
+ {
+ gint n_children;
+
+ n_children = gtk_tree_model_iter_n_children(dstmodel, NULL);
+ if (n_children)
+ {
+ drop_pos = GTK_TREE_VIEW_DROP_AFTER;
+ path = gtk_tree_path_new_from_indices(n_children-1, -1);
+ }
+ else
+ {
+ drop_pos = GTK_TREE_VIEW_DROP_BEFORE;
+ path = gtk_tree_path_new_from_indices(0, -1);
+ }
+ }
+ if (path)
+ {
+ GtkTreeView *srcwidget;
+ GtkTreeModel *srcmodel;
+ GtkTreeSelection *select;
+ GtkTreePath *srcpath = NULL;
+ GValue *preset;
+ gint tree_depth, ii;
+
+ srcwidget = GTK_TREE_VIEW(gtk_drag_get_source_widget(dc));
+ select = gtk_tree_view_get_selection (srcwidget);
+ gtk_tree_selection_get_selected (select, &srcmodel, &srciter);
+
+ srcpath = gtk_tree_model_get_path (srcmodel, &srciter);
+ src_indices = gtk_tree_path_get_indices(srcpath);
+ src_len = gtk_tree_path_get_depth(srcpath);
+ src_ptype = ghb_presets_get_type(presetsPlist, src_indices, src_len);
+ src_folder = ghb_presets_get_folder(presetsPlist, src_indices, src_len);
+ preset = ghb_value_dup(
+ presets_get_dict(presetsPlist, src_indices, src_len));
+ gtk_tree_path_free(srcpath);
+
+ // Don't allow repositioning of builtin presets
+ if (src_ptype != PRESETS_CUSTOM)
+ return;
+
+ tree_depth = preset_tree_depth(preset);
+ if (src_folder && tree_depth == 1)
+ tree_depth = 2;
+
+ dst_len = gtk_tree_path_get_depth(path);
+ if (dst_len+tree_depth-1 >= MAX_NESTED_PRESET)
+ {
+ if (drop_pos == GTK_TREE_VIEW_DROP_INTO_OR_BEFORE)
+ drop_pos = GTK_TREE_VIEW_DROP_BEFORE;
+ if (drop_pos == GTK_TREE_VIEW_DROP_INTO_OR_AFTER)
+ drop_pos = GTK_TREE_VIEW_DROP_AFTER;
+ }
+
+ for (ii = dst_len+tree_depth-1; ii > MAX_NESTED_PRESET; ii--)
+ gtk_tree_path_up(path);
+ dst_indices = gtk_tree_path_get_indices(path);
+ dst_len = gtk_tree_path_get_depth(path);
+ dst_folder = ghb_presets_get_folder(presetsPlist, dst_indices, dst_len);
+ // Only allow *drop into* for folders
+ if (!dst_folder)
+ {
+ if (drop_pos == GTK_TREE_VIEW_DROP_INTO_OR_BEFORE)
+ drop_pos = GTK_TREE_VIEW_DROP_BEFORE;
+ if (drop_pos == GTK_TREE_VIEW_DROP_INTO_OR_AFTER)
+ drop_pos = GTK_TREE_VIEW_DROP_AFTER;
+ }
+ if (gtk_tree_model_get_iter (dstmodel, &dstiter, path))
+ {
+ GtkTreeIter iter;
+ GtkTreePath *dstpath = NULL;
+
+ switch (drop_pos)
+ {
+ case GTK_TREE_VIEW_DROP_BEFORE:
+ gtk_tree_store_insert_before(GTK_TREE_STORE (dstmodel),
+ &iter, NULL, &dstiter);
+ break;
+
+ case GTK_TREE_VIEW_DROP_INTO_OR_BEFORE:
+ gtk_tree_store_insert(GTK_TREE_STORE (dstmodel),
+ &iter, &dstiter, 0);
+ break;
+
+ case GTK_TREE_VIEW_DROP_AFTER:
+ gtk_tree_store_insert_after(GTK_TREE_STORE (dstmodel),
+ &iter, NULL, &dstiter);
+ break;
+
+ case GTK_TREE_VIEW_DROP_INTO_OR_AFTER:
+ gtk_tree_store_insert_after(GTK_TREE_STORE (dstmodel),
+ &iter, &dstiter, 0);
+ break;
+
+ default:
+ break;
+ }
+
+ dstpath = gtk_tree_model_get_path (dstmodel, &iter);
+ dst_indices = gtk_tree_path_get_indices(dstpath);
+ dst_len = gtk_tree_path_get_depth(dstpath);
+ ghb_presets_insert(presetsPlist, preset, dst_indices, dst_len);
+ gtk_tree_path_free(dstpath);
+
+ srcpath = gtk_tree_model_get_path (srcmodel, &srciter);
+ src_indices = gtk_tree_path_get_indices(srcpath);
+ src_len = gtk_tree_path_get_depth(srcpath);
+ ghb_presets_remove(presetsPlist, src_indices, src_len);
+ gtk_tree_path_free(srcpath);
+
+ gtk_tree_store_remove (GTK_TREE_STORE (srcmodel), &srciter);
+
+ dstpath = gtk_tree_model_get_path (dstmodel, &iter);
+ dst_indices = gtk_tree_path_get_indices(dstpath);
+ dst_len = gtk_tree_path_get_depth(dstpath);
+ presets_list_update_item(ud, dst_indices, dst_len, TRUE);
+ gtk_tree_path_free(dstpath);
+
+ store_presets();
+ }
+ gtk_tree_path_free(path);
+ }
}
void
presets_row_expanded_cb(
- GtkTreeView *treeview,
- GtkTreeIter *iter,
- GtkTreePath *path,
- signal_user_data_t *ud)
-{
- gint *indices, len;
- gboolean expanded, folder;
- GValue *dict;
-
- expanded = gtk_tree_view_row_expanded(treeview, path);
- indices = gtk_tree_path_get_indices(path);
- len = gtk_tree_path_get_depth(path);
- dict = presets_get_dict(presetsPlist, indices, len);
- if (preset_folder_is_open(dict))
- {
- if (expanded)
- return;
- }
- else if (!expanded)
- {
- return;
- }
- folder = ghb_presets_get_folder(presetsPlist, indices, len);
- if (folder)
- {
- presets_set_folder_open(expanded, indices, len);
- }
-
- // Collapsing parent folder collapses all children
- if (!expanded)
- {
- GValue *presets = NULL;
- gint *more_indices, count, ii;
-
- more_indices = g_malloc((len+1)*sizeof(gint));
- memcpy(more_indices, indices, len*sizeof(gint));
-
- presets = presets_get_folder(presetsPlist, indices, len);
- count = ghb_array_len(presets);
- for (ii = 0; ii < count; ii++)
- {
- dict = ghb_array_get_nth(presets, ii);
- folder = ghb_preset_folder(dict);
- if (folder)
- {
- more_indices[len] = ii;
- presets_set_folder_open(expanded, more_indices, len+1);
- }
- }
- g_free(more_indices);
- }
- store_presets();
+ GtkTreeView *treeview,
+ GtkTreeIter *iter,
+ GtkTreePath *path,
+ signal_user_data_t *ud)
+{
+ gint *indices, len;
+ gboolean expanded, folder;
+ GValue *dict;
+
+ expanded = gtk_tree_view_row_expanded(treeview, path);
+ indices = gtk_tree_path_get_indices(path);
+ len = gtk_tree_path_get_depth(path);
+ dict = presets_get_dict(presetsPlist, indices, len);
+ if (preset_folder_is_open(dict))
+ {
+ if (expanded)
+ return;
+ }
+ else if (!expanded)
+ {
+ return;
+ }
+ folder = ghb_presets_get_folder(presetsPlist, indices, len);
+ if (folder)
+ {
+ presets_set_folder_open(expanded, indices, len);
+ }
+
+ // Collapsing parent folder collapses all children
+ if (!expanded)
+ {
+ GValue *presets = NULL;
+ gint *more_indices, count, ii;
+
+ more_indices = g_malloc((len+1)*sizeof(gint));
+ memcpy(more_indices, indices, len*sizeof(gint));
+
+ presets = presets_get_folder(presetsPlist, indices, len);
+ count = ghb_array_len(presets);
+ for (ii = 0; ii < count; ii++)
+ {
+ dict = ghb_array_get_nth(presets, ii);
+ folder = ghb_preset_folder(dict);
+ if (folder)
+ {
+ more_indices[len] = ii;
+ presets_set_folder_open(expanded, more_indices, len+1);
+ }
+ }
+ g_free(more_indices);
+ }
+ store_presets();
}
static void
preset_update_title_deps(signal_user_data_t *ud, hb_title_t *title)
{
- GtkWidget *widget;
-
- ghb_ui_update(ud, "scale_width",
- ghb_int64_value(title->width - title->crop[2] - title->crop[3]));
- // If anamorphic or keep_aspect, the hight will be automatically calculated
- gboolean keep_aspect;
- gint pic_par;
- keep_aspect = ghb_settings_get_boolean(ud->settings, "PictureKeepRatio");
- pic_par = ghb_settings_combo_int(ud->settings, "PicturePAR");
- if (!(keep_aspect || pic_par) || pic_par == 3)
- {
- ghb_ui_update(ud, "scale_height",
- ghb_int64_value(title->height - title->crop[0] - title->crop[1]));
- }
-
- // Set the limits of cropping. hb_set_anamorphic_size crashes if
- // you pass it a cropped width or height == 0.
- gint bound;
- bound = title->height / 2 - 2;
- widget = GHB_WIDGET (ud->builder, "PictureTopCrop");
- gtk_spin_button_set_range (GTK_SPIN_BUTTON(widget), 0, bound);
- widget = GHB_WIDGET (ud->builder, "PictureBottomCrop");
- gtk_spin_button_set_range (GTK_SPIN_BUTTON(widget), 0, bound);
- bound = title->width / 2 - 2;
- widget = GHB_WIDGET (ud->builder, "PictureLeftCrop");
- gtk_spin_button_set_range (GTK_SPIN_BUTTON(widget), 0, bound);
- widget = GHB_WIDGET (ud->builder, "PictureRightCrop");
- gtk_spin_button_set_range (GTK_SPIN_BUTTON(widget), 0, bound);
- if (ghb_settings_get_boolean(ud->settings, "PictureAutoCrop"))
- {
- ghb_ui_update(ud, "PictureTopCrop", ghb_int64_value(title->crop[0]));
- ghb_ui_update(ud, "PictureBottomCrop", ghb_int64_value(title->crop[1]));
- ghb_ui_update(ud, "PictureLeftCrop", ghb_int64_value(title->crop[2]));
- ghb_ui_update(ud, "PictureRightCrop", ghb_int64_value(title->crop[3]));
- }
+ GtkWidget *widget;
+
+ ghb_ui_update(ud, "scale_width",
+ ghb_int64_value(title->width - title->crop[2] - title->crop[3]));
+ // If anamorphic or keep_aspect, the hight will be automatically calculated
+ gboolean keep_aspect;
+ gint pic_par;
+ keep_aspect = ghb_settings_get_boolean(ud->settings, "PictureKeepRatio");
+ pic_par = ghb_settings_combo_int(ud->settings, "PicturePAR");
+ if (!(keep_aspect || pic_par) || pic_par == 3)
+ {
+ ghb_ui_update(ud, "scale_height",
+ ghb_int64_value(title->height - title->crop[0] - title->crop[1]));
+ }
+
+ // Set the limits of cropping. hb_set_anamorphic_size crashes if
+ // you pass it a cropped width or height == 0.
+ gint bound;
+ bound = title->height / 2 - 2;
+ widget = GHB_WIDGET (ud->builder, "PictureTopCrop");
+ gtk_spin_button_set_range (GTK_SPIN_BUTTON(widget), 0, bound);
+ widget = GHB_WIDGET (ud->builder, "PictureBottomCrop");
+ gtk_spin_button_set_range (GTK_SPIN_BUTTON(widget), 0, bound);
+ bound = title->width / 2 - 2;
+ widget = GHB_WIDGET (ud->builder, "PictureLeftCrop");
+ gtk_spin_button_set_range (GTK_SPIN_BUTTON(widget), 0, bound);
+ widget = GHB_WIDGET (ud->builder, "PictureRightCrop");
+ gtk_spin_button_set_range (GTK_SPIN_BUTTON(widget), 0, bound);
+ if (ghb_settings_get_boolean(ud->settings, "PictureAutoCrop"))
+ {
+ ghb_ui_update(ud, "PictureTopCrop", ghb_int64_value(title->crop[0]));
+ ghb_ui_update(ud, "PictureBottomCrop", ghb_int64_value(title->crop[1]));
+ ghb_ui_update(ud, "PictureLeftCrop", ghb_int64_value(title->crop[2]));
+ ghb_ui_update(ud, "PictureRightCrop", ghb_int64_value(title->crop[3]));
+ }
}
void
ghb_refresh_preset(signal_user_data_t *ud)
{
- GValue *preset;
- gint *indices, len;
-
- g_debug("ghb_refresh_preset ()");
- preset = ghb_settings_get_value(ud->settings, "preset_selection");
- indices = ghb_preset_indices_from_path(presetsPlist, preset, &len);
- if (indices)
- {
- gboolean folder;
-
- folder = ghb_presets_get_folder(presetsPlist, indices, len);
- if (!folder)
- {
- ud->dont_clear_presets = TRUE;
- ud->scale_busy = TRUE;
- // Temporarily set the video_quality range to (0,100)
- // This is needed so the video_quality value does not get
- // truncated when set. The range will be readjusted below
- GtkWidget *qp = GHB_WIDGET(ud->builder, "VideoQualitySlider");
- gtk_range_set_range (GTK_RANGE(qp), 0, 100);
- gtk_scale_set_digits(GTK_SCALE(qp), 3);
- ghb_set_preset_from_indices(ud, indices, len);
- gint titleindex;
- titleindex = ghb_settings_combo_int(ud->settings, "title");
- ghb_set_pref_audio_settings(titleindex, ud->settings);
- ghb_set_pref_audio_from_settings(ud, ud->settings);
- ghb_set_pref_subtitle(titleindex, ud);
- ghb_settings_set_boolean(ud->settings, "preset_modified", FALSE);
- hb_title_t * title = ghb_get_title_info(titleindex);
- if (title != NULL)
- {
- preset_update_title_deps(ud, title);
- }
- ud->scale_busy = FALSE;
- ghb_set_scale (ud, GHB_PIC_KEEP_PAR|GHB_PIC_USE_MAX);
- ud->dont_clear_presets = FALSE;
-
- gdouble vqmin, vqmax, step, page;
- gint digits;
- gboolean inverted;
-
- ghb_vquality_range(ud, &vqmin, &vqmax, &step,
- &page, &digits, &inverted);
- gtk_range_set_range (GTK_RANGE(qp), vqmin, vqmax);
- gtk_range_set_increments (GTK_RANGE(qp), step, page);
- gtk_scale_set_digits(GTK_SCALE(qp), digits);
- gtk_range_set_inverted (GTK_RANGE(qp), inverted);
-
- gchar *text;
- gint crop[4];
- GtkWidget *crop_widget;
- crop[0] = ghb_settings_get_int(ud->settings, "PictureTopCrop");
- crop[1] = ghb_settings_get_int(ud->settings, "PictureBottomCrop");
- crop[2] = ghb_settings_get_int(ud->settings, "PictureLeftCrop");
- crop[3] = ghb_settings_get_int(ud->settings, "PictureRightCrop");
- crop_widget = GHB_WIDGET (ud->builder, "crop_values");
- text = g_strdup_printf("%d:%d:%d:%d",
- crop[0], crop[1], crop[2], crop[3]);
- gtk_label_set_text (GTK_LABEL(crop_widget), text);
- g_free(text);
- }
- }
+ GValue *preset;
+ gint *indices, len;
+
+ g_debug("ghb_refresh_preset ()");
+ preset = ghb_settings_get_value(ud->settings, "preset_selection");
+ indices = ghb_preset_indices_from_path(presetsPlist, preset, &len);
+ if (indices)
+ {
+ gboolean folder;
+
+ folder = ghb_presets_get_folder(presetsPlist, indices, len);
+ if (!folder)
+ {
+ ud->dont_clear_presets = TRUE;
+ ud->scale_busy = TRUE;
+ // Temporarily set the video_quality range to (0,100)
+ // This is needed so the video_quality value does not get
+ // truncated when set. The range will be readjusted below
+ GtkWidget *qp = GHB_WIDGET(ud->builder, "VideoQualitySlider");
+ gtk_range_set_range (GTK_RANGE(qp), 0, 100);
+ gtk_scale_set_digits(GTK_SCALE(qp), 3);
+ ghb_set_preset_from_indices(ud, indices, len);
+ gint titleindex;
+ titleindex = ghb_settings_combo_int(ud->settings, "title");
+ ghb_set_pref_audio_settings(titleindex, ud->settings);
+ ghb_set_pref_audio_from_settings(ud, ud->settings);
+ ghb_set_pref_subtitle(titleindex, ud);
+ ghb_settings_set_boolean(ud->settings, "preset_modified", FALSE);
+ hb_title_t * title = ghb_get_title_info(titleindex);
+ if (title != NULL)
+ {
+ preset_update_title_deps(ud, title);
+ }
+ ud->scale_busy = FALSE;
+ ghb_set_scale (ud, GHB_PIC_KEEP_PAR|GHB_PIC_USE_MAX);
+ ud->dont_clear_presets = FALSE;
+
+ gdouble vqmin, vqmax, step, page;
+ gint digits;
+ gboolean inverted;
+
+ ghb_vquality_range(ud, &vqmin, &vqmax, &step,
+ &page, &digits, &inverted);
+ gtk_range_set_range (GTK_RANGE(qp), vqmin, vqmax);
+ gtk_range_set_increments (GTK_RANGE(qp), step, page);
+ gtk_scale_set_digits(GTK_SCALE(qp), digits);
+ gtk_range_set_inverted (GTK_RANGE(qp), inverted);
+
+ gchar *text;
+ gint crop[4];
+ GtkWidget *crop_widget;
+ crop[0] = ghb_settings_get_int(ud->settings, "PictureTopCrop");
+ crop[1] = ghb_settings_get_int(ud->settings, "PictureBottomCrop");
+ crop[2] = ghb_settings_get_int(ud->settings, "PictureLeftCrop");
+ crop[3] = ghb_settings_get_int(ud->settings, "PictureRightCrop");
+ crop_widget = GHB_WIDGET (ud->builder, "crop_values");
+ text = g_strdup_printf("%d:%d:%d:%d",
+ crop[0], crop[1], crop[2], crop[3]);
+ gtk_label_set_text (GTK_LABEL(crop_widget), text);
+ g_free(text);
+ }
+ }
}
G_MODULE_EXPORT void
presets_list_selection_changed_cb(GtkTreeSelection *selection, signal_user_data_t *ud)
{
- GtkTreeModel *store;
- GtkTreeIter iter;
- GtkWidget *widget;
-
- g_debug("presets_list_selection_changed_cb ()");
- widget = GHB_WIDGET (ud->builder, "presets_remove");
- if (gtk_tree_selection_get_selected(selection, &store, &iter))
- {
- GtkTreePath *treepath;
- gint *indices, len;
- GValue *path;
- gboolean folder;
-
- treepath = gtk_tree_model_get_path(store, &iter);
- indices = gtk_tree_path_get_indices(treepath);
- len = gtk_tree_path_get_depth(treepath);
-
- path = preset_path_from_indices(presetsPlist, indices, len);
- ghb_settings_take_value(ud->settings, "preset_selection", path);
-
- folder = ghb_presets_get_folder(presetsPlist, indices, len);
- if (!folder)
- {
- ud->dont_clear_presets = TRUE;
- ud->scale_busy = TRUE;
- // Temporarily set the video_quality range to (0,100)
- // This is needed so the video_quality value does not get
- // truncated when set. The range will be readjusted below
- GtkWidget *qp = GHB_WIDGET(ud->builder, "VideoQualitySlider");
- gtk_range_set_range (GTK_RANGE(qp), 0, 100);
- gtk_scale_set_digits(GTK_SCALE(qp), 3);
- ghb_set_preset_from_indices(ud, indices, len);
- gint titleindex;
- titleindex = ghb_settings_combo_int(ud->settings, "title");
- ghb_set_pref_audio_settings(titleindex, ud->settings);
- ghb_set_pref_audio_from_settings(ud, ud->settings);
- ghb_set_pref_subtitle(titleindex, ud);
- ghb_settings_set_boolean(ud->settings, "preset_modified", FALSE);
- hb_title_t * title = ghb_get_title_info(titleindex);
- if (title != NULL)
- {
- preset_update_title_deps(ud, title);
- }
- ud->scale_busy = FALSE;
- ghb_set_scale (ud, GHB_PIC_KEEP_PAR|GHB_PIC_USE_MAX);
- ud->dont_clear_presets = FALSE;
-
- gdouble vqmin, vqmax, step, page;
- gint digits;
- gboolean inverted;
-
- ghb_vquality_range(ud, &vqmin, &vqmax, &step,
- &page, &digits, &inverted);
- gtk_range_set_range (GTK_RANGE(qp), vqmin, vqmax);
- gtk_range_set_increments (GTK_RANGE(qp), step, page);
- gtk_scale_set_digits(GTK_SCALE(qp), digits);
- gtk_range_set_inverted (GTK_RANGE(qp), inverted);
-
- gchar *text;
- gint crop[4];
- GtkWidget *crop_widget;
- crop[0] = ghb_settings_get_int(ud->settings, "PictureTopCrop");
- crop[1] = ghb_settings_get_int(ud->settings, "PictureBottomCrop");
- crop[2] = ghb_settings_get_int(ud->settings, "PictureLeftCrop");
- crop[3] = ghb_settings_get_int(ud->settings, "PictureRightCrop");
- crop_widget = GHB_WIDGET (ud->builder, "crop_values");
- text = g_strdup_printf("%d:%d:%d:%d",
- crop[0], crop[1], crop[2], crop[3]);
- gtk_label_set_text (GTK_LABEL(crop_widget), text);
- g_free(text);
- }
- gtk_tree_path_free(treepath);
- gtk_widget_set_sensitive(widget, TRUE);
- }
- else
- {
- g_debug("No selection??? Perhaps unselected.");
- gtk_widget_set_sensitive(widget, FALSE);
- }
- if (ghb_settings_combo_int(ud->settings, "PtoPType") == 0)
- {
- gint start, end;
- start = ghb_settings_get_int(ud->settings, "start_point");
- end = ghb_settings_get_int(ud->settings, "end_point");
- widget = GHB_WIDGET (ud->builder, "ChapterMarkers");
- gtk_widget_set_sensitive(widget, TRUE);
- if (start == end)
- {
- ud->dont_clear_presets = TRUE;
- ghb_ui_update(ud, "ChapterMarkers", ghb_boolean_value(FALSE));
- ud->dont_clear_presets = FALSE;
- gtk_widget_set_sensitive(widget, FALSE);
- }
- }
+ GtkTreeModel *store;
+ GtkTreeIter iter;
+ GtkWidget *widget;
+
+ g_debug("presets_list_selection_changed_cb ()");
+ widget = GHB_WIDGET (ud->builder, "presets_remove");
+ if (gtk_tree_selection_get_selected(selection, &store, &iter))
+ {
+ GtkTreePath *treepath;
+ gint *indices, len;
+ GValue *path;
+ gboolean folder;
+
+ treepath = gtk_tree_model_get_path(store, &iter);
+ indices = gtk_tree_path_get_indices(treepath);
+ len = gtk_tree_path_get_depth(treepath);
+
+ path = preset_path_from_indices(presetsPlist, indices, len);
+ ghb_settings_take_value(ud->settings, "preset_selection", path);
+
+ folder = ghb_presets_get_folder(presetsPlist, indices, len);
+ if (!folder)
+ {
+ ud->dont_clear_presets = TRUE;
+ ud->scale_busy = TRUE;
+ // Temporarily set the video_quality range to (0,100)
+ // This is needed so the video_quality value does not get
+ // truncated when set. The range will be readjusted below
+ GtkWidget *qp = GHB_WIDGET(ud->builder, "VideoQualitySlider");
+ gtk_range_set_range (GTK_RANGE(qp), 0, 100);
+ gtk_scale_set_digits(GTK_SCALE(qp), 3);
+ ghb_set_preset_from_indices(ud, indices, len);
+ gint titleindex;
+ titleindex = ghb_settings_combo_int(ud->settings, "title");
+ ghb_set_pref_audio_settings(titleindex, ud->settings);
+ ghb_set_pref_audio_from_settings(ud, ud->settings);
+ ghb_set_pref_subtitle(titleindex, ud);
+ ghb_settings_set_boolean(ud->settings, "preset_modified", FALSE);
+ hb_title_t * title = ghb_get_title_info(titleindex);
+ if (title != NULL)
+ {
+ preset_update_title_deps(ud, title);
+ }
+ ud->scale_busy = FALSE;
+ ghb_set_scale (ud, GHB_PIC_KEEP_PAR|GHB_PIC_USE_MAX);
+ ud->dont_clear_presets = FALSE;
+
+ gdouble vqmin, vqmax, step, page;
+ gint digits;
+ gboolean inverted;
+
+ ghb_vquality_range(ud, &vqmin, &vqmax, &step,
+ &page, &digits, &inverted);
+ gtk_range_set_range (GTK_RANGE(qp), vqmin, vqmax);
+ gtk_range_set_increments (GTK_RANGE(qp), step, page);
+ gtk_scale_set_digits(GTK_SCALE(qp), digits);
+ gtk_range_set_inverted (GTK_RANGE(qp), inverted);
+
+ gchar *text;
+ gint crop[4];
+ GtkWidget *crop_widget;
+ crop[0] = ghb_settings_get_int(ud->settings, "PictureTopCrop");
+ crop[1] = ghb_settings_get_int(ud->settings, "PictureBottomCrop");
+ crop[2] = ghb_settings_get_int(ud->settings, "PictureLeftCrop");
+ crop[3] = ghb_settings_get_int(ud->settings, "PictureRightCrop");
+ crop_widget = GHB_WIDGET (ud->builder, "crop_values");
+ text = g_strdup_printf("%d:%d:%d:%d",
+ crop[0], crop[1], crop[2], crop[3]);
+ gtk_label_set_text (GTK_LABEL(crop_widget), text);
+ g_free(text);
+ }
+ gtk_tree_path_free(treepath);
+ gtk_widget_set_sensitive(widget, TRUE);
+ }
+ else
+ {
+ g_debug("No selection??? Perhaps unselected.");
+ gtk_widget_set_sensitive(widget, FALSE);
+ }
+ if (ghb_settings_combo_int(ud->settings, "PtoPType") == 0)
+ {
+ gint start, end;
+ start = ghb_settings_get_int(ud->settings, "start_point");
+ end = ghb_settings_get_int(ud->settings, "end_point");
+ widget = GHB_WIDGET (ud->builder, "ChapterMarkers");
+ gtk_widget_set_sensitive(widget, TRUE);
+ if (start == end)
+ {
+ ud->dont_clear_presets = TRUE;
+ ghb_ui_update(ud, "ChapterMarkers", ghb_boolean_value(FALSE));
+ ud->dont_clear_presets = FALSE;
+ gtk_widget_set_sensitive(widget, FALSE);
+ }
+ }
}
void
ghb_clear_presets_selection(signal_user_data_t *ud)
{
- GtkTreeView *treeview;
- GtkTreeSelection *selection;
-
- if (ud->dont_clear_presets) return;
- g_debug("ghb_clear_presets_selection()");
- treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "presets_list"));
- selection = gtk_tree_view_get_selection (treeview);
- gtk_tree_selection_unselect_all (selection);
- ghb_settings_set_boolean(ud->settings, "preset_modified", TRUE);
+ GtkTreeView *treeview;
+ GtkTreeSelection *selection;
+
+ if (ud->dont_clear_presets) return;
+ g_debug("ghb_clear_presets_selection()");
+ treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "presets_list"));
+ selection = gtk_tree_view_get_selection (treeview);
+ gtk_tree_selection_unselect_all (selection);
+ ghb_settings_set_boolean(ud->settings, "preset_modified", TRUE);
}
G_MODULE_EXPORT void
presets_frame_size_allocate_cb(GtkWidget *widget, GtkAllocation *allocation, signal_user_data_t *ud)
{
- GtkTreeView *treeview;
- GtkTreeSelection *selection;
- GtkTreeModel *store;
- GtkTreeIter iter;
-
- treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "presets_list"));
- selection = gtk_tree_view_get_selection(treeview);
- if (gtk_tree_selection_get_selected(selection, &store, &iter))
- {
- GtkTreePath *path;
- path = gtk_tree_model_get_path (store, &iter);
- // Make the parent visible in scroll window if it is not.
- gtk_tree_view_scroll_to_cell (treeview, path, NULL, FALSE, 0, 0);
- gtk_tree_path_free(path);
- }
+ GtkTreeView *treeview;
+ GtkTreeSelection *selection;
+ GtkTreeModel *store;
+ GtkTreeIter iter;
+
+ treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "presets_list"));
+ selection = gtk_tree_view_get_selection(treeview);
+ if (gtk_tree_selection_get_selected(selection, &store, &iter))
+ {
+ GtkTreePath *path;
+ path = gtk_tree_model_get_path (store, &iter);
+ // Make the parent visible in scroll window if it is not.
+ gtk_tree_view_scroll_to_cell (treeview, path, NULL, FALSE, 0, 0);
+ gtk_tree_path_free(path);
+ }
}
G_MODULE_EXPORT void
presets_default_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud)
{
- GValue *preset;
- gint *indices, len;
-
- g_debug("presets_default_clicked_cb ()");
- preset = ghb_settings_get_value(ud->settings, "preset_selection");
- indices = ghb_preset_indices_from_path(presetsPlist, preset, &len);
- if (indices)
- {
- if (!ghb_presets_get_folder(presetsPlist, indices, len))
- {
- ghb_presets_list_clear_default(ud);
- presets_set_default(indices, len);
- ghb_presets_list_default(ud);
- }
- g_free(indices);
- }
+ GValue *preset;
+ gint *indices, len;
+
+ g_debug("presets_default_clicked_cb ()");
+ preset = ghb_settings_get_value(ud->settings, "preset_selection");
+ indices = ghb_preset_indices_from_path(presetsPlist, preset, &len);
+ if (indices)
+ {
+ if (!ghb_presets_get_folder(presetsPlist, indices, len))
+ {
+ ghb_presets_list_clear_default(ud);
+ presets_set_default(indices, len);
+ ghb_presets_list_default(ud);
+ }
+ g_free(indices);
+ }
}
G_MODULE_EXPORT void
preset_edited_cb(
- GtkCellRendererText *cell,
- gchar *path,
- gchar *text,
- signal_user_data_t *ud)
-{
- GtkTreePath *treepath;
- GtkTreeStore *store;
- GtkTreeView *treeview;
- GtkTreeIter iter;
- gint *indices, len, count;
- GValue *dict;
- GValue *preset, *dest;
-
- g_debug("preset_edited_cb ()");
- g_debug("path (%s)", path);
- g_debug("text (%s)", text);
-
- preset = ghb_settings_get_value (ud->settings, "preset_selection");
- dest = ghb_array_value_new(MAX_NESTED_PRESET);
- count = ghb_array_len(preset);
- ghb_array_copy(dest, preset, count-1);
- ghb_array_append(dest, ghb_string_value_new(text));
- indices = ghb_preset_indices_from_path(presetsPlist, dest, &len);
- ghb_value_free(dest);
- if (indices != NULL)
- {
- // Already exists
- g_free(indices);
- return;
- }
-
- treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "presets_list"));
- store = GTK_TREE_STORE(gtk_tree_view_get_model(treeview));
- treepath = gtk_tree_path_new_from_string (path);
- indices = gtk_tree_path_get_indices(treepath);
- len = gtk_tree_path_get_depth(treepath);
- gtk_tree_model_get_iter(GTK_TREE_MODEL(store), &iter, treepath);
- gtk_tree_store_set(store, &iter, 0, text, -1);
-
- dict = presets_get_dict(presetsPlist, indices, len);
- ghb_dict_insert(dict, g_strdup("PresetName"), ghb_string_value_new(text));
- store_presets();
- gtk_tree_path_free (treepath);
+ GtkCellRendererText *cell,
+ gchar *path,
+ gchar *text,
+ signal_user_data_t *ud)
+{
+ GtkTreePath *treepath;
+ GtkTreeStore *store;
+ GtkTreeView *treeview;
+ GtkTreeIter iter;
+ gint *indices, len, count;
+ GValue *dict;
+ GValue *preset, *dest;
+
+ g_debug("preset_edited_cb ()");
+ g_debug("path (%s)", path);
+ g_debug("text (%s)", text);
+
+ preset = ghb_settings_get_value (ud->settings, "preset_selection");
+ dest = ghb_array_value_new(MAX_NESTED_PRESET);
+ count = ghb_array_len(preset);
+ ghb_array_copy(dest, preset, count-1);
+ ghb_array_append(dest, ghb_string_value_new(text));
+ indices = ghb_preset_indices_from_path(presetsPlist, dest, &len);
+ ghb_value_free(dest);
+ if (indices != NULL)
+ {
+ // Already exists
+ g_free(indices);
+ return;
+ }
+
+ treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "presets_list"));
+ store = GTK_TREE_STORE(gtk_tree_view_get_model(treeview));
+ treepath = gtk_tree_path_new_from_string (path);
+ indices = gtk_tree_path_get_indices(treepath);
+ len = gtk_tree_path_get_depth(treepath);
+ gtk_tree_model_get_iter(GTK_TREE_MODEL(store), &iter, treepath);
+ gtk_tree_store_set(store, &iter, 0, text, -1);
+
+ dict = presets_get_dict(presetsPlist, indices, len);
+ ghb_dict_insert(dict, g_strdup("PresetName"), ghb_string_value_new(text));
+ store_presets();
+ gtk_tree_path_free (treepath);
}
diff --git a/gtk/src/presets.h b/gtk/src/presets.h
index 89f778092..e3e126703 100644
--- a/gtk/src/presets.h
+++ b/gtk/src/presets.h
@@ -34,7 +34,7 @@ gchar* ghb_get_user_config_dir(gchar *subdir);
void ghb_settings_to_ui(signal_user_data_t *ud, GValue *dict);
void ghb_clear_presets_selection(signal_user_data_t *ud);
void ghb_select_preset(GtkBuilder *builder,
- const GValue *preset);
+ const GValue *preset);
void ghb_select_default_preset(GtkBuilder *builder);
void ghb_presets_list_init(signal_user_data_t *ud, gint *indices, gint len);
GValue* ghb_parse_preset_path(const gchar *path);
diff --git a/gtk/src/preview.c b/gtk/src/preview.c
index 334ec82bb..03d680a4f 100644
--- a/gtk/src/preview.c
+++ b/gtk/src/preview.c
@@ -42,592 +42,592 @@
struct preview_s
{
#if defined(_ENABLE_GST)
- GstElement *play;
- gulong xid;
+ GstElement *play;
+ gulong xid;
#endif
- gint64 len;
- gint64 pos;
- gboolean seek_lock;
- gboolean progress_lock;
- gint width;
- gint height;
- GtkWidget *view;
- GdkPixbuf *pix;
- gint button_width;
- gint button_height;
- gint frame;
- gint state;
- gboolean pause;
- gboolean encoded[30];
- gint encode_frame;
- gint live_id;
- gchar *current;
- gint live_enabled;
+ gint64 len;
+ gint64 pos;
+ gboolean seek_lock;
+ gboolean progress_lock;
+ gint width;
+ gint height;
+ GtkWidget *view;
+ GdkPixbuf *pix;
+ gint button_width;
+ gint button_height;
+ gint frame;
+ gint state;
+ gboolean pause;
+ gboolean encoded[30];
+ gint encode_frame;
+ gint live_id;
+ gchar *current;
+ gint live_enabled;
};
#if defined(_ENABLE_GST)
G_MODULE_EXPORT gboolean live_preview_cb(GstBus *bus, GstMessage *msg, gpointer data);
static GstBusSyncReply create_window(GstBus *bus, GstMessage *msg,
- gpointer data);
+ gpointer data);
#endif
G_MODULE_EXPORT gboolean preview_expose_cb(GtkWidget *widget, GdkEventExpose *event,
- signal_user_data_t *ud);
+ signal_user_data_t *ud);
void
ghb_screen_par(signal_user_data_t *ud, gint *par_n, gint *par_d)
{
#if defined(_ENABLE_GST)
- GValue disp_par = {0,};
- GstElement *xover;
- GObjectClass *klass;
- GParamSpec *pspec;
-
- if (!ud->preview->live_enabled)
- goto fail;
-
- g_value_init(&disp_par, GST_TYPE_FRACTION);
- gst_value_set_fraction(&disp_par, 1, 1);
- g_object_get(ud->preview->play, "video-sink", &xover, NULL);
- if (xover == NULL)
- goto fail;
-
- klass = G_OBJECT_GET_CLASS(xover);
- if (klass == NULL)
- goto fail;
-
- pspec = g_object_class_find_property(klass, "pixel-aspect_ratio");
- if (pspec)
- {
- GValue par_prop = {0,};
-
- g_value_init(&par_prop, pspec->value_type);
- g_object_get_property(G_OBJECT(xover), "pixel-aspect-ratio",
- &par_prop);
- if (!g_value_transform(&par_prop, &disp_par))
- {
- g_warning("transform failed");
- gst_value_set_fraction(&disp_par, 1, 1);
- }
- g_value_unset(&par_prop);
- }
- *par_n = gst_value_get_fraction_numerator(&disp_par);
- *par_d = gst_value_get_fraction_denominator(&disp_par);
- g_value_unset(&disp_par);
- return;
+ GValue disp_par = {0,};
+ GstElement *xover;
+ GObjectClass *klass;
+ GParamSpec *pspec;
+
+ if (!ud->preview->live_enabled)
+ goto fail;
+
+ g_value_init(&disp_par, GST_TYPE_FRACTION);
+ gst_value_set_fraction(&disp_par, 1, 1);
+ g_object_get(ud->preview->play, "video-sink", &xover, NULL);
+ if (xover == NULL)
+ goto fail;
+
+ klass = G_OBJECT_GET_CLASS(xover);
+ if (klass == NULL)
+ goto fail;
+
+ pspec = g_object_class_find_property(klass, "pixel-aspect_ratio");
+ if (pspec)
+ {
+ GValue par_prop = {0,};
+
+ g_value_init(&par_prop, pspec->value_type);
+ g_object_get_property(G_OBJECT(xover), "pixel-aspect-ratio",
+ &par_prop);
+ if (!g_value_transform(&par_prop, &disp_par))
+ {
+ g_warning("transform failed");
+ gst_value_set_fraction(&disp_par, 1, 1);
+ }
+ g_value_unset(&par_prop);
+ }
+ *par_n = gst_value_get_fraction_numerator(&disp_par);
+ *par_d = gst_value_get_fraction_denominator(&disp_par);
+ g_value_unset(&disp_par);
+ return;
fail:
- *par_n = 1;
- *par_d = 1;
+ *par_n = 1;
+ *par_d = 1;
#else
- *par_n = 1;
- *par_d = 1;
+ *par_n = 1;
+ *par_d = 1;
#endif
}
void
ghb_par_scale(signal_user_data_t *ud, gint *width, gint *height, gint par_n, gint par_d)
{
- gint disp_par_n, disp_par_d;
- gint64 num, den;
-
- ghb_screen_par(ud, &disp_par_n, &disp_par_d);
- if (disp_par_n < 1) disp_par_n = 1;
- if (disp_par_d < 1) disp_par_d = 1;
- num = par_n * disp_par_d;
- den = par_d * disp_par_n;
-
- if (par_n > par_d)
- *width = *width * num / den;
- else
- *height = *height * den / num;
+ gint disp_par_n, disp_par_d;
+ gint64 num, den;
+
+ ghb_screen_par(ud, &disp_par_n, &disp_par_d);
+ if (disp_par_n < 1) disp_par_n = 1;
+ if (disp_par_d < 1) disp_par_d = 1;
+ num = par_n * disp_par_d;
+ den = par_d * disp_par_n;
+
+ if (par_n > par_d)
+ *width = *width * num / den;
+ else
+ *height = *height * den / num;
}
void
ghb_preview_init(signal_user_data_t *ud)
{
- GtkWidget *widget;
-
- ud->preview = g_malloc0(sizeof(preview_t));
- ud->preview->view = GHB_WIDGET(ud->builder, "preview_image");
- gtk_widget_realize(ud->preview->view);
- g_signal_connect(G_OBJECT(ud->preview->view), "expose_event",
- G_CALLBACK(preview_expose_cb), ud);
-
- ud->preview->pause = TRUE;
- ud->preview->encode_frame = -1;
- ud->preview->live_id = -1;
- widget = GHB_WIDGET (ud->builder, "preview_button_image");
- gtk_widget_get_size_request(widget, &ud->preview->button_width, &ud->preview->button_height);
-
+ GtkWidget *widget;
+
+ ud->preview = g_malloc0(sizeof(preview_t));
+ ud->preview->view = GHB_WIDGET(ud->builder, "preview_image");
+ gtk_widget_realize(ud->preview->view);
+ g_signal_connect(G_OBJECT(ud->preview->view), "expose_event",
+ G_CALLBACK(preview_expose_cb), ud);
+
+ ud->preview->pause = TRUE;
+ ud->preview->encode_frame = -1;
+ ud->preview->live_id = -1;
+ widget = GHB_WIDGET (ud->builder, "preview_button_image");
+ gtk_widget_get_size_request(widget, &ud->preview->button_width, &ud->preview->button_height);
+
#if defined(_ENABLE_GST)
- GstBus *bus;
- GstElement *xover;
+ GstBus *bus;
+ GstElement *xover;
#if GTK_CHECK_VERSION(2,18,0)
- if (!gdk_window_ensure_native(gtk_widget_get_window(ud->preview->view)))
- {
- g_message("Couldn't create native window for GstXOverlay. Disabling live preview.");
- GtkWidget *widget = GHB_WIDGET(ud->builder, "live_preview_box");
- gtk_widget_hide (widget);
- widget = GHB_WIDGET(ud->builder, "live_preview_duration_box");
- gtk_widget_hide (widget);
- return;
- }
+ if (!gdk_window_ensure_native(gtk_widget_get_window(ud->preview->view)))
+ {
+ g_message("Couldn't create native window for GstXOverlay. Disabling live preview.");
+ GtkWidget *widget = GHB_WIDGET(ud->builder, "live_preview_box");
+ gtk_widget_hide (widget);
+ widget = GHB_WIDGET(ud->builder, "live_preview_duration_box");
+ gtk_widget_hide (widget);
+ return;
+ }
#endif
#if !defined(_WIN32)
- ud->preview->xid = GDK_WINDOW_XID(gtk_widget_get_window(ud->preview->view));
+ ud->preview->xid = GDK_WINDOW_XID(gtk_widget_get_window(ud->preview->view));
#else
- ud->preview->xid = GDK_WINDOW_HWND(gtk_widget_get_window(ud->preview->view));
+ ud->preview->xid = GDK_WINDOW_HWND(gtk_widget_get_window(ud->preview->view));
#endif
- ud->preview->play = gst_element_factory_make("playbin", "play");
- xover = gst_element_factory_make("gconfvideosink", "xover");
- if (xover == NULL)
- {
- xover = gst_element_factory_make("xvimagesink", "xover");
- }
- if (xover == NULL)
- {
- xover = gst_element_factory_make("ximagesink", "xover");
- }
- if (ud->preview->play == NULL || xover == NULL)
- {
- g_message("Couldn't initialize gstreamer. Disabling live preview.");
- GtkWidget *widget = GHB_WIDGET(ud->builder, "live_preview_box");
- gtk_widget_hide (widget);
- widget = GHB_WIDGET(ud->builder, "live_preview_duration_box");
- gtk_widget_hide (widget);
- return;
- }
- else
- {
-
- g_object_set(G_OBJECT(ud->preview->play), "video-sink", xover, NULL);
- g_object_set(ud->preview->play, "subtitle-font-desc",
- "sans bold 20", NULL);
-
- bus = gst_pipeline_get_bus(GST_PIPELINE(ud->preview->play));
- gst_bus_add_watch(bus, live_preview_cb, ud);
- gst_bus_set_sync_handler(bus, create_window, ud->preview);
- gst_object_unref(bus);
- ud->preview->live_enabled = 1;
- }
+ ud->preview->play = gst_element_factory_make("playbin", "play");
+ xover = gst_element_factory_make("gconfvideosink", "xover");
+ if (xover == NULL)
+ {
+ xover = gst_element_factory_make("xvimagesink", "xover");
+ }
+ if (xover == NULL)
+ {
+ xover = gst_element_factory_make("ximagesink", "xover");
+ }
+ if (ud->preview->play == NULL || xover == NULL)
+ {
+ g_message("Couldn't initialize gstreamer. Disabling live preview.");
+ GtkWidget *widget = GHB_WIDGET(ud->builder, "live_preview_box");
+ gtk_widget_hide (widget);
+ widget = GHB_WIDGET(ud->builder, "live_preview_duration_box");
+ gtk_widget_hide (widget);
+ return;
+ }
+ else
+ {
+
+ g_object_set(G_OBJECT(ud->preview->play), "video-sink", xover, NULL);
+ g_object_set(ud->preview->play, "subtitle-font-desc",
+ "sans bold 20", NULL);
+
+ bus = gst_pipeline_get_bus(GST_PIPELINE(ud->preview->play));
+ gst_bus_add_watch(bus, live_preview_cb, ud);
+ gst_bus_set_sync_handler(bus, create_window, ud->preview);
+ gst_object_unref(bus);
+ ud->preview->live_enabled = 1;
+ }
#else
- widget = GHB_WIDGET(ud->builder, "live_preview_box");
- gtk_widget_hide (widget);
- widget = GHB_WIDGET(ud->builder, "live_preview_duration_box");
- gtk_widget_hide (widget);
+ widget = GHB_WIDGET(ud->builder, "live_preview_box");
+ gtk_widget_hide (widget);
+ widget = GHB_WIDGET(ud->builder, "live_preview_duration_box");
+ gtk_widget_hide (widget);
#endif
}
void
ghb_preview_cleanup(signal_user_data_t *ud)
{
- if (ud->preview->current)
- {
- ud->preview->current = NULL;
- g_free(ud->preview->current);
- }
+ if (ud->preview->current)
+ {
+ ud->preview->current = NULL;
+ g_free(ud->preview->current);
+ }
}
#if defined(_ENABLE_GST)
static GstBusSyncReply
create_window(GstBus *bus, GstMessage *msg, gpointer data)
{
- preview_t *preview = (preview_t*)data;
-
- switch (GST_MESSAGE_TYPE(msg))
- {
- case GST_MESSAGE_ELEMENT:
- {
- if (!gst_structure_has_name(msg->structure, "prepare-xwindow-id"))
- return GST_BUS_PASS;
+ preview_t *preview = (preview_t*)data;
+
+ switch (GST_MESSAGE_TYPE(msg))
+ {
+ case GST_MESSAGE_ELEMENT:
+ {
+ if (!gst_structure_has_name(msg->structure, "prepare-xwindow-id"))
+ return GST_BUS_PASS;
#if !defined(_WIN32)
- gst_x_overlay_set_xwindow_id(
- GST_X_OVERLAY(GST_MESSAGE_SRC(msg)), preview->xid);
+ gst_x_overlay_set_xwindow_id(
+ GST_X_OVERLAY(GST_MESSAGE_SRC(msg)), preview->xid);
#else
- gst_directdraw_sink_set_window_id(
- GST_X_OVERLAY(GST_MESSAGE_SRC(msg)), preview->xid);
+ gst_directdraw_sink_set_window_id(
+ GST_X_OVERLAY(GST_MESSAGE_SRC(msg)), preview->xid);
#endif
- gst_message_unref(msg);
- return GST_BUS_DROP;
- } break;
-
- default:
- {
- } break;
- }
- return GST_BUS_PASS;
+ gst_message_unref(msg);
+ return GST_BUS_DROP;
+ } break;
+
+ default:
+ {
+ } break;
+ }
+ return GST_BUS_PASS;
}
static GList *
get_stream_info_objects_for_type (GstElement *play, const gchar *typestr)
{
- GValueArray *info_arr = NULL;
- GList *ret = NULL;
- guint ii;
-
- if (play == NULL)
- return NULL;
-
- g_object_get(play, "stream-info-value-array", &info_arr, NULL);
- if (info_arr == NULL)
- return NULL;
-
- for (ii = 0; ii < info_arr->n_values; ++ii)
- {
- GObject *info_obj;
- GValue *val;
-
- val = g_value_array_get_nth(info_arr, ii);
- info_obj = g_value_get_object(val);
- if (info_obj)
- {
- GParamSpec *pspec;
- GEnumValue *value;
- gint type = -1;
-
- g_object_get(info_obj, "type", &type, NULL);
- pspec = g_object_class_find_property(
- G_OBJECT_GET_CLASS (info_obj), "type");
- value = g_enum_get_value(
- G_PARAM_SPEC_ENUM (pspec)->enum_class, type);
- if (value)
- {
- if (g_ascii_strcasecmp (value->value_nick, typestr) == 0 ||
- g_ascii_strcasecmp (value->value_name, typestr) == 0)
- {
- ret = g_list_prepend (ret, g_object_ref (info_obj));
- }
- }
- }
- }
- g_value_array_free (info_arr);
- return g_list_reverse (ret);
+ GValueArray *info_arr = NULL;
+ GList *ret = NULL;
+ guint ii;
+
+ if (play == NULL)
+ return NULL;
+
+ g_object_get(play, "stream-info-value-array", &info_arr, NULL);
+ if (info_arr == NULL)
+ return NULL;
+
+ for (ii = 0; ii < info_arr->n_values; ++ii)
+ {
+ GObject *info_obj;
+ GValue *val;
+
+ val = g_value_array_get_nth(info_arr, ii);
+ info_obj = g_value_get_object(val);
+ if (info_obj)
+ {
+ GParamSpec *pspec;
+ GEnumValue *value;
+ gint type = -1;
+
+ g_object_get(info_obj, "type", &type, NULL);
+ pspec = g_object_class_find_property(
+ G_OBJECT_GET_CLASS (info_obj), "type");
+ value = g_enum_get_value(
+ G_PARAM_SPEC_ENUM (pspec)->enum_class, type);
+ if (value)
+ {
+ if (g_ascii_strcasecmp (value->value_nick, typestr) == 0 ||
+ g_ascii_strcasecmp (value->value_name, typestr) == 0)
+ {
+ ret = g_list_prepend (ret, g_object_ref (info_obj));
+ }
+ }
+ }
+ }
+ g_value_array_free (info_arr);
+ return g_list_reverse (ret);
}
static void
caps_set(GstCaps *caps, signal_user_data_t *ud)
{
- GstStructure *ss;
-
- ss = gst_caps_get_structure(caps, 0);
- if (ss)
- {
- gint fps_n, fps_d, width, height;
- guint num, den, par_n, par_d;
- gint disp_par_n, disp_par_d;
- const GValue *par;
-
- gst_structure_get_fraction(ss, "framerate", &fps_n, &fps_d);
- gst_structure_get_int(ss, "width", &width);
- gst_structure_get_int(ss, "height", &height);
- par = gst_structure_get_value(ss, "pixel-aspect-ratio");
- par_n = gst_value_get_fraction_numerator(par);
- par_d = gst_value_get_fraction_denominator(par);
-
- ghb_screen_par(ud, &disp_par_n, &disp_par_d);
- gst_video_calculate_display_ratio(
- &num, &den, width, height, par_n, par_d, disp_par_n, disp_par_d);
-
- if (par_n > par_d)
- width = gst_util_uint64_scale_int(height, num, den);
- else
- height = gst_util_uint64_scale_int(width, den, num);
-
- if (ghb_settings_get_boolean(ud->settings, "reduce_hd_preview"))
- {
- GdkScreen *ss;
- gint s_w, s_h;
-
- ss = gdk_screen_get_default();
- s_w = gdk_screen_get_width(ss);
- s_h = gdk_screen_get_height(ss);
-
- if (width > s_w * 80 / 100)
- {
- width = s_w * 80 / 100;
- height = gst_util_uint64_scale_int(width, den, num);
- }
- if (height > s_h * 80 / 100)
- {
- height = s_h * 80 / 100;
- width = gst_util_uint64_scale_int(height, num, den);
- }
- }
-
- if (width != ud->preview->width || height != ud->preview->height)
- {
- gtk_widget_set_size_request(ud->preview->view, width, height);
- ud->preview->width = width;
- ud->preview->height = height;
- }
- }
+ GstStructure *ss;
+
+ ss = gst_caps_get_structure(caps, 0);
+ if (ss)
+ {
+ gint fps_n, fps_d, width, height;
+ guint num, den, par_n, par_d;
+ gint disp_par_n, disp_par_d;
+ const GValue *par;
+
+ gst_structure_get_fraction(ss, "framerate", &fps_n, &fps_d);
+ gst_structure_get_int(ss, "width", &width);
+ gst_structure_get_int(ss, "height", &height);
+ par = gst_structure_get_value(ss, "pixel-aspect-ratio");
+ par_n = gst_value_get_fraction_numerator(par);
+ par_d = gst_value_get_fraction_denominator(par);
+
+ ghb_screen_par(ud, &disp_par_n, &disp_par_d);
+ gst_video_calculate_display_ratio(
+ &num, &den, width, height, par_n, par_d, disp_par_n, disp_par_d);
+
+ if (par_n > par_d)
+ width = gst_util_uint64_scale_int(height, num, den);
+ else
+ height = gst_util_uint64_scale_int(width, den, num);
+
+ if (ghb_settings_get_boolean(ud->settings, "reduce_hd_preview"))
+ {
+ GdkScreen *ss;
+ gint s_w, s_h;
+
+ ss = gdk_screen_get_default();
+ s_w = gdk_screen_get_width(ss);
+ s_h = gdk_screen_get_height(ss);
+
+ if (width > s_w * 80 / 100)
+ {
+ width = s_w * 80 / 100;
+ height = gst_util_uint64_scale_int(width, den, num);
+ }
+ if (height > s_h * 80 / 100)
+ {
+ height = s_h * 80 / 100;
+ width = gst_util_uint64_scale_int(height, num, den);
+ }
+ }
+
+ if (width != ud->preview->width || height != ud->preview->height)
+ {
+ gtk_widget_set_size_request(ud->preview->view, width, height);
+ ud->preview->width = width;
+ ud->preview->height = height;
+ }
+ }
}
static void
update_stream_info(signal_user_data_t *ud)
{
- GList *vstreams, *ll;
- GstPad *vpad = NULL;
-
- vstreams = get_stream_info_objects_for_type(ud->preview->play, "video");
- if (vstreams)
- {
- for (ll = vstreams; vpad == NULL && ll != NULL; ll = ll->next)
- {
- g_object_get(ll->data, "object", &vpad, NULL);
- }
- }
- if (vpad)
- {
- GstCaps *caps;
-
- caps = gst_pad_get_negotiated_caps(vpad);
- if (caps)
- {
- caps_set(caps, ud);
- gst_caps_unref(caps);
- }
- //g_signal_connect(vpad, "notify::caps", G_CALLBACK(caps_set_cb), preview);
- gst_object_unref(vpad);
- }
- g_list_foreach(vstreams, (GFunc)g_object_unref, NULL);
- g_list_free(vstreams);
+ GList *vstreams, *ll;
+ GstPad *vpad = NULL;
+
+ vstreams = get_stream_info_objects_for_type(ud->preview->play, "video");
+ if (vstreams)
+ {
+ for (ll = vstreams; vpad == NULL && ll != NULL; ll = ll->next)
+ {
+ g_object_get(ll->data, "object", &vpad, NULL);
+ }
+ }
+ if (vpad)
+ {
+ GstCaps *caps;
+
+ caps = gst_pad_get_negotiated_caps(vpad);
+ if (caps)
+ {
+ caps_set(caps, ud);
+ gst_caps_unref(caps);
+ }
+ //g_signal_connect(vpad, "notify::caps", G_CALLBACK(caps_set_cb), preview);
+ gst_object_unref(vpad);
+ }
+ g_list_foreach(vstreams, (GFunc)g_object_unref, NULL);
+ g_list_free(vstreams);
}
G_MODULE_EXPORT gboolean
live_preview_cb(GstBus *bus, GstMessage *msg, gpointer data)
{
- signal_user_data_t *ud = (signal_user_data_t*)data;
-
- switch (GST_MESSAGE_TYPE(msg))
- {
- case GST_MESSAGE_ERROR:
- {
- GError *err;
- gchar *debug;
-
- gst_message_parse_error(msg, &err, &debug);
- g_warning("Gstreamer Error: %s", err->message);
- g_error_free(err);
- g_free(debug);
- } break;
-
- case GST_MESSAGE_ELEMENT:
- {
- if (gst_is_missing_plugin_message(msg))
- {
- gst_element_set_state(ud->preview->play, GST_STATE_PAUSED);
- gchar *message, *desc;
- desc = gst_missing_plugin_message_get_description(msg);
- message = g_strdup_printf(
- "Missing GStreamer plugin\n"
- "Audio or Video may not play as expected\n\n%s",
- desc);
- ghb_message_dialog(GTK_MESSAGE_WARNING, message, "Ok", NULL);
- g_free(message);
- gst_element_set_state(ud->preview->play, GST_STATE_PLAYING);
- }
- } break;
-
- case GST_MESSAGE_STATE_CHANGED:
- {
- GstState state, pending;
- gst_element_get_state(ud->preview->play, &state, &pending, 0);
- if (state == GST_STATE_PAUSED || state == GST_STATE_PLAYING)
- {
- update_stream_info(ud);
- }
- } break;
-
- case GST_MESSAGE_EOS:
- {
- // Done
- GtkImage *img;
-
- img = GTK_IMAGE(GHB_WIDGET(ud->builder, "live_preview_play_image"));
- gtk_image_set_from_stock(img, "gtk-media-play", GTK_ICON_SIZE_BUTTON);
- gst_element_set_state(ud->preview->play, GST_STATE_PAUSED);
- ud->preview->pause = TRUE;
- gst_element_seek(ud->preview->play, 1.0,
- GST_FORMAT_TIME, GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_KEY_UNIT,
- GST_SEEK_TYPE_SET, 0,
- GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE);
- } break;
-
- default:
- {
- // Ignore
- }
- }
- return TRUE;
+ signal_user_data_t *ud = (signal_user_data_t*)data;
+
+ switch (GST_MESSAGE_TYPE(msg))
+ {
+ case GST_MESSAGE_ERROR:
+ {
+ GError *err;
+ gchar *debug;
+
+ gst_message_parse_error(msg, &err, &debug);
+ g_warning("Gstreamer Error: %s", err->message);
+ g_error_free(err);
+ g_free(debug);
+ } break;
+
+ case GST_MESSAGE_ELEMENT:
+ {
+ if (gst_is_missing_plugin_message(msg))
+ {
+ gst_element_set_state(ud->preview->play, GST_STATE_PAUSED);
+ gchar *message, *desc;
+ desc = gst_missing_plugin_message_get_description(msg);
+ message = g_strdup_printf(
+ "Missing GStreamer plugin\n"
+ "Audio or Video may not play as expected\n\n%s",
+ desc);
+ ghb_message_dialog(GTK_MESSAGE_WARNING, message, "Ok", NULL);
+ g_free(message);
+ gst_element_set_state(ud->preview->play, GST_STATE_PLAYING);
+ }
+ } break;
+
+ case GST_MESSAGE_STATE_CHANGED:
+ {
+ GstState state, pending;
+ gst_element_get_state(ud->preview->play, &state, &pending, 0);
+ if (state == GST_STATE_PAUSED || state == GST_STATE_PLAYING)
+ {
+ update_stream_info(ud);
+ }
+ } break;
+
+ case GST_MESSAGE_EOS:
+ {
+ // Done
+ GtkImage *img;
+
+ img = GTK_IMAGE(GHB_WIDGET(ud->builder, "live_preview_play_image"));
+ gtk_image_set_from_stock(img, "gtk-media-play", GTK_ICON_SIZE_BUTTON);
+ gst_element_set_state(ud->preview->play, GST_STATE_PAUSED);
+ ud->preview->pause = TRUE;
+ gst_element_seek(ud->preview->play, 1.0,
+ GST_FORMAT_TIME, GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_KEY_UNIT,
+ GST_SEEK_TYPE_SET, 0,
+ GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE);
+ } break;
+
+ default:
+ {
+ // Ignore
+ }
+ }
+ return TRUE;
}
void
live_preview_start(signal_user_data_t *ud)
{
- GtkImage *img;
- gchar *uri;
-
- if (!ud->preview->live_enabled)
- return;
-
- img = GTK_IMAGE(GHB_WIDGET(ud->builder, "live_preview_play_image"));
- if (!ud->preview->encoded[ud->preview->frame])
- {
- gtk_image_set_from_stock(img, "gtk-media-play", GTK_ICON_SIZE_BUTTON);
- gst_element_set_state(ud->preview->play, GST_STATE_NULL);
- ud->preview->pause = TRUE;
- return;
- }
-
- uri = g_strdup_printf("file://%s", ud->preview->current);
- gtk_image_set_from_stock(img, "gtk-media-pause", GTK_ICON_SIZE_BUTTON);
- ud->preview->state = PREVIEW_STATE_LIVE;
- g_object_set(G_OBJECT(ud->preview->play), "uri", uri, NULL);
- gst_element_set_state(ud->preview->play, GST_STATE_PLAYING);
- ud->preview->pause = FALSE;
- g_free(uri);
+ GtkImage *img;
+ gchar *uri;
+
+ if (!ud->preview->live_enabled)
+ return;
+
+ img = GTK_IMAGE(GHB_WIDGET(ud->builder, "live_preview_play_image"));
+ if (!ud->preview->encoded[ud->preview->frame])
+ {
+ gtk_image_set_from_stock(img, "gtk-media-play", GTK_ICON_SIZE_BUTTON);
+ gst_element_set_state(ud->preview->play, GST_STATE_NULL);
+ ud->preview->pause = TRUE;
+ return;
+ }
+
+ uri = g_strdup_printf("file://%s", ud->preview->current);
+ gtk_image_set_from_stock(img, "gtk-media-pause", GTK_ICON_SIZE_BUTTON);
+ ud->preview->state = PREVIEW_STATE_LIVE;
+ g_object_set(G_OBJECT(ud->preview->play), "uri", uri, NULL);
+ gst_element_set_state(ud->preview->play, GST_STATE_PLAYING);
+ ud->preview->pause = FALSE;
+ g_free(uri);
}
void
live_preview_pause(signal_user_data_t *ud)
{
- GtkImage *img;
+ GtkImage *img;
- if (!ud->preview->live_enabled)
- return;
+ if (!ud->preview->live_enabled)
+ return;
- img = GTK_IMAGE(GHB_WIDGET(ud->builder, "live_preview_play_image"));
- gtk_image_set_from_stock(img, "gtk-media-play", GTK_ICON_SIZE_BUTTON);
- gst_element_set_state(ud->preview->play, GST_STATE_PAUSED);
- ud->preview->pause = TRUE;
+ img = GTK_IMAGE(GHB_WIDGET(ud->builder, "live_preview_play_image"));
+ gtk_image_set_from_stock(img, "gtk-media-play", GTK_ICON_SIZE_BUTTON);
+ gst_element_set_state(ud->preview->play, GST_STATE_PAUSED);
+ ud->preview->pause = TRUE;
}
#endif
void
live_preview_stop(signal_user_data_t *ud)
{
- GtkImage *img;
- GtkRange *progress;
+ GtkImage *img;
+ GtkRange *progress;
- if (!ud->preview->live_enabled)
- return;
+ if (!ud->preview->live_enabled)
+ return;
- img = GTK_IMAGE(GHB_WIDGET(ud->builder, "live_preview_play_image"));
- gtk_image_set_from_stock(img, "gtk-media-play", GTK_ICON_SIZE_BUTTON);
+ img = GTK_IMAGE(GHB_WIDGET(ud->builder, "live_preview_play_image"));
+ gtk_image_set_from_stock(img, "gtk-media-play", GTK_ICON_SIZE_BUTTON);
#if defined(_ENABLE_GST)
- gst_element_set_state(ud->preview->play, GST_STATE_NULL);
+ gst_element_set_state(ud->preview->play, GST_STATE_NULL);
#endif
- ud->preview->pause = TRUE;
- ud->preview->state = PREVIEW_STATE_IMAGE;
+ ud->preview->pause = TRUE;
+ ud->preview->state = PREVIEW_STATE_IMAGE;
- progress = GTK_RANGE(GHB_WIDGET(ud->builder, "live_preview_progress"));
- gtk_range_set_value(progress, 0);
+ progress = GTK_RANGE(GHB_WIDGET(ud->builder, "live_preview_progress"));
+ gtk_range_set_value(progress, 0);
}
void
ghb_live_reset(signal_user_data_t *ud)
{
- gboolean encoded;
-
- if (ud->preview->live_id >= 0)
- {
- ghb_stop_live_encode();
- }
- ud->preview->live_id = -1;
- ud->preview->encode_frame = -1;
- if (!ud->preview->pause)
- live_preview_stop(ud);
- if (ud->preview->current)
- {
- g_free(ud->preview->current);
- ud->preview->current = NULL;
- }
- encoded = ud->preview->encoded[ud->preview->frame];
- memset(ud->preview->encoded, 0, sizeof(gboolean) * 10);
- if (encoded)
- ghb_set_preview_image(ud);
+ gboolean encoded;
+
+ if (ud->preview->live_id >= 0)
+ {
+ ghb_stop_live_encode();
+ }
+ ud->preview->live_id = -1;
+ ud->preview->encode_frame = -1;
+ if (!ud->preview->pause)
+ live_preview_stop(ud);
+ if (ud->preview->current)
+ {
+ g_free(ud->preview->current);
+ ud->preview->current = NULL;
+ }
+ encoded = ud->preview->encoded[ud->preview->frame];
+ memset(ud->preview->encoded, 0, sizeof(gboolean) * 10);
+ if (encoded)
+ ghb_set_preview_image(ud);
}
G_MODULE_EXPORT void
live_preview_start_cb(GtkWidget *xwidget, signal_user_data_t *ud)
{
- gchar *tmp_dir;
- gchar *name;
- gint frame = ud->preview->frame;
-
- tmp_dir = ghb_get_tmp_dir();
- name = g_strdup_printf("%s/live%02d", tmp_dir, ud->preview->frame);
- if (ud->preview->current)
- g_free(ud->preview->current);
- ud->preview->current = name;
-
- if (ud->preview->encoded[frame] &&
- g_file_test(name, G_FILE_TEST_IS_REGULAR))
- {
+ gchar *tmp_dir;
+ gchar *name;
+ gint frame = ud->preview->frame;
+
+ tmp_dir = ghb_get_tmp_dir();
+ name = g_strdup_printf("%s/live%02d", tmp_dir, ud->preview->frame);
+ if (ud->preview->current)
+ g_free(ud->preview->current);
+ ud->preview->current = name;
+
+ if (ud->preview->encoded[frame] &&
+ g_file_test(name, G_FILE_TEST_IS_REGULAR))
+ {
#if defined(_ENABLE_GST)
- if (ud->preview->pause)
- live_preview_start(ud);
- else
- live_preview_pause(ud);
+ if (ud->preview->pause)
+ live_preview_start(ud);
+ else
+ live_preview_pause(ud);
#endif
- }
- else
- {
- GValue *js;
-
- ud->preview->encode_frame = frame;
- js = ghb_value_dup(ud->settings);
- ghb_settings_set_string(js, "destination", name);
- ghb_settings_set_int(js, "start_frame", ud->preview->frame);
- ud->preview->live_id = 0;
- ghb_add_live_job(js, ud->preview->live_id);
- ghb_start_live_encode();
- ghb_value_free(js);
- }
+ }
+ else
+ {
+ GValue *js;
+
+ ud->preview->encode_frame = frame;
+ js = ghb_value_dup(ud->settings);
+ ghb_settings_set_string(js, "destination", name);
+ ghb_settings_set_int(js, "start_frame", ud->preview->frame);
+ ud->preview->live_id = 0;
+ ghb_add_live_job(js, ud->preview->live_id);
+ ghb_start_live_encode();
+ ghb_value_free(js);
+ }
}
void
ghb_live_encode_done(signal_user_data_t *ud, gboolean success)
{
- GtkWidget *widget;
- GtkWidget *prog;
-
- ud->preview->live_id = -1;
- prog = GHB_WIDGET(ud->builder, "live_encode_progress");
- if (success &&
- ud->preview->encode_frame == ud->preview->frame)
- {
- gtk_progress_bar_set_text(GTK_PROGRESS_BAR(prog), "Done");
- gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR(prog), 1);
- ud->preview->encoded[ud->preview->encode_frame] = TRUE;
+ GtkWidget *widget;
+ GtkWidget *prog;
+
+ ud->preview->live_id = -1;
+ prog = GHB_WIDGET(ud->builder, "live_encode_progress");
+ if (success &&
+ ud->preview->encode_frame == ud->preview->frame)
+ {
+ gtk_progress_bar_set_text(GTK_PROGRESS_BAR(prog), "Done");
+ gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR(prog), 1);
+ ud->preview->encoded[ud->preview->encode_frame] = TRUE;
#if defined(_ENABLE_GST)
- live_preview_start(ud);
+ live_preview_start(ud);
#endif
- widget = GHB_WIDGET(ud->builder, "live_progress_box");
- gtk_widget_hide (widget);
- widget = GHB_WIDGET(ud->builder, "live_preview_progress");
- gtk_widget_show (widget);
- }
- else
- {
- gtk_progress_bar_set_text(GTK_PROGRESS_BAR(prog), "");
- gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR(prog), 0);
- ud->preview->encoded[ud->preview->encode_frame] = FALSE;
- }
+ widget = GHB_WIDGET(ud->builder, "live_progress_box");
+ gtk_widget_hide (widget);
+ widget = GHB_WIDGET(ud->builder, "live_preview_progress");
+ gtk_widget_show (widget);
+ }
+ else
+ {
+ gtk_progress_bar_set_text(GTK_PROGRESS_BAR(prog), "");
+ gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR(prog), 0);
+ ud->preview->encoded[ud->preview->encode_frame] = FALSE;
+ }
}
#if defined(_ENABLE_GST)
G_MODULE_EXPORT gboolean
unlock_progress_cb(signal_user_data_t *ud)
{
- ud->preview->progress_lock = FALSE;
- // This function is initiated by g_idle_add. Must return false
- // so that it is not called again
- return FALSE;
+ ud->preview->progress_lock = FALSE;
+ // This function is initiated by g_idle_add. Must return false
+ // so that it is not called again
+ return FALSE;
}
#endif
@@ -635,40 +635,40 @@ void
ghb_live_preview_progress(signal_user_data_t *ud)
{
#if defined(_ENABLE_GST)
- GstFormat fmt = GST_FORMAT_TIME;
- gint64 len = -1, pos = -1;
-
- if (!ud->preview->live_enabled)
- return;
-
- if (ud->preview->state != PREVIEW_STATE_LIVE || ud->preview->seek_lock)
- return;
-
- ud->preview->progress_lock = TRUE;
- if (gst_element_query_duration(ud->preview->play, &fmt, &len))
- {
- if (len != -1 && fmt == GST_FORMAT_TIME)
- {
- ud->preview->len = len / GST_MSECOND;
- }
- }
- if (gst_element_query_position(ud->preview->play, &fmt, &pos))
- {
- if (pos != -1 && fmt == GST_FORMAT_TIME)
- {
- ud->preview->pos = pos / GST_MSECOND;
- }
- }
- if (ud->preview->len > 0)
- {
- GtkRange *progress;
- gdouble percent;
-
- percent = (gdouble)ud->preview->pos * 100 / ud->preview->len;
- progress = GTK_RANGE(GHB_WIDGET(ud->builder, "live_preview_progress"));
- gtk_range_set_value(progress, percent);
- }
- g_idle_add((GSourceFunc)unlock_progress_cb, ud);
+ GstFormat fmt = GST_FORMAT_TIME;
+ gint64 len = -1, pos = -1;
+
+ if (!ud->preview->live_enabled)
+ return;
+
+ if (ud->preview->state != PREVIEW_STATE_LIVE || ud->preview->seek_lock)
+ return;
+
+ ud->preview->progress_lock = TRUE;
+ if (gst_element_query_duration(ud->preview->play, &fmt, &len))
+ {
+ if (len != -1 && fmt == GST_FORMAT_TIME)
+ {
+ ud->preview->len = len / GST_MSECOND;
+ }
+ }
+ if (gst_element_query_position(ud->preview->play, &fmt, &pos))
+ {
+ if (pos != -1 && fmt == GST_FORMAT_TIME)
+ {
+ ud->preview->pos = pos / GST_MSECOND;
+ }
+ }
+ if (ud->preview->len > 0)
+ {
+ GtkRange *progress;
+ gdouble percent;
+
+ percent = (gdouble)ud->preview->pos * 100 / ud->preview->len;
+ progress = GTK_RANGE(GHB_WIDGET(ud->builder, "live_preview_progress"));
+ gtk_range_set_value(progress, percent);
+ }
+ g_idle_add((GSourceFunc)unlock_progress_cb, ud);
#endif
}
@@ -676,10 +676,10 @@ ghb_live_preview_progress(signal_user_data_t *ud)
G_MODULE_EXPORT gboolean
unlock_seek_cb(signal_user_data_t *ud)
{
- ud->preview->seek_lock = FALSE;
- // This function is initiated by g_idle_add. Must return false
- // so that it is not called again
- return FALSE;
+ ud->preview->seek_lock = FALSE;
+ // This function is initiated by g_idle_add. Must return false
+ // so that it is not called again
+ return FALSE;
}
#endif
@@ -687,23 +687,23 @@ G_MODULE_EXPORT void
live_preview_seek_cb(GtkWidget *widget, signal_user_data_t *ud)
{
#if defined(_ENABLE_GST)
- gdouble dval;
- gint64 pos;
-
- if (!ud->preview->live_enabled)
- return;
-
- if (ud->preview->progress_lock)
- return;
-
- ud->preview->seek_lock = TRUE;
- dval = gtk_range_get_value(GTK_RANGE(widget));
- pos = ((ud->preview->len * dval) / 100) * GST_MSECOND;
- gst_element_seek(ud->preview->play, 1.0,
- GST_FORMAT_TIME, GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_ACCURATE,
- GST_SEEK_TYPE_SET, pos,
- GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE);
- g_idle_add((GSourceFunc)unlock_seek_cb, ud);
+ gdouble dval;
+ gint64 pos;
+
+ if (!ud->preview->live_enabled)
+ return;
+
+ if (ud->preview->progress_lock)
+ return;
+
+ ud->preview->seek_lock = TRUE;
+ dval = gtk_range_get_value(GTK_RANGE(widget));
+ pos = ((ud->preview->len * dval) / 100) * GST_MSECOND;
+ gst_element_seek(ud->preview->play, 1.0,
+ GST_FORMAT_TIME, GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_ACCURATE,
+ GST_SEEK_TYPE_SET, pos,
+ GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE);
+ g_idle_add((GSourceFunc)unlock_seek_cb, ud);
#endif
}
@@ -714,372 +714,372 @@ static void _draw_pixbuf(GdkWindow *window, GdkPixbuf *pixbuf)
cr = gdk_cairo_create(window);
gdk_cairo_set_source_pixbuf(cr, pixbuf, 0, 0);
cairo_paint(cr);
- cairo_destroy(cr);
+ cairo_destroy(cr);
}
void
ghb_set_preview_image(signal_user_data_t *ud)
{
- GtkWidget *widget;
- gint preview_width, preview_height, target_height, width, height;
-
- g_debug("set_preview_button_image ()");
- gint titleindex;
-
- live_preview_stop(ud);
-
- titleindex = ghb_settings_combo_int(ud->settings, "title");
- if (titleindex < 0) return;
- widget = GHB_WIDGET (ud->builder, "preview_frame");
- ud->preview->frame = ghb_widget_int(widget) - 1;
- if (ud->preview->encoded[ud->preview->frame])
- {
- widget = GHB_WIDGET(ud->builder, "live_progress_box");
- gtk_widget_hide (widget);
- widget = GHB_WIDGET(ud->builder, "live_preview_progress");
- gtk_widget_show (widget);
- }
- else
- {
- widget = GHB_WIDGET(ud->builder, "live_preview_progress");
- gtk_widget_hide (widget);
- widget = GHB_WIDGET(ud->builder, "live_progress_box");
- gtk_widget_show (widget);
- widget = GHB_WIDGET(ud->builder, "live_encode_progress");
- gtk_progress_bar_set_text(GTK_PROGRESS_BAR(widget), "");
- gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR(widget), 0);
- }
- if (ud->preview->pix != NULL)
- g_object_unref(ud->preview->pix);
-
- ud->preview->pix =
- ghb_get_preview_image(titleindex, ud->preview->frame,
- ud, &width, &height);
- if (ud->preview->pix == NULL) return;
- preview_width = gdk_pixbuf_get_width(ud->preview->pix);
- preview_height = gdk_pixbuf_get_height(ud->preview->pix);
- widget = GHB_WIDGET (ud->builder, "preview_image");
- if (preview_width != ud->preview->width ||
- preview_height != ud->preview->height)
- {
- gtk_widget_set_size_request(widget, preview_width, preview_height);
- ud->preview->width = preview_width;
- ud->preview->height = preview_height;
- }
+ GtkWidget *widget;
+ gint preview_width, preview_height, target_height, width, height;
+
+ g_debug("set_preview_button_image ()");
+ gint titleindex;
+
+ live_preview_stop(ud);
+
+ titleindex = ghb_settings_combo_int(ud->settings, "title");
+ if (titleindex < 0) return;
+ widget = GHB_WIDGET (ud->builder, "preview_frame");
+ ud->preview->frame = ghb_widget_int(widget) - 1;
+ if (ud->preview->encoded[ud->preview->frame])
+ {
+ widget = GHB_WIDGET(ud->builder, "live_progress_box");
+ gtk_widget_hide (widget);
+ widget = GHB_WIDGET(ud->builder, "live_preview_progress");
+ gtk_widget_show (widget);
+ }
+ else
+ {
+ widget = GHB_WIDGET(ud->builder, "live_preview_progress");
+ gtk_widget_hide (widget);
+ widget = GHB_WIDGET(ud->builder, "live_progress_box");
+ gtk_widget_show (widget);
+ widget = GHB_WIDGET(ud->builder, "live_encode_progress");
+ gtk_progress_bar_set_text(GTK_PROGRESS_BAR(widget), "");
+ gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR(widget), 0);
+ }
+ if (ud->preview->pix != NULL)
+ g_object_unref(ud->preview->pix);
+
+ ud->preview->pix =
+ ghb_get_preview_image(titleindex, ud->preview->frame,
+ ud, &width, &height);
+ if (ud->preview->pix == NULL) return;
+ preview_width = gdk_pixbuf_get_width(ud->preview->pix);
+ preview_height = gdk_pixbuf_get_height(ud->preview->pix);
+ widget = GHB_WIDGET (ud->builder, "preview_image");
+ if (preview_width != ud->preview->width ||
+ preview_height != ud->preview->height)
+ {
+ gtk_widget_set_size_request(widget, preview_width, preview_height);
+ ud->preview->width = preview_width;
+ ud->preview->height = preview_height;
+ }
_draw_pixbuf(gtk_widget_get_window(widget), ud->preview->pix);
- gchar *text = g_strdup_printf("%d x %d", width, height);
- widget = GHB_WIDGET (ud->builder, "preview_dims");
- gtk_label_set_text(GTK_LABEL(widget), text);
- g_free(text);
-
- g_debug("preview %d x %d", preview_width, preview_height);
- target_height = MIN(ud->preview->button_height, 200);
- height = target_height;
- width = preview_width * height / preview_height;
- if (width > 400)
- {
- width = 400;
- height = preview_height * width / preview_width;
- }
-
- if ((height >= 16) && (width >= 16))
- {
- GdkPixbuf *scaled_preview;
- scaled_preview = gdk_pixbuf_scale_simple (ud->preview->pix, width,
- height, GDK_INTERP_NEAREST);
- if (scaled_preview != NULL)
- {
- widget = GHB_WIDGET (ud->builder, "preview_button_image");
- gtk_image_set_from_pixbuf(GTK_IMAGE(widget), scaled_preview);
- g_object_unref (scaled_preview);
- }
- }
+ gchar *text = g_strdup_printf("%d x %d", width, height);
+ widget = GHB_WIDGET (ud->builder, "preview_dims");
+ gtk_label_set_text(GTK_LABEL(widget), text);
+ g_free(text);
+
+ g_debug("preview %d x %d", preview_width, preview_height);
+ target_height = MIN(ud->preview->button_height, 200);
+ height = target_height;
+ width = preview_width * height / preview_height;
+ if (width > 400)
+ {
+ width = 400;
+ height = preview_height * width / preview_width;
+ }
+
+ if ((height >= 16) && (width >= 16))
+ {
+ GdkPixbuf *scaled_preview;
+ scaled_preview = gdk_pixbuf_scale_simple (ud->preview->pix, width,
+ height, GDK_INTERP_NEAREST);
+ if (scaled_preview != NULL)
+ {
+ widget = GHB_WIDGET (ud->builder, "preview_button_image");
+ gtk_image_set_from_pixbuf(GTK_IMAGE(widget), scaled_preview);
+ g_object_unref (scaled_preview);
+ }
+ }
}
#if defined(_ENABLE_GST)
G_MODULE_EXPORT gboolean
delayed_expose_cb(signal_user_data_t *ud)
{
- GstElement *vsink;
- GstXOverlay *xover;
-
- if (!ud->preview->live_enabled)
- return FALSE;
-
- g_object_get(ud->preview->play, "video-sink", &vsink, NULL);
- if (vsink == NULL)
- return FALSE;
-
- if (GST_IS_BIN(vsink))
- xover = GST_X_OVERLAY(gst_bin_get_by_interface(
- GST_BIN(vsink), GST_TYPE_X_OVERLAY));
- else
- xover = GST_X_OVERLAY(vsink);
- gst_x_overlay_expose(xover);
- // This function is initiated by g_idle_add. Must return false
- // so that it is not called again
- return FALSE;
+ GstElement *vsink;
+ GstXOverlay *xover;
+
+ if (!ud->preview->live_enabled)
+ return FALSE;
+
+ g_object_get(ud->preview->play, "video-sink", &vsink, NULL);
+ if (vsink == NULL)
+ return FALSE;
+
+ if (GST_IS_BIN(vsink))
+ xover = GST_X_OVERLAY(gst_bin_get_by_interface(
+ GST_BIN(vsink), GST_TYPE_X_OVERLAY));
+ else
+ xover = GST_X_OVERLAY(vsink);
+ gst_x_overlay_expose(xover);
+ // This function is initiated by g_idle_add. Must return false
+ // so that it is not called again
+ return FALSE;
}
#endif
G_MODULE_EXPORT gboolean
preview_expose_cb(
- GtkWidget *widget,
- GdkEventExpose *event,
- signal_user_data_t *ud)
+ GtkWidget *widget,
+ GdkEventExpose *event,
+ signal_user_data_t *ud)
{
#if defined(_ENABLE_GST)
- if (ud->preview->live_enabled && ud->preview->state == PREVIEW_STATE_LIVE)
- {
- if (GST_STATE(ud->preview->play) >= GST_STATE_PAUSED)
- {
- GstElement *vsink;
- GstXOverlay *xover;
-
- g_object_get(ud->preview->play, "video-sink", &vsink, NULL);
- if (GST_IS_BIN(vsink))
- xover = GST_X_OVERLAY(gst_bin_get_by_interface(
- GST_BIN(vsink), GST_TYPE_X_OVERLAY));
- else
- xover = GST_X_OVERLAY(vsink);
- gst_x_overlay_expose(xover);
- // For some reason, the exposed region doesn't always get
- // cleaned up here. But a delayed gst_x_overlay_expose()
- // takes care of it.
- g_idle_add((GSourceFunc)delayed_expose_cb, ud);
- return FALSE;
- }
- return TRUE;
- }
+ if (ud->preview->live_enabled && ud->preview->state == PREVIEW_STATE_LIVE)
+ {
+ if (GST_STATE(ud->preview->play) >= GST_STATE_PAUSED)
+ {
+ GstElement *vsink;
+ GstXOverlay *xover;
+
+ g_object_get(ud->preview->play, "video-sink", &vsink, NULL);
+ if (GST_IS_BIN(vsink))
+ xover = GST_X_OVERLAY(gst_bin_get_by_interface(
+ GST_BIN(vsink), GST_TYPE_X_OVERLAY));
+ else
+ xover = GST_X_OVERLAY(vsink);
+ gst_x_overlay_expose(xover);
+ // For some reason, the exposed region doesn't always get
+ // cleaned up here. But a delayed gst_x_overlay_expose()
+ // takes care of it.
+ g_idle_add((GSourceFunc)delayed_expose_cb, ud);
+ return FALSE;
+ }
+ return TRUE;
+ }
#endif
- if (ud->preview->pix != NULL)
- {
+ if (ud->preview->pix != NULL)
+ {
_draw_pixbuf(gtk_widget_get_window(widget), ud->preview->pix);
- }
- return TRUE;
+ }
+ return TRUE;
}
G_MODULE_EXPORT void
preview_button_size_allocate_cb(GtkWidget *widget, GtkAllocation *allocation, signal_user_data_t *ud)
{
- g_debug("allocate %d x %d", allocation->width, allocation->height);
- if (ud->preview->button_width == allocation->width &&
- ud->preview->button_height == allocation->height)
- {
- // Nothing to do. Bug out.
- g_debug("nothing to do");
- return;
- }
- g_debug("prev allocate %d x %d", ud->preview->button_width,
- ud->preview->button_height);
- ud->preview->button_width = allocation->width;
- ud->preview->button_height = allocation->height;
- ghb_set_preview_image(ud);
+ g_debug("allocate %d x %d", allocation->width, allocation->height);
+ if (ud->preview->button_width == allocation->width &&
+ ud->preview->button_height == allocation->height)
+ {
+ // Nothing to do. Bug out.
+ g_debug("nothing to do");
+ return;
+ }
+ g_debug("prev allocate %d x %d", ud->preview->button_width,
+ ud->preview->button_height);
+ ud->preview->button_width = allocation->width;
+ ud->preview->button_height = allocation->height;
+ ghb_set_preview_image(ud);
}
static void
set_visible(GtkWidget *widget, gboolean visible)
{
- if (visible)
- {
- gtk_widget_show_now(widget);
- }
- else
- {
- gtk_widget_hide(widget);
- }
+ if (visible)
+ {
+ gtk_widget_show_now(widget);
+ }
+ else
+ {
+ gtk_widget_hide(widget);
+ }
}
void
ghb_preview_set_visible(signal_user_data_t *ud)
{
- gint titleindex;
- GtkWidget *widget;
- gboolean settings_active;
-
- settings_active = ghb_settings_get_boolean(ud->settings, "show_picture");
- widget = GHB_WIDGET (ud->builder, "preview_window");
- titleindex = ghb_settings_combo_int(ud->settings, "title");
- if (settings_active && titleindex >= 0)
- {
- gint x, y;
- x = ghb_settings_get_int(ud->settings, "preview_x");
- y = ghb_settings_get_int(ud->settings, "preview_y");
- if (x >= 0 && y >= 0)
- gtk_window_move(GTK_WINDOW(widget), x, y);
- set_visible(widget,
- ghb_settings_get_boolean(ud->settings, "show_preview"));
- }
- else
- {
- set_visible(widget, FALSE);
- }
+ gint titleindex;
+ GtkWidget *widget;
+ gboolean settings_active;
+
+ settings_active = ghb_settings_get_boolean(ud->settings, "show_picture");
+ widget = GHB_WIDGET (ud->builder, "preview_window");
+ titleindex = ghb_settings_combo_int(ud->settings, "title");
+ if (settings_active && titleindex >= 0)
+ {
+ gint x, y;
+ x = ghb_settings_get_int(ud->settings, "preview_x");
+ y = ghb_settings_get_int(ud->settings, "preview_y");
+ if (x >= 0 && y >= 0)
+ gtk_window_move(GTK_WINDOW(widget), x, y);
+ set_visible(widget,
+ ghb_settings_get_boolean(ud->settings, "show_preview"));
+ }
+ else
+ {
+ set_visible(widget, FALSE);
+ }
}
G_MODULE_EXPORT void
preview_button_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud)
{
- g_debug("preview_button_clicked_cb()");
- ghb_widget_to_setting (ud->settings, xwidget);
- ghb_preview_set_visible(ud);
- ghb_check_dependency(ud, xwidget, NULL);
- const gchar *name = ghb_get_setting_key(xwidget);
- ghb_pref_save(ud->settings, name);
+ g_debug("preview_button_clicked_cb()");
+ ghb_widget_to_setting (ud->settings, xwidget);
+ ghb_preview_set_visible(ud);
+ ghb_check_dependency(ud, xwidget, NULL);
+ const gchar *name = ghb_get_setting_key(xwidget);
+ ghb_pref_save(ud->settings, name);
}
G_MODULE_EXPORT void
picture_settings_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud)
{
- GtkWidget *widget;
- gboolean active, hide_settings;
- gint x, y;
-
- g_debug("picture_settings_clicked_cb()");
- ghb_widget_to_setting (ud->settings, xwidget);
-
- hide_settings = ghb_settings_get_boolean(ud->settings, "hide_settings");
-
- active = ghb_settings_get_boolean(ud->settings, "show_picture");
- widget = GHB_WIDGET (ud->builder, "settings_window");
- x = ghb_settings_get_int(ud->settings, "settings_x");
- y = ghb_settings_get_int(ud->settings, "settings_y");
- if (x >= 0 && y >= 0)
- gtk_window_move(GTK_WINDOW(widget), x, y);
- set_visible(widget, active && !hide_settings);
- ghb_preview_set_visible(ud);
+ GtkWidget *widget;
+ gboolean active, hide_settings;
+ gint x, y;
+
+ g_debug("picture_settings_clicked_cb()");
+ ghb_widget_to_setting (ud->settings, xwidget);
+
+ hide_settings = ghb_settings_get_boolean(ud->settings, "hide_settings");
+
+ active = ghb_settings_get_boolean(ud->settings, "show_picture");
+ widget = GHB_WIDGET (ud->builder, "settings_window");
+ x = ghb_settings_get_int(ud->settings, "settings_x");
+ y = ghb_settings_get_int(ud->settings, "settings_y");
+ if (x >= 0 && y >= 0)
+ gtk_window_move(GTK_WINDOW(widget), x, y);
+ set_visible(widget, active && !hide_settings);
+ ghb_preview_set_visible(ud);
}
G_MODULE_EXPORT void
picture_settings_alt_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud)
{
- GtkWidget *toggle;
- gboolean active;
+ GtkWidget *toggle;
+ gboolean active;
- g_debug("picture_settings_alt_clicked_cb()");
- toggle = GHB_WIDGET (ud->builder, "show_picture");
- active = gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(toggle));
- gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(toggle), !active);
+ g_debug("picture_settings_alt_clicked_cb()");
+ toggle = GHB_WIDGET (ud->builder, "show_picture");
+ active = gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(toggle));
+ gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(toggle), !active);
}
static gboolean
go_full(signal_user_data_t *ud)
{
- GtkWindow *window;
- window = GTK_WINDOW(GHB_WIDGET (ud->builder, "preview_window"));
- gtk_window_fullscreen(window);
- ghb_set_preview_image(ud);
- return FALSE;
+ GtkWindow *window;
+ window = GTK_WINDOW(GHB_WIDGET (ud->builder, "preview_window"));
+ gtk_window_fullscreen(window);
+ ghb_set_preview_image(ud);
+ return FALSE;
}
G_MODULE_EXPORT void
fullscreen_clicked_cb(GtkWidget *toggle, signal_user_data_t *ud)
{
- gboolean active;
- GtkWindow *window;
-
- g_debug("fullscreen_clicked_cb()");
- ghb_widget_to_setting (ud->settings, toggle);
- ghb_check_dependency(ud, toggle, NULL);
- const gchar *name = ghb_get_setting_key(toggle);
- ghb_pref_save(ud->settings, name);
-
- window = GTK_WINDOW(GHB_WIDGET (ud->builder, "preview_window"));
- active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toggle));
- if (active)
- {
- gtk_window_set_resizable(window, TRUE);
- gtk_button_set_label(GTK_BUTTON(toggle), "Windowed");
- // Changing resizable property doesn't take effect immediately
- // need to delay fullscreen till after this callback returns
- // to mainloop
- g_idle_add((GSourceFunc)go_full, ud);
- }
- else
- {
- gtk_window_unfullscreen(window);
- gtk_window_set_resizable(window, FALSE);
- gtk_button_set_label(GTK_BUTTON(toggle), "Fullscreen");
- ghb_set_preview_image(ud);
- }
+ gboolean active;
+ GtkWindow *window;
+
+ g_debug("fullscreen_clicked_cb()");
+ ghb_widget_to_setting (ud->settings, toggle);
+ ghb_check_dependency(ud, toggle, NULL);
+ const gchar *name = ghb_get_setting_key(toggle);
+ ghb_pref_save(ud->settings, name);
+
+ window = GTK_WINDOW(GHB_WIDGET (ud->builder, "preview_window"));
+ active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toggle));
+ if (active)
+ {
+ gtk_window_set_resizable(window, TRUE);
+ gtk_button_set_label(GTK_BUTTON(toggle), "Windowed");
+ // Changing resizable property doesn't take effect immediately
+ // need to delay fullscreen till after this callback returns
+ // to mainloop
+ g_idle_add((GSourceFunc)go_full, ud);
+ }
+ else
+ {
+ gtk_window_unfullscreen(window);
+ gtk_window_set_resizable(window, FALSE);
+ gtk_button_set_label(GTK_BUTTON(toggle), "Fullscreen");
+ ghb_set_preview_image(ud);
+ }
}
G_MODULE_EXPORT void
picture_settings_alt2_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud)
{
- GtkWidget *toggle;
- gboolean active;
- GtkWidget *window;
-
- g_debug("picture_settings_alt2_clicked_cb()");
- ghb_widget_to_setting (ud->settings, xwidget);
- active = ghb_settings_get_boolean(ud->settings, "hide_settings");
-
- toggle = GHB_WIDGET (ud->builder, "hide_settings");
- window = GHB_WIDGET(ud->builder, "settings_window");
- if (!active)
- {
- gtk_button_set_label(GTK_BUTTON(toggle), "Hide Settings");
- gtk_widget_set_tooltip_text(toggle,
- "Hide the picture settings window while "
- "leaving the preview visible.");
- gtk_widget_show(window);
- }
- else
- {
- gtk_button_set_label(GTK_BUTTON(toggle), "Show Settings");
- gtk_widget_set_tooltip_text(toggle, "Show picture settings.");
- gtk_widget_hide(window);
- }
+ GtkWidget *toggle;
+ gboolean active;
+ GtkWidget *window;
+
+ g_debug("picture_settings_alt2_clicked_cb()");
+ ghb_widget_to_setting (ud->settings, xwidget);
+ active = ghb_settings_get_boolean(ud->settings, "hide_settings");
+
+ toggle = GHB_WIDGET (ud->builder, "hide_settings");
+ window = GHB_WIDGET(ud->builder, "settings_window");
+ if (!active)
+ {
+ gtk_button_set_label(GTK_BUTTON(toggle), "Hide Settings");
+ gtk_widget_set_tooltip_text(toggle,
+ "Hide the picture settings window while "
+ "leaving the preview visible.");
+ gtk_widget_show(window);
+ }
+ else
+ {
+ gtk_button_set_label(GTK_BUTTON(toggle), "Show Settings");
+ gtk_widget_set_tooltip_text(toggle, "Show picture settings.");
+ gtk_widget_hide(window);
+ }
}
G_MODULE_EXPORT void
preview_frame_value_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
{
- if (ud->preview->live_id >= 0)
- {
- ghb_stop_live_encode();
- ud->preview->live_id = -1;
- ud->preview->encode_frame = -1;
- }
- ghb_set_preview_image(ud);
+ if (ud->preview->live_id >= 0)
+ {
+ ghb_stop_live_encode();
+ ud->preview->live_id = -1;
+ ud->preview->encode_frame = -1;
+ }
+ ghb_set_preview_image(ud);
}
G_MODULE_EXPORT gboolean
preview_window_delete_cb(
- GtkWidget *widget,
- GdkEvent *event,
- signal_user_data_t *ud)
+ GtkWidget *widget,
+ GdkEvent *event,
+ signal_user_data_t *ud)
{
- live_preview_stop(ud);
- widget = GHB_WIDGET (ud->builder, "show_picture");
- gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(widget), FALSE);
- return TRUE;
+ live_preview_stop(ud);
+ widget = GHB_WIDGET (ud->builder, "show_picture");
+ gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(widget), FALSE);
+ return TRUE;
}
G_MODULE_EXPORT gboolean
settings_window_delete_cb(
- GtkWidget *widget,
- GdkEvent *event,
- signal_user_data_t *ud)
+ GtkWidget *widget,
+ GdkEvent *event,
+ signal_user_data_t *ud)
{
- live_preview_stop(ud);
- widget = GHB_WIDGET (ud->builder, "show_picture");
- gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(widget), FALSE);
+ live_preview_stop(ud);
+ widget = GHB_WIDGET (ud->builder, "show_picture");
+ gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(widget), FALSE);
- return TRUE;
+ return TRUE;
}
G_MODULE_EXPORT void
preview_duration_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
{
- g_debug("preview_duration_changed_cb ()");
- ghb_live_reset(ud);
- ghb_widget_to_setting (ud->settings, widget);
- ghb_check_dependency(ud, widget, NULL);
- const gchar *name = ghb_get_setting_key(widget);
- ghb_pref_save(ud->settings, name);
+ g_debug("preview_duration_changed_cb ()");
+ ghb_live_reset(ud);
+ ghb_widget_to_setting (ud->settings, widget);
+ ghb_check_dependency(ud, widget, NULL);
+ const gchar *name = ghb_get_setting_key(widget);
+ ghb_pref_save(ud->settings, name);
}
static guint hud_timeout_id = 0;
@@ -1087,192 +1087,192 @@ static guint hud_timeout_id = 0;
static gboolean
hud_timeout(signal_user_data_t *ud)
{
- GtkWidget *widget;
+ GtkWidget *widget;
- g_debug("hud_timeout()");
- widget = GHB_WIDGET(ud->builder, "preview_hud");
- gtk_widget_hide(widget);
- hud_timeout_id = 0;
- return FALSE;
+ g_debug("hud_timeout()");
+ widget = GHB_WIDGET(ud->builder, "preview_hud");
+ gtk_widget_hide(widget);
+ hud_timeout_id = 0;
+ return FALSE;
}
G_MODULE_EXPORT gboolean
hud_enter_cb(
- GtkWidget *widget,
- GdkEventCrossing *event,
- signal_user_data_t *ud)
+ GtkWidget *widget,
+ GdkEventCrossing *event,
+ signal_user_data_t *ud)
{
- g_debug("hud_enter_cb()");
- if (hud_timeout_id != 0)
- {
- GMainContext *mc;
- GSource *source;
-
- mc = g_main_context_default();
- source = g_main_context_find_source_by_id(mc, hud_timeout_id);
- if (source != NULL)
- g_source_destroy(source);
- }
- widget = GHB_WIDGET(ud->builder, "preview_hud");
- gtk_widget_show(widget);
- hud_timeout_id = 0;
- return FALSE;
+ g_debug("hud_enter_cb()");
+ if (hud_timeout_id != 0)
+ {
+ GMainContext *mc;
+ GSource *source;
+
+ mc = g_main_context_default();
+ source = g_main_context_find_source_by_id(mc, hud_timeout_id);
+ if (source != NULL)
+ g_source_destroy(source);
+ }
+ widget = GHB_WIDGET(ud->builder, "preview_hud");
+ gtk_widget_show(widget);
+ hud_timeout_id = 0;
+ return FALSE;
}
G_MODULE_EXPORT gboolean
preview_leave_cb(
- GtkWidget *widget,
- GdkEventCrossing *event,
- signal_user_data_t *ud)
+ GtkWidget *widget,
+ GdkEventCrossing *event,
+ signal_user_data_t *ud)
{
- g_debug("hud_leave_cb()");
- if (hud_timeout_id != 0)
- {
- GMainContext *mc;
- GSource *source;
-
- mc = g_main_context_default();
- source = g_main_context_find_source_by_id(mc, hud_timeout_id);
- if (source != NULL)
- g_source_destroy(source);
- }
- hud_timeout_id = g_timeout_add(300, (GSourceFunc)hud_timeout, ud);
- return FALSE;
+ g_debug("hud_leave_cb()");
+ if (hud_timeout_id != 0)
+ {
+ GMainContext *mc;
+ GSource *source;
+
+ mc = g_main_context_default();
+ source = g_main_context_find_source_by_id(mc, hud_timeout_id);
+ if (source != NULL)
+ g_source_destroy(source);
+ }
+ hud_timeout_id = g_timeout_add(300, (GSourceFunc)hud_timeout, ud);
+ return FALSE;
}
G_MODULE_EXPORT gboolean
preview_motion_cb(
- GtkWidget *widget,
- GdkEventMotion *event,
- signal_user_data_t *ud)
+ GtkWidget *widget,
+ GdkEventMotion *event,
+ signal_user_data_t *ud)
{
- //g_debug("hud_motion_cb %d", hud_timeout_id);
- if (hud_timeout_id != 0)
- {
- GMainContext *mc;
- GSource *source;
-
- mc = g_main_context_default();
- source = g_main_context_find_source_by_id(mc, hud_timeout_id);
- if (source != NULL)
- g_source_destroy(source);
- }
- widget = GHB_WIDGET(ud->builder, "preview_hud");
- if (!gtk_widget_get_visible(widget))
- {
- gtk_widget_show(widget);
- }
- hud_timeout_id = g_timeout_add_seconds(4, (GSourceFunc)hud_timeout, ud);
- return FALSE;
+ //g_debug("hud_motion_cb %d", hud_timeout_id);
+ if (hud_timeout_id != 0)
+ {
+ GMainContext *mc;
+ GSource *source;
+
+ mc = g_main_context_default();
+ source = g_main_context_find_source_by_id(mc, hud_timeout_id);
+ if (source != NULL)
+ g_source_destroy(source);
+ }
+ widget = GHB_WIDGET(ud->builder, "preview_hud");
+ if (!gtk_widget_get_visible(widget))
+ {
+ gtk_widget_show(widget);
+ }
+ hud_timeout_id = g_timeout_add_seconds(4, (GSourceFunc)hud_timeout, ud);
+ return FALSE;
}
GdkDrawable*
ghb_curved_rect_mask(gint width, gint height, gint radius)
{
- GdkDrawable *shape;
- cairo_t *cr;
- double w, h;
+ GdkDrawable *shape;
+ cairo_t *cr;
+ double w, h;
- if (!width || !height)
- return NULL;
+ if (!width || !height)
+ return NULL;
- shape = (GdkDrawable *)gdk_pixmap_new (NULL, width, height, 1);
+ shape = (GdkDrawable *)gdk_pixmap_new (NULL, width, height, 1);
- cr = gdk_cairo_create (shape);
+ cr = gdk_cairo_create (shape);
- w = width;
- h = height;
- if (radius > width / 2)
- radius = width / 2;
- if (radius > height / 2)
- radius = height / 2;
+ w = width;
+ h = height;
+ if (radius > width / 2)
+ radius = width / 2;
+ if (radius > height / 2)
+ radius = height / 2;
- // fill shape with black
- cairo_save(cr);
- cairo_rectangle (cr, 0, 0, width, height);
- cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR);
- cairo_fill (cr);
- cairo_restore (cr);
+ // fill shape with black
+ cairo_save(cr);
+ cairo_rectangle (cr, 0, 0, width, height);
+ cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR);
+ cairo_fill (cr);
+ cairo_restore (cr);
- cairo_move_to (cr, 0, radius);
- cairo_curve_to (cr, 0 , 0, 0 , 0, radius, 0);
- cairo_line_to (cr, w - radius, 0);
- cairo_curve_to (cr, w, 0, w, 0, w, radius);
- cairo_line_to (cr, w , h - radius);
- cairo_curve_to (cr, w, h, w, h, w - radius, h);
- cairo_line_to (cr, 0 + radius, h);
- cairo_curve_to (cr, 0, h, 0, h, 0, h - radius);
+ cairo_move_to (cr, 0, radius);
+ cairo_curve_to (cr, 0 , 0, 0 , 0, radius, 0);
+ cairo_line_to (cr, w - radius, 0);
+ cairo_curve_to (cr, w, 0, w, 0, w, radius);
+ cairo_line_to (cr, w , h - radius);
+ cairo_curve_to (cr, w, h, w, h, w - radius, h);
+ cairo_line_to (cr, 0 + radius, h);
+ cairo_curve_to (cr, 0, h, 0, h, 0, h - radius);
- cairo_close_path(cr);
+ cairo_close_path(cr);
- cairo_set_source_rgb(cr, 1, 1, 1);
- cairo_fill(cr);
+ cairo_set_source_rgb(cr, 1, 1, 1);
+ cairo_fill(cr);
- cairo_destroy(cr);
+ cairo_destroy(cr);
- return shape;
+ return shape;
}
G_MODULE_EXPORT void
preview_hud_size_alloc_cb(
- GtkWidget *widget,
- GtkAllocation *allocation,
- signal_user_data_t *ud)
+ GtkWidget *widget,
+ GtkAllocation *allocation,
+ signal_user_data_t *ud)
{
- GdkDrawable *shape;
-
- //g_message("preview_hud_size_alloc_cb()");
- if (gtk_widget_get_visible(widget) && allocation->height > 50)
- {
- shape = ghb_curved_rect_mask(allocation->width,
- allocation->height, allocation->height/4);
- if (shape != NULL)
- {
- gtk_widget_shape_combine_mask(widget, shape, 0, 0);
- gdk_pixmap_unref(shape);
- }
- }
+ GdkDrawable *shape;
+
+ //g_message("preview_hud_size_alloc_cb()");
+ if (gtk_widget_get_visible(widget) && allocation->height > 50)
+ {
+ shape = ghb_curved_rect_mask(allocation->width,
+ allocation->height, allocation->height/4);
+ if (shape != NULL)
+ {
+ gtk_widget_shape_combine_mask(widget, shape, 0, 0);
+ gdk_pixmap_unref(shape);
+ }
+ }
}
G_MODULE_EXPORT gboolean
preview_configure_cb(
- GtkWidget *widget,
- GdkEventConfigure *event,
- signal_user_data_t *ud)
+ GtkWidget *widget,
+ GdkEventConfigure *event,
+ signal_user_data_t *ud)
{
- gint x, y;
-
- //g_message("preview_configure_cb()");
- if (gtk_widget_get_visible(widget))
- {
- gtk_window_get_position(GTK_WINDOW(widget), &x, &y);
- ghb_settings_set_int(ud->settings, "preview_x", x);
- ghb_settings_set_int(ud->settings, "preview_y", y);
- ghb_pref_set(ud->settings, "preview_x");
- ghb_pref_set(ud->settings, "preview_y");
- ghb_prefs_store();
- }
- return FALSE;
+ gint x, y;
+
+ //g_message("preview_configure_cb()");
+ if (gtk_widget_get_visible(widget))
+ {
+ gtk_window_get_position(GTK_WINDOW(widget), &x, &y);
+ ghb_settings_set_int(ud->settings, "preview_x", x);
+ ghb_settings_set_int(ud->settings, "preview_y", y);
+ ghb_pref_set(ud->settings, "preview_x");
+ ghb_pref_set(ud->settings, "preview_y");
+ ghb_prefs_store();
+ }
+ return FALSE;
}
G_MODULE_EXPORT gboolean
settings_configure_cb(
- GtkWidget *widget,
- GdkEventConfigure *event,
- signal_user_data_t *ud)
+ GtkWidget *widget,
+ GdkEventConfigure *event,
+ signal_user_data_t *ud)
{
- gint x, y;
-
- //g_message("settings_configure_cb()");
- if (gtk_widget_get_visible(widget))
- {
- gtk_window_get_position(GTK_WINDOW(widget), &x, &y);
- ghb_settings_set_int(ud->settings, "settings_x", x);
- ghb_settings_set_int(ud->settings, "settings_y", y);
- ghb_pref_set(ud->settings, "settings_x");
- ghb_pref_set(ud->settings, "settings_y");
- ghb_prefs_store();
- }
- return FALSE;
+ gint x, y;
+
+ //g_message("settings_configure_cb()");
+ if (gtk_widget_get_visible(widget))
+ {
+ gtk_window_get_position(GTK_WINDOW(widget), &x, &y);
+ ghb_settings_set_int(ud->settings, "settings_x", x);
+ ghb_settings_set_int(ud->settings, "settings_y", y);
+ ghb_pref_set(ud->settings, "settings_x");
+ ghb_pref_set(ud->settings, "settings_y");
+ ghb_prefs_store();
+ }
+ return FALSE;
}
diff --git a/gtk/src/queuehandler.c b/gtk/src/queuehandler.c
index 297757d4b..1c0c430bd 100644
--- a/gtk/src/queuehandler.c
+++ b/gtk/src/queuehandler.c
@@ -26,779 +26,779 @@
G_MODULE_EXPORT void
queue_list_selection_changed_cb(GtkTreeSelection *selection, signal_user_data_t *ud)
{
- GtkTreeModel *store;
- GtkTreeIter iter, piter;
-
- g_debug("queue_list_selection_changed_cb ()");
- // A queue entry is made up of a parent and multiple
- // children that are visible when expanded. When and entry
- // is selected, I want the parent to be selected.
- // This is purely cosmetic.
- if (gtk_tree_selection_get_selected(selection, &store, &iter))
- {
- GtkWidget *widget = GHB_WIDGET (ud->builder, "queue_edit");
- gtk_widget_set_sensitive (widget, TRUE);
- if (gtk_tree_model_iter_parent (store, &piter, &iter))
- {
- GtkTreePath *path;
- GtkTreeView *treeview;
-
- gtk_tree_selection_select_iter (selection, &piter);
- path = gtk_tree_model_get_path (store, &piter);
- treeview = gtk_tree_selection_get_tree_view (selection);
- // Make the parent visible in scroll window if it is not.
- gtk_tree_view_scroll_to_cell (treeview, path, NULL, FALSE, 0, 0);
- gtk_tree_path_free(path);
- }
- }
- else
- {
- GtkWidget *widget = GHB_WIDGET (ud->builder, "queue_edit");
- gtk_widget_set_sensitive (widget, FALSE);
- }
+ GtkTreeModel *store;
+ GtkTreeIter iter, piter;
+
+ g_debug("queue_list_selection_changed_cb ()");
+ // A queue entry is made up of a parent and multiple
+ // children that are visible when expanded. When and entry
+ // is selected, I want the parent to be selected.
+ // This is purely cosmetic.
+ if (gtk_tree_selection_get_selected(selection, &store, &iter))
+ {
+ GtkWidget *widget = GHB_WIDGET (ud->builder, "queue_edit");
+ gtk_widget_set_sensitive (widget, TRUE);
+ if (gtk_tree_model_iter_parent (store, &piter, &iter))
+ {
+ GtkTreePath *path;
+ GtkTreeView *treeview;
+
+ gtk_tree_selection_select_iter (selection, &piter);
+ path = gtk_tree_model_get_path (store, &piter);
+ treeview = gtk_tree_selection_get_tree_view (selection);
+ // Make the parent visible in scroll window if it is not.
+ gtk_tree_view_scroll_to_cell (treeview, path, NULL, FALSE, 0, 0);
+ gtk_tree_path_free(path);
+ }
+ }
+ else
+ {
+ GtkWidget *widget = GHB_WIDGET (ud->builder, "queue_edit");
+ gtk_widget_set_sensitive (widget, FALSE);
+ }
}
static void
add_to_queue_list(signal_user_data_t *ud, GValue *settings, GtkTreeIter *piter)
{
- GtkTreeView *treeview;
- GtkTreeIter iter;
- GtkTreeStore *store;
- gchar *info;
- gint status;
- GtkTreeIter citer;
- gchar *dest, *preset, *vol_name, *basename;
- const gchar *vcodec, *container;
- gchar *fps, *vcodec_abbr;
- gint title, start_point, end_point, width, height;
- gint source_width, source_height;
- gboolean pass2 = FALSE, keep_aspect, vqtype, turbo;
- gint pic_par;
- gchar *escape, *escape2;
-
- g_debug("update_queue_list ()");
- if (settings == NULL) return;
- treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "queue_list"));
- store = GTK_TREE_STORE(gtk_tree_view_get_model(treeview));
-
- title = ghb_settings_get_int(settings, "titlenum");
- start_point = ghb_settings_get_int(settings, "start_point");
- end_point = ghb_settings_get_int(settings, "end_point");
- vol_name = ghb_settings_get_string(settings, "volume_label");
- dest = ghb_settings_get_string(settings, "destination");
- basename = g_path_get_basename(dest);
- escape = g_markup_escape_text(basename, -1);
- escape2 = g_markup_escape_text(vol_name, -1);
-
- vqtype = ghb_settings_get_boolean(settings, "vquality_type_constant");
- if (!vqtype)
- pass2 = ghb_settings_get_boolean(settings, "VideoTwoPass");
- const gchar *points = "Chapters";
- if (ghb_settings_combo_int(settings, "PtoPType") == 0)
- points = "Chapters";
- else if (ghb_settings_combo_int(settings, "PtoPType") == 1)
- points = "Seconds";
- else if (ghb_settings_combo_int(settings, "PtoPType") == 2)
- points = "Frames";
- info = g_strdup_printf
- (
- "<big><b>%s</b></big> "
- "<small>(Title %d, %s %d through %d, %d Video %s)"
- " --> %s</small>",
- escape2, title, points, start_point, end_point,
- pass2 ? 2:1, pass2 ? "Passes":"Pass", escape
- );
- g_free(basename);
- g_free(escape);
- g_free(escape2);
-
- if (piter)
- iter = *piter;
- else
- gtk_tree_store_append(store, &iter, NULL);
-
- gtk_tree_store_set(store, &iter, 1, info, 2, "hb-queue-delete", -1);
- g_free(info);
- status = ghb_settings_get_int(settings, "job_status");
- switch (status)
- {
- case GHB_QUEUE_PENDING:
- gtk_tree_store_set(store, &iter, 0, "hb-queue-job", -1);
- break;
- case GHB_QUEUE_CANCELED:
- gtk_tree_store_set(store, &iter, 0, "hb-canceled", -1);
- break;
- case GHB_QUEUE_RUNNING:
- gtk_tree_store_set(store, &iter, 0, "hb-working0", -1);
- break;
- case GHB_QUEUE_DONE:
- gtk_tree_store_set(store, &iter, 0, "hb-complete", -1);
- break;
- default:
- gtk_tree_store_set(store, &iter, 0, "hb-queue-job", -1);
- break;
- }
-
- GString *str = g_string_new("");
- gboolean markers;
- gboolean preset_modified;
- gint mux;
- const GValue *path;
-
- container = ghb_settings_combo_option(settings, "FileFormat");
- mux = ghb_settings_combo_int(settings, "FileFormat");
- preset_modified = ghb_settings_get_boolean(settings, "preset_modified");
- path = ghb_settings_get_value(settings, "preset");
- preset = ghb_preset_path_string(path);
- markers = ghb_settings_get_boolean(settings, "ChapterMarkers");
-
- if (preset_modified)
- g_string_append_printf(str,
- "<b>Modified Preset Based On:</b> <small>%s</small>\n",
- preset);
- else
- g_string_append_printf(str,
- "<b>Preset:</b> <small>%s</small>\n",
- preset);
-
- if (markers)
- {
- g_string_append_printf(str,
- "<b>Format:</b> <small>%s Container, Chapter Markers</small>\n",
- container);
- }
- else
- {
- g_string_append_printf(str,
- "<b>Format:</b> <small>%s Container</small>\n", container);
- }
- if (mux == HB_MUX_MP4)
- {
- gboolean ipod, http, large;
-
- ipod = ghb_settings_get_boolean(settings, "Mp4iPodCompatible");
- http = ghb_settings_get_boolean(settings, "Mp4HttpOptimize");
- large = ghb_settings_get_boolean(settings, "Mp4LargeFile");
- if (http || ipod || large)
- {
- g_string_append_printf(str, "<b>MP4 Options:</b><small>");
- if (ipod)
- g_string_append_printf(str, " - iPod 5G Support");
- if (http)
- g_string_append_printf(str, " - Web Optimized");
- if (large)
- g_string_append_printf(str, " - Large File Size (>4GB)");
- g_string_append_printf(str, "</small>\n");
- }
- }
- escape = g_markup_escape_text(dest, -1);
- g_string_append_printf(str,
- "<b>Destination:</b> <small>%s</small>\n", escape);
-
- width = ghb_settings_get_int(settings, "scale_width");
- height = ghb_settings_get_int(settings, "scale_height");
- pic_par = ghb_settings_combo_int(settings, "PicturePAR");
- keep_aspect = ghb_settings_get_boolean(settings, "PictureKeepRatio");
-
- gchar *aspect_desc;
- switch (pic_par)
- {
- case 0:
- {
- if (keep_aspect)
- {
- aspect_desc = "(Aspect Preserved)";
- }
- else
- {
- aspect_desc = "(Aspect Lost)";
- }
- } break;
-
- case 1:
- {
- aspect_desc = "(Strict Anamorphic)";
- } break;
-
- case 2:
- {
- aspect_desc = "(Loose Anamorphic)";
- } break;
-
- case 3:
- {
- aspect_desc = "(Custom Anamorphic)";
- } break;
-
- default:
- {
- aspect_desc = "(Unknown)";
- } break;
- }
- vqtype = ghb_settings_get_boolean(settings, "vquality_type_constant");
- vcodec = ghb_settings_combo_option(settings, "VideoEncoder");
- vcodec_abbr = ghb_settings_get_string(settings, "VideoEncoder");
-
- gchar *vq_desc = "Error";
- gchar *vq_units = "";
- gchar *vqstr;
- gdouble vqvalue;
- if (!vqtype)
- {
+ GtkTreeView *treeview;
+ GtkTreeIter iter;
+ GtkTreeStore *store;
+ gchar *info;
+ gint status;
+ GtkTreeIter citer;
+ gchar *dest, *preset, *vol_name, *basename;
+ const gchar *vcodec, *container;
+ gchar *fps, *vcodec_abbr;
+ gint title, start_point, end_point, width, height;
+ gint source_width, source_height;
+ gboolean pass2 = FALSE, keep_aspect, vqtype, turbo;
+ gint pic_par;
+ gchar *escape, *escape2;
+
+ g_debug("update_queue_list ()");
+ if (settings == NULL) return;
+ treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "queue_list"));
+ store = GTK_TREE_STORE(gtk_tree_view_get_model(treeview));
+
+ title = ghb_settings_get_int(settings, "titlenum");
+ start_point = ghb_settings_get_int(settings, "start_point");
+ end_point = ghb_settings_get_int(settings, "end_point");
+ vol_name = ghb_settings_get_string(settings, "volume_label");
+ dest = ghb_settings_get_string(settings, "destination");
+ basename = g_path_get_basename(dest);
+ escape = g_markup_escape_text(basename, -1);
+ escape2 = g_markup_escape_text(vol_name, -1);
+
+ vqtype = ghb_settings_get_boolean(settings, "vquality_type_constant");
+ if (!vqtype)
+ pass2 = ghb_settings_get_boolean(settings, "VideoTwoPass");
+ const gchar *points = "Chapters";
+ if (ghb_settings_combo_int(settings, "PtoPType") == 0)
+ points = "Chapters";
+ else if (ghb_settings_combo_int(settings, "PtoPType") == 1)
+ points = "Seconds";
+ else if (ghb_settings_combo_int(settings, "PtoPType") == 2)
+ points = "Frames";
+ info = g_strdup_printf
+ (
+ "<big><b>%s</b></big> "
+ "<small>(Title %d, %s %d through %d, %d Video %s)"
+ " --> %s</small>",
+ escape2, title, points, start_point, end_point,
+ pass2 ? 2:1, pass2 ? "Passes":"Pass", escape
+ );
+ g_free(basename);
+ g_free(escape);
+ g_free(escape2);
+
+ if (piter)
+ iter = *piter;
+ else
+ gtk_tree_store_append(store, &iter, NULL);
+
+ gtk_tree_store_set(store, &iter, 1, info, 2, "hb-queue-delete", -1);
+ g_free(info);
+ status = ghb_settings_get_int(settings, "job_status");
+ switch (status)
+ {
+ case GHB_QUEUE_PENDING:
+ gtk_tree_store_set(store, &iter, 0, "hb-queue-job", -1);
+ break;
+ case GHB_QUEUE_CANCELED:
+ gtk_tree_store_set(store, &iter, 0, "hb-canceled", -1);
+ break;
+ case GHB_QUEUE_RUNNING:
+ gtk_tree_store_set(store, &iter, 0, "hb-working0", -1);
+ break;
+ case GHB_QUEUE_DONE:
+ gtk_tree_store_set(store, &iter, 0, "hb-complete", -1);
+ break;
+ default:
+ gtk_tree_store_set(store, &iter, 0, "hb-queue-job", -1);
+ break;
+ }
+
+ GString *str = g_string_new("");
+ gboolean markers;
+ gboolean preset_modified;
+ gint mux;
+ const GValue *path;
+
+ container = ghb_settings_combo_option(settings, "FileFormat");
+ mux = ghb_settings_combo_int(settings, "FileFormat");
+ preset_modified = ghb_settings_get_boolean(settings, "preset_modified");
+ path = ghb_settings_get_value(settings, "preset");
+ preset = ghb_preset_path_string(path);
+ markers = ghb_settings_get_boolean(settings, "ChapterMarkers");
+
+ if (preset_modified)
+ g_string_append_printf(str,
+ "<b>Modified Preset Based On:</b> <small>%s</small>\n",
+ preset);
+ else
+ g_string_append_printf(str,
+ "<b>Preset:</b> <small>%s</small>\n",
+ preset);
+
+ if (markers)
+ {
+ g_string_append_printf(str,
+ "<b>Format:</b> <small>%s Container, Chapter Markers</small>\n",
+ container);
+ }
+ else
+ {
+ g_string_append_printf(str,
+ "<b>Format:</b> <small>%s Container</small>\n", container);
+ }
+ if (mux == HB_MUX_MP4)
+ {
+ gboolean ipod, http, large;
+
+ ipod = ghb_settings_get_boolean(settings, "Mp4iPodCompatible");
+ http = ghb_settings_get_boolean(settings, "Mp4HttpOptimize");
+ large = ghb_settings_get_boolean(settings, "Mp4LargeFile");
+ if (http || ipod || large)
+ {
+ g_string_append_printf(str, "<b>MP4 Options:</b><small>");
+ if (ipod)
+ g_string_append_printf(str, " - iPod 5G Support");
+ if (http)
+ g_string_append_printf(str, " - Web Optimized");
+ if (large)
+ g_string_append_printf(str, " - Large File Size (>4GB)");
+ g_string_append_printf(str, "</small>\n");
+ }
+ }
+ escape = g_markup_escape_text(dest, -1);
+ g_string_append_printf(str,
+ "<b>Destination:</b> <small>%s</small>\n", escape);
+
+ width = ghb_settings_get_int(settings, "scale_width");
+ height = ghb_settings_get_int(settings, "scale_height");
+ pic_par = ghb_settings_combo_int(settings, "PicturePAR");
+ keep_aspect = ghb_settings_get_boolean(settings, "PictureKeepRatio");
+
+ gchar *aspect_desc;
+ switch (pic_par)
+ {
+ case 0:
+ {
+ if (keep_aspect)
+ {
+ aspect_desc = "(Aspect Preserved)";
+ }
+ else
+ {
+ aspect_desc = "(Aspect Lost)";
+ }
+ } break;
+
+ case 1:
+ {
+ aspect_desc = "(Strict Anamorphic)";
+ } break;
+
+ case 2:
+ {
+ aspect_desc = "(Loose Anamorphic)";
+ } break;
+
+ case 3:
+ {
+ aspect_desc = "(Custom Anamorphic)";
+ } break;
+
+ default:
+ {
+ aspect_desc = "(Unknown)";
+ } break;
+ }
+ vqtype = ghb_settings_get_boolean(settings, "vquality_type_constant");
+ vcodec = ghb_settings_combo_option(settings, "VideoEncoder");
+ vcodec_abbr = ghb_settings_get_string(settings, "VideoEncoder");
+
+ gchar *vq_desc = "Error";
+ gchar *vq_units = "";
+ gchar *vqstr;
+ gdouble vqvalue;
+ if (!vqtype)
+ {
// Has to be bitrate
vqvalue = ghb_settings_get_int(settings, "VideoAvgBitrate");
vq_desc = "Bitrate:";
vq_units = "kbps";
- vqstr = g_strdup_printf("%d", (gint)vqvalue);
- }
- else
- {
- // Constant quality
- vqvalue = ghb_settings_get_double(settings, "VideoQualitySlider");
- vq_desc = "Constant Quality:";
- vqstr = g_strdup_printf("%d", (gint)vqvalue);
- if (strcmp(vcodec_abbr, "x264") == 0)
- {
- vq_units = "(RF)";
- }
- else
- {
- vq_units = "(QP)";
- }
- }
- fps = ghb_settings_get_string(settings, "VideoFramerate");
- if (strcmp("source", fps) == 0)
- {
- g_free(fps);
- if (ghb_settings_get_boolean(settings, "VideoFramerateCFR"))
- fps = g_strdup("Same As Source (constant)");
- else
- fps = g_strdup("Same As Source (variable)");
- }
- else
- {
- if (ghb_settings_get_boolean(settings, "VideoFrameratePFR"))
- {
- gchar *tmp;
- tmp = g_strdup_printf("Peak %s (may be lower)", fps);
- g_free(fps);
- fps = tmp;
- }
- else
- {
- gchar *tmp;
- tmp = g_strdup_printf("%s (constant frame rate)", fps);
- g_free(fps);
- fps = tmp;
- }
- }
- source_width = ghb_settings_get_int(settings, "source_width");
- source_height = ghb_settings_get_int(settings, "source_height");
- g_string_append_printf(str,
- "<b>Picture:</b> Source: <small>%d x %d, Output %d x %d %s</small>\n",
- source_width, source_height, width, height, aspect_desc);
-
- gint decomb, detel;
- gboolean decomb_deint;
- gboolean filters = FALSE;
-
- decomb_deint = ghb_settings_get_boolean(settings, "PictureDecombDeinterlace");
- decomb = ghb_settings_combo_int(settings, "PictureDecomb");
- g_string_append_printf(str, "<b>Filters:</b><small>");
- detel = ghb_settings_combo_int(settings, "PictureDetelecine");
- if (detel)
- {
- g_string_append_printf(str, " - Detelecine");
- if (detel == 1)
- {
- gchar *cust;
- cust = ghb_settings_get_string(settings, "PictureDetelecineCustom");
- g_string_append_printf(str, ": %s", cust);
- g_free(cust);
- }
- filters = TRUE;
- }
- if (decomb_deint && decomb)
- {
- g_string_append_printf(str, " - Decomb");
- if (decomb == 1)
- {
- gchar *cust;
- cust = ghb_settings_get_string(settings, "PictureDecombCustom");
- g_string_append_printf(str, ": %s", cust);
- g_free(cust);
- }
- filters = TRUE;
- }
- else if (!decomb_deint)
- {
- gint deint = ghb_settings_combo_int(settings, "PictureDeinterlace");
- if (deint)
- {
- if (deint == 1)
- {
- gchar *cust = ghb_settings_get_string(settings,
- "PictureDeinterlaceCustom");
- g_string_append_printf(str, " - Deinterlace: %s", cust);
- g_free(cust);
- }
- else
- {
- const gchar *opt = ghb_settings_combo_option(settings,
- "PictureDeinterlace");
- g_string_append_printf(str, " - Deinterlace: %s", opt);
- }
- filters = TRUE;
- }
- }
- gint denoise = ghb_settings_combo_int(settings, "PictureDenoise");
- if (denoise)
- {
- if (denoise == 1)
- {
- gchar *cust = ghb_settings_get_string(settings,
- "PictureDenoiseCustom");
- g_string_append_printf(str, " - Denoise: %s", cust);
- g_free(cust);
- }
- else
- {
- const gchar *opt = ghb_settings_combo_option(settings,
- "PictureDenoise");
- g_string_append_printf(str, " - Denoise: %s", opt);
- }
- filters = TRUE;
- }
- gint deblock = ghb_settings_get_int(settings, "PictureDeblock");
- if (deblock >= 5)
- {
- g_string_append_printf(str, " - Deblock (%d)", deblock);
- filters = TRUE;
- }
- if (ghb_settings_get_boolean(settings, "VideoGrayScale"))
- {
- g_string_append_printf(str, " - Grayscale");
- filters = TRUE;
- }
- if (!filters)
- g_string_append_printf(str, " None");
- g_string_append_printf(str, "</small>\n");
-
- g_string_append_printf(str,
- "<b>Video:</b> <small>%s, Framerate: %s, %s %s%s</small>\n",
- vcodec, fps, vq_desc, vqstr, vq_units);
-
- turbo = ghb_settings_get_boolean(settings, "VideoTurboTwoPass");
- if (turbo)
- {
- g_string_append_printf(str, "<b>Turbo:</b> <small>On</small>\n");
- }
- if (strcmp(vcodec_abbr, "x264") == 0 ||
- strcmp(vcodec_abbr, "ffmpeg") == 0)
- {
- gchar *opts = ghb_build_advanced_opts_string(settings);
- g_string_append_printf(str,
- "<b>Advanced Options:</b> <small>%s</small>\n", opts);
- g_free(opts);
- }
- // Add the audios
- gint count, ii;
- const GValue *audio_list;
-
- audio_list = ghb_settings_get_value(settings, "audio_list");
- count = ghb_array_len(audio_list);
- for (ii = 0; ii < count; ii++)
- {
- gchar *quality = NULL, *samplerate, *track;
- const gchar *acodec, *mix;
- GValue *asettings;
- gdouble sr;
-
- asettings = ghb_array_get_nth(audio_list, ii);
-
- acodec = ghb_settings_combo_option(asettings, "AudioEncoderActual");
- double q = ghb_settings_get_double(asettings, "AudioTrackQuality");
- if (ghb_settings_get_boolean(asettings, "AudioTrackQualityEnable") &&
- q != HB_INVALID_AUDIO_QUALITY)
- {
- int codec = ghb_settings_combo_int(asettings, "AudioEncoderActual");
- quality = ghb_format_quality("Quality: ", codec, q);
- }
- else
- {
- const char *br;
- br = ghb_settings_get_string(asettings, "AudioBitrate");
- quality = g_strdup_printf("Bitrate: %s", br);
- }
- sr = ghb_settings_get_double(asettings, "AudioSamplerate");
- samplerate = ghb_settings_get_string(asettings, "AudioSamplerate");
- if ((int)sr == 0)
- {
- samplerate = g_strdup("Same As Source");
- }
- else
- {
- samplerate = g_strdup_printf("%.4g", sr);
- }
- track = ghb_settings_get_string(asettings, "AudioTrackDescription");
- mix = ghb_settings_combo_option(asettings, "AudioMixdown");
- if (count == 1)
- g_string_append_printf(str, "<b>Audio:</b>");
- else if (ii == 0)
- g_string_append_printf(str, "<b>Audio:</b>\n");
- if (count != 1)
- g_string_append_printf(str, "\t");
-
- g_string_append_printf(str,
- "<small> %s, Encoder: %s, Mixdown: %s, SampleRate: %s, %s</small>\n",
- track, acodec, mix, samplerate, quality);
- g_free(track);
- g_free(quality);
- g_free(samplerate);
- }
-
- // Add the audios
- const GValue *sub_list;
-
- sub_list = ghb_settings_get_value(settings, "subtitle_list");
- count = ghb_array_len(sub_list);
- for (ii = 0; ii < count; ii++)
- {
- GValue *settings;
- gchar *track;
- gboolean force, burn, def;
- gint source;
-
- settings = ghb_array_get_nth(sub_list, ii);
- track = ghb_settings_get_string(settings, "SubtitleTrackDescription");
- source = ghb_settings_get_int(settings, "SubtitleSource");
- force = ghb_settings_get_boolean(settings, "SubtitleForced");
- burn = ghb_settings_get_boolean(settings, "SubtitleBurned");
- def = ghb_settings_get_boolean(settings, "SubtitleDefaultTrack");
- if (count == 1)
- g_string_append_printf(str, "<b>Subtitle:</b>");
- else if (ii == 0)
- g_string_append_printf(str, "<b>Subtitles:</b>\n");
- if (count != 1)
- g_string_append_printf(str, "\t");
-
- if (source != SRTSUB)
- {
- g_string_append_printf(str,
- "<small> %s%s%s%s</small>",
- track,
- force ? " (Force)":"",
- burn ? " (Burn)":"",
- def ? " (Default)":""
- );
- }
- else
- {
- gint offset;
- gchar *filename, *basename, *code;
-
- offset = ghb_settings_get_int(settings, "SrtOffset");
- filename = ghb_settings_get_string(settings, "SrtFile");
- basename = g_path_get_basename(filename);
- code = ghb_settings_get_string(settings, "SrtCodeset");
- g_string_append_printf(str,
- "<small> %s (%s), %s, Offset (ms) %d%s</small>",
- track, code, basename, offset,
- def ? " (Default)":""
- );
- g_free(filename);
- g_free(basename);
- g_free(code);
- }
- if (ii < count-1)
- g_string_append_printf(str, "\n");
- g_free(track);
- }
-
- info = g_string_free(str, FALSE);
- gtk_tree_store_append(store, &citer, &iter);
- gtk_tree_store_set(store, &citer, 1, info, -1);
- g_free(info);
- g_free(fps);
- g_free(vcodec_abbr);
- g_free(vol_name);
- g_free(dest);
- g_free(preset);
+ vqstr = g_strdup_printf("%d", (gint)vqvalue);
+ }
+ else
+ {
+ // Constant quality
+ vqvalue = ghb_settings_get_double(settings, "VideoQualitySlider");
+ vq_desc = "Constant Quality:";
+ vqstr = g_strdup_printf("%d", (gint)vqvalue);
+ if (strcmp(vcodec_abbr, "x264") == 0)
+ {
+ vq_units = "(RF)";
+ }
+ else
+ {
+ vq_units = "(QP)";
+ }
+ }
+ fps = ghb_settings_get_string(settings, "VideoFramerate");
+ if (strcmp("source", fps) == 0)
+ {
+ g_free(fps);
+ if (ghb_settings_get_boolean(settings, "VideoFramerateCFR"))
+ fps = g_strdup("Same As Source (constant)");
+ else
+ fps = g_strdup("Same As Source (variable)");
+ }
+ else
+ {
+ if (ghb_settings_get_boolean(settings, "VideoFrameratePFR"))
+ {
+ gchar *tmp;
+ tmp = g_strdup_printf("Peak %s (may be lower)", fps);
+ g_free(fps);
+ fps = tmp;
+ }
+ else
+ {
+ gchar *tmp;
+ tmp = g_strdup_printf("%s (constant frame rate)", fps);
+ g_free(fps);
+ fps = tmp;
+ }
+ }
+ source_width = ghb_settings_get_int(settings, "source_width");
+ source_height = ghb_settings_get_int(settings, "source_height");
+ g_string_append_printf(str,
+ "<b>Picture:</b> Source: <small>%d x %d, Output %d x %d %s</small>\n",
+ source_width, source_height, width, height, aspect_desc);
+
+ gint decomb, detel;
+ gboolean decomb_deint;
+ gboolean filters = FALSE;
+
+ decomb_deint = ghb_settings_get_boolean(settings, "PictureDecombDeinterlace");
+ decomb = ghb_settings_combo_int(settings, "PictureDecomb");
+ g_string_append_printf(str, "<b>Filters:</b><small>");
+ detel = ghb_settings_combo_int(settings, "PictureDetelecine");
+ if (detel)
+ {
+ g_string_append_printf(str, " - Detelecine");
+ if (detel == 1)
+ {
+ gchar *cust;
+ cust = ghb_settings_get_string(settings, "PictureDetelecineCustom");
+ g_string_append_printf(str, ": %s", cust);
+ g_free(cust);
+ }
+ filters = TRUE;
+ }
+ if (decomb_deint && decomb)
+ {
+ g_string_append_printf(str, " - Decomb");
+ if (decomb == 1)
+ {
+ gchar *cust;
+ cust = ghb_settings_get_string(settings, "PictureDecombCustom");
+ g_string_append_printf(str, ": %s", cust);
+ g_free(cust);
+ }
+ filters = TRUE;
+ }
+ else if (!decomb_deint)
+ {
+ gint deint = ghb_settings_combo_int(settings, "PictureDeinterlace");
+ if (deint)
+ {
+ if (deint == 1)
+ {
+ gchar *cust = ghb_settings_get_string(settings,
+ "PictureDeinterlaceCustom");
+ g_string_append_printf(str, " - Deinterlace: %s", cust);
+ g_free(cust);
+ }
+ else
+ {
+ const gchar *opt = ghb_settings_combo_option(settings,
+ "PictureDeinterlace");
+ g_string_append_printf(str, " - Deinterlace: %s", opt);
+ }
+ filters = TRUE;
+ }
+ }
+ gint denoise = ghb_settings_combo_int(settings, "PictureDenoise");
+ if (denoise)
+ {
+ if (denoise == 1)
+ {
+ gchar *cust = ghb_settings_get_string(settings,
+ "PictureDenoiseCustom");
+ g_string_append_printf(str, " - Denoise: %s", cust);
+ g_free(cust);
+ }
+ else
+ {
+ const gchar *opt = ghb_settings_combo_option(settings,
+ "PictureDenoise");
+ g_string_append_printf(str, " - Denoise: %s", opt);
+ }
+ filters = TRUE;
+ }
+ gint deblock = ghb_settings_get_int(settings, "PictureDeblock");
+ if (deblock >= 5)
+ {
+ g_string_append_printf(str, " - Deblock (%d)", deblock);
+ filters = TRUE;
+ }
+ if (ghb_settings_get_boolean(settings, "VideoGrayScale"))
+ {
+ g_string_append_printf(str, " - Grayscale");
+ filters = TRUE;
+ }
+ if (!filters)
+ g_string_append_printf(str, " None");
+ g_string_append_printf(str, "</small>\n");
+
+ g_string_append_printf(str,
+ "<b>Video:</b> <small>%s, Framerate: %s, %s %s%s</small>\n",
+ vcodec, fps, vq_desc, vqstr, vq_units);
+
+ turbo = ghb_settings_get_boolean(settings, "VideoTurboTwoPass");
+ if (turbo)
+ {
+ g_string_append_printf(str, "<b>Turbo:</b> <small>On</small>\n");
+ }
+ if (strcmp(vcodec_abbr, "x264") == 0 ||
+ strcmp(vcodec_abbr, "ffmpeg") == 0)
+ {
+ gchar *opts = ghb_build_advanced_opts_string(settings);
+ g_string_append_printf(str,
+ "<b>Advanced Options:</b> <small>%s</small>\n", opts);
+ g_free(opts);
+ }
+ // Add the audios
+ gint count, ii;
+ const GValue *audio_list;
+
+ audio_list = ghb_settings_get_value(settings, "audio_list");
+ count = ghb_array_len(audio_list);
+ for (ii = 0; ii < count; ii++)
+ {
+ gchar *quality = NULL, *samplerate, *track;
+ const gchar *acodec, *mix;
+ GValue *asettings;
+ gdouble sr;
+
+ asettings = ghb_array_get_nth(audio_list, ii);
+
+ acodec = ghb_settings_combo_option(asettings, "AudioEncoderActual");
+ double q = ghb_settings_get_double(asettings, "AudioTrackQuality");
+ if (ghb_settings_get_boolean(asettings, "AudioTrackQualityEnable") &&
+ q != HB_INVALID_AUDIO_QUALITY)
+ {
+ int codec = ghb_settings_combo_int(asettings, "AudioEncoderActual");
+ quality = ghb_format_quality("Quality: ", codec, q);
+ }
+ else
+ {
+ const char *br;
+ br = ghb_settings_get_string(asettings, "AudioBitrate");
+ quality = g_strdup_printf("Bitrate: %s", br);
+ }
+ sr = ghb_settings_get_double(asettings, "AudioSamplerate");
+ samplerate = ghb_settings_get_string(asettings, "AudioSamplerate");
+ if ((int)sr == 0)
+ {
+ samplerate = g_strdup("Same As Source");
+ }
+ else
+ {
+ samplerate = g_strdup_printf("%.4g", sr);
+ }
+ track = ghb_settings_get_string(asettings, "AudioTrackDescription");
+ mix = ghb_settings_combo_option(asettings, "AudioMixdown");
+ if (count == 1)
+ g_string_append_printf(str, "<b>Audio:</b>");
+ else if (ii == 0)
+ g_string_append_printf(str, "<b>Audio:</b>\n");
+ if (count != 1)
+ g_string_append_printf(str, "\t");
+
+ g_string_append_printf(str,
+ "<small> %s, Encoder: %s, Mixdown: %s, SampleRate: %s, %s</small>\n",
+ track, acodec, mix, samplerate, quality);
+ g_free(track);
+ g_free(quality);
+ g_free(samplerate);
+ }
+
+ // Add the audios
+ const GValue *sub_list;
+
+ sub_list = ghb_settings_get_value(settings, "subtitle_list");
+ count = ghb_array_len(sub_list);
+ for (ii = 0; ii < count; ii++)
+ {
+ GValue *settings;
+ gchar *track;
+ gboolean force, burn, def;
+ gint source;
+
+ settings = ghb_array_get_nth(sub_list, ii);
+ track = ghb_settings_get_string(settings, "SubtitleTrackDescription");
+ source = ghb_settings_get_int(settings, "SubtitleSource");
+ force = ghb_settings_get_boolean(settings, "SubtitleForced");
+ burn = ghb_settings_get_boolean(settings, "SubtitleBurned");
+ def = ghb_settings_get_boolean(settings, "SubtitleDefaultTrack");
+ if (count == 1)
+ g_string_append_printf(str, "<b>Subtitle:</b>");
+ else if (ii == 0)
+ g_string_append_printf(str, "<b>Subtitles:</b>\n");
+ if (count != 1)
+ g_string_append_printf(str, "\t");
+
+ if (source != SRTSUB)
+ {
+ g_string_append_printf(str,
+ "<small> %s%s%s%s</small>",
+ track,
+ force ? " (Force)":"",
+ burn ? " (Burn)":"",
+ def ? " (Default)":""
+ );
+ }
+ else
+ {
+ gint offset;
+ gchar *filename, *basename, *code;
+
+ offset = ghb_settings_get_int(settings, "SrtOffset");
+ filename = ghb_settings_get_string(settings, "SrtFile");
+ basename = g_path_get_basename(filename);
+ code = ghb_settings_get_string(settings, "SrtCodeset");
+ g_string_append_printf(str,
+ "<small> %s (%s), %s, Offset (ms) %d%s</small>",
+ track, code, basename, offset,
+ def ? " (Default)":""
+ );
+ g_free(filename);
+ g_free(basename);
+ g_free(code);
+ }
+ if (ii < count-1)
+ g_string_append_printf(str, "\n");
+ g_free(track);
+ }
+
+ info = g_string_free(str, FALSE);
+ gtk_tree_store_append(store, &citer, &iter);
+ gtk_tree_store_set(store, &citer, 1, info, -1);
+ g_free(info);
+ g_free(fps);
+ g_free(vcodec_abbr);
+ g_free(vol_name);
+ g_free(dest);
+ g_free(preset);
}
static gboolean
validate_settings(signal_user_data_t *ud, GValue *settings, gint batch)
{
- // Check to see if the dest file exists or is
- // already in the queue
- gchar *message, *dest;
- gint count, ii;
- gint titleindex;
-
- titleindex = ghb_settings_combo_int(settings, "title");
- if (titleindex < 0) return FALSE;
- dest = ghb_settings_get_string(settings, "destination");
- count = ghb_array_len(ud->queue);
- for (ii = 0; ii < count; ii++)
- {
- GValue *js;
- gchar *filename;
-
- js = ghb_array_get_nth(ud->queue, ii);
- filename = ghb_settings_get_string(js, "destination");
- if (strcmp(dest, filename) == 0)
- {
- message = g_strdup_printf(
- "Destination: %s\n\n"
- "Another queued job has specified the same destination.\n"
- "Do you want to overwrite?",
- dest);
- if (!ghb_message_dialog(GTK_MESSAGE_QUESTION, message, "Cancel", "Overwrite"))
- {
- g_free(filename);
- g_free(dest);
- g_free(message);
- return FALSE;
- }
- g_free(message);
- break;
- }
- g_free(filename);
- }
- gchar *destdir = g_path_get_dirname(dest);
- if (!g_file_test(destdir, G_FILE_TEST_IS_DIR))
- {
- message = g_strdup_printf(
- "Destination: %s\n\n"
- "This is not a valid directory.",
- destdir);
- ghb_message_dialog(GTK_MESSAGE_ERROR, message, "Cancel", NULL);
- g_free(dest);
- g_free(message);
- g_free(destdir);
- return FALSE;
- }
+ // Check to see if the dest file exists or is
+ // already in the queue
+ gchar *message, *dest;
+ gint count, ii;
+ gint titleindex;
+
+ titleindex = ghb_settings_combo_int(settings, "title");
+ if (titleindex < 0) return FALSE;
+ dest = ghb_settings_get_string(settings, "destination");
+ count = ghb_array_len(ud->queue);
+ for (ii = 0; ii < count; ii++)
+ {
+ GValue *js;
+ gchar *filename;
+
+ js = ghb_array_get_nth(ud->queue, ii);
+ filename = ghb_settings_get_string(js, "destination");
+ if (strcmp(dest, filename) == 0)
+ {
+ message = g_strdup_printf(
+ "Destination: %s\n\n"
+ "Another queued job has specified the same destination.\n"
+ "Do you want to overwrite?",
+ dest);
+ if (!ghb_message_dialog(GTK_MESSAGE_QUESTION, message, "Cancel", "Overwrite"))
+ {
+ g_free(filename);
+ g_free(dest);
+ g_free(message);
+ return FALSE;
+ }
+ g_free(message);
+ break;
+ }
+ g_free(filename);
+ }
+ gchar *destdir = g_path_get_dirname(dest);
+ if (!g_file_test(destdir, G_FILE_TEST_IS_DIR))
+ {
+ message = g_strdup_printf(
+ "Destination: %s\n\n"
+ "This is not a valid directory.",
+ destdir);
+ ghb_message_dialog(GTK_MESSAGE_ERROR, message, "Cancel", NULL);
+ g_free(dest);
+ g_free(message);
+ g_free(destdir);
+ return FALSE;
+ }
#if !defined(_WIN32)
- // This doesn't work properly on windows
- if (g_access(destdir, R_OK|W_OK) != 0)
- {
- message = g_strdup_printf(
- "Destination: %s\n\n"
- "Can not read or write the directory.",
- destdir);
- ghb_message_dialog(GTK_MESSAGE_ERROR, message, "Cancel", NULL);
- g_free(dest);
- g_free(message);
- g_free(destdir);
- return FALSE;
- }
+ // This doesn't work properly on windows
+ if (g_access(destdir, R_OK|W_OK) != 0)
+ {
+ message = g_strdup_printf(
+ "Destination: %s\n\n"
+ "Can not read or write the directory.",
+ destdir);
+ ghb_message_dialog(GTK_MESSAGE_ERROR, message, "Cancel", NULL);
+ g_free(dest);
+ g_free(message);
+ g_free(destdir);
+ return FALSE;
+ }
#endif
- if (!batch)
- {
- GFile *gfile;
- GFileInfo *info;
- guint64 size;
- gchar *resolved = ghb_resolve_symlink(destdir);
-
- gfile = g_file_new_for_path(resolved);
- info = g_file_query_filesystem_info(gfile,
- G_FILE_ATTRIBUTE_FILESYSTEM_FREE, NULL, NULL);
- if (info != NULL)
- {
- if (g_file_info_has_attribute(info, G_FILE_ATTRIBUTE_FILESYSTEM_FREE))
- {
- size = g_file_info_get_attribute_uint64(info,
- G_FILE_ATTRIBUTE_FILESYSTEM_FREE);
-
- gint64 fsize = (guint64)10 * 1024 * 1024 * 1024;
- if (size < fsize)
- {
- message = g_strdup_printf(
- "Destination filesystem is almost full: %uM free\n\n"
- "Encode may be incomplete if you proceed.\n",
- (guint)(size / (1024L*1024L)));
- if (!ghb_message_dialog(GTK_MESSAGE_QUESTION, message, "Cancel", "Proceed"))
- {
- g_free(dest);
- g_free(message);
- return FALSE;
- }
- g_free(message);
- }
- }
- g_object_unref(info);
- }
- g_object_unref(gfile);
- g_free(resolved);
- }
- g_free(destdir);
- if (g_file_test(dest, G_FILE_TEST_EXISTS))
- {
- message = g_strdup_printf(
- "Destination: %s\n\n"
- "File already exists.\n"
- "Do you want to overwrite?",
- dest);
- if (!ghb_message_dialog(GTK_MESSAGE_QUESTION, message, "Cancel", "Overwrite"))
- {
- g_free(dest);
- g_free(message);
- return FALSE;
- }
- g_free(message);
- g_unlink(dest);
- }
- g_free(dest);
- // Validate video quality is in a reasonable range
- if (!ghb_validate_vquality(settings))
- {
- return FALSE;
- }
- // Validate audio settings
- if (!ghb_validate_audio(settings))
- {
- return FALSE;
- }
- // Validate audio settings
- if (!ghb_validate_subtitles(settings))
- {
- return FALSE;
- }
- // Validate video settings
- if (!ghb_validate_video(settings))
- {
- return FALSE;
- }
- // Validate filter settings
- if (!ghb_validate_filters(settings))
- {
- return FALSE;
- }
- return TRUE;
+ if (!batch)
+ {
+ GFile *gfile;
+ GFileInfo *info;
+ guint64 size;
+ gchar *resolved = ghb_resolve_symlink(destdir);
+
+ gfile = g_file_new_for_path(resolved);
+ info = g_file_query_filesystem_info(gfile,
+ G_FILE_ATTRIBUTE_FILESYSTEM_FREE, NULL, NULL);
+ if (info != NULL)
+ {
+ if (g_file_info_has_attribute(info, G_FILE_ATTRIBUTE_FILESYSTEM_FREE))
+ {
+ size = g_file_info_get_attribute_uint64(info,
+ G_FILE_ATTRIBUTE_FILESYSTEM_FREE);
+
+ gint64 fsize = (guint64)10 * 1024 * 1024 * 1024;
+ if (size < fsize)
+ {
+ message = g_strdup_printf(
+ "Destination filesystem is almost full: %uM free\n\n"
+ "Encode may be incomplete if you proceed.\n",
+ (guint)(size / (1024L*1024L)));
+ if (!ghb_message_dialog(GTK_MESSAGE_QUESTION, message, "Cancel", "Proceed"))
+ {
+ g_free(dest);
+ g_free(message);
+ return FALSE;
+ }
+ g_free(message);
+ }
+ }
+ g_object_unref(info);
+ }
+ g_object_unref(gfile);
+ g_free(resolved);
+ }
+ g_free(destdir);
+ if (g_file_test(dest, G_FILE_TEST_EXISTS))
+ {
+ message = g_strdup_printf(
+ "Destination: %s\n\n"
+ "File already exists.\n"
+ "Do you want to overwrite?",
+ dest);
+ if (!ghb_message_dialog(GTK_MESSAGE_QUESTION, message, "Cancel", "Overwrite"))
+ {
+ g_free(dest);
+ g_free(message);
+ return FALSE;
+ }
+ g_free(message);
+ g_unlink(dest);
+ }
+ g_free(dest);
+ // Validate video quality is in a reasonable range
+ if (!ghb_validate_vquality(settings))
+ {
+ return FALSE;
+ }
+ // Validate audio settings
+ if (!ghb_validate_audio(settings))
+ {
+ return FALSE;
+ }
+ // Validate audio settings
+ if (!ghb_validate_subtitles(settings))
+ {
+ return FALSE;
+ }
+ // Validate video settings
+ if (!ghb_validate_video(settings))
+ {
+ return FALSE;
+ }
+ // Validate filter settings
+ if (!ghb_validate_filters(settings))
+ {
+ return FALSE;
+ }
+ return TRUE;
}
gboolean
ghb_queue_add(signal_user_data_t *ud, GValue *settings, gint batch)
{
- // Add settings to the queue
- gint titleindex;
- gint titlenum;
-
- g_debug("queue_add ()");
- if (!validate_settings(ud, settings, batch))
- {
- return FALSE;
- }
-
- if (ud->queue == NULL)
- ud->queue = ghb_array_value_new(32);
- // Make a copy of current settings to be used for the new job
- ghb_settings_set_int(settings, "job_status", GHB_QUEUE_PENDING);
- ghb_settings_set_int(settings, "job_unique_id", 0);
- titleindex = ghb_settings_combo_int(settings, "title");
- titlenum = ghb_get_title_number(titleindex);
- ghb_settings_set_int(settings, "titlenum", titlenum);
- ghb_array_append(ud->queue, settings);
- add_to_queue_list(ud, settings, NULL);
- ghb_save_queue(ud->queue);
- ghb_update_pending(ud);
-
- return TRUE;
+ // Add settings to the queue
+ gint titleindex;
+ gint titlenum;
+
+ g_debug("queue_add ()");
+ if (!validate_settings(ud, settings, batch))
+ {
+ return FALSE;
+ }
+
+ if (ud->queue == NULL)
+ ud->queue = ghb_array_value_new(32);
+ // Make a copy of current settings to be used for the new job
+ ghb_settings_set_int(settings, "job_status", GHB_QUEUE_PENDING);
+ ghb_settings_set_int(settings, "job_unique_id", 0);
+ titleindex = ghb_settings_combo_int(settings, "title");
+ titlenum = ghb_get_title_number(titleindex);
+ ghb_settings_set_int(settings, "titlenum", titlenum);
+ ghb_array_append(ud->queue, settings);
+ add_to_queue_list(ud, settings, NULL);
+ ghb_save_queue(ud->queue);
+ ghb_update_pending(ud);
+
+ return TRUE;
}
G_MODULE_EXPORT void
queue_add_clicked_cb(GtkWidget *widget, signal_user_data_t *ud)
{
- g_debug("queue_add_clicked_cb ()");
- GValue *settings = ghb_value_dup(ud->settings);
- if (!ghb_queue_add(ud, settings, 0))
- ghb_value_free(settings);
- // Validation of settings may have changed audio list
- ghb_audio_list_refresh(ud);
+ g_debug("queue_add_clicked_cb ()");
+ GValue *settings = ghb_value_dup(ud->settings);
+ if (!ghb_queue_add(ud, settings, 0))
+ ghb_value_free(settings);
+ // Validation of settings may have changed audio list
+ ghb_audio_list_refresh(ud);
}
G_MODULE_EXPORT void
queue_add_all_clicked_cb(GtkWidget *widget, signal_user_data_t *ud)
{
- g_debug("queue_add_all_clicked_cb ()");
- ghb_add_all_titles(ud);
+ g_debug("queue_add_all_clicked_cb ()");
+ ghb_add_all_titles(ud);
}
G_MODULE_EXPORT void
queue_remove_clicked_cb(GtkWidget *widget, gchar *path, signal_user_data_t *ud)
{
- GtkTreeView *treeview;
- GtkTreePath *treepath;
- GtkTreeModel *store;
- GtkTreeIter iter;
- gint row;
- gint *indices;
- gint unique_id;
- GValue *settings;
- gint status;
-
- g_debug("queue_remove_clicked_cb ()");
- treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "queue_list"));
- store = gtk_tree_view_get_model(treeview);
- treepath = gtk_tree_path_new_from_string (path);
- if (gtk_tree_path_get_depth(treepath) > 1) return;
- if (gtk_tree_model_get_iter(store, &iter, treepath))
- {
- // Find the entry in the queue
- indices = gtk_tree_path_get_indices (treepath);
- row = indices[0];
- // Can only free the treepath After getting what I need from
- // indices since this points into treepath somewhere.
- gtk_tree_path_free (treepath);
- if (row < 0) return;
- if (row >= ghb_array_len(ud->queue))
- return;
- settings = ghb_array_get_nth(ud->queue, row);
- status = ghb_settings_get_int(settings, "job_status");
- if (status == GHB_QUEUE_RUNNING)
- {
- // Ask if wants to stop encode.
- if (!ghb_cancel_encode2(ud, NULL))
- {
- return;
- }
- unique_id = ghb_settings_get_int(settings, "job_unique_id");
- ghb_remove_job(unique_id);
- }
- // Remove the selected item
- gtk_tree_store_remove(GTK_TREE_STORE(store), &iter);
- // Remove the corresponding item from the queue list
- GValue *old = ghb_array_get_nth(ud->queue, row);
- ghb_value_free(old);
- ghb_array_remove(ud->queue, row);
- ghb_save_queue(ud->queue);
- }
- else
- {
- gtk_tree_path_free (treepath);
- }
- ghb_update_pending(ud);
+ GtkTreeView *treeview;
+ GtkTreePath *treepath;
+ GtkTreeModel *store;
+ GtkTreeIter iter;
+ gint row;
+ gint *indices;
+ gint unique_id;
+ GValue *settings;
+ gint status;
+
+ g_debug("queue_remove_clicked_cb ()");
+ treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "queue_list"));
+ store = gtk_tree_view_get_model(treeview);
+ treepath = gtk_tree_path_new_from_string (path);
+ if (gtk_tree_path_get_depth(treepath) > 1) return;
+ if (gtk_tree_model_get_iter(store, &iter, treepath))
+ {
+ // Find the entry in the queue
+ indices = gtk_tree_path_get_indices (treepath);
+ row = indices[0];
+ // Can only free the treepath After getting what I need from
+ // indices since this points into treepath somewhere.
+ gtk_tree_path_free (treepath);
+ if (row < 0) return;
+ if (row >= ghb_array_len(ud->queue))
+ return;
+ settings = ghb_array_get_nth(ud->queue, row);
+ status = ghb_settings_get_int(settings, "job_status");
+ if (status == GHB_QUEUE_RUNNING)
+ {
+ // Ask if wants to stop encode.
+ if (!ghb_cancel_encode2(ud, NULL))
+ {
+ return;
+ }
+ unique_id = ghb_settings_get_int(settings, "job_unique_id");
+ ghb_remove_job(unique_id);
+ }
+ // Remove the selected item
+ gtk_tree_store_remove(GTK_TREE_STORE(store), &iter);
+ // Remove the corresponding item from the queue list
+ GValue *old = ghb_array_get_nth(ud->queue, row);
+ ghb_value_free(old);
+ ghb_array_remove(ud->queue, row);
+ ghb_save_queue(ud->queue);
+ }
+ else
+ {
+ gtk_tree_path_free (treepath);
+ }
+ ghb_update_pending(ud);
}
static gint
find_last_finished(GValue *queue)
{
- GValue *js;
- gint ii, count;
- gint status;
-
- g_debug("find_last_finished");
- count = ghb_array_len(queue);
- for (ii = 0; ii < count; ii++)
- {
- js = ghb_array_get_nth(queue, ii);
- status = ghb_settings_get_int(js, "job_status");
- if (status != GHB_QUEUE_DONE && status != GHB_QUEUE_RUNNING)
- {
- return ii-1;
- }
- }
- return -1;
+ GValue *js;
+ gint ii, count;
+ gint status;
+
+ g_debug("find_last_finished");
+ count = ghb_array_len(queue);
+ for (ii = 0; ii < count; ii++)
+ {
+ js = ghb_array_get_nth(queue, ii);
+ status = ghb_settings_get_int(js, "job_status");
+ if (status != GHB_QUEUE_DONE && status != GHB_QUEUE_RUNNING)
+ {
+ return ii-1;
+ }
+ }
+ return -1;
}
// This little bit is needed to prevent the default drag motion
@@ -807,563 +807,563 @@ find_last_finished(GValue *queue)
// Also controls where valid drop locations are
G_MODULE_EXPORT gboolean
queue_drag_motion_cb(
- GtkTreeView *tv,
- GdkDragContext *ctx,
- gint x,
- gint y,
- guint time,
- signal_user_data_t *ud)
+ GtkTreeView *tv,
+ GdkDragContext *ctx,
+ gint x,
+ gint y,
+ guint time,
+ signal_user_data_t *ud)
{
- GtkTreePath *path = NULL;
- GtkTreeViewDropPosition pos;
- gint *indices, row, status, finished;
- GValue *js;
- GtkTreeIter iter;
- GtkTreeView *srctv;
- GtkTreeModel *model;
- GtkTreeSelection *select;
- GtkWidget *widget;
-
- widget = gtk_drag_get_source_widget(ctx);
- if (widget == NULL || widget != GTK_WIDGET(tv))
- return TRUE;
-
- // This bit checks to see if the source is allowed to be
- // moved. Only pending and canceled items may be moved.
- srctv = GTK_TREE_VIEW(gtk_drag_get_source_widget(ctx));
- select = gtk_tree_view_get_selection (srctv);
- gtk_tree_selection_get_selected (select, &model, &iter);
- path = gtk_tree_model_get_path (model, &iter);
- indices = gtk_tree_path_get_indices(path);
- row = indices[0];
- gtk_tree_path_free(path);
- js = ghb_array_get_nth(ud->queue, row);
- status = ghb_settings_get_int(js, "job_status");
- if (status != GHB_QUEUE_PENDING && status != GHB_QUEUE_CANCELED)
- {
- gdk_drag_status(ctx, 0, time);
- return TRUE;
- }
-
- // The reset checks that the destination is a valid position
- // in the list. Can not move above any finished or running items
- gtk_tree_view_get_dest_row_at_pos (tv, x, y, &path, &pos);
- if (path == NULL)
- {
- gdk_drag_status(ctx, GDK_ACTION_MOVE, time);
- return TRUE;
- }
- // Don't allow *drop into*
- if (pos == GTK_TREE_VIEW_DROP_INTO_OR_BEFORE)
- pos = GTK_TREE_VIEW_DROP_BEFORE;
- if (pos == GTK_TREE_VIEW_DROP_INTO_OR_AFTER)
- pos = GTK_TREE_VIEW_DROP_AFTER;
- // Don't allow droping int child items
- if (gtk_tree_path_get_depth(path) > 1)
- {
- gtk_tree_path_up(path);
- pos = GTK_TREE_VIEW_DROP_AFTER;
- }
- indices = gtk_tree_path_get_indices(path);
- row = indices[0];
- js = ghb_array_get_nth(ud->queue, row);
-
- finished = find_last_finished(ud->queue);
- if (row < finished)
- {
- gtk_tree_path_free(path);
- gdk_drag_status(ctx, 0, time);
- return TRUE;
- }
- if (pos != GTK_TREE_VIEW_DROP_AFTER &&
- row == finished)
- {
- gtk_tree_path_free(path);
- gdk_drag_status(ctx, 0, time);
- return TRUE;
- }
- gtk_tree_view_set_drag_dest_row(tv, path, pos);
- gtk_tree_path_free(path);
- gdk_drag_status(ctx, GDK_ACTION_MOVE, time);
- return TRUE;
+ GtkTreePath *path = NULL;
+ GtkTreeViewDropPosition pos;
+ gint *indices, row, status, finished;
+ GValue *js;
+ GtkTreeIter iter;
+ GtkTreeView *srctv;
+ GtkTreeModel *model;
+ GtkTreeSelection *select;
+ GtkWidget *widget;
+
+ widget = gtk_drag_get_source_widget(ctx);
+ if (widget == NULL || widget != GTK_WIDGET(tv))
+ return TRUE;
+
+ // This bit checks to see if the source is allowed to be
+ // moved. Only pending and canceled items may be moved.
+ srctv = GTK_TREE_VIEW(gtk_drag_get_source_widget(ctx));
+ select = gtk_tree_view_get_selection (srctv);
+ gtk_tree_selection_get_selected (select, &model, &iter);
+ path = gtk_tree_model_get_path (model, &iter);
+ indices = gtk_tree_path_get_indices(path);
+ row = indices[0];
+ gtk_tree_path_free(path);
+ js = ghb_array_get_nth(ud->queue, row);
+ status = ghb_settings_get_int(js, "job_status");
+ if (status != GHB_QUEUE_PENDING && status != GHB_QUEUE_CANCELED)
+ {
+ gdk_drag_status(ctx, 0, time);
+ return TRUE;
+ }
+
+ // The reset checks that the destination is a valid position
+ // in the list. Can not move above any finished or running items
+ gtk_tree_view_get_dest_row_at_pos (tv, x, y, &path, &pos);
+ if (path == NULL)
+ {
+ gdk_drag_status(ctx, GDK_ACTION_MOVE, time);
+ return TRUE;
+ }
+ // Don't allow *drop into*
+ if (pos == GTK_TREE_VIEW_DROP_INTO_OR_BEFORE)
+ pos = GTK_TREE_VIEW_DROP_BEFORE;
+ if (pos == GTK_TREE_VIEW_DROP_INTO_OR_AFTER)
+ pos = GTK_TREE_VIEW_DROP_AFTER;
+ // Don't allow droping int child items
+ if (gtk_tree_path_get_depth(path) > 1)
+ {
+ gtk_tree_path_up(path);
+ pos = GTK_TREE_VIEW_DROP_AFTER;
+ }
+ indices = gtk_tree_path_get_indices(path);
+ row = indices[0];
+ js = ghb_array_get_nth(ud->queue, row);
+
+ finished = find_last_finished(ud->queue);
+ if (row < finished)
+ {
+ gtk_tree_path_free(path);
+ gdk_drag_status(ctx, 0, time);
+ return TRUE;
+ }
+ if (pos != GTK_TREE_VIEW_DROP_AFTER &&
+ row == finished)
+ {
+ gtk_tree_path_free(path);
+ gdk_drag_status(ctx, 0, time);
+ return TRUE;
+ }
+ gtk_tree_view_set_drag_dest_row(tv, path, pos);
+ gtk_tree_path_free(path);
+ gdk_drag_status(ctx, GDK_ACTION_MOVE, time);
+ return TRUE;
}
G_MODULE_EXPORT void
queue_drag_cb(
- GtkTreeView *dstwidget,
- GdkDragContext *dc,
- gint x, gint y,
- GtkSelectionData *selection_data,
- guint info, guint t,
- signal_user_data_t *ud)
+ GtkTreeView *dstwidget,
+ GdkDragContext *dc,
+ gint x, gint y,
+ GtkSelectionData *selection_data,
+ guint info, guint t,
+ signal_user_data_t *ud)
{
- GtkTreePath *path = NULL;
- //GtkTreeModel *model;
- GtkTreeViewDropPosition pos;
- GtkTreeIter dstiter, srciter;
- gint *indices, row;
- GValue *js;
-
- GtkTreeModel *dstmodel = gtk_tree_view_get_model(dstwidget);
-
- g_debug("queue_drag_cb ()");
- // This doesn't work here for some reason...
- // gtk_tree_view_get_drag_dest_row(dstwidget, &path, &pos);
- gtk_tree_view_get_dest_row_at_pos (dstwidget, x, y, &path, &pos);
- // This little hack is needed because attempting to drop after
- // the last item gives us no path or pos.
- if (path == NULL)
- {
- gint n_children;
-
- n_children = gtk_tree_model_iter_n_children(dstmodel, NULL);
- if (n_children)
- {
- pos = GTK_TREE_VIEW_DROP_AFTER;
- path = gtk_tree_path_new_from_indices(n_children-1, -1);
- }
- else
- {
- pos = GTK_TREE_VIEW_DROP_BEFORE;
- path = gtk_tree_path_new_from_indices(0, -1);
- }
- }
- if (path)
- {
- if (gtk_tree_path_get_depth(path) > 1)
- gtk_tree_path_up(path);
- if (gtk_tree_model_get_iter (dstmodel, &dstiter, path))
- {
- GtkTreeIter iter;
- GtkTreeView *srcwidget;
- GtkTreeModel *srcmodel;
- GtkTreeSelection *select;
- GtkTreePath *srcpath = NULL;
- GtkTreePath *dstpath = NULL;
-
- srcwidget = GTK_TREE_VIEW(gtk_drag_get_source_widget(dc));
- //srcmodel = gtk_tree_view_get_model(srcwidget);
- select = gtk_tree_view_get_selection (srcwidget);
- gtk_tree_selection_get_selected (select, &srcmodel, &srciter);
-
- srcpath = gtk_tree_model_get_path (srcmodel, &srciter);
- indices = gtk_tree_path_get_indices(srcpath);
- row = indices[0];
- gtk_tree_path_free(srcpath);
- js = ghb_array_get_nth(ud->queue, row);
-
- switch (pos)
- {
- case GTK_TREE_VIEW_DROP_BEFORE:
- case GTK_TREE_VIEW_DROP_INTO_OR_BEFORE:
- gtk_tree_store_insert_before (GTK_TREE_STORE (dstmodel),
- &iter, NULL, &dstiter);
- break;
-
- case GTK_TREE_VIEW_DROP_AFTER:
- case GTK_TREE_VIEW_DROP_INTO_OR_AFTER:
- gtk_tree_store_insert_after (GTK_TREE_STORE (dstmodel),
- &iter, NULL, &dstiter);
- break;
-
- default:
- break;
- }
- // Reset job to pending
- ghb_settings_set_int(js, "job_status", GHB_QUEUE_PENDING);
- add_to_queue_list(ud, js, &iter);
-
- dstpath = gtk_tree_model_get_path (dstmodel, &iter);
- indices = gtk_tree_path_get_indices(dstpath);
- row = indices[0];
- gtk_tree_path_free(dstpath);
- ghb_array_insert(ud->queue, row, js);
-
- srcpath = gtk_tree_model_get_path (srcmodel, &srciter);
- indices = gtk_tree_path_get_indices(srcpath);
- row = indices[0];
- gtk_tree_path_free(srcpath);
- ghb_array_remove(ud->queue, row);
- gtk_tree_store_remove (GTK_TREE_STORE (srcmodel), &srciter);
- ghb_save_queue(ud->queue);
- }
- gtk_tree_path_free(path);
- }
+ GtkTreePath *path = NULL;
+ //GtkTreeModel *model;
+ GtkTreeViewDropPosition pos;
+ GtkTreeIter dstiter, srciter;
+ gint *indices, row;
+ GValue *js;
+
+ GtkTreeModel *dstmodel = gtk_tree_view_get_model(dstwidget);
+
+ g_debug("queue_drag_cb ()");
+ // This doesn't work here for some reason...
+ // gtk_tree_view_get_drag_dest_row(dstwidget, &path, &pos);
+ gtk_tree_view_get_dest_row_at_pos (dstwidget, x, y, &path, &pos);
+ // This little hack is needed because attempting to drop after
+ // the last item gives us no path or pos.
+ if (path == NULL)
+ {
+ gint n_children;
+
+ n_children = gtk_tree_model_iter_n_children(dstmodel, NULL);
+ if (n_children)
+ {
+ pos = GTK_TREE_VIEW_DROP_AFTER;
+ path = gtk_tree_path_new_from_indices(n_children-1, -1);
+ }
+ else
+ {
+ pos = GTK_TREE_VIEW_DROP_BEFORE;
+ path = gtk_tree_path_new_from_indices(0, -1);
+ }
+ }
+ if (path)
+ {
+ if (gtk_tree_path_get_depth(path) > 1)
+ gtk_tree_path_up(path);
+ if (gtk_tree_model_get_iter (dstmodel, &dstiter, path))
+ {
+ GtkTreeIter iter;
+ GtkTreeView *srcwidget;
+ GtkTreeModel *srcmodel;
+ GtkTreeSelection *select;
+ GtkTreePath *srcpath = NULL;
+ GtkTreePath *dstpath = NULL;
+
+ srcwidget = GTK_TREE_VIEW(gtk_drag_get_source_widget(dc));
+ //srcmodel = gtk_tree_view_get_model(srcwidget);
+ select = gtk_tree_view_get_selection (srcwidget);
+ gtk_tree_selection_get_selected (select, &srcmodel, &srciter);
+
+ srcpath = gtk_tree_model_get_path (srcmodel, &srciter);
+ indices = gtk_tree_path_get_indices(srcpath);
+ row = indices[0];
+ gtk_tree_path_free(srcpath);
+ js = ghb_array_get_nth(ud->queue, row);
+
+ switch (pos)
+ {
+ case GTK_TREE_VIEW_DROP_BEFORE:
+ case GTK_TREE_VIEW_DROP_INTO_OR_BEFORE:
+ gtk_tree_store_insert_before (GTK_TREE_STORE (dstmodel),
+ &iter, NULL, &dstiter);
+ break;
+
+ case GTK_TREE_VIEW_DROP_AFTER:
+ case GTK_TREE_VIEW_DROP_INTO_OR_AFTER:
+ gtk_tree_store_insert_after (GTK_TREE_STORE (dstmodel),
+ &iter, NULL, &dstiter);
+ break;
+
+ default:
+ break;
+ }
+ // Reset job to pending
+ ghb_settings_set_int(js, "job_status", GHB_QUEUE_PENDING);
+ add_to_queue_list(ud, js, &iter);
+
+ dstpath = gtk_tree_model_get_path (dstmodel, &iter);
+ indices = gtk_tree_path_get_indices(dstpath);
+ row = indices[0];
+ gtk_tree_path_free(dstpath);
+ ghb_array_insert(ud->queue, row, js);
+
+ srcpath = gtk_tree_model_get_path (srcmodel, &srciter);
+ indices = gtk_tree_path_get_indices(srcpath);
+ row = indices[0];
+ gtk_tree_path_free(srcpath);
+ ghb_array_remove(ud->queue, row);
+ gtk_tree_store_remove (GTK_TREE_STORE (srcmodel), &srciter);
+ ghb_save_queue(ud->queue);
+ }
+ gtk_tree_path_free(path);
+ }
}
void
ghb_queue_buttons_grey(signal_user_data_t *ud)
{
- GtkWidget *widget;
- GtkAction *action;
- gint queue_count;
- gint titleindex;
- gint queue_state, scan_state;
- gboolean show_start, show_stop, paused;
-
- queue_count = ghb_array_len(ud->queue);
- titleindex = ghb_settings_combo_int(ud->settings, "title");
-
- queue_state = ghb_get_queue_state();
- scan_state = ghb_get_scan_state();
-
- show_stop = queue_state &
- (GHB_STATE_WORKING | GHB_STATE_SEARCHING |
- GHB_STATE_SCANNING | GHB_STATE_MUXING);
- show_start = !(scan_state & GHB_STATE_SCANNING) &&
- (titleindex >= 0 || queue_count > 0);
-
-
- paused = queue_state & GHB_STATE_PAUSED;
-
- widget = GHB_WIDGET(ud->builder, "queue_add");
- gtk_widget_set_sensitive(widget, show_start);
- action = GHB_ACTION(ud->builder, "queue_add_menu");
- gtk_action_set_sensitive(action, show_start);
- action = GHB_ACTION(ud->builder, "queue_add_all_menu");
- gtk_action_set_sensitive(action, show_start);
-
- widget = GHB_WIDGET (ud->builder, "queue_start1");
- if (show_stop)
- {
- gtk_widget_set_sensitive (widget, TRUE);
- gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(widget), "hb-stop");
- gtk_tool_button_set_label(GTK_TOOL_BUTTON(widget), "Stop");
- gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(widget), "Stop Encoding");
- }
- else
- {
- gtk_widget_set_sensitive (widget, show_start);
- gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(widget), "hb-start");
- gtk_tool_button_set_label(GTK_TOOL_BUTTON(widget), "Start");
- gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(widget), "Start Encoding");
- }
- widget = GHB_WIDGET (ud->builder, "queue_start2");
- if (show_stop)
- {
- gtk_widget_set_sensitive (widget, TRUE);
- gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(widget), "hb-stop");
- gtk_tool_button_set_label(GTK_TOOL_BUTTON(widget), "Stop");
- gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(widget), "Stop Encoding");
- }
- else
- {
- gtk_widget_set_sensitive (widget, show_start);
- gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(widget), "hb-start");
- gtk_tool_button_set_label(GTK_TOOL_BUTTON(widget), "Start");
- gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(widget), "Start Encoding");
- }
- widget = GHB_WIDGET (ud->builder, "queue_pause1");
- if (paused)
- {
- gtk_widget_set_sensitive (widget, show_stop);
- gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(widget), "hb-start");
- gtk_tool_button_set_label(GTK_TOOL_BUTTON(widget), "Resume");
- gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(widget), "Resume Encoding");
- }
- else
- {
- gtk_widget_set_sensitive (widget, show_stop);
- gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(widget), "hb-pause");
- gtk_tool_button_set_label(GTK_TOOL_BUTTON(widget), "Pause");
- gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(widget), "Pause Encoding");
- }
- widget = GHB_WIDGET (ud->builder, "queue_pause2");
- if (paused)
- {
- gtk_widget_set_sensitive (widget, show_stop);
- gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(widget), "hb-start");
- gtk_tool_button_set_label(GTK_TOOL_BUTTON(widget), "Resume");
- gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(widget), "Resume Encoding");
- }
- else
- {
- gtk_widget_set_sensitive (widget, show_stop);
- gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(widget), "hb-pause");
- gtk_tool_button_set_label(GTK_TOOL_BUTTON(widget), "Pause");
- gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(widget), "Pause Encoding");
- }
-
- action = GHB_ACTION (ud->builder, "queue_start_menu");
- if (show_stop)
- {
- gtk_action_set_sensitive (action, TRUE);
+ GtkWidget *widget;
+ GtkAction *action;
+ gint queue_count;
+ gint titleindex;
+ gint queue_state, scan_state;
+ gboolean show_start, show_stop, paused;
+
+ queue_count = ghb_array_len(ud->queue);
+ titleindex = ghb_settings_combo_int(ud->settings, "title");
+
+ queue_state = ghb_get_queue_state();
+ scan_state = ghb_get_scan_state();
+
+ show_stop = queue_state &
+ (GHB_STATE_WORKING | GHB_STATE_SEARCHING |
+ GHB_STATE_SCANNING | GHB_STATE_MUXING);
+ show_start = !(scan_state & GHB_STATE_SCANNING) &&
+ (titleindex >= 0 || queue_count > 0);
+
+
+ paused = queue_state & GHB_STATE_PAUSED;
+
+ widget = GHB_WIDGET(ud->builder, "queue_add");
+ gtk_widget_set_sensitive(widget, show_start);
+ action = GHB_ACTION(ud->builder, "queue_add_menu");
+ gtk_action_set_sensitive(action, show_start);
+ action = GHB_ACTION(ud->builder, "queue_add_all_menu");
+ gtk_action_set_sensitive(action, show_start);
+
+ widget = GHB_WIDGET (ud->builder, "queue_start1");
+ if (show_stop)
+ {
+ gtk_widget_set_sensitive (widget, TRUE);
+ gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(widget), "hb-stop");
+ gtk_tool_button_set_label(GTK_TOOL_BUTTON(widget), "Stop");
+ gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(widget), "Stop Encoding");
+ }
+ else
+ {
+ gtk_widget_set_sensitive (widget, show_start);
+ gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(widget), "hb-start");
+ gtk_tool_button_set_label(GTK_TOOL_BUTTON(widget), "Start");
+ gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(widget), "Start Encoding");
+ }
+ widget = GHB_WIDGET (ud->builder, "queue_start2");
+ if (show_stop)
+ {
+ gtk_widget_set_sensitive (widget, TRUE);
+ gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(widget), "hb-stop");
+ gtk_tool_button_set_label(GTK_TOOL_BUTTON(widget), "Stop");
+ gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(widget), "Stop Encoding");
+ }
+ else
+ {
+ gtk_widget_set_sensitive (widget, show_start);
+ gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(widget), "hb-start");
+ gtk_tool_button_set_label(GTK_TOOL_BUTTON(widget), "Start");
+ gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(widget), "Start Encoding");
+ }
+ widget = GHB_WIDGET (ud->builder, "queue_pause1");
+ if (paused)
+ {
+ gtk_widget_set_sensitive (widget, show_stop);
+ gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(widget), "hb-start");
+ gtk_tool_button_set_label(GTK_TOOL_BUTTON(widget), "Resume");
+ gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(widget), "Resume Encoding");
+ }
+ else
+ {
+ gtk_widget_set_sensitive (widget, show_stop);
+ gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(widget), "hb-pause");
+ gtk_tool_button_set_label(GTK_TOOL_BUTTON(widget), "Pause");
+ gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(widget), "Pause Encoding");
+ }
+ widget = GHB_WIDGET (ud->builder, "queue_pause2");
+ if (paused)
+ {
+ gtk_widget_set_sensitive (widget, show_stop);
+ gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(widget), "hb-start");
+ gtk_tool_button_set_label(GTK_TOOL_BUTTON(widget), "Resume");
+ gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(widget), "Resume Encoding");
+ }
+ else
+ {
+ gtk_widget_set_sensitive (widget, show_stop);
+ gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(widget), "hb-pause");
+ gtk_tool_button_set_label(GTK_TOOL_BUTTON(widget), "Pause");
+ gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(widget), "Pause Encoding");
+ }
+
+ action = GHB_ACTION (ud->builder, "queue_start_menu");
+ if (show_stop)
+ {
+ gtk_action_set_sensitive (action, TRUE);
#if GTK_CHECK_VERSION(2, 16, 0)
- gtk_action_set_icon_name(action, "hb-stop");
- gtk_action_set_label(action, "S_top Queue");
- gtk_action_set_tooltip(action, "Stop Encoding");
+ gtk_action_set_icon_name(action, "hb-stop");
+ gtk_action_set_label(action, "S_top Queue");
+ gtk_action_set_tooltip(action, "Stop Encoding");
#else
- g_object_set_property(G_OBJECT(action), "icon-name",
- ghb_string_value("hb-stop"));
- g_object_set_property(G_OBJECT(action), "label",
- ghb_string_value("S_top Queue"));
- g_object_set_property(G_OBJECT(action), "tooltip",
- ghb_string_value("Stop Encoding"));
+ g_object_set_property(G_OBJECT(action), "icon-name",
+ ghb_string_value("hb-stop"));
+ g_object_set_property(G_OBJECT(action), "label",
+ ghb_string_value("S_top Queue"));
+ g_object_set_property(G_OBJECT(action), "tooltip",
+ ghb_string_value("Stop Encoding"));
#endif
- }
- else
- {
- gtk_action_set_sensitive (action, show_start);
+ }
+ else
+ {
+ gtk_action_set_sensitive (action, show_start);
#if GTK_CHECK_VERSION(2, 16, 0)
- gtk_action_set_icon_name(action, "hb-start");
- gtk_action_set_label(action, "_Start Queue");
- gtk_action_set_tooltip(action, "Start Encoding");
+ gtk_action_set_icon_name(action, "hb-start");
+ gtk_action_set_label(action, "_Start Queue");
+ gtk_action_set_tooltip(action, "Start Encoding");
#else
- g_object_set_property(G_OBJECT(action), "icon-name",
- ghb_string_value("hb-start"));
- g_object_set_property(G_OBJECT(action), "label",
- ghb_string_value("_Start Queue"));
- g_object_set_property(G_OBJECT(action), "tooltip",
- ghb_string_value("Start Encoding"));
+ g_object_set_property(G_OBJECT(action), "icon-name",
+ ghb_string_value("hb-start"));
+ g_object_set_property(G_OBJECT(action), "label",
+ ghb_string_value("_Start Queue"));
+ g_object_set_property(G_OBJECT(action), "tooltip",
+ ghb_string_value("Start Encoding"));
#endif
- }
- action = GHB_ACTION (ud->builder, "queue_pause_menu");
- if (paused)
- {
- gtk_action_set_sensitive (action, show_start);
+ }
+ action = GHB_ACTION (ud->builder, "queue_pause_menu");
+ if (paused)
+ {
+ gtk_action_set_sensitive (action, show_start);
#if GTK_CHECK_VERSION(2, 16, 0)
- gtk_action_set_icon_name(action, "hb-start");
- gtk_action_set_label(action, "_Resume Queue");
- gtk_action_set_tooltip(action, "Resume Encoding");
+ gtk_action_set_icon_name(action, "hb-start");
+ gtk_action_set_label(action, "_Resume Queue");
+ gtk_action_set_tooltip(action, "Resume Encoding");
#else
- g_object_set_property(G_OBJECT(action), "icon-name",
- ghb_string_value("hb-start"));
- g_object_set_property(G_OBJECT(action), "label",
- ghb_string_value("_Resume Queue"));
- g_object_set_property(G_OBJECT(action), "tooltip",
- ghb_string_value("Resume Encoding"));
+ g_object_set_property(G_OBJECT(action), "icon-name",
+ ghb_string_value("hb-start"));
+ g_object_set_property(G_OBJECT(action), "label",
+ ghb_string_value("_Resume Queue"));
+ g_object_set_property(G_OBJECT(action), "tooltip",
+ ghb_string_value("Resume Encoding"));
#endif
- }
- else
- {
- gtk_action_set_sensitive (action, show_stop);
+ }
+ else
+ {
+ gtk_action_set_sensitive (action, show_stop);
#if GTK_CHECK_VERSION(2, 16, 0)
- gtk_action_set_icon_name(action, "hb-pause");
- gtk_action_set_label(action, "_Pause Queue");
- gtk_action_set_tooltip(action, "Pause Encoding");
+ gtk_action_set_icon_name(action, "hb-pause");
+ gtk_action_set_label(action, "_Pause Queue");
+ gtk_action_set_tooltip(action, "Pause Encoding");
#else
- g_object_set_property(G_OBJECT(action), "icon-name",
- ghb_string_value("hb-pause"));
- g_object_set_property(G_OBJECT(action), "label",
- ghb_string_value("_Pause Queue"));
- g_object_set_property(G_OBJECT(action), "tooltip",
- ghb_string_value("Pause Encoding"));
+ g_object_set_property(G_OBJECT(action), "icon-name",
+ ghb_string_value("hb-pause"));
+ g_object_set_property(G_OBJECT(action), "label",
+ ghb_string_value("_Pause Queue"));
+ g_object_set_property(G_OBJECT(action), "tooltip",
+ ghb_string_value("Pause Encoding"));
#endif
- }
+ }
}
G_MODULE_EXPORT void
queue_list_size_allocate_cb(GtkWidget *widget, GtkAllocation *allocation, GtkCellRenderer *cell)
{
- GtkTreeViewColumn *column;
- gint width;
-
- column = gtk_tree_view_get_column (GTK_TREE_VIEW(widget), 0);
- width = gtk_tree_view_column_get_width(column);
- g_debug("col width %d alloc width %d", width, allocation->width);
- // Set new wrap-width. Shave a little off to accomidate the icons
- // that share this column.
- if (width >= 564) // Don't allow below a certain size
- g_object_set(cell, "wrap-width", width-70, NULL);
+ GtkTreeViewColumn *column;
+ gint width;
+
+ column = gtk_tree_view_get_column (GTK_TREE_VIEW(widget), 0);
+ width = gtk_tree_view_column_get_width(column);
+ g_debug("col width %d alloc width %d", width, allocation->width);
+ // Set new wrap-width. Shave a little off to accomidate the icons
+ // that share this column.
+ if (width >= 564) // Don't allow below a certain size
+ g_object_set(cell, "wrap-width", width-70, NULL);
}
G_MODULE_EXPORT void
queue_start_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud)
{
- GValue *js;
- gboolean running = FALSE;
- gint count, ii;
- gint status;
- gint state;
-
- state = ghb_get_queue_state();
- if (state & (GHB_STATE_WORKING | GHB_STATE_SEARCHING |
- GHB_STATE_SCANNING | GHB_STATE_MUXING))
- {
- ghb_cancel_encode(ud, "You are currently encoding. "
- "What would you like to do?");
- return;
- }
-
- count = ghb_array_len(ud->queue);
- for (ii = 0; ii < count; ii++)
- {
- js = ghb_array_get_nth(ud->queue, ii);
- status = ghb_settings_get_int(js, "job_status");
- if ((status == GHB_QUEUE_RUNNING) ||
- (status == GHB_QUEUE_PENDING))
- {
- running = TRUE;
- break;
- }
- }
- if (!running)
- {
- // The queue has no running or pending jobs.
- // Add current settings to the queue, then run.
- GValue *settings = ghb_value_dup(ud->settings);
- if (!ghb_queue_add(ud, settings, 0))
- {
- ghb_value_free(settings);
- return;
- }
- // Validation of settings may have changed audio list
- ghb_audio_list_refresh(ud);
- }
- if (state == GHB_STATE_IDLE)
- {
- // Add the first pending queue item and start
- ud->current_job = ghb_start_next_job(ud, TRUE);
- }
+ GValue *js;
+ gboolean running = FALSE;
+ gint count, ii;
+ gint status;
+ gint state;
+
+ state = ghb_get_queue_state();
+ if (state & (GHB_STATE_WORKING | GHB_STATE_SEARCHING |
+ GHB_STATE_SCANNING | GHB_STATE_MUXING))
+ {
+ ghb_cancel_encode(ud, "You are currently encoding. "
+ "What would you like to do?");
+ return;
+ }
+
+ count = ghb_array_len(ud->queue);
+ for (ii = 0; ii < count; ii++)
+ {
+ js = ghb_array_get_nth(ud->queue, ii);
+ status = ghb_settings_get_int(js, "job_status");
+ if ((status == GHB_QUEUE_RUNNING) ||
+ (status == GHB_QUEUE_PENDING))
+ {
+ running = TRUE;
+ break;
+ }
+ }
+ if (!running)
+ {
+ // The queue has no running or pending jobs.
+ // Add current settings to the queue, then run.
+ GValue *settings = ghb_value_dup(ud->settings);
+ if (!ghb_queue_add(ud, settings, 0))
+ {
+ ghb_value_free(settings);
+ return;
+ }
+ // Validation of settings may have changed audio list
+ ghb_audio_list_refresh(ud);
+ }
+ if (state == GHB_STATE_IDLE)
+ {
+ // Add the first pending queue item and start
+ ud->current_job = ghb_start_next_job(ud, TRUE);
+ }
}
G_MODULE_EXPORT void
queue_pause_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud)
{
- ghb_pause_queue();
+ ghb_pause_queue();
}
gboolean
ghb_reload_queue(signal_user_data_t *ud)
{
- GValue *queue;
- gint unfinished = 0;
- gint count, ii;
- gint pid;
- gint status;
- GValue *settings;
- gchar *message;
+ GValue *queue;
+ gint unfinished = 0;
+ gint count, ii;
+ gint pid;
+ gint status;
+ GValue *settings;
+ gchar *message;
- g_debug("ghb_reload_queue");
+ g_debug("ghb_reload_queue");
find_pid:
- pid = ghb_find_pid_file();
- if (pid < 0)
- return FALSE;
-
- queue = ghb_load_old_queue(pid);
- ghb_remove_old_queue_file(pid);
- // Look for unfinished entries
- count = ghb_array_len(queue);
- for (ii = 0; ii < count; ii++)
- {
- settings = ghb_array_get_nth(queue, ii);
- status = ghb_settings_get_int(settings, "job_status");
- if (status != GHB_QUEUE_DONE && status != GHB_QUEUE_CANCELED)
- {
- unfinished++;
- }
- }
- if (!unfinished)
- goto find_pid;
-
- if (unfinished)
- {
- message = g_strdup_printf(
- "You have %d unfinished job%s in a saved queue.\n\n"
- "Would you like to reload %s?",
- unfinished,
- (unfinished > 1) ? "s" : "",
- (unfinished > 1) ? "them" : "it");
- if (ghb_message_dialog(GTK_MESSAGE_QUESTION, message, "No", "Yes"))
- {
- GtkWidget *widget = GHB_WIDGET (ud->builder, "queue_window");
- gtk_widget_show (widget);
- widget = GHB_WIDGET (ud->builder, "show_queue");
- gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(widget), TRUE);
-
- ud->queue = queue;
- // First get rid of any old items we don't want
- for (ii = count-1; ii >= 0; ii--)
- {
- settings = ghb_array_get_nth(queue, ii);
- status = ghb_settings_get_int(settings, "job_status");
- if (status == GHB_QUEUE_DONE || status == GHB_QUEUE_CANCELED)
- {
- GValue *old = ghb_array_get_nth(queue, ii);
- ghb_value_free(old);
- ghb_array_remove(queue, ii);
- }
- }
- count = ghb_array_len(queue);
- for (ii = 0; ii < count; ii++)
- {
- settings = ghb_array_get_nth(queue, ii);
- ghb_settings_set_int(settings, "job_unique_id", 0);
- ghb_settings_set_int(settings, "job_status", GHB_QUEUE_PENDING);
- add_to_queue_list(ud, settings, NULL);
- }
- ghb_queue_buttons_grey(ud);
- ghb_save_queue(ud->queue);
- }
- else
- {
- ghb_value_free(queue);
- }
- g_free(message);
- }
- return FALSE;
+ pid = ghb_find_pid_file();
+ if (pid < 0)
+ return FALSE;
+
+ queue = ghb_load_old_queue(pid);
+ ghb_remove_old_queue_file(pid);
+ // Look for unfinished entries
+ count = ghb_array_len(queue);
+ for (ii = 0; ii < count; ii++)
+ {
+ settings = ghb_array_get_nth(queue, ii);
+ status = ghb_settings_get_int(settings, "job_status");
+ if (status != GHB_QUEUE_DONE && status != GHB_QUEUE_CANCELED)
+ {
+ unfinished++;
+ }
+ }
+ if (!unfinished)
+ goto find_pid;
+
+ if (unfinished)
+ {
+ message = g_strdup_printf(
+ "You have %d unfinished job%s in a saved queue.\n\n"
+ "Would you like to reload %s?",
+ unfinished,
+ (unfinished > 1) ? "s" : "",
+ (unfinished > 1) ? "them" : "it");
+ if (ghb_message_dialog(GTK_MESSAGE_QUESTION, message, "No", "Yes"))
+ {
+ GtkWidget *widget = GHB_WIDGET (ud->builder, "queue_window");
+ gtk_widget_show (widget);
+ widget = GHB_WIDGET (ud->builder, "show_queue");
+ gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(widget), TRUE);
+
+ ud->queue = queue;
+ // First get rid of any old items we don't want
+ for (ii = count-1; ii >= 0; ii--)
+ {
+ settings = ghb_array_get_nth(queue, ii);
+ status = ghb_settings_get_int(settings, "job_status");
+ if (status == GHB_QUEUE_DONE || status == GHB_QUEUE_CANCELED)
+ {
+ GValue *old = ghb_array_get_nth(queue, ii);
+ ghb_value_free(old);
+ ghb_array_remove(queue, ii);
+ }
+ }
+ count = ghb_array_len(queue);
+ for (ii = 0; ii < count; ii++)
+ {
+ settings = ghb_array_get_nth(queue, ii);
+ ghb_settings_set_int(settings, "job_unique_id", 0);
+ ghb_settings_set_int(settings, "job_status", GHB_QUEUE_PENDING);
+ add_to_queue_list(ud, settings, NULL);
+ }
+ ghb_queue_buttons_grey(ud);
+ ghb_save_queue(ud->queue);
+ }
+ else
+ {
+ ghb_value_free(queue);
+ }
+ g_free(message);
+ }
+ return FALSE;
}
G_MODULE_EXPORT gboolean
queue_key_press_cb(
- GtkWidget *widget,
- GdkEventKey *event,
- signal_user_data_t *ud)
+ GtkWidget *widget,
+ GdkEventKey *event,
+ signal_user_data_t *ud)
{
- GtkTreeView *treeview;
- GtkTreeSelection *selection;
- GtkTreeModel *store;
- GtkTreeIter iter;
- gint row;
- gint *indices;
- gint unique_id;
- GValue *settings;
- gint status;
-
- g_debug("queue_key_press_cb ()");
- if (event->keyval != GDK_KEY_Delete)
- return FALSE;
- treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "queue_list"));
- store = gtk_tree_view_get_model(treeview);
-
- selection = gtk_tree_view_get_selection (treeview);
- if (gtk_tree_selection_get_selected(selection, &store, &iter))
- {
- GtkTreePath *treepath;
-
- treepath = gtk_tree_model_get_path (store, &iter);
- // Find the entry in the queue
- indices = gtk_tree_path_get_indices (treepath);
- row = indices[0];
- // Can only free the treepath After getting what I need from
- // indices since this points into treepath somewhere.
- gtk_tree_path_free (treepath);
- if (row < 0) return FALSE;
- if (row >= ghb_array_len(ud->queue))
- return FALSE;
- settings = ghb_array_get_nth(ud->queue, row);
- status = ghb_settings_get_int(settings, "job_status");
- if (status == GHB_QUEUE_RUNNING)
- {
- // Ask if wants to stop encode.
- if (!ghb_cancel_encode2(ud, NULL))
- {
- return TRUE;
- }
- unique_id = ghb_settings_get_int(settings, "job_unique_id");
- ghb_remove_job(unique_id);
- }
- // Remove the selected item
- gtk_tree_store_remove(GTK_TREE_STORE(store), &iter);
- // Remove the corresponding item from the queue list
- GValue *old = ghb_array_get_nth(ud->queue, row);
- ghb_value_free(old);
- ghb_array_remove(ud->queue, row);
- ghb_save_queue(ud->queue);
- return TRUE;
- }
- return FALSE;
+ GtkTreeView *treeview;
+ GtkTreeSelection *selection;
+ GtkTreeModel *store;
+ GtkTreeIter iter;
+ gint row;
+ gint *indices;
+ gint unique_id;
+ GValue *settings;
+ gint status;
+
+ g_debug("queue_key_press_cb ()");
+ if (event->keyval != GDK_KEY_Delete)
+ return FALSE;
+ treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "queue_list"));
+ store = gtk_tree_view_get_model(treeview);
+
+ selection = gtk_tree_view_get_selection (treeview);
+ if (gtk_tree_selection_get_selected(selection, &store, &iter))
+ {
+ GtkTreePath *treepath;
+
+ treepath = gtk_tree_model_get_path (store, &iter);
+ // Find the entry in the queue
+ indices = gtk_tree_path_get_indices (treepath);
+ row = indices[0];
+ // Can only free the treepath After getting what I need from
+ // indices since this points into treepath somewhere.
+ gtk_tree_path_free (treepath);
+ if (row < 0) return FALSE;
+ if (row >= ghb_array_len(ud->queue))
+ return FALSE;
+ settings = ghb_array_get_nth(ud->queue, row);
+ status = ghb_settings_get_int(settings, "job_status");
+ if (status == GHB_QUEUE_RUNNING)
+ {
+ // Ask if wants to stop encode.
+ if (!ghb_cancel_encode2(ud, NULL))
+ {
+ return TRUE;
+ }
+ unique_id = ghb_settings_get_int(settings, "job_unique_id");
+ ghb_remove_job(unique_id);
+ }
+ // Remove the selected item
+ gtk_tree_store_remove(GTK_TREE_STORE(store), &iter);
+ // Remove the corresponding item from the queue list
+ GValue *old = ghb_array_get_nth(ud->queue, row);
+ ghb_value_free(old);
+ ghb_array_remove(ud->queue, row);
+ ghb_save_queue(ud->queue);
+ return TRUE;
+ }
+ return FALSE;
}
GValue *ghb_queue_edit_settings = NULL;
@@ -1371,50 +1371,50 @@ GValue *ghb_queue_edit_settings = NULL;
G_MODULE_EXPORT void
queue_edit_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud)
{
- GtkTreeView *treeview;
- GtkTreeSelection *selection;
- GtkTreeModel *store;
- GtkTreeIter iter;
- gint row;
- gint *indices;
- gint status;
-
- g_debug("queue_key_press_cb ()");
- treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "queue_list"));
- store = gtk_tree_view_get_model(treeview);
-
- selection = gtk_tree_view_get_selection (treeview);
- if (gtk_tree_selection_get_selected(selection, &store, &iter))
- {
- GtkTreePath *treepath;
-
- treepath = gtk_tree_model_get_path (store, &iter);
- // Find the entry in the queue
- indices = gtk_tree_path_get_indices (treepath);
- row = indices[0];
- // Can only free the treepath After getting what I need from
- // indices since this points into treepath somewhere.
- gtk_tree_path_free (treepath);
- if (row < 0) return;
- if (row >= ghb_array_len(ud->queue))
- return;
- ghb_queue_edit_settings = ghb_array_get_nth(ud->queue, row);
- status = ghb_settings_get_int(ghb_queue_edit_settings, "job_status");
- if (status == GHB_QUEUE_PENDING)
- {
- // Remove the selected item
- gtk_tree_store_remove(GTK_TREE_STORE(store), &iter);
- // Remove the corresponding item from the queue list
- ghb_array_remove(ud->queue, row);
- }
- else
- {
- ghb_queue_edit_settings = ghb_value_dup(ghb_queue_edit_settings);
- }
- gchar *source;
- source = ghb_settings_get_string(ghb_queue_edit_settings, "source");
- ghb_do_scan(ud, source, 0, FALSE);
- g_free(source);
- }
+ GtkTreeView *treeview;
+ GtkTreeSelection *selection;
+ GtkTreeModel *store;
+ GtkTreeIter iter;
+ gint row;
+ gint *indices;
+ gint status;
+
+ g_debug("queue_key_press_cb ()");
+ treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "queue_list"));
+ store = gtk_tree_view_get_model(treeview);
+
+ selection = gtk_tree_view_get_selection (treeview);
+ if (gtk_tree_selection_get_selected(selection, &store, &iter))
+ {
+ GtkTreePath *treepath;
+
+ treepath = gtk_tree_model_get_path (store, &iter);
+ // Find the entry in the queue
+ indices = gtk_tree_path_get_indices (treepath);
+ row = indices[0];
+ // Can only free the treepath After getting what I need from
+ // indices since this points into treepath somewhere.
+ gtk_tree_path_free (treepath);
+ if (row < 0) return;
+ if (row >= ghb_array_len(ud->queue))
+ return;
+ ghb_queue_edit_settings = ghb_array_get_nth(ud->queue, row);
+ status = ghb_settings_get_int(ghb_queue_edit_settings, "job_status");
+ if (status == GHB_QUEUE_PENDING)
+ {
+ // Remove the selected item
+ gtk_tree_store_remove(GTK_TREE_STORE(store), &iter);
+ // Remove the corresponding item from the queue list
+ ghb_array_remove(ud->queue, row);
+ }
+ else
+ {
+ ghb_queue_edit_settings = ghb_value_dup(ghb_queue_edit_settings);
+ }
+ gchar *source;
+ source = ghb_settings_get_string(ghb_queue_edit_settings, "source");
+ ghb_do_scan(ud, source, 0, FALSE);
+ g_free(source);
+ }
}
diff --git a/gtk/src/queuehandler.h b/gtk/src/queuehandler.h
index a8c103ac9..734968109 100644
--- a/gtk/src/queuehandler.h
+++ b/gtk/src/queuehandler.h
@@ -17,9 +17,9 @@
*
* You should have received a copy of the GNU General Public License
* along with callbacks.h. If not, write to:
- * The Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301, USA.
+ * The Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301, USA.
*/
#if !defined(_QUEUEHANDLER_H_)
diff --git a/gtk/src/quotestring.c b/gtk/src/quotestring.c
index c691f5f7f..f29969bd2 100644
--- a/gtk/src/quotestring.c
+++ b/gtk/src/quotestring.c
@@ -35,44 +35,44 @@ main(int argc, char *argv[])
}
while (fgets(in_buffer, BUF_SIZE, infile) != NULL)
{
- int ii, jj;
+ int ii, jj;
int len;
- int eol = 0;
+ int eol = 0;
// Step on any CR LF at end of line
len = strlen(in_buffer);
- if (len > 1 && in_buffer[len-1] == '\n' && in_buffer[len-2] == '\r')
- {
- in_buffer[len-1] = 0;
- in_buffer[len-2] = 0;
- eol = 1;
- }
- else if (len > 0 && in_buffer[len-1] == '\n')
- {
- in_buffer[len-1] = 0;
- eol = 1;
- }
- for (jj = 0, ii = 0; ii < len; ii++)
- {
- if (in_buffer[ii] == '"')
- {
- out_buffer[jj++] = '\\';
- out_buffer[jj++] = in_buffer[ii];
- }
- else if (in_buffer[ii] == '\r')
- { // Skip it
- }
- else
- {
- out_buffer[jj++] = in_buffer[ii];
- }
- }
- out_buffer[jj] = 0;
- if (eol)
- fprintf(outfile, "\"%s\\n\"\n", out_buffer);
- else
- fprintf(outfile, "\"%s\"\n", out_buffer);
+ if (len > 1 && in_buffer[len-1] == '\n' && in_buffer[len-2] == '\r')
+ {
+ in_buffer[len-1] = 0;
+ in_buffer[len-2] = 0;
+ eol = 1;
+ }
+ else if (len > 0 && in_buffer[len-1] == '\n')
+ {
+ in_buffer[len-1] = 0;
+ eol = 1;
+ }
+ for (jj = 0, ii = 0; ii < len; ii++)
+ {
+ if (in_buffer[ii] == '"')
+ {
+ out_buffer[jj++] = '\\';
+ out_buffer[jj++] = in_buffer[ii];
+ }
+ else if (in_buffer[ii] == '\r')
+ { // Skip it
+ }
+ else
+ {
+ out_buffer[jj++] = in_buffer[ii];
+ }
+ }
+ out_buffer[jj] = 0;
+ if (eol)
+ fprintf(outfile, "\"%s\\n\"\n", out_buffer);
+ else
+ fprintf(outfile, "\"%s\"\n", out_buffer);
}
fclose(infile);
fclose(outfile);
- return 0;
+ return 0;
}
diff --git a/gtk/src/quotestring.py b/gtk/src/quotestring.py
index ee6acb36c..1c0c5b2d1 100644
--- a/gtk/src/quotestring.py
+++ b/gtk/src/quotestring.py
@@ -5,59 +5,59 @@ import getopt
import sys
def usage():
- print >> sys.stderr, (
- "Usage: %s <input> [output]\n"
- "Summary:\n"
- " Creates a quoted string suitable for inclusion in a C char*\n\n"
- "Options:\n"
- " <input> Input file to quote\n"
- " <output> Output quoted string [stdout]\n"
- % sys.argv[0]
- )
+ print >> sys.stderr, (
+ "Usage: %s <input> [output]\n"
+ "Summary:\n"
+ " Creates a quoted string suitable for inclusion in a C char*\n\n"
+ "Options:\n"
+ " <input> Input file to quote\n"
+ " <output> Output quoted string [stdout]\n"
+ % sys.argv[0]
+ )
def main():
- global inc_list
-
- OPTS = ""
- try:
- opts, args = getopt.gnu_getopt(sys.argv[1:], OPTS)
- except getopt.GetoptError, err:
- print >> sys.stderr, str(err)
- usage()
- sys.exit(2)
-
- for o, a in opts:
- usage()
- assert False, "unhandled option"
-
- if len(args) > 2 or len(args) < 1:
- usage()
- sys.exit(2)
-
- try:
- infile = open(args[0])
- except Exception, err:
- print >> sys.stderr, ( "Error: %s" % str(err) )
- sys.exit(1)
-
- if len(args) > 1:
- try:
- outfile = open(args[1], "w")
- except Exception, err:
- print >> sys.stderr, ( "Error: %s" % str(err))
- sys.exit(1)
- else:
- outfile = sys.stdout
-
- ss = infile.read()
- ss = re.sub("\"", "\\\"", ss)
- pattern = re.compile("$", re.M)
- # the replacement string below seems a bit strange, but it seems to be
- # the only way to get the litteral chars '\' 'n' inserted into the string
- ss = re.sub(pattern, "\\\\n\"", ss)
- pattern = re.compile("^", re.M)
- ss = re.sub(pattern, "\"", ss)
- outfile.write(ss)
+ global inc_list
+
+ OPTS = ""
+ try:
+ opts, args = getopt.gnu_getopt(sys.argv[1:], OPTS)
+ except getopt.GetoptError, err:
+ print >> sys.stderr, str(err)
+ usage()
+ sys.exit(2)
+
+ for o, a in opts:
+ usage()
+ assert False, "unhandled option"
+
+ if len(args) > 2 or len(args) < 1:
+ usage()
+ sys.exit(2)
+
+ try:
+ infile = open(args[0])
+ except Exception, err:
+ print >> sys.stderr, ( "Error: %s" % str(err) )
+ sys.exit(1)
+
+ if len(args) > 1:
+ try:
+ outfile = open(args[1], "w")
+ except Exception, err:
+ print >> sys.stderr, ( "Error: %s" % str(err))
+ sys.exit(1)
+ else:
+ outfile = sys.stdout
+
+ ss = infile.read()
+ ss = re.sub("\"", "\\\"", ss)
+ pattern = re.compile("$", re.M)
+ # the replacement string below seems a bit strange, but it seems to be
+ # the only way to get the litteral chars '\' 'n' inserted into the string
+ ss = re.sub(pattern, "\\\\n\"", ss)
+ pattern = re.compile("^", re.M)
+ ss = re.sub(pattern, "\"", ss)
+ outfile.write(ss)
main()
diff --git a/gtk/src/renderer_button.c b/gtk/src/renderer_button.c
index c7e28f1ed..bcc1fc352 100644
--- a/gtk/src/renderer_button.c
+++ b/gtk/src/renderer_button.c
@@ -17,12 +17,12 @@ static void custom_cell_renderer_button_finalize (GObject *gobject);
// My customized part that adds "clicked" signal
static gboolean
custom_cell_renderer_button_activate (GtkCellRenderer *cell,
- GdkEvent *event,
- GtkWidget *widget,
- const gchar *path,
- GdkRectangle *background_area,
- GdkRectangle *cell_area,
- GtkCellRendererState flags);
+ GdkEvent *event,
+ GtkWidget *widget,
+ const gchar *path,
+ GdkRectangle *background_area,
+ GdkRectangle *cell_area,
+ GtkCellRendererState flags);
enum {
CLICKED,
@@ -44,31 +44,31 @@ static gpointer parent_class;
GType
custom_cell_renderer_button_get_type (void)
{
- static GType cell_button_type = 0;
-
- if (cell_button_type == 0)
- {
- static const GTypeInfo cell_button_info =
- {
- sizeof (CustomCellRendererButtonClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) custom_cell_renderer_button_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (CustomCellRendererButton),
- 0, /* n_preallocs */
- (GInstanceInitFunc) custom_cell_renderer_button_init,
- };
-
- /* Derive from GtkCellRendererPixbuf */
- cell_button_type = g_type_register_static (GTK_TYPE_CELL_RENDERER_PIXBUF,
- "CustomCellRendererButton",
- &cell_button_info,
- 0);
- }
-
- return cell_button_type;
+ static GType cell_button_type = 0;
+
+ if (cell_button_type == 0)
+ {
+ static const GTypeInfo cell_button_info =
+ {
+ sizeof (CustomCellRendererButtonClass),
+ NULL, /* base_init */
+ NULL, /* base_finalize */
+ (GClassInitFunc) custom_cell_renderer_button_class_init,
+ NULL, /* class_finalize */
+ NULL, /* class_data */
+ sizeof (CustomCellRendererButton),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) custom_cell_renderer_button_init,
+ };
+
+ /* Derive from GtkCellRendererPixbuf */
+ cell_button_type = g_type_register_static (GTK_TYPE_CELL_RENDERER_PIXBUF,
+ "CustomCellRendererButton",
+ &cell_button_info,
+ 0);
+ }
+
+ return cell_button_type;
}
/***************************************************************************
@@ -80,9 +80,9 @@ custom_cell_renderer_button_get_type (void)
static void
custom_cell_renderer_button_init (CustomCellRendererButton *cellbutton)
{
- g_object_set(cellbutton, "mode", GTK_CELL_RENDERER_MODE_ACTIVATABLE, NULL);
- g_object_set(cellbutton, "xpad", 2, NULL);
- g_object_set(cellbutton, "ypad", 2, NULL);
+ g_object_set(cellbutton, "mode", GTK_CELL_RENDERER_MODE_ACTIVATABLE, NULL);
+ g_object_set(cellbutton, "xpad", 2, NULL);
+ g_object_set(cellbutton, "ypad", 2, NULL);
}
/***************************************************************************
@@ -99,29 +99,29 @@ custom_cell_renderer_button_init (CustomCellRendererButton *cellbutton)
static void
custom_cell_renderer_button_class_init (CustomCellRendererButtonClass *klass)
{
- GtkCellRendererClass *cell_class = GTK_CELL_RENDERER_CLASS(klass);
- GObjectClass *object_class = G_OBJECT_CLASS(klass);
-
- parent_class = g_type_class_peek_parent (klass);
- object_class->finalize = custom_cell_renderer_button_finalize;
-
- /* Hook up functions to set and get our
- * custom cell renderer properties */
- object_class->get_property = custom_cell_renderer_button_get_property;
- object_class->set_property = custom_cell_renderer_button_set_property;
-
- // Override activate
- cell_class->activate = custom_cell_renderer_button_activate;
-
- button_cell_signals[CLICKED] =
- g_signal_new (g_intern_static_string ("clicked"),
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (CustomCellRendererButtonClass, clicked),
- NULL, NULL,
- ghb_marshal_VOID__STRING,
- G_TYPE_NONE, 1,
- G_TYPE_STRING);
+ GtkCellRendererClass *cell_class = GTK_CELL_RENDERER_CLASS(klass);
+ GObjectClass *object_class = G_OBJECT_CLASS(klass);
+
+ parent_class = g_type_class_peek_parent (klass);
+ object_class->finalize = custom_cell_renderer_button_finalize;
+
+ /* Hook up functions to set and get our
+ * custom cell renderer properties */
+ object_class->get_property = custom_cell_renderer_button_get_property;
+ object_class->set_property = custom_cell_renderer_button_set_property;
+
+ // Override activate
+ cell_class->activate = custom_cell_renderer_button_activate;
+
+ button_cell_signals[CLICKED] =
+ g_signal_new (g_intern_static_string ("clicked"),
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (CustomCellRendererButtonClass, clicked),
+ NULL, NULL,
+ ghb_marshal_VOID__STRING,
+ G_TYPE_NONE, 1,
+ G_TYPE_STRING);
}
/***************************************************************************
@@ -132,14 +132,14 @@ custom_cell_renderer_button_class_init (CustomCellRendererButtonClass *klass)
static void
custom_cell_renderer_button_finalize (GObject *object)
{
- /*
- If you need to do anyting with the renderer button ...
- CustomCellRendererProgress *cellrendererbutton = CUSTOM_CELL_RENDERER_BUTTON(object);
- */
+ /*
+ If you need to do anyting with the renderer button ...
+ CustomCellRendererProgress *cellrendererbutton = CUSTOM_CELL_RENDERER_BUTTON(object);
+ */
- /* Free any dynamically allocated resources here */
+ /* Free any dynamically allocated resources here */
- (* G_OBJECT_CLASS (parent_class)->finalize) (object);
+ (* G_OBJECT_CLASS (parent_class)->finalize) (object);
}
/***************************************************************************
@@ -153,14 +153,14 @@ custom_cell_renderer_button_get_property (GObject *object,
GValue *value,
GParamSpec *psec)
{
- //CustomCellRendererButton *cellbutton = CUSTOM_CELL_RENDERER_BUTTON(object);
-
- switch (param_id)
- {
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, psec);
- break;
- }
+ //CustomCellRendererButton *cellbutton = CUSTOM_CELL_RENDERER_BUTTON(object);
+
+ switch (param_id)
+ {
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, psec);
+ break;
+ }
}
/***************************************************************************
@@ -174,14 +174,14 @@ custom_cell_renderer_button_set_property (GObject *object,
const GValue *value,
GParamSpec *pspec)
{
- //CustomCellRendererButton *cellbutton = CUSTOM_CELL_RENDERER_BUTTON(object);
-
- switch (param_id)
- {
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID(object, param_id, pspec);
- break;
- }
+ //CustomCellRendererButton *cellbutton = CUSTOM_CELL_RENDERER_BUTTON(object);
+
+ switch (param_id)
+ {
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, param_id, pspec);
+ break;
+ }
}
/***************************************************************************
@@ -192,19 +192,19 @@ custom_cell_renderer_button_set_property (GObject *object,
GtkCellRenderer *
custom_cell_renderer_button_new (void)
{
- return g_object_new(CUSTOM_TYPE_CELL_RENDERER_BUTTON, NULL);
+ return g_object_new(CUSTOM_TYPE_CELL_RENDERER_BUTTON, NULL);
}
static gboolean
custom_cell_renderer_button_activate (GtkCellRenderer *cell,
- GdkEvent *event,
- GtkWidget *widget,
- const gchar *path,
- GdkRectangle *background_area,
- GdkRectangle *cell_area,
- GtkCellRendererState flags)
+ GdkEvent *event,
+ GtkWidget *widget,
+ const gchar *path,
+ GdkRectangle *background_area,
+ GdkRectangle *cell_area,
+ GtkCellRendererState flags)
{
- g_debug("custom_cell_renderer_button_activate ()\n");
- g_signal_emit (cell, button_cell_signals[CLICKED], 0, path);
- return TRUE;
+ g_debug("custom_cell_renderer_button_activate ()\n");
+ g_signal_emit (cell, button_cell_signals[CLICKED], 0, path);
+ return TRUE;
}
diff --git a/gtk/src/renderer_button.h b/gtk/src/renderer_button.h
index dc898e4eb..4c2f1f9a8 100644
--- a/gtk/src/renderer_button.h
+++ b/gtk/src/renderer_button.h
@@ -20,15 +20,15 @@ typedef struct _CustomCellRendererButtonClass CustomCellRendererButtonClass;
* structure. Extend according to need */
struct _CustomCellRendererButton
{
- GtkCellRendererPixbuf parent;
+ GtkCellRendererPixbuf parent;
};
struct _CustomCellRendererButtonClass
{
- GtkCellRendererPixbufClass parent_class;
+ GtkCellRendererPixbufClass parent_class;
- void (* clicked) (CustomCellRendererButton *cell_renderer_button,
- const gchar *path);
+ void (* clicked) (CustomCellRendererButton *cell_renderer_button,
+ const gchar *path);
};
GType custom_cell_renderer_button_get_type (void);
diff --git a/gtk/src/resources.c b/gtk/src/resources.c
index c2255013f..283d8d772 100644
--- a/gtk/src/resources.c
+++ b/gtk/src/resources.c
@@ -30,13 +30,13 @@ static GValue *resources;
void
ghb_resource_init()
{
- resources = ghb_plist_parse(resource_str, sizeof(resource_str)-1);
+ resources = ghb_plist_parse(resource_str, sizeof(resource_str)-1);
}
GValue*
ghb_resource_get(const gchar *name)
{
- GValue *result;
- result = ghb_dict_lookup(resources, name);
- return result;
+ GValue *result;
+ result = ghb_dict_lookup(resources, name);
+ return result;
}
diff --git a/gtk/src/resources.list b/gtk/src/resources.list
index e0a0781b5..cc31d5a93 100644
--- a/gtk/src/resources.list
+++ b/gtk/src/resources.list
@@ -1,51 +1,51 @@
<resources>
- <section name="icons">
- <icon name="hb-activity.32" file="hb-activity.32.png" />
- <icon name="hb-activity.64" file="hb-activity.64.png" />
- <icon name="hb-add-queue.32" file="hb-add-queue.32.png" />
- <icon name="hb-add-queue.64" file="hb-add-queue.64.png" />
- <icon name="hb-canceled" file="hb-canceled.16.png" />
- <icon name="hb-complete" file="hb-complete.16.png" />
- <icon name="hb-icon.256" file="hb-icon.256.png" />
- <icon name="hb-icon.128" file="hb-icon.128.png" />
- <icon name="hb-icon.64" file="hb-icon.64.png" />
- <icon name="hb-icon.48" file="hb-icon.48.png" />
- <icon name="hb-icon.32" file="hb-icon.32.png" />
- <icon name="hb-icon.24" file="hb-icon.24.png" />
- <icon name="hb-icon.22" file="hb-icon.22.png" />
- <icon name="hb-icon.16" file="hb-icon.16.png" />
- <icon name="hb-status" file="hb-status.32.png" />
- <icon name="hb-status-empty" file="hb-status-empty.32.png" />
- <icon name="hb-pause.32" file="hb-pause.32.png" />
- <icon name="hb-pause.64" file="hb-pause.64.png" />
- <icon name="hb-start.32" file="hb-start.32.png" />
- <icon name="hb-start.64" file="hb-start.64.png" />
- <icon name="hb-pref" file="hb-pref.32.png" />
- <icon name="hb-picture.32" file="hb-picture.32.png" />
- <icon name="hb-picture.64" file="hb-picture.64.png" />
- <icon name="hb-queue.32" file="hb-showqueue.32.png" />
- <icon name="hb-queue.64" file="hb-showqueue.32.png" />
- <icon name="hb-queue-delete" file="hb-remove.24.png" />
- <icon name="hb-queue-job" file="hb-queue-job.16.png" />
- <icon name="hb-queue-pass1" file="hb-queue-pass1.16.png" />
- <icon name="hb-queue-pass2" file="hb-queue-pass2.16.png" />
- <icon name="hb-queue-subtitle" file="hb-queue-subtitle.16.png" />
- <icon name="hb-remove" file="hb-remove.48.png" />
- <icon name="hb-source.32" file="hb-source.32.png" />
- <icon name="hb-source.64" file="hb-source.64.png" />
- <icon name="hb-stop.32" file="hb-stop.32.png" />
- <icon name="hb-stop.64" file="hb-stop.64.png" />
- <icon name="hb-edit" file="hb-edit.32.png" />
- <icon name="hb-working0" file="hb-working0.16.png" />
- <icon name="hb-working1" file="hb-working1.16.png" />
- <icon name="hb-working2" file="hb-working2.16.png" />
- <icon name="hb-working3" file="hb-working3.16.png" />
- <icon name="hb-working4" file="hb-working4.16.png" />
- <icon name="hb-working5" file="hb-working5.16.png" />
- </section>
- <plist name="internal-defaults" file="internal_defaults.xml" />
- <plist name="standard-presets" file="standard_presets.xml" />
- <plist name="widget-deps" file="widget.deps" />
- <plist name="widget-reverse-deps" file="widget_reverse.deps" />
- <string name="ghb-ui" file="ghb.ui" />
+ <section name="icons">
+ <icon name="hb-activity.32" file="hb-activity.32.png" />
+ <icon name="hb-activity.64" file="hb-activity.64.png" />
+ <icon name="hb-add-queue.32" file="hb-add-queue.32.png" />
+ <icon name="hb-add-queue.64" file="hb-add-queue.64.png" />
+ <icon name="hb-canceled" file="hb-canceled.16.png" />
+ <icon name="hb-complete" file="hb-complete.16.png" />
+ <icon name="hb-icon.256" file="hb-icon.256.png" />
+ <icon name="hb-icon.128" file="hb-icon.128.png" />
+ <icon name="hb-icon.64" file="hb-icon.64.png" />
+ <icon name="hb-icon.48" file="hb-icon.48.png" />
+ <icon name="hb-icon.32" file="hb-icon.32.png" />
+ <icon name="hb-icon.24" file="hb-icon.24.png" />
+ <icon name="hb-icon.22" file="hb-icon.22.png" />
+ <icon name="hb-icon.16" file="hb-icon.16.png" />
+ <icon name="hb-status" file="hb-status.32.png" />
+ <icon name="hb-status-empty" file="hb-status-empty.32.png" />
+ <icon name="hb-pause.32" file="hb-pause.32.png" />
+ <icon name="hb-pause.64" file="hb-pause.64.png" />
+ <icon name="hb-start.32" file="hb-start.32.png" />
+ <icon name="hb-start.64" file="hb-start.64.png" />
+ <icon name="hb-pref" file="hb-pref.32.png" />
+ <icon name="hb-picture.32" file="hb-picture.32.png" />
+ <icon name="hb-picture.64" file="hb-picture.64.png" />
+ <icon name="hb-queue.32" file="hb-showqueue.32.png" />
+ <icon name="hb-queue.64" file="hb-showqueue.32.png" />
+ <icon name="hb-queue-delete" file="hb-remove.24.png" />
+ <icon name="hb-queue-job" file="hb-queue-job.16.png" />
+ <icon name="hb-queue-pass1" file="hb-queue-pass1.16.png" />
+ <icon name="hb-queue-pass2" file="hb-queue-pass2.16.png" />
+ <icon name="hb-queue-subtitle" file="hb-queue-subtitle.16.png" />
+ <icon name="hb-remove" file="hb-remove.48.png" />
+ <icon name="hb-source.32" file="hb-source.32.png" />
+ <icon name="hb-source.64" file="hb-source.64.png" />
+ <icon name="hb-stop.32" file="hb-stop.32.png" />
+ <icon name="hb-stop.64" file="hb-stop.64.png" />
+ <icon name="hb-edit" file="hb-edit.32.png" />
+ <icon name="hb-working0" file="hb-working0.16.png" />
+ <icon name="hb-working1" file="hb-working1.16.png" />
+ <icon name="hb-working2" file="hb-working2.16.png" />
+ <icon name="hb-working3" file="hb-working3.16.png" />
+ <icon name="hb-working4" file="hb-working4.16.png" />
+ <icon name="hb-working5" file="hb-working5.16.png" />
+ </section>
+ <plist name="internal-defaults" file="internal_defaults.xml" />
+ <plist name="standard-presets" file="standard_presets.xml" />
+ <plist name="widget-deps" file="widget.deps" />
+ <plist name="widget-reverse-deps" file="widget_reverse.deps" />
+ <string name="ghb-ui" file="ghb.ui" />
</resources>
diff --git a/gtk/src/settings.c b/gtk/src/settings.c
index dbfead67c..e883fae1b 100644
--- a/gtk/src/settings.c
+++ b/gtk/src/settings.c
@@ -27,153 +27,153 @@ void ghb_pref_audio_init(signal_user_data_t *ud);
GObject*
debug_get_object(GtkBuilder* b, const gchar *n)
{
- g_message("name %s\n", n);
- return gtk_builder_get_object(b, n);
+ g_message("name %s\n", n);
+ return gtk_builder_get_object(b, n);
}
GValue*
ghb_settings_new()
{
- return ghb_dict_value_new();
+ return ghb_dict_value_new();
}
void
ghb_settings_set_value(
- GValue *settings,
- const gchar *key,
- const GValue *value)
+ GValue *settings,
+ const gchar *key,
+ const GValue *value)
{
- if (key == NULL || value == NULL)
- return;
- ghb_dict_insert(settings, g_strdup(key), ghb_value_dup(value));
+ if (key == NULL || value == NULL)
+ return;
+ ghb_dict_insert(settings, g_strdup(key), ghb_value_dup(value));
}
void
ghb_settings_take_value(GValue *settings, const gchar *key, GValue *value)
{
- ghb_dict_insert(settings, g_strdup(key), value);
+ ghb_dict_insert(settings, g_strdup(key), value);
}
void
ghb_settings_set_string(
- GValue *settings,
- const gchar *key,
- const gchar *sval)
+ GValue *settings,
+ const gchar *key,
+ const gchar *sval)
{
- GValue *value;
- value = ghb_string_value_new(sval);
- ghb_dict_insert(settings, g_strdup(key), value);
+ GValue *value;
+ value = ghb_string_value_new(sval);
+ ghb_dict_insert(settings, g_strdup(key), value);
}
void
ghb_settings_set_double(GValue *settings, const gchar *key, gdouble dval)
{
- GValue *value;
- value = ghb_double_value_new(dval);
- ghb_dict_insert(settings, g_strdup(key), value);
+ GValue *value;
+ value = ghb_double_value_new(dval);
+ ghb_dict_insert(settings, g_strdup(key), value);
}
void
ghb_settings_set_int64(GValue *settings, const gchar *key, gint64 ival)
{
- GValue *value;
- value = ghb_int64_value_new(ival);
- ghb_dict_insert(settings, g_strdup(key), value);
+ GValue *value;
+ value = ghb_int64_value_new(ival);
+ ghb_dict_insert(settings, g_strdup(key), value);
}
void
ghb_settings_set_int(GValue *settings, const gchar *key, gint ival)
{
- GValue *value;
- value = ghb_int64_value_new((gint64)ival);
- ghb_dict_insert(settings, g_strdup(key), value);
+ GValue *value;
+ value = ghb_int64_value_new((gint64)ival);
+ ghb_dict_insert(settings, g_strdup(key), value);
}
void
ghb_settings_set_boolean(GValue *settings, const gchar *key, gboolean bval)
{
- GValue *value;
- value = ghb_boolean_value_new(bval);
- ghb_dict_insert(settings, g_strdup(key), value);
+ GValue *value;
+ value = ghb_boolean_value_new(bval);
+ ghb_dict_insert(settings, g_strdup(key), value);
}
GValue*
ghb_settings_get_value(const GValue *settings, const gchar *key)
{
- GValue *value;
- value = ghb_dict_lookup(settings, key);
- if (value == NULL)
- g_warning("returning null (%s)", key);
- return value;
+ GValue *value;
+ value = ghb_dict_lookup(settings, key);
+ if (value == NULL)
+ g_warning("returning null (%s)", key);
+ return value;
}
gboolean
ghb_settings_get_boolean(const GValue *settings, const gchar *key)
{
- const GValue* value;
- value = ghb_settings_get_value(settings, key);
- if (value == NULL) return FALSE;
- return ghb_value_boolean(value);
+ const GValue* value;
+ value = ghb_settings_get_value(settings, key);
+ if (value == NULL) return FALSE;
+ return ghb_value_boolean(value);
}
gint64
ghb_settings_get_int64(const GValue *settings, const gchar *key)
{
- const GValue* value;
- value = ghb_settings_get_value(settings, key);
- if (value == NULL) return 0;
- return ghb_value_int64(value);
+ const GValue* value;
+ value = ghb_settings_get_value(settings, key);
+ if (value == NULL) return 0;
+ return ghb_value_int64(value);
}
gint
ghb_settings_get_int(const GValue *settings, const gchar *key)
{
- const GValue* value;
- value = ghb_settings_get_value(settings, key);
- if (value == NULL) return 0;
- return ghb_value_int(value);
+ const GValue* value;
+ value = ghb_settings_get_value(settings, key);
+ if (value == NULL) return 0;
+ return ghb_value_int(value);
}
gdouble
ghb_settings_get_double(const GValue *settings, const gchar *key)
{
- const GValue* value;
- value = ghb_settings_get_value(settings, key);
- if (value == NULL) return 0;
- return ghb_value_double(value);
+ const GValue* value;
+ value = ghb_settings_get_value(settings, key);
+ if (value == NULL) return 0;
+ return ghb_value_double(value);
}
gchar*
ghb_settings_get_string(const GValue *settings, const gchar *key)
{
- const GValue* value;
- value = ghb_settings_get_value(settings, key);
- if (value == NULL) return g_strdup("");
- return ghb_value_string(value);
+ const GValue* value;
+ value = ghb_settings_get_value(settings, key);
+ if (value == NULL) return g_strdup("");
+ return ghb_value_string(value);
}
gint
ghb_settings_combo_int(const GValue *settings, const gchar *key)
{
- return ghb_lookup_combo_int(key, ghb_settings_get_value(settings, key));
+ return ghb_lookup_combo_int(key, ghb_settings_get_value(settings, key));
}
gdouble
ghb_settings_combo_double(const GValue *settings, const gchar *key)
{
- return ghb_lookup_combo_double(key, ghb_settings_get_value(settings, key));
+ return ghb_lookup_combo_double(key, ghb_settings_get_value(settings, key));
}
const gchar*
ghb_settings_combo_option(const GValue *settings, const gchar *key)
{
- return ghb_lookup_combo_option(key, ghb_settings_get_value(settings, key));
+ return ghb_lookup_combo_option(key, ghb_settings_get_value(settings, key));
}
const gchar*
ghb_settings_combo_string(const GValue *settings, const gchar *key)
{
- return ghb_lookup_combo_string(key, ghb_settings_get_value(settings, key));
+ return ghb_lookup_combo_string(key, ghb_settings_get_value(settings, key));
}
// Map widget names to setting keys
@@ -182,570 +182,570 @@ ghb_settings_combo_string(const GValue *settings, const gchar *key)
const gchar*
ghb_get_setting_key(GtkWidget *widget)
{
- const gchar *name;
-
- g_debug("get_setting_key ()\n");
- if (widget == NULL) return NULL;
- name = gtk_buildable_get_name(GTK_BUILDABLE(widget));
-
- if (name == NULL)
- {
- // Bad widget pointer? Should never happen.
- g_debug("Bad widget\n");
- return NULL;
- }
- return name;
+ const gchar *name;
+
+ g_debug("get_setting_key ()\n");
+ if (widget == NULL) return NULL;
+ name = gtk_buildable_get_name(GTK_BUILDABLE(widget));
+
+ if (name == NULL)
+ {
+ // Bad widget pointer? Should never happen.
+ g_debug("Bad widget\n");
+ return NULL;
+ }
+ return name;
}
GValue*
ghb_widget_value(GtkWidget *widget)
{
- GValue *value = NULL;
- const gchar *name;
- GType type;
-
- if (widget == NULL)
- {
- g_debug("NULL widget\n");
- return NULL;
- }
-
- type = G_OBJECT_TYPE(widget);
- name = ghb_get_setting_key(widget);
- g_debug("ghb_widget_value widget (%s)\n", name);
- if (type == GTK_TYPE_ENTRY)
- {
- const gchar *str = gtk_entry_get_text(GTK_ENTRY(widget));
- value = ghb_string_value_new(str);
- }
- else if (type == GTK_TYPE_RADIO_BUTTON)
- {
- g_debug("\tradio_button");
- gboolean bval;
- bval = gtk_toggle_button_get_inconsistent(GTK_TOGGLE_BUTTON(widget));
- if (bval)
- {
- value = ghb_boolean_value_new(FALSE);
- }
- else
- {
- bval = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
- value = ghb_boolean_value_new(bval);
- }
- }
- else if (type == GTK_TYPE_CHECK_BUTTON)
- {
- g_debug("\tcheck_button");
- gboolean bval;
- bval = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
- value = ghb_boolean_value_new(bval);
- }
- else if (type == GTK_TYPE_TOGGLE_TOOL_BUTTON)
- {
- g_debug("\ttoggle_tool_button");
- gboolean bval;
- bval = gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(widget));
- value = ghb_boolean_value_new(bval);
- }
- else if (type == GTK_TYPE_TOGGLE_BUTTON)
- {
- g_debug("\ttoggle_button");
- gboolean bval;
- bval = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
- value = ghb_boolean_value_new(bval);
- }
- else if (type == GTK_TYPE_TOGGLE_ACTION)
- {
- g_debug("\ttoggle action");
- gboolean bval;
- bval = gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(widget));
- value = ghb_boolean_value_new(bval);
- }
- else if (type == GTK_TYPE_CHECK_MENU_ITEM)
- {
- g_debug("\tcheck_menu_item");
- gboolean bval;
- bval = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget));
- value = ghb_boolean_value_new(bval);
- }
- else if (type == GTK_TYPE_COMBO_BOX)
- {
- g_debug("\tcombo_box");
- GtkTreeModel *store;
- GtkTreeIter iter;
- gchar *shortOpt;
-
- store = gtk_combo_box_get_model(GTK_COMBO_BOX(widget));
- if (gtk_combo_box_get_active_iter(GTK_COMBO_BOX(widget), &iter))
- {
- gtk_tree_model_get(store, &iter, 2, &shortOpt, -1);
- value = ghb_string_value_new(shortOpt);
- g_free(shortOpt);
- }
- else
- {
- value = ghb_string_value_new("");
- }
- }
- else if (type == GTK_TYPE_COMBO_BOX_ENTRY)
- {
- GtkTreeModel *store;
- GtkTreeIter iter;
- gchar *shortOpt;
-
- g_debug("\tcombo_box_entry");
- store = gtk_combo_box_get_model(GTK_COMBO_BOX(widget));
- if (gtk_combo_box_get_active_iter(GTK_COMBO_BOX(widget), &iter))
- {
- gtk_tree_model_get(store, &iter, 2, &shortOpt, -1);
- value = ghb_string_value_new(shortOpt);
- g_free(shortOpt);
- }
- else
- {
- const gchar *str;
- str = gtk_combo_box_get_active_text(GTK_COMBO_BOX(widget));
- if (str == NULL) str = "";
- value = ghb_string_value_new(str);
- }
- }
- else if (type == GTK_TYPE_SPIN_BUTTON)
- {
- gint ival;
- ival = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
- value = ghb_int64_value_new(ival);
- }
- else if (type == GTK_TYPE_HSCALE)
- {
- gdouble dval;
- gint digits;
-
- digits = gtk_scale_get_digits(GTK_SCALE(widget));
- dval = gtk_range_get_value(GTK_RANGE(widget));
- if (digits)
- {
- value = ghb_double_value_new(dval);
- }
- else
- {
- value = ghb_int_value_new(dval);
- }
- }
- else if (type == GTK_TYPE_SCALE_BUTTON)
- {
- gdouble dval;
-
- dval = gtk_scale_button_get_value(GTK_SCALE_BUTTON(widget));
- value = ghb_double_value_new(dval);
- }
- else if (type == GTK_TYPE_TEXT_VIEW)
- {
- GtkTextBuffer *buffer;
- GtkTextIter start, end;
- gchar *str;
-
- buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(widget));
- gtk_text_buffer_get_bounds(buffer, &start, &end);
- str = gtk_text_buffer_get_text(buffer, &start, &end, FALSE);
- value = ghb_string_value_new(str);
- g_free(str);
- }
- else if (type == GTK_TYPE_LABEL)
- {
- const gchar *str;
- str = gtk_label_get_text (GTK_LABEL(widget));
- value = ghb_string_value_new(str);
- }
- else if (type == GTK_TYPE_FILE_CHOOSER_BUTTON)
- {
- gchar *str;
- str = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER(widget));
- if (str == NULL)
- str = gtk_file_chooser_get_current_folder(GTK_FILE_CHOOSER(widget));
- value = ghb_string_value_new(str);
- if (str != NULL)
- g_free(str);
- }
- else
- {
- g_debug("Attempt to set unknown widget type: %s\n", name);
- g_free(value);
- value = NULL;
- }
- return value;
+ GValue *value = NULL;
+ const gchar *name;
+ GType type;
+
+ if (widget == NULL)
+ {
+ g_debug("NULL widget\n");
+ return NULL;
+ }
+
+ type = G_OBJECT_TYPE(widget);
+ name = ghb_get_setting_key(widget);
+ g_debug("ghb_widget_value widget (%s)\n", name);
+ if (type == GTK_TYPE_ENTRY)
+ {
+ const gchar *str = gtk_entry_get_text(GTK_ENTRY(widget));
+ value = ghb_string_value_new(str);
+ }
+ else if (type == GTK_TYPE_RADIO_BUTTON)
+ {
+ g_debug("\tradio_button");
+ gboolean bval;
+ bval = gtk_toggle_button_get_inconsistent(GTK_TOGGLE_BUTTON(widget));
+ if (bval)
+ {
+ value = ghb_boolean_value_new(FALSE);
+ }
+ else
+ {
+ bval = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
+ value = ghb_boolean_value_new(bval);
+ }
+ }
+ else if (type == GTK_TYPE_CHECK_BUTTON)
+ {
+ g_debug("\tcheck_button");
+ gboolean bval;
+ bval = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
+ value = ghb_boolean_value_new(bval);
+ }
+ else if (type == GTK_TYPE_TOGGLE_TOOL_BUTTON)
+ {
+ g_debug("\ttoggle_tool_button");
+ gboolean bval;
+ bval = gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(widget));
+ value = ghb_boolean_value_new(bval);
+ }
+ else if (type == GTK_TYPE_TOGGLE_BUTTON)
+ {
+ g_debug("\ttoggle_button");
+ gboolean bval;
+ bval = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
+ value = ghb_boolean_value_new(bval);
+ }
+ else if (type == GTK_TYPE_TOGGLE_ACTION)
+ {
+ g_debug("\ttoggle action");
+ gboolean bval;
+ bval = gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(widget));
+ value = ghb_boolean_value_new(bval);
+ }
+ else if (type == GTK_TYPE_CHECK_MENU_ITEM)
+ {
+ g_debug("\tcheck_menu_item");
+ gboolean bval;
+ bval = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget));
+ value = ghb_boolean_value_new(bval);
+ }
+ else if (type == GTK_TYPE_COMBO_BOX)
+ {
+ g_debug("\tcombo_box");
+ GtkTreeModel *store;
+ GtkTreeIter iter;
+ gchar *shortOpt;
+
+ store = gtk_combo_box_get_model(GTK_COMBO_BOX(widget));
+ if (gtk_combo_box_get_active_iter(GTK_COMBO_BOX(widget), &iter))
+ {
+ gtk_tree_model_get(store, &iter, 2, &shortOpt, -1);
+ value = ghb_string_value_new(shortOpt);
+ g_free(shortOpt);
+ }
+ else
+ {
+ value = ghb_string_value_new("");
+ }
+ }
+ else if (type == GTK_TYPE_COMBO_BOX_ENTRY)
+ {
+ GtkTreeModel *store;
+ GtkTreeIter iter;
+ gchar *shortOpt;
+
+ g_debug("\tcombo_box_entry");
+ store = gtk_combo_box_get_model(GTK_COMBO_BOX(widget));
+ if (gtk_combo_box_get_active_iter(GTK_COMBO_BOX(widget), &iter))
+ {
+ gtk_tree_model_get(store, &iter, 2, &shortOpt, -1);
+ value = ghb_string_value_new(shortOpt);
+ g_free(shortOpt);
+ }
+ else
+ {
+ const gchar *str;
+ str = gtk_combo_box_get_active_text(GTK_COMBO_BOX(widget));
+ if (str == NULL) str = "";
+ value = ghb_string_value_new(str);
+ }
+ }
+ else if (type == GTK_TYPE_SPIN_BUTTON)
+ {
+ gint ival;
+ ival = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
+ value = ghb_int64_value_new(ival);
+ }
+ else if (type == GTK_TYPE_HSCALE)
+ {
+ gdouble dval;
+ gint digits;
+
+ digits = gtk_scale_get_digits(GTK_SCALE(widget));
+ dval = gtk_range_get_value(GTK_RANGE(widget));
+ if (digits)
+ {
+ value = ghb_double_value_new(dval);
+ }
+ else
+ {
+ value = ghb_int_value_new(dval);
+ }
+ }
+ else if (type == GTK_TYPE_SCALE_BUTTON)
+ {
+ gdouble dval;
+
+ dval = gtk_scale_button_get_value(GTK_SCALE_BUTTON(widget));
+ value = ghb_double_value_new(dval);
+ }
+ else if (type == GTK_TYPE_TEXT_VIEW)
+ {
+ GtkTextBuffer *buffer;
+ GtkTextIter start, end;
+ gchar *str;
+
+ buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(widget));
+ gtk_text_buffer_get_bounds(buffer, &start, &end);
+ str = gtk_text_buffer_get_text(buffer, &start, &end, FALSE);
+ value = ghb_string_value_new(str);
+ g_free(str);
+ }
+ else if (type == GTK_TYPE_LABEL)
+ {
+ const gchar *str;
+ str = gtk_label_get_text (GTK_LABEL(widget));
+ value = ghb_string_value_new(str);
+ }
+ else if (type == GTK_TYPE_FILE_CHOOSER_BUTTON)
+ {
+ gchar *str;
+ str = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER(widget));
+ if (str == NULL)
+ str = gtk_file_chooser_get_current_folder(GTK_FILE_CHOOSER(widget));
+ value = ghb_string_value_new(str);
+ if (str != NULL)
+ g_free(str);
+ }
+ else
+ {
+ g_debug("Attempt to set unknown widget type: %s\n", name);
+ g_free(value);
+ value = NULL;
+ }
+ return value;
}
gchar*
ghb_widget_string(GtkWidget *widget)
{
- GValue *value;
- gchar *sval;
-
- value = ghb_widget_value(widget);
- sval = ghb_value_string(value);
- ghb_value_free(value);
- return sval;
+ GValue *value;
+ gchar *sval;
+
+ value = ghb_widget_value(widget);
+ sval = ghb_value_string(value);
+ ghb_value_free(value);
+ return sval;
}
gdouble
ghb_widget_double(GtkWidget *widget)
{
- GValue *value;
- gdouble dval;
-
- value = ghb_widget_value(widget);
- dval = ghb_value_double(value);
- ghb_value_free(value);
- return dval;
+ GValue *value;
+ gdouble dval;
+
+ value = ghb_widget_value(widget);
+ dval = ghb_value_double(value);
+ ghb_value_free(value);
+ return dval;
}
gint64
ghb_widget_int64(GtkWidget *widget)
{
- GValue *value;
- gint64 ival;
-
- value = ghb_widget_value(widget);
- ival = ghb_value_int64(value);
- ghb_value_free(value);
- return ival;
+ GValue *value;
+ gint64 ival;
+
+ value = ghb_widget_value(widget);
+ ival = ghb_value_int64(value);
+ ghb_value_free(value);
+ return ival;
}
gint
ghb_widget_int(GtkWidget *widget)
{
- GValue *value;
- gint ival;
-
- value = ghb_widget_value(widget);
- ival = (gint)ghb_value_int64(value);
- ghb_value_free(value);
- return ival;
+ GValue *value;
+ gint ival;
+
+ value = ghb_widget_value(widget);
+ ival = (gint)ghb_value_int64(value);
+ ghb_value_free(value);
+ return ival;
}
gint
ghb_widget_boolean(GtkWidget *widget)
{
- GValue *value;
- gboolean bval;
-
- value = ghb_widget_value(widget);
- bval = ghb_value_boolean(value);
- ghb_value_free(value);
- return bval;
+ GValue *value;
+ gboolean bval;
+
+ value = ghb_widget_value(widget);
+ bval = ghb_value_boolean(value);
+ ghb_value_free(value);
+ return bval;
}
static void check_radio_consistency(GValue *settings, GtkWidget *widget)
{
- const gchar *key = NULL;
- GValue *value;
-
- if (widget == NULL) return;
- if (G_OBJECT_TYPE(widget) == GTK_TYPE_RADIO_BUTTON)
- {
- // Find corresponding setting
- key = ghb_get_setting_key(widget);
- if (key == NULL) return;
- value = ghb_widget_value(widget);
- if (value == NULL) return;
- if (ghb_value_boolean(value) == ghb_settings_get_boolean(settings, key))
- {
- gtk_toggle_button_set_inconsistent(GTK_TOGGLE_BUTTON(widget), FALSE);
- }
- }
+ const gchar *key = NULL;
+ GValue *value;
+
+ if (widget == NULL) return;
+ if (G_OBJECT_TYPE(widget) == GTK_TYPE_RADIO_BUTTON)
+ {
+ // Find corresponding setting
+ key = ghb_get_setting_key(widget);
+ if (key == NULL) return;
+ value = ghb_widget_value(widget);
+ if (value == NULL) return;
+ if (ghb_value_boolean(value) == ghb_settings_get_boolean(settings, key))
+ {
+ gtk_toggle_button_set_inconsistent(GTK_TOGGLE_BUTTON(widget), FALSE);
+ }
+ }
}
void
ghb_widget_to_setting(GValue *settings, GtkWidget *widget)
{
- const gchar *key = NULL;
- GValue *value;
-
- if (widget == NULL) return;
- g_debug("ghb_widget_to_setting");
- // Find corresponding setting
- key = ghb_get_setting_key(widget);
- if (key == NULL) return;
- value = ghb_widget_value(widget);
- if (value != NULL)
- {
- check_radio_consistency(settings, widget);
- ghb_settings_take_value(settings, key, value);
- }
- else
- {
- g_debug("No value found for %s\n", key);
- }
+ const gchar *key = NULL;
+ GValue *value;
+
+ if (widget == NULL) return;
+ g_debug("ghb_widget_to_setting");
+ // Find corresponding setting
+ key = ghb_get_setting_key(widget);
+ if (key == NULL) return;
+ value = ghb_widget_value(widget);
+ if (value != NULL)
+ {
+ check_radio_consistency(settings, widget);
+ ghb_settings_take_value(settings, key, value);
+ }
+ else
+ {
+ g_debug("No value found for %s\n", key);
+ }
}
static void
update_widget(GtkWidget *widget, const GValue *value)
{
- GType type;
- gchar *str;
- gint ival;
- gdouble dval;
-
- g_debug("update_widget");
- type = G_VALUE_TYPE(value);
- if (type == ghb_array_get_type() || type == ghb_dict_get_type())
- return;
- if (value == NULL) return;
- str = ghb_value_string(value);
- ival = ghb_value_int(value);
- dval = ghb_value_double(value);
- type = G_OBJECT_TYPE(widget);
- if (type == GTK_TYPE_ENTRY)
- {
- g_debug("entry");
- gtk_entry_set_text((GtkEntry*)widget, str);
- }
- else if (type == GTK_TYPE_RADIO_BUTTON)
- {
- g_debug("radio button");
- int cur_val = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
- if (cur_val && !ival)
- {
- gtk_toggle_button_set_inconsistent(GTK_TOGGLE_BUTTON(widget), TRUE);
- }
- else
- {
- gtk_toggle_button_set_inconsistent(GTK_TOGGLE_BUTTON(widget), FALSE);
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), ival);
- }
- }
- else if (type == GTK_TYPE_CHECK_BUTTON)
- {
- g_debug("check button");
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), ival);
- }
- else if (type == GTK_TYPE_TOGGLE_TOOL_BUTTON)
- {
- g_debug("toggle button");
- gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(widget), ival);
- }
- else if (type == GTK_TYPE_TOGGLE_BUTTON)
- {
- g_debug("toggle button");
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), ival);
- }
- else if (type == GTK_TYPE_TOGGLE_ACTION)
- {
- g_debug("toggle action");
- gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(widget), ival);
- }
- else if (type == GTK_TYPE_CHECK_MENU_ITEM)
- {
- g_debug("check menu item");
- gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(widget), ival);
- }
- else if (type == GTK_TYPE_COMBO_BOX)
- {
- GtkTreeModel *store;
- GtkTreeIter iter;
- gchar *shortOpt;
- gdouble ivalue;
- gboolean foundit = FALSE;
-
- g_debug("combo (%s)", str);
- store = gtk_combo_box_get_model(GTK_COMBO_BOX(widget));
- if (gtk_tree_model_get_iter_first (store, &iter))
- {
- do
- {
- gtk_tree_model_get(store, &iter, 2, &shortOpt, -1);
- if (strcasecmp(shortOpt, str) == 0)
- {
- gtk_combo_box_set_active_iter (
- GTK_COMBO_BOX(widget), &iter);
- g_free(shortOpt);
- foundit = TRUE;
- break;
- }
- g_free(shortOpt);
- } while (gtk_tree_model_iter_next (store, &iter));
- }
- if (!foundit && gtk_tree_model_get_iter_first (store, &iter))
- {
- do
- {
- gtk_tree_model_get(store, &iter, 3, &ivalue, -1);
- if ((gint)ivalue == ival || ivalue == dval)
- {
- gtk_combo_box_set_active_iter (
- GTK_COMBO_BOX(widget), &iter);
- foundit = TRUE;
- break;
- }
- } while (gtk_tree_model_iter_next (store, &iter));
- }
- if (!foundit)
- {
- gtk_combo_box_set_active (GTK_COMBO_BOX(widget), 0);
- }
- }
- else if (type == GTK_TYPE_COMBO_BOX_ENTRY)
- {
- GtkTreeModel *store;
- GtkTreeIter iter;
- gchar *shortOpt;
- gdouble ivalue;
- gboolean foundit = FALSE;
-
- g_debug("GTK_COMBO_BOX_ENTRY");
- store = gtk_combo_box_get_model(GTK_COMBO_BOX(widget));
- if (gtk_tree_model_get_iter_first (store, &iter))
- {
- do
- {
- gtk_tree_model_get(store, &iter, 2, &shortOpt, -1);
- if (strcmp(shortOpt, str) == 0)
- {
- gtk_combo_box_set_active_iter (
- GTK_COMBO_BOX(widget), &iter);
- g_free(shortOpt);
- foundit = TRUE;
- break;
- }
- g_free(shortOpt);
- } while (gtk_tree_model_iter_next (store, &iter));
- }
- if (!foundit && gtk_tree_model_get_iter_first (store, &iter))
- {
- do
- {
- gtk_tree_model_get(store, &iter, 3, &ivalue, -1);
- if ((gint)ivalue == ival || ivalue == dval)
- {
- gtk_combo_box_set_active_iter (
- GTK_COMBO_BOX(widget), &iter);
- foundit = TRUE;
- break;
- }
- } while (gtk_tree_model_iter_next (store, &iter));
- }
- if (!foundit)
- {
- GtkEntry *entry = GTK_ENTRY(gtk_bin_get_child(GTK_BIN(widget)));
- if (entry)
- {
- gtk_entry_set_text (entry, str);
- }
- }
- }
- else if (type == GTK_TYPE_SPIN_BUTTON)
- {
- g_debug("spin (%s)", str);
- gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget), dval);
- }
- else if (type == GTK_TYPE_HSCALE)
- {
- g_debug("hscale");
- gtk_range_set_value(GTK_RANGE(widget), dval);
- }
- else if (type == GTK_TYPE_SCALE_BUTTON)
- {
- g_debug("scale_button");
- gtk_scale_button_set_value(GTK_SCALE_BUTTON(widget), dval);
- }
- else if (type == GTK_TYPE_TEXT_VIEW)
- {
- g_debug("textview (%s)", str);
- GtkTextBuffer *buffer = gtk_text_view_get_buffer(
- GTK_TEXT_VIEW(widget));
- gtk_text_buffer_set_text (buffer, str, -1);
- }
- else if (type == GTK_TYPE_LABEL)
- {
- gtk_label_set_markup (GTK_LABEL(widget), str);
- }
- else if (type == GTK_TYPE_FILE_CHOOSER_BUTTON)
- {
- GtkFileChooserAction act;
- act = gtk_file_chooser_get_action(GTK_FILE_CHOOSER(widget));
- if (str[0] == 0)
- {
- // Do nothing
- ;
- }
- else if (act == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER ||
- act == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER)
- {
- gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(widget), str);
- }
- else if (act == GTK_FILE_CHOOSER_ACTION_SAVE)
- {
- gtk_file_chooser_set_filename (GTK_FILE_CHOOSER(widget), str);
- }
- else
- {
- if (g_file_test(str, G_FILE_TEST_IS_DIR))
- {
- gtk_file_chooser_set_current_folder(
- GTK_FILE_CHOOSER(widget), str);
- }
- else if (g_file_test(str, G_FILE_TEST_EXISTS))
- {
- gtk_file_chooser_set_filename (GTK_FILE_CHOOSER(widget), str);
- }
- else
- {
- gchar *dirname;
-
- dirname = g_path_get_dirname(str);
- gtk_file_chooser_set_current_folder(
- GTK_FILE_CHOOSER(widget), dirname);
- g_free(dirname);
- }
- }
- }
- else
- {
- g_debug("Attempt to set unknown widget type");
- }
- g_free(str);
+ GType type;
+ gchar *str;
+ gint ival;
+ gdouble dval;
+
+ g_debug("update_widget");
+ type = G_VALUE_TYPE(value);
+ if (type == ghb_array_get_type() || type == ghb_dict_get_type())
+ return;
+ if (value == NULL) return;
+ str = ghb_value_string(value);
+ ival = ghb_value_int(value);
+ dval = ghb_value_double(value);
+ type = G_OBJECT_TYPE(widget);
+ if (type == GTK_TYPE_ENTRY)
+ {
+ g_debug("entry");
+ gtk_entry_set_text((GtkEntry*)widget, str);
+ }
+ else if (type == GTK_TYPE_RADIO_BUTTON)
+ {
+ g_debug("radio button");
+ int cur_val = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
+ if (cur_val && !ival)
+ {
+ gtk_toggle_button_set_inconsistent(GTK_TOGGLE_BUTTON(widget), TRUE);
+ }
+ else
+ {
+ gtk_toggle_button_set_inconsistent(GTK_TOGGLE_BUTTON(widget), FALSE);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), ival);
+ }
+ }
+ else if (type == GTK_TYPE_CHECK_BUTTON)
+ {
+ g_debug("check button");
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), ival);
+ }
+ else if (type == GTK_TYPE_TOGGLE_TOOL_BUTTON)
+ {
+ g_debug("toggle button");
+ gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(widget), ival);
+ }
+ else if (type == GTK_TYPE_TOGGLE_BUTTON)
+ {
+ g_debug("toggle button");
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), ival);
+ }
+ else if (type == GTK_TYPE_TOGGLE_ACTION)
+ {
+ g_debug("toggle action");
+ gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(widget), ival);
+ }
+ else if (type == GTK_TYPE_CHECK_MENU_ITEM)
+ {
+ g_debug("check menu item");
+ gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(widget), ival);
+ }
+ else if (type == GTK_TYPE_COMBO_BOX)
+ {
+ GtkTreeModel *store;
+ GtkTreeIter iter;
+ gchar *shortOpt;
+ gdouble ivalue;
+ gboolean foundit = FALSE;
+
+ g_debug("combo (%s)", str);
+ store = gtk_combo_box_get_model(GTK_COMBO_BOX(widget));
+ if (gtk_tree_model_get_iter_first (store, &iter))
+ {
+ do
+ {
+ gtk_tree_model_get(store, &iter, 2, &shortOpt, -1);
+ if (strcasecmp(shortOpt, str) == 0)
+ {
+ gtk_combo_box_set_active_iter (
+ GTK_COMBO_BOX(widget), &iter);
+ g_free(shortOpt);
+ foundit = TRUE;
+ break;
+ }
+ g_free(shortOpt);
+ } while (gtk_tree_model_iter_next (store, &iter));
+ }
+ if (!foundit && gtk_tree_model_get_iter_first (store, &iter))
+ {
+ do
+ {
+ gtk_tree_model_get(store, &iter, 3, &ivalue, -1);
+ if ((gint)ivalue == ival || ivalue == dval)
+ {
+ gtk_combo_box_set_active_iter (
+ GTK_COMBO_BOX(widget), &iter);
+ foundit = TRUE;
+ break;
+ }
+ } while (gtk_tree_model_iter_next (store, &iter));
+ }
+ if (!foundit)
+ {
+ gtk_combo_box_set_active (GTK_COMBO_BOX(widget), 0);
+ }
+ }
+ else if (type == GTK_TYPE_COMBO_BOX_ENTRY)
+ {
+ GtkTreeModel *store;
+ GtkTreeIter iter;
+ gchar *shortOpt;
+ gdouble ivalue;
+ gboolean foundit = FALSE;
+
+ g_debug("GTK_COMBO_BOX_ENTRY");
+ store = gtk_combo_box_get_model(GTK_COMBO_BOX(widget));
+ if (gtk_tree_model_get_iter_first (store, &iter))
+ {
+ do
+ {
+ gtk_tree_model_get(store, &iter, 2, &shortOpt, -1);
+ if (strcmp(shortOpt, str) == 0)
+ {
+ gtk_combo_box_set_active_iter (
+ GTK_COMBO_BOX(widget), &iter);
+ g_free(shortOpt);
+ foundit = TRUE;
+ break;
+ }
+ g_free(shortOpt);
+ } while (gtk_tree_model_iter_next (store, &iter));
+ }
+ if (!foundit && gtk_tree_model_get_iter_first (store, &iter))
+ {
+ do
+ {
+ gtk_tree_model_get(store, &iter, 3, &ivalue, -1);
+ if ((gint)ivalue == ival || ivalue == dval)
+ {
+ gtk_combo_box_set_active_iter (
+ GTK_COMBO_BOX(widget), &iter);
+ foundit = TRUE;
+ break;
+ }
+ } while (gtk_tree_model_iter_next (store, &iter));
+ }
+ if (!foundit)
+ {
+ GtkEntry *entry = GTK_ENTRY(gtk_bin_get_child(GTK_BIN(widget)));
+ if (entry)
+ {
+ gtk_entry_set_text (entry, str);
+ }
+ }
+ }
+ else if (type == GTK_TYPE_SPIN_BUTTON)
+ {
+ g_debug("spin (%s)", str);
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget), dval);
+ }
+ else if (type == GTK_TYPE_HSCALE)
+ {
+ g_debug("hscale");
+ gtk_range_set_value(GTK_RANGE(widget), dval);
+ }
+ else if (type == GTK_TYPE_SCALE_BUTTON)
+ {
+ g_debug("scale_button");
+ gtk_scale_button_set_value(GTK_SCALE_BUTTON(widget), dval);
+ }
+ else if (type == GTK_TYPE_TEXT_VIEW)
+ {
+ g_debug("textview (%s)", str);
+ GtkTextBuffer *buffer = gtk_text_view_get_buffer(
+ GTK_TEXT_VIEW(widget));
+ gtk_text_buffer_set_text (buffer, str, -1);
+ }
+ else if (type == GTK_TYPE_LABEL)
+ {
+ gtk_label_set_markup (GTK_LABEL(widget), str);
+ }
+ else if (type == GTK_TYPE_FILE_CHOOSER_BUTTON)
+ {
+ GtkFileChooserAction act;
+ act = gtk_file_chooser_get_action(GTK_FILE_CHOOSER(widget));
+ if (str[0] == 0)
+ {
+ // Do nothing
+ ;
+ }
+ else if (act == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER ||
+ act == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER)
+ {
+ gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(widget), str);
+ }
+ else if (act == GTK_FILE_CHOOSER_ACTION_SAVE)
+ {
+ gtk_file_chooser_set_filename (GTK_FILE_CHOOSER(widget), str);
+ }
+ else
+ {
+ if (g_file_test(str, G_FILE_TEST_IS_DIR))
+ {
+ gtk_file_chooser_set_current_folder(
+ GTK_FILE_CHOOSER(widget), str);
+ }
+ else if (g_file_test(str, G_FILE_TEST_EXISTS))
+ {
+ gtk_file_chooser_set_filename (GTK_FILE_CHOOSER(widget), str);
+ }
+ else
+ {
+ gchar *dirname;
+
+ dirname = g_path_get_dirname(str);
+ gtk_file_chooser_set_current_folder(
+ GTK_FILE_CHOOSER(widget), dirname);
+ g_free(dirname);
+ }
+ }
+ }
+ else
+ {
+ g_debug("Attempt to set unknown widget type");
+ }
+ g_free(str);
}
int
ghb_ui_update_from_settings(GtkBuilder *builder, const gchar *name, const GValue *settings)
{
- GObject *object;
- GValue * value;
-
- g_debug("ghb_ui_update_from_settings() %s", name);
- if (name == NULL)
- return 0;
- value = ghb_settings_get_value(settings, name);
- if (value == NULL)
- return 0;
- object = GHB_OBJECT(builder, name);
- if (object == NULL)
- {
- g_debug("Failed to find widget for key: %s\n", name);
- return -1;
- }
- update_widget((GtkWidget*)object, value);
- return 0;
+ GObject *object;
+ GValue * value;
+
+ g_debug("ghb_ui_update_from_settings() %s", name);
+ if (name == NULL)
+ return 0;
+ value = ghb_settings_get_value(settings, name);
+ if (value == NULL)
+ return 0;
+ object = GHB_OBJECT(builder, name);
+ if (object == NULL)
+ {
+ g_debug("Failed to find widget for key: %s\n", name);
+ return -1;
+ }
+ update_widget((GtkWidget*)object, value);
+ return 0;
}
int
ghb_ui_update(signal_user_data_t *ud, const gchar *name, const GValue *value)
{
- GObject *object;
-
- g_debug("ghb_ui_update() %s", name);
- if (name == NULL || value == NULL)
- return 0;
- object = GHB_OBJECT(ud->builder, name);
- if (object == NULL)
- {
- g_debug("Failed to find widget for key: %s\n", name);
- return -1;
- }
- update_widget((GtkWidget*)object, value);
- // Its possible the value hasn't changed. Since settings are only
- // updated when the value changes, I'm initializing settings here as well.
- ghb_widget_to_setting(ud->settings, (GtkWidget*)object);
- return 0;
+ GObject *object;
+
+ g_debug("ghb_ui_update() %s", name);
+ if (name == NULL || value == NULL)
+ return 0;
+ object = GHB_OBJECT(ud->builder, name);
+ if (object == NULL)
+ {
+ g_debug("Failed to find widget for key: %s\n", name);
+ return -1;
+ }
+ update_widget((GtkWidget*)object, value);
+ // Its possible the value hasn't changed. Since settings are only
+ // updated when the value changes, I'm initializing settings here as well.
+ ghb_widget_to_setting(ud->settings, (GtkWidget*)object);
+ return 0;
}
diff --git a/gtk/src/settings.h b/gtk/src/settings.h
index f9f72e123..76f2d97be 100644
--- a/gtk/src/settings.h
+++ b/gtk/src/settings.h
@@ -21,79 +21,79 @@
#include <libappindicator/app-indicator.h>
#endif
-#define GHB_WIDGET(b,n) GTK_WIDGET(gtk_builder_get_object ((b), (n)))
-//#define GHB_WIDGET(b,n) GTK_WIDGET(debug_get_object((b), (n)))
-#define GHB_ACTION(b,n) GTK_ACTION(gtk_builder_get_object ((b), (n)))
-#define GHB_OBJECT(b,n) gtk_builder_get_object ((b), (n))
+#define GHB_WIDGET(b,n) GTK_WIDGET(gtk_builder_get_object ((b), (n)))
+//#define GHB_WIDGET(b,n) GTK_WIDGET(debug_get_object((b), (n)))
+#define GHB_ACTION(b,n) GTK_ACTION(gtk_builder_get_object ((b), (n)))
+#define GHB_OBJECT(b,n) gtk_builder_get_object ((b), (n))
GObject* debug_get_object(GtkBuilder *b, const gchar *n);
enum
{
- GHB_STATE_IDLE = 0x00,
- GHB_STATE_SCANNING = 0x02,
- GHB_STATE_SCANDONE = 0x04,
- GHB_STATE_WORKING = 0x08,
- GHB_STATE_WORKDONE = 0x10,
- GHB_STATE_PAUSED = 0x20,
- GHB_STATE_MUXING = 0x40,
- GHB_STATE_SEARCHING = 0x80,
+ GHB_STATE_IDLE = 0x00,
+ GHB_STATE_SCANNING = 0x02,
+ GHB_STATE_SCANDONE = 0x04,
+ GHB_STATE_WORKING = 0x08,
+ GHB_STATE_WORKDONE = 0x10,
+ GHB_STATE_PAUSED = 0x20,
+ GHB_STATE_MUXING = 0x40,
+ GHB_STATE_SEARCHING = 0x80,
};
enum
{
- GHB_CANCEL_NONE,
- GHB_CANCEL_ALL,
- GHB_CANCEL_CURRENT,
- GHB_CANCEL_FINISH
+ GHB_CANCEL_NONE,
+ GHB_CANCEL_ALL,
+ GHB_CANCEL_CURRENT,
+ GHB_CANCEL_FINISH
};
typedef struct preview_s preview_t;
typedef struct
{
- gchar *current_dvd_device;
- gboolean debug;
- gboolean dont_clear_presets;
- gboolean scale_busy;
- gint cancel_encode;
- GtkBuilder *builder;
- GValue *settings;
- GValue *queue;
- GValue *current_job;
- GIOChannel *activity_log;
- GIOChannel *job_activity_log;
- preview_t *preview;
- gchar *appcast;
- gint appcast_len;
- GdkVisibilityState hb_visibility;
+ gchar *current_dvd_device;
+ gboolean debug;
+ gboolean dont_clear_presets;
+ gboolean scale_busy;
+ gint cancel_encode;
+ GtkBuilder *builder;
+ GValue *settings;
+ GValue *queue;
+ GValue *current_job;
+ GIOChannel *activity_log;
+ GIOChannel *job_activity_log;
+ preview_t *preview;
+ gchar *appcast;
+ gint appcast_len;
+ GdkVisibilityState hb_visibility;
#if defined(_USE_APP_IND)
- AppIndicator *ai;
+ AppIndicator *ai;
#endif
} signal_user_data_t;
enum
{
- GHB_QUEUE_PENDING,
- GHB_QUEUE_RUNNING,
- GHB_QUEUE_CANCELED,
- GHB_QUEUE_DONE,
+ GHB_QUEUE_PENDING,
+ GHB_QUEUE_RUNNING,
+ GHB_QUEUE_CANCELED,
+ GHB_QUEUE_DONE,
};
GValue* ghb_settings_new(void);
void ghb_settings_take_value(
- GValue *settings, const gchar *key, GValue *value);
+ GValue *settings, const gchar *key, GValue *value);
void ghb_settings_set_value(
- GValue *settings, const gchar *key, const GValue *value);
+ GValue *settings, const gchar *key, const GValue *value);
void ghb_settings_set_string(
- GValue *settings, const gchar *key, const gchar *sval);
+ GValue *settings, const gchar *key, const gchar *sval);
void ghb_settings_set_double(GValue *settings, const gchar *key, gdouble dval);
void ghb_settings_set_int64(GValue *settings, const gchar *key, gint64 ival);
void ghb_settings_set_int(GValue *settings, const gchar *key, gint ival);
void ghb_settings_set_boolean(
- GValue *settings, const gchar *key, gboolean bval);
+ GValue *settings, const gchar *key, gboolean bval);
void ghb_settings_copy(
- GValue *settings, const gchar *key, const GValue *value);
+ GValue *settings, const gchar *key, const GValue *value);
GValue* ghb_settings_get_value(const GValue *settings, const gchar *key);
gboolean ghb_settings_get_boolean(const GValue *settings, const gchar *key);
gint64 ghb_settings_get_int64(const GValue *settings, const gchar *key);
@@ -114,9 +114,9 @@ gint ghb_widget_boolean(GtkWidget *widget);
void ghb_widget_to_setting(GValue *settings, GtkWidget *widget);
int ghb_ui_update(
- signal_user_data_t *ud, const gchar *name, const GValue *value);
+ signal_user_data_t *ud, const gchar *name, const GValue *value);
int ghb_ui_update_from_settings(
- GtkBuilder *builder, const gchar *name, const GValue *settings);
+ GtkBuilder *builder, const gchar *name, const GValue *settings);
const gchar* ghb_get_setting_key(GtkWidget *widget);
#endif // _SETTINGS_H_
diff --git a/gtk/src/standard_presets.xml b/gtk/src/standard_presets.xml
index 5582893eb..9a0b35400 100644
--- a/gtk/src/standard_presets.xml
+++ b/gtk/src/standard_presets.xml
@@ -2,1216 +2,1216 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
- <dict>
- <key>ChildrenArray</key>
- <array>
- <dict>
- <key>AudioList</key>
- <array>
- <dict>
- <key>AudioBitrate</key>
- <string>160</string>
- <key>AudioEncoder</key>
- <string>AAC (faac)</string>
- <key>AudioMixdown</key>
- <string>Dolby Pro Logic II</string>
- <key>AudioSamplerate</key>
- <string>Auto</string>
- <key>AudioTrack</key>
- <integer>1</integer>
- <key>AudioTrackDRCSlider</key>
- <real>0.0</real>
- </dict>
- <dict>
- <key>AudioBitrate</key>
- <string>160</string>
- <key>AudioEncoder</key>
- <string>AC3 Passthru</string>
- <key>AudioMixdown</key>
- <string>None</string>
- <key>AudioSamplerate</key>
- <string>Auto</string>
- <key>AudioTrack</key>
- <integer>1</integer>
- <key>AudioTrackDRCSlider</key>
- <real>0.0</real>
- </dict>
- </array>
- <key>ChapterMarkers</key>
- <integer>1</integer>
- <key>Default</key>
- <integer>0</integer>
- <key>FileFormat</key>
- <string>MP4 file</string>
- <key>Folder</key>
- <false/>
- <key>Mp4LargeFile</key>
- <integer>0</integer>
- <key>PictureAutoCrop</key>
- <integer>1</integer>
- <key>PictureBottomCrop</key>
- <integer>0</integer>
- <key>PictureDeblock</key>
- <integer>0</integer>
- <key>PictureDeinterlace</key>
- <integer>0</integer>
- <key>PictureDenoise</key>
- <integer>0</integer>
- <key>PictureDetelecine</key>
- <integer>0</integer>
- <key>PictureHeight</key>
- <integer>0</integer>
- <key>PictureKeepRatio</key>
- <integer>0</integer>
- <key>PictureLeftCrop</key>
- <integer>0</integer>
- <key>PictureModulus</key>
- <integer>2</integer>
- <key>PicturePAR</key>
- <integer>2</integer>
- <key>PictureRightCrop</key>
- <integer>0</integer>
- <key>PictureTopCrop</key>
- <integer>0</integer>
- <key>PictureWidth</key>
- <integer>720</integer>
- <key>PresetDescription</key>
- <string>HandBrake's universally compatible, full resolution settings for all current Apple devices: iPod (6G and up), iPhone, AppleTV, and Macs</string>
- <key>PresetName</key>
- <string>Universal</string>
- <key>Subtitles</key>
- <string>None</string>
- <key>Type</key>
- <integer>0</integer>
- <key>UsesPictureFilters</key>
- <integer>1</integer>
- <key>UsesPictureSettings</key>
- <integer>1</integer>
- <key>VFR</key>
- <integer>0</integer>
- <key>VideoAvgBitrate</key>
- <string>2500</string>
- <key>VideoEncoder</key>
- <string>H.264 (x264)</string>
- <key>VideoFramerate</key>
- <string>30</string>
- <key>VideoFramerateMode</key>
- <string>pfr</string>
- <key>VideoGrayScale</key>
- <integer>0</integer>
- <key>VideoQualitySlider</key>
- <real>20</real>
- <key>VideoQualityType</key>
- <integer>2</integer>
- <key>VideoTwoPass</key>
- <integer>0</integer>
- <key>h264Level</key>
- <string>3.0</string>
+ <dict>
+ <key>ChildrenArray</key>
+ <array>
+ <dict>
+ <key>AudioList</key>
+ <array>
+ <dict>
+ <key>AudioBitrate</key>
+ <string>160</string>
+ <key>AudioEncoder</key>
+ <string>AAC (faac)</string>
+ <key>AudioMixdown</key>
+ <string>Dolby Pro Logic II</string>
+ <key>AudioSamplerate</key>
+ <string>Auto</string>
+ <key>AudioTrack</key>
+ <integer>1</integer>
+ <key>AudioTrackDRCSlider</key>
+ <real>0.0</real>
+ </dict>
+ <dict>
+ <key>AudioBitrate</key>
+ <string>160</string>
+ <key>AudioEncoder</key>
+ <string>AC3 Passthru</string>
+ <key>AudioMixdown</key>
+ <string>None</string>
+ <key>AudioSamplerate</key>
+ <string>Auto</string>
+ <key>AudioTrack</key>
+ <integer>1</integer>
+ <key>AudioTrackDRCSlider</key>
+ <real>0.0</real>
+ </dict>
+ </array>
+ <key>ChapterMarkers</key>
+ <integer>1</integer>
+ <key>Default</key>
+ <integer>0</integer>
+ <key>FileFormat</key>
+ <string>MP4 file</string>
+ <key>Folder</key>
+ <false/>
+ <key>Mp4LargeFile</key>
+ <integer>0</integer>
+ <key>PictureAutoCrop</key>
+ <integer>1</integer>
+ <key>PictureBottomCrop</key>
+ <integer>0</integer>
+ <key>PictureDeblock</key>
+ <integer>0</integer>
+ <key>PictureDeinterlace</key>
+ <integer>0</integer>
+ <key>PictureDenoise</key>
+ <integer>0</integer>
+ <key>PictureDetelecine</key>
+ <integer>0</integer>
+ <key>PictureHeight</key>
+ <integer>0</integer>
+ <key>PictureKeepRatio</key>
+ <integer>0</integer>
+ <key>PictureLeftCrop</key>
+ <integer>0</integer>
+ <key>PictureModulus</key>
+ <integer>2</integer>
+ <key>PicturePAR</key>
+ <integer>2</integer>
+ <key>PictureRightCrop</key>
+ <integer>0</integer>
+ <key>PictureTopCrop</key>
+ <integer>0</integer>
+ <key>PictureWidth</key>
+ <integer>720</integer>
+ <key>PresetDescription</key>
+ <string>HandBrake's universally compatible, full resolution settings for all current Apple devices: iPod (6G and up), iPhone, AppleTV, and Macs</string>
+ <key>PresetName</key>
+ <string>Universal</string>
+ <key>Subtitles</key>
+ <string>None</string>
+ <key>Type</key>
+ <integer>0</integer>
+ <key>UsesPictureFilters</key>
+ <integer>1</integer>
+ <key>UsesPictureSettings</key>
+ <integer>1</integer>
+ <key>VFR</key>
+ <integer>0</integer>
+ <key>VideoAvgBitrate</key>
+ <string>2500</string>
+ <key>VideoEncoder</key>
+ <string>H.264 (x264)</string>
+ <key>VideoFramerate</key>
+ <string>30</string>
+ <key>VideoFramerateMode</key>
+ <string>pfr</string>
+ <key>VideoGrayScale</key>
+ <integer>0</integer>
+ <key>VideoQualitySlider</key>
+ <real>20</real>
+ <key>VideoQualityType</key>
+ <integer>2</integer>
+ <key>VideoTwoPass</key>
+ <integer>0</integer>
+ <key>h264Level</key>
+ <string>3.0</string>
<key>x264UseAdvancedOptions</key>
<false />
- <key>x264Option</key>
- <string>level=3.0:ref=1:bframes=0:cabac=0:8x8dct=0:weightp=0:subme=6:vbv-bufsize=10000:vbv-maxrate=10000:rc-lookahead=30</string>
- <key>x264OptionExtra</key>
- <string></string>
- <key>x264Preset</key>
- <string>fast</string>
- <key>h264Profile</key>
- <string>baseline</string>
- <key>x264Tune</key>
- <string>none</string>
- </dict>
- <dict>
- <key>AudioList</key>
- <array>
- <dict>
- <key>AudioBitrate</key>
- <string>160</string>
- <key>AudioEncoder</key>
- <string>AAC (faac)</string>
- <key>AudioMixdown</key>
- <string>Dolby Pro Logic II</string>
- <key>AudioSamplerate</key>
- <string>Auto</string>
- <key>AudioTrack</key>
- <integer>1</integer>
- <key>AudioTrackDRCSlider</key>
- <real>0.0</real>
- </dict>
- </array>
- <key>ChapterMarkers</key>
- <integer>1</integer>
- <key>Default</key>
- <integer>0</integer>
- <key>FileFormat</key>
- <string>MP4 file</string>
- <key>Mp4iPodCompatible</key>
- <integer>1</integer>
- <key>PictureAutoCrop</key>
- <integer>1</integer>
- <key>PictureBottomCrop</key>
- <integer>0</integer>
- <key>PictureDeblock</key>
- <integer>0</integer>
- <key>PictureDeinterlace</key>
- <integer>0</integer>
- <key>PictureDenoise</key>
- <integer>0</integer>
- <key>PictureDetelecine</key>
- <integer>0</integer>
- <key>PictureHeight</key>
- <integer>0</integer>
- <key>PictureKeepRatio</key>
- <integer>1</integer>
- <key>PictureLeftCrop</key>
- <integer>0</integer>
- <key>PictureModulus</key>
- <integer>2</integer>
- <key>PicturePAR</key>
- <integer>0</integer>
- <key>PictureRightCrop</key>
- <integer>0</integer>
- <key>PictureTopCrop</key>
- <integer>0</integer>
- <key>PictureWidth</key>
- <integer>320</integer>
- <key>PresetDescription</key>
- <string>HandBrake's low resolution settings for the iPod (5G and up). Optimized for great playback on the iPod screen, with smaller file size.</string>
- <key>PresetName</key>
- <string>iPod</string>
- <key>Subtitles</key>
- <string>None</string>
- <key>Type</key>
- <integer>0</integer>
- <key>UsesPictureFilters</key>
- <integer>1</integer>
- <key>UsesPictureSettings</key>
- <integer>1</integer>
- <key>VFR</key>
- <integer>0</integer>
- <key>VideoAvgBitrate</key>
- <string>700</string>
- <key>VideoEncoder</key>
- <string>H.264 (x264)</string>
- <key>VideoFramerate</key>
- <string>30</string>
- <key>VideoFramerateMode</key>
- <string>pfr</string>
- <key>VideoGrayScale</key>
- <integer>0</integer>
- <key>VideoQualitySlider</key>
- <real>22</real>
- <key>VideoQualityType</key>
- <integer>2</integer>
- <key>VideoTwoPass</key>
- <integer>0</integer>
- <key>h264Level</key>
- <string>1.3</string>
+ <key>x264Option</key>
+ <string>level=3.0:ref=1:bframes=0:cabac=0:8x8dct=0:weightp=0:subme=6:vbv-bufsize=10000:vbv-maxrate=10000:rc-lookahead=30</string>
+ <key>x264OptionExtra</key>
+ <string></string>
+ <key>x264Preset</key>
+ <string>fast</string>
+ <key>h264Profile</key>
+ <string>baseline</string>
+ <key>x264Tune</key>
+ <string>none</string>
+ </dict>
+ <dict>
+ <key>AudioList</key>
+ <array>
+ <dict>
+ <key>AudioBitrate</key>
+ <string>160</string>
+ <key>AudioEncoder</key>
+ <string>AAC (faac)</string>
+ <key>AudioMixdown</key>
+ <string>Dolby Pro Logic II</string>
+ <key>AudioSamplerate</key>
+ <string>Auto</string>
+ <key>AudioTrack</key>
+ <integer>1</integer>
+ <key>AudioTrackDRCSlider</key>
+ <real>0.0</real>
+ </dict>
+ </array>
+ <key>ChapterMarkers</key>
+ <integer>1</integer>
+ <key>Default</key>
+ <integer>0</integer>
+ <key>FileFormat</key>
+ <string>MP4 file</string>
+ <key>Mp4iPodCompatible</key>
+ <integer>1</integer>
+ <key>PictureAutoCrop</key>
+ <integer>1</integer>
+ <key>PictureBottomCrop</key>
+ <integer>0</integer>
+ <key>PictureDeblock</key>
+ <integer>0</integer>
+ <key>PictureDeinterlace</key>
+ <integer>0</integer>
+ <key>PictureDenoise</key>
+ <integer>0</integer>
+ <key>PictureDetelecine</key>
+ <integer>0</integer>
+ <key>PictureHeight</key>
+ <integer>0</integer>
+ <key>PictureKeepRatio</key>
+ <integer>1</integer>
+ <key>PictureLeftCrop</key>
+ <integer>0</integer>
+ <key>PictureModulus</key>
+ <integer>2</integer>
+ <key>PicturePAR</key>
+ <integer>0</integer>
+ <key>PictureRightCrop</key>
+ <integer>0</integer>
+ <key>PictureTopCrop</key>
+ <integer>0</integer>
+ <key>PictureWidth</key>
+ <integer>320</integer>
+ <key>PresetDescription</key>
+ <string>HandBrake's low resolution settings for the iPod (5G and up). Optimized for great playback on the iPod screen, with smaller file size.</string>
+ <key>PresetName</key>
+ <string>iPod</string>
+ <key>Subtitles</key>
+ <string>None</string>
+ <key>Type</key>
+ <integer>0</integer>
+ <key>UsesPictureFilters</key>
+ <integer>1</integer>
+ <key>UsesPictureSettings</key>
+ <integer>1</integer>
+ <key>VFR</key>
+ <integer>0</integer>
+ <key>VideoAvgBitrate</key>
+ <string>700</string>
+ <key>VideoEncoder</key>
+ <string>H.264 (x264)</string>
+ <key>VideoFramerate</key>
+ <string>30</string>
+ <key>VideoFramerateMode</key>
+ <string>pfr</string>
+ <key>VideoGrayScale</key>
+ <integer>0</integer>
+ <key>VideoQualitySlider</key>
+ <real>22</real>
+ <key>VideoQualityType</key>
+ <integer>2</integer>
+ <key>VideoTwoPass</key>
+ <integer>0</integer>
+ <key>h264Level</key>
+ <string>1.3</string>
<key>x264UseAdvancedOptions</key>
<false />
- <key>x264Option</key>
- <string>level=1.3:ref=1:bframes=0:cabac=0:8x8dct=0:weightp=0:vbv-bufsize=2000:vbv-maxrate=768</string>
- <key>x264OptionExtra</key>
- <string></string>
- <key>x264Preset</key>
- <string>medium</string>
- <key>h264Profile</key>
- <string>baseline</string>
- <key>x264Tune</key>
- <string>none</string>
- </dict>
- <dict>
- <key>AudioList</key>
- <array>
- <dict>
- <key>AudioBitrate</key>
- <string>160</string>
- <key>AudioEncoder</key>
- <string>AAC (faac)</string>
- <key>AudioMixdown</key>
- <string>Dolby Pro Logic II</string>
- <key>AudioSamplerate</key>
- <string>Auto</string>
- <key>AudioTrack</key>
- <integer>1</integer>
- <key>AudioTrackDRCSlider</key>
- <real>0.0</real>
- </dict>
- </array>
- <key>ChapterMarkers</key>
- <integer>1</integer>
- <key>Default</key>
- <integer>0</integer>
- <key>FileFormat</key>
- <string>MP4 file</string>
- <key>Folder</key>
- <false/>
- <key>Mp4LargeFile</key>
- <integer>1</integer>
- <key>PictureAutoCrop</key>
- <integer>1</integer>
- <key>PictureBottomCrop</key>
- <integer>0</integer>
- <key>PictureDeblock</key>
- <integer>0</integer>
- <key>PictureDeinterlace</key>
- <integer>0</integer>
- <key>PictureDenoise</key>
- <integer>0</integer>
- <key>PictureDetelecine</key>
- <integer>0</integer>
- <key>PictureHeight</key>
- <integer>0</integer>
- <key>PictureKeepRatio</key>
- <integer>0</integer>
- <key>PictureLeftCrop</key>
- <integer>0</integer>
- <key>PictureModulus</key>
- <integer>2</integer>
- <key>PicturePAR</key>
- <integer>2</integer>
- <key>PictureRightCrop</key>
- <integer>0</integer>
- <key>PictureTopCrop</key>
- <integer>0</integer>
- <key>PictureWidth</key>
- <integer>960</integer>
- <key>PresetDescription</key>
- <string>HandBrake's preset for the iPhone 4 is optimized for viewing on its 960x480 display.</string>
- <key>PresetName</key>
- <string>iPhone &amp; iPod Touch</string>
- <key>Subtitles</key>
- <string>None</string>
- <key>Type</key>
- <integer>0</integer>
- <key>UsesPictureFilters</key>
- <integer>1</integer>
- <key>UsesPictureSettings</key>
- <integer>1</integer>
- <key>VFR</key>
- <integer>0</integer>
- <key>VideoAvgBitrate</key>
- <string>2500</string>
- <key>VideoEncoder</key>
- <string>H.264 (x264)</string>
- <key>VideoFramerate</key>
- <string>29.97 (NTSC Video)</string>
- <key>VideoFramerateMode</key>
- <string>pfr</string>
- <key>VideoGrayScale</key>
- <integer>0</integer>
- <key>VideoQualitySlider</key>
- <real>22</real>
- <key>VideoQualityType</key>
- <integer>2</integer>
- <key>VideoTwoPass</key>
- <integer>0</integer>
- <key>h264Level</key>
- <string>3.1</string>
+ <key>x264Option</key>
+ <string>level=1.3:ref=1:bframes=0:cabac=0:8x8dct=0:weightp=0:vbv-bufsize=2000:vbv-maxrate=768</string>
+ <key>x264OptionExtra</key>
+ <string></string>
+ <key>x264Preset</key>
+ <string>medium</string>
+ <key>h264Profile</key>
+ <string>baseline</string>
+ <key>x264Tune</key>
+ <string>none</string>
+ </dict>
+ <dict>
+ <key>AudioList</key>
+ <array>
+ <dict>
+ <key>AudioBitrate</key>
+ <string>160</string>
+ <key>AudioEncoder</key>
+ <string>AAC (faac)</string>
+ <key>AudioMixdown</key>
+ <string>Dolby Pro Logic II</string>
+ <key>AudioSamplerate</key>
+ <string>Auto</string>
+ <key>AudioTrack</key>
+ <integer>1</integer>
+ <key>AudioTrackDRCSlider</key>
+ <real>0.0</real>
+ </dict>
+ </array>
+ <key>ChapterMarkers</key>
+ <integer>1</integer>
+ <key>Default</key>
+ <integer>0</integer>
+ <key>FileFormat</key>
+ <string>MP4 file</string>
+ <key>Folder</key>
+ <false/>
+ <key>Mp4LargeFile</key>
+ <integer>1</integer>
+ <key>PictureAutoCrop</key>
+ <integer>1</integer>
+ <key>PictureBottomCrop</key>
+ <integer>0</integer>
+ <key>PictureDeblock</key>
+ <integer>0</integer>
+ <key>PictureDeinterlace</key>
+ <integer>0</integer>
+ <key>PictureDenoise</key>
+ <integer>0</integer>
+ <key>PictureDetelecine</key>
+ <integer>0</integer>
+ <key>PictureHeight</key>
+ <integer>0</integer>
+ <key>PictureKeepRatio</key>
+ <integer>0</integer>
+ <key>PictureLeftCrop</key>
+ <integer>0</integer>
+ <key>PictureModulus</key>
+ <integer>2</integer>
+ <key>PicturePAR</key>
+ <integer>2</integer>
+ <key>PictureRightCrop</key>
+ <integer>0</integer>
+ <key>PictureTopCrop</key>
+ <integer>0</integer>
+ <key>PictureWidth</key>
+ <integer>960</integer>
+ <key>PresetDescription</key>
+ <string>HandBrake's preset for the iPhone 4 is optimized for viewing on its 960x480 display.</string>
+ <key>PresetName</key>
+ <string>iPhone &amp; iPod Touch</string>
+ <key>Subtitles</key>
+ <string>None</string>
+ <key>Type</key>
+ <integer>0</integer>
+ <key>UsesPictureFilters</key>
+ <integer>1</integer>
+ <key>UsesPictureSettings</key>
+ <integer>1</integer>
+ <key>VFR</key>
+ <integer>0</integer>
+ <key>VideoAvgBitrate</key>
+ <string>2500</string>
+ <key>VideoEncoder</key>
+ <string>H.264 (x264)</string>
+ <key>VideoFramerate</key>
+ <string>29.97 (NTSC Video)</string>
+ <key>VideoFramerateMode</key>
+ <string>pfr</string>
+ <key>VideoGrayScale</key>
+ <integer>0</integer>
+ <key>VideoQualitySlider</key>
+ <real>22</real>
+ <key>VideoQualityType</key>
+ <integer>2</integer>
+ <key>VideoTwoPass</key>
+ <integer>0</integer>
+ <key>h264Level</key>
+ <string>3.1</string>
<key>x264UseAdvancedOptions</key>
<false />
- <key>x264Option</key>
- <string>level=3.1:vbv-bufsize=17500:vbv-maxrate=17500</string>
- <key>x264OptionExtra</key>
- <string></string>
- <key>x264Preset</key>
- <string>medium</string>
- <key>h264Profile</key>
- <string>high</string>
- <key>x264Tune</key>
- <string>none</string>
- </dict>
- <dict>
- <key>AudioList</key>
- <array>
- <dict>
- <key>AudioBitrate</key>
- <string>160</string>
- <key>AudioEncoder</key>
- <string>AAC (faac)</string>
- <key>AudioMixdown</key>
- <string>Dolby Pro Logic II</string>
- <key>AudioSamplerate</key>
- <string>Auto</string>
- <key>AudioTrack</key>
- <integer>1</integer>
- <key>AudioTrackDRCSlider</key>
- <real>0.0</real>
- </dict>
- </array>
- <key>ChapterMarkers</key>
- <integer>1</integer>
- <key>Default</key>
- <integer>0</integer>
- <key>FileFormat</key>
- <string>MP4 file</string>
- <key>Folder</key>
- <false/>
- <key>Mp4LargeFile</key>
- <integer>1</integer>
- <key>PictureAutoCrop</key>
- <integer>1</integer>
- <key>PictureBottomCrop</key>
- <integer>0</integer>
- <key>PictureDeblock</key>
- <integer>0</integer>
- <key>PictureDeinterlace</key>
- <integer>0</integer>
- <key>PictureDenoise</key>
- <integer>0</integer>
- <key>PictureDetelecine</key>
- <integer>0</integer>
- <key>PictureHeight</key>
- <integer>0</integer>
- <key>PictureKeepRatio</key>
- <integer>0</integer>
- <key>PictureLeftCrop</key>
- <integer>0</integer>
- <key>PictureModulus</key>
- <integer>2</integer>
- <key>PicturePAR</key>
- <integer>2</integer>
- <key>PictureRightCrop</key>
- <integer>0</integer>
- <key>PictureTopCrop</key>
- <integer>0</integer>
- <key>PictureWidth</key>
- <integer>1280</integer>
- <key>PresetDescription</key>
- <string>HandBrake's preset for the iPad (all generations) is optimized for a good balance between quality and filesize.</string>
- <key>PresetName</key>
- <string>iPad</string>
- <key>Subtitles</key>
- <string>None</string>
- <key>Type</key>
- <integer>0</integer>
- <key>UsesPictureFilters</key>
- <integer>1</integer>
- <key>UsesPictureSettings</key>
- <integer>1</integer>
- <key>VFR</key>
- <integer>0</integer>
- <key>VideoAvgBitrate</key>
- <string>2500</string>
- <key>VideoEncoder</key>
- <string>H.264 (x264)</string>
- <key>VideoFramerate</key>
- <string>29.97 (NTSC Video)</string>
- <key>VideoFramerateMode</key>
- <string>pfr</string>
- <key>VideoGrayScale</key>
- <integer>0</integer>
- <key>VideoQualitySlider</key>
- <real>20</real>
- <key>VideoQualityType</key>
- <integer>2</integer>
- <key>VideoTwoPass</key>
- <integer>0</integer>
- <key>h264Level</key>
- <string>3.1</string>
+ <key>x264Option</key>
+ <string>level=3.1:vbv-bufsize=17500:vbv-maxrate=17500</string>
+ <key>x264OptionExtra</key>
+ <string></string>
+ <key>x264Preset</key>
+ <string>medium</string>
+ <key>h264Profile</key>
+ <string>high</string>
+ <key>x264Tune</key>
+ <string>none</string>
+ </dict>
+ <dict>
+ <key>AudioList</key>
+ <array>
+ <dict>
+ <key>AudioBitrate</key>
+ <string>160</string>
+ <key>AudioEncoder</key>
+ <string>AAC (faac)</string>
+ <key>AudioMixdown</key>
+ <string>Dolby Pro Logic II</string>
+ <key>AudioSamplerate</key>
+ <string>Auto</string>
+ <key>AudioTrack</key>
+ <integer>1</integer>
+ <key>AudioTrackDRCSlider</key>
+ <real>0.0</real>
+ </dict>
+ </array>
+ <key>ChapterMarkers</key>
+ <integer>1</integer>
+ <key>Default</key>
+ <integer>0</integer>
+ <key>FileFormat</key>
+ <string>MP4 file</string>
+ <key>Folder</key>
+ <false/>
+ <key>Mp4LargeFile</key>
+ <integer>1</integer>
+ <key>PictureAutoCrop</key>
+ <integer>1</integer>
+ <key>PictureBottomCrop</key>
+ <integer>0</integer>
+ <key>PictureDeblock</key>
+ <integer>0</integer>
+ <key>PictureDeinterlace</key>
+ <integer>0</integer>
+ <key>PictureDenoise</key>
+ <integer>0</integer>
+ <key>PictureDetelecine</key>
+ <integer>0</integer>
+ <key>PictureHeight</key>
+ <integer>0</integer>
+ <key>PictureKeepRatio</key>
+ <integer>0</integer>
+ <key>PictureLeftCrop</key>
+ <integer>0</integer>
+ <key>PictureModulus</key>
+ <integer>2</integer>
+ <key>PicturePAR</key>
+ <integer>2</integer>
+ <key>PictureRightCrop</key>
+ <integer>0</integer>
+ <key>PictureTopCrop</key>
+ <integer>0</integer>
+ <key>PictureWidth</key>
+ <integer>1280</integer>
+ <key>PresetDescription</key>
+ <string>HandBrake's preset for the iPad (all generations) is optimized for a good balance between quality and filesize.</string>
+ <key>PresetName</key>
+ <string>iPad</string>
+ <key>Subtitles</key>
+ <string>None</string>
+ <key>Type</key>
+ <integer>0</integer>
+ <key>UsesPictureFilters</key>
+ <integer>1</integer>
+ <key>UsesPictureSettings</key>
+ <integer>1</integer>
+ <key>VFR</key>
+ <integer>0</integer>
+ <key>VideoAvgBitrate</key>
+ <string>2500</string>
+ <key>VideoEncoder</key>
+ <string>H.264 (x264)</string>
+ <key>VideoFramerate</key>
+ <string>29.97 (NTSC Video)</string>
+ <key>VideoFramerateMode</key>
+ <string>pfr</string>
+ <key>VideoGrayScale</key>
+ <integer>0</integer>
+ <key>VideoQualitySlider</key>
+ <real>20</real>
+ <key>VideoQualityType</key>
+ <integer>2</integer>
+ <key>VideoTwoPass</key>
+ <integer>0</integer>
+ <key>h264Level</key>
+ <string>3.1</string>
<key>x264UseAdvancedOptions</key>
<false />
- <key>x264Option</key>
- <string>level=3.1:vbv-bufsize=17500:vbv-maxrate=17500</string>
- <key>x264OptionExtra</key>
- <string></string>
- <key>x264Preset</key>
- <string>medium</string>
- <key>h264Profile</key>
- <string>high</string>
- <key>x264Tune</key>
- <string>none</string>
- </dict>
- <dict>
- <key>AudioList</key>
- <array>
- <dict>
- <key>AudioBitrate</key>
- <string>160</string>
- <key>AudioEncoder</key>
- <string>AAC (faac)</string>
- <key>AudioMixdown</key>
- <string>Dolby Pro Logic II</string>
- <key>AudioSamplerate</key>
- <string>Auto</string>
- <key>AudioTrack</key>
- <integer>1</integer>
- <key>AudioTrackDRCSlider</key>
- <real>0.0</real>
- </dict>
- <dict>
- <key>AudioBitrate</key>
- <string>160</string>
- <key>AudioEncoder</key>
- <string>AC3 Passthru</string>
- <key>AudioMixdown</key>
- <string>None</string>
- <key>AudioSamplerate</key>
- <string>Auto</string>
- <key>AudioTrack</key>
- <integer>1</integer>
- <key>AudioTrackDRCSlider</key>
- <real>0.0</real>
- </dict>
- </array>
- <key>ChapterMarkers</key>
- <integer>1</integer>
- <key>Default</key>
- <integer>0</integer>
- <key>FileFormat</key>
- <string>MP4 file</string>
- <key>Folder</key>
- <false/>
- <key>Mp4LargeFile</key>
- <integer>1</integer>
- <key>PictureAutoCrop</key>
- <integer>1</integer>
- <key>PictureBottomCrop</key>
- <integer>0</integer>
- <key>PictureDeblock</key>
- <integer>0</integer>
- <key>PictureDeinterlace</key>
- <integer>0</integer>
- <key>PictureDenoise</key>
- <integer>0</integer>
- <key>PictureDetelecine</key>
- <integer>0</integer>
- <key>PictureHeight</key>
- <integer>0</integer>
- <key>PictureKeepRatio</key>
- <integer>0</integer>
- <key>PictureLeftCrop</key>
- <integer>0</integer>
- <key>PictureModulus</key>
- <integer>2</integer>
- <key>PicturePAR</key>
- <integer>2</integer>
- <key>PictureRightCrop</key>
- <integer>0</integer>
- <key>PictureTopCrop</key>
- <integer>0</integer>
- <key>PictureWidth</key>
- <integer>960</integer>
- <key>PresetDescription</key>
- <string>HandBrake's settings for the AppleTV and 2009's iPhone and iPod Touch lineup. Provides a good balance between quality and file size, and pushes the devices to their limits. Includes Dolby Digital 5.1 AC3 sound for the AppleTV.</string>
- <key>PresetName</key>
- <string>AppleTV</string>
- <key>Subtitles</key>
- <string>None</string>
- <key>Type</key>
- <integer>0</integer>
- <key>UsesPictureFilters</key>
- <integer>1</integer>
- <key>UsesPictureSettings</key>
- <integer>1</integer>
- <key>VFR</key>
- <integer>0</integer>
- <key>VideoAvgBitrate</key>
- <string>2500</string>
- <key>VideoEncoder</key>
- <string>H.264 (x264)</string>
- <key>VideoFramerate</key>
- <string>30</string>
- <key>VideoFramerateMode</key>
- <string>pfr</string>
- <key>VideoGrayScale</key>
- <integer>0</integer>
- <key>VideoQualitySlider</key>
- <real>20</real>
- <key>VideoQualityType</key>
- <integer>2</integer>
- <key>VideoTwoPass</key>
- <integer>0</integer>
- <key>h264Level</key>
- <string>3.1</string>
+ <key>x264Option</key>
+ <string>level=3.1:vbv-bufsize=17500:vbv-maxrate=17500</string>
+ <key>x264OptionExtra</key>
+ <string></string>
+ <key>x264Preset</key>
+ <string>medium</string>
+ <key>h264Profile</key>
+ <string>high</string>
+ <key>x264Tune</key>
+ <string>none</string>
+ </dict>
+ <dict>
+ <key>AudioList</key>
+ <array>
+ <dict>
+ <key>AudioBitrate</key>
+ <string>160</string>
+ <key>AudioEncoder</key>
+ <string>AAC (faac)</string>
+ <key>AudioMixdown</key>
+ <string>Dolby Pro Logic II</string>
+ <key>AudioSamplerate</key>
+ <string>Auto</string>
+ <key>AudioTrack</key>
+ <integer>1</integer>
+ <key>AudioTrackDRCSlider</key>
+ <real>0.0</real>
+ </dict>
+ <dict>
+ <key>AudioBitrate</key>
+ <string>160</string>
+ <key>AudioEncoder</key>
+ <string>AC3 Passthru</string>
+ <key>AudioMixdown</key>
+ <string>None</string>
+ <key>AudioSamplerate</key>
+ <string>Auto</string>
+ <key>AudioTrack</key>
+ <integer>1</integer>
+ <key>AudioTrackDRCSlider</key>
+ <real>0.0</real>
+ </dict>
+ </array>
+ <key>ChapterMarkers</key>
+ <integer>1</integer>
+ <key>Default</key>
+ <integer>0</integer>
+ <key>FileFormat</key>
+ <string>MP4 file</string>
+ <key>Folder</key>
+ <false/>
+ <key>Mp4LargeFile</key>
+ <integer>1</integer>
+ <key>PictureAutoCrop</key>
+ <integer>1</integer>
+ <key>PictureBottomCrop</key>
+ <integer>0</integer>
+ <key>PictureDeblock</key>
+ <integer>0</integer>
+ <key>PictureDeinterlace</key>
+ <integer>0</integer>
+ <key>PictureDenoise</key>
+ <integer>0</integer>
+ <key>PictureDetelecine</key>
+ <integer>0</integer>
+ <key>PictureHeight</key>
+ <integer>0</integer>
+ <key>PictureKeepRatio</key>
+ <integer>0</integer>
+ <key>PictureLeftCrop</key>
+ <integer>0</integer>
+ <key>PictureModulus</key>
+ <integer>2</integer>
+ <key>PicturePAR</key>
+ <integer>2</integer>
+ <key>PictureRightCrop</key>
+ <integer>0</integer>
+ <key>PictureTopCrop</key>
+ <integer>0</integer>
+ <key>PictureWidth</key>
+ <integer>960</integer>
+ <key>PresetDescription</key>
+ <string>HandBrake's settings for the AppleTV and 2009's iPhone and iPod Touch lineup. Provides a good balance between quality and file size, and pushes the devices to their limits. Includes Dolby Digital 5.1 AC3 sound for the AppleTV.</string>
+ <key>PresetName</key>
+ <string>AppleTV</string>
+ <key>Subtitles</key>
+ <string>None</string>
+ <key>Type</key>
+ <integer>0</integer>
+ <key>UsesPictureFilters</key>
+ <integer>1</integer>
+ <key>UsesPictureSettings</key>
+ <integer>1</integer>
+ <key>VFR</key>
+ <integer>0</integer>
+ <key>VideoAvgBitrate</key>
+ <string>2500</string>
+ <key>VideoEncoder</key>
+ <string>H.264 (x264)</string>
+ <key>VideoFramerate</key>
+ <string>30</string>
+ <key>VideoFramerateMode</key>
+ <string>pfr</string>
+ <key>VideoGrayScale</key>
+ <integer>0</integer>
+ <key>VideoQualitySlider</key>
+ <real>20</real>
+ <key>VideoQualityType</key>
+ <integer>2</integer>
+ <key>VideoTwoPass</key>
+ <integer>0</integer>
+ <key>h264Level</key>
+ <string>3.1</string>
<key>x264UseAdvancedOptions</key>
<false />
- <key>x264Option</key>
- <string>cabac=0:ref=2:b-pyramid=none:weightb=0:weightp=0:vbv-maxrate=9500:vbv-bufsize=9500:level=3.1:8x8dct=0</string>
- <key>x264OptionExtra</key>
- <string>cabac=0:ref=2:b-pyramid=none:weightb=0:weightp=0:vbv-maxrate=9500:vbv-bufsize=9500</string>
- <key>x264Preset</key>
- <string>medium</string>
- <key>h264Profile</key>
- <string>main</string>
- <key>x264Tune</key>
- <string>none</string>
- </dict>
- <dict>
- <key>AudioList</key>
- <array>
- <dict>
- <key>AudioBitrate</key>
- <string>160</string>
- <key>AudioEncoder</key>
- <string>AAC (faac)</string>
- <key>AudioMixdown</key>
- <string>Dolby Pro Logic II</string>
- <key>AudioSamplerate</key>
- <string>Auto</string>
- <key>AudioTrack</key>
- <integer>1</integer>
- <key>AudioTrackDRCSlider</key>
- <real>0.0</real>
- </dict>
- <dict>
- <key>AudioBitrate</key>
- <string>160</string>
- <key>AudioEncoder</key>
- <string>AC3 Passthru</string>
- <key>AudioMixdown</key>
- <string>None</string>
- <key>AudioSamplerate</key>
- <string>Auto</string>
- <key>AudioTrack</key>
- <integer>1</integer>
- <key>AudioTrackDRCSlider</key>
- <real>0.0</real>
- </dict>
- </array>
- <key>ChapterMarkers</key>
- <integer>1</integer>
- <key>Default</key>
- <integer>0</integer>
- <key>FileFormat</key>
- <string>MP4 file</string>
- <key>Folder</key>
- <false/>
- <key>Mp4LargeFile</key>
- <integer>1</integer>
- <key>PictureAutoCrop</key>
- <integer>1</integer>
- <key>PictureBottomCrop</key>
- <integer>0</integer>
- <key>PictureDeblock</key>
- <integer>0</integer>
- <key>PictureDeinterlace</key>
- <integer>0</integer>
- <key>PictureDenoise</key>
- <integer>0</integer>
- <key>PictureDetelecine</key>
- <integer>0</integer>
- <key>PictureHeight</key>
- <integer>0</integer>
- <key>PictureKeepRatio</key>
- <integer>0</integer>
- <key>PictureLeftCrop</key>
- <integer>0</integer>
- <key>PictureModulus</key>
- <integer>2</integer>
- <key>PicturePAR</key>
- <integer>2</integer>
- <key>PictureRightCrop</key>
- <integer>0</integer>
- <key>PictureTopCrop</key>
- <integer>0</integer>
- <key>PictureWidth</key>
- <integer>1280</integer>
- <key>PresetDescription</key>
- <string>HandBrake's preset for the Apple TV (2nd gen) is optimized for viewing on its 1280x720 display.</string>
- <key>PresetName</key>
- <string>AppleTV 2</string>
- <key>Subtitles</key>
- <string>None</string>
- <key>Type</key>
- <integer>0</integer>
- <key>UsesPictureFilters</key>
- <integer>1</integer>
- <key>UsesPictureSettings</key>
- <integer>1</integer>
- <key>VFR</key>
- <integer>0</integer>
- <key>VideoAvgBitrate</key>
- <string>2500</string>
- <key>VideoEncoder</key>
- <string>H.264 (x264)</string>
- <key>VideoFramerate</key>
- <string>29.97 (NTSC Video)</string>
- <key>VideoFramerateMode</key>
- <string>pfr</string>
- <key>VideoGrayScale</key>
- <integer>0</integer>
- <key>VideoQualitySlider</key>
- <real>20</real>
- <key>VideoQualityType</key>
- <integer>2</integer>
- <key>VideoTwoPass</key>
- <integer>0</integer>
- <key>h264Level</key>
- <string>3.1</string>
+ <key>x264Option</key>
+ <string>cabac=0:ref=2:b-pyramid=none:weightb=0:weightp=0:vbv-maxrate=9500:vbv-bufsize=9500:level=3.1:8x8dct=0</string>
+ <key>x264OptionExtra</key>
+ <string>cabac=0:ref=2:b-pyramid=none:weightb=0:weightp=0:vbv-maxrate=9500:vbv-bufsize=9500</string>
+ <key>x264Preset</key>
+ <string>medium</string>
+ <key>h264Profile</key>
+ <string>main</string>
+ <key>x264Tune</key>
+ <string>none</string>
+ </dict>
+ <dict>
+ <key>AudioList</key>
+ <array>
+ <dict>
+ <key>AudioBitrate</key>
+ <string>160</string>
+ <key>AudioEncoder</key>
+ <string>AAC (faac)</string>
+ <key>AudioMixdown</key>
+ <string>Dolby Pro Logic II</string>
+ <key>AudioSamplerate</key>
+ <string>Auto</string>
+ <key>AudioTrack</key>
+ <integer>1</integer>
+ <key>AudioTrackDRCSlider</key>
+ <real>0.0</real>
+ </dict>
+ <dict>
+ <key>AudioBitrate</key>
+ <string>160</string>
+ <key>AudioEncoder</key>
+ <string>AC3 Passthru</string>
+ <key>AudioMixdown</key>
+ <string>None</string>
+ <key>AudioSamplerate</key>
+ <string>Auto</string>
+ <key>AudioTrack</key>
+ <integer>1</integer>
+ <key>AudioTrackDRCSlider</key>
+ <real>0.0</real>
+ </dict>
+ </array>
+ <key>ChapterMarkers</key>
+ <integer>1</integer>
+ <key>Default</key>
+ <integer>0</integer>
+ <key>FileFormat</key>
+ <string>MP4 file</string>
+ <key>Folder</key>
+ <false/>
+ <key>Mp4LargeFile</key>
+ <integer>1</integer>
+ <key>PictureAutoCrop</key>
+ <integer>1</integer>
+ <key>PictureBottomCrop</key>
+ <integer>0</integer>
+ <key>PictureDeblock</key>
+ <integer>0</integer>
+ <key>PictureDeinterlace</key>
+ <integer>0</integer>
+ <key>PictureDenoise</key>
+ <integer>0</integer>
+ <key>PictureDetelecine</key>
+ <integer>0</integer>
+ <key>PictureHeight</key>
+ <integer>0</integer>
+ <key>PictureKeepRatio</key>
+ <integer>0</integer>
+ <key>PictureLeftCrop</key>
+ <integer>0</integer>
+ <key>PictureModulus</key>
+ <integer>2</integer>
+ <key>PicturePAR</key>
+ <integer>2</integer>
+ <key>PictureRightCrop</key>
+ <integer>0</integer>
+ <key>PictureTopCrop</key>
+ <integer>0</integer>
+ <key>PictureWidth</key>
+ <integer>1280</integer>
+ <key>PresetDescription</key>
+ <string>HandBrake's preset for the Apple TV (2nd gen) is optimized for viewing on its 1280x720 display.</string>
+ <key>PresetName</key>
+ <string>AppleTV 2</string>
+ <key>Subtitles</key>
+ <string>None</string>
+ <key>Type</key>
+ <integer>0</integer>
+ <key>UsesPictureFilters</key>
+ <integer>1</integer>
+ <key>UsesPictureSettings</key>
+ <integer>1</integer>
+ <key>VFR</key>
+ <integer>0</integer>
+ <key>VideoAvgBitrate</key>
+ <string>2500</string>
+ <key>VideoEncoder</key>
+ <string>H.264 (x264)</string>
+ <key>VideoFramerate</key>
+ <string>29.97 (NTSC Video)</string>
+ <key>VideoFramerateMode</key>
+ <string>pfr</string>
+ <key>VideoGrayScale</key>
+ <integer>0</integer>
+ <key>VideoQualitySlider</key>
+ <real>20</real>
+ <key>VideoQualityType</key>
+ <integer>2</integer>
+ <key>VideoTwoPass</key>
+ <integer>0</integer>
+ <key>h264Level</key>
+ <string>3.1</string>
<key>x264UseAdvancedOptions</key>
<false />
- <key>x264Option</key>
- <string>level=3.1:vbv-bufsize=17500:vbv-maxrate=17500</string>
- <key>x264OptionExtra</key>
- <string></string>
- <key>x264Preset</key>
- <string>medium</string>
- <key>h264Profile</key>
- <string>high</string>
- <key>x264Tune</key>
- <string>none</string>
- </dict>
- <dict>
- <key>AudioList</key>
- <array>
- <dict>
- <key>AudioBitrate</key>
- <string>160</string>
- <key>AudioEncoder</key>
- <string>AAC (faac)</string>
- <key>AudioMixdown</key>
- <string>Dolby Pro Logic II</string>
- <key>AudioSamplerate</key>
- <string>Auto</string>
- <key>AudioTrack</key>
- <integer>1</integer>
- <key>AudioTrackDRCSlider</key>
- <real>0.0</real>
- </dict>
- <dict>
- <key>AudioBitrate</key>
- <string>160</string>
- <key>AudioEncoder</key>
- <string>AC3 Passthru</string>
- <key>AudioMixdown</key>
- <string>None</string>
- <key>AudioSamplerate</key>
- <string>Auto</string>
- <key>AudioTrack</key>
- <integer>1</integer>
- <key>AudioTrackDRCSlider</key>
- <real>0.0</real>
- </dict>
- </array>
- <key>ChapterMarkers</key>
- <integer>1</integer>
- <key>Default</key>
- <integer>0</integer>
- <key>FileFormat</key>
- <string>MP4 file</string>
- <key>Folder</key>
- <false/>
- <key>Mp4LargeFile</key>
- <integer>1</integer>
- <key>PictureAutoCrop</key>
- <integer>1</integer>
- <key>PictureBottomCrop</key>
- <integer>0</integer>
- <key>PictureDeblock</key>
- <integer>0</integer>
- <key>PictureDecomb</key>
- <integer>3</integer>
- <key>PictureDecombDeinterlace</key>
- <integer>1</integer>
- <key>PictureDeinterlace</key>
- <integer>0</integer>
- <key>PictureDenoise</key>
- <integer>0</integer>
- <key>PictureDetelecine</key>
- <integer>0</integer>
- <key>PictureHeight</key>
- <integer>0</integer>
- <key>PictureKeepRatio</key>
- <integer>0</integer>
- <key>PictureLeftCrop</key>
- <integer>0</integer>
- <key>PictureModulus</key>
- <integer>2</integer>
- <key>PicturePAR</key>
- <integer>2</integer>
- <key>PictureRightCrop</key>
- <integer>0</integer>
- <key>PictureTopCrop</key>
- <integer>0</integer>
- <key>PictureWidth</key>
- <integer>1920</integer>
- <key>PresetDescription</key>
- <string>HandBrake's preset for the Apple TV (3rd gen) is optimized for up to 1080p playback.</string>
- <key>PresetName</key>
- <string>AppleTV 3</string>
- <key>Subtitles</key>
- <string>None</string>
- <key>Type</key>
- <integer>0</integer>
- <key>UsesPictureFilters</key>
- <integer>1</integer>
- <key>UsesPictureSettings</key>
- <integer>1</integer>
- <key>VideoAvgBitrate</key>
- <string>2500</string>
- <key>VideoEncoder</key>
- <string>H.264 (x264)</string>
- <key>VideoFramerate</key>
- <string>30</string>
- <key>VideoFramerateMode</key>
- <string>pfr</string>
- <key>VideoGrayScale</key>
- <integer>0</integer>
- <key>VideoQualitySlider</key>
- <real>20</real>
- <key>VideoQualityType</key>
- <integer>2</integer>
- <key>VideoTwoPass</key>
- <integer>0</integer>
- <key>h264Level</key>
- <string>4.0</string>
+ <key>x264Option</key>
+ <string>level=3.1:vbv-bufsize=17500:vbv-maxrate=17500</string>
+ <key>x264OptionExtra</key>
+ <string></string>
+ <key>x264Preset</key>
+ <string>medium</string>
+ <key>h264Profile</key>
+ <string>high</string>
+ <key>x264Tune</key>
+ <string>none</string>
+ </dict>
+ <dict>
+ <key>AudioList</key>
+ <array>
+ <dict>
+ <key>AudioBitrate</key>
+ <string>160</string>
+ <key>AudioEncoder</key>
+ <string>AAC (faac)</string>
+ <key>AudioMixdown</key>
+ <string>Dolby Pro Logic II</string>
+ <key>AudioSamplerate</key>
+ <string>Auto</string>
+ <key>AudioTrack</key>
+ <integer>1</integer>
+ <key>AudioTrackDRCSlider</key>
+ <real>0.0</real>
+ </dict>
+ <dict>
+ <key>AudioBitrate</key>
+ <string>160</string>
+ <key>AudioEncoder</key>
+ <string>AC3 Passthru</string>
+ <key>AudioMixdown</key>
+ <string>None</string>
+ <key>AudioSamplerate</key>
+ <string>Auto</string>
+ <key>AudioTrack</key>
+ <integer>1</integer>
+ <key>AudioTrackDRCSlider</key>
+ <real>0.0</real>
+ </dict>
+ </array>
+ <key>ChapterMarkers</key>
+ <integer>1</integer>
+ <key>Default</key>
+ <integer>0</integer>
+ <key>FileFormat</key>
+ <string>MP4 file</string>
+ <key>Folder</key>
+ <false/>
+ <key>Mp4LargeFile</key>
+ <integer>1</integer>
+ <key>PictureAutoCrop</key>
+ <integer>1</integer>
+ <key>PictureBottomCrop</key>
+ <integer>0</integer>
+ <key>PictureDeblock</key>
+ <integer>0</integer>
+ <key>PictureDecomb</key>
+ <integer>3</integer>
+ <key>PictureDecombDeinterlace</key>
+ <integer>1</integer>
+ <key>PictureDeinterlace</key>
+ <integer>0</integer>
+ <key>PictureDenoise</key>
+ <integer>0</integer>
+ <key>PictureDetelecine</key>
+ <integer>0</integer>
+ <key>PictureHeight</key>
+ <integer>0</integer>
+ <key>PictureKeepRatio</key>
+ <integer>0</integer>
+ <key>PictureLeftCrop</key>
+ <integer>0</integer>
+ <key>PictureModulus</key>
+ <integer>2</integer>
+ <key>PicturePAR</key>
+ <integer>2</integer>
+ <key>PictureRightCrop</key>
+ <integer>0</integer>
+ <key>PictureTopCrop</key>
+ <integer>0</integer>
+ <key>PictureWidth</key>
+ <integer>1920</integer>
+ <key>PresetDescription</key>
+ <string>HandBrake's preset for the Apple TV (3rd gen) is optimized for up to 1080p playback.</string>
+ <key>PresetName</key>
+ <string>AppleTV 3</string>
+ <key>Subtitles</key>
+ <string>None</string>
+ <key>Type</key>
+ <integer>0</integer>
+ <key>UsesPictureFilters</key>
+ <integer>1</integer>
+ <key>UsesPictureSettings</key>
+ <integer>1</integer>
+ <key>VideoAvgBitrate</key>
+ <string>2500</string>
+ <key>VideoEncoder</key>
+ <string>H.264 (x264)</string>
+ <key>VideoFramerate</key>
+ <string>30</string>
+ <key>VideoFramerateMode</key>
+ <string>pfr</string>
+ <key>VideoGrayScale</key>
+ <integer>0</integer>
+ <key>VideoQualitySlider</key>
+ <real>20</real>
+ <key>VideoQualityType</key>
+ <integer>2</integer>
+ <key>VideoTwoPass</key>
+ <integer>0</integer>
+ <key>h264Level</key>
+ <string>4.0</string>
<key>x264UseAdvancedOptions</key>
<false />
- <key>x264Option</key>
- <string>level=4.0:vbv-bufsize=31250:vbv-maxrate=25000</string>
- <key>x264OptionExtra</key>
- <string></string>
- <key>x264Preset</key>
- <string>medium</string>
- <key>h264Profile</key>
- <string>high</string>
- <key>x264Tune</key>
- <string>none</string>
- </dict>
- <dict>
- <key>AudioList</key>
- <array>
- <dict>
- <key>AudioBitrate</key>
- <string>128</string>
- <key>AudioEncoder</key>
- <string>AAC (faac)</string>
- <key>AudioMixdown</key>
- <string>Dolby Pro Logic II</string>
- <key>AudioSamplerate</key>
- <string>Auto</string>
- <key>AudioTrack</key>
- <integer>1</integer>
- <key>AudioTrackDRCSlider</key>
- <real>0.0</real>
- </dict>
- </array>
- <key>ChapterMarkers</key>
- <integer>0</integer>
- <key>Default</key>
- <integer>0</integer>
- <key>FileFormat</key>
- <string>MP4 file</string>
- <key>Mp4LargeFile</key>
- <integer>0</integer>
- <key>Mp4iPodCompatible</key>
- <integer>0</integer>
- <key>PictureAutoCrop</key>
- <integer>1</integer>
- <key>PictureBottomCrop</key>
- <integer>0</integer>
- <key>PictureDeblock</key>
- <integer>0</integer>
- <key>PictureDeinterlace</key>
- <integer>0</integer>
- <key>PictureDenoise</key>
- <integer>0</integer>
- <key>PictureDetelecine</key>
- <integer>0</integer>
- <key>PictureHeight</key>
- <integer>0</integer>
- <key>PictureKeepRatio</key>
- <integer>1</integer>
- <key>PictureLeftCrop</key>
- <integer>0</integer>
- <key>PictureModulus</key>
- <integer>2</integer>
- <key>PicturePAR</key>
- <integer>2</integer>
- <key>PictureRightCrop</key>
- <integer>0</integer>
- <key>PictureTopCrop</key>
- <integer>0</integer>
- <key>PictureWidth</key>
- <integer>720</integer>
- <key>PresetDescription</key>
- <string>HandBrake's settings for Mid-range Android 2.3 or better devices.</string>
- <key>PresetName</key>
- <string>Android</string>
- <key>Subtitles</key>
- <string>None</string>
- <key>Type</key>
- <integer>0</integer>
- <key>UsesPictureFilters</key>
- <integer>1</integer>
- <key>UsesPictureSettings</key>
- <integer>1</integer>
- <key>VFR</key>
- <integer>0</integer>
- <key>VideoAvgBitrate</key>
- <string>960</string>
- <key>VideoEncoder</key>
- <string>H.264 (x264)</string>
- <key>VideoFramerate</key>
- <string>29.97 (NTSC Video)</string>
- <key>VideoFramerateMode</key>
- <string>pfr</string>
- <key>VideoGrayScale</key>
- <integer>0</integer>
- <key>VideoQualitySlider</key>
- <real>22</real>
- <key>VideoQualityType</key>
- <integer>2</integer>
- <key>VideoTwoPass</key>
- <integer>0</integer>
- <key>h264Level</key>
- <string>2.2</string>
+ <key>x264Option</key>
+ <string>level=4.0:vbv-bufsize=31250:vbv-maxrate=25000</string>
+ <key>x264OptionExtra</key>
+ <string></string>
+ <key>x264Preset</key>
+ <string>medium</string>
+ <key>h264Profile</key>
+ <string>high</string>
+ <key>x264Tune</key>
+ <string>none</string>
+ </dict>
+ <dict>
+ <key>AudioList</key>
+ <array>
+ <dict>
+ <key>AudioBitrate</key>
+ <string>128</string>
+ <key>AudioEncoder</key>
+ <string>AAC (faac)</string>
+ <key>AudioMixdown</key>
+ <string>Dolby Pro Logic II</string>
+ <key>AudioSamplerate</key>
+ <string>Auto</string>
+ <key>AudioTrack</key>
+ <integer>1</integer>
+ <key>AudioTrackDRCSlider</key>
+ <real>0.0</real>
+ </dict>
+ </array>
+ <key>ChapterMarkers</key>
+ <integer>0</integer>
+ <key>Default</key>
+ <integer>0</integer>
+ <key>FileFormat</key>
+ <string>MP4 file</string>
+ <key>Mp4LargeFile</key>
+ <integer>0</integer>
+ <key>Mp4iPodCompatible</key>
+ <integer>0</integer>
+ <key>PictureAutoCrop</key>
+ <integer>1</integer>
+ <key>PictureBottomCrop</key>
+ <integer>0</integer>
+ <key>PictureDeblock</key>
+ <integer>0</integer>
+ <key>PictureDeinterlace</key>
+ <integer>0</integer>
+ <key>PictureDenoise</key>
+ <integer>0</integer>
+ <key>PictureDetelecine</key>
+ <integer>0</integer>
+ <key>PictureHeight</key>
+ <integer>0</integer>
+ <key>PictureKeepRatio</key>
+ <integer>1</integer>
+ <key>PictureLeftCrop</key>
+ <integer>0</integer>
+ <key>PictureModulus</key>
+ <integer>2</integer>
+ <key>PicturePAR</key>
+ <integer>2</integer>
+ <key>PictureRightCrop</key>
+ <integer>0</integer>
+ <key>PictureTopCrop</key>
+ <integer>0</integer>
+ <key>PictureWidth</key>
+ <integer>720</integer>
+ <key>PresetDescription</key>
+ <string>HandBrake's settings for Mid-range Android 2.3 or better devices.</string>
+ <key>PresetName</key>
+ <string>Android</string>
+ <key>Subtitles</key>
+ <string>None</string>
+ <key>Type</key>
+ <integer>0</integer>
+ <key>UsesPictureFilters</key>
+ <integer>1</integer>
+ <key>UsesPictureSettings</key>
+ <integer>1</integer>
+ <key>VFR</key>
+ <integer>0</integer>
+ <key>VideoAvgBitrate</key>
+ <string>960</string>
+ <key>VideoEncoder</key>
+ <string>H.264 (x264)</string>
+ <key>VideoFramerate</key>
+ <string>29.97 (NTSC Video)</string>
+ <key>VideoFramerateMode</key>
+ <string>pfr</string>
+ <key>VideoGrayScale</key>
+ <integer>0</integer>
+ <key>VideoQualitySlider</key>
+ <real>22</real>
+ <key>VideoQualityType</key>
+ <integer>2</integer>
+ <key>VideoTwoPass</key>
+ <integer>0</integer>
+ <key>h264Level</key>
+ <string>2.2</string>
<key>x264UseAdvancedOptions</key>
<false />
- <key>x264Option</key>
- <string>level=2.2:ref=1:bframes=0:8x8dct=0:vbv-bufsize=4000:vbv-maxrate=4000</string>
- <key>x264OptionExtra</key>
- <string></string>
- <key>x264Preset</key>
- <string>medium</string>
- <key>h264Profile</key>
- <string>main</string>
- <key>x264Tune</key>
- <string>none</string>
- </dict>
- <dict>
- <key>AudioList</key>
- <array>
- <dict>
- <key>AudioBitrate</key>
- <string>128</string>
- <key>AudioEncoder</key>
- <string>AAC (faac)</string>
- <key>AudioMixdown</key>
- <string>Dolby Pro Logic II</string>
- <key>AudioSamplerate</key>
- <string>Auto</string>
- <key>AudioTrack</key>
- <integer>1</integer>
- <key>AudioTrackDRCSlider</key>
- <real>0.0</real>
- </dict>
- </array>
- <key>ChapterMarkers</key>
- <integer>0</integer>
- <key>Default</key>
- <integer>0</integer>
- <key>FileFormat</key>
- <string>MP4 file</string>
- <key>Folder</key>
- <false/>
- <key>Mp4LargeFile</key>
- <integer>0</integer>
- <key>PictureAutoCrop</key>
- <integer>1</integer>
- <key>PictureBottomCrop</key>
- <integer>0</integer>
- <key>PictureDeblock</key>
- <integer>0</integer>
- <key>PictureDeinterlace</key>
- <integer>0</integer>
- <key>PictureDenoise</key>
- <integer>0</integer>
- <key>PictureDetelecine</key>
- <integer>0</integer>
- <key>PictureHeight</key>
- <integer>0</integer>
- <key>PictureKeepRatio</key>
- <integer>0</integer>
- <key>PictureLeftCrop</key>
- <integer>0</integer>
- <key>PictureModulus</key>
- <integer>2</integer>
- <key>PicturePAR</key>
- <integer>2</integer>
- <key>PictureRightCrop</key>
- <integer>0</integer>
- <key>PictureTopCrop</key>
- <integer>0</integer>
- <key>PictureWidth</key>
- <integer>1280</integer>
- <key>PresetDescription</key>
- <string>HandBrake's preset for the Higher end Anroid 2.3 or better devices.</string>
- <key>PresetName</key>
- <string>Android Tablet</string>
- <key>Subtitles</key>
- <string>None</string>
- <key>Type</key>
- <integer>0</integer>
- <key>UsesPictureFilters</key>
- <integer>1</integer>
- <key>UsesPictureSettings</key>
- <integer>1</integer>
- <key>VFR</key>
- <integer>0</integer>
- <key>VideoAvgBitrate</key>
- <string>2500</string>
- <key>VideoEncoder</key>
- <string>H.264 (x264)</string>
- <key>VideoFramerate</key>
- <string>29.97 (NTSC Video)</string>
- <key>VideoFramerateMode</key>
- <string>pfr</string>
- <key>VideoGrayScale</key>
- <integer>0</integer>
- <key>VideoQualitySlider</key>
- <real>22</real>
- <key>VideoQualityType</key>
- <integer>2</integer>
- <key>VideoTwoPass</key>
- <integer>0</integer>
- <key>h264Level</key>
- <string>3.1</string>
+ <key>x264Option</key>
+ <string>level=2.2:ref=1:bframes=0:8x8dct=0:vbv-bufsize=4000:vbv-maxrate=4000</string>
+ <key>x264OptionExtra</key>
+ <string></string>
+ <key>x264Preset</key>
+ <string>medium</string>
+ <key>h264Profile</key>
+ <string>main</string>
+ <key>x264Tune</key>
+ <string>none</string>
+ </dict>
+ <dict>
+ <key>AudioList</key>
+ <array>
+ <dict>
+ <key>AudioBitrate</key>
+ <string>128</string>
+ <key>AudioEncoder</key>
+ <string>AAC (faac)</string>
+ <key>AudioMixdown</key>
+ <string>Dolby Pro Logic II</string>
+ <key>AudioSamplerate</key>
+ <string>Auto</string>
+ <key>AudioTrack</key>
+ <integer>1</integer>
+ <key>AudioTrackDRCSlider</key>
+ <real>0.0</real>
+ </dict>
+ </array>
+ <key>ChapterMarkers</key>
+ <integer>0</integer>
+ <key>Default</key>
+ <integer>0</integer>
+ <key>FileFormat</key>
+ <string>MP4 file</string>
+ <key>Folder</key>
+ <false/>
+ <key>Mp4LargeFile</key>
+ <integer>0</integer>
+ <key>PictureAutoCrop</key>
+ <integer>1</integer>
+ <key>PictureBottomCrop</key>
+ <integer>0</integer>
+ <key>PictureDeblock</key>
+ <integer>0</integer>
+ <key>PictureDeinterlace</key>
+ <integer>0</integer>
+ <key>PictureDenoise</key>
+ <integer>0</integer>
+ <key>PictureDetelecine</key>
+ <integer>0</integer>
+ <key>PictureHeight</key>
+ <integer>0</integer>
+ <key>PictureKeepRatio</key>
+ <integer>0</integer>
+ <key>PictureLeftCrop</key>
+ <integer>0</integer>
+ <key>PictureModulus</key>
+ <integer>2</integer>
+ <key>PicturePAR</key>
+ <integer>2</integer>
+ <key>PictureRightCrop</key>
+ <integer>0</integer>
+ <key>PictureTopCrop</key>
+ <integer>0</integer>
+ <key>PictureWidth</key>
+ <integer>1280</integer>
+ <key>PresetDescription</key>
+ <string>HandBrake's preset for the Higher end Anroid 2.3 or better devices.</string>
+ <key>PresetName</key>
+ <string>Android Tablet</string>
+ <key>Subtitles</key>
+ <string>None</string>
+ <key>Type</key>
+ <integer>0</integer>
+ <key>UsesPictureFilters</key>
+ <integer>1</integer>
+ <key>UsesPictureSettings</key>
+ <integer>1</integer>
+ <key>VFR</key>
+ <integer>0</integer>
+ <key>VideoAvgBitrate</key>
+ <string>2500</string>
+ <key>VideoEncoder</key>
+ <string>H.264 (x264)</string>
+ <key>VideoFramerate</key>
+ <string>29.97 (NTSC Video)</string>
+ <key>VideoFramerateMode</key>
+ <string>pfr</string>
+ <key>VideoGrayScale</key>
+ <integer>0</integer>
+ <key>VideoQualitySlider</key>
+ <real>22</real>
+ <key>VideoQualityType</key>
+ <integer>2</integer>
+ <key>VideoTwoPass</key>
+ <integer>0</integer>
+ <key>h264Level</key>
+ <string>3.1</string>
<key>x264UseAdvancedOptions</key>
<false />
- <key>x264Option</key>
- <string>level=3.1:8x8dct=0:vbv-bufsize=14000:vbv-maxrate=14000</string>
- <key>x264OptionExtra</key>
- <string></string>
- <key>x264Preset</key>
- <string>medium</string>
- <key>h264Profile</key>
- <string>main</string>
- <key>x264Tune</key>
- <string>none</string>
- </dict>
- </array>
- <key>Default</key>
- <integer>0</integer>
- <key>Folder</key>
- <true/>
- <key>PresetBuildNumber</key>
- <integer>2012041101</integer>
- <key>PresetName</key>
- <string>Devices</string>
- <key>Type</key>
- <integer>0</integer>
- </dict>
- <dict>
- <key>ChildrenArray</key>
- <array>
- <dict>
- <key>AudioList</key>
- <array>
- <dict>
- <key>AudioBitrate</key>
- <string>160</string>
- <key>AudioEncoder</key>
- <string>AAC (faac)</string>
- <key>AudioMixdown</key>
- <string>Dolby Pro Logic II</string>
- <key>AudioSamplerate</key>
- <string>Auto</string>
- <key>AudioTrack</key>
- <integer>1</integer>
- <key>AudioTrackDRCSlider</key>
- <real>0.0</real>
- </dict>
- </array>
- <key>ChapterMarkers</key>
- <integer>1</integer>
- <key>Default</key>
- <integer>1</integer>
- <key>FileFormat</key>
- <string>MP4 file</string>
- <key>PictureAutoCrop</key>
- <integer>1</integer>
- <key>PictureBottomCrop</key>
- <integer>0</integer>
- <key>PictureDeblock</key>
- <integer>0</integer>
- <key>PictureDeinterlace</key>
- <integer>0</integer>
- <key>PictureDenoise</key>
- <integer>0</integer>
- <key>PictureDetelecine</key>
- <integer>0</integer>
- <key>PictureHeight</key>
- <integer>0</integer>
- <key>PictureKeepRatio</key>
- <integer>0</integer>
- <key>PictureLeftCrop</key>
- <integer>0</integer>
- <key>PictureModulus</key>
- <integer>2</integer>
- <key>PicturePAR</key>
- <integer>2</integer>
- <key>PictureRightCrop</key>
- <integer>0</integer>
- <key>PictureTopCrop</key>
- <integer>0</integer>
- <key>PictureWidth</key>
- <integer>0</integer>
- <key>PresetDescription</key>
- <string>HandBrake's normal, default settings.</string>
- <key>PresetName</key>
- <string>Normal</string>
- <key>Subtitles</key>
- <string>None</string>
- <key>Type</key>
- <integer>0</integer>
- <key>UsesPictureFilters</key>
- <integer>1</integer>
- <key>UsesPictureSettings</key>
- <integer>2</integer>
- <key>VFR</key>
- <integer>0</integer>
- <key>VideoAvgBitrate</key>
- <string>1500</string>
- <key>VideoEncoder</key>
- <string>H.264 (x264)</string>
- <key>VideoFramerate</key>
- <string>Same as source</string>
- <key>VideoFramerateMode</key>
- <string>vfr</string>
- <key>VideoGrayScale</key>
- <integer>0</integer>
- <key>VideoQualitySlider</key>
- <real>20</real>
- <key>VideoQualityType</key>
- <integer>2</integer>
- <key>VideoTurboTwoPass</key>
- <integer>0</integer>
- <key>VideoTwoPass</key>
- <integer>0</integer>
- <key>h264Level</key>
- <string>4.0</string>
+ <key>x264Option</key>
+ <string>level=3.1:8x8dct=0:vbv-bufsize=14000:vbv-maxrate=14000</string>
+ <key>x264OptionExtra</key>
+ <string></string>
+ <key>x264Preset</key>
+ <string>medium</string>
+ <key>h264Profile</key>
+ <string>main</string>
+ <key>x264Tune</key>
+ <string>none</string>
+ </dict>
+ </array>
+ <key>Default</key>
+ <integer>0</integer>
+ <key>Folder</key>
+ <true/>
+ <key>PresetBuildNumber</key>
+ <integer>2012041101</integer>
+ <key>PresetName</key>
+ <string>Devices</string>
+ <key>Type</key>
+ <integer>0</integer>
+ </dict>
+ <dict>
+ <key>ChildrenArray</key>
+ <array>
+ <dict>
+ <key>AudioList</key>
+ <array>
+ <dict>
+ <key>AudioBitrate</key>
+ <string>160</string>
+ <key>AudioEncoder</key>
+ <string>AAC (faac)</string>
+ <key>AudioMixdown</key>
+ <string>Dolby Pro Logic II</string>
+ <key>AudioSamplerate</key>
+ <string>Auto</string>
+ <key>AudioTrack</key>
+ <integer>1</integer>
+ <key>AudioTrackDRCSlider</key>
+ <real>0.0</real>
+ </dict>
+ </array>
+ <key>ChapterMarkers</key>
+ <integer>1</integer>
+ <key>Default</key>
+ <integer>1</integer>
+ <key>FileFormat</key>
+ <string>MP4 file</string>
+ <key>PictureAutoCrop</key>
+ <integer>1</integer>
+ <key>PictureBottomCrop</key>
+ <integer>0</integer>
+ <key>PictureDeblock</key>
+ <integer>0</integer>
+ <key>PictureDeinterlace</key>
+ <integer>0</integer>
+ <key>PictureDenoise</key>
+ <integer>0</integer>
+ <key>PictureDetelecine</key>
+ <integer>0</integer>
+ <key>PictureHeight</key>
+ <integer>0</integer>
+ <key>PictureKeepRatio</key>
+ <integer>0</integer>
+ <key>PictureLeftCrop</key>
+ <integer>0</integer>
+ <key>PictureModulus</key>
+ <integer>2</integer>
+ <key>PicturePAR</key>
+ <integer>2</integer>
+ <key>PictureRightCrop</key>
+ <integer>0</integer>
+ <key>PictureTopCrop</key>
+ <integer>0</integer>
+ <key>PictureWidth</key>
+ <integer>0</integer>
+ <key>PresetDescription</key>
+ <string>HandBrake's normal, default settings.</string>
+ <key>PresetName</key>
+ <string>Normal</string>
+ <key>Subtitles</key>
+ <string>None</string>
+ <key>Type</key>
+ <integer>0</integer>
+ <key>UsesPictureFilters</key>
+ <integer>1</integer>
+ <key>UsesPictureSettings</key>
+ <integer>2</integer>
+ <key>VFR</key>
+ <integer>0</integer>
+ <key>VideoAvgBitrate</key>
+ <string>1500</string>
+ <key>VideoEncoder</key>
+ <string>H.264 (x264)</string>
+ <key>VideoFramerate</key>
+ <string>Same as source</string>
+ <key>VideoFramerateMode</key>
+ <string>vfr</string>
+ <key>VideoGrayScale</key>
+ <integer>0</integer>
+ <key>VideoQualitySlider</key>
+ <real>20</real>
+ <key>VideoQualityType</key>
+ <integer>2</integer>
+ <key>VideoTurboTwoPass</key>
+ <integer>0</integer>
+ <key>VideoTwoPass</key>
+ <integer>0</integer>
+ <key>h264Level</key>
+ <string>4.0</string>
<key>x264UseAdvancedOptions</key>
<false />
- <key>x264Option</key>
- <string>level=4.0:ref=1:8x8dct=0:weightp=1:subme=2:mixed-refs=0:trellis=0:vbv-bufsize=25000:vbv-maxrate=20000:rc-lookahead=10</string>
- <key>x264OptionExtra</key>
- <string></string>
- <key>x264Preset</key>
- <string>veryfast</string>
- <key>h264Profile</key>
- <string>main</string>
- <key>x264Tune</key>
- <string>none</string>
- </dict>
- <dict>
- <key>AudioList</key>
- <array>
- <dict>
- <key>AudioBitrate</key>
- <string>160</string>
- <key>AudioEncoder</key>
- <string>AAC (faac)</string>
- <key>AudioMixdown</key>
- <string>Dolby Pro Logic II</string>
- <key>AudioSamplerate</key>
- <string>Auto</string>
- <key>AudioTrack</key>
- <integer>1</integer>
- <key>AudioTrackDRCSlider</key>
- <real>0.0</real>
- </dict>
- <dict>
- <key>AudioBitrate</key>
- <string>160</string>
- <key>AudioEncoder</key>
- <string>AC3 Passthru</string>
- <key>AudioMixdown</key>
- <string>None</string>
- <key>AudioSamplerate</key>
- <string>Auto</string>
- <key>AudioTrack</key>
- <integer>1</integer>
- <key>AudioTrackDRCSlider</key>
- <real>0.0</real>
- </dict>
- </array>
- <key>ChapterMarkers</key>
- <integer>1</integer>
- <key>Default</key>
- <integer>0</integer>
- <key>FileFormat</key>
- <string>MP4 file</string>
- <key>Mp4LargeFile</key>
- <integer>1</integer>
- <key>PictureAutoCrop</key>
- <integer>1</integer>
- <key>PictureBottomCrop</key>
- <integer>0</integer>
- <key>PictureDeblock</key>
- <integer>0</integer>
- <key>PictureDecomb</key>
- <integer>2</integer>
- <key>PictureDecombDeinterlace</key>
- <integer>1</integer>
- <key>PictureDeinterlace</key>
- <integer>0</integer>
- <key>PictureDenoise</key>
- <integer>0</integer>
- <key>PictureDetelecine</key>
- <integer>0</integer>
- <key>PictureHeight</key>
- <integer>0</integer>
- <key>PictureKeepRatio</key>
- <integer>0</integer>
- <key>PictureLeftCrop</key>
- <integer>0</integer>
- <key>PictureModulus</key>
- <integer>2</integer>
- <key>PicturePAR</key>
- <integer>2</integer>
- <key>PictureRightCrop</key>
- <integer>0</integer>
- <key>PictureTopCrop</key>
- <integer>0</integer>
- <key>PictureWidth</key>
- <integer>0</integer>
- <key>PresetDescription</key>
- <string>HandBrake's general-purpose preset for High Profile H.264 video, with all the bells and whistles.</string>
- <key>PresetName</key>
- <string>High Profile</string>
- <key>Subtitles</key>
- <string>None</string>
- <key>Type</key>
- <integer>0</integer>
- <key>UsesPictureFilters</key>
- <integer>1</integer>
- <key>UsesPictureSettings</key>
- <integer>2</integer>
- <key>VideoAvgBitrate</key>
- <string>1800</string>
- <key>VideoEncoder</key>
- <string>H.264 (x264)</string>
- <key>VideoFramerate</key>
- <string>Same as source</string>
- <key>VideoFramerateMode</key>
- <string>vfr</string>
- <key>VideoGrayScale</key>
- <integer>0</integer>
- <key>VideoQualitySlider</key>
- <real>20</real>
- <key>VideoQualityType</key>
- <integer>2</integer>
- <key>VideoTurboTwoPass</key>
- <integer>0</integer>
- <key>VideoTwoPass</key>
- <integer>0</integer>
- <key>h264Level</key>
- <string>4.1</string>
+ <key>x264Option</key>
+ <string>level=4.0:ref=1:8x8dct=0:weightp=1:subme=2:mixed-refs=0:trellis=0:vbv-bufsize=25000:vbv-maxrate=20000:rc-lookahead=10</string>
+ <key>x264OptionExtra</key>
+ <string></string>
+ <key>x264Preset</key>
+ <string>veryfast</string>
+ <key>h264Profile</key>
+ <string>main</string>
+ <key>x264Tune</key>
+ <string>none</string>
+ </dict>
+ <dict>
+ <key>AudioList</key>
+ <array>
+ <dict>
+ <key>AudioBitrate</key>
+ <string>160</string>
+ <key>AudioEncoder</key>
+ <string>AAC (faac)</string>
+ <key>AudioMixdown</key>
+ <string>Dolby Pro Logic II</string>
+ <key>AudioSamplerate</key>
+ <string>Auto</string>
+ <key>AudioTrack</key>
+ <integer>1</integer>
+ <key>AudioTrackDRCSlider</key>
+ <real>0.0</real>
+ </dict>
+ <dict>
+ <key>AudioBitrate</key>
+ <string>160</string>
+ <key>AudioEncoder</key>
+ <string>AC3 Passthru</string>
+ <key>AudioMixdown</key>
+ <string>None</string>
+ <key>AudioSamplerate</key>
+ <string>Auto</string>
+ <key>AudioTrack</key>
+ <integer>1</integer>
+ <key>AudioTrackDRCSlider</key>
+ <real>0.0</real>
+ </dict>
+ </array>
+ <key>ChapterMarkers</key>
+ <integer>1</integer>
+ <key>Default</key>
+ <integer>0</integer>
+ <key>FileFormat</key>
+ <string>MP4 file</string>
+ <key>Mp4LargeFile</key>
+ <integer>1</integer>
+ <key>PictureAutoCrop</key>
+ <integer>1</integer>
+ <key>PictureBottomCrop</key>
+ <integer>0</integer>
+ <key>PictureDeblock</key>
+ <integer>0</integer>
+ <key>PictureDecomb</key>
+ <integer>2</integer>
+ <key>PictureDecombDeinterlace</key>
+ <integer>1</integer>
+ <key>PictureDeinterlace</key>
+ <integer>0</integer>
+ <key>PictureDenoise</key>
+ <integer>0</integer>
+ <key>PictureDetelecine</key>
+ <integer>0</integer>
+ <key>PictureHeight</key>
+ <integer>0</integer>
+ <key>PictureKeepRatio</key>
+ <integer>0</integer>
+ <key>PictureLeftCrop</key>
+ <integer>0</integer>
+ <key>PictureModulus</key>
+ <integer>2</integer>
+ <key>PicturePAR</key>
+ <integer>2</integer>
+ <key>PictureRightCrop</key>
+ <integer>0</integer>
+ <key>PictureTopCrop</key>
+ <integer>0</integer>
+ <key>PictureWidth</key>
+ <integer>0</integer>
+ <key>PresetDescription</key>
+ <string>HandBrake's general-purpose preset for High Profile H.264 video, with all the bells and whistles.</string>
+ <key>PresetName</key>
+ <string>High Profile</string>
+ <key>Subtitles</key>
+ <string>None</string>
+ <key>Type</key>
+ <integer>0</integer>
+ <key>UsesPictureFilters</key>
+ <integer>1</integer>
+ <key>UsesPictureSettings</key>
+ <integer>2</integer>
+ <key>VideoAvgBitrate</key>
+ <string>1800</string>
+ <key>VideoEncoder</key>
+ <string>H.264 (x264)</string>
+ <key>VideoFramerate</key>
+ <string>Same as source</string>
+ <key>VideoFramerateMode</key>
+ <string>vfr</string>
+ <key>VideoGrayScale</key>
+ <integer>0</integer>
+ <key>VideoQualitySlider</key>
+ <real>20</real>
+ <key>VideoQualityType</key>
+ <integer>2</integer>
+ <key>VideoTurboTwoPass</key>
+ <integer>0</integer>
+ <key>VideoTwoPass</key>
+ <integer>0</integer>
+ <key>h264Level</key>
+ <string>4.1</string>
<key>x264UseAdvancedOptions</key>
<false />
- <key>x264Option</key>
- <string>level=4.1:vbv-bufsize=78125:vbv-maxrate=62500</string>
- <key>x264OptionExtra</key>
- <string></string>
- <key>x264Preset</key>
- <string>medium</string>
- <key>h264Profile</key>
- <string>high</string>
- <key>x264Tune</key>
- <string>none</string>
- </dict>
- </array>
- <key>Default</key>
- <integer>0</integer>
- <key>Folder</key>
- <true/>
- <key>PresetBuildNumber</key>
- <integer>2012041101</integer>
- <key>PresetName</key>
- <string>Regular</string>
- <key>Type</key>
- <integer>0</integer>
- </dict>
+ <key>x264Option</key>
+ <string>level=4.1:vbv-bufsize=78125:vbv-maxrate=62500</string>
+ <key>x264OptionExtra</key>
+ <string></string>
+ <key>x264Preset</key>
+ <string>medium</string>
+ <key>h264Profile</key>
+ <string>high</string>
+ <key>x264Tune</key>
+ <string>none</string>
+ </dict>
+ </array>
+ <key>Default</key>
+ <integer>0</integer>
+ <key>Folder</key>
+ <true/>
+ <key>PresetBuildNumber</key>
+ <integer>2012041101</integer>
+ <key>PresetName</key>
+ <string>Regular</string>
+ <key>Type</key>
+ <integer>0</integer>
+ </dict>
</array>
</plist>
diff --git a/gtk/src/subtitlehandler.c b/gtk/src/subtitlehandler.c
index 2fe053eca..896a642e1 100644
--- a/gtk/src/subtitlehandler.c
+++ b/gtk/src/subtitlehandler.c
@@ -32,26 +32,26 @@ static void ghb_clear_subtitle_list(signal_user_data_t *ud);
static void
free_subtitle_index_list(gpointer data)
{
- g_free(data);
+ g_free(data);
}
static void
free_subtitle_key(gpointer data)
{
- if (data != NULL)
- g_free(data);
+ if (data != NULL)
+ g_free(data);
}
gboolean
ghb_canPassSub(int source, int mux)
{
- return hb_subtitle_can_pass(source, mux);
+ return hb_subtitle_can_pass(source, mux);
}
gboolean
ghb_canBurnSub(int source)
{
- return hb_subtitle_can_burn(source);
+ return hb_subtitle_can_burn(source);
}
gboolean
@@ -63,1379 +63,1379 @@ ghb_canForceSub(int source)
gboolean
ghb_soft_in_subtitle_list(GValue *subtitle_list)
{
- gint count, ii;
- GValue *settings;
-
- count = ghb_array_len(subtitle_list);
- for (ii = 0; ii < count; ii++)
- {
- settings = ghb_array_get_nth(subtitle_list, ii);
- if (!ghb_settings_get_boolean(settings, "SubtitleBurned"))
- {
- return TRUE;
- }
- }
- return FALSE;
+ gint count, ii;
+ GValue *settings;
+
+ count = ghb_array_len(subtitle_list);
+ for (ii = 0; ii < count; ii++)
+ {
+ settings = ghb_array_get_nth(subtitle_list, ii);
+ if (!ghb_settings_get_boolean(settings, "SubtitleBurned"))
+ {
+ return TRUE;
+ }
+ }
+ return FALSE;
}
void
ghb_subtitle_exclusive_burn_settings(GValue *settings, gint index)
{
- GValue *subtitle_list;
- GValue *subsettings;
- gint ii, count;
-
- g_debug("ghb_subtitle_exclusive_burn_settings");
- subtitle_list = ghb_settings_get_value(settings, "subtitle_list");
- count = ghb_array_len(subtitle_list);
- for (ii = 0; ii < count; ii++)
- {
- if (ii != index)
- {
- subsettings = ghb_array_get_nth(subtitle_list, ii);
- ghb_settings_set_boolean(subsettings, "SubtitleBurned", FALSE);
- }
- }
+ GValue *subtitle_list;
+ GValue *subsettings;
+ gint ii, count;
+
+ g_debug("ghb_subtitle_exclusive_burn_settings");
+ subtitle_list = ghb_settings_get_value(settings, "subtitle_list");
+ count = ghb_array_len(subtitle_list);
+ for (ii = 0; ii < count; ii++)
+ {
+ if (ii != index)
+ {
+ subsettings = ghb_array_get_nth(subtitle_list, ii);
+ ghb_settings_set_boolean(subsettings, "SubtitleBurned", FALSE);
+ }
+ }
}
void
ghb_subtitle_exclusive_burn(signal_user_data_t *ud, gint index)
{
- GValue *subtitle_list;
- GValue *subsettings;
- gint ii, count;
- GtkTreeView *tv;
- GtkTreeModel *tm;
- GtkTreeIter ti;
-
- g_debug("ghb_subtitle_exclusive_burn");
- subtitle_list = ghb_settings_get_value(ud->settings, "subtitle_list");
- count = ghb_array_len(subtitle_list);
- for (ii = 0; ii < count; ii++)
- {
- tv = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "subtitle_list"));
- g_return_if_fail(tv != NULL);
- tm = gtk_tree_view_get_model(tv);
- gtk_tree_model_iter_nth_child(tm, &ti, NULL, ii);
- if (ii != index)
- {
- subsettings = ghb_array_get_nth(subtitle_list, ii);
- ghb_settings_set_boolean(subsettings, "SubtitleBurned", FALSE);
- gtk_list_store_set(GTK_LIST_STORE(tm), &ti, 2, FALSE, -1);
- }
- }
+ GValue *subtitle_list;
+ GValue *subsettings;
+ gint ii, count;
+ GtkTreeView *tv;
+ GtkTreeModel *tm;
+ GtkTreeIter ti;
+
+ g_debug("ghb_subtitle_exclusive_burn");
+ subtitle_list = ghb_settings_get_value(ud->settings, "subtitle_list");
+ count = ghb_array_len(subtitle_list);
+ for (ii = 0; ii < count; ii++)
+ {
+ tv = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "subtitle_list"));
+ g_return_if_fail(tv != NULL);
+ tm = gtk_tree_view_get_model(tv);
+ gtk_tree_model_iter_nth_child(tm, &ti, NULL, ii);
+ if (ii != index)
+ {
+ subsettings = ghb_array_get_nth(subtitle_list, ii);
+ ghb_settings_set_boolean(subsettings, "SubtitleBurned", FALSE);
+ gtk_list_store_set(GTK_LIST_STORE(tm), &ti, 2, FALSE, -1);
+ }
+ }
}
void
ghb_subtitle_exclusive_default_settings(GValue *settings, gint index)
{
- GValue *subtitle_list;
- GValue *subtitle;
- gint ii, count;
-
- g_debug("ghb_subtitle_exclusive_default");
- subtitle_list = ghb_settings_get_value(settings, "subtitle_list");
- count = ghb_array_len(subtitle_list);
- for (ii = 0; ii < count; ii++)
- {
- if (ii != index)
- {
- subtitle = ghb_array_get_nth(subtitle_list, ii);
- ghb_settings_set_boolean(subtitle, "SubtitleDefaultTrack", FALSE);
- }
- }
+ GValue *subtitle_list;
+ GValue *subtitle;
+ gint ii, count;
+
+ g_debug("ghb_subtitle_exclusive_default");
+ subtitle_list = ghb_settings_get_value(settings, "subtitle_list");
+ count = ghb_array_len(subtitle_list);
+ for (ii = 0; ii < count; ii++)
+ {
+ if (ii != index)
+ {
+ subtitle = ghb_array_get_nth(subtitle_list, ii);
+ ghb_settings_set_boolean(subtitle, "SubtitleDefaultTrack", FALSE);
+ }
+ }
}
void
ghb_subtitle_exclusive_default(signal_user_data_t *ud, gint index)
{
- GValue *subtitle_list;
- GValue *settings;
- gint ii, count;
- GtkTreeView *tv;
- GtkTreeModel *tm;
- GtkTreeIter ti;
- gboolean def;
-
- g_debug("ghb_subtitle_exclusive_default");
- subtitle_list = ghb_settings_get_value(ud->settings, "subtitle_list");
- count = ghb_array_len(subtitle_list);
- for (ii = 0; ii < count; ii++)
- {
- settings = ghb_array_get_nth(subtitle_list, ii);
- def = ghb_settings_get_boolean(settings, "SubtitleDefaultTrack");
-
- tv = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "subtitle_list"));
- g_return_if_fail(tv != NULL);
- tm = gtk_tree_view_get_model(tv);
- gtk_tree_model_iter_nth_child(tm, &ti, NULL, ii);
- if (def && ii != index)
- {
-
- ghb_settings_set_boolean(settings, "SubtitleDefaultTrack", FALSE);
- gtk_list_store_set(GTK_LIST_STORE(tm), &ti, 3, FALSE, -1);
- }
- }
+ GValue *subtitle_list;
+ GValue *settings;
+ gint ii, count;
+ GtkTreeView *tv;
+ GtkTreeModel *tm;
+ GtkTreeIter ti;
+ gboolean def;
+
+ g_debug("ghb_subtitle_exclusive_default");
+ subtitle_list = ghb_settings_get_value(ud->settings, "subtitle_list");
+ count = ghb_array_len(subtitle_list);
+ for (ii = 0; ii < count; ii++)
+ {
+ settings = ghb_array_get_nth(subtitle_list, ii);
+ def = ghb_settings_get_boolean(settings, "SubtitleDefaultTrack");
+
+ tv = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "subtitle_list"));
+ g_return_if_fail(tv != NULL);
+ tm = gtk_tree_view_get_model(tv);
+ gtk_tree_model_iter_nth_child(tm, &ti, NULL, ii);
+ if (def && ii != index)
+ {
+
+ ghb_settings_set_boolean(settings, "SubtitleDefaultTrack", FALSE);
+ gtk_list_store_set(GTK_LIST_STORE(tm), &ti, 3, FALSE, -1);
+ }
+ }
}
void
ghb_add_srt(signal_user_data_t *ud, GValue *settings)
{
- // Add the current subtitle settings to the list.
- GValue *subtitle_list;
- gint count;
- const gchar *lang;
-
- g_debug("ghb_add_srt ()");
-
- ghb_settings_set_boolean(settings, "SubtitleBurned", FALSE);
- // Add the long track description so the queue can access it
- // when a different title is selected.
- lang = ghb_settings_combo_option(settings, "SrtLanguage");
- ghb_settings_set_string(settings, "SubtitleTrackDescription", lang);
-
- subtitle_list = ghb_settings_get_value(ud->settings, "subtitle_list");
- if (subtitle_list == NULL)
- {
- subtitle_list = ghb_array_value_new(8);
- ghb_settings_set_value(ud->settings, "subtitle_list", subtitle_list);
- }
- count = ghb_array_len(subtitle_list);
-
- // Don't allow more than 99
- // This is a had limit imposed by libhb/sync.c:GetFifoForId()
- if (count >= 99)
- {
- ghb_value_free(settings);
- return;
- }
-
- ghb_array_append(subtitle_list, settings);
- add_to_srt_list(ud, settings);
-
- if (count == 98)
- {
- GtkWidget *widget;
- widget = GHB_WIDGET (ud->builder, "subtitle_add");
- gtk_widget_set_sensitive(widget, FALSE);
- widget = GHB_WIDGET (ud->builder, "srt_add");
- gtk_widget_set_sensitive(widget, FALSE);
- }
- ghb_live_reset(ud);
+ // Add the current subtitle settings to the list.
+ GValue *subtitle_list;
+ gint count;
+ const gchar *lang;
+
+ g_debug("ghb_add_srt ()");
+
+ ghb_settings_set_boolean(settings, "SubtitleBurned", FALSE);
+ // Add the long track description so the queue can access it
+ // when a different title is selected.
+ lang = ghb_settings_combo_option(settings, "SrtLanguage");
+ ghb_settings_set_string(settings, "SubtitleTrackDescription", lang);
+
+ subtitle_list = ghb_settings_get_value(ud->settings, "subtitle_list");
+ if (subtitle_list == NULL)
+ {
+ subtitle_list = ghb_array_value_new(8);
+ ghb_settings_set_value(ud->settings, "subtitle_list", subtitle_list);
+ }
+ count = ghb_array_len(subtitle_list);
+
+ // Don't allow more than 99
+ // This is a had limit imposed by libhb/sync.c:GetFifoForId()
+ if (count >= 99)
+ {
+ ghb_value_free(settings);
+ return;
+ }
+
+ ghb_array_append(subtitle_list, settings);
+ add_to_srt_list(ud, settings);
+
+ if (count == 98)
+ {
+ GtkWidget *widget;
+ widget = GHB_WIDGET (ud->builder, "subtitle_add");
+ gtk_widget_set_sensitive(widget, FALSE);
+ widget = GHB_WIDGET (ud->builder, "srt_add");
+ gtk_widget_set_sensitive(widget, FALSE);
+ }
+ ghb_live_reset(ud);
}
static gboolean
ghb_add_subtitle_to_settings(GValue *settings, GValue *subsettings)
{
- // Add the current subtitle settings to the list.
- GValue *subtitle_list;
- gint count;
- gboolean burned, forced;
- gint source, mux;
- const gchar *track;
- const gchar *lang;
-
- g_debug("ghb_add_subtitle_to_settings ()");
-
- subtitle_list = ghb_settings_get_value(settings, "subtitle_list");
- if (subtitle_list == NULL)
- {
- subtitle_list = ghb_array_value_new(8);
- ghb_settings_set_value(settings, "subtitle_list", subtitle_list);
- }
-
- count = ghb_array_len(subtitle_list);
- // Don't allow more than 99
- // This is a hard limit imposed by libhb/reader.c:GetFifoForId()
- if (count >= 99)
- {
- ghb_value_free(subsettings);
- return FALSE;
- }
-
- // Add the long track description so the queue can access it
- // when a different title is selected.
- track = ghb_settings_combo_option(subsettings, "SubtitleTrack");
- ghb_settings_set_string(subsettings, "SubtitleTrackDescription", track);
-
- lang = ghb_settings_combo_string(subsettings, "SubtitleTrack");
- ghb_settings_set_string(subsettings, "SubtitleLanguage", lang);
-
- mux = ghb_settings_combo_int(settings, "FileFormat");
- source = ghb_settings_get_int(subsettings, "SubtitleSource");
- burned = ghb_settings_get_boolean(subsettings, "SubtitleBurned");
- if (burned && !ghb_canBurnSub(source))
- {
- burned = FALSE;
- ghb_settings_set_boolean(subsettings, "SubtitleBurned", burned);
- }
- if (!burned && !ghb_canPassSub(source, mux))
- {
- burned = TRUE;
- ghb_settings_set_boolean(subsettings, "SubtitleBurned", burned);
- ghb_settings_set_boolean(subsettings, "SubtitleDefaultTrack", FALSE);
- }
- forced = ghb_settings_get_boolean(subsettings, "SubtitleForced");
- if (forced && !ghb_canForceSub(source))
- {
- forced = FALSE;
- ghb_settings_set_boolean(subsettings, "SubtitleForced", forced);
- }
-
- ghb_array_append(subtitle_list, subsettings);
-
- if (burned)
- ghb_subtitle_exclusive_burn_settings(settings, count);
- return TRUE;
+ // Add the current subtitle settings to the list.
+ GValue *subtitle_list;
+ gint count;
+ gboolean burned, forced;
+ gint source, mux;
+ const gchar *track;
+ const gchar *lang;
+
+ g_debug("ghb_add_subtitle_to_settings ()");
+
+ subtitle_list = ghb_settings_get_value(settings, "subtitle_list");
+ if (subtitle_list == NULL)
+ {
+ subtitle_list = ghb_array_value_new(8);
+ ghb_settings_set_value(settings, "subtitle_list", subtitle_list);
+ }
+
+ count = ghb_array_len(subtitle_list);
+ // Don't allow more than 99
+ // This is a hard limit imposed by libhb/reader.c:GetFifoForId()
+ if (count >= 99)
+ {
+ ghb_value_free(subsettings);
+ return FALSE;
+ }
+
+ // Add the long track description so the queue can access it
+ // when a different title is selected.
+ track = ghb_settings_combo_option(subsettings, "SubtitleTrack");
+ ghb_settings_set_string(subsettings, "SubtitleTrackDescription", track);
+
+ lang = ghb_settings_combo_string(subsettings, "SubtitleTrack");
+ ghb_settings_set_string(subsettings, "SubtitleLanguage", lang);
+
+ mux = ghb_settings_combo_int(settings, "FileFormat");
+ source = ghb_settings_get_int(subsettings, "SubtitleSource");
+ burned = ghb_settings_get_boolean(subsettings, "SubtitleBurned");
+ if (burned && !ghb_canBurnSub(source))
+ {
+ burned = FALSE;
+ ghb_settings_set_boolean(subsettings, "SubtitleBurned", burned);
+ }
+ if (!burned && !ghb_canPassSub(source, mux))
+ {
+ burned = TRUE;
+ ghb_settings_set_boolean(subsettings, "SubtitleBurned", burned);
+ ghb_settings_set_boolean(subsettings, "SubtitleDefaultTrack", FALSE);
+ }
+ forced = ghb_settings_get_boolean(subsettings, "SubtitleForced");
+ if (forced && !ghb_canForceSub(source))
+ {
+ forced = FALSE;
+ ghb_settings_set_boolean(subsettings, "SubtitleForced", forced);
+ }
+
+ ghb_array_append(subtitle_list, subsettings);
+
+ if (burned)
+ ghb_subtitle_exclusive_burn_settings(settings, count);
+ return TRUE;
}
static void
ghb_add_subtitle_to_ui(signal_user_data_t *ud, GValue *subsettings)
{
- // Add the current subtitle settings to the list.
- GValue *subtitle_list;
- gint count;
-
- g_debug("ghb_add_subtitle_to_ui ()");
- add_to_subtitle_list(ud, subsettings);
-
- subtitle_list = ghb_settings_get_value(ud->settings, "subtitle_list");
- count = ghb_array_len(subtitle_list);
- if (count == 99)
- {
- GtkWidget *widget;
- widget = GHB_WIDGET (ud->builder, "subtitle_add");
- gtk_widget_set_sensitive(widget, FALSE);
- widget = GHB_WIDGET (ud->builder, "srt_add");
- gtk_widget_set_sensitive(widget, FALSE);
- }
- ghb_live_reset(ud);
+ // Add the current subtitle settings to the list.
+ GValue *subtitle_list;
+ gint count;
+
+ g_debug("ghb_add_subtitle_to_ui ()");
+ add_to_subtitle_list(ud, subsettings);
+
+ subtitle_list = ghb_settings_get_value(ud->settings, "subtitle_list");
+ count = ghb_array_len(subtitle_list);
+ if (count == 99)
+ {
+ GtkWidget *widget;
+ widget = GHB_WIDGET (ud->builder, "subtitle_add");
+ gtk_widget_set_sensitive(widget, FALSE);
+ widget = GHB_WIDGET (ud->builder, "srt_add");
+ gtk_widget_set_sensitive(widget, FALSE);
+ }
+ ghb_live_reset(ud);
}
static void
add_all_pref_subtitles(signal_user_data_t *ud)
{
- const GValue *pref_subtitle;
- GValue *subtitle;
- gint count, ii, track;
- char *lang;
-
- pref_subtitle = ghb_settings_get_value(ud->settings, "SubtitleList");
- count = ghb_array_len(pref_subtitle);
- for (ii = 0; ii < count; ii++)
- {
- subtitle = ghb_value_dup(ghb_array_get_nth(pref_subtitle, ii));
- lang = ghb_settings_get_string(subtitle, "SubtitleLanguage");
- // If there are multiple subtitles using the same language, then
- // select sequential tracks for each. The hash keeps track
- // of the tracks used for each language.
- track = ghb_find_pref_subtitle_track(lang);
- g_free(lang);
- if (track >= -1)
- {
- int source;
-
- // Add to subtitle list
- ghb_settings_set_int(subtitle, "SubtitleTrack", track);
- source = ghb_subtitle_track_source(ud->settings, track);
- ghb_settings_set_int(subtitle, "SubtitleSource", source);
-
- if (!ghb_add_subtitle_to_settings(ud->settings, subtitle))
- return;
-
- ghb_add_subtitle_to_ui(ud, subtitle);
- }
- }
+ const GValue *pref_subtitle;
+ GValue *subtitle;
+ gint count, ii, track;
+ char *lang;
+
+ pref_subtitle = ghb_settings_get_value(ud->settings, "SubtitleList");
+ count = ghb_array_len(pref_subtitle);
+ for (ii = 0; ii < count; ii++)
+ {
+ subtitle = ghb_value_dup(ghb_array_get_nth(pref_subtitle, ii));
+ lang = ghb_settings_get_string(subtitle, "SubtitleLanguage");
+ // If there are multiple subtitles using the same language, then
+ // select sequential tracks for each. The hash keeps track
+ // of the tracks used for each language.
+ track = ghb_find_pref_subtitle_track(lang);
+ g_free(lang);
+ if (track >= -1)
+ {
+ int source;
+
+ // Add to subtitle list
+ ghb_settings_set_int(subtitle, "SubtitleTrack", track);
+ source = ghb_subtitle_track_source(ud->settings, track);
+ ghb_settings_set_int(subtitle, "SubtitleSource", source);
+
+ if (!ghb_add_subtitle_to_settings(ud->settings, subtitle))
+ return;
+
+ ghb_add_subtitle_to_ui(ud, subtitle);
+ }
+ }
}
void
ghb_set_pref_subtitle_settings(gint titleindex, GValue *settings)
{
- gint track;
- GHashTable *track_indices;
- gchar *lang, *pref_lang = NULL;
- const gchar *audio_lang;
- gint foreign_lang_index = -1;
- gboolean found_cc = FALSE;
-
- const GValue *pref_subtitle;
- GValue *subtitle;
- gint count, ii, jj;
-
- g_debug("ghb_set_pref_subtitle %d", titleindex);
-
- // Check to see if we need to add a subtitle track for foreign audio
- // language films. A subtitle track will be added if:
- //
- // The first (default) audio track language does NOT match the users
- // chosen Preferred Language AND the Preferred Language is NOT Any (und).
- //
- audio_lang = ghb_get_user_audio_lang(settings, titleindex, 0);
- pref_lang = ghb_settings_get_string(settings, "PreferredLanguage");
-
- if (audio_lang != NULL && pref_lang != NULL &&
- (strcmp(audio_lang, pref_lang) == 0 || strcmp("und", pref_lang) == 0))
- {
- g_free(pref_lang);
- pref_lang = NULL;
- }
-
- track_indices = g_hash_table_new_full(g_str_hash, g_str_equal,
- free_subtitle_key, free_subtitle_index_list);
-
- ghb_settings_set_int(settings, "SubtitleTrack", 0);
-
- // Clear the subtitle list
- ghb_clear_subtitle_list_settings(settings);
- if (titleindex < 0)
- {
- return;
- }
-
- // Find "best" subtitle based on subtitle preferences
- pref_subtitle = ghb_settings_get_value(settings, "SubtitleList");
-
- count = ghb_array_len(pref_subtitle);
- jj = 0;
- for (ii = 0; ii < count; ii++)
- {
- gint source;
- gboolean force, burn;
-
- subtitle = ghb_array_get_nth(pref_subtitle, ii);
- lang = ghb_settings_get_string(subtitle, "SubtitleLanguage");
- source = ghb_settings_get_int(subtitle, "SubtitleSource");
- burn = ghb_settings_get_boolean(subtitle, "SubtitleBurned");
- force = ghb_settings_get_boolean(subtitle, "SubtitleForced");
- // If there are multiple subtitles using the same language, then
- // select sequential tracks for each. The hash keeps track
- // of the tracks used for each language.
- track = ghb_find_subtitle_track(titleindex, lang, burn,
- force, source, track_indices);
- g_free(lang);
- if (track >= -1)
- {
- const gchar *track_lang;
- GValue *dup = ghb_value_dup(subtitle);
- track_lang = ghb_subtitle_track_lang(settings, track);
- ghb_settings_set_int(dup, "SubtitleTrack", track);
- if (foreign_lang_index < 0 && pref_lang != NULL &&
- strcmp(track_lang, pref_lang) == 0 &&
- !ghb_settings_get_boolean(dup, "SubtitleBurned"))
- {
- foreign_lang_index = jj;
- ghb_settings_take_value(dup, "SubtitleForced",
- ghb_boolean_value_new(FALSE));
- ghb_settings_take_value(dup, "SubtitleDefaultTrack",
- ghb_boolean_value_new(TRUE));
- }
- source = ghb_subtitle_track_source(settings, track);
- ghb_settings_set_int(dup, "SubtitleSource", source);
- if (source == CC608SUB || source == CC708SUB)
- found_cc = TRUE;
- ghb_add_subtitle_to_settings(settings, dup);
- jj++;
- }
- }
- if (foreign_lang_index < 0 && pref_lang != NULL)
- {
- // Subtitle for foreign language audio not added yet
- GValue *subsettings;
- gboolean burn;
-
- track = ghb_find_subtitle_track(titleindex, pref_lang, FALSE, FALSE, PGSSUB, track_indices);
- if (track >= -1)
- {
- int source;
-
- subsettings = ghb_dict_value_new();
- ghb_settings_set_int(subsettings, "SubtitleTrack", track);
- source = ghb_subtitle_track_source(settings, track);
- ghb_settings_set_int(subsettings, "SubtitleSource", source);
- burn = FALSE;
- ghb_settings_take_value(subsettings, "SubtitleForced",
- ghb_boolean_value_new(FALSE));
- ghb_settings_take_value(subsettings, "SubtitleBurned",
- ghb_boolean_value_new(burn));
- ghb_settings_take_value(subsettings, "SubtitleDefaultTrack",
- ghb_boolean_value_new(TRUE));
-
- ghb_add_subtitle_to_settings(settings, subsettings);
- foreign_lang_index = jj;
- }
- }
- if (foreign_lang_index >= 0)
- {
- GValue *subtitle_list;
- gboolean burn, def;
-
- subtitle_list = ghb_settings_get_value(settings, "subtitle_list");
- subtitle = ghb_array_get_nth(subtitle_list, foreign_lang_index);
-
- burn = ghb_settings_get_boolean(subtitle, "SubtitleBurned");
- def = ghb_settings_get_boolean(subtitle, "SubtitleDefaultTrack");
- if (burn)
- ghb_subtitle_exclusive_burn_settings(settings, foreign_lang_index);
- if (def)
- ghb_subtitle_exclusive_default_settings(settings, foreign_lang_index);
- ghb_log("adding subtitle for foreign language audio: %s", audio_lang);
- }
- if (ghb_settings_get_boolean(settings, "AddCC") && !found_cc)
- {
- // Subtitle for foreign language audio not added yet
- GValue *subsettings;
-
- track = ghb_find_cc_track(titleindex);
- if (track >= 0)
- {
- int source;
- subsettings = ghb_dict_value_new();
- ghb_settings_set_int(subsettings, "SubtitleTrack", track);
- source = ghb_subtitle_track_source(settings, track);
- ghb_settings_set_int(subsettings, "SubtitleSource", source);
- ghb_settings_take_value(subsettings, "SubtitleForced",
- ghb_boolean_value_new(FALSE));
- ghb_settings_take_value(subsettings, "SubtitleBurned",
- ghb_boolean_value_new(FALSE));
- ghb_settings_take_value(subsettings, "SubtitleDefaultTrack",
- ghb_boolean_value_new(FALSE));
-
- ghb_add_subtitle_to_settings(settings, subsettings);
- ghb_log("adding Closed Captions: %s", audio_lang);
- }
- }
- if (pref_lang != NULL)
- g_free(pref_lang);
- g_hash_table_destroy(track_indices);
+ gint track;
+ GHashTable *track_indices;
+ gchar *lang, *pref_lang = NULL;
+ const gchar *audio_lang;
+ gint foreign_lang_index = -1;
+ gboolean found_cc = FALSE;
+
+ const GValue *pref_subtitle;
+ GValue *subtitle;
+ gint count, ii, jj;
+
+ g_debug("ghb_set_pref_subtitle %d", titleindex);
+
+ // Check to see if we need to add a subtitle track for foreign audio
+ // language films. A subtitle track will be added if:
+ //
+ // The first (default) audio track language does NOT match the users
+ // chosen Preferred Language AND the Preferred Language is NOT Any (und).
+ //
+ audio_lang = ghb_get_user_audio_lang(settings, titleindex, 0);
+ pref_lang = ghb_settings_get_string(settings, "PreferredLanguage");
+
+ if (audio_lang != NULL && pref_lang != NULL &&
+ (strcmp(audio_lang, pref_lang) == 0 || strcmp("und", pref_lang) == 0))
+ {
+ g_free(pref_lang);
+ pref_lang = NULL;
+ }
+
+ track_indices = g_hash_table_new_full(g_str_hash, g_str_equal,
+ free_subtitle_key, free_subtitle_index_list);
+
+ ghb_settings_set_int(settings, "SubtitleTrack", 0);
+
+ // Clear the subtitle list
+ ghb_clear_subtitle_list_settings(settings);
+ if (titleindex < 0)
+ {
+ return;
+ }
+
+ // Find "best" subtitle based on subtitle preferences
+ pref_subtitle = ghb_settings_get_value(settings, "SubtitleList");
+
+ count = ghb_array_len(pref_subtitle);
+ jj = 0;
+ for (ii = 0; ii < count; ii++)
+ {
+ gint source;
+ gboolean force, burn;
+
+ subtitle = ghb_array_get_nth(pref_subtitle, ii);
+ lang = ghb_settings_get_string(subtitle, "SubtitleLanguage");
+ source = ghb_settings_get_int(subtitle, "SubtitleSource");
+ burn = ghb_settings_get_boolean(subtitle, "SubtitleBurned");
+ force = ghb_settings_get_boolean(subtitle, "SubtitleForced");
+ // If there are multiple subtitles using the same language, then
+ // select sequential tracks for each. The hash keeps track
+ // of the tracks used for each language.
+ track = ghb_find_subtitle_track(titleindex, lang, burn,
+ force, source, track_indices);
+ g_free(lang);
+ if (track >= -1)
+ {
+ const gchar *track_lang;
+ GValue *dup = ghb_value_dup(subtitle);
+ track_lang = ghb_subtitle_track_lang(settings, track);
+ ghb_settings_set_int(dup, "SubtitleTrack", track);
+ if (foreign_lang_index < 0 && pref_lang != NULL &&
+ strcmp(track_lang, pref_lang) == 0 &&
+ !ghb_settings_get_boolean(dup, "SubtitleBurned"))
+ {
+ foreign_lang_index = jj;
+ ghb_settings_take_value(dup, "SubtitleForced",
+ ghb_boolean_value_new(FALSE));
+ ghb_settings_take_value(dup, "SubtitleDefaultTrack",
+ ghb_boolean_value_new(TRUE));
+ }
+ source = ghb_subtitle_track_source(settings, track);
+ ghb_settings_set_int(dup, "SubtitleSource", source);
+ if (source == CC608SUB || source == CC708SUB)
+ found_cc = TRUE;
+ ghb_add_subtitle_to_settings(settings, dup);
+ jj++;
+ }
+ }
+ if (foreign_lang_index < 0 && pref_lang != NULL)
+ {
+ // Subtitle for foreign language audio not added yet
+ GValue *subsettings;
+ gboolean burn;
+
+ track = ghb_find_subtitle_track(titleindex, pref_lang, FALSE, FALSE, PGSSUB, track_indices);
+ if (track >= -1)
+ {
+ int source;
+
+ subsettings = ghb_dict_value_new();
+ ghb_settings_set_int(subsettings, "SubtitleTrack", track);
+ source = ghb_subtitle_track_source(settings, track);
+ ghb_settings_set_int(subsettings, "SubtitleSource", source);
+ burn = FALSE;
+ ghb_settings_take_value(subsettings, "SubtitleForced",
+ ghb_boolean_value_new(FALSE));
+ ghb_settings_take_value(subsettings, "SubtitleBurned",
+ ghb_boolean_value_new(burn));
+ ghb_settings_take_value(subsettings, "SubtitleDefaultTrack",
+ ghb_boolean_value_new(TRUE));
+
+ ghb_add_subtitle_to_settings(settings, subsettings);
+ foreign_lang_index = jj;
+ }
+ }
+ if (foreign_lang_index >= 0)
+ {
+ GValue *subtitle_list;
+ gboolean burn, def;
+
+ subtitle_list = ghb_settings_get_value(settings, "subtitle_list");
+ subtitle = ghb_array_get_nth(subtitle_list, foreign_lang_index);
+
+ burn = ghb_settings_get_boolean(subtitle, "SubtitleBurned");
+ def = ghb_settings_get_boolean(subtitle, "SubtitleDefaultTrack");
+ if (burn)
+ ghb_subtitle_exclusive_burn_settings(settings, foreign_lang_index);
+ if (def)
+ ghb_subtitle_exclusive_default_settings(settings, foreign_lang_index);
+ ghb_log("adding subtitle for foreign language audio: %s", audio_lang);
+ }
+ if (ghb_settings_get_boolean(settings, "AddCC") && !found_cc)
+ {
+ // Subtitle for foreign language audio not added yet
+ GValue *subsettings;
+
+ track = ghb_find_cc_track(titleindex);
+ if (track >= 0)
+ {
+ int source;
+ subsettings = ghb_dict_value_new();
+ ghb_settings_set_int(subsettings, "SubtitleTrack", track);
+ source = ghb_subtitle_track_source(settings, track);
+ ghb_settings_set_int(subsettings, "SubtitleSource", source);
+ ghb_settings_take_value(subsettings, "SubtitleForced",
+ ghb_boolean_value_new(FALSE));
+ ghb_settings_take_value(subsettings, "SubtitleBurned",
+ ghb_boolean_value_new(FALSE));
+ ghb_settings_take_value(subsettings, "SubtitleDefaultTrack",
+ ghb_boolean_value_new(FALSE));
+
+ ghb_add_subtitle_to_settings(settings, subsettings);
+ ghb_log("adding Closed Captions: %s", audio_lang);
+ }
+ }
+ if (pref_lang != NULL)
+ g_free(pref_lang);
+ g_hash_table_destroy(track_indices);
}
void
ghb_set_pref_subtitle(gint titleindex, signal_user_data_t *ud)
{
- ghb_set_pref_subtitle_settings(titleindex, ud->settings);
- ghb_clear_subtitle_list(ud);
- if (titleindex < 0)
- {
- add_all_pref_subtitles(ud);
- return;
- }
-
- gint count, ii;
- GValue *subtitle_list;
- subtitle_list = ghb_settings_get_value(ud->settings, "subtitle_list");
- count = ghb_array_len(subtitle_list);
- for (ii = 0; ii < count; ii++)
- {
- GValue *subtitle;
- subtitle = ghb_array_get_nth(subtitle_list, ii);
- ghb_add_subtitle_to_ui(ud, subtitle);
- }
+ ghb_set_pref_subtitle_settings(titleindex, ud->settings);
+ ghb_clear_subtitle_list(ud);
+ if (titleindex < 0)
+ {
+ add_all_pref_subtitles(ud);
+ return;
+ }
+
+ gint count, ii;
+ GValue *subtitle_list;
+ subtitle_list = ghb_settings_get_value(ud->settings, "subtitle_list");
+ count = ghb_array_len(subtitle_list);
+ for (ii = 0; ii < count; ii++)
+ {
+ GValue *subtitle;
+ subtitle = ghb_array_get_nth(subtitle_list, ii);
+ ghb_add_subtitle_to_ui(ud, subtitle);
+ }
}
gint
ghb_selected_subtitle_row(signal_user_data_t *ud)
{
- GtkTreeView *treeview;
- GtkTreePath *treepath;
- GtkTreeSelection *selection;
- GtkTreeModel *store;
- GtkTreeIter iter;
- gint *indices;
- gint row = -1;
-
- g_debug("ghb_selected_subtitle_row ()");
- treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "subtitle_list"));
- selection = gtk_tree_view_get_selection (treeview);
- if (gtk_tree_selection_get_selected(selection, &store, &iter))
- {
- // Get the row number
- treepath = gtk_tree_model_get_path (store, &iter);
- indices = gtk_tree_path_get_indices (treepath);
- row = indices[0];
- gtk_tree_path_free(treepath);
- }
- return row;
+ GtkTreeView *treeview;
+ GtkTreePath *treepath;
+ GtkTreeSelection *selection;
+ GtkTreeModel *store;
+ GtkTreeIter iter;
+ gint *indices;
+ gint row = -1;
+
+ g_debug("ghb_selected_subtitle_row ()");
+ treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "subtitle_list"));
+ selection = gtk_tree_view_get_selection (treeview);
+ if (gtk_tree_selection_get_selected(selection, &store, &iter))
+ {
+ // Get the row number
+ treepath = gtk_tree_model_get_path (store, &iter);
+ indices = gtk_tree_path_get_indices (treepath);
+ row = indices[0];
+ gtk_tree_path_free(treepath);
+ }
+ return row;
}
GValue*
ghb_selected_subtitle_settings(signal_user_data_t *ud)
{
- GtkTreeView *treeview;
- GtkTreePath *treepath;
- GtkTreeSelection *selection;
- GtkTreeModel *store;
- GtkTreeIter iter;
- gint *indices;
- gint row;
- GValue *settings = NULL;
- const GValue *subtitle_list;
-
- g_debug("get_selected_settings ()");
- treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "subtitle_list"));
- selection = gtk_tree_view_get_selection (treeview);
- if (gtk_tree_selection_get_selected(selection, &store, &iter))
- {
- // Get the row number
- treepath = gtk_tree_model_get_path (store, &iter);
- indices = gtk_tree_path_get_indices (treepath);
- row = indices[0];
- gtk_tree_path_free(treepath);
- // find subtitle settings
- if (row < 0) return NULL;
- subtitle_list = ghb_settings_get_value(ud->settings, "subtitle_list");
- if (row >= ghb_array_len(subtitle_list))
- return NULL;
- settings = ghb_array_get_nth(subtitle_list, row);
- }
- return settings;
+ GtkTreeView *treeview;
+ GtkTreePath *treepath;
+ GtkTreeSelection *selection;
+ GtkTreeModel *store;
+ GtkTreeIter iter;
+ gint *indices;
+ gint row;
+ GValue *settings = NULL;
+ const GValue *subtitle_list;
+
+ g_debug("get_selected_settings ()");
+ treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "subtitle_list"));
+ selection = gtk_tree_view_get_selection (treeview);
+ if (gtk_tree_selection_get_selected(selection, &store, &iter))
+ {
+ // Get the row number
+ treepath = gtk_tree_model_get_path (store, &iter);
+ indices = gtk_tree_path_get_indices (treepath);
+ row = indices[0];
+ gtk_tree_path_free(treepath);
+ // find subtitle settings
+ if (row < 0) return NULL;
+ subtitle_list = ghb_settings_get_value(ud->settings, "subtitle_list");
+ if (row >= ghb_array_len(subtitle_list))
+ return NULL;
+ settings = ghb_array_get_nth(subtitle_list, row);
+ }
+ return settings;
}
G_MODULE_EXPORT void
subtitle_forced_toggled_cb(
- GtkCellRendererToggle *cell,
- gchar *path,
- signal_user_data_t *ud)
+ GtkCellRendererToggle *cell,
+ gchar *path,
+ signal_user_data_t *ud)
{
- GtkTreeView *tv;
- GtkTreeModel *tm;
- GtkTreeIter ti;
- gboolean active;
- gint row;
- GtkTreePath *tp;
- gint *indices;
- GValue *subtitle_list, *settings;
- gint source;
-
- g_debug("forced toggled");
- tp = gtk_tree_path_new_from_string (path);
- tv = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "subtitle_list"));
- g_return_if_fail(tv != NULL);
- tm = gtk_tree_view_get_model(tv);
- g_return_if_fail(tm != NULL);
- gtk_tree_model_get_iter(tm, &ti, tp);
- gtk_tree_model_get(tm, &ti, 1, &active, -1);
- active ^= 1;
-
- // Get the row number
- indices = gtk_tree_path_get_indices (tp);
- row = indices[0];
- gtk_tree_path_free(tp);
-
- subtitle_list = ghb_settings_get_value(ud->settings, "subtitle_list");
-
- if (row < 0 || row >= ghb_array_len(subtitle_list))
- return;
-
- settings = ghb_array_get_nth(subtitle_list, row);
-
- source = ghb_settings_get_int(settings, "SubtitleSource");
- if (!ghb_canForceSub(source))
+ GtkTreeView *tv;
+ GtkTreeModel *tm;
+ GtkTreeIter ti;
+ gboolean active;
+ gint row;
+ GtkTreePath *tp;
+ gint *indices;
+ GValue *subtitle_list, *settings;
+ gint source;
+
+ g_debug("forced toggled");
+ tp = gtk_tree_path_new_from_string (path);
+ tv = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "subtitle_list"));
+ g_return_if_fail(tv != NULL);
+ tm = gtk_tree_view_get_model(tv);
+ g_return_if_fail(tm != NULL);
+ gtk_tree_model_get_iter(tm, &ti, tp);
+ gtk_tree_model_get(tm, &ti, 1, &active, -1);
+ active ^= 1;
+
+ // Get the row number
+ indices = gtk_tree_path_get_indices (tp);
+ row = indices[0];
+ gtk_tree_path_free(tp);
+
+ subtitle_list = ghb_settings_get_value(ud->settings, "subtitle_list");
+
+ if (row < 0 || row >= ghb_array_len(subtitle_list))
+ return;
+
+ settings = ghb_array_get_nth(subtitle_list, row);
+
+ source = ghb_settings_get_int(settings, "SubtitleSource");
+ if (!ghb_canForceSub(source))
{
- return;
+ return;
}
- ghb_settings_set_boolean(settings, "SubtitleForced", active);
- gtk_list_store_set(GTK_LIST_STORE(tm), &ti, 1, active, -1);
- ghb_live_reset(ud);
+ ghb_settings_set_boolean(settings, "SubtitleForced", active);
+ gtk_list_store_set(GTK_LIST_STORE(tm), &ti, 1, active, -1);
+ ghb_live_reset(ud);
}
G_MODULE_EXPORT void
subtitle_burned_toggled_cb(
- GtkCellRendererToggle *cell,
- gchar *path,
- signal_user_data_t *ud)
+ GtkCellRendererToggle *cell,
+ gchar *path,
+ signal_user_data_t *ud)
{
- GtkTreeView *tv;
- GtkTreeModel *tm;
- GtkTreeIter ti;
- GtkTreePath *tp;
- gboolean active;
- gint row;
- gint *indices;
- GValue *subtitle_list;
- gint count;
- GValue *settings;
- gint source, mux;
-
- g_debug("burned toggled");
- tp = gtk_tree_path_new_from_string (path);
- tv = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "subtitle_list"));
- g_return_if_fail(tv != NULL);
- tm = gtk_tree_view_get_model(tv);
- g_return_if_fail(tm != NULL);
- gtk_tree_model_get_iter(tm, &ti, tp);
- gtk_tree_model_get(tm, &ti, 2, &active, -1);
- active ^= 1;
-
- // Get the row number
- indices = gtk_tree_path_get_indices (tp);
- row = indices[0];
- gtk_tree_path_free(tp);
-
- subtitle_list = ghb_settings_get_value(ud->settings, "subtitle_list");
- count = ghb_array_len(subtitle_list);
- if (row < 0 || row >= count)
- return;
-
- settings = ghb_array_get_nth(subtitle_list, row);
- source = ghb_settings_get_int(settings, "SubtitleSource");
- if (!ghb_canBurnSub(source))
- return;
- mux = ghb_settings_combo_int(ud->settings, "FileFormat");
- if (!active && !hb_subtitle_can_pass(source, mux))
- return;
-
- ghb_settings_set_boolean(settings, "SubtitleBurned", active);
- gtk_list_store_set(GTK_LIST_STORE(tm), &ti, 2, active, -1);
-
- if (active)
- {
- ghb_settings_set_boolean(settings, "SubtitleDefaultTrack", !active);
- gtk_list_store_set(GTK_LIST_STORE(tm), &ti, 3, !active, -1);
- }
-
- // Unburn the rest
- if (active)
- ghb_subtitle_exclusive_burn(ud, row);
- ghb_live_reset(ud);
+ GtkTreeView *tv;
+ GtkTreeModel *tm;
+ GtkTreeIter ti;
+ GtkTreePath *tp;
+ gboolean active;
+ gint row;
+ gint *indices;
+ GValue *subtitle_list;
+ gint count;
+ GValue *settings;
+ gint source, mux;
+
+ g_debug("burned toggled");
+ tp = gtk_tree_path_new_from_string (path);
+ tv = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "subtitle_list"));
+ g_return_if_fail(tv != NULL);
+ tm = gtk_tree_view_get_model(tv);
+ g_return_if_fail(tm != NULL);
+ gtk_tree_model_get_iter(tm, &ti, tp);
+ gtk_tree_model_get(tm, &ti, 2, &active, -1);
+ active ^= 1;
+
+ // Get the row number
+ indices = gtk_tree_path_get_indices (tp);
+ row = indices[0];
+ gtk_tree_path_free(tp);
+
+ subtitle_list = ghb_settings_get_value(ud->settings, "subtitle_list");
+ count = ghb_array_len(subtitle_list);
+ if (row < 0 || row >= count)
+ return;
+
+ settings = ghb_array_get_nth(subtitle_list, row);
+ source = ghb_settings_get_int(settings, "SubtitleSource");
+ if (!ghb_canBurnSub(source))
+ return;
+ mux = ghb_settings_combo_int(ud->settings, "FileFormat");
+ if (!active && !hb_subtitle_can_pass(source, mux))
+ return;
+
+ ghb_settings_set_boolean(settings, "SubtitleBurned", active);
+ gtk_list_store_set(GTK_LIST_STORE(tm), &ti, 2, active, -1);
+
+ if (active)
+ {
+ ghb_settings_set_boolean(settings, "SubtitleDefaultTrack", !active);
+ gtk_list_store_set(GTK_LIST_STORE(tm), &ti, 3, !active, -1);
+ }
+
+ // Unburn the rest
+ if (active)
+ ghb_subtitle_exclusive_burn(ud, row);
+ ghb_live_reset(ud);
}
G_MODULE_EXPORT void
subtitle_default_toggled_cb(
- GtkCellRendererToggle *cell,
- gchar *path,
- signal_user_data_t *ud)
+ GtkCellRendererToggle *cell,
+ gchar *path,
+ signal_user_data_t *ud)
{
- GtkTreeView *tv;
- GtkTreeModel *tm;
- GtkTreeIter ti;
- GtkTreePath *tp;
- gboolean active;
- gint row;
- gint *indices;
- GValue *subtitle_list;
- gint count;
- GValue *settings;
-
- g_debug("default toggled");
- tp = gtk_tree_path_new_from_string (path);
- tv = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "subtitle_list"));
- g_return_if_fail(tv != NULL);
- tm = gtk_tree_view_get_model(tv);
- g_return_if_fail(tm != NULL);
- gtk_tree_model_get_iter(tm, &ti, tp);
- gtk_tree_model_get(tm, &ti, 3, &active, -1);
- active ^= 1;
-
- // Get the row number
- indices = gtk_tree_path_get_indices (tp);
- row = indices[0];
- gtk_tree_path_free(tp);
-
- subtitle_list = ghb_settings_get_value(ud->settings, "subtitle_list");
- count = ghb_array_len(subtitle_list);
- if (row < 0 || row >= count)
- return;
-
- settings = ghb_array_get_nth(subtitle_list, row);
-
- int source, mux;
- source = ghb_settings_get_int(settings, "SubtitleSource");
- mux = ghb_settings_combo_int(ud->settings, "FileFormat");
- if (active && !hb_subtitle_can_pass(source, mux))
- return;
-
- ghb_settings_set_boolean(settings, "SubtitleDefaultTrack", active);
- gtk_list_store_set(GTK_LIST_STORE(tm), &ti, 3, active, -1);
-
- if (active)
- {
- ghb_settings_set_boolean(settings, "SubtitleBurned", !active);
- gtk_list_store_set(GTK_LIST_STORE(tm), &ti, 2, !active, -1);
- }
- // allow only one default
- ghb_subtitle_exclusive_default(ud, row);
- ghb_live_reset(ud);
+ GtkTreeView *tv;
+ GtkTreeModel *tm;
+ GtkTreeIter ti;
+ GtkTreePath *tp;
+ gboolean active;
+ gint row;
+ gint *indices;
+ GValue *subtitle_list;
+ gint count;
+ GValue *settings;
+
+ g_debug("default toggled");
+ tp = gtk_tree_path_new_from_string (path);
+ tv = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "subtitle_list"));
+ g_return_if_fail(tv != NULL);
+ tm = gtk_tree_view_get_model(tv);
+ g_return_if_fail(tm != NULL);
+ gtk_tree_model_get_iter(tm, &ti, tp);
+ gtk_tree_model_get(tm, &ti, 3, &active, -1);
+ active ^= 1;
+
+ // Get the row number
+ indices = gtk_tree_path_get_indices (tp);
+ row = indices[0];
+ gtk_tree_path_free(tp);
+
+ subtitle_list = ghb_settings_get_value(ud->settings, "subtitle_list");
+ count = ghb_array_len(subtitle_list);
+ if (row < 0 || row >= count)
+ return;
+
+ settings = ghb_array_get_nth(subtitle_list, row);
+
+ int source, mux;
+ source = ghb_settings_get_int(settings, "SubtitleSource");
+ mux = ghb_settings_combo_int(ud->settings, "FileFormat");
+ if (active && !hb_subtitle_can_pass(source, mux))
+ return;
+
+ ghb_settings_set_boolean(settings, "SubtitleDefaultTrack", active);
+ gtk_list_store_set(GTK_LIST_STORE(tm), &ti, 3, active, -1);
+
+ if (active)
+ {
+ ghb_settings_set_boolean(settings, "SubtitleBurned", !active);
+ gtk_list_store_set(GTK_LIST_STORE(tm), &ti, 2, !active, -1);
+ }
+ // allow only one default
+ ghb_subtitle_exclusive_default(ud, row);
+ ghb_live_reset(ud);
}
void
ghb_subtitle_list_refresh_selected(signal_user_data_t *ud)
{
- GtkTreeView *treeview;
- GtkTreePath *treepath;
- GtkTreeSelection *selection;
- GtkTreeModel *store;
- GtkTreeIter iter;
- gint *indices;
- gint row;
- GValue *settings = NULL;
- const GValue *subtitle_list;
- gboolean allow_force = FALSE;
- gboolean allow_burn = FALSE;
-
- g_debug("subtitle_list_refresh_selected ()");
- treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "subtitle_list"));
- selection = gtk_tree_view_get_selection (treeview);
- if (gtk_tree_selection_get_selected(selection, &store, &iter))
- {
- gchar *track, *source;
- gboolean forced, burned, def;
- gchar *s_track;
- gint offset = 0;
-
- // Get the row number
- treepath = gtk_tree_model_get_path (store, &iter);
- indices = gtk_tree_path_get_indices (treepath);
- row = indices[0];
- gtk_tree_path_free(treepath);
- if (row < 0) return;
- subtitle_list = ghb_settings_get_value(ud->settings, "subtitle_list");
- if (row >= ghb_array_len(subtitle_list))
- return;
- settings = ghb_array_get_nth(subtitle_list, row);
-
- burned = ghb_settings_get_boolean(settings, "SubtitleBurned");
-
- gint i_source;
- i_source = ghb_settings_get_int(settings, "SubtitleSource");
- if (!ghb_canBurnSub(i_source))
- {
- burned = FALSE;
- ghb_settings_set_boolean(settings, "SubtitleBurned", burned);
- }
-
- gint i_mux;
- i_mux = ghb_settings_combo_int(ud->settings, "FileFormat");
- if (!burned && !ghb_canPassSub(i_source, i_mux))
- {
- burned = TRUE;
- ghb_settings_set_boolean(settings, "SubtitleBurned", burned);
- ghb_settings_set_boolean(settings, "SubtitleDefaultTrack", FALSE);
- }
-
- forced = ghb_settings_get_boolean(settings, "SubtitleForced");
- if (!ghb_canForceSub(i_source))
- {
- forced = FALSE;
- ghb_settings_set_boolean(settings, "SubtitleForced", forced);
- }
-
- def = ghb_settings_get_boolean(settings, "SubtitleDefaultTrack");
-
- if (i_source == SRTSUB)
- {
- const gchar *lang;
- gchar *code;
-
- lang = ghb_settings_combo_option(settings, "SrtLanguage");
- code = ghb_settings_get_string(settings, "SrtCodeset");
-
- s_track = ghb_settings_get_string(settings, "SrtFile");
- if (g_file_test(s_track, G_FILE_TEST_IS_REGULAR))
- {
- gchar *basename;
-
- basename = g_path_get_basename(s_track);
- track = g_strdup_printf("%s (%s)(SRT)(%s)", lang, code, basename);
- source = g_strdup_printf("SRT (%s)", basename);
- g_free(basename);
- }
- else
- {
- track = g_strdup_printf("%s (%s)(SRT)", lang, code);
- source = g_strdup_printf("SRT (none)");
- }
- g_free(code);
- offset = ghb_settings_get_int(settings, "SrtOffset");
- }
- else
- {
- track = g_strdup(
- ghb_settings_combo_option(settings, "SubtitleTrack"));
- source = g_strdup(hb_subsource_name(i_source));
- s_track = ghb_settings_get_string(settings, "SubtitleTrack");
- }
-
- if (ghb_canBurnSub(i_source))
- allow_burn = TRUE;
- if (ghb_canForceSub(i_source))
- allow_force = TRUE;
-
- gtk_list_store_set(GTK_LIST_STORE(store), &iter,
- // These are displayed in list
- 0, track,
- 1, forced,
- 2, burned,
- 3, def,
- 4, offset,
- // These are used to set combo box values when a list item is selected
- 5, s_track,
- 6, i_source,
- 7, allow_force,
- 8, allow_burn,
- -1);
- g_free(track);
- g_free(source);
- g_free(s_track);
- if (burned)
- ghb_subtitle_exclusive_burn(ud, row);
- }
+ GtkTreeView *treeview;
+ GtkTreePath *treepath;
+ GtkTreeSelection *selection;
+ GtkTreeModel *store;
+ GtkTreeIter iter;
+ gint *indices;
+ gint row;
+ GValue *settings = NULL;
+ const GValue *subtitle_list;
+ gboolean allow_force = FALSE;
+ gboolean allow_burn = FALSE;
+
+ g_debug("subtitle_list_refresh_selected ()");
+ treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "subtitle_list"));
+ selection = gtk_tree_view_get_selection (treeview);
+ if (gtk_tree_selection_get_selected(selection, &store, &iter))
+ {
+ gchar *track, *source;
+ gboolean forced, burned, def;
+ gchar *s_track;
+ gint offset = 0;
+
+ // Get the row number
+ treepath = gtk_tree_model_get_path (store, &iter);
+ indices = gtk_tree_path_get_indices (treepath);
+ row = indices[0];
+ gtk_tree_path_free(treepath);
+ if (row < 0) return;
+ subtitle_list = ghb_settings_get_value(ud->settings, "subtitle_list");
+ if (row >= ghb_array_len(subtitle_list))
+ return;
+ settings = ghb_array_get_nth(subtitle_list, row);
+
+ burned = ghb_settings_get_boolean(settings, "SubtitleBurned");
+
+ gint i_source;
+ i_source = ghb_settings_get_int(settings, "SubtitleSource");
+ if (!ghb_canBurnSub(i_source))
+ {
+ burned = FALSE;
+ ghb_settings_set_boolean(settings, "SubtitleBurned", burned);
+ }
+
+ gint i_mux;
+ i_mux = ghb_settings_combo_int(ud->settings, "FileFormat");
+ if (!burned && !ghb_canPassSub(i_source, i_mux))
+ {
+ burned = TRUE;
+ ghb_settings_set_boolean(settings, "SubtitleBurned", burned);
+ ghb_settings_set_boolean(settings, "SubtitleDefaultTrack", FALSE);
+ }
+
+ forced = ghb_settings_get_boolean(settings, "SubtitleForced");
+ if (!ghb_canForceSub(i_source))
+ {
+ forced = FALSE;
+ ghb_settings_set_boolean(settings, "SubtitleForced", forced);
+ }
+
+ def = ghb_settings_get_boolean(settings, "SubtitleDefaultTrack");
+
+ if (i_source == SRTSUB)
+ {
+ const gchar *lang;
+ gchar *code;
+
+ lang = ghb_settings_combo_option(settings, "SrtLanguage");
+ code = ghb_settings_get_string(settings, "SrtCodeset");
+
+ s_track = ghb_settings_get_string(settings, "SrtFile");
+ if (g_file_test(s_track, G_FILE_TEST_IS_REGULAR))
+ {
+ gchar *basename;
+
+ basename = g_path_get_basename(s_track);
+ track = g_strdup_printf("%s (%s)(SRT)(%s)", lang, code, basename);
+ source = g_strdup_printf("SRT (%s)", basename);
+ g_free(basename);
+ }
+ else
+ {
+ track = g_strdup_printf("%s (%s)(SRT)", lang, code);
+ source = g_strdup_printf("SRT (none)");
+ }
+ g_free(code);
+ offset = ghb_settings_get_int(settings, "SrtOffset");
+ }
+ else
+ {
+ track = g_strdup(
+ ghb_settings_combo_option(settings, "SubtitleTrack"));
+ source = g_strdup(hb_subsource_name(i_source));
+ s_track = ghb_settings_get_string(settings, "SubtitleTrack");
+ }
+
+ if (ghb_canBurnSub(i_source))
+ allow_burn = TRUE;
+ if (ghb_canForceSub(i_source))
+ allow_force = TRUE;
+
+ gtk_list_store_set(GTK_LIST_STORE(store), &iter,
+ // These are displayed in list
+ 0, track,
+ 1, forced,
+ 2, burned,
+ 3, def,
+ 4, offset,
+ // These are used to set combo box values when a list item is selected
+ 5, s_track,
+ 6, i_source,
+ 7, allow_force,
+ 8, allow_burn,
+ -1);
+ g_free(track);
+ g_free(source);
+ g_free(s_track);
+ if (burned)
+ ghb_subtitle_exclusive_burn(ud, row);
+ }
}
G_MODULE_EXPORT void
subtitle_track_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
{
- GValue *settings;
-
- g_debug("subtitle_track_changed_cb ()");
- ghb_check_dependency(ud, widget, NULL);
- ghb_widget_to_setting(ud->settings, widget);
- settings = ghb_selected_subtitle_settings(ud);
- if (settings != NULL)
- {
- const gchar *track, *lang;
- gint tt, source;
-
- ghb_widget_to_setting(settings, widget);
- track = ghb_settings_combo_option(settings, "SubtitleTrack");
- ghb_settings_set_string(settings, "SubtitleTrackDescription", track);
- tt = ghb_settings_get_int(settings, "SubtitleTrack");
- source = ghb_subtitle_track_source(ud->settings, tt);
- ghb_settings_set_int(settings, "SubtitleSource", source);
- lang = ghb_settings_combo_string(settings, "SubtitleTrack");
- ghb_settings_set_string(settings, "SubtitleLanguage", lang);
- ghb_subtitle_list_refresh_selected(ud);
- ghb_live_reset(ud);
- }
- ghb_live_reset(ud);
+ GValue *settings;
+
+ g_debug("subtitle_track_changed_cb ()");
+ ghb_check_dependency(ud, widget, NULL);
+ ghb_widget_to_setting(ud->settings, widget);
+ settings = ghb_selected_subtitle_settings(ud);
+ if (settings != NULL)
+ {
+ const gchar *track, *lang;
+ gint tt, source;
+
+ ghb_widget_to_setting(settings, widget);
+ track = ghb_settings_combo_option(settings, "SubtitleTrack");
+ ghb_settings_set_string(settings, "SubtitleTrackDescription", track);
+ tt = ghb_settings_get_int(settings, "SubtitleTrack");
+ source = ghb_subtitle_track_source(ud->settings, tt);
+ ghb_settings_set_int(settings, "SubtitleSource", source);
+ lang = ghb_settings_combo_string(settings, "SubtitleTrack");
+ ghb_settings_set_string(settings, "SubtitleLanguage", lang);
+ ghb_subtitle_list_refresh_selected(ud);
+ ghb_live_reset(ud);
+ }
+ ghb_live_reset(ud);
}
G_MODULE_EXPORT void
srt_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
{
- GValue *settings;
-
- g_debug("srt_changed_cb ()");
- ghb_check_dependency(ud, widget, NULL);
- ghb_widget_to_setting(ud->settings, widget);
- settings = ghb_selected_subtitle_settings(ud);
- if (settings != NULL)
- {
- ghb_widget_to_setting(settings, widget);
- ghb_subtitle_list_refresh_selected(ud);
-
- ghb_live_reset(ud);
- }
+ GValue *settings;
+
+ g_debug("srt_changed_cb ()");
+ ghb_check_dependency(ud, widget, NULL);
+ ghb_widget_to_setting(ud->settings, widget);
+ settings = ghb_selected_subtitle_settings(ud);
+ if (settings != NULL)
+ {
+ ghb_widget_to_setting(settings, widget);
+ ghb_subtitle_list_refresh_selected(ud);
+
+ ghb_live_reset(ud);
+ }
}
G_MODULE_EXPORT void
srt_file_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
{
- GValue *settings;
-
- g_debug("srt_file_changed_cb ()");
- ghb_check_dependency(ud, widget, NULL);
- ghb_widget_to_setting(ud->settings, widget);
- settings = ghb_selected_subtitle_settings(ud);
- if (settings != NULL)
- {
- gchar *filename, *dirname;
-
- ghb_widget_to_setting(settings, widget);
- ghb_subtitle_list_refresh_selected(ud);
-
- ghb_live_reset(ud);
-
- filename = ghb_settings_get_string(settings, "SrtFile");
- if (g_file_test(filename, G_FILE_TEST_IS_DIR))
- {
- ghb_settings_set_string(ud->settings, "SrtDir", filename);
- }
- else
- {
- dirname = g_path_get_dirname(filename);
- ghb_settings_set_string(ud->settings, "SrtDir", dirname);
- g_free(dirname);
- }
- ghb_pref_save(ud->settings, "SrtDir");
- g_free(filename);
- }
+ GValue *settings;
+
+ g_debug("srt_file_changed_cb ()");
+ ghb_check_dependency(ud, widget, NULL);
+ ghb_widget_to_setting(ud->settings, widget);
+ settings = ghb_selected_subtitle_settings(ud);
+ if (settings != NULL)
+ {
+ gchar *filename, *dirname;
+
+ ghb_widget_to_setting(settings, widget);
+ ghb_subtitle_list_refresh_selected(ud);
+
+ ghb_live_reset(ud);
+
+ filename = ghb_settings_get_string(settings, "SrtFile");
+ if (g_file_test(filename, G_FILE_TEST_IS_DIR))
+ {
+ ghb_settings_set_string(ud->settings, "SrtDir", filename);
+ }
+ else
+ {
+ dirname = g_path_get_dirname(filename);
+ ghb_settings_set_string(ud->settings, "SrtDir", dirname);
+ g_free(dirname);
+ }
+ ghb_pref_save(ud->settings, "SrtDir");
+ g_free(filename);
+ }
}
G_MODULE_EXPORT void
srt_lang_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
{
- GValue *settings;
+ GValue *settings;
- g_debug("srt_lang_changed_cb ()");
- ghb_check_dependency(ud, widget, NULL);
- ghb_widget_to_setting(ud->settings, widget);
- settings = ghb_selected_subtitle_settings(ud);
- if (settings != NULL)
- {
- const gchar *lang;
+ g_debug("srt_lang_changed_cb ()");
+ ghb_check_dependency(ud, widget, NULL);
+ ghb_widget_to_setting(ud->settings, widget);
+ settings = ghb_selected_subtitle_settings(ud);
+ if (settings != NULL)
+ {
+ const gchar *lang;
- ghb_widget_to_setting(settings, widget);
- ghb_subtitle_list_refresh_selected(ud);
+ ghb_widget_to_setting(settings, widget);
+ ghb_subtitle_list_refresh_selected(ud);
- ghb_live_reset(ud);
+ ghb_live_reset(ud);
- lang = ghb_settings_combo_option(settings, "SrtLanguage");
- ghb_settings_set_string(settings, "SubtitleTrackDescription", lang);
- }
+ lang = ghb_settings_combo_option(settings, "SrtLanguage");
+ ghb_settings_set_string(settings, "SubtitleTrackDescription", lang);
+ }
}
static void
ghb_clear_subtitle_list_settings(GValue *settings)
{
- GValue *subtitle_list;
-
- g_debug("clear_subtitle_list ()");
- subtitle_list = ghb_settings_get_value(settings, "subtitle_list");
- if (subtitle_list == NULL)
- {
- subtitle_list = ghb_array_value_new(8);
- ghb_settings_set_value(settings, "subtitle_list", subtitle_list);
- }
- else
- ghb_array_value_reset(subtitle_list, 8);
+ GValue *subtitle_list;
+
+ g_debug("clear_subtitle_list ()");
+ subtitle_list = ghb_settings_get_value(settings, "subtitle_list");
+ if (subtitle_list == NULL)
+ {
+ subtitle_list = ghb_array_value_new(8);
+ ghb_settings_set_value(settings, "subtitle_list", subtitle_list);
+ }
+ else
+ ghb_array_value_reset(subtitle_list, 8);
}
static void
ghb_clear_subtitle_list(signal_user_data_t *ud)
{
- GtkTreeView *treeview;
- GtkListStore *store;
-
- g_debug("clear_subtitle_list ()");
- treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "subtitle_list"));
- store = GTK_LIST_STORE(gtk_tree_view_get_model(treeview));
- gtk_list_store_clear (store);
+ GtkTreeView *treeview;
+ GtkListStore *store;
+
+ g_debug("clear_subtitle_list ()");
+ treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "subtitle_list"));
+ store = GTK_LIST_STORE(gtk_tree_view_get_model(treeview));
+ gtk_list_store_clear (store);
}
static void
add_to_subtitle_list(
- signal_user_data_t *ud,
- GValue *settings)
+ signal_user_data_t *ud,
+ GValue *settings)
{
- GtkTreeView *treeview;
- GtkTreeIter iter;
- GtkListStore *store;
- GtkTreeSelection *selection;
- const gchar *track;
- gboolean forced, burned, def;
- gchar *s_track;
- gint i_source;
- gboolean allow_force = FALSE;
- gboolean allow_burn = FALSE;
-
- g_debug("add_to_subtitle_list ()");
- treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "subtitle_list"));
- selection = gtk_tree_view_get_selection (treeview);
- store = GTK_LIST_STORE(gtk_tree_view_get_model(treeview));
-
- track = ghb_settings_combo_option(settings, "SubtitleTrack");
- forced = ghb_settings_get_boolean(settings, "SubtitleForced");
- burned = ghb_settings_get_boolean(settings, "SubtitleBurned");
- def = ghb_settings_get_boolean(settings, "SubtitleDefaultTrack");
-
- s_track = ghb_settings_get_string(settings, "SubtitleTrack");
- i_source = ghb_settings_get_int(settings, "SubtitleSource");
-
- if (ghb_canBurnSub(i_source))
- allow_burn = TRUE;
- if (ghb_canForceSub(i_source))
- allow_force = TRUE;
-
- gtk_list_store_append(store, &iter);
- gtk_list_store_set(store, &iter,
- // These are displayed in list
- 0, track,
- 1, forced,
- 2, burned,
- 3, def,
- // These are used to set combo box values when a list item is selected
- 5, s_track,
- 6, i_source,
- 7, allow_force,
- 8, allow_burn,
- 9, FALSE,
- -1);
- gtk_tree_selection_select_iter(selection, &iter);
- g_free(s_track);
+ GtkTreeView *treeview;
+ GtkTreeIter iter;
+ GtkListStore *store;
+ GtkTreeSelection *selection;
+ const gchar *track;
+ gboolean forced, burned, def;
+ gchar *s_track;
+ gint i_source;
+ gboolean allow_force = FALSE;
+ gboolean allow_burn = FALSE;
+
+ g_debug("add_to_subtitle_list ()");
+ treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "subtitle_list"));
+ selection = gtk_tree_view_get_selection (treeview);
+ store = GTK_LIST_STORE(gtk_tree_view_get_model(treeview));
+
+ track = ghb_settings_combo_option(settings, "SubtitleTrack");
+ forced = ghb_settings_get_boolean(settings, "SubtitleForced");
+ burned = ghb_settings_get_boolean(settings, "SubtitleBurned");
+ def = ghb_settings_get_boolean(settings, "SubtitleDefaultTrack");
+
+ s_track = ghb_settings_get_string(settings, "SubtitleTrack");
+ i_source = ghb_settings_get_int(settings, "SubtitleSource");
+
+ if (ghb_canBurnSub(i_source))
+ allow_burn = TRUE;
+ if (ghb_canForceSub(i_source))
+ allow_force = TRUE;
+
+ gtk_list_store_append(store, &iter);
+ gtk_list_store_set(store, &iter,
+ // These are displayed in list
+ 0, track,
+ 1, forced,
+ 2, burned,
+ 3, def,
+ // These are used to set combo box values when a list item is selected
+ 5, s_track,
+ 6, i_source,
+ 7, allow_force,
+ 8, allow_burn,
+ 9, FALSE,
+ -1);
+ gtk_tree_selection_select_iter(selection, &iter);
+ g_free(s_track);
}
static void
add_to_srt_list(
- signal_user_data_t *ud,
- GValue *settings)
+ signal_user_data_t *ud,
+ GValue *settings)
{
- GtkTreeView *treeview;
- GtkTreeIter iter;
- GtkListStore *store;
- GtkTreeSelection *selection;
- const gchar *lang;
- gboolean forced, burned, def;
- gchar *filename, *code, *track, *source;
- gint i_source, offset;
-
- g_debug("add_to_srt_list ()");
- treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "subtitle_list"));
- selection = gtk_tree_view_get_selection (treeview);
- store = GTK_LIST_STORE(gtk_tree_view_get_model(treeview));
-
- lang = ghb_settings_combo_option(settings, "SrtLanguage");
- code = ghb_settings_get_string(settings, "SrtCodeset");
- forced = FALSE;
- burned = FALSE;
- def = ghb_settings_get_boolean(settings, "SubtitleDefaultTrack");
-
- filename = ghb_settings_get_string(settings, "SrtFile");
- if (g_file_test(filename, G_FILE_TEST_IS_REGULAR))
- {
- gchar *basename;
-
- basename = g_path_get_basename(filename);
- track = g_strdup_printf("%s (%s)(SRT)(%s)", lang, code, basename);
- source = g_strdup_printf("SRT (%s)", basename);
- g_free(basename);
- }
- else
- {
- track = g_strdup_printf("%s (%s)(SRT)", lang, code);
- source = g_strdup_printf("SRT (none)");
- }
- i_source = SRTSUB;
- offset = ghb_settings_get_int(settings, "SrtOffset");
-
- gtk_list_store_append(store, &iter);
- gtk_list_store_set(store, &iter,
- // These are displayed in list
- 0, track,
- 1, forced,
- 2, burned,
- 3, def,
- 4, offset,
- // These are used to set combo box values when a list item is selected
- 5, filename,
- 6, i_source,
- 7, FALSE,
- 8, FALSE,
- 9, TRUE,
- -1);
- gtk_tree_selection_select_iter(selection, &iter);
- g_free(code);
- g_free(track);
- g_free(filename);
- g_free(source);
+ GtkTreeView *treeview;
+ GtkTreeIter iter;
+ GtkListStore *store;
+ GtkTreeSelection *selection;
+ const gchar *lang;
+ gboolean forced, burned, def;
+ gchar *filename, *code, *track, *source;
+ gint i_source, offset;
+
+ g_debug("add_to_srt_list ()");
+ treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "subtitle_list"));
+ selection = gtk_tree_view_get_selection (treeview);
+ store = GTK_LIST_STORE(gtk_tree_view_get_model(treeview));
+
+ lang = ghb_settings_combo_option(settings, "SrtLanguage");
+ code = ghb_settings_get_string(settings, "SrtCodeset");
+ forced = FALSE;
+ burned = FALSE;
+ def = ghb_settings_get_boolean(settings, "SubtitleDefaultTrack");
+
+ filename = ghb_settings_get_string(settings, "SrtFile");
+ if (g_file_test(filename, G_FILE_TEST_IS_REGULAR))
+ {
+ gchar *basename;
+
+ basename = g_path_get_basename(filename);
+ track = g_strdup_printf("%s (%s)(SRT)(%s)", lang, code, basename);
+ source = g_strdup_printf("SRT (%s)", basename);
+ g_free(basename);
+ }
+ else
+ {
+ track = g_strdup_printf("%s (%s)(SRT)", lang, code);
+ source = g_strdup_printf("SRT (none)");
+ }
+ i_source = SRTSUB;
+ offset = ghb_settings_get_int(settings, "SrtOffset");
+
+ gtk_list_store_append(store, &iter);
+ gtk_list_store_set(store, &iter,
+ // These are displayed in list
+ 0, track,
+ 1, forced,
+ 2, burned,
+ 3, def,
+ 4, offset,
+ // These are used to set combo box values when a list item is selected
+ 5, filename,
+ 6, i_source,
+ 7, FALSE,
+ 8, FALSE,
+ 9, TRUE,
+ -1);
+ gtk_tree_selection_select_iter(selection, &iter);
+ g_free(code);
+ g_free(track);
+ g_free(filename);
+ g_free(source);
}
G_MODULE_EXPORT void
subtitle_list_selection_changed_cb(GtkTreeSelection *selection, signal_user_data_t *ud)
{
- GtkTreeModel *store;
- GtkTreeIter iter;
- GtkWidget *widget;
-
- g_debug("subtitle_list_selection_changed_cb ()");
- if (gtk_tree_selection_get_selected(selection, &store, &iter))
- {
- gint source;
- GtkTreePath *treepath;
- gint *indices, row;
- GValue *subtitle_list, *settings;
-
- treepath = gtk_tree_model_get_path (store, &iter);
- indices = gtk_tree_path_get_indices (treepath);
- row = indices[0];
- gtk_tree_path_free(treepath);
-
- subtitle_list = ghb_settings_get_value(ud->settings, "subtitle_list");
- if (row >= ghb_array_len(subtitle_list))
- return;
-
- settings = ghb_array_get_nth(subtitle_list, row);
-
- source = ghb_settings_get_int(settings, "SubtitleSource");
- if (source == SRTSUB)
- {
- gchar *str;
- gint offset;
-
- str = ghb_settings_get_string(settings, "SrtLanguage");
- ghb_ui_update(ud, "SrtLanguage", ghb_string_value(str));
- g_free(str);
-
- str = ghb_settings_get_string(settings, "SrtCodeset");
- ghb_ui_update(ud, "SrtCodeset", ghb_string_value(str));
- g_free(str);
-
- str = ghb_settings_get_string(settings, "SrtFile");
- ghb_ui_update(ud, "SrtFile", ghb_string_value(str));
- g_free(str);
-
- offset = ghb_settings_get_int(settings, "SrtOffset");
- ghb_ui_update(ud, "SrtOffset", ghb_int_value(offset));
-
- widget = GHB_WIDGET(ud->builder, "subtitle_track_label");
- gtk_widget_hide(widget);
- widget = GHB_WIDGET(ud->builder, "SubtitleTrack");
- gtk_widget_hide(widget);
- widget = GHB_WIDGET(ud->builder, "srt_lang_label");
- gtk_widget_show(widget);
- widget = GHB_WIDGET(ud->builder, "srt_code_label");
- gtk_widget_show(widget);
- widget = GHB_WIDGET(ud->builder, "srt_file_label");
- gtk_widget_show(widget);
- widget = GHB_WIDGET(ud->builder, "srt_offset_label");
- gtk_widget_show(widget);
- widget = GHB_WIDGET(ud->builder, "SrtLanguage");
- gtk_widget_show(widget);
- widget = GHB_WIDGET(ud->builder, "SrtCodeset");
- gtk_widget_show(widget);
- widget = GHB_WIDGET(ud->builder, "SrtFile");
- gtk_widget_show(widget);
- widget = GHB_WIDGET(ud->builder, "SrtOffset");
- gtk_widget_show(widget);
- }
- else
- {
- gchar *track;
-
- track = ghb_settings_get_string(settings, "SubtitleTrack");
- ghb_ui_update(ud, "SubtitleTrack", ghb_string_value(track));
- g_free(track);
-
- widget = GHB_WIDGET(ud->builder, "srt_lang_label");
- gtk_widget_hide(widget);
- widget = GHB_WIDGET(ud->builder, "srt_code_label");
- gtk_widget_hide(widget);
- widget = GHB_WIDGET(ud->builder, "srt_file_label");
- gtk_widget_hide(widget);
- widget = GHB_WIDGET(ud->builder, "srt_offset_label");
- gtk_widget_hide(widget);
- widget = GHB_WIDGET(ud->builder, "SrtLanguage");
- gtk_widget_hide(widget);
- widget = GHB_WIDGET(ud->builder, "SrtCodeset");
- gtk_widget_hide(widget);
- widget = GHB_WIDGET(ud->builder, "SrtFile");
- gtk_widget_hide(widget);
- widget = GHB_WIDGET(ud->builder, "SrtOffset");
- gtk_widget_hide(widget);
- widget = GHB_WIDGET(ud->builder, "subtitle_track_label");
- gtk_widget_show(widget);
- widget = GHB_WIDGET(ud->builder, "SubtitleTrack");
- gtk_widget_show(widget);
- }
- widget = GHB_WIDGET (ud->builder, "subtitle_remove");
- gtk_widget_set_sensitive(widget, TRUE);
- }
- else
- {
- widget = GHB_WIDGET(ud->builder, "srt_lang_label");
- gtk_widget_hide(widget);
- widget = GHB_WIDGET(ud->builder, "srt_code_label");
- gtk_widget_hide(widget);
- widget = GHB_WIDGET(ud->builder, "srt_file_label");
- gtk_widget_hide(widget);
- widget = GHB_WIDGET(ud->builder, "srt_offset_label");
- gtk_widget_hide(widget);
- widget = GHB_WIDGET(ud->builder, "SrtLanguage");
- gtk_widget_hide(widget);
- widget = GHB_WIDGET(ud->builder, "SrtCodeset");
- gtk_widget_hide(widget);
- widget = GHB_WIDGET(ud->builder, "SrtFile");
- gtk_widget_hide(widget);
- widget = GHB_WIDGET(ud->builder, "SrtOffset");
- gtk_widget_hide(widget);
- widget = GHB_WIDGET(ud->builder, "subtitle_track_label");
- gtk_widget_show(widget);
- widget = GHB_WIDGET(ud->builder, "SubtitleTrack");
- gtk_widget_show(widget);
- }
+ GtkTreeModel *store;
+ GtkTreeIter iter;
+ GtkWidget *widget;
+
+ g_debug("subtitle_list_selection_changed_cb ()");
+ if (gtk_tree_selection_get_selected(selection, &store, &iter))
+ {
+ gint source;
+ GtkTreePath *treepath;
+ gint *indices, row;
+ GValue *subtitle_list, *settings;
+
+ treepath = gtk_tree_model_get_path (store, &iter);
+ indices = gtk_tree_path_get_indices (treepath);
+ row = indices[0];
+ gtk_tree_path_free(treepath);
+
+ subtitle_list = ghb_settings_get_value(ud->settings, "subtitle_list");
+ if (row >= ghb_array_len(subtitle_list))
+ return;
+
+ settings = ghb_array_get_nth(subtitle_list, row);
+
+ source = ghb_settings_get_int(settings, "SubtitleSource");
+ if (source == SRTSUB)
+ {
+ gchar *str;
+ gint offset;
+
+ str = ghb_settings_get_string(settings, "SrtLanguage");
+ ghb_ui_update(ud, "SrtLanguage", ghb_string_value(str));
+ g_free(str);
+
+ str = ghb_settings_get_string(settings, "SrtCodeset");
+ ghb_ui_update(ud, "SrtCodeset", ghb_string_value(str));
+ g_free(str);
+
+ str = ghb_settings_get_string(settings, "SrtFile");
+ ghb_ui_update(ud, "SrtFile", ghb_string_value(str));
+ g_free(str);
+
+ offset = ghb_settings_get_int(settings, "SrtOffset");
+ ghb_ui_update(ud, "SrtOffset", ghb_int_value(offset));
+
+ widget = GHB_WIDGET(ud->builder, "subtitle_track_label");
+ gtk_widget_hide(widget);
+ widget = GHB_WIDGET(ud->builder, "SubtitleTrack");
+ gtk_widget_hide(widget);
+ widget = GHB_WIDGET(ud->builder, "srt_lang_label");
+ gtk_widget_show(widget);
+ widget = GHB_WIDGET(ud->builder, "srt_code_label");
+ gtk_widget_show(widget);
+ widget = GHB_WIDGET(ud->builder, "srt_file_label");
+ gtk_widget_show(widget);
+ widget = GHB_WIDGET(ud->builder, "srt_offset_label");
+ gtk_widget_show(widget);
+ widget = GHB_WIDGET(ud->builder, "SrtLanguage");
+ gtk_widget_show(widget);
+ widget = GHB_WIDGET(ud->builder, "SrtCodeset");
+ gtk_widget_show(widget);
+ widget = GHB_WIDGET(ud->builder, "SrtFile");
+ gtk_widget_show(widget);
+ widget = GHB_WIDGET(ud->builder, "SrtOffset");
+ gtk_widget_show(widget);
+ }
+ else
+ {
+ gchar *track;
+
+ track = ghb_settings_get_string(settings, "SubtitleTrack");
+ ghb_ui_update(ud, "SubtitleTrack", ghb_string_value(track));
+ g_free(track);
+
+ widget = GHB_WIDGET(ud->builder, "srt_lang_label");
+ gtk_widget_hide(widget);
+ widget = GHB_WIDGET(ud->builder, "srt_code_label");
+ gtk_widget_hide(widget);
+ widget = GHB_WIDGET(ud->builder, "srt_file_label");
+ gtk_widget_hide(widget);
+ widget = GHB_WIDGET(ud->builder, "srt_offset_label");
+ gtk_widget_hide(widget);
+ widget = GHB_WIDGET(ud->builder, "SrtLanguage");
+ gtk_widget_hide(widget);
+ widget = GHB_WIDGET(ud->builder, "SrtCodeset");
+ gtk_widget_hide(widget);
+ widget = GHB_WIDGET(ud->builder, "SrtFile");
+ gtk_widget_hide(widget);
+ widget = GHB_WIDGET(ud->builder, "SrtOffset");
+ gtk_widget_hide(widget);
+ widget = GHB_WIDGET(ud->builder, "subtitle_track_label");
+ gtk_widget_show(widget);
+ widget = GHB_WIDGET(ud->builder, "SubtitleTrack");
+ gtk_widget_show(widget);
+ }
+ widget = GHB_WIDGET (ud->builder, "subtitle_remove");
+ gtk_widget_set_sensitive(widget, TRUE);
+ }
+ else
+ {
+ widget = GHB_WIDGET(ud->builder, "srt_lang_label");
+ gtk_widget_hide(widget);
+ widget = GHB_WIDGET(ud->builder, "srt_code_label");
+ gtk_widget_hide(widget);
+ widget = GHB_WIDGET(ud->builder, "srt_file_label");
+ gtk_widget_hide(widget);
+ widget = GHB_WIDGET(ud->builder, "srt_offset_label");
+ gtk_widget_hide(widget);
+ widget = GHB_WIDGET(ud->builder, "SrtLanguage");
+ gtk_widget_hide(widget);
+ widget = GHB_WIDGET(ud->builder, "SrtCodeset");
+ gtk_widget_hide(widget);
+ widget = GHB_WIDGET(ud->builder, "SrtFile");
+ gtk_widget_hide(widget);
+ widget = GHB_WIDGET(ud->builder, "SrtOffset");
+ gtk_widget_hide(widget);
+ widget = GHB_WIDGET(ud->builder, "subtitle_track_label");
+ gtk_widget_show(widget);
+ widget = GHB_WIDGET(ud->builder, "SubtitleTrack");
+ gtk_widget_show(widget);
+ }
}
G_MODULE_EXPORT void
srt_add_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud)
{
- // Add the current subtitle settings to the list.
- GValue *settings;
- gchar *dir, *filename, *lang;
-
- g_debug("subtitle_add_clicked_cb ()");
-
- settings = ghb_dict_value_new();
- ghb_settings_set_int(settings, "SubtitleSource", SRTSUB);
- lang = ghb_settings_get_string(ud->settings, "PreferredLanguage");
- ghb_settings_set_string(settings, "SrtLanguage", lang);
- g_free(lang);
- ghb_settings_set_string(settings, "SrtCodeset", "UTF-8");
-
- dir = ghb_settings_get_string(ud->settings, "SrtDir");
- filename = g_strdup_printf("%s/none", dir);
- ghb_settings_set_string(settings, "SrtFile", filename);
- g_free(dir);
- g_free(filename);
-
- ghb_settings_set_int(settings, "SrtOffset", 0);
- ghb_settings_take_value(settings, "SubtitleDefaultTrack",
- ghb_boolean_value_new(FALSE));
-
- ghb_add_srt(ud, settings);
+ // Add the current subtitle settings to the list.
+ GValue *settings;
+ gchar *dir, *filename, *lang;
+
+ g_debug("subtitle_add_clicked_cb ()");
+
+ settings = ghb_dict_value_new();
+ ghb_settings_set_int(settings, "SubtitleSource", SRTSUB);
+ lang = ghb_settings_get_string(ud->settings, "PreferredLanguage");
+ ghb_settings_set_string(settings, "SrtLanguage", lang);
+ g_free(lang);
+ ghb_settings_set_string(settings, "SrtCodeset", "UTF-8");
+
+ dir = ghb_settings_get_string(ud->settings, "SrtDir");
+ filename = g_strdup_printf("%s/none", dir);
+ ghb_settings_set_string(settings, "SrtFile", filename);
+ g_free(dir);
+ g_free(filename);
+
+ ghb_settings_set_int(settings, "SrtOffset", 0);
+ ghb_settings_take_value(settings, "SubtitleDefaultTrack",
+ ghb_boolean_value_new(FALSE));
+
+ ghb_add_srt(ud, settings);
}
G_MODULE_EXPORT void
subtitle_add_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud)
{
- // Add the current subtitle settings to the list.
- GValue *settings;
- gboolean burned = FALSE;
- gint track, source, mux;
-
- g_debug("subtitle_add_clicked_cb ()");
-
- track = ghb_settings_get_int(ud->settings, "SubtitleTrack");
-
- settings = ghb_dict_value_new();
- ghb_settings_set_int(settings, "SubtitleTrack", track);
- source = ghb_subtitle_track_source(ud->settings, track);
-
- // Initialize to passthru if possible, else burn
- mux = ghb_settings_combo_int(ud->settings, "FileFormat");
- burned = !hb_subtitle_can_pass(source, mux);
-
- ghb_settings_set_int(settings, "SubtitleSource", source);
- ghb_settings_take_value(settings, "SubtitleForced",
- ghb_boolean_value_new(FALSE));
- ghb_settings_take_value(settings, "SubtitleBurned",
- ghb_boolean_value_new(burned));
- ghb_settings_take_value(settings, "SubtitleDefaultTrack",
- ghb_boolean_value_new(FALSE));
-
- if (!ghb_add_subtitle_to_settings(ud->settings, settings))
- return;
-
- ghb_add_subtitle_to_ui(ud, settings);
+ // Add the current subtitle settings to the list.
+ GValue *settings;
+ gboolean burned = FALSE;
+ gint track, source, mux;
+
+ g_debug("subtitle_add_clicked_cb ()");
+
+ track = ghb_settings_get_int(ud->settings, "SubtitleTrack");
+
+ settings = ghb_dict_value_new();
+ ghb_settings_set_int(settings, "SubtitleTrack", track);
+ source = ghb_subtitle_track_source(ud->settings, track);
+
+ // Initialize to passthru if possible, else burn
+ mux = ghb_settings_combo_int(ud->settings, "FileFormat");
+ burned = !hb_subtitle_can_pass(source, mux);
+
+ ghb_settings_set_int(settings, "SubtitleSource", source);
+ ghb_settings_take_value(settings, "SubtitleForced",
+ ghb_boolean_value_new(FALSE));
+ ghb_settings_take_value(settings, "SubtitleBurned",
+ ghb_boolean_value_new(burned));
+ ghb_settings_take_value(settings, "SubtitleDefaultTrack",
+ ghb_boolean_value_new(FALSE));
+
+ if (!ghb_add_subtitle_to_settings(ud->settings, settings))
+ return;
+
+ ghb_add_subtitle_to_ui(ud, settings);
}
G_MODULE_EXPORT void
subtitle_remove_clicked_cb(GtkWidget *widget, signal_user_data_t *ud)
{
- GtkTreeView *treeview;
- GtkTreePath *treepath;
- GtkTreeSelection *selection;
- GtkTreeModel *store;
- GtkTreeIter iter, nextIter;
- gint *indices;
- gint row;
- GValue *subtitle_list;
-
- g_debug("subtitle_remove_clicked_cb ()");
- treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "subtitle_list"));
- selection = gtk_tree_view_get_selection (treeview);
- if (gtk_tree_selection_get_selected(selection, &store, &iter))
- {
- nextIter = iter;
- if (!gtk_tree_model_iter_next(store, &nextIter))
- {
- nextIter = iter;
- if (gtk_tree_model_get_iter_first(store, &nextIter))
- {
- gtk_tree_selection_select_iter (selection, &nextIter);
- }
- }
- else
- {
- gtk_tree_selection_select_iter (selection, &nextIter);
- }
- // Get the row number
- treepath = gtk_tree_model_get_path (store, &iter);
- indices = gtk_tree_path_get_indices (treepath);
- row = indices[0];
- gtk_tree_path_free(treepath);
- // Remove the selected item
- gtk_list_store_remove (GTK_LIST_STORE(store), &iter);
- // remove from subtitle settings list
- if (row < 0) return;
- widget = GHB_WIDGET (ud->builder, "subtitle_add");
- gtk_widget_set_sensitive(widget, TRUE);
- widget = GHB_WIDGET (ud->builder, "srt_add");
- gtk_widget_set_sensitive(widget, TRUE);
- subtitle_list = ghb_settings_get_value(ud->settings, "subtitle_list");
- if (row >= ghb_array_len(subtitle_list))
- return;
- GValue *old = ghb_array_get_nth(subtitle_list, row);
- ghb_value_free(old);
- ghb_array_remove(subtitle_list, row);
- ghb_live_reset(ud);
- }
+ GtkTreeView *treeview;
+ GtkTreePath *treepath;
+ GtkTreeSelection *selection;
+ GtkTreeModel *store;
+ GtkTreeIter iter, nextIter;
+ gint *indices;
+ gint row;
+ GValue *subtitle_list;
+
+ g_debug("subtitle_remove_clicked_cb ()");
+ treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "subtitle_list"));
+ selection = gtk_tree_view_get_selection (treeview);
+ if (gtk_tree_selection_get_selected(selection, &store, &iter))
+ {
+ nextIter = iter;
+ if (!gtk_tree_model_iter_next(store, &nextIter))
+ {
+ nextIter = iter;
+ if (gtk_tree_model_get_iter_first(store, &nextIter))
+ {
+ gtk_tree_selection_select_iter (selection, &nextIter);
+ }
+ }
+ else
+ {
+ gtk_tree_selection_select_iter (selection, &nextIter);
+ }
+ // Get the row number
+ treepath = gtk_tree_model_get_path (store, &iter);
+ indices = gtk_tree_path_get_indices (treepath);
+ row = indices[0];
+ gtk_tree_path_free(treepath);
+ // Remove the selected item
+ gtk_list_store_remove (GTK_LIST_STORE(store), &iter);
+ // remove from subtitle settings list
+ if (row < 0) return;
+ widget = GHB_WIDGET (ud->builder, "subtitle_add");
+ gtk_widget_set_sensitive(widget, TRUE);
+ widget = GHB_WIDGET (ud->builder, "srt_add");
+ gtk_widget_set_sensitive(widget, TRUE);
+ subtitle_list = ghb_settings_get_value(ud->settings, "subtitle_list");
+ if (row >= ghb_array_len(subtitle_list))
+ return;
+ GValue *old = ghb_array_get_nth(subtitle_list, row);
+ ghb_value_free(old);
+ ghb_array_remove(subtitle_list, row);
+ ghb_live_reset(ud);
+ }
}
void
ghb_subtitle_prune(signal_user_data_t *ud)
{
- GtkTreeView *tv;
- GValue *subtitle_list;
- gint count, ii;
- gint first_track = 0, one_burned = 0;
-
- subtitle_list = ghb_settings_get_value(ud->settings, "subtitle_list");
- if (subtitle_list == NULL)
- return;
- count = ghb_array_len(subtitle_list);
-
- tv = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "subtitle_list"));
- g_return_if_fail(tv != NULL);
- for (ii = count-1; ii >= 0; ii--)
- {
- gboolean burned;
- GValue *settings;
-
- settings = ghb_array_get_nth(subtitle_list, ii);
- burned = ghb_settings_get_boolean(settings, "SubtitleBurned");
- if (burned)
- {
- first_track = ii;
- one_burned++;
- }
- }
- if (one_burned)
- {
- ghb_subtitle_exclusive_burn(ud, first_track);
- }
+ GtkTreeView *tv;
+ GValue *subtitle_list;
+ gint count, ii;
+ gint first_track = 0, one_burned = 0;
+
+ subtitle_list = ghb_settings_get_value(ud->settings, "subtitle_list");
+ if (subtitle_list == NULL)
+ return;
+ count = ghb_array_len(subtitle_list);
+
+ tv = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "subtitle_list"));
+ g_return_if_fail(tv != NULL);
+ for (ii = count-1; ii >= 0; ii--)
+ {
+ gboolean burned;
+ GValue *settings;
+
+ settings = ghb_array_get_nth(subtitle_list, ii);
+ burned = ghb_settings_get_boolean(settings, "SubtitleBurned");
+ if (burned)
+ {
+ first_track = ii;
+ one_burned++;
+ }
+ }
+ if (one_burned)
+ {
+ ghb_subtitle_exclusive_burn(ud, first_track);
+ }
}
void
ghb_reset_subtitles(signal_user_data_t *ud, GValue *settings)
{
- GValue *slist;
- GValue *subtitle;
- gint count, ii;
- gint titleindex;
-
- g_debug("ghb_reset_subtitles");
- ghb_clear_subtitle_list_settings(ud->settings);
- ghb_clear_subtitle_list(ud);
- titleindex = ghb_settings_combo_int(ud->settings, "title");
- if (titleindex < 0)
- return;
-
- slist = ghb_settings_get_value(settings, "subtitle_list");
- count = ghb_array_len(slist);
- for (ii = 0; ii < count; ii++)
- {
- int source;
-
- subtitle = ghb_value_dup(ghb_array_get_nth(slist, ii));
- source = ghb_settings_get_int(subtitle, "SubtitleSource");
- if (source == SRTSUB)
- ghb_add_srt(ud, subtitle);
- else
- {
- if (!ghb_add_subtitle_to_settings(ud->settings, subtitle))
- return;
- ghb_add_subtitle_to_ui(ud, subtitle);
- }
- }
+ GValue *slist;
+ GValue *subtitle;
+ gint count, ii;
+ gint titleindex;
+
+ g_debug("ghb_reset_subtitles");
+ ghb_clear_subtitle_list_settings(ud->settings);
+ ghb_clear_subtitle_list(ud);
+ titleindex = ghb_settings_combo_int(ud->settings, "title");
+ if (titleindex < 0)
+ return;
+
+ slist = ghb_settings_get_value(settings, "subtitle_list");
+ count = ghb_array_len(slist);
+ for (ii = 0; ii < count; ii++)
+ {
+ int source;
+
+ subtitle = ghb_value_dup(ghb_array_get_nth(slist, ii));
+ source = ghb_settings_get_int(subtitle, "SubtitleSource");
+ if (source == SRTSUB)
+ ghb_add_srt(ud, subtitle);
+ else
+ {
+ if (!ghb_add_subtitle_to_settings(ud->settings, subtitle))
+ return;
+ ghb_add_subtitle_to_ui(ud, subtitle);
+ }
+ }
}
diff --git a/gtk/src/subtitlehandler.h b/gtk/src/subtitlehandler.h
index 267b79bc2..146c12e36 100644
--- a/gtk/src/subtitlehandler.h
+++ b/gtk/src/subtitlehandler.h
@@ -17,9 +17,9 @@
*
* You should have received a copy of the GNU General Public License
* along with callbacks.h. If not, write to:
- * The Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301, USA.
+ * The Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301, USA.
*/
#if !defined(_SUBTITLEHANDLER_H_)
diff --git a/gtk/src/values.c b/gtk/src/values.c
index f755363e5..b128db049 100644
--- a/gtk/src/values.c
+++ b/gtk/src/values.c
@@ -24,769 +24,769 @@ static void dict_delete_value(gpointer data);
GValue*
ghb_value_new(GType gtype)
{
- GValue *gval = g_malloc0(sizeof(GValue));
- g_value_init(gval, gtype);
- return gval;
+ GValue *gval = g_malloc0(sizeof(GValue));
+ g_value_init(gval, gtype);
+ return gval;
}
void
ghb_value_free(GValue *gval)
{
- if (gval == NULL) return;
- g_value_unset(gval);
- g_free(gval);
+ if (gval == NULL) return;
+ g_value_unset(gval);
+ g_free(gval);
}
GValue*
ghb_value_dup(const GValue *val)
{
- if (val == NULL) return NULL;
- GValue *copy = ghb_value_new(G_VALUE_TYPE(val));
- g_value_copy(val, copy);
- return copy;
+ if (val == NULL) return NULL;
+ GValue *copy = ghb_value_new(G_VALUE_TYPE(val));
+ g_value_copy(val, copy);
+ return copy;
}
void
debug_show_type(GType tp)
{
- const gchar *str = "unknown";
- if (tp == G_TYPE_STRING)
- {
- str ="string";
- }
- else if (tp == G_TYPE_INT)
- {
- str ="int";
- }
- else if (tp == G_TYPE_INT64)
- {
- str ="int64";
- }
- else if (tp == G_TYPE_DOUBLE)
- {
- str ="double";
- }
- else if (tp == G_TYPE_BOOLEAN)
- {
- str ="bool";
- }
- else if (tp == ghb_array_get_type())
- {
- str ="array";
- }
- else if (tp == ghb_dict_get_type())
- {
- str ="dict";
- }
- g_debug("Type %s", str);
+ const gchar *str = "unknown";
+ if (tp == G_TYPE_STRING)
+ {
+ str ="string";
+ }
+ else if (tp == G_TYPE_INT)
+ {
+ str ="int";
+ }
+ else if (tp == G_TYPE_INT64)
+ {
+ str ="int64";
+ }
+ else if (tp == G_TYPE_DOUBLE)
+ {
+ str ="double";
+ }
+ else if (tp == G_TYPE_BOOLEAN)
+ {
+ str ="bool";
+ }
+ else if (tp == ghb_array_get_type())
+ {
+ str ="array";
+ }
+ else if (tp == ghb_dict_get_type())
+ {
+ str ="dict";
+ }
+ g_debug("Type %s", str);
}
void
debug_show_value(GValue *gval)
{
- GType tp;
-
- tp = G_VALUE_TYPE(gval);
- if (tp == G_TYPE_STRING)
- {
- g_message("Type %s value %s", "string", g_value_get_string(gval));
- }
- else if (tp == G_TYPE_INT)
- {
- g_message("Type %s value %d", "int", g_value_get_int(gval));
- }
- else if (tp == G_TYPE_INT64)
- {
- g_message("Type %s value %" PRId64, "int64", g_value_get_int64(gval));
- }
- else if (tp == G_TYPE_DOUBLE)
- {
- g_message("Type %s value %f", "double", g_value_get_double(gval));
- }
- else if (tp == G_TYPE_BOOLEAN)
- {
- g_message("Type %s value %d", "boolean", g_value_get_boolean(gval));
- }
- else if (tp == ghb_array_get_type())
- {
- g_message("Type %s", "boolean");
- }
- else if (tp == ghb_dict_get_type())
- {
- g_message("Type %s", "dict");
- }
+ GType tp;
+
+ tp = G_VALUE_TYPE(gval);
+ if (tp == G_TYPE_STRING)
+ {
+ g_message("Type %s value %s", "string", g_value_get_string(gval));
+ }
+ else if (tp == G_TYPE_INT)
+ {
+ g_message("Type %s value %d", "int", g_value_get_int(gval));
+ }
+ else if (tp == G_TYPE_INT64)
+ {
+ g_message("Type %s value %" PRId64, "int64", g_value_get_int64(gval));
+ }
+ else if (tp == G_TYPE_DOUBLE)
+ {
+ g_message("Type %s value %f", "double", g_value_get_double(gval));
+ }
+ else if (tp == G_TYPE_BOOLEAN)
+ {
+ g_message("Type %s value %d", "boolean", g_value_get_boolean(gval));
+ }
+ else if (tp == ghb_array_get_type())
+ {
+ g_message("Type %s", "boolean");
+ }
+ else if (tp == ghb_dict_get_type())
+ {
+ g_message("Type %s", "dict");
+ }
}
gint
ghb_value_int(const GValue *val)
{
- gint result;
-
- if (val == NULL) return 0;
- GValue xform = {0,};
- if (G_VALUE_TYPE(val) != G_TYPE_INT)
- {
- g_value_init(&xform, G_TYPE_INT);
- if (!g_value_transform(val, &xform))
- {
- debug_show_type(G_VALUE_TYPE(val));
- g_warning("int can't transform");
- return 0;
- }
- result = g_value_get_int(&xform);
- g_value_unset(&xform);
- }
- else
- {
- result = g_value_get_int(val);
- }
- return result;
+ gint result;
+
+ if (val == NULL) return 0;
+ GValue xform = {0,};
+ if (G_VALUE_TYPE(val) != G_TYPE_INT)
+ {
+ g_value_init(&xform, G_TYPE_INT);
+ if (!g_value_transform(val, &xform))
+ {
+ debug_show_type(G_VALUE_TYPE(val));
+ g_warning("int can't transform");
+ return 0;
+ }
+ result = g_value_get_int(&xform);
+ g_value_unset(&xform);
+ }
+ else
+ {
+ result = g_value_get_int(val);
+ }
+ return result;
}
gint64
ghb_value_int64(const GValue *val)
{
- gint64 result;
-
- if (val == NULL) return 0;
- GValue xform = {0,};
- if (G_VALUE_TYPE(val) != G_TYPE_INT64)
- {
- g_value_init(&xform, G_TYPE_INT64);
- if (!g_value_transform(val, &xform))
- {
- debug_show_type(G_VALUE_TYPE(val));
- g_warning("int64 can't transform");
- return 0;
- }
- result = g_value_get_int64(&xform);
- g_value_unset(&xform);
- }
- else
- {
- result = g_value_get_int64(val);
- }
- return result;
+ gint64 result;
+
+ if (val == NULL) return 0;
+ GValue xform = {0,};
+ if (G_VALUE_TYPE(val) != G_TYPE_INT64)
+ {
+ g_value_init(&xform, G_TYPE_INT64);
+ if (!g_value_transform(val, &xform))
+ {
+ debug_show_type(G_VALUE_TYPE(val));
+ g_warning("int64 can't transform");
+ return 0;
+ }
+ result = g_value_get_int64(&xform);
+ g_value_unset(&xform);
+ }
+ else
+ {
+ result = g_value_get_int64(val);
+ }
+ return result;
}
gdouble
ghb_value_double(const GValue *val)
{
- gdouble result;
-
- if (val == NULL) return 0;
- GValue xform = {0,};
- if (G_VALUE_TYPE(val) != G_TYPE_DOUBLE)
- {
- g_value_init(&xform, G_TYPE_DOUBLE);
- if (!g_value_transform(val, &xform))
- {
- debug_show_type(G_VALUE_TYPE(val));
- g_warning("double can't transform");
- return 0;
- }
- result = g_value_get_double(&xform);
- g_value_unset(&xform);
- }
- else
- {
- result = g_value_get_double(val);
- }
- return result;
+ gdouble result;
+
+ if (val == NULL) return 0;
+ GValue xform = {0,};
+ if (G_VALUE_TYPE(val) != G_TYPE_DOUBLE)
+ {
+ g_value_init(&xform, G_TYPE_DOUBLE);
+ if (!g_value_transform(val, &xform))
+ {
+ debug_show_type(G_VALUE_TYPE(val));
+ g_warning("double can't transform");
+ return 0;
+ }
+ result = g_value_get_double(&xform);
+ g_value_unset(&xform);
+ }
+ else
+ {
+ result = g_value_get_double(val);
+ }
+ return result;
}
gchar*
ghb_value_string(const GValue *val)
{
- gchar *result;
-
- if (val == NULL) return 0;
- GValue xform = {0,};
- if (G_VALUE_TYPE(val) != G_TYPE_STRING)
- {
- g_value_init(&xform, G_TYPE_STRING);
- if (!g_value_transform(val, &xform))
- {
- debug_show_type(G_VALUE_TYPE(val));
- g_warning("string can't transform");
- return NULL;
- }
- result = g_strdup(g_value_get_string(&xform));
- g_value_unset(&xform);
- }
- else
- {
- result = g_strdup(g_value_get_string(val));
- }
- return result;
+ gchar *result;
+
+ if (val == NULL) return 0;
+ GValue xform = {0,};
+ if (G_VALUE_TYPE(val) != G_TYPE_STRING)
+ {
+ g_value_init(&xform, G_TYPE_STRING);
+ if (!g_value_transform(val, &xform))
+ {
+ debug_show_type(G_VALUE_TYPE(val));
+ g_warning("string can't transform");
+ return NULL;
+ }
+ result = g_strdup(g_value_get_string(&xform));
+ g_value_unset(&xform);
+ }
+ else
+ {
+ result = g_strdup(g_value_get_string(val));
+ }
+ return result;
}
gboolean
ghb_value_boolean(const GValue *val)
{
- gboolean result;
-
- if (val == NULL) return FALSE;
- GValue xform = {0,};
- if (G_VALUE_TYPE(val) != G_TYPE_BOOLEAN)
- {
- g_value_init(&xform, G_TYPE_BOOLEAN);
- if (!g_value_transform(val, &xform))
- {
- debug_show_type(G_VALUE_TYPE(val));
- g_warning("boolean can't transform");
- return FALSE;
- }
- result = g_value_get_boolean(&xform);
- g_value_unset(&xform);
- }
- else
- {
- result = g_value_get_boolean(val);
- }
- return result;
+ gboolean result;
+
+ if (val == NULL) return FALSE;
+ GValue xform = {0,};
+ if (G_VALUE_TYPE(val) != G_TYPE_BOOLEAN)
+ {
+ g_value_init(&xform, G_TYPE_BOOLEAN);
+ if (!g_value_transform(val, &xform))
+ {
+ debug_show_type(G_VALUE_TYPE(val));
+ g_warning("boolean can't transform");
+ return FALSE;
+ }
+ result = g_value_get_boolean(&xform);
+ g_value_unset(&xform);
+ }
+ else
+ {
+ result = g_value_get_boolean(val);
+ }
+ return result;
}
gint
ghb_value_cmp(const GValue *vala, const GValue *valb)
{
- GType typa;
- GType typb;
-
- if ((vala == NULL && valb != NULL) || (vala != NULL && valb == NULL))
- {
- return 1;
- }
- typa = G_VALUE_TYPE(vala);
- typb = G_VALUE_TYPE(valb);
- if (typa != typb)
- {
- return 1;
- }
-
- if (typa == G_TYPE_STRING)
- {
- char *stra, *strb;
- gint res;
- stra = ghb_value_string(vala);
- strb = ghb_value_string(valb);
- if (stra == NULL && strb == NULL)
- return 0;
- if (stra == NULL)
- {
- g_free(strb);
- return -1;
- }
- if (strb == NULL)
- {
- g_free(stra);
- return 1;
- }
- res = strcmp(stra, strb);
- g_free(stra);
- g_free(strb);
- return res;
- }
- else if (typa == G_TYPE_INT64 || typa == G_TYPE_INT ||
- typa == G_TYPE_BOOLEAN)
- {
- return ghb_value_int64(vala) - ghb_value_int64(valb);
- }
- else if (typa == G_TYPE_DOUBLE || typa == G_TYPE_FLOAT)
- {
- return ghb_value_double(vala) - ghb_value_double(valb);
- }
- else if (typa == ghb_array_get_type())
- {
- // Cheating here. Just assume they are different.
- // Maybe later I'll recurse through these
- return 1;
- }
- else if (typa == ghb_dict_get_type())
- {
- // Cheating here. Just assume they are different.
- // Maybe later I'll recurse through these
- return 1;
- }
- else
- {
- g_warning("ghb_value_cmp: unrecognized type");
- return 1;
- }
- return 0;
+ GType typa;
+ GType typb;
+
+ if ((vala == NULL && valb != NULL) || (vala != NULL && valb == NULL))
+ {
+ return 1;
+ }
+ typa = G_VALUE_TYPE(vala);
+ typb = G_VALUE_TYPE(valb);
+ if (typa != typb)
+ {
+ return 1;
+ }
+
+ if (typa == G_TYPE_STRING)
+ {
+ char *stra, *strb;
+ gint res;
+ stra = ghb_value_string(vala);
+ strb = ghb_value_string(valb);
+ if (stra == NULL && strb == NULL)
+ return 0;
+ if (stra == NULL)
+ {
+ g_free(strb);
+ return -1;
+ }
+ if (strb == NULL)
+ {
+ g_free(stra);
+ return 1;
+ }
+ res = strcmp(stra, strb);
+ g_free(stra);
+ g_free(strb);
+ return res;
+ }
+ else if (typa == G_TYPE_INT64 || typa == G_TYPE_INT ||
+ typa == G_TYPE_BOOLEAN)
+ {
+ return ghb_value_int64(vala) - ghb_value_int64(valb);
+ }
+ else if (typa == G_TYPE_DOUBLE || typa == G_TYPE_FLOAT)
+ {
+ return ghb_value_double(vala) - ghb_value_double(valb);
+ }
+ else if (typa == ghb_array_get_type())
+ {
+ // Cheating here. Just assume they are different.
+ // Maybe later I'll recurse through these
+ return 1;
+ }
+ else if (typa == ghb_dict_get_type())
+ {
+ // Cheating here. Just assume they are different.
+ // Maybe later I'll recurse through these
+ return 1;
+ }
+ else
+ {
+ g_warning("ghb_value_cmp: unrecognized type");
+ return 1;
+ }
+ return 0;
}
GValue*
ghb_string_value(const gchar *str)
{
- static GValue gval = {0,};
- if (!G_IS_VALUE(&gval))
- g_value_init(&gval, G_TYPE_STRING);
- if (str == NULL)
- {
- g_value_set_string(&gval, "");
- }
- else
- {
- g_value_set_string(&gval, str);
- }
- return &gval;
+ static GValue gval = {0,};
+ if (!G_IS_VALUE(&gval))
+ g_value_init(&gval, G_TYPE_STRING);
+ if (str == NULL)
+ {
+ g_value_set_string(&gval, "");
+ }
+ else
+ {
+ g_value_set_string(&gval, str);
+ }
+ return &gval;
}
GValue*
ghb_int64_value(gint64 ival)
{
- static GValue gval = {0,};
- if (!G_IS_VALUE(&gval))
- g_value_init(&gval, G_TYPE_INT64);
- g_value_set_int64(&gval, ival);
- return &gval;
+ static GValue gval = {0,};
+ if (!G_IS_VALUE(&gval))
+ g_value_init(&gval, G_TYPE_INT64);
+ g_value_set_int64(&gval, ival);
+ return &gval;
}
GValue*
ghb_int_value(gint ival)
{
- static GValue gval = {0,};
- if (!G_IS_VALUE(&gval))
- g_value_init(&gval, G_TYPE_INT64);
- g_value_set_int64(&gval, (gint64)ival);
- return &gval;
+ static GValue gval = {0,};
+ if (!G_IS_VALUE(&gval))
+ g_value_init(&gval, G_TYPE_INT64);
+ g_value_set_int64(&gval, (gint64)ival);
+ return &gval;
}
GValue*
ghb_double_value(gdouble dval)
{
- static GValue gval = {0,};
- if (!G_IS_VALUE(&gval))
- g_value_init(&gval, G_TYPE_DOUBLE);
- g_value_set_double(&gval, dval);
- return &gval;
+ static GValue gval = {0,};
+ if (!G_IS_VALUE(&gval))
+ g_value_init(&gval, G_TYPE_DOUBLE);
+ g_value_set_double(&gval, dval);
+ return &gval;
}
GValue*
ghb_boolean_value(gboolean bval)
{
- static GValue gval = {0,};
- if (!G_IS_VALUE(&gval))
- g_value_init(&gval, G_TYPE_BOOLEAN);
- g_value_set_boolean(&gval, bval);
- return &gval;
+ static GValue gval = {0,};
+ if (!G_IS_VALUE(&gval))
+ g_value_init(&gval, G_TYPE_BOOLEAN);
+ g_value_set_boolean(&gval, bval);
+ return &gval;
}
GValue*
ghb_string_value_new(const gchar *str)
{
- if (str == NULL) str = "";
- GValue *gval = ghb_value_new(G_TYPE_STRING);
- g_value_set_string(gval, str);
- return gval;
+ if (str == NULL) str = "";
+ GValue *gval = ghb_value_new(G_TYPE_STRING);
+ g_value_set_string(gval, str);
+ return gval;
}
GValue*
ghb_int64_value_new(gint64 ival)
{
- GValue *gval = ghb_value_new(G_TYPE_INT64);
- g_value_set_int64(gval, ival);
- return gval;
+ GValue *gval = ghb_value_new(G_TYPE_INT64);
+ g_value_set_int64(gval, ival);
+ return gval;
}
GValue*
ghb_int_value_new(gint ival)
{
- GValue *gval = ghb_value_new(G_TYPE_INT64);
- g_value_set_int64(gval, ival);
- return gval;
+ GValue *gval = ghb_value_new(G_TYPE_INT64);
+ g_value_set_int64(gval, ival);
+ return gval;
}
GValue*
ghb_double_value_new(gdouble dval)
{
- GValue *gval = ghb_value_new(G_TYPE_DOUBLE);
- g_value_set_double(gval, dval);
- return gval;
+ GValue *gval = ghb_value_new(G_TYPE_DOUBLE);
+ g_value_set_double(gval, dval);
+ return gval;
}
GValue*
ghb_boolean_value_new(gboolean bval)
{
- GValue *gval = ghb_value_new(G_TYPE_BOOLEAN);
- g_value_set_boolean(gval, bval);
- return gval;
+ GValue *gval = ghb_value_new(G_TYPE_BOOLEAN);
+ g_value_set_boolean(gval, bval);
+ return gval;
}
GValue*
ghb_dict_value_new()
{
- GHashTable *dict;
- GValue *gval = ghb_value_new(ghb_dict_get_type());
- dict = g_hash_table_new_full(g_str_hash, g_str_equal,
- dict_delete_key, dict_delete_value);
- g_value_take_boxed(gval, dict);
- return gval;
+ GHashTable *dict;
+ GValue *gval = ghb_value_new(ghb_dict_get_type());
+ dict = g_hash_table_new_full(g_str_hash, g_str_equal,
+ dict_delete_key, dict_delete_value);
+ g_value_take_boxed(gval, dict);
+ return gval;
}
GValue*
ghb_array_value_new(guint size)
{
- GValue *gval = ghb_value_new(ghb_array_get_type());
- GArray *array;
+ GValue *gval = ghb_value_new(ghb_array_get_type());
+ GArray *array;
- array = g_array_sized_new(FALSE, FALSE, sizeof(GValue*), size);
- g_value_take_boxed(gval, array);
- return gval;
+ array = g_array_sized_new(FALSE, FALSE, sizeof(GValue*), size);
+ g_value_take_boxed(gval, array);
+ return gval;
}
void
ghb_array_value_reset(GValue *gval, guint size)
{
- GArray *array;
- g_value_reset(gval);
- array = g_array_sized_new(FALSE, FALSE, sizeof(GValue*), size);
- g_value_take_boxed(gval, array);
+ GArray *array;
+ g_value_reset(gval);
+ array = g_array_sized_new(FALSE, FALSE, sizeof(GValue*), size);
+ g_value_take_boxed(gval, array);
}
GValue*
ghb_date_value_new(GDate *date)
{
- GValue *gval = ghb_value_new(g_date_get_type());
- g_value_set_boxed(gval, date);
- return gval;
+ GValue *gval = ghb_value_new(g_date_get_type());
+ g_value_set_boxed(gval, date);
+ return gval;
}
GValue*
ghb_rawdata_value_new(ghb_rawdata_t *data)
{
- GValue *gval = ghb_value_new(ghb_rawdata_get_type());
- g_value_take_boxed(gval, data);
- return gval;
+ GValue *gval = ghb_value_new(ghb_rawdata_get_type());
+ g_value_take_boxed(gval, data);
+ return gval;
}
static gpointer
rawdata_copy(gpointer boxed)
{
- const ghb_rawdata_t *data = (const ghb_rawdata_t*)boxed;
- ghb_rawdata_t *copy = g_malloc(sizeof(ghb_rawdata_t));
- copy->size = data->size;
- if (data->data)
- {
- copy->data = g_malloc(data->size);
- memcpy(copy->data, data->data, data->size);
- }
- else
- {
- copy->data = NULL;
- copy->size = 0;
- }
- return copy;
+ const ghb_rawdata_t *data = (const ghb_rawdata_t*)boxed;
+ ghb_rawdata_t *copy = g_malloc(sizeof(ghb_rawdata_t));
+ copy->size = data->size;
+ if (data->data)
+ {
+ copy->data = g_malloc(data->size);
+ memcpy(copy->data, data->data, data->size);
+ }
+ else
+ {
+ copy->data = NULL;
+ copy->size = 0;
+ }
+ return copy;
}
static void
rawdata_free(gpointer boxed)
{
- ghb_rawdata_t *data = (ghb_rawdata_t*)boxed;
- if (data->data) g_free(data->data);
- g_free(data);
+ ghb_rawdata_t *data = (ghb_rawdata_t*)boxed;
+ if (data->data) g_free(data->data);
+ g_free(data);
}
GType
ghb_rawdata_get_type(void)
{
- static GType type_id = 0;
- if (!type_id)
- type_id = g_boxed_type_register_static(g_intern_static_string("GHBData"),
- (GBoxedCopyFunc) rawdata_copy,
- (GBoxedFreeFunc) rawdata_free);
- return type_id;
+ static GType type_id = 0;
+ if (!type_id)
+ type_id = g_boxed_type_register_static(g_intern_static_string("GHBData"),
+ (GBoxedCopyFunc) rawdata_copy,
+ (GBoxedFreeFunc) rawdata_free);
+ return type_id;
}
static void
dict_delete_key(gpointer data)
{
- if (data == NULL)
- {
- g_warning("dict frees null key");
- return;
- }
- g_free(data);
+ if (data == NULL)
+ {
+ g_warning("dict frees null key");
+ return;
+ }
+ g_free(data);
}
static void
dict_delete_value(gpointer data)
{
- GValue *gval = (GValue*)data;
- if (gval == NULL)
- {
- g_warning("dict frees null value");
- return;
- }
- ghb_value_free(gval);
+ GValue *gval = (GValue*)data;
+ if (gval == NULL)
+ {
+ g_warning("dict frees null value");
+ return;
+ }
+ ghb_value_free(gval);
}
static gpointer
dict_copy(gpointer boxed)
{
- GHashTable *dict = (GHashTable*)boxed;
- GHashTable *copy;
- GHashTableIter iter;
- gchar *key;
- GValue *gval;
+ GHashTable *dict = (GHashTable*)boxed;
+ GHashTable *copy;
+ GHashTableIter iter;
+ gchar *key;
+ GValue *gval;
- copy = g_hash_table_new_full(g_str_hash, g_str_equal,
- dict_delete_key, dict_delete_value);
+ copy = g_hash_table_new_full(g_str_hash, g_str_equal,
+ dict_delete_key, dict_delete_value);
- g_hash_table_iter_init(&iter, dict);
- // middle (void*) cast prevents gcc warning "defreferencing type-punned
- // pointer will break strict-aliasing rules"
- while (g_hash_table_iter_next(
- &iter, (gpointer*)(void*)&key, (gpointer*)(void*)&gval))
- {
- g_hash_table_insert(copy, g_strdup(key), ghb_value_dup(gval));
- }
- return copy;
+ g_hash_table_iter_init(&iter, dict);
+ // middle (void*) cast prevents gcc warning "defreferencing type-punned
+ // pointer will break strict-aliasing rules"
+ while (g_hash_table_iter_next(
+ &iter, (gpointer*)(void*)&key, (gpointer*)(void*)&gval))
+ {
+ g_hash_table_insert(copy, g_strdup(key), ghb_value_dup(gval));
+ }
+ return copy;
}
static void
dict_free(gpointer boxed)
{
- GHashTable *dict = (GHashTable*)boxed;
- g_hash_table_destroy(dict);
+ GHashTable *dict = (GHashTable*)boxed;
+ g_hash_table_destroy(dict);
}
GType
ghb_dict_get_type(void)
{
- static GType type_id = 0;
- if (!type_id)
- type_id = g_boxed_type_register_static(
- g_intern_static_string("GHBDict"),
- (GBoxedCopyFunc) dict_copy,
- (GBoxedFreeFunc) dict_free);
- return type_id;
+ static GType type_id = 0;
+ if (!type_id)
+ type_id = g_boxed_type_register_static(
+ g_intern_static_string("GHBDict"),
+ (GBoxedCopyFunc) dict_copy,
+ (GBoxedFreeFunc) dict_free);
+ return type_id;
}
void
ghb_dict_insert(GValue *gval, gchar *key, GValue *val)
{
- GHashTable *dict = g_value_get_boxed(gval);
- g_hash_table_insert(dict, key, val);
+ GHashTable *dict = g_value_get_boxed(gval);
+ g_hash_table_insert(dict, key, val);
}
void
ghb_dict_iter_init(GHashTableIter *iter, GValue *gval)
{
- GHashTable *dict = g_value_get_boxed(gval);
- g_hash_table_iter_init(iter, dict);
+ GHashTable *dict = g_value_get_boxed(gval);
+ g_hash_table_iter_init(iter, dict);
}
GValue*
ghb_dict_lookup(const GValue *gval, const gchar *key)
{
- GHashTable *dict = g_value_get_boxed(gval);
- return g_hash_table_lookup(dict, key);
+ GHashTable *dict = g_value_get_boxed(gval);
+ return g_hash_table_lookup(dict, key);
}
gboolean
ghb_dict_remove(GValue *gval, const gchar *key)
{
- GHashTable *dict = g_value_get_boxed(gval);
- return g_hash_table_remove(dict, key);
+ GHashTable *dict = g_value_get_boxed(gval);
+ return g_hash_table_remove(dict, key);
}
static gpointer
array_copy(gpointer boxed)
{
- const GArray *array = (const GArray*)boxed;
- GArray *copy = g_array_new(FALSE, FALSE, sizeof(GValue*));
+ const GArray *array = (const GArray*)boxed;
+ GArray *copy = g_array_new(FALSE, FALSE, sizeof(GValue*));
- GValue *gval, *gval_copy;
- gint ii;
+ GValue *gval, *gval_copy;
+ gint ii;
- for (ii = 0; ii < array->len; ii++)
- {
- gval = g_array_index(array, GValue*, ii);
- if (gval)
- {
- gval_copy = ghb_value_dup(gval);
- g_array_append_val(copy, gval_copy);
- }
- }
- return copy;
+ for (ii = 0; ii < array->len; ii++)
+ {
+ gval = g_array_index(array, GValue*, ii);
+ if (gval)
+ {
+ gval_copy = ghb_value_dup(gval);
+ g_array_append_val(copy, gval_copy);
+ }
+ }
+ return copy;
}
static void
array_free(gpointer boxed)
{
- GArray *array = (GArray*)boxed;
- GValue *gval;
- gint ii;
+ GArray *array = (GArray*)boxed;
+ GValue *gval;
+ gint ii;
- for (ii = 0; ii < array->len; ii++)
- {
- gval = g_array_index(array, GValue*, ii);
- if (gval)
- {
- ghb_value_free(gval);
- }
- }
- g_array_free(array, TRUE);
+ for (ii = 0; ii < array->len; ii++)
+ {
+ gval = g_array_index(array, GValue*, ii);
+ if (gval)
+ {
+ ghb_value_free(gval);
+ }
+ }
+ g_array_free(array, TRUE);
}
GType
ghb_array_get_type(void)
{
- static GType type_id = 0;
- if (!type_id)
- type_id = g_boxed_type_register_static(
- g_intern_static_string("GHBArray"),
- (GBoxedCopyFunc) array_copy,
- (GBoxedFreeFunc) array_free);
- return type_id;
+ static GType type_id = 0;
+ if (!type_id)
+ type_id = g_boxed_type_register_static(
+ g_intern_static_string("GHBArray"),
+ (GBoxedCopyFunc) array_copy,
+ (GBoxedFreeFunc) array_free);
+ return type_id;
}
GValue*
ghb_array_get_nth(const GValue *gval, gint ii)
{
- GArray *arr = g_value_get_boxed(gval);
- return g_array_index(arr, GValue*, ii);
+ GArray *arr = g_value_get_boxed(gval);
+ return g_array_index(arr, GValue*, ii);
}
void
ghb_array_insert(GValue *gval, guint ii, GValue *val)
{
- GArray *arr = g_value_get_boxed(gval);
- // A little nastyness here. The array pointer
- // can change when the array changes size. So
- // I must re-box it in the GValue each time.
- arr = g_array_insert_val(arr, ii, val);
- memset(gval, 0, sizeof(GValue));
- g_value_init(gval, ghb_array_get_type());
- g_value_take_boxed(gval, arr);
+ GArray *arr = g_value_get_boxed(gval);
+ // A little nastyness here. The array pointer
+ // can change when the array changes size. So
+ // I must re-box it in the GValue each time.
+ arr = g_array_insert_val(arr, ii, val);
+ memset(gval, 0, sizeof(GValue));
+ g_value_init(gval, ghb_array_get_type());
+ g_value_take_boxed(gval, arr);
}
void
ghb_array_append(GValue *gval, GValue *val)
{
- GArray *arr = g_value_get_boxed(gval);
- // A little nastyness here. The array pointer
- // can change when the array changes size. So
- // I must re-box it in the GValue each time.
- arr = g_array_append_val(arr, val);
- memset(gval, 0, sizeof(GValue));
- g_value_init(gval, ghb_array_get_type());
- g_value_take_boxed(gval, arr);
+ GArray *arr = g_value_get_boxed(gval);
+ // A little nastyness here. The array pointer
+ // can change when the array changes size. So
+ // I must re-box it in the GValue each time.
+ arr = g_array_append_val(arr, val);
+ memset(gval, 0, sizeof(GValue));
+ g_value_init(gval, ghb_array_get_type());
+ g_value_take_boxed(gval, arr);
}
void
ghb_array_remove(GValue *gval, guint ii)
{
- GArray *arr = g_value_get_boxed(gval);
- // A little nastyness here. The array pointer
- // can change when the array changes size. So
- // I must re-box it in the GValue each time.
- arr = g_array_remove_index(arr, ii);
- memset(gval, 0, sizeof(GValue));
- g_value_init(gval, ghb_array_get_type());
- g_value_take_boxed(gval, arr);
+ GArray *arr = g_value_get_boxed(gval);
+ // A little nastyness here. The array pointer
+ // can change when the array changes size. So
+ // I must re-box it in the GValue each time.
+ arr = g_array_remove_index(arr, ii);
+ memset(gval, 0, sizeof(GValue));
+ g_value_init(gval, ghb_array_get_type());
+ g_value_take_boxed(gval, arr);
}
void
ghb_array_replace(GValue *gval, guint ii, GValue *val)
{
- GArray *arr = g_value_get_boxed(gval);
- // A little nastyness here. The array pointer
- // can change when the array changes size. So
- // I must re-box it in the GValue each time.
- if (ii >= arr->len) return;
- ghb_value_free(((GValue**)arr->data)[ii]);
- ((GValue**)arr->data)[ii] = val;
+ GArray *arr = g_value_get_boxed(gval);
+ // A little nastyness here. The array pointer
+ // can change when the array changes size. So
+ // I must re-box it in the GValue each time.
+ if (ii >= arr->len) return;
+ ghb_value_free(((GValue**)arr->data)[ii]);
+ ((GValue**)arr->data)[ii] = val;
}
void
ghb_array_copy(GValue *arr1, GValue *arr2, gint count)
{
- gint len, ii;
+ gint len, ii;
- // empty the first array if it is not already empty
- len = ghb_array_len(arr1);
- for (ii = 0; ii < len; ii++)
- ghb_array_remove(arr1, 0);
+ // empty the first array if it is not already empty
+ len = ghb_array_len(arr1);
+ for (ii = 0; ii < len; ii++)
+ ghb_array_remove(arr1, 0);
- len = ghb_array_len(arr2);
- count = MIN(count, len);
- for (ii = 0; ii < count; ii++)
- ghb_array_append(arr1, ghb_value_dup(ghb_array_get_nth(arr2, ii)));
+ len = ghb_array_len(arr2);
+ count = MIN(count, len);
+ for (ii = 0; ii < count; ii++)
+ ghb_array_append(arr1, ghb_value_dup(ghb_array_get_nth(arr2, ii)));
}
gint
ghb_array_len(const GValue *gval)
{
- if (gval == NULL) return 0;
- GArray *arr = g_value_get_boxed(gval);
- return arr->len;
+ if (gval == NULL) return 0;
+ GArray *arr = g_value_get_boxed(gval);
+ return arr->len;
}
static void
xform_string_int(const GValue *sval, GValue *ival)
{
- gchar *end;
+ gchar *end;
- const gchar *str = g_value_get_string(sval);
- gint val = g_strtod(str, &end);
- if (*end)
- val = (guint)(~0)>>1;
- g_value_set_int(ival, val);
+ const gchar *str = g_value_get_string(sval);
+ gint val = g_strtod(str, &end);
+ if (*end)
+ val = (guint)(~0)>>1;
+ g_value_set_int(ival, val);
}
static void
xform_string_int64(const GValue *sval, GValue *ival)
{
- gchar *end;
- const gchar *str = g_value_get_string(sval);
- gint64 val = g_strtod(str, &end);
- if (*end)
- val = (guint64)(~0L)>>1;
- g_value_set_int64(ival, val);
+ gchar *end;
+ const gchar *str = g_value_get_string(sval);
+ gint64 val = g_strtod(str, &end);
+ if (*end)
+ val = (guint64)(~0L)>>1;
+ g_value_set_int64(ival, val);
}
static void
xform_string_double(const GValue *sval, GValue *dval)
{
- const gchar *str = g_value_get_string(sval);
- double val = g_strtod(str, NULL);
- g_value_set_double(dval, val);
+ const gchar *str = g_value_get_string(sval);
+ double val = g_strtod(str, NULL);
+ g_value_set_double(dval, val);
}
static void
xform_double_string(const GValue *dval, GValue *sval)
{
- gchar *str;
- double val = g_value_get_double(dval);
- str = g_strdup_printf("%g", val);
- g_value_take_string(sval, str);
+ gchar *str;
+ double val = g_value_get_double(dval);
+ str = g_strdup_printf("%g", val);
+ g_value_take_string(sval, str);
}
static void
xform_boolean_double(const GValue *bval, GValue *dval)
{
- gboolean b = g_value_get_boolean(bval);
- double val = b;
- g_value_set_double(dval, val);
+ gboolean b = g_value_get_boolean(bval);
+ double val = b;
+ g_value_set_double(dval, val);
}
void
ghb_register_transforms()
{
- g_value_register_transform_func(G_TYPE_STRING, G_TYPE_INT64,
- xform_string_int64);
- g_value_register_transform_func(G_TYPE_STRING, G_TYPE_INT,
- xform_string_int);
- g_value_register_transform_func(G_TYPE_STRING, G_TYPE_DOUBLE,
- xform_string_double);
- g_value_register_transform_func(G_TYPE_BOOLEAN, G_TYPE_DOUBLE,
- xform_boolean_double);
- g_value_register_transform_func(G_TYPE_DOUBLE, G_TYPE_STRING,
- xform_double_string);
+ g_value_register_transform_func(G_TYPE_STRING, G_TYPE_INT64,
+ xform_string_int64);
+ g_value_register_transform_func(G_TYPE_STRING, G_TYPE_INT,
+ xform_string_int);
+ g_value_register_transform_func(G_TYPE_STRING, G_TYPE_DOUBLE,
+ xform_string_double);
+ g_value_register_transform_func(G_TYPE_BOOLEAN, G_TYPE_DOUBLE,
+ xform_boolean_double);
+ g_value_register_transform_func(G_TYPE_DOUBLE, G_TYPE_STRING,
+ xform_double_string);
}
diff --git a/gtk/src/values.h b/gtk/src/values.h
index d28727fcb..dde169036 100644
--- a/gtk/src/values.h
+++ b/gtk/src/values.h
@@ -21,8 +21,8 @@
typedef struct
{
- guchar *data;
- gsize size;
+ guchar *data;
+ gsize size;
} ghb_rawdata_t;
GType ghb_rawdata_get_type(void);
diff --git a/gtk/src/widgetdeps.c b/gtk/src/widgetdeps.c
index 8d6b03290..f2c7c82ae 100644
--- a/gtk/src/widgetdeps.c
+++ b/gtk/src/widgetdeps.c
@@ -7,136 +7,136 @@
typedef struct
{
- const gchar *widget_name;
- const gchar *dep_name;
- const gchar *enable_value;
- const gboolean disable_if_equal;
- const gboolean hide;
+ 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_bpyramid", "<2", TRUE, FALSE},
- {"x264_bframes", "x264_direct", "0", TRUE, FALSE},
- {"x264_bframes", "x264_b_adapt", "0", 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},
+ {"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_bpyramid", "<2", TRUE, FALSE},
+ {"x264_bframes", "x264_direct", "0", TRUE, FALSE},
+ {"x264_bframes", "x264_b_adapt", "0", 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);
+ gint ii, jj;
+ GValue *top;
+ gint count = sizeof(dep_map) / sizeof(dependency_t);
- g_type_init();
+ g_type_init();
- top = ghb_dict_value_new();
- for (ii = 0; ii < count; ii++)
- {
- const gchar *name;
- GValue *array;
+ 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);
+ 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;
+ // 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;
+ 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;
}
diff --git a/gtk/src/x264handler.c b/gtk/src/x264handler.c
index 248a9137e..1056d9820 100644
--- a/gtk/src/x264handler.c
+++ b/gtk/src/x264handler.c
@@ -216,81 +216,81 @@ x264_option_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
G_MODULE_EXPORT void
x264_widget_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
{
- ghb_widget_to_setting(ud->settings, widget);
- if (!ignore_options_update)
- {
- ignore_options_update = TRUE;
- x264_opt_update(ud, widget);
- ignore_options_update = FALSE;
- }
- ghb_check_dependency(ud, widget, NULL);
- ghb_clear_presets_selection(ud);
+ ghb_widget_to_setting(ud->settings, widget);
+ if (!ignore_options_update)
+ {
+ ignore_options_update = TRUE;
+ x264_opt_update(ud, widget);
+ ignore_options_update = FALSE;
+ }
+ ghb_check_dependency(ud, widget, NULL);
+ ghb_clear_presets_selection(ud);
}
G_MODULE_EXPORT void
x264_slider_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
{
- ghb_widget_to_setting(ud->settings, widget);
-
- // Lock slider values to multiples of step_increment
- GtkAdjustment * adj = gtk_range_get_adjustment(GTK_RANGE(widget));
- gdouble step = gtk_adjustment_get_step_increment(adj);
- gdouble val = gtk_range_get_value(GTK_RANGE(widget));
- gdouble new_val = ((int)((val + step / 2) / step)) * step;
- gdouble diff = val - new_val;
- if ( diff > 0.0001 || diff < -0.0001 )
- {
- gtk_range_set_value(GTK_RANGE(widget), new_val);
- }
- else if (!ignore_options_update)
- {
- ignore_options_update = TRUE;
- x264_opt_update(ud, widget);
- ignore_options_update = FALSE;
- }
- ghb_check_dependency(ud, widget, NULL);
- ghb_clear_presets_selection(ud);
+ ghb_widget_to_setting(ud->settings, widget);
+
+ // Lock slider values to multiples of step_increment
+ GtkAdjustment * adj = gtk_range_get_adjustment(GTK_RANGE(widget));
+ gdouble step = gtk_adjustment_get_step_increment(adj);
+ gdouble val = gtk_range_get_value(GTK_RANGE(widget));
+ gdouble new_val = ((int)((val + step / 2) / step)) * step;
+ gdouble diff = val - new_val;
+ if ( diff > 0.0001 || diff < -0.0001 )
+ {
+ gtk_range_set_value(GTK_RANGE(widget), new_val);
+ }
+ else if (!ignore_options_update)
+ {
+ ignore_options_update = TRUE;
+ x264_opt_update(ud, widget);
+ ignore_options_update = FALSE;
+ }
+ ghb_check_dependency(ud, widget, NULL);
+ ghb_clear_presets_selection(ud);
}
G_MODULE_EXPORT gchar*
x264_format_slider_cb(GtkScale *scale, gdouble val, signal_user_data_t *ud)
{
- return g_strdup_printf("%-6.6g", val);
+ return g_strdup_printf("%-6.6g", val);
}
G_MODULE_EXPORT void
x264_me_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
{
- gint me;
-
- ghb_widget_to_setting(ud->settings, widget);
- if (!ignore_options_update)
- {
- ignore_options_update = TRUE;
- x264_opt_update(ud, widget);
- ignore_options_update = FALSE;
- }
- ghb_check_dependency(ud, widget, NULL);
- ghb_clear_presets_selection(ud);
- widget = GHB_WIDGET(ud->builder, "x264_merange");
- me = ghb_settings_combo_int(ud->settings, "x264_me");
- if (me < 2)
- { // me < umh
- // me_range 4 - 16
- gtk_spin_button_set_range(GTK_SPIN_BUTTON(widget), 4, 16);
- }
- else
- {
- // me_range 4 - 64
- gtk_spin_button_set_range(GTK_SPIN_BUTTON(widget), 4, 64);
- }
+ gint me;
+
+ ghb_widget_to_setting(ud->settings, widget);
+ if (!ignore_options_update)
+ {
+ ignore_options_update = TRUE;
+ x264_opt_update(ud, widget);
+ ignore_options_update = FALSE;
+ }
+ ghb_check_dependency(ud, widget, NULL);
+ ghb_clear_presets_selection(ud);
+ widget = GHB_WIDGET(ud->builder, "x264_merange");
+ me = ghb_settings_combo_int(ud->settings, "x264_me");
+ if (me < 2)
+ { // me < umh
+ // me_range 4 - 16
+ gtk_spin_button_set_range(GTK_SPIN_BUTTON(widget), 4, 16);
+ }
+ else
+ {
+ // me_range 4 - 64
+ gtk_spin_button_set_range(GTK_SPIN_BUTTON(widget), 4, 64);
+ }
}
G_MODULE_EXPORT void
x264_entry_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
{
- g_debug("x264_entry_changed_cb ()");
+ g_debug("x264_entry_changed_cb ()");
static char *tt = NULL;
@@ -300,24 +300,24 @@ x264_entry_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
tt = gtk_widget_get_tooltip_text(eo);
}
- if (!ignore_options_update)
- {
- GtkWidget *textview;
- gchar *options;
+ if (!ignore_options_update)
+ {
+ GtkWidget *textview;
+ gchar *options;
- textview = GTK_WIDGET(GHB_WIDGET(ud->builder, "x264Option"));
- ghb_widget_to_setting(ud->settings, textview);
- options = ghb_settings_get_string(ud->settings, "x264Option");
+ textview = GTK_WIDGET(GHB_WIDGET(ud->builder, "x264Option"));
+ ghb_widget_to_setting(ud->settings, textview);
+ options = ghb_settings_get_string(ud->settings, "x264Option");
- ignore_options_update = TRUE;
- ghb_x264_parse_options(ud, options);
- if (!gtk_widget_has_focus(textview))
- {
- gchar *sopts;
+ ignore_options_update = TRUE;
+ ghb_x264_parse_options(ud, options);
+ if (!gtk_widget_has_focus(textview))
+ {
+ gchar *sopts;
- sopts = sanitize_x264opts(ud, options);
- ghb_ui_update(ud, "x264Option", ghb_string_value(sopts));
- ghb_x264_parse_options(ud, sopts);
+ sopts = sanitize_x264opts(ud, options);
+ ghb_ui_update(ud, "x264Option", ghb_string_value(sopts));
+ ghb_x264_parse_options(ud, sopts);
GtkWidget *eo = GTK_WIDGET(GHB_WIDGET(ud->builder, "x264OptionExtra"));
char * new_tt;
@@ -329,7 +329,7 @@ x264_entry_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
g_free(options);
options = sopts;
- }
+ }
#if 0
if (ghb_settings_get_boolean(ud->settings, "x264UseAdvancedOptions"))
{
@@ -341,109 +341,109 @@ x264_entry_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
ghb_ui_update(ud, "x264OptionExtra", ghb_string_value(options));
}
#endif
- g_free(options);
- ignore_options_update = FALSE;
- }
+ g_free(options);
+ ignore_options_update = FALSE;
+ }
}
G_MODULE_EXPORT gboolean
x264_focus_out_cb(GtkWidget *widget, GdkEventFocus *event,
- signal_user_data_t *ud)
+ signal_user_data_t *ud)
{
- gchar *options, *sopts;
-
- ghb_widget_to_setting(ud->settings, widget);
- options = ghb_settings_get_string(ud->settings, "x264Option");
- sopts = sanitize_x264opts(ud, options);
- ignore_options_update = TRUE;
- if (sopts != NULL && strcmp(sopts, options) != 0)
- {
- ghb_ui_update(ud, "x264Option", ghb_string_value(sopts));
- ghb_x264_parse_options(ud, sopts);
- }
- g_free(options);
- g_free(sopts);
- ignore_options_update = FALSE;
- return FALSE;
+ gchar *options, *sopts;
+
+ ghb_widget_to_setting(ud->settings, widget);
+ options = ghb_settings_get_string(ud->settings, "x264Option");
+ sopts = sanitize_x264opts(ud, options);
+ ignore_options_update = TRUE;
+ if (sopts != NULL && strcmp(sopts, options) != 0)
+ {
+ ghb_ui_update(ud, "x264Option", ghb_string_value(sopts));
+ ghb_x264_parse_options(ud, sopts);
+ }
+ g_free(options);
+ g_free(sopts);
+ ignore_options_update = FALSE;
+ return FALSE;
}
enum
{
- X264_OPT_NONE,
- X264_OPT_BOOL_NONE,
- X264_OPT_INT_NONE,
- X264_OPT_DEBLOCK,
- X264_OPT_PSY,
- X264_OPT_INT,
- X264_OPT_DOUBLE,
- X264_OPT_COMBO,
- X264_OPT_BOOL,
- X264_OPT_TRANS,
+ X264_OPT_NONE,
+ X264_OPT_BOOL_NONE,
+ X264_OPT_INT_NONE,
+ X264_OPT_DEBLOCK,
+ X264_OPT_PSY,
+ X264_OPT_INT,
+ X264_OPT_DOUBLE,
+ X264_OPT_COMBO,
+ X264_OPT_BOOL,
+ X264_OPT_TRANS,
};
typedef struct
{
- gchar *x264_val;
- char *ui_val;
+ gchar *x264_val;
+ char *ui_val;
} trans_entry_t;
typedef struct
{
- gint count;
- gint x264_type;
- gint ui_type;
- trans_entry_t *map;
+ gint count;
+ gint x264_type;
+ gint ui_type;
+ trans_entry_t *map;
} trans_table_t;
static gchar *
trans_x264_val(trans_table_t *trans, char *val)
{
- int ii;
-
- if (val == NULL)
- return NULL;
- for (ii = 0; ii < trans->count; ii++)
- {
- if (strcmp(val, trans->map[ii].x264_val) == 0)
- {
- return trans->map[ii].ui_val;
- }
- }
- return NULL;
+ int ii;
+
+ if (val == NULL)
+ return NULL;
+ for (ii = 0; ii < trans->count; ii++)
+ {
+ if (strcmp(val, trans->map[ii].x264_val) == 0)
+ {
+ return trans->map[ii].ui_val;
+ }
+ }
+ return NULL;
}
static gchar *
trans_ui_val(trans_table_t *trans, char *val)
{
- int ii;
-
- if (val == NULL)
- return NULL;
- for (ii = 0; ii < trans->count; ii++)
- {
- if (strcmp(val, trans->map[ii].ui_val) == 0)
- {
- return trans->map[ii].x264_val;
- }
- }
- return NULL;
+ int ii;
+
+ if (val == NULL)
+ return NULL;
+ for (ii = 0; ii < trans->count; ii++)
+ {
+ if (strcmp(val, trans->map[ii].ui_val) == 0)
+ {
+ return trans->map[ii].x264_val;
+ }
+ }
+ return NULL;
}
struct x264_opt_map_s
{
- gchar **opt_syns;
- gchar *name;
- gchar *def_val;
- gint type;
- trans_table_t *translation;
- gboolean found;
+ gchar **opt_syns;
+ gchar *name;
+ gchar *def_val;
+ gint type;
+ trans_table_t *translation;
+ gboolean found;
};
static gchar *x264_ref_syns[] = {"ref", "frameref", NULL};
static gchar *x264_bframes_syns[] = {"bframes", NULL};
static gchar *x264_badapt_syns[] = {"b-adapt", "b_adapt", NULL};
static gchar *x264_direct_syns[] =
- {"direct", "direct-pred", "direct_pred", NULL};
+ {"direct", "direct-pred", "direct_pred", NULL};
static gchar *x264_weightp_syns[] = {"weightp", NULL};
static gchar *x264_bpyramid_syns[] = {"b-pyramid", "b_pyramid", NULL};
static gchar *x264_me_syns[] = {"me", NULL};
@@ -459,734 +459,734 @@ static gchar *x264_psy_syns[] = {"psy-rd", "psy_rd", NULL};
static gchar *x264_aq_strength_syns[] = {"aq-strength", "aq_strength", NULL};
static gchar *x264_mbtree_syns[] = {"mbtree", NULL};
static gchar *x264_decimate_syns[] =
- {"no-dct-decimate", "no_dct_decimate", NULL};
+ {"no-dct-decimate", "no_dct_decimate", NULL};
static gchar *x264_cabac_syns[] = {"cabac", NULL};
static gint
find_syn_match(const gchar *opt, gchar **syns)
{
- gint ii;
- for (ii = 0; syns[ii] != NULL; ii++)
- {
- if (strcmp(opt, syns[ii]) == 0)
- return ii;
- }
- return -1;
+ gint ii;
+ for (ii = 0; syns[ii] != NULL; ii++)
+ {
+ if (strcmp(opt, syns[ii]) == 0)
+ return ii;
+ }
+ return -1;
}
struct x264_opt_map_s x264_opt_map[] =
{
- {x264_ref_syns, "x264_refs", "3", X264_OPT_INT},
- {x264_bframes_syns, "x264_bframes", "3", X264_OPT_INT},
- {x264_direct_syns, "x264_direct", "spatial", X264_OPT_COMBO},
- {x264_badapt_syns, "x264_b_adapt", "1", X264_OPT_COMBO},
- {x264_weightp_syns, "x264_weighted_pframes", "2", X264_OPT_COMBO},
- {x264_bpyramid_syns, "x264_bpyramid", "normal", X264_OPT_COMBO},
- {x264_me_syns, "x264_me", "hex", X264_OPT_COMBO},
- {x264_merange_syns, "x264_merange", "16", X264_OPT_INT},
- {x264_subme_syns, "x264_subme", "7", X264_OPT_COMBO},
- {x264_aqmode_syns, "x264_aqmode", "1", X264_OPT_INT_NONE},
- {x264_analyse_syns, "x264_analyse", "p8x8,b8x8,i8x8,i4x4", X264_OPT_COMBO},
- {x264_8x8dct_syns, "x264_8x8dct", "1", X264_OPT_BOOL},
- {x264_deblock_syns, "x264_deblock_alpha", "0,0", X264_OPT_DEBLOCK},
- {x264_deblock_syns, "x264_deblock_beta", "0,0", X264_OPT_DEBLOCK},
- {x264_trellis_syns, "x264_trellis", "1", X264_OPT_COMBO},
- {x264_pskip_syns, "x264_no_fast_pskip", "0", X264_OPT_BOOL},
- {x264_decimate_syns, "x264_no_dct_decimate", "0", X264_OPT_BOOL},
- {x264_cabac_syns, "x264_cabac", "1", X264_OPT_BOOL},
- {x264_aq_strength_syns, "x264_aq_strength", "1", X264_OPT_DOUBLE},
- {x264_psy_syns, "x264_psy_rd", "1|0", X264_OPT_PSY},
- {x264_psy_syns, "x264_psy_trell", "1|0", X264_OPT_PSY},
- {x264_mbtree_syns, "x264_mbtree", "1", X264_OPT_BOOL_NONE},
+ {x264_ref_syns, "x264_refs", "3", X264_OPT_INT},
+ {x264_bframes_syns, "x264_bframes", "3", X264_OPT_INT},
+ {x264_direct_syns, "x264_direct", "spatial", X264_OPT_COMBO},
+ {x264_badapt_syns, "x264_b_adapt", "1", X264_OPT_COMBO},
+ {x264_weightp_syns, "x264_weighted_pframes", "2", X264_OPT_COMBO},
+ {x264_bpyramid_syns, "x264_bpyramid", "normal", X264_OPT_COMBO},
+ {x264_me_syns, "x264_me", "hex", X264_OPT_COMBO},
+ {x264_merange_syns, "x264_merange", "16", X264_OPT_INT},
+ {x264_subme_syns, "x264_subme", "7", X264_OPT_COMBO},
+ {x264_aqmode_syns, "x264_aqmode", "1", X264_OPT_INT_NONE},
+ {x264_analyse_syns, "x264_analyse", "p8x8,b8x8,i8x8,i4x4", X264_OPT_COMBO},
+ {x264_8x8dct_syns, "x264_8x8dct", "1", X264_OPT_BOOL},
+ {x264_deblock_syns, "x264_deblock_alpha", "0,0", X264_OPT_DEBLOCK},
+ {x264_deblock_syns, "x264_deblock_beta", "0,0", X264_OPT_DEBLOCK},
+ {x264_trellis_syns, "x264_trellis", "1", X264_OPT_COMBO},
+ {x264_pskip_syns, "x264_no_fast_pskip", "0", X264_OPT_BOOL},
+ {x264_decimate_syns, "x264_no_dct_decimate", "0", X264_OPT_BOOL},
+ {x264_cabac_syns, "x264_cabac", "1", X264_OPT_BOOL},
+ {x264_aq_strength_syns, "x264_aq_strength", "1", X264_OPT_DOUBLE},
+ {x264_psy_syns, "x264_psy_rd", "1|0", X264_OPT_PSY},
+ {x264_psy_syns, "x264_psy_trell", "1|0", X264_OPT_PSY},
+ {x264_mbtree_syns, "x264_mbtree", "1", X264_OPT_BOOL_NONE},
};
#define X264_OPT_MAP_SIZE (sizeof(x264_opt_map)/sizeof(struct x264_opt_map_s))
static const gchar*
x264_opt_get_default(const gchar *opt)
{
- gint jj;
- for (jj = 0; jj < X264_OPT_MAP_SIZE; jj++)
- {
- if (find_syn_match(opt, x264_opt_map[jj].opt_syns) >= 0)
- {
- return x264_opt_map[jj].def_val;
- }
- }
- return "";
+ gint jj;
+ for (jj = 0; jj < X264_OPT_MAP_SIZE; jj++)
+ {
+ if (find_syn_match(opt, x264_opt_map[jj].opt_syns) >= 0)
+ {
+ return x264_opt_map[jj].def_val;
+ }
+ }
+ return "";
}
static void
x264_update_double(signal_user_data_t *ud, const gchar *name, const gchar *val)
{
- gdouble dval;
+ gdouble dval;
- if (val == NULL) return;
- dval = g_strtod (val, NULL);
- ghb_ui_update(ud, name, ghb_double_value(dval));
+ if (val == NULL) return;
+ dval = g_strtod (val, NULL);
+ ghb_ui_update(ud, name, ghb_double_value(dval));
}
static void
x264_update_int(signal_user_data_t *ud, const gchar *name, const gchar *val)
{
- gint ival;
+ gint ival;
- if (val == NULL) return;
- ival = g_strtod (val, NULL);
- ghb_ui_update(ud, name, ghb_int64_value(ival));
+ if (val == NULL) return;
+ ival = g_strtod (val, NULL);
+ ghb_ui_update(ud, name, ghb_int64_value(ival));
}
static void
x264_update_int_setting(signal_user_data_t *ud, const gchar *name, const gchar *val)
{
- gint ival;
+ gint ival;
- if (val == NULL) return;
- ival = g_strtod (val, NULL);
- ghb_settings_set_value(ud->settings, name, ghb_int64_value(ival));
- ghb_check_dependency(ud, NULL, name);
+ if (val == NULL) return;
+ ival = g_strtod (val, NULL);
+ ghb_settings_set_value(ud->settings, name, ghb_int64_value(ival));
+ ghb_check_dependency(ud, NULL, name);
}
static gchar *true_str[] =
{
- "true",
- "yes",
- "1",
- NULL
+ "true",
+ "yes",
+ "1",
+ NULL
};
static gboolean
str_is_true(const gchar *str)
{
- gint ii;
- for (ii = 0; true_str[ii]; ii++)
- {
- if (g_ascii_strcasecmp(str, true_str[ii]) == 0)
- return TRUE;
- }
- return FALSE;
+ gint ii;
+ for (ii = 0; true_str[ii]; ii++)
+ {
+ if (g_ascii_strcasecmp(str, true_str[ii]) == 0)
+ return TRUE;
+ }
+ return FALSE;
}
static void
x264_update_bool(signal_user_data_t *ud, const gchar *name, const gchar *val)
{
- if (val == NULL)
- ghb_ui_update(ud, name, ghb_boolean_value(1));
- else
- ghb_ui_update(ud, name, ghb_boolean_value(str_is_true(val)));
+ if (val == NULL)
+ ghb_ui_update(ud, name, ghb_boolean_value(1));
+ else
+ ghb_ui_update(ud, name, ghb_boolean_value(str_is_true(val)));
}
static void
x264_update_bool_setting(signal_user_data_t *ud, const gchar *name, const gchar *val)
{
- if (val == NULL)
- ghb_settings_set_value(ud->settings, name, ghb_boolean_value(1));
- else
- ghb_settings_set_value(ud->settings, name, ghb_boolean_value(str_is_true(val)));
+ if (val == NULL)
+ ghb_settings_set_value(ud->settings, name, ghb_boolean_value(1));
+ else
+ ghb_settings_set_value(ud->settings, name, ghb_boolean_value(str_is_true(val)));
- ghb_check_dependency(ud, NULL, name);
+ ghb_check_dependency(ud, NULL, name);
}
static void
x264_update_combo(signal_user_data_t *ud, const gchar *name, const gchar *val)
{
- GtkTreeModel *store;
- GtkTreeIter iter;
- gchar *shortOpt;
- gdouble ivalue;
- gboolean foundit = FALSE;
- GtkWidget *widget;
-
- if (val == NULL) return;
- widget = GHB_WIDGET(ud->builder, name);
- if (widget == NULL)
- {
- g_debug("Failed to find widget for key: %s\n", name);
- return;
- }
- store = gtk_combo_box_get_model(GTK_COMBO_BOX(widget));
- if (gtk_tree_model_get_iter_first (store, &iter))
- {
- do
- {
- gtk_tree_model_get(store, &iter, 2, &shortOpt, 3, &ivalue, -1);
- if (strcmp(shortOpt, val) == 0)
- {
- gtk_combo_box_set_active_iter (GTK_COMBO_BOX(widget), &iter);
- g_free(shortOpt);
- foundit = TRUE;
- break;
- }
- g_free(shortOpt);
- } while (gtk_tree_model_iter_next (store, &iter));
- }
- if (!foundit)
- {
- if (gtk_tree_model_get_iter_first (store, &iter))
- {
- do
- {
- gtk_tree_model_get(store, &iter, 2, &shortOpt, 3, &ivalue, -1);
- if (strcmp(shortOpt, "custom") == 0)
- {
- gtk_list_store_set(GTK_LIST_STORE(store), &iter, 4, val, -1);
- gtk_combo_box_set_active_iter (GTK_COMBO_BOX(widget), &iter);
- g_free(shortOpt);
- foundit = TRUE;
- break;
- }
- g_free(shortOpt);
- } while (gtk_tree_model_iter_next (store, &iter));
- }
- }
- // Its possible the value hasn't changed. Since settings are only
- // updated when the value changes, I'm initializing settings here as well.
- ghb_widget_to_setting(ud->settings, widget);
+ GtkTreeModel *store;
+ GtkTreeIter iter;
+ gchar *shortOpt;
+ gdouble ivalue;
+ gboolean foundit = FALSE;
+ GtkWidget *widget;
+
+ if (val == NULL) return;
+ widget = GHB_WIDGET(ud->builder, name);
+ if (widget == NULL)
+ {
+ g_debug("Failed to find widget for key: %s\n", name);
+ return;
+ }
+ store = gtk_combo_box_get_model(GTK_COMBO_BOX(widget));
+ if (gtk_tree_model_get_iter_first (store, &iter))
+ {
+ do
+ {
+ gtk_tree_model_get(store, &iter, 2, &shortOpt, 3, &ivalue, -1);
+ if (strcmp(shortOpt, val) == 0)
+ {
+ gtk_combo_box_set_active_iter (GTK_COMBO_BOX(widget), &iter);
+ g_free(shortOpt);
+ foundit = TRUE;
+ break;
+ }
+ g_free(shortOpt);
+ } while (gtk_tree_model_iter_next (store, &iter));
+ }
+ if (!foundit)
+ {
+ if (gtk_tree_model_get_iter_first (store, &iter))
+ {
+ do
+ {
+ gtk_tree_model_get(store, &iter, 2, &shortOpt, 3, &ivalue, -1);
+ if (strcmp(shortOpt, "custom") == 0)
+ {
+ gtk_list_store_set(GTK_LIST_STORE(store), &iter, 4, val, -1);
+ gtk_combo_box_set_active_iter (GTK_COMBO_BOX(widget), &iter);
+ g_free(shortOpt);
+ foundit = TRUE;
+ break;
+ }
+ g_free(shortOpt);
+ } while (gtk_tree_model_iter_next (store, &iter));
+ }
+ }
+ // Its possible the value hasn't changed. Since settings are only
+ // updated when the value changes, I'm initializing settings here as well.
+ ghb_widget_to_setting(ud->settings, widget);
}
static void
x264_update_deblock(signal_user_data_t *ud, const gchar *xval)
{
- gdouble avalue, bvalue;
- gchar *end;
- gchar *val;
- gchar *bval = NULL;
-
- if (xval == NULL) return;
- val = g_strdup(xval);
- bvalue = avalue = 0;
- if (val != NULL)
- {
- gchar *pos = strchr(val, ',');
- if (pos != NULL)
- {
- bval = pos + 1;
- *pos = 0;
- }
- avalue = g_strtod (val, &end);
- if (bval != NULL)
- {
- bvalue = g_strtod (bval, &end);
- }
- }
- g_free(val);
- ghb_ui_update(ud, "x264_deblock_alpha", ghb_int64_value(avalue));
- ghb_ui_update(ud, "x264_deblock_beta", ghb_int64_value(bvalue));
+ gdouble avalue, bvalue;
+ gchar *end;
+ gchar *val;
+ gchar *bval = NULL;
+
+ if (xval == NULL) return;
+ val = g_strdup(xval);
+ bvalue = avalue = 0;
+ if (val != NULL)
+ {
+ gchar *pos = strchr(val, ',');
+ if (pos != NULL)
+ {
+ bval = pos + 1;
+ *pos = 0;
+ }
+ avalue = g_strtod (val, &end);
+ if (bval != NULL)
+ {
+ bvalue = g_strtod (bval, &end);
+ }
+ }
+ g_free(val);
+ ghb_ui_update(ud, "x264_deblock_alpha", ghb_int64_value(avalue));
+ ghb_ui_update(ud, "x264_deblock_beta", ghb_int64_value(bvalue));
}
static void
x264_parse_psy(const gchar *psy, gdouble *psy_rd, gdouble *psy_trell)
{
- *psy_rd = 0.;
- *psy_trell = 0.;
- if (psy == NULL) return;
- if (2 == sscanf(psy, "%lf|%lf", psy_rd, psy_trell) ||
- 2 == sscanf(psy, "%lf,%lf", psy_rd, psy_trell))
- {
- }
+ *psy_rd = 0.;
+ *psy_trell = 0.;
+ if (psy == NULL) return;
+ if (2 == sscanf(psy, "%lf|%lf", psy_rd, psy_trell) ||
+ 2 == sscanf(psy, "%lf,%lf", psy_rd, psy_trell))
+ {
+ }
}
static void
x264_update_psy(signal_user_data_t *ud, const gchar *xval)
{
- gdouble rd_value, trell_value;
+ gdouble rd_value, trell_value;
- if (xval == NULL) return;
- x264_parse_psy(xval, &rd_value, &trell_value);
- ghb_ui_update(ud, "x264_psy_rd", ghb_double_value(rd_value));
- ghb_ui_update(ud, "x264_psy_trell", ghb_double_value(trell_value));
+ if (xval == NULL) return;
+ x264_parse_psy(xval, &rd_value, &trell_value);
+ ghb_ui_update(ud, "x264_psy_rd", ghb_double_value(rd_value));
+ ghb_ui_update(ud, "x264_psy_trell", ghb_double_value(trell_value));
}
static void do_update(signal_user_data_t *ud, char *name, gint type, char *val)
{
- switch(type)
- {
- case X264_OPT_INT:
- x264_update_int(ud, name, val);
- break;
- case X264_OPT_DOUBLE:
- x264_update_double(ud, name, val);
- break;
- case X264_OPT_BOOL:
- x264_update_bool(ud, name, val);
- break;
- case X264_OPT_COMBO:
- x264_update_combo(ud, name, val);
- break;
- case X264_OPT_BOOL_NONE:
- x264_update_bool_setting(ud, name, val);
- break;
- case X264_OPT_INT_NONE:
- x264_update_int_setting(ud, name, val);
- break;
- }
+ switch(type)
+ {
+ case X264_OPT_INT:
+ x264_update_int(ud, name, val);
+ break;
+ case X264_OPT_DOUBLE:
+ x264_update_double(ud, name, val);
+ break;
+ case X264_OPT_BOOL:
+ x264_update_bool(ud, name, val);
+ break;
+ case X264_OPT_COMBO:
+ x264_update_combo(ud, name, val);
+ break;
+ case X264_OPT_BOOL_NONE:
+ x264_update_bool_setting(ud, name, val);
+ break;
+ case X264_OPT_INT_NONE:
+ x264_update_int_setting(ud, name, val);
+ break;
+ }
}
void
ghb_x264_parse_options(signal_user_data_t *ud, const gchar *options)
{
- gchar **split = g_strsplit(options, ":", -1);
- if (split == NULL) return;
-
- gint ii;
- gint jj;
-
- for (jj = 0; jj < X264_OPT_MAP_SIZE; jj++)
- x264_opt_map[jj].found = FALSE;
-
- for (ii = 0; split[ii] != NULL; ii++)
- {
- gchar *val = NULL;
- gchar *pos = strchr(split[ii], '=');
- if (pos != NULL)
- {
- val = pos + 1;
- *pos = 0;
- }
- for (jj = 0; jj < X264_OPT_MAP_SIZE; jj++)
- {
- if (find_syn_match(split[ii], x264_opt_map[jj].opt_syns) >= 0)
- {
- x264_opt_map[jj].found = TRUE;
- switch(x264_opt_map[jj].type)
- {
- case X264_OPT_INT:
- x264_update_int(ud, x264_opt_map[jj].name, val);
- break;
- case X264_OPT_DOUBLE:
- x264_update_double(ud, x264_opt_map[jj].name, val);
- break;
- case X264_OPT_BOOL:
- x264_update_bool(ud, x264_opt_map[jj].name, val);
- break;
- case X264_OPT_COMBO:
- x264_update_combo(ud, x264_opt_map[jj].name, val);
- break;
- case X264_OPT_DEBLOCK:
- // dirty little hack. mark deblock_beta found as well
- x264_opt_map[jj+1].found = TRUE;
- x264_update_deblock(ud, val);
- break;
- case X264_OPT_PSY:
- // dirty little hack. mark psy_trell found as well
- x264_opt_map[jj+1].found = TRUE;
- x264_update_psy(ud, val);
- break;
- case X264_OPT_BOOL_NONE:
- x264_update_bool_setting(ud, x264_opt_map[jj].name, val);
- break;
- case X264_OPT_INT_NONE:
- x264_update_int_setting(ud, x264_opt_map[jj].name, val);
- break;
- case X264_OPT_TRANS:
- if (x264_opt_map[jj].translation == NULL)
- break;
- val = trans_x264_val(x264_opt_map[jj].translation, val);
- if (val != NULL)
- {
- do_update(ud, x264_opt_map[jj].name,
- x264_opt_map[jj].translation->ui_type, val);
- // TODO un-grey the ui control
- }
- else
- {
- // TODO grey out the ui control
- }
- break;
- }
- break;
- }
- }
- }
- // For any options not found in the option string, set ui to
- // default values
- for (jj = 0; jj < X264_OPT_MAP_SIZE; jj++)
- {
- if (!x264_opt_map[jj].found)
- {
- gchar *val = strdup(x264_opt_map[jj].def_val);
- switch(x264_opt_map[jj].type)
- {
- case X264_OPT_INT:
- x264_update_int(ud, x264_opt_map[jj].name, val);
- break;
- case X264_OPT_DOUBLE:
- x264_update_double(ud, x264_opt_map[jj].name, val);
- break;
- case X264_OPT_BOOL:
- x264_update_bool(ud, x264_opt_map[jj].name, val);
- break;
- case X264_OPT_COMBO:
- x264_update_combo(ud, x264_opt_map[jj].name, val);
- break;
- case X264_OPT_DEBLOCK:
- x264_update_deblock(ud, val);
- break;
- case X264_OPT_PSY:
- x264_update_psy(ud, val);
- break;
- case X264_OPT_BOOL_NONE:
- x264_update_bool_setting(ud, x264_opt_map[jj].name, val);
- break;
- case X264_OPT_INT_NONE:
- x264_update_int_setting(ud, x264_opt_map[jj].name, val);
- break;
- case X264_OPT_TRANS:
- if (x264_opt_map[jj].translation == NULL)
- break;
- val = g_strdup(trans_x264_val(x264_opt_map[jj].translation, val));
- if (val != NULL)
- {
- do_update(ud, x264_opt_map[jj].name,
- x264_opt_map[jj].translation->ui_type, val);
- // TODO un-grey the ui control
- }
- else
- {
- // TODO grey out the ui control
- }
- break;
- }
- x264_opt_map[jj].found = TRUE;
- g_free(val);
- }
- }
- g_strfreev(split);
+ gchar **split = g_strsplit(options, ":", -1);
+ if (split == NULL) return;
+
+ gint ii;
+ gint jj;
+
+ for (jj = 0; jj < X264_OPT_MAP_SIZE; jj++)
+ x264_opt_map[jj].found = FALSE;
+
+ for (ii = 0; split[ii] != NULL; ii++)
+ {
+ gchar *val = NULL;
+ gchar *pos = strchr(split[ii], '=');
+ if (pos != NULL)
+ {
+ val = pos + 1;
+ *pos = 0;
+ }
+ for (jj = 0; jj < X264_OPT_MAP_SIZE; jj++)
+ {
+ if (find_syn_match(split[ii], x264_opt_map[jj].opt_syns) >= 0)
+ {
+ x264_opt_map[jj].found = TRUE;
+ switch(x264_opt_map[jj].type)
+ {
+ case X264_OPT_INT:
+ x264_update_int(ud, x264_opt_map[jj].name, val);
+ break;
+ case X264_OPT_DOUBLE:
+ x264_update_double(ud, x264_opt_map[jj].name, val);
+ break;
+ case X264_OPT_BOOL:
+ x264_update_bool(ud, x264_opt_map[jj].name, val);
+ break;
+ case X264_OPT_COMBO:
+ x264_update_combo(ud, x264_opt_map[jj].name, val);
+ break;
+ case X264_OPT_DEBLOCK:
+ // dirty little hack. mark deblock_beta found as well
+ x264_opt_map[jj+1].found = TRUE;
+ x264_update_deblock(ud, val);
+ break;
+ case X264_OPT_PSY:
+ // dirty little hack. mark psy_trell found as well
+ x264_opt_map[jj+1].found = TRUE;
+ x264_update_psy(ud, val);
+ break;
+ case X264_OPT_BOOL_NONE:
+ x264_update_bool_setting(ud, x264_opt_map[jj].name, val);
+ break;
+ case X264_OPT_INT_NONE:
+ x264_update_int_setting(ud, x264_opt_map[jj].name, val);
+ break;
+ case X264_OPT_TRANS:
+ if (x264_opt_map[jj].translation == NULL)
+ break;
+ val = trans_x264_val(x264_opt_map[jj].translation, val);
+ if (val != NULL)
+ {
+ do_update(ud, x264_opt_map[jj].name,
+ x264_opt_map[jj].translation->ui_type, val);
+ // TODO un-grey the ui control
+ }
+ else
+ {
+ // TODO grey out the ui control
+ }
+ break;
+ }
+ break;
+ }
+ }
+ }
+ // For any options not found in the option string, set ui to
+ // default values
+ for (jj = 0; jj < X264_OPT_MAP_SIZE; jj++)
+ {
+ if (!x264_opt_map[jj].found)
+ {
+ gchar *val = strdup(x264_opt_map[jj].def_val);
+ switch(x264_opt_map[jj].type)
+ {
+ case X264_OPT_INT:
+ x264_update_int(ud, x264_opt_map[jj].name, val);
+ break;
+ case X264_OPT_DOUBLE:
+ x264_update_double(ud, x264_opt_map[jj].name, val);
+ break;
+ case X264_OPT_BOOL:
+ x264_update_bool(ud, x264_opt_map[jj].name, val);
+ break;
+ case X264_OPT_COMBO:
+ x264_update_combo(ud, x264_opt_map[jj].name, val);
+ break;
+ case X264_OPT_DEBLOCK:
+ x264_update_deblock(ud, val);
+ break;
+ case X264_OPT_PSY:
+ x264_update_psy(ud, val);
+ break;
+ case X264_OPT_BOOL_NONE:
+ x264_update_bool_setting(ud, x264_opt_map[jj].name, val);
+ break;
+ case X264_OPT_INT_NONE:
+ x264_update_int_setting(ud, x264_opt_map[jj].name, val);
+ break;
+ case X264_OPT_TRANS:
+ if (x264_opt_map[jj].translation == NULL)
+ break;
+ val = g_strdup(trans_x264_val(x264_opt_map[jj].translation, val));
+ if (val != NULL)
+ {
+ do_update(ud, x264_opt_map[jj].name,
+ x264_opt_map[jj].translation->ui_type, val);
+ // TODO un-grey the ui control
+ }
+ else
+ {
+ // TODO grey out the ui control
+ }
+ break;
+ }
+ x264_opt_map[jj].found = TRUE;
+ g_free(val);
+ }
+ }
+ g_strfreev(split);
}
gchar*
get_deblock_val(signal_user_data_t *ud)
{
- gchar *alpha, *beta;
- gchar *result;
- alpha = ghb_settings_get_string(ud->settings, "x264_deblock_alpha");
- beta = ghb_settings_get_string(ud->settings, "x264_deblock_beta");
- result = g_strdup_printf("%s,%s", alpha, beta);
- g_free(alpha);
- g_free(beta);
- return result;
+ gchar *alpha, *beta;
+ gchar *result;
+ alpha = ghb_settings_get_string(ud->settings, "x264_deblock_alpha");
+ beta = ghb_settings_get_string(ud->settings, "x264_deblock_beta");
+ result = g_strdup_printf("%s,%s", alpha, beta);
+ g_free(alpha);
+ g_free(beta);
+ return result;
}
gchar*
get_psy_val(signal_user_data_t *ud)
{
- gdouble rd, trell;
- gchar *result;
- rd = ghb_settings_get_double(ud->settings, "x264_psy_rd");
- trell = ghb_settings_get_double(ud->settings, "x264_psy_trell");
- result = g_strdup_printf("%g|%g", rd, trell);
- return result;
+ gdouble rd, trell;
+ gchar *result;
+ rd = ghb_settings_get_double(ud->settings, "x264_psy_rd");
+ trell = ghb_settings_get_double(ud->settings, "x264_psy_trell");
+ result = g_strdup_printf("%g|%g", rd, trell);
+ return result;
}
static void
x264_opt_update(signal_user_data_t *ud, GtkWidget *widget)
{
- gint jj;
- const gchar *name = ghb_get_setting_key(widget);
- gchar **opt_syns = NULL;
- const gchar *def_val = NULL;
- gint type;
- trans_table_t *trans;
-
- for (jj = 0; jj < X264_OPT_MAP_SIZE; jj++)
- {
- if (strcmp(name, x264_opt_map[jj].name) == 0)
- {
- // found the options that needs updating
- opt_syns = x264_opt_map[jj].opt_syns;
- def_val = x264_opt_map[jj].def_val;
- type = x264_opt_map[jj].type;
- trans = x264_opt_map[jj].translation;
- break;
- }
- }
- if (opt_syns != NULL)
- {
- GString *x264opts = g_string_new("");
- gchar *options;
- gchar **split = NULL;
- gint ii;
- gboolean foundit = FALSE;
-
- options = ghb_settings_get_string(ud->settings, "x264Option");
- if (options)
- {
- split = g_strsplit(options, ":", -1);
- g_free(options);
- }
- for (ii = 0; split && split[ii] != NULL; ii++)
- {
- gint syn;
- gchar *val = NULL;
- gchar *pos = strchr(split[ii], '=');
- if (pos != NULL)
- {
- val = pos + 1;
- *pos = 0;
- }
- syn = find_syn_match(split[ii], opt_syns);
- if (syn >= 0)
- { // Updating this option
- gchar *val;
- foundit = TRUE;
- if (type == X264_OPT_DEBLOCK)
- val = get_deblock_val(ud);
- else if (type == X264_OPT_PSY)
- val = get_psy_val(ud);
- else
- {
- GValue *gval;
- gval = ghb_widget_value(widget);
- if (G_VALUE_TYPE(gval) == G_TYPE_BOOLEAN)
- {
- if (ghb_value_boolean(gval))
- val = g_strdup("1");
- else
- val = g_strdup("0");
- }
- else
- {
- val = ghb_widget_string(widget);
- }
- ghb_value_free(gval);
- }
- if (type == X264_OPT_TRANS)
- {
- gchar *tmp;
- tmp = g_strdup(trans_ui_val(trans, val));
- if (tmp)
- {
- g_free(val);
- val = tmp;
- }
- }
- if (strcmp(def_val, val) != 0)
- {
- g_string_append_printf(x264opts, "%s=%s:", opt_syns[syn], val);
- }
- g_free(val);
- }
- else if (val != NULL)
- g_string_append_printf(x264opts, "%s=%s:", split[ii], val);
- else
- g_string_append_printf(x264opts, "%s:", split[ii]);
-
- }
- if (split) g_strfreev(split);
- if (!foundit)
- {
- gchar *val;
- if (type == X264_OPT_DEBLOCK)
- val = get_deblock_val(ud);
- else if (type == X264_OPT_PSY)
- val = get_psy_val(ud);
- else
- {
- GValue *gval;
- gval = ghb_widget_value(widget);
- if (G_VALUE_TYPE(gval) == G_TYPE_BOOLEAN)
- {
- if (ghb_value_boolean(gval))
- val = g_strdup("1");
- else
- val = g_strdup("0");
- }
- else
- {
- val = ghb_widget_string(widget);
- }
- ghb_value_free(gval);
- }
- if (type == X264_OPT_TRANS)
- {
- gchar *tmp;
- tmp = g_strdup(trans_ui_val(trans, val));
- if (tmp)
- {
- g_free(val);
- val = tmp;
- }
- }
- if (strcmp(def_val, val) != 0)
- {
- g_string_append_printf(x264opts, "%s=%s:", opt_syns[0], val);
- }
- g_free(val);
- }
- // Update the options value
- // strip the trailing ":"
- gchar *result;
- gint len;
- result = g_string_free(x264opts, FALSE);
- len = strlen(result);
- if (len > 0) result[len - 1] = 0;
- gchar *sopts;
- sopts = sanitize_x264opts(ud, result);
- ghb_ui_update(ud, "x264Option", ghb_string_value(sopts));
- ghb_x264_parse_options(ud, sopts);
- g_free(sopts);
- g_free(result);
- }
+ gint jj;
+ const gchar *name = ghb_get_setting_key(widget);
+ gchar **opt_syns = NULL;
+ const gchar *def_val = NULL;
+ gint type;
+ trans_table_t *trans;
+
+ for (jj = 0; jj < X264_OPT_MAP_SIZE; jj++)
+ {
+ if (strcmp(name, x264_opt_map[jj].name) == 0)
+ {
+ // found the options that needs updating
+ opt_syns = x264_opt_map[jj].opt_syns;
+ def_val = x264_opt_map[jj].def_val;
+ type = x264_opt_map[jj].type;
+ trans = x264_opt_map[jj].translation;
+ break;
+ }
+ }
+ if (opt_syns != NULL)
+ {
+ GString *x264opts = g_string_new("");
+ gchar *options;
+ gchar **split = NULL;
+ gint ii;
+ gboolean foundit = FALSE;
+
+ options = ghb_settings_get_string(ud->settings, "x264Option");
+ if (options)
+ {
+ split = g_strsplit(options, ":", -1);
+ g_free(options);
+ }
+ for (ii = 0; split && split[ii] != NULL; ii++)
+ {
+ gint syn;
+ gchar *val = NULL;
+ gchar *pos = strchr(split[ii], '=');
+ if (pos != NULL)
+ {
+ val = pos + 1;
+ *pos = 0;
+ }
+ syn = find_syn_match(split[ii], opt_syns);
+ if (syn >= 0)
+ { // Updating this option
+ gchar *val;
+ foundit = TRUE;
+ if (type == X264_OPT_DEBLOCK)
+ val = get_deblock_val(ud);
+ else if (type == X264_OPT_PSY)
+ val = get_psy_val(ud);
+ else
+ {
+ GValue *gval;
+ gval = ghb_widget_value(widget);
+ if (G_VALUE_TYPE(gval) == G_TYPE_BOOLEAN)
+ {
+ if (ghb_value_boolean(gval))
+ val = g_strdup("1");
+ else
+ val = g_strdup("0");
+ }
+ else
+ {
+ val = ghb_widget_string(widget);
+ }
+ ghb_value_free(gval);
+ }
+ if (type == X264_OPT_TRANS)
+ {
+ gchar *tmp;
+ tmp = g_strdup(trans_ui_val(trans, val));
+ if (tmp)
+ {
+ g_free(val);
+ val = tmp;
+ }
+ }
+ if (strcmp(def_val, val) != 0)
+ {
+ g_string_append_printf(x264opts, "%s=%s:", opt_syns[syn], val);
+ }
+ g_free(val);
+ }
+ else if (val != NULL)
+ g_string_append_printf(x264opts, "%s=%s:", split[ii], val);
+ else
+ g_string_append_printf(x264opts, "%s:", split[ii]);
+
+ }
+ if (split) g_strfreev(split);
+ if (!foundit)
+ {
+ gchar *val;
+ if (type == X264_OPT_DEBLOCK)
+ val = get_deblock_val(ud);
+ else if (type == X264_OPT_PSY)
+ val = get_psy_val(ud);
+ else
+ {
+ GValue *gval;
+ gval = ghb_widget_value(widget);
+ if (G_VALUE_TYPE(gval) == G_TYPE_BOOLEAN)
+ {
+ if (ghb_value_boolean(gval))
+ val = g_strdup("1");
+ else
+ val = g_strdup("0");
+ }
+ else
+ {
+ val = ghb_widget_string(widget);
+ }
+ ghb_value_free(gval);
+ }
+ if (type == X264_OPT_TRANS)
+ {
+ gchar *tmp;
+ tmp = g_strdup(trans_ui_val(trans, val));
+ if (tmp)
+ {
+ g_free(val);
+ val = tmp;
+ }
+ }
+ if (strcmp(def_val, val) != 0)
+ {
+ g_string_append_printf(x264opts, "%s=%s:", opt_syns[0], val);
+ }
+ g_free(val);
+ }
+ // Update the options value
+ // strip the trailing ":"
+ gchar *result;
+ gint len;
+ result = g_string_free(x264opts, FALSE);
+ len = strlen(result);
+ if (len > 0) result[len - 1] = 0;
+ gchar *sopts;
+ sopts = sanitize_x264opts(ud, result);
+ ghb_ui_update(ud, "x264Option", ghb_string_value(sopts));
+ ghb_x264_parse_options(ud, sopts);
+ g_free(sopts);
+ g_free(result);
+ }
}
static gint
x264_find_opt(gchar **opts, gchar **opt_syns)
{
- gint ii;
- for (ii = 0; opts[ii] != NULL; ii++)
- {
- gchar *opt;
- opt = g_strdup(opts[ii]);
- gchar *pos = strchr(opt, '=');
- if (pos != NULL)
- {
- *pos = 0;
- }
- if (find_syn_match(opt, opt_syns) >= 0)
- {
- g_free(opt);
- return ii;
- }
- g_free(opt);
- }
- return -1;
+ gint ii;
+ for (ii = 0; opts[ii] != NULL; ii++)
+ {
+ gchar *opt;
+ opt = g_strdup(opts[ii]);
+ gchar *pos = strchr(opt, '=');
+ if (pos != NULL)
+ {
+ *pos = 0;
+ }
+ if (find_syn_match(opt, opt_syns) >= 0)
+ {
+ g_free(opt);
+ return ii;
+ }
+ g_free(opt);
+ }
+ return -1;
}
static void
x264_remove_opt(gchar **opts, gchar **opt_syns)
{
- gint ii;
- for (ii = 0; opts[ii] != NULL; ii++)
- {
- gchar *opt;
- opt = g_strdup(opts[ii]);
- gchar *pos = strchr(opt, '=');
- if (pos != NULL)
- {
- *pos = 0;
- }
- if (find_syn_match(opt, opt_syns) >= 0)
- {
- // Mark as deleted
- opts[ii][0] = 0;
- }
- g_free(opt);
- }
+ gint ii;
+ for (ii = 0; opts[ii] != NULL; ii++)
+ {
+ gchar *opt;
+ opt = g_strdup(opts[ii]);
+ gchar *pos = strchr(opt, '=');
+ if (pos != NULL)
+ {
+ *pos = 0;
+ }
+ if (find_syn_match(opt, opt_syns) >= 0)
+ {
+ // Mark as deleted
+ opts[ii][0] = 0;
+ }
+ g_free(opt);
+ }
}
static gchar*
x264_lookup_value(gchar **opts, gchar **opt_syns)
{
- gchar *ret = NULL;
- gint pos;
-
- const gchar *def_val = x264_opt_get_default(opt_syns[0]);
-
- pos = x264_find_opt(opts, opt_syns);
- if (pos >= 0)
- {
- gchar *cpos = strchr(opts[pos], '=');
- if (cpos != NULL)
- {
- ret = g_strdup(cpos+1);
- }
- else
- {
- ret = g_strdup("");
- }
- }
- else if (def_val != NULL)
- {
- ret = g_strdup(def_val);
- }
- return ret;
+ gchar *ret = NULL;
+ gint pos;
+
+ const gchar *def_val = x264_opt_get_default(opt_syns[0]);
+
+ pos = x264_find_opt(opts, opt_syns);
+ if (pos >= 0)
+ {
+ gchar *cpos = strchr(opts[pos], '=');
+ if (cpos != NULL)
+ {
+ ret = g_strdup(cpos+1);
+ }
+ else
+ {
+ ret = g_strdup("");
+ }
+ }
+ else if (def_val != NULL)
+ {
+ ret = g_strdup(def_val);
+ }
+ return ret;
}
gint
ghb_lookup_badapt(const gchar *options)
{
- gint ret = 0;
- gchar *result;
- gchar **split;
-
- if (options == NULL)
- options = "";
-
- split = g_strsplit(options, ":", -1);
-
- result = x264_lookup_value(split, x264_badapt_syns);
- g_strfreev(split);
- if (result != NULL)
- {
- ret = g_strtod(result, NULL);
- g_free(result);
- }
- return ret;
+ gint ret = 0;
+ gchar *result;
+ gchar **split;
+
+ if (options == NULL)
+ options = "";
+
+ split = g_strsplit(options, ":", -1);
+
+ result = x264_lookup_value(split, x264_badapt_syns);
+ g_strfreev(split);
+ if (result != NULL)
+ {
+ ret = g_strtod(result, NULL);
+ g_free(result);
+ }
+ return ret;
}
gint
ghb_lookup_aqmode(const gchar *options)
{
- gint ret = 0;
- gchar *result;
- gchar **split;
-
- if (options == NULL)
- options = "";
-
- split = g_strsplit(options, ":", -1);
-
- result = x264_lookup_value(split, x264_aqmode_syns);
- g_strfreev(split);
- if (result != NULL)
- {
- ret = g_strtod(result, NULL);
- g_free(result);
- }
- return ret;
+ gint ret = 0;
+ gchar *result;
+ gchar **split;
+
+ if (options == NULL)
+ options = "";
+
+ split = g_strsplit(options, ":", -1);
+
+ result = x264_lookup_value(split, x264_aqmode_syns);
+ g_strfreev(split);
+ if (result != NULL)
+ {
+ ret = g_strtod(result, NULL);
+ g_free(result);
+ }
+ return ret;
}
gint
ghb_lookup_bframes(const gchar *options)
{
- gint ret = 0;
- gchar *result;
- gchar **split;
-
- if (options == NULL)
- options = "";
-
- split = g_strsplit(options, ":", -1);
-
- result = x264_lookup_value(split, x264_bframes_syns);
- g_strfreev(split);
- if (result != NULL)
- {
- ret = g_strtod(result, NULL);
- g_free(result);
- }
- return ret;
+ gint ret = 0;
+ gchar *result;
+ gchar **split;
+
+ if (options == NULL)
+ options = "";
+
+ split = g_strsplit(options, ":", -1);
+
+ result = x264_lookup_value(split, x264_bframes_syns);
+ g_strfreev(split);
+ if (result != NULL)
+ {
+ ret = g_strtod(result, NULL);
+ g_free(result);
+ }
+ return ret;
}
gint
ghb_lookup_mbtree(const gchar *options)
{
- gint ret = ghb_lookup_bframes(options) != 0;
- gchar *result;
- gchar **split;
-
- if (options == NULL)
- options = "";
-
- split = g_strsplit(options, ":", -1);
-
- result = x264_lookup_value(split, x264_mbtree_syns);
- g_strfreev(split);
- if (result != NULL)
- {
- ret = g_strtod(result, NULL);
- g_free(result);
- }
- return ret;
+ gint ret = ghb_lookup_bframes(options) != 0;
+ gchar *result;
+ gchar **split;
+
+ if (options == NULL)
+ options = "";
+
+ split = g_strsplit(options, ":", -1);
+
+ result = x264_lookup_value(split, x264_mbtree_syns);
+ g_strfreev(split);
+ if (result != NULL)
+ {
+ ret = g_strtod(result, NULL);
+ g_free(result);
+ }
+ return ret;
}
// Construct the x264 options string
@@ -1194,117 +1194,117 @@ ghb_lookup_mbtree(const gchar *options)
static gchar*
sanitize_x264opts(signal_user_data_t *ud, const gchar *options)
{
- GString *x264opts = g_string_new("");
- gchar **split = g_strsplit(options, ":", -1);
- gint ii;
-
- // Fix up option dependencies
- gint subme = ghb_settings_combo_int(ud->settings, "x264_subme");
- if (subme < 6)
- {
- x264_remove_opt(split, x264_psy_syns);
- }
- gint trell = ghb_settings_combo_int(ud->settings, "x264_trellis");
- if (subme >= 10)
- {
- gint aqmode = ghb_lookup_aqmode(options);
- if (trell != 2 || aqmode == 0)
- {
- gint pos = x264_find_opt(split, x264_subme_syns);
- g_free(split[pos]);
- split[pos] = g_strdup_printf("subme=9");
- }
- }
- if (trell < 1)
- {
- gint psy;
- gdouble psy_rd = 0., psy_trell;
-
- psy = x264_find_opt(split, x264_psy_syns);
- if (psy >= 0)
- {
- gchar *pos = strchr(split[psy], '=');
- if (pos != NULL)
- {
- x264_parse_psy(pos+1, &psy_rd, &psy_trell);
- }
- g_free(split[psy]);
- split[psy] = g_strdup_printf("psy-rd=%g|0", psy_rd);
- }
- }
- gint bframes = ghb_settings_get_int(ud->settings, "x264_bframes");
- if (bframes == 0)
- {
- x264_remove_opt(split, x264_direct_syns);
- x264_remove_opt(split, x264_badapt_syns);
- }
- if (bframes <= 1)
- {
- x264_remove_opt(split, x264_bpyramid_syns);
- }
- // Remove entries that match the defaults
- for (ii = 0; split[ii] != NULL; ii++)
- {
- gchar *val = NULL;
- gchar *opt = g_strdup(split[ii]);
- gchar *pos = strchr(opt, '=');
- if (pos != NULL)
- {
- val = pos + 1;
- *pos = 0;
- }
- else
- {
- val = "1";
- }
- const gchar *def_val;
- def_val = x264_opt_get_default(opt);
- if (strcmp(val, def_val) == 0)
- {
- // Matches the default, so remove it
- split[ii][0] = 0;
- }
- g_free(opt);
- }
- for (ii = 0; split[ii] != NULL; ii++)
- {
- if (split[ii][0] != 0)
- g_string_append_printf(x264opts, "%s:", split[ii]);
- }
- g_strfreev(split);
- // strip the trailing ":"
- gchar *result;
- gint len;
- result = g_string_free(x264opts, FALSE);
- len = strlen(result);
- if (len > 0) result[len - 1] = 0;
- return result;
+ GString *x264opts = g_string_new("");
+ gchar **split = g_strsplit(options, ":", -1);
+ gint ii;
+
+ // Fix up option dependencies
+ gint subme = ghb_settings_combo_int(ud->settings, "x264_subme");
+ if (subme < 6)
+ {
+ x264_remove_opt(split, x264_psy_syns);
+ }
+ gint trell = ghb_settings_combo_int(ud->settings, "x264_trellis");
+ if (subme >= 10)
+ {
+ gint aqmode = ghb_lookup_aqmode(options);
+ if (trell != 2 || aqmode == 0)
+ {
+ gint pos = x264_find_opt(split, x264_subme_syns);
+ g_free(split[pos]);
+ split[pos] = g_strdup_printf("subme=9");
+ }
+ }
+ if (trell < 1)
+ {
+ gint psy;
+ gdouble psy_rd = 0., psy_trell;
+
+ psy = x264_find_opt(split, x264_psy_syns);
+ if (psy >= 0)
+ {
+ gchar *pos = strchr(split[psy], '=');
+ if (pos != NULL)
+ {
+ x264_parse_psy(pos+1, &psy_rd, &psy_trell);
+ }
+ g_free(split[psy]);
+ split[psy] = g_strdup_printf("psy-rd=%g|0", psy_rd);
+ }
+ }
+ gint bframes = ghb_settings_get_int(ud->settings, "x264_bframes");
+ if (bframes == 0)
+ {
+ x264_remove_opt(split, x264_direct_syns);
+ x264_remove_opt(split, x264_badapt_syns);
+ }
+ if (bframes <= 1)
+ {
+ x264_remove_opt(split, x264_bpyramid_syns);
+ }
+ // Remove entries that match the defaults
+ for (ii = 0; split[ii] != NULL; ii++)
+ {
+ gchar *val = NULL;
+ gchar *opt = g_strdup(split[ii]);
+ gchar *pos = strchr(opt, '=');
+ if (pos != NULL)
+ {
+ val = pos + 1;
+ *pos = 0;
+ }
+ else
+ {
+ val = "1";
+ }
+ const gchar *def_val;
+ def_val = x264_opt_get_default(opt);
+ if (strcmp(val, def_val) == 0)
+ {
+ // Matches the default, so remove it
+ split[ii][0] = 0;
+ }
+ g_free(opt);
+ }
+ for (ii = 0; split[ii] != NULL; ii++)
+ {
+ if (split[ii][0] != 0)
+ g_string_append_printf(x264opts, "%s:", split[ii]);
+ }
+ g_strfreev(split);
+ // strip the trailing ":"
+ gchar *result;
+ gint len;
+ result = g_string_free(x264opts, FALSE);
+ len = strlen(result);
+ if (len > 0) result[len - 1] = 0;
+ return result;
}
G_MODULE_EXPORT gboolean
lavc_focus_out_cb(GtkWidget *widget, GdkEventFocus *event,
- signal_user_data_t *ud)
+ signal_user_data_t *ud)
{
- ghb_widget_to_setting(ud->settings, widget);
+ ghb_widget_to_setting(ud->settings, widget);
#if 0
- gchar *options, *sopts;
- ****************************************************************
- When there are lavc widget in the future, this will be populated
- ****************************************************************
- options = ghb_settings_get_string(ud->settings, "x264Option");
- sopts = sanitize_x264opts(ud, options);
- ignore_options_update = TRUE;
- if (sopts != NULL && strcmp(sopts, options) != 0)
- {
- ghb_ui_update(ud, "x264Option", ghb_string_value(sopts));
- ghb_x264_parse_options(ud, sopts);
- }
- g_free(options);
- g_free(sopts);
- ignore_options_update = FALSE;
+ gchar *options, *sopts;
+ ****************************************************************
+ When there are lavc widget in the future, this will be populated
+ ****************************************************************
+ options = ghb_settings_get_string(ud->settings, "x264Option");
+ sopts = sanitize_x264opts(ud, options);
+ ignore_options_update = TRUE;
+ if (sopts != NULL && strcmp(sopts, options) != 0)
+ {
+ ghb_ui_update(ud, "x264Option", ghb_string_value(sopts));
+ ghb_x264_parse_options(ud, sopts);
+ }
+ g_free(options);
+ g_free(sopts);
+ ignore_options_update = FALSE;
#endif
- return FALSE;
+ return FALSE;
}
G_MODULE_EXPORT gchar*
diff --git a/gtk/src/x264handler.h b/gtk/src/x264handler.h
index 592a4fd3b..2e72ce4ba 100644
--- a/gtk/src/x264handler.h
+++ b/gtk/src/x264handler.h
@@ -17,9 +17,9 @@
*
* You should have received a copy of the GNU General Public License
* along with callbacks.h. If not, write to:
- * The Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301, USA.
+ * The Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301, USA.
*/
#if !defined(_X264HANDLER_H_)