OSDN Git Service

WinGui:
[handbrake-jp/handbrake-jp-git.git] / libhb / hb.h
1 #ifndef HB_HB_H
2 #define HB_HB_H
3
4 #ifdef __cplusplus
5 extern "C" {
6 #endif
7
8 #include "project.h"
9 #include "common.h"
10
11 /* hb_init()
12    Initializes a libhb session (launches his own thread, detects CPUs,
13    etc) */
14 #define HB_DEBUG_NONE 0
15 #define HB_DEBUG_ALL  1
16 void          hb_register( hb_work_object_t * );
17 void          hb_register_logger( void (*log_cb)(const char* message) );
18 hb_handle_t * hb_init( int verbose, int update_check );
19 hb_handle_t * hb_init_dl ( int verbose, int update_check ); // hb_init for use with dylib
20
21 /* hb_get_version() */
22 char        * hb_get_version( hb_handle_t * );
23 int           hb_get_build( hb_handle_t * );
24
25 /* hb_check_update()
26    Checks for an update on the website. If there is, returns the build
27    number and points 'version' to a version description. Returns a
28    negative value otherwise. */
29 int           hb_check_update( hb_handle_t * h, char ** version );
30
31 /* hb_set_cpu_count()
32    Force libhb to act as if you had X CPU(s).
33    Default is to use the detected count (see also hb_get_cpu_count() in
34    ports.h) */
35 void          hb_set_cpu_count( hb_handle_t *, int );
36
37 char *        hb_dvd_name( char * path );
38 void          hb_dvd_set_dvdnav( int enable );
39
40 /* hb_scan()
41    Scan the specified path. Can be a DVD device, a VIDEO_TS folder or
42    a VOB file. If title_index is 0, scan all titles. */
43 void          hb_scan( hb_handle_t *, const char * path,
44                        int title_index, int preview_count,
45                        int store_previews, uint64_t min_duration );
46 void          hb_scan_stop( hb_handle_t * );
47 hb_filter_object_t * hb_get_filter_object(int filter_id, const char * settings);
48 uint64_t      hb_first_duration( hb_handle_t * );
49
50 /* hb_get_titles()
51    Returns the list of valid titles detected by the latest scan. */
52 hb_list_t   * hb_get_titles( hb_handle_t * );
53
54 /* hb_detect_comb()
55    Analyze a frame for interlacing artifacts, returns true if they're found.
56    Taken from Thomas Oestreich's 32detect filter in the Transcode project.  */
57 int hb_detect_comb( hb_buffer_t * buf, int width, int height, int color_equal, int color_diff, int threshold, int prog_equal, int prog_diff, int prog_threshold );
58
59 void          hb_get_preview_by_index( hb_handle_t *, int, int, uint8_t * );
60 void          hb_get_preview( hb_handle_t *, hb_title_t *, int,
61                               uint8_t * );
62 void          hb_set_size( hb_job_t *, double ratio, int pixels );
63 void          hb_set_anamorphic_size_by_index( hb_handle_t *, int,
64                 int *output_width, int *output_height,
65                 int *output_par_width, int *output_par_height );
66 void          hb_set_anamorphic_size( hb_job_t *,
67                 int *output_width, int *output_height,
68                 int *output_par_width, int *output_par_height );
69
70 /* Handling jobs */
71 int           hb_count( hb_handle_t * );
72 hb_job_t *    hb_job( hb_handle_t *, int );
73 void          hb_set_chapter_name( hb_handle_t *, int, int, const char * );
74 void          hb_set_job( hb_handle_t *, int, hb_job_t * );
75 void          hb_add( hb_handle_t *, hb_job_t * );
76 void          hb_rem( hb_handle_t *, hb_job_t * );
77
78 void          hb_start( hb_handle_t * );
79 void          hb_pause( hb_handle_t * );
80 void          hb_resume( hb_handle_t * );
81 void          hb_stop( hb_handle_t * );
82
83 /* Persistent data between jobs. */
84 typedef struct hb_interjob_s
85 {
86     int last_job;          /* job->sequence_id & 0xFFFFFF */
87     int frame_count;       /* number of frames counted by sync */
88     uint64_t total_time;   /* real length in 90khz (i.e. / 90000 */
89     int render_dropped;    /* frames droped by telecine */
90     int vrate;             /* initial assigned vrate */
91     int vrate_base;        /* initial assigned vrate_base */
92
93     hb_subtitle_t *select_subtitle; /* foreign language scan subtitle */
94 } hb_interjob_t;
95
96 hb_interjob_t * hb_interjob_get( hb_handle_t * ); 
97
98 /* hb_get_state()
99    Should be regularly called by the UI (like 5 or 10 times a second).
100    Look at test/test.c to see how to use it. */
101 void hb_get_state( hb_handle_t *, hb_state_t * );
102 void hb_get_state2( hb_handle_t *, hb_state_t * );
103 /* hb_get_scancount() is called by the MacGui in UpdateUI to
104    check for a new scan during HB_STATE_WORKING phase  */
105 int hb_get_scancount( hb_handle_t * );
106
107 /* hb_close()
108    Aborts all current jobs if any, frees memory. */
109 void          hb_close( hb_handle_t ** );
110
111 /* hb_global_close()
112    Performs final cleanup for the process. */
113 void          hb_global_close();
114
115 /* hb_get_instance_id()
116    Return the unique instance id of an libhb instance created by hb_init. */
117 int hb_get_instance_id( hb_handle_t * h );
118
119 #ifdef __cplusplus
120 }
121 #endif
122
123 #endif