WinGui: Fix another instance of the Caliburn vs Json.net sillyness where objects...
[HandBrake.git] / libhb / hb.h
blobcbf25f712121205dc710041a1eff202cc175d1e3
1 /* hb.h
3 Copyright (c) 2003-2015 HandBrake Team
4 This file is part of the HandBrake source code
5 Homepage: <http://handbrake.fr/>.
6 It may be used under the terms of the GNU General Public License v2.
7 For full terms see the file COPYING file or visit http://www.gnu.org/licenses/gpl-2.0.html
8 */
10 #ifndef HB_HB_H
11 #define HB_HB_H
13 #ifdef __cplusplus
14 extern "C" {
15 #endif
17 #include "common.h"
18 #include "project.h"
19 #include "compat.h"
20 #include "hb_dict.h"
21 #include "hb_json.h"
22 #include "preset.h"
23 #include "plist.h"
24 #include "param.h"
26 /* hb_init()
27 Initializes a libhb session (launches his own thread, detects CPUs,
28 etc) */
29 #define HB_DEBUG_NONE 0
30 #define HB_DEBUG_ALL 1
31 void hb_register( hb_work_object_t * );
32 void hb_register_logger( void (*log_cb)(const char* message) );
33 hb_handle_t * hb_init( int verbose, int update_check );
34 void hb_update_poll(hb_handle_t *h);
35 void hb_log_level_set(hb_handle_t *h, int level);
37 void hb_hwd_set_enable( hb_handle_t *h, uint8_t enable );
38 int hb_hwd_enabled( hb_handle_t *h );
39 hb_hwd_t * hb_hwd_get_context();
41 /* hb_get_version() */
42 char * hb_get_version( hb_handle_t * );
43 int hb_get_build( hb_handle_t * );
45 /* hb_check_update()
46 Checks for an update on the website. If there is, returns the build
47 number and points 'version' to a version description. Returns a
48 negative value otherwise. */
49 int hb_check_update( hb_handle_t * h, char ** version );
52 char * hb_dvd_name( char * path );
53 void hb_dvd_set_dvdnav( int enable );
55 /* hb_scan()
56 Scan the specified path. Can be a DVD device, a VIDEO_TS folder or
57 a VOB file. If title_index is 0, scan all titles. */
58 void hb_scan( hb_handle_t *, const char * path,
59 int title_index, int preview_count,
60 int store_previews, uint64_t min_duration );
61 void hb_scan_stop( hb_handle_t * );
62 uint64_t hb_first_duration( hb_handle_t * );
64 /* hb_get_titles()
65 Returns the list of valid titles detected by the latest scan. */
66 hb_list_t * hb_get_titles( hb_handle_t * );
68 /* hb_get_title_set()
69 Returns the title set which contains a list of valid titles detected
70 by the latest scan and title set data. */
71 hb_title_set_t * hb_get_title_set( hb_handle_t * );
73 /* hb_detect_comb()
74 Analyze a frame for interlacing artifacts, returns true if they're found.
75 Taken from Thomas Oestreich's 32detect filter in the Transcode project. */
76 int hb_detect_comb( hb_buffer_t * buf, int color_equal, int color_diff, int threshold, int prog_equal, int prog_diff, int prog_threshold );
78 // JJJ: title->job?
79 int hb_save_preview( hb_handle_t * h, int title, int preview,
80 hb_buffer_t *buf );
81 hb_buffer_t * hb_read_preview( hb_handle_t * h, hb_title_t *title,
82 int preview );
83 hb_image_t * hb_get_preview2(hb_handle_t * h, int title_idx, int picture,
84 hb_geometry_settings_t *geo, int deinterlace);
85 void hb_set_anamorphic_size2(hb_geometry_t *src_geo,
86 hb_geometry_settings_t *geo,
87 hb_geometry_t *result);
88 void hb_add_filter( hb_job_t * job, hb_filter_object_t * filter,
89 const char * settings );
91 /* Handling jobs */
92 int hb_count( hb_handle_t * );
93 hb_job_t * hb_job( hb_handle_t *, int );
94 void hb_add( hb_handle_t *, hb_job_t * );
95 void hb_rem( hb_handle_t *, hb_job_t * );
97 hb_title_t * hb_find_title_by_index( hb_handle_t *h, int title_index );
98 hb_job_t * hb_job_init_by_index( hb_handle_t *h, int title_index );
99 hb_job_t * hb_job_init( hb_title_t * title );
100 void hb_job_close( hb_job_t ** job );
102 void hb_start( hb_handle_t * );
103 void hb_pause( hb_handle_t * );
104 void hb_resume( hb_handle_t * );
105 void hb_stop( hb_handle_t * );
107 void hb_system_sleep_allow(hb_handle_t*);
108 void hb_system_sleep_prevent(hb_handle_t*);
110 /* Persistent data between jobs. */
111 typedef struct hb_interjob_s
113 int last_job; /* job->sequence_id & 0xFFFFFF */
114 int frame_count; /* number of frames counted by sync */
115 int out_frame_count; /* number of frames counted by render */
116 uint64_t total_time; /* real length in 90kHz ticks (i.e. seconds / 90000) */
117 hb_rational_t vrate; /* actual measured output vrate from 1st pass */
119 hb_subtitle_t *select_subtitle; /* foreign language scan subtitle */
120 } hb_interjob_t;
122 hb_interjob_t * hb_interjob_get( hb_handle_t * );
124 /* hb_get_state()
125 Should be regularly called by the UI (like 5 or 10 times a second).
126 Look at test/test.c to see how to use it. */
127 void hb_get_state( hb_handle_t *, hb_state_t * );
128 void hb_get_state2( hb_handle_t *, hb_state_t * );
130 /* hb_close()
131 Aborts all current jobs if any, frees memory. */
132 void hb_close( hb_handle_t ** );
134 /* hb_global_init()
135 Performs process initialization. */
136 int hb_global_init();
137 /* hb_global_close()
138 Performs final cleanup for the process. */
139 void hb_global_close();
141 /* hb_get_instance_id()
142 Return the unique instance id of an libhb instance created by hb_init. */
143 int hb_get_instance_id( hb_handle_t * h );
145 #ifdef __cplusplus
147 #endif
149 #endif