MCPcopy Create free account
hub / github.com/HandBrake/HandBrake / ghb_validate_video

Function ghb_validate_video

gtk/src/hb-backend.c:4556–4600  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4554}
4555
4556gboolean
4557ghb_validate_video(GhbValue *settings, GtkWindow *parent)
4558{
4559 gint vcodec;
4560 const char *message, *mux_id;
4561 const hb_container_t *mux;
4562
4563 mux_id = ghb_dict_get_string(settings, "FileFormat");
4564 mux = ghb_lookup_container_by_name(mux_id);
4565
4566 gboolean v_unsup = FALSE;
4567
4568 vcodec = ghb_settings_video_encoder_codec(settings, "VideoEncoder");
4569 if ((mux->format & HB_MUX_MASK_MP4) && (vcodec == HB_VCODEC_THEORA))
4570 {
4571 // mp4/theora combination is not supported.
4572 message = _("Theora is not supported in the MP4 container.\n\n"
4573 "You should choose a different video codec or container.\n"
4574 "If you continue, FFMPEG will be chosen for you.");
4575 v_unsup = TRUE;
4576 }
4577 else if ((mux->format & HB_MUX_MASK_WEBM) &&
4578 (vcodec != HB_VCODEC_FFMPEG_VP8 && vcodec != HB_VCODEC_FFMPEG_VP9 && vcodec != HB_VCODEC_FFMPEG_VP9_10BIT && vcodec != HB_VCODEC_SVT_AV1 && vcodec != HB_VCODEC_SVT_AV1_10BIT))
4579 {
4580 // webm only supports vp8, vp9 and av1.
4581 message = _("Only VP8, VP9 and AV1 is supported in the WebM container.\n\n"
4582 "You should choose a different video codec or container.\n"
4583 "If you continue, one will be chosen for you.");
4584 v_unsup = TRUE;
4585 }
4586
4587 if (v_unsup)
4588 {
4589 if (!ghb_question_dialog_run(parent, GHB_ACTION_NORMAL, _("Continue"),
4590 _("Cancel"), _("Invalid Video Codec"), "%s", message))
4591 {
4592 return FALSE;
4593 }
4594 vcodec = hb_video_encoder_get_default(mux->format);
4595 ghb_dict_set_string(settings, "VideoEncoder",
4596 hb_video_encoder_get_short_name(vcodec));
4597 }
4598
4599 return TRUE;
4600}
4601
4602gboolean
4603ghb_validate_subtitles(GhbValue *settings, GtkWindow *parent)

Callers 1

validate_settingsFunction · 0.85

Tested by

no test coverage detected