1 /* $Id: Utils.h,v 1.23 2004/03/08 11:32:48 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. */
10 /* Standard headers */
16 typedef uint8_t byte_t;
23 #define MIN( a, b ) ( ( (a) > (b) ) ? (b) : (a) )
26 #define MAX( a, b ) ( ( (a) > (b) ) ? (a) : (b) )
29 #define EVEN( a ) ( ( (a) & 0x1 ) ? ( (a) + 1 ) : (a) )
32 #define MULTIPLE_16( a ) ( 16 * ( ( (a) + 8 ) / 16 ) )
34 #ifndef VOUT_ASPECT_FACTOR
35 #define VOUT_ASPECT_FACTOR 432000
38 typedef struct HBHandle HBHandle;
41 typedef struct HBAudio HBAudio;
42 typedef struct HBBuffer HBBuffer;
43 typedef struct HBCond HBCond;
44 typedef struct HBFifo HBFifo;
45 typedef struct HBList HBList;
46 typedef struct HBLock HBLock;
47 typedef struct HBTitle HBTitle;
48 typedef struct HBThread HBThread;
51 typedef struct HBAviMux HBAviMux;
52 typedef struct HBOgmMux HBOgmMux;
53 typedef struct HBDVDRead HBDVDRead;
54 typedef struct HBMp4Mux HBMp4Mux;
55 typedef struct HBScan HBScan;
57 typedef struct HBWork HBWork;
58 typedef struct HBWorkThread HBWorkThread;
61 typedef struct HBAviMainHeader HBAviMainHeader;
62 typedef struct HBAviStreamHeader HBAviStreamHeader;
63 typedef struct HBBitmapInfo HBBitmapInfo;
64 typedef struct HBWaveFormatEx HBWaveFormatEx;
66 /* Misc functions which may be used from anywhere */
67 void HBSnooze( int time );
68 void HBLog( char * log, ... );
70 int HBPStoES( HBBuffer ** psBuffer, HBList * esBufferList );
72 /* HBList functions */
73 HBList * HBListInit();
74 int HBListCount( HBList * );
75 void HBListAdd( HBList *, void * item );
76 void HBListRemove( HBList *, void * item );
77 void * HBListItemAt( HBList *, int index );
78 void HBListClose( HBList ** );
80 /* HBTitle function */
81 HBTitle * HBTitleInit();
82 void HBTitleClose( HBTitle ** );
84 /* HBAudio functions */
85 HBAudio * HBAudioInit( int id, char * language );
86 void HBAudioClose( HBAudio ** );
88 #define HB_SUCCESS 0x00
89 #define HB_CANCELED 0x01
90 #define HB_ERROR_A52_SYNC 0x02
91 #define HB_ERROR_AVI_WRITE 0x04
92 #define HB_ERROR_DVD_OPEN 0x08
93 #define HB_ERROR_DVD_READ 0x10
94 #define HB_ERROR_MP3_INIT 0x20
95 #define HB_ERROR_MP3_ENCODE 0x40
96 #define HB_ERROR_MPEG4_INIT 0x80
99 #define HB_CODEC_MPEG2 0x00
100 #define HB_CODEC_FFMPEG 0x01
101 #define HB_CODEC_XVID 0x02
102 #define HB_CODEC_AC3 0x04
103 #define HB_CODEC_LPCM 0x08
104 #define HB_CODEC_MP3 0x10
105 #define HB_CODEC_AAC 0x20
106 #define HB_CODEC_X264 0x40
107 #define HB_CODEC_VORBIS 0x80
109 /* Possible muxers */
110 #define HB_MUX_AVI 0x00
111 #define HB_MUX_MP4 0x01
112 #define HB_MUX_OGM 0x02
123 HBList * ripAudioList;
150 /* Encoder settings */
159 /* MP4 muxer specific */
164 /* AVI muxer specific */
165 HBAviMainHeader * aviMainHeader;
166 HBAviStreamHeader * aviVideoHeader;
167 HBBitmapInfo * aviVideoFormat;
180 HBWorkThread * workThreads[8];
202 int delay; /* in ms */
207 /* MPEG-4 config, used in the MP4 muxer */
209 unsigned long esConfigLength;
216 HBAviStreamHeader * aviAudioHeader;
217 HBWaveFormatEx * aviAudioFormat;