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

Function live_preview_play_clicked_cb

gtk/src/preview.c:403–454  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

401}
402
403G_MODULE_EXPORT void
404live_preview_play_clicked_cb (GtkWidget *widget, gpointer data)
405{
406 signal_user_data_t *ud = ghb_ud();
407 gint frame = ud->preview->frame;
408 const char *tmp_dir = ghb_get_tmp_dir();
409 char *name = g_strdup_printf("%s/live%02d", tmp_dir, ud->preview->frame);
410 if (ud->preview->current)
411 g_free(ud->preview->current);
412 ud->preview->current = name;
413
414 if (ud->preview->encoded[frame] &&
415 g_file_test(name, G_FILE_TEST_IS_REGULAR))
416 {
417 live_preview_toggle_playback(ud);
418 }
419 else if (ud->preview->live_id < 0)
420 {
421 GhbValue *js;
422 GhbValue *range, *dest;
423
424 ud->preview->encode_frame = frame;
425 js = ghb_value_dup(ud->settings);
426
427 ghb_finalize_job(js);
428 range = ghb_get_job_range_settings(js);
429 dest = ghb_get_job_dest_settings(js);
430
431 ghb_dict_set_string(dest, "File", name);
432 ghb_dict_set_string(range, "Type", "preview");
433 ghb_dict_set_int(range, "Start", ud->preview->frame + 1);
434 ghb_dict_set_int(range, "End",
435 ghb_dict_get_int(ud->prefs, "live_duration") * 90000);
436 ghb_dict_set_int(range, "SeekPoints",
437 ghb_dict_get_int(ud->prefs, "preview_count"));
438
439 GhbValue *job_dict = ghb_dict_get(js, "Job");
440 ud->preview->live_id = ghb_add_job(ghb_live_handle(), job_dict);
441 ghb_start_live_encode();
442 ghb_value_free(&js);
443
444 live_preview_set_state(PREVIEW_STATE_ENCODING);
445 }
446 else
447 {
448 // An encode is running, stop it
449 ghb_stop_live_encode();
450 ud->preview->live_id = -1;
451 ud->preview->encode_frame = -1;
452 live_preview_set_state(PREVIEW_STATE_STOPPED);
453 }
454}
455
456void
457ghb_live_encode_done(signal_user_data_t *ud, gboolean success)

Callers

nothing calls this directly

Calls 14

ghb_udFunction · 0.85
ghb_get_tmp_dirFunction · 0.85
ghb_finalize_jobFunction · 0.85
ghb_dict_set_stringFunction · 0.85
ghb_dict_set_intFunction · 0.85
ghb_dict_get_intFunction · 0.85
ghb_add_jobFunction · 0.85
ghb_live_handleFunction · 0.85
ghb_start_live_encodeFunction · 0.85

Tested by

no test coverage detected