| 2679 | } |
| 2680 | |
| 2681 | void |
| 2682 | ghb_set_title_settings(signal_user_data_t *ud, GhbValue *settings) |
| 2683 | { |
| 2684 | int title_id, titleindex; |
| 2685 | const hb_title_t * title; |
| 2686 | |
| 2687 | title_id = ghb_dict_get_int(settings, "title"); |
| 2688 | title = ghb_lookup_title(title_id, &titleindex); |
| 2689 | |
| 2690 | ghb_subtitle_set_pref_lang(settings); |
| 2691 | if (title != NULL) |
| 2692 | { |
| 2693 | GhbValue * job_dict, * title_dict; |
| 2694 | char * label; |
| 2695 | |
| 2696 | job_dict = hb_preset_job_init(ghb_scan_handle(), title_id, settings); |
| 2697 | ghb_dict_set(settings, "Job", job_dict); |
| 2698 | title_dict = hb_title_to_dict(ghb_scan_handle(), title_id); |
| 2699 | ghb_dict_set(settings, "Title", title_dict); |
| 2700 | |
| 2701 | GhbValue *chapter_list = ghb_get_job_chapter_list(settings); |
| 2702 | gint num_chapters = ghb_array_len(chapter_list); |
| 2703 | |
| 2704 | ghb_dict_set_int(settings, "angle", 1); |
| 2705 | ghb_dict_set_string(settings, "PtoPType", "chapter"); |
| 2706 | ghb_dict_set_int(settings, "start_point", 1); |
| 2707 | ghb_dict_set_int(settings, "end_point", num_chapters); |
| 2708 | ghb_dict_set_int(settings, "source_width", title->geometry.width); |
| 2709 | ghb_dict_set_int(settings, "source_height", title->geometry.height); |
| 2710 | ghb_dict_set_string(settings, "source", title->path); |
| 2711 | label = ghb_create_source_label(title); |
| 2712 | ghb_dict_set_string(settings, "source_label", label); |
| 2713 | g_free(label); |
| 2714 | label = ghb_create_volume_label(title); |
| 2715 | ghb_dict_set_string(settings, "volume", label); |
| 2716 | g_free(label); |
| 2717 | |
| 2718 | |
| 2719 | int angle, hflip; |
| 2720 | hb_geometry_crop_t srcGeo; |
| 2721 | |
| 2722 | srcGeo.geometry = title->geometry; |
| 2723 | memcpy(srcGeo.crop, &title->crop, 4 * sizeof(int)); |
| 2724 | angle = ghb_dict_get_int(settings, "rotate"); |
| 2725 | hflip = ghb_dict_get_int(settings, "hflip"); |
| 2726 | hb_rotate_geometry(&srcGeo, &srcGeo, angle, hflip); |
| 2727 | ghb_apply_crop(settings, &srcGeo, title); |
| 2728 | |
| 2729 | int crop[4]; |
| 2730 | |
| 2731 | crop[0] = ghb_dict_get_int(settings, "PictureTopCrop"); |
| 2732 | crop[1] = ghb_dict_get_int(settings, "PictureBottomCrop"); |
| 2733 | crop[2] = ghb_dict_get_int(settings, "PictureLeftCrop"); |
| 2734 | crop[3] = ghb_dict_get_int(settings, "PictureRightCrop"); |
| 2735 | ghb_dict_set_int(settings, "scale_width", |
| 2736 | srcGeo.geometry.width - crop[2] - crop[3]); |
| 2737 | |
| 2738 | // If anamorphic or keep_aspect, the height will |
no test coverage detected