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, ... );
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, int * 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 /***********************************************************************
23 **********************************************************************/
24 int hb_get_pid( hb_handle_t * );
25 void hb_set_state( hb_handle_t *, hb_state_t * );
27 /***********************************************************************
29 **********************************************************************/
30 typedef struct hb_buffer_s hb_buffer_t;
53 hb_buffer_t * hb_buffer_init( int size );
54 void hb_buffer_realloc( hb_buffer_t *, int size );
55 void hb_buffer_close( hb_buffer_t ** );
57 typedef struct hb_fifo_s hb_fifo_t;
59 hb_fifo_t * hb_fifo_init();
60 int hb_fifo_size( hb_fifo_t * );
61 int hb_fifo_is_full( hb_fifo_t * );
62 hb_buffer_t * hb_fifo_get( hb_fifo_t * );
63 hb_buffer_t * hb_fifo_see( hb_fifo_t * );
64 void hb_fifo_push( hb_fifo_t *, hb_buffer_t * );
65 void hb_fifo_close( hb_fifo_t ** );
67 /***********************************************************************
68 * Threads: update.c, scan.c, work.c, reader.c, muxcommon.c
69 **********************************************************************/
70 hb_thread_t * hb_update_init( int * build, char * version );
71 hb_thread_t * hb_scan_init( hb_handle_t *, const char * path,
72 int title_index, hb_list_t * list_title );
73 hb_thread_t * hb_work_init( hb_list_t * jobs, int cpu_count,
74 volatile int * die, int * error );
75 hb_thread_t * hb_reader_init( hb_job_t * );
76 hb_thread_t * hb_muxer_init( hb_job_t * );
78 /***********************************************************************
80 ***********************************************************************
81 * It is exported here because it is used at several places
82 **********************************************************************/
83 typedef struct hb_libmpeg2_s hb_libmpeg2_t;
85 hb_libmpeg2_t * hb_libmpeg2_init();
86 int hb_libmpeg2_decode( hb_libmpeg2_t *,
88 hb_list_t * raw_list );
89 void hb_libmpeg2_info( hb_libmpeg2_t * m, int * width,
90 int * height, int * rate );
91 void hb_libmpeg2_close( hb_libmpeg2_t ** );
93 /***********************************************************************
95 **********************************************************************/
96 int hb_demux_ps( hb_buffer_t * ps_buf, hb_list_t * es_list );
98 /***********************************************************************
100 **********************************************************************/
101 typedef struct hb_dvd_s hb_dvd_t;
103 hb_dvd_t * hb_dvd_init( char * path );
104 int hb_dvd_title_count( hb_dvd_t * );
105 hb_title_t * hb_dvd_title_scan( hb_dvd_t *, int title );
106 int hb_dvd_start( hb_dvd_t *, int title, int chapter );
107 void hb_dvd_stop( hb_dvd_t * );
108 int hb_dvd_seek( hb_dvd_t *, float );
109 int hb_dvd_read( hb_dvd_t *, hb_buffer_t * );
110 int hb_dvd_chapter( hb_dvd_t * );
111 void hb_dvd_close( hb_dvd_t ** );
113 /***********************************************************************
115 **********************************************************************/
116 typedef struct hb_work_object_s hb_work_object_t;
118 #define HB_WORK_COMMON \
123 hb_fifo_t * fifo_in; \
124 hb_fifo_t * fifo_out; \
125 int (* work) ( hb_work_object_t *, hb_buffer_t **, \
127 void (* close) ( hb_work_object_t ** )
129 #define HB_WORK_IDLE 0
131 #define HB_WORK_ERROR 2
132 #define HB_WORK_DONE 3
135 #define DECLARE_WORK_NORMAL( a ) \
136 hb_work_object_t * hb_work_##a##_init( hb_job_t * );
138 #define DECLARE_WORK_AUDIO( a ) \
139 hb_work_object_t * hb_work_##a##_init( hb_job_t *, hb_audio_t * );
141 DECLARE_WORK_NORMAL( sync );
142 DECLARE_WORK_NORMAL( decmpeg2 );
143 DECLARE_WORK_NORMAL( decsub );
144 DECLARE_WORK_NORMAL( render );
145 DECLARE_WORK_NORMAL( encavcodec );
146 DECLARE_WORK_NORMAL( encxvid );
147 DECLARE_WORK_NORMAL( encx264 );
148 DECLARE_WORK_AUDIO( deca52 );
149 DECLARE_WORK_AUDIO( decavcodec );
150 DECLARE_WORK_AUDIO( declpcm );
151 DECLARE_WORK_AUDIO( encfaac );
152 DECLARE_WORK_AUDIO( enclame );
153 DECLARE_WORK_AUDIO( encvorbis );
155 /***********************************************************************
157 **********************************************************************/
158 typedef struct hb_mux_object_s hb_mux_object_t;
159 typedef struct hb_mux_data_s hb_mux_data_t;
161 #define HB_MUX_COMMON \
162 int (*init) ( hb_mux_object_t * ); \
163 int (*mux) ( hb_mux_object_t *, hb_mux_data_t *, \
165 int (*end) ( hb_mux_object_t * );
167 #define DECLARE_MUX( a ) \
168 hb_mux_object_t * hb_mux_##a##_init( hb_job_t * );