Moves the filters' logging info to work.c, adds parameter info. I also changed the...
[HandBrake.git] / libhb / internal.h
blobb4870a128f03c403bcf7611264fcef3108027cbf
1 /* $Id: internal.h,v 1.41 2005/11/25 15:05:25 titer Exp $
3 This file is part of the HandBrake source code.
4 Homepage: <http://handbrake.m0k.org/>.
5 It may be used under the terms of the GNU General Public License. */
7 /***********************************************************************
8 * common.c
9 **********************************************************************/
10 void hb_log( char * log, ... );
12 int hb_list_bytes( hb_list_t * );
13 void hb_list_seebytes( hb_list_t * l, uint8_t * dst, int size );
14 void hb_list_getbytes( hb_list_t * l, uint8_t * dst, int size,
15 uint64_t * pts, uint64_t * pos );
16 void hb_list_empty( hb_list_t ** );
18 hb_title_t * hb_title_init( char * dvd, int index );
19 void hb_title_close( hb_title_t ** );
21 /***********************************************************************
22 * hb.c
23 **********************************************************************/
24 int hb_get_pid( hb_handle_t * );
25 void hb_set_state( hb_handle_t *, hb_state_t * );
27 /***********************************************************************
28 * fifo.c
29 **********************************************************************/
30 struct hb_buffer_s
32 int size;
33 int alloc;
34 uint8_t * data;
35 int cur;
37 int id;
38 int64_t start;
39 int64_t stop;
40 int new_chap;
42 #define HB_FRAME_IDR 0x01
43 #define HB_FRAME_I 0x02
44 #define HB_FRAME_AUDIO 0x04
45 #define HB_FRAME_P 0x10
46 #define HB_FRAME_B 0x20
47 #define HB_FRAME_BREF 0x40
48 #define HB_FRAME_KEY 0x0F
49 #define HB_FRAME_REF 0xF0
50 uint8_t frametype;
51 uint8_t flags;
53 /* Holds the output PTS from x264, for use by b-frame offsets in muxmp4.c */
54 int64_t renderOffset;
56 int x;
57 int y;
58 int width;
59 int height;
61 hb_buffer_t * sub;
63 hb_buffer_t * next;
66 hb_buffer_t * hb_buffer_init( int size );
67 void hb_buffer_realloc( hb_buffer_t *, int size );
68 void hb_buffer_close( hb_buffer_t ** );
69 void hb_buffer_copy_settings( hb_buffer_t * dst,
70 const hb_buffer_t * src );
72 hb_fifo_t * hb_fifo_init();
73 int hb_fifo_size( hb_fifo_t * );
74 int hb_fifo_is_full( hb_fifo_t * );
75 float hb_fifo_percent_full( hb_fifo_t * f );
76 hb_buffer_t * hb_fifo_get( hb_fifo_t * );
77 hb_buffer_t * hb_fifo_see( hb_fifo_t * );
78 hb_buffer_t * hb_fifo_see2( hb_fifo_t * );
79 void hb_fifo_push( hb_fifo_t *, hb_buffer_t * );
80 void hb_fifo_close( hb_fifo_t ** );
82 /***********************************************************************
83 * Threads: update.c, scan.c, work.c, reader.c, muxcommon.c
84 **********************************************************************/
85 hb_thread_t * hb_update_init( int * build, char * version );
86 hb_thread_t * hb_scan_init( hb_handle_t *, const char * path,
87 int title_index, hb_list_t * list_title );
88 hb_thread_t * hb_work_init( hb_list_t * jobs, int cpu_count,
89 volatile int * die, int * error );
90 hb_thread_t * hb_reader_init( hb_job_t * );
91 hb_thread_t * hb_muxer_init( hb_job_t * );
93 /***********************************************************************
94 * libmpeg2 wrapper
95 ***********************************************************************
96 * It is exported here because it is used at several places
97 **********************************************************************/
98 typedef struct hb_libmpeg2_s hb_libmpeg2_t;
100 hb_libmpeg2_t * hb_libmpeg2_init();
101 int hb_libmpeg2_decode( hb_libmpeg2_t *,
102 hb_buffer_t * es_buf,
103 hb_list_t * raw_list );
104 void hb_libmpeg2_info( hb_libmpeg2_t * m, int * width,
105 int * height, int * rate, int * aspect_ratio );
106 void hb_libmpeg2_close( hb_libmpeg2_t ** );
108 /***********************************************************************
109 * mpegdemux.c
110 **********************************************************************/
111 int hb_demux_ps( hb_buffer_t * ps_buf, hb_list_t * es_list );
113 /***********************************************************************
114 * dvd.c
115 **********************************************************************/
116 typedef struct hb_dvd_s hb_dvd_t;
117 typedef struct hb_stream_s hb_stream_t;
119 hb_dvd_t * hb_dvd_init( char * path );
120 int hb_dvd_title_count( hb_dvd_t * );
121 hb_title_t * hb_dvd_title_scan( hb_dvd_t *, int title );
122 int hb_dvd_start( hb_dvd_t *, int title, int chapter );
123 void hb_dvd_stop( hb_dvd_t * );
124 int hb_dvd_seek( hb_dvd_t *, float );
125 int hb_dvd_read( hb_dvd_t *, hb_buffer_t * );
126 int hb_dvd_chapter( hb_dvd_t * );
127 int hb_dvd_is_break( hb_dvd_t * d );
128 void hb_dvd_close( hb_dvd_t ** );
130 int hb_stream_is_stream_type( char * path);
131 hb_stream_t * hb_stream_open( char * path );
132 void hb_stream_close( hb_stream_t ** );
133 hb_title_t * hb_stream_title_scan( hb_stream_t *);
134 int hb_stream_read( hb_stream_t *, hb_buffer_t *);
135 int hb_stream_seek( hb_stream_t *, float );
136 void hb_stream_update_audio( hb_stream_t *, hb_audio_t *);
137 void hb_stream_set_selected_audio_pid_index(hb_stream_t *, int);
139 /***********************************************************************
140 * Work objects
141 **********************************************************************/
142 #define HB_CONFIG_MAX_SIZE 8192
143 union hb_esconfig_u
146 struct
148 uint8_t bytes[HB_CONFIG_MAX_SIZE];
149 int length;
150 } mpeg4;
152 struct
154 uint8_t sps[HB_CONFIG_MAX_SIZE];
155 int sps_length;
156 uint8_t pps[HB_CONFIG_MAX_SIZE];
157 int pps_length;
158 } h264;
160 struct
162 uint8_t bytes[HB_CONFIG_MAX_SIZE];
163 int length;
164 } aac;
166 struct
168 uint8_t headers[3][HB_CONFIG_MAX_SIZE];
169 char *language;
170 } vorbis;
172 struct
174 /* ac3flags stores the flags from the AC3 source, as found in scan.c */
175 int ac3flags;
176 } a52;
178 struct
180 /* dcaflags stores the flags from the DCA source, as found in scan.c */
181 int dcaflags;
182 } dca;
186 enum
188 WORK_SYNC = 1,
189 WORK_DECMPEG2,
190 WORK_DECSUB,
191 WORK_RENDER,
192 WORK_ENCAVCODEC,
193 WORK_ENCXVID,
194 WORK_ENCX264,
195 WORK_DECA52,
196 WORK_DECDCA,
197 WORK_DECAVCODEC,
198 WORK_DECLPCM,
199 WORK_ENCFAAC,
200 WORK_ENCLAME,
201 WORK_ENCVORBIS
204 enum
206 FILTER_DEINTERLACE = 1,
207 FILTER_DEBLOCK,
208 FILTER_DENOISE,
209 FILTER_DETELECINE
212 extern hb_work_object_t * hb_objects;
214 #define HB_WORK_IDLE 0
215 #define HB_WORK_OK 1
216 #define HB_WORK_ERROR 2
217 #define HB_WORK_DONE 3
219 /***********************************************************************
220 * Muxers
221 **********************************************************************/
222 typedef struct hb_mux_object_s hb_mux_object_t;
223 typedef struct hb_mux_data_s hb_mux_data_t;
225 #define HB_MUX_COMMON \
226 int (*init) ( hb_mux_object_t * ); \
227 int (*mux) ( hb_mux_object_t *, hb_mux_data_t *, \
228 hb_buffer_t * ); \
229 int (*end) ( hb_mux_object_t * );
231 #define DECLARE_MUX( a ) \
232 hb_mux_object_t * hb_mux_##a##_init( hb_job_t * );
234 DECLARE_MUX( mp4 );
235 DECLARE_MUX( avi );
236 DECLARE_MUX( ogm );
237 DECLARE_MUX( mkv );