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 /***********************************************************************
9 **********************************************************************/
10 void hb_log( char * log, ... );
11 void hb_error( char * fmt, ...);
13 int hb_list_bytes( hb_list_t * );
14 void hb_list_seebytes( hb_list_t * l, uint8_t * dst, int size );
15 void hb_list_getbytes( hb_list_t * l, uint8_t * dst, int size,
16 uint64_t * pts, uint64_t * pos );
17 void hb_list_empty( hb_list_t ** );
19 hb_title_t * hb_title_init( char * dvd, int index );
20 void hb_title_close( hb_title_t ** );
22 void hb_filter_close( hb_filter_object_t ** );
24 /***********************************************************************
26 **********************************************************************/
27 int hb_get_pid( hb_handle_t * );
28 void hb_set_state( hb_handle_t *, hb_state_t * );
30 /***********************************************************************
32 **********************************************************************/
47 #define HB_FRAME_IDR 0x01
48 #define HB_FRAME_I 0x02
49 #define HB_FRAME_AUDIO 0x04
50 #define HB_FRAME_P 0x10
51 #define HB_FRAME_B 0x20
52 #define HB_FRAME_BREF 0x40
53 #define HB_FRAME_KEY 0x0F
54 #define HB_FRAME_REF 0xF0
58 /* Holds the output PTS from x264, for use by b-frame offsets in muxmp4.c */
71 void hb_buffer_pool_init( void );
72 void hb_buffer_pool_free( void );
74 hb_buffer_t * hb_buffer_init( int size );
75 void hb_buffer_realloc( hb_buffer_t *, int size );
76 void hb_buffer_close( hb_buffer_t ** );
77 void hb_buffer_copy_settings( hb_buffer_t * dst,
78 const hb_buffer_t * src );
80 hb_fifo_t * hb_fifo_init();
81 int hb_fifo_size( hb_fifo_t * );
82 int hb_fifo_is_full( hb_fifo_t * );
83 float hb_fifo_percent_full( hb_fifo_t * f );
84 hb_buffer_t * hb_fifo_get( hb_fifo_t * );
85 hb_buffer_t * hb_fifo_see( hb_fifo_t * );
86 hb_buffer_t * hb_fifo_see2( hb_fifo_t * );
87 void hb_fifo_push( hb_fifo_t *, hb_buffer_t * );
88 void hb_fifo_close( hb_fifo_t ** );
90 /***********************************************************************
91 * Threads: update.c, scan.c, work.c, reader.c, muxcommon.c
92 **********************************************************************/
93 hb_thread_t * hb_update_init( int * build, char * version );
94 hb_thread_t * hb_scan_init( hb_handle_t *, const char * path,
95 int title_index, hb_list_t * list_title );
96 hb_thread_t * hb_work_init( hb_list_t * jobs, int cpu_count,
97 volatile int * die, int * error, hb_job_t ** job );
98 hb_thread_t * hb_reader_init( hb_job_t * );
99 hb_thread_t * hb_muxer_init( hb_job_t * );
101 /***********************************************************************
103 ***********************************************************************
104 * It is exported here because it is used at several places
105 **********************************************************************/
106 typedef struct hb_libmpeg2_s hb_libmpeg2_t;
108 hb_libmpeg2_t * hb_libmpeg2_init();
109 int hb_libmpeg2_decode( hb_libmpeg2_t *,
110 hb_buffer_t * es_buf,
111 hb_list_t * raw_list );
112 void hb_libmpeg2_info( hb_libmpeg2_t * m, int * width,
113 int * height, int * rate, int * aspect_ratio );
114 void hb_libmpeg2_close( hb_libmpeg2_t ** );
116 /***********************************************************************
118 **********************************************************************/
119 int hb_demux_ps( hb_buffer_t * ps_buf, hb_list_t * es_list );
121 /***********************************************************************
123 **********************************************************************/
124 typedef struct hb_dvd_s hb_dvd_t;
125 typedef struct hb_stream_s hb_stream_t;
127 hb_dvd_t * hb_dvd_init( char * path );
128 int hb_dvd_title_count( hb_dvd_t * );
129 hb_title_t * hb_dvd_title_scan( hb_dvd_t *, int title );
130 int hb_dvd_start( hb_dvd_t *, int title, int chapter );
131 void hb_dvd_stop( hb_dvd_t * );
132 int hb_dvd_seek( hb_dvd_t *, float );
133 int hb_dvd_read( hb_dvd_t *, hb_buffer_t * );
134 int hb_dvd_chapter( hb_dvd_t * );
135 int hb_dvd_is_break( hb_dvd_t * d );
136 void hb_dvd_close( hb_dvd_t ** );
138 hb_stream_t * hb_stream_open( char * path );
139 void hb_stream_close( hb_stream_t ** );
140 hb_title_t * hb_stream_title_scan( hb_stream_t *);
141 int hb_stream_read( hb_stream_t *, hb_buffer_t *);
142 int hb_stream_seek( hb_stream_t *, float );
143 void hb_stream_update_audio( hb_stream_t *, hb_audio_t *);
145 /***********************************************************************
147 **********************************************************************/
148 #define HB_CONFIG_MAX_SIZE 8192
154 uint8_t bytes[HB_CONFIG_MAX_SIZE];
160 uint8_t sps[HB_CONFIG_MAX_SIZE];
162 uint8_t pps[HB_CONFIG_MAX_SIZE];
168 uint8_t bytes[HB_CONFIG_MAX_SIZE];
174 uint8_t headers[3][HB_CONFIG_MAX_SIZE];
180 /* ac3flags stores the flags from the AC3 source, as found in scan.c */
186 /* dcaflags stores the flags from the DCA source, as found in scan.c */
212 FILTER_DEINTERLACE = 1,
218 extern hb_work_object_t * hb_objects;
220 #define HB_WORK_IDLE 0
222 #define HB_WORK_ERROR 2
223 #define HB_WORK_DONE 3
225 /***********************************************************************
227 **********************************************************************/
228 typedef struct hb_mux_object_s hb_mux_object_t;
229 typedef struct hb_mux_data_s hb_mux_data_t;
231 #define HB_MUX_COMMON \
232 int (*init) ( hb_mux_object_t * ); \
233 int (*mux) ( hb_mux_object_t *, hb_mux_data_t *, \
235 int (*end) ( hb_mux_object_t * );
237 #define DECLARE_MUX( a ) \
238 hb_mux_object_t * hb_mux_##a##_init( hb_job_t * );