summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--gtk/src/callbacks.c4
-rw-r--r--gtk/src/hb-backend.c100
-rw-r--r--gtk/src/hb-backend.h5
-rw-r--r--gtk/src/queuehandler.c24
4 files changed, 65 insertions, 68 deletions
diff --git a/gtk/src/callbacks.c b/gtk/src/callbacks.c
index bc75a1ead..edda75d6a 100644
--- a/gtk/src/callbacks.c
+++ b/gtk/src/callbacks.c
@@ -1960,14 +1960,14 @@ framerate_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
{
ghb_widget_to_setting(ud->settings, widget);
- if (ghb_settings_combo_int(ud->settings, "VideoFramerate") != 0)
+ if (ghb_settings_video_framerate_rate(ud->settings, "VideoFramerate") != 0)
{
if (!ghb_settings_get_boolean(ud->settings, "VideoFrameratePFR"))
{
ghb_ui_update(ud, "VideoFramerateCFR", ghb_boolean_value(TRUE));
}
}
- if (ghb_settings_combo_int(ud->settings, "VideoFramerate") == 0 &&
+ if (ghb_settings_video_framerate_rate(ud->settings, "VideoFramerate") == 0 &&
ghb_settings_get_boolean(ud->settings, "VideoFrameratePFR"))
{
ghb_ui_update(ud, "VideoFramerateVFR", ghb_boolean_value(TRUE));
diff --git a/gtk/src/hb-backend.c b/gtk/src/hb-backend.c
index aaa04cd4a..114881a0e 100644
--- a/gtk/src/hb-backend.c
+++ b/gtk/src/hb-backend.c
@@ -862,45 +862,6 @@ lookup_generic_option(combo_opts_t *opts, const GValue *gval)
}
static const hb_rate_t *
-lookup_video_framerate(const GValue *grate)
-{
- gchar *str;
- const hb_rate_t *rate;
-
- str = ghb_value_string(grate);
- for (rate = hb_video_framerate_get_next(NULL); rate != NULL;
- rate = hb_video_framerate_get_next(rate))
- {
- if (strcmp(rate->name, str) == 0)
- {
- g_free(str);
- return rate;
- }
- }
- g_free(str);
- // Default to "same as source"
- return NULL;
-}
-
-static gint
-lookup_video_framerate_int(const GValue *grate)
-{
- const hb_rate_t *rate = lookup_video_framerate(grate);
- if (rate != NULL)
- return rate->rate;
- return 0;
-}
-
-static const gchar*
-lookup_video_framerate_option(const GValue *grate)
-{
- const hb_rate_t *rate = lookup_video_framerate(grate);
- if (rate != NULL)
- return rate->name;
- return "Same as source";
-}
-
-static const hb_rate_t *
lookup_audio_samplerate(const GValue *grate)
{
const hb_rate_t *rate;
@@ -1489,17 +1450,54 @@ video_framerate_opts_set(GtkBuilder *builder, const gchar *name)
}
}
+const hb_rate_t sas_rate =
+{
+ .name = N_("Same as source"),
+ .rate = 0,
+};
+
const hb_rate_t*
-ghb_lookup_framerte(const char *name)
+ghb_lookup_video_framerate(const char *name)
{
- const hb_rate_t *rate;
- for (rate = hb_video_framerate_get_next(NULL); rate != NULL;
- rate = hb_video_framerate_get_next(rate))
+ // Check for special "Same as source" value
+ if (!strncmp(name, "source", 8))
+ return &sas_rate;
+
+ // First find an enabled rate
+ int rate = hb_video_framerate_get_from_name(name);
+
+ // Now find the matching rate info
+ const hb_rate_t *hb_rate, *first;
+ for (first = hb_rate = hb_video_framerate_get_next(NULL); hb_rate != NULL;
+ hb_rate = hb_video_framerate_get_next(hb_rate))
{
- if (!strncmp(name, rate->name, 80))
- return rate;
+ if (rate == hb_rate->rate)
+ {
+ return hb_rate;
+ }
}
- return NULL;
+ // Return a default rate if nothing matches
+ return first;
+}
+
+int
+ghb_lookup_video_framerate_rate(const char *name)
+{
+ return ghb_lookup_video_framerate(name)->rate;
+}
+
+int
+ghb_settings_video_framerate_rate(const GValue *settings, const char *name)
+{
+ const char *rate_id = ghb_settings_get_const_string(settings, name);
+ return ghb_lookup_video_framerate_rate(rate_id);
+}
+
+const hb_rate_t*
+ghb_settings_video_framerate(const GValue *settings, const char *name)
+{
+ const char *rate_id = ghb_settings_get_const_string(settings, name);
+ return ghb_lookup_video_framerate(rate_id);
}
static void
@@ -2530,8 +2528,6 @@ ghb_lookup_combo_int(const gchar *name, const GValue *gval)
return lookup_audio_bitrate_int(gval);
else if (strcmp(name, "AudioSamplerate") == 0)
return lookup_audio_samplerate_int(gval);
- else if (strcmp(name, "VideoFramerate") == 0)
- return lookup_video_framerate_int(gval);
else if (strcmp(name, "SrtLanguage") == 0)
return lookup_audio_lang_int(gval);
else
@@ -2551,8 +2547,6 @@ ghb_lookup_combo_double(const gchar *name, const GValue *gval)
return lookup_audio_bitrate_int(gval);
else if (strcmp(name, "AudioSamplerate") == 0)
return lookup_audio_samplerate_int(gval);
- else if (strcmp(name, "VideoFramerate") == 0)
- return lookup_video_framerate_int(gval);
else if (strcmp(name, "SrtLanguage") == 0)
return lookup_audio_lang_int(gval);
else
@@ -2572,8 +2566,6 @@ ghb_lookup_combo_option(const gchar *name, const GValue *gval)
return lookup_audio_bitrate_option(gval);
else if (strcmp(name, "AudioSamplerate") == 0)
return lookup_audio_samplerate_option(gval);
- else if (strcmp(name, "VideoFramerate") == 0)
- return lookup_video_framerate_option(gval);
else if (strcmp(name, "SrtLanguage") == 0)
return lookup_audio_lang_option(gval);
else
@@ -2593,8 +2585,6 @@ ghb_lookup_combo_string(const gchar *name, const GValue *gval)
return lookup_audio_bitrate_option(gval);
else if (strcmp(name, "AudioSamplerate") == 0)
return lookup_audio_samplerate_string(gval);
- else if (strcmp(name, "VideoFramerate") == 0)
- return lookup_video_framerate_option(gval);
else if (strcmp(name, "SrtLanguage") == 0)
return lookup_audio_lang_option(gval);
else
@@ -4624,7 +4614,7 @@ add_job(hb_handle_t *h, GValue *js, gint unique_id, int titleindex)
}
gint vrate;
- gint vrate_base = ghb_settings_combo_int(js, "VideoFramerate");
+ gint vrate_base = ghb_settings_video_framerate_rate(js, "VideoFramerate");
gint cfr;
if (ghb_settings_get_boolean(js, "VideoFrameratePFR"))
cfr = 2;
diff --git a/gtk/src/hb-backend.h b/gtk/src/hb-backend.h
index 1eb4f01e8..8445c28d2 100644
--- a/gtk/src/hb-backend.h
+++ b/gtk/src/hb-backend.h
@@ -188,5 +188,10 @@ int ghb_lookup_mixdown_mix(const char *name);
int ghb_settings_mixdown_mix(const GValue *settings, const char *name);
const hb_mixdown_t* ghb_settings_mixdown(
const GValue *settings, const char *name);
+const hb_rate_t* ghb_lookup_video_framerate(const char *name);
+int ghb_lookup_video_framerate_rate(const char *name);
+int ghb_settings_video_framerate_rate(const GValue *settings, const char *name);
+const hb_rate_t* ghb_settings_video_framerate(
+ const GValue *settings, const char *name);
#endif // _HBBACKEND_H_
diff --git a/gtk/src/queuehandler.c b/gtk/src/queuehandler.c
index 94f56ed7c..e7f8788cd 100644
--- a/gtk/src/queuehandler.c
+++ b/gtk/src/queuehandler.c
@@ -387,27 +387,28 @@ add_to_queue_list(signal_user_data_t *ud, GValue *settings, GtkTreeIter *piter)
const hb_encoder_t *video_encoder;
video_encoder = ghb_settings_video_encoder(settings, "VideoEncoder");
- XPRINT("<b>Video:</b> <small>%s</small>", video_encoder->name);
+ XPRINT("<b>Video:</b> <small>%s", video_encoder->name);
- const char *fps;
- fps = ghb_settings_get_const_string(settings, "VideoFramerate");
- if (strcmp("source", fps) == 0)
+ const hb_rate_t *fps;
+ fps = ghb_settings_video_framerate(settings, "VideoFramerate");
+ if (fps->rate == 0)
{
+ const char *rate_mode;
if (ghb_settings_get_boolean(settings, "VideoFramerateCFR"))
- fps = "Same As Source (constant)";
+ rate_mode = "(constant)";
else
- fps = "Same As Source (variable)";
- XPRINT("<small>, Framerate: %s</small>", fps);
+ rate_mode = "(variable)";
+ XPRINT(", Framerate: %s %s", fps->name, rate_mode);
}
else
{
if (ghb_settings_get_boolean(settings, "VideoFrameratePFR"))
{
- XPRINT("<small>, Framerate: Peak %s (may be lower)</small>", fps);
+ XPRINT(", Framerate: Peak %s (may be lower)", fps->name);
}
else
{
- XPRINT("<small>, Framerate: %s (constant frame rate)</small>", fps);
+ XPRINT(", Framerate: %s (constant frame rate)", fps->name);
}
}
const gchar *vq_desc = "Error";
@@ -419,7 +420,7 @@ add_to_queue_list(signal_user_data_t *ud, GValue *settings, GtkTreeIter *piter)
vqvalue = ghb_settings_get_int(settings, "VideoAvgBitrate");
vq_desc = "Bitrate:";
vq_units = "kbps";
- XPRINT("<small>, %s %d%s</small>\n",
+ XPRINT(", %s %d%s",
vq_desc, (int)vqvalue, vq_units);
}
else
@@ -428,9 +429,10 @@ add_to_queue_list(signal_user_data_t *ud, GValue *settings, GtkTreeIter *piter)
vqvalue = ghb_settings_get_double(settings, "VideoQualitySlider");
vq_desc = "Constant Quality:";
vq_units = hb_video_quality_get_name(video_encoder->codec);
- XPRINT("<small>, %s %.4g(%s)</small>\n",
+ XPRINT(", %s %.4g(%s)",
vq_desc, vqvalue, vq_units);
}
+ XPRINT("</small>\n");
// Next line in the display (Turbo setting)
gboolean turbo;