Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #ifndef AVILIB_H
00034 #define AVILIB_H
00035
00036 #include "defs.h"
00037 #include <inttypes.h>
00038 #include <sys/types.h>
00039
00040
00041 #define AVI_MAX_TRACKS 8
00042 #define FRAME_RATE_SCALE 1000000
00043
00044 typedef struct _video_index_entry
00045 {
00046 off_t key;
00047 off_t pos;
00048 off_t len;
00049 } video_index_entry;
00050
00051 typedef struct _audio_index_entry
00052 {
00053 off_t pos;
00054 off_t len;
00055 off_t tot;
00056 } audio_index_entry;
00057
00058
00059 typedef struct track_s
00060 {
00061
00062 long a_fmt;
00063 long a_chans;
00064 long a_rate;
00065 long a_bits;
00066 long mpgrate;
00067 long a_vbr;
00068 long padrate;
00069
00070 long audio_strn;
00071 off_t audio_bytes;
00072 long audio_chunks;
00073
00074 char audio_tag[4];
00075 long audio_posc;
00076 long audio_posb;
00077
00078 off_t a_codech_off;
00079 off_t a_codecf_off;
00080
00081 audio_index_entry *audio_index;
00082
00083 } __attribute__ ((packed)) track_t;
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139 struct avi_t
00140 {
00141 long fdes;
00142 long mode;
00143
00144
00145 long width;
00146 long height;
00147 double fps;
00148 char compressor[8];
00149 char compressor2[8];
00150 long video_strn;
00151 long video_frames;
00152 char video_tag[4];
00153 long video_pos;
00154
00155
00156 DWORD max_len;
00157
00158 track_t track[AVI_MAX_TRACKS];
00159
00160 off_t pos;
00161 long n_idx;
00162 long max_idx;
00163
00164 off_t v_codech_off;
00165 off_t v_codecf_off;
00166
00167 BYTE (*idx)[16];
00168
00169 video_index_entry *video_index;
00170
00171
00172
00173 off_t last_pos;
00174 DWORD last_len;
00175 int must_use_index;
00176 off_t movi_start;
00177 int total_frames;
00178
00179 int anum;
00180 int aptr;
00181
00182
00183
00184
00185
00186
00187 void* extradata;
00188 ULONG extradata_size;
00189 int closed;
00190
00191 } __attribute__ ((packed));
00192
00193 #define AVI_MODE_WRITE 0
00194 #define AVI_MODE_READ 1
00195
00196
00197
00198 #define AVI_ERR_SIZELIM 1
00199
00200
00201
00202
00203 #define AVI_ERR_OPEN 2
00204
00205
00206 #define AVI_ERR_READ 3
00207
00208 #define AVI_ERR_WRITE 4
00209
00210
00211 #define AVI_ERR_WRITE_INDEX 5
00212
00213
00214
00215 #define AVI_ERR_CLOSE 6
00216
00217
00218
00219 #define AVI_ERR_NOT_PERM 7
00220
00221
00222
00223 #define AVI_ERR_NO_MEM 8
00224
00225 #define AVI_ERR_NO_AVI 9
00226
00227 #define AVI_ERR_NO_HDRL 10
00228
00229
00230 #define AVI_ERR_NO_MOVI 11
00231
00232
00233 #define AVI_ERR_NO_VIDS 12
00234
00235 #define AVI_ERR_NO_IDX 13
00236
00237
00238
00239
00240
00241 #define WAVE_FORMAT_UNKNOWN (0x0000)
00242 #define WAVE_FORMAT_PCM (0x0001)
00243 #define WAVE_FORMAT_ADPCM (0x0002)
00244 #define WAVE_FORMAT_IBM_CVSD (0x0005)
00245 #define WAVE_FORMAT_ALAW (0x0006)
00246 #define WAVE_FORMAT_MULAW (0x0007)
00247 #define WAVE_FORMAT_OKI_ADPCM (0x0010)
00248 #define WAVE_FORMAT_DVI_ADPCM (0x0011)
00249 #define WAVE_FORMAT_DIGISTD (0x0015)
00250 #define WAVE_FORMAT_DIGIFIX (0x0016)
00251 #define WAVE_FORMAT_YAMAHA_ADPCM (0x0020)
00252 #define WAVE_FORMAT_DSP_TRUESPEECH (0x0022)
00253 #define WAVE_FORMAT_GSM610 (0x0031)
00254 #define IBM_FORMAT_MULAW (0x0101)
00255 #define IBM_FORMAT_ALAW (0x0102)
00256 #define IBM_FORMAT_ADPCM (0x0103)
00257
00258 #define DOLBY_FORMAT_AC3 (0x2000)
00259 #define ANTEX_FORMAT_ADPCME (0x0033)
00260 #define AUDIO_FORMAT_APTX (0x0025)
00261 #define AUDIOFILE_FORMAT_AF10 (0x0026)
00262 #define AUDIOFILE_FORMAT_AF36 (0x0024)
00263 #define BROOKTREE_FORMAT_BTVD (0x0400)
00264 #define CANOPUS_FORMAT_ATRAC (0x0063)
00265 #define CIRRUS_FORMAT_CIRRUS (0x0060)
00266 #define CONTROL_FORMAT_CR10 (0x0037)
00267 #define CONTROL_FORMAT_VQLPC (0x0034)
00268 #define CREATIVE_FORMAT_ADPCM (0x0200)
00269 #define CREATIVE_FORMAT_FASTSPEECH10 (0x0203)
00270 #define CREATIVE_FORMAT_FASTSPEECH8 (0x0202)
00271 #define IMA_FORMAT_ADPCM (0x0039)
00272 #define CONSISTENT_FORMAT_CS2 (0x0260)
00273 #define HP_FORMAT_CU (0x0019)
00274 #define DEC_FORMAT_G723 (0x0123)
00275 #define DF_FORMAT_G726 (0x0085)
00276 #define DSP_FORMAT_ADPCM (0x0036)
00277 #define DOLBY_FORMAT_AC2 (0x0030)
00278 #define DOLBY_FORMAT_AC3_SPDIF (0x0092)
00279 #define ESS_FORMAT_ESPCM (0x0061)
00280 #define IEEE_FORMAT_FLOAT (0x0003)
00281 #define ISO_FORMAT_MP3 (0x0055)
00282 #define ISO_FORMAT_MPEG12 (0x0050)
00283 #define MS_FORMAT_MSAUDIO1_DIVX (0x0160)
00284 #define MS_FORMAT_MSAUDIO2_DIVX (0x0161)
00285 #define OGG_FORMAT_VORBIS1 (0x674f)
00286 #define OGG_FORMAT_VORBIS1P (0x676f)
00287 #define OGG_FORMAT_VORBIS2 (0x6750)
00288 #define OGG_FORMAT_VORBIS2P (0x6770)
00289 #define OGG_FORMAT_VORBIS3 (0x6751)
00290 #define OGG_FORMAT_VORBIS3P (0x6771)
00291 #define MS_FORMAT_WMA9 (0x0163)
00292 #define MS_FORMAT_WMA9_PRO (0x0162)
00293
00294 int AVI_open_output_file(struct avi_t *AVI, const char * filename);
00295 void AVI_set_video(struct avi_t *AVI, int width, int height, double fps, char *compressor);
00296 void AVI_set_audio(struct avi_t *AVI, int channels, long rate, int mpgrate, int bits, int format);
00297 int AVI_write_frame(struct avi_t *AVI, BYTE *data, long bytes, int keyframe);
00298 int AVI_dup_frame(struct avi_t *AVI);
00299 int AVI_write_audio(struct avi_t *AVI, BYTE *data, long bytes);
00300 int AVI_append_audio(struct avi_t *AVI, BYTE *data, long bytes);
00301 ULONG AVI_bytes_remain(struct avi_t *AVI);
00302 int AVI_close(struct avi_t *AVI);
00303
00304
00305 int AVI_set_audio_track(struct avi_t *AVI, int track);
00306 void AVI_set_audio_vbr(struct avi_t *AVI, long is_vbr);
00307
00308
00309 ULONG AVI_set_MAX_LEN(ULONG len);
00310
00311 int AVI_getErrno();
00312
00313 void AVI_print_error(char *str);
00314 char *AVI_strerror();
00315 char *AVI_syserror();
00316
00317 #endif