diff options
author | Justin Bull <[email protected]> | 2019-02-13 09:52:48 -0500 |
---|---|---|
committer | John Stebbins <[email protected]> | 2019-02-13 06:52:48 -0800 |
commit | d0e37ca0d75fbcef5bdf47aafe8543e262314ec5 (patch) | |
tree | e2766be1f7734793f992bf4c1dbd4ede1b97e086 /gtk/src | |
parent | 7cc7d562b6c67c875b684a48451910af37b3fda7 (diff) |
Add WebM support (#1822)
Note that since webm has no official subtitle support, only burned in subtitles can be used with this muxer at this time.
Diffstat (limited to 'gtk/src')
-rw-r--r-- | gtk/src/callbacks.c | 2 | ||||
-rw-r--r-- | gtk/src/ghb.m4 | 1 | ||||
-rw-r--r-- | gtk/src/hb-backend.c | 58 | ||||
-rw-r--r-- | gtk/src/main.c | 5 |
4 files changed, 63 insertions, 3 deletions
diff --git a/gtk/src/callbacks.c b/gtk/src/callbacks.c index 60e4a2b1a..f8614d13c 100644 --- a/gtk/src/callbacks.c +++ b/gtk/src/callbacks.c @@ -1934,7 +1934,7 @@ dvd_source_activate_cb(GtkWidget *widget, signal_user_data_t *ud) void ghb_update_destination_extension(signal_user_data_t *ud) { - static gchar *containers[] = {".mkv", ".mp4", ".m4v", ".error", NULL}; + static gchar *containers[] = {".mkv", ".mp4", ".m4v", ".webm", ".error", NULL}; gchar *filename; const gchar *extension; gint ii; diff --git a/gtk/src/ghb.m4 b/gtk/src/ghb.m4 index d9dea4c8a..108a89aef 100644 --- a/gtk/src/ghb.m4 +++ b/gtk/src/ghb.m4 @@ -16,6 +16,7 @@ filter_output([ <object class="GtkFileFilter" id="SourceFilterEVO"/> <object class="GtkFileFilter" id="SourceFilterFLV"/> <object class="GtkFileFilter" id="SourceFilterMKV"/> + <object class="GtkFileFilter" id="SourceFilterWebM"/> <object class="GtkFileFilter" id="SourceFilterMOV"/> <object class="GtkFileFilter" id="SourceFilterMP4"/> <object class="GtkFileFilter" id="SourceFilterMPG"/> diff --git a/gtk/src/hb-backend.c b/gtk/src/hb-backend.c index e433d50de..a638487f6 100644 --- a/gtk/src/hb-backend.c +++ b/gtk/src/hb-backend.c @@ -4298,6 +4298,8 @@ ghb_validate_video(GhbValue *settings, GtkWindow *parent) mux_id = ghb_dict_get_string(settings, "FileFormat"); mux = ghb_lookup_container_by_name(mux_id); + gboolean v_unsup = FALSE; + vcodec = ghb_settings_video_encoder_codec(settings, "VideoEncoder"); if ((mux->format & HB_MUX_MASK_MP4) && (vcodec == HB_VCODEC_THEORA)) { @@ -4306,6 +4308,21 @@ ghb_validate_video(GhbValue *settings, GtkWindow *parent) _("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.")); + v_unsup = TRUE; + } + else if ((mux->format & HB_MUX_MASK_WEBM) && + (vcodec != HB_VCODEC_FFMPEG_VP8 && vcodec != HB_VCODEC_FFMPEG_VP9)) + { + // webm only supports vp8 and vp9. + message = g_strdup_printf( + _("Only VP8 or VP9 is supported in the WebM container.\n\n" + "You should choose a different video codec or container.\n" + "If you continue, one will be chosen for you.")); + v_unsup = TRUE; + } + + if (v_unsup) + { if (!ghb_message_dialog(parent, GTK_MESSAGE_WARNING, message, _("Cancel"), _("Continue"))) { @@ -4317,6 +4334,7 @@ ghb_validate_video(GhbValue *settings, GtkWindow *parent) ghb_dict_set_string(settings, "VideoEncoder", hb_video_encoder_get_short_name(vcodec)); } + return TRUE; } @@ -4340,6 +4358,12 @@ ghb_validate_subtitles(GhbValue *settings, GtkWindow *parent) gint count, ii, track; gboolean burned, one_burned = FALSE; + const char *mux_id; + const hb_container_t *mux; + + mux_id = ghb_dict_get_string(settings, "FileFormat"); + mux = ghb_lookup_container_by_name(mux_id); + slist = ghb_get_job_subtitle_list(settings); count = ghb_array_len(slist); for (ii = 0; ii < count; ii++) @@ -4369,6 +4393,22 @@ ghb_validate_subtitles(GhbValue *settings, GtkWindow *parent) { one_burned = TRUE; } + else if (mux->format & HB_MUX_MASK_WEBM) + { + // WebM can only handle burned subs afaik. Their specs are ambiguous here + message = g_strdup_printf( + _("WebM in HandBrake only supports burned subtitles.\n\n" + "You should change your subtitle selections.\n" + "If you continue, some subtitles will be lost.")); + if (!ghb_message_dialog(parent, GTK_MESSAGE_WARNING, + message, _("Cancel"), _("Continue"))) + { + g_free(message); + return FALSE; + } + g_free(message); + break; + } if (import != NULL) { const gchar *filename; @@ -4457,6 +4497,10 @@ ghb_validate_audio(GhbValue *settings, GtkWindow *parent) { codec = HB_ACODEC_LAME; } + else if (mux->format & HB_MUX_MASK_WEBM) + { + codec = hb_audio_encoder_get_default(mux->format); + } else { codec = HB_ACODEC_FFAAC; @@ -4464,8 +4508,8 @@ ghb_validate_audio(GhbValue *settings, GtkWindow *parent) const char *name = hb_audio_encoder_get_short_name(codec); ghb_dict_set_string(asettings, "Encoder", name); } - gchar *a_unsup = NULL; - gchar *mux_s = NULL; + const gchar *a_unsup = NULL; + const gchar *mux_s = NULL; if (mux->format & HB_MUX_MASK_MP4) { mux_s = "MP4"; @@ -4476,6 +4520,16 @@ ghb_validate_audio(GhbValue *settings, GtkWindow *parent) codec = HB_ACODEC_FFAAC; } } + if (mux->format & HB_MUX_MASK_WEBM) + { + mux_s = "WebM"; + // WebM only supports Vorbis and Opus codecs + if (codec != HB_ACODEC_VORBIS && codec != HB_ACODEC_OPUS) + { + a_unsup = hb_audio_encoder_get_short_name(codec); + codec = hb_audio_encoder_get_default(mux->format); + } + } if (a_unsup) { message = g_strdup_printf( diff --git a/gtk/src/main.c b/gtk/src/main.c index e82360668..dd86cf242 100644 --- a/gtk/src/main.c +++ b/gtk/src/main.c @@ -1126,6 +1126,7 @@ ghb_activate_cb(GApplication * app, signal_user_data_t * ud) SourceFilterEVO SourceFilterVOB SourceFilterMKV + SourceFilterWebM SourceFilterMP4 SourceFilterAVI SourceFilterMOV @@ -1174,6 +1175,10 @@ ghb_activate_cb(GApplication * app, signal_user_data_t * ud) 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, "SourceFilterWebM")); + gtk_file_filter_set_name(filter, "WebM"); + gtk_file_filter_add_pattern(filter, "*.webm"); + 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"); |