OSDN Git Service

2603c1a5f7164d02246c1ccf31efde6eccc96307
[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 hb_handle_t * hb_init( int verbose, int update_check );
18 hb_handle_t * hb_init_dl ( int verbose, int update_check ); // hb_init for use with dylib
19
20 /* hb_get_version() */
21 char        * hb_get_version( hb_handle_t * );
22 int           hb_get_build( hb_handle_t * );
23
24 /* hb_check_update()
25    Checks for an update on the website. If there is, returns the build
26    number and points 'version' to a version description. Returns a
27    negative value otherwise. */
28 int           hb_check_update( hb_handle_t * h, char ** version );
29         
30         int hello_world();
31
32 /* hb_set_cpu_count()
33    Force libhb to act as if you had X CPU(s).
34    Default is to use the detected count (see also hb_get_cpu_count() in
35    ports.h) */
36 void          hb_set_cpu_count( hb_handle_t *, int );
37
38 char *        hb_dvd_name( char * path );
39 void          hb_dvd_set_dvdnav( int enable );
40
41 /* hb_scan()
42    Scan the specified path. Can be a DVD device, a VIDEO_TS folder or
43    a VOB file. If title_index is 0, scan all titles. */
44 void          hb_scan( hb_handle_t *, const char * path,
45                        int title_index, int preview_count,
46                        int store_previews );
47 void          hb_scan_stop( hb_handle_t * );
48
49 /* hb_get_titles()
50    Returns the list of valid titles detected by the latest scan. */
51 hb_list_t   * hb_get_titles( hb_handle_t * );
52
53 /* hb_detect_comb()
54    Analyze a frame for interlacing artifacts, returns true if they're found.
55    Taken from Thomas Oestreich's 32detect filter in the Transcode project.  */
56 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 );
57
58 void          hb_get_preview( hb_handle_t *, hb_title_t *, int,
59                               uint8_t * );
60 void          hb_set_size( hb_job_t *, double ratio, int pixels );
61 void          hb_set_anamorphic_size( hb_job_t *,
62                 int *output_width, int *output_height,
63                 int *output_par_width, int *output_par_height);
64
65 /* Handling jobs */
66 int           hb_count( hb_handle_t * );
67 hb_job_t *    hb_job( hb_handle_t *, int );
68 void          hb_add( hb_handle_t *, hb_job_t * );
69 void          hb_rem( hb_handle_t *, hb_job_t * );
70
71 void          hb_start( hb_handle_t * );
72 void          hb_pause( hb_handle_t * );
73 void          hb_resume( hb_handle_t * );
74 void          hb_stop( hb_handle_t * );
75
76 /* Persistent data between jobs. */
77 typedef struct hb_interjob_s
78 {
79     int last_job;          /* job->sequence_id & 0xFFFFFF */
80     int frame_count;       /* number of frames counted by sync */
81     uint64_t total_time;   /* real length in 90khz (i.e. / 90000 */
82     int render_dropped;    /* frames droped by telecine */
83     int vrate;             /* initial assigned vrate */
84     int vrate_base;        /* initial assigned vrate_base */
85
86     hb_subtitle_t *select_subtitle; /* foreign language scan subtitle */
87 } hb_interjob_t;
88
89 hb_interjob_t * hb_interjob_get( hb_handle_t * ); 
90
91 /* hb_get_state()
92    Should be regularly called by the UI (like 5 or 10 times a second).
93    Look at test/test.c to see how to use it. */
94 void hb_get_state( hb_handle_t *, hb_state_t * );
95 void hb_get_state2( hb_handle_t *, hb_state_t * );
96 /* hb_get_scancount() is called by the MacGui in UpdateUI to
97    check for a new scan during HB_STATE_WORKING phase  */
98 int hb_get_scancount( hb_handle_t * );
99
100 /* hb_close()
101    Aborts all current jobs if any, frees memory. */
102 void          hb_close( hb_handle_t ** );
103
104 #ifdef __cplusplus
105 }
106 #endif
107
108 #endif