GPAC
Open Source Multimedia Framework. For more information, check out http://gpac.wp.mines-telecom.fr
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups
avilib.c File Reference
#include <gpac/setup.h>
#include <gpac/internal/avilib.h>
+ Include dependency graph for avilib.c:

Macros

#define PACKAGE   "GPAC/avilib"
 
#define VERSION   GPAC_FULL_VERSION
 
#define INFO_LIST
 
#define NEW_RIFF_THRES   (1900*1024*1024)
 
#define NR_IXNN_CHUNKS   96
 
#define DEBUG_ODML
 
#define MAX_INFO_STRLEN   64
 
#define FRAME_RATE_SCALE   1000000
 
#define HEADERBYTES   2048
 
#define AVI_MAX_LEN   (UINT_MAX-(1<<20)*16-HEADERBYTES)
 
#define PAD_EVEN(x)   ( ((x)+1) & ~1 )
 
#define OUTD(n)   long2str((unsigned char*) (ix00+bl),(s32)n); bl+=4
 
#define OUTW(n)   ix00[bl] = (n)&0xff; ix00[bl+1] = (n>>8)&0xff; bl+=2
 
#define OUTC(n)   ix00[bl] = (n)&0xff; bl+=1
 
#define OUTS(s)   memcpy(ix00+bl,s,4); bl+=4
 
#define OUT4CC(s)   if(nhb<=HEADERBYTES-4) memcpy(AVI_header+nhb,s,4); nhb += 4
 
#define OUTLONG(n)   if(nhb<=HEADERBYTES-4) long2str(AVI_header+nhb, (s32)(n)); nhb += 4
 
#define OUTSHRT(n)
 
#define OUTCHR(n)
 
#define OUTMEM(d, s)
 
#define AVIF_HASINDEX   0x00000010 /* Index at end of file */
 
#define AVIF_MUSTUSEINDEX   0x00000020
 
#define AVIF_ISINTERLEAVED   0x00000100
 
#define AVIF_TRUSTCKTYPE   0x00000800 /* Use CKType to find key frames */
 
#define AVIF_WASCAPTUREFILE   0x00010000
 
#define AVIF_COPYRIGHTED   0x00020000
 
#define S_IRWXU   00700 /* read, write, execute: owner */
 
#define S_IRUSR   00400 /* read permission: owner */
 
#define S_IWUSR   00200 /* write permission: owner */
 
#define S_IXUSR   00100 /* execute permission: owner */
 
#define S_IRWXG   00070 /* read, write, execute: group */
 
#define S_IRGRP   00040 /* read permission: group */
 
#define S_IWGRP   00020 /* write permission: group */
 
#define S_IXGRP   00010 /* execute permission: group */
 
#define S_IRWXO   00007 /* read, write, execute: other */
 
#define S_IROTH   00004 /* read permission: other */
 
#define S_IWOTH   00002 /* write permission: other */
 
#define S_IXOTH   00001 /* execute permission: other */
 
#define AVIF_HASINDEX   0x00000010 /* Index at end of file */
 
#define AVIF_MUSTUSEINDEX   0x00000020
 
#define AVIF_ISINTERLEAVED   0x00000100
 
#define AVIF_TRUSTCKTYPE   0x00000800 /* Use CKType to find key frames */
 
#define AVIF_WASCAPTUREFILE   0x00010000
 
#define AVIF_COPYRIGHTED   0x00020000
 
#define ERR_EXIT(x)
 

Functions

static u32 avi_read (FILE *fd, char *buf, u32 len)
 
static u32 avi_write (FILE *fd, char *buf, u32 len)
 
static void long2str (unsigned char *dst, s32 n)
 
static u64 str2ullong (unsigned char *str)
 
static u32 str2ulong (unsigned char *str)
 
static u32 str2ushort (unsigned char *str)
 
static u32 str2ulong_len (unsigned char *str)
 
static u32 str2ulong_key (unsigned char *str)
 
static int avi_sampsize (avi_t *AVI, int j)
 
static int avi_add_chunk (avi_t *AVI, unsigned char *tag, unsigned char *data, u32 length)
 
static int avi_ixnn_entry (avi_t *AVI, avistdindex_chunk *ch, avisuperindex_entry *en)
 
static int avi_init_super_index (avi_t *AVI, unsigned char *idxtag, avisuperindex_chunk **si)
 
static int avi_add_std_index (avi_t *AVI, unsigned char *idxtag, unsigned char *strtag, avistdindex_chunk *stdil)
 
static int avi_add_odml_index_entry_core (avi_t *AVI, long flags, u64 pos, unsigned long len, avistdindex_chunk *si)
 
static int avi_add_odml_index_entry (avi_t *AVI, unsigned char *tag, long flags, u64 pos, unsigned long len)
 
static int avi_add_index_entry (avi_t *AVI, unsigned char *tag, long flags, u64 pos, u64 len)
 
int AVI_can_read_audio (avi_t *AVI)
 
avi_tAVI_open_output_file (char *filename)
 
void AVI_set_video (avi_t *AVI, int width, int height, double fps, char *compressor)
 
void AVI_set_audio (avi_t *AVI, int channels, long rate, int bits, int format, long mp3rate)
 
int avi_update_header (avi_t *AVI)
 
static int avi_close_output_file (avi_t *AVI)
 
static int avi_write_data (avi_t *AVI, char *data, unsigned long length, int audio, int keyframe)
 
int AVI_write_frame (avi_t *AVI, char *data, long bytes, int keyframe)
 
int AVI_dup_frame (avi_t *AVI)
 
int AVI_write_audio (avi_t *AVI, char *data, long bytes)
 
int AVI_append_audio (avi_t *AVI, char *data, long bytes)
 
u64 AVI_bytes_remain (avi_t *AVI)
 
u64 AVI_bytes_written (avi_t *AVI)
 
int AVI_set_audio_track (avi_t *AVI, u32 track)
 
int AVI_get_audio_track (avi_t *AVI)
 
void AVI_set_audio_vbr (avi_t *AVI, long is_vbr)
 
long AVI_get_audio_vbr (avi_t *AVI)
 
int AVI_close (avi_t *AVI)
 
avi_tAVI_open_input_file (char *filename, int getIndex)
 
avi_tAVI_open_fd (FILE *fd, int getIndex)
 
int avi_parse_input_file (avi_t *AVI, int getIndex)
 
long AVI_video_frames (avi_t *AVI)
 
int AVI_video_width (avi_t *AVI)
 
int AVI_video_height (avi_t *AVI)
 
double AVI_frame_rate (avi_t *AVI)
 
char * AVI_video_compressor (avi_t *AVI)
 
long AVI_max_video_chunk (avi_t *AVI)
 
int AVI_audio_tracks (avi_t *AVI)
 
int AVI_audio_channels (avi_t *AVI)
 
long AVI_audio_mp3rate (avi_t *AVI)
 
long AVI_audio_padrate (avi_t *AVI)
 
int AVI_audio_bits (avi_t *AVI)
 
int AVI_audio_format (avi_t *AVI)
 
long AVI_audio_rate (avi_t *AVI)
 
long AVI_frame_size (avi_t *AVI, long frame)
 
long AVI_audio_size (avi_t *AVI, long frame)
 
u64 AVI_get_video_position (avi_t *AVI, long frame)
 
int AVI_seek_start (avi_t *AVI)
 
int AVI_set_video_position (avi_t *AVI, long frame)
 
int AVI_set_audio_bitrate (avi_t *AVI, long bitrate)
 
long AVI_read_frame (avi_t *AVI, char *vidbuf, int *keyframe)
 
long AVI_get_audio_position_index (avi_t *AVI)
 
int AVI_set_audio_position_index (avi_t *AVI, long indexpos)
 
int AVI_set_audio_position (avi_t *AVI, long byte)
 
long AVI_read_audio (avi_t *AVI, char *audbuf, long bytes, int *continuous)
 
int AVI_read_data (avi_t *AVI, char *vidbuf, long max_vidbuf, char *audbuf, long max_audbuf, long *len)
 
u64 AVI_max_size (void)
 

Variables

long AVI_errno = 0
 
static char id_str [64]
 

Macro Definition Documentation

#define PACKAGE   "GPAC/avilib"
#define VERSION   GPAC_FULL_VERSION
#define INFO_LIST
#define NEW_RIFF_THRES   (1900*1024*1024)
#define NR_IXNN_CHUNKS   96
#define DEBUG_ODML
#define MAX_INFO_STRLEN   64
#define FRAME_RATE_SCALE   1000000
#define HEADERBYTES   2048
#define AVI_MAX_LEN   (UINT_MAX-(1<<20)*16-HEADERBYTES)
#define PAD_EVEN (   x)    ( ((x)+1) & ~1 )
#define OUTD (   n)    long2str((unsigned char*) (ix00+bl),(s32)n); bl+=4
#define OUTW (   n)    ix00[bl] = (n)&0xff; ix00[bl+1] = (n>>8)&0xff; bl+=2
#define OUTC (   n)    ix00[bl] = (n)&0xff; bl+=1
#define OUTS (   s)    memcpy(ix00+bl,s,4); bl+=4
#define OUT4CC (   s)    if(nhb<=HEADERBYTES-4) memcpy(AVI_header+nhb,s,4); nhb += 4
#define OUTLONG (   n)    if(nhb<=HEADERBYTES-4) long2str(AVI_header+nhb, (s32)(n)); nhb += 4
#define OUTSHRT (   n)
Value:
if(nhb<=HEADERBYTES-2) { \
AVI_header[nhb ] = (u8) ((n )&0xff); \
AVI_header[nhb+1] = (u8) ((n>>8)&0xff); \
} \
nhb += 2
#define HEADERBYTES
Definition: avilib.c:99
uint8_t u8
Definition: setup.h:248
#define OUTCHR (   n)
Value:
if(nhb<=HEADERBYTES-1) { \
AVI_header[nhb ] = (n )&0xff; \
} \
nhb += 1
#define HEADERBYTES
Definition: avilib.c:99
#define OUTMEM (   d,
 
)
Value:
{ \
u32 s_ = (u32) (s); \
if(nhb + s_ <= HEADERBYTES) \
memcpy(AVI_header+nhb, (d), s_); \
nhb += s_; \
}
#define HEADERBYTES
Definition: avilib.c:99
uint32_t u32
Definition: setup.h:246
#define AVIF_HASINDEX   0x00000010 /* Index at end of file */
#define AVIF_MUSTUSEINDEX   0x00000020
#define AVIF_ISINTERLEAVED   0x00000100
#define AVIF_TRUSTCKTYPE   0x00000800 /* Use CKType to find key frames */
#define AVIF_WASCAPTUREFILE   0x00010000
#define AVIF_COPYRIGHTED   0x00020000
#define S_IRWXU   00700 /* read, write, execute: owner */
#define S_IRUSR   00400 /* read permission: owner */
#define S_IWUSR   00200 /* write permission: owner */
#define S_IXUSR   00100 /* execute permission: owner */
#define S_IRWXG   00070 /* read, write, execute: group */
#define S_IRGRP   00040 /* read permission: group */
#define S_IWGRP   00020 /* write permission: group */
#define S_IXGRP   00010 /* execute permission: group */
#define S_IRWXO   00007 /* read, write, execute: other */
#define S_IROTH   00004 /* read permission: other */
#define S_IWOTH   00002 /* write permission: other */
#define S_IXOTH   00001 /* execute permission: other */
#define AVIF_HASINDEX   0x00000010 /* Index at end of file */
#define AVIF_MUSTUSEINDEX   0x00000020
#define AVIF_ISINTERLEAVED   0x00000100
#define AVIF_TRUSTCKTYPE   0x00000800 /* Use CKType to find key frames */
#define AVIF_WASCAPTUREFILE   0x00010000
#define AVIF_COPYRIGHTED   0x00020000
#define ERR_EXIT (   x)
Value:
{ \
AVI_errno = x; \
return 0; \
}
long AVI_errno
Definition: avilib.c:54
int AVI_close(avi_t *AVI)
Definition: avilib.c:1707

Function Documentation

static u32 avi_read ( FILE *  fd,
char *  buf,
u32  len 
)
static

+ Here is the caller graph for this function:

static u32 avi_write ( FILE *  fd,
char *  buf,
u32  len 
)
static

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void long2str ( unsigned char *  dst,
s32  n 
)
static

+ Here is the caller graph for this function:

static u64 str2ullong ( unsigned char *  str)
static

+ Here is the caller graph for this function:

static u32 str2ulong ( unsigned char *  str)
static

+ Here is the caller graph for this function:

static u32 str2ushort ( unsigned char *  str)
static

+ Here is the caller graph for this function:

static u32 str2ulong_len ( unsigned char *  str)
static

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static u32 str2ulong_key ( unsigned char *  str)
static

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static int avi_sampsize ( avi_t AVI,
int  j 
)
static

+ Here is the caller graph for this function:

static int avi_add_chunk ( avi_t AVI,
unsigned char *  tag,
unsigned char *  data,
u32  length 
)
static

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static int avi_ixnn_entry ( avi_t AVI,
avistdindex_chunk ch,
avisuperindex_entry en 
)
static

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static int avi_init_super_index ( avi_t AVI,
unsigned char *  idxtag,
avisuperindex_chunk **  si 
)
static

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static int avi_add_std_index ( avi_t AVI,
unsigned char *  idxtag,
unsigned char *  strtag,
avistdindex_chunk stdil 
)
static

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static int avi_add_odml_index_entry_core ( avi_t AVI,
long  flags,
u64  pos,
unsigned long  len,
avistdindex_chunk si 
)
static

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static int avi_add_odml_index_entry ( avi_t AVI,
unsigned char *  tag,
long  flags,
u64  pos,
unsigned long  len 
)
static

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static int avi_add_index_entry ( avi_t AVI,
unsigned char *  tag,
long  flags,
u64  pos,
u64  len 
)
static

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int AVI_can_read_audio ( avi_t AVI)
avi_t* AVI_open_output_file ( char *  filename)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void AVI_set_video ( avi_t AVI,
int  width,
int  height,
double  fps,
char *  compressor 
)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void AVI_set_audio ( avi_t AVI,
int  channels,
long  rate,
int  bits,
int  format,
long  mp3rate 
)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int avi_update_header ( avi_t AVI)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static int avi_close_output_file ( avi_t AVI)
static

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static int avi_write_data ( avi_t AVI,
char *  data,
unsigned long  length,
int  audio,
int  keyframe 
)
static

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int AVI_write_frame ( avi_t AVI,
char *  data,
long  bytes,
int  keyframe 
)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int AVI_dup_frame ( avi_t AVI)

+ Here is the call graph for this function:

int AVI_write_audio ( avi_t AVI,
char *  data,
long  bytes 
)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int AVI_append_audio ( avi_t AVI,
char *  data,
long  bytes 
)

+ Here is the call graph for this function:

u64 AVI_bytes_remain ( avi_t AVI)
u64 AVI_bytes_written ( avi_t AVI)
int AVI_set_audio_track ( avi_t AVI,
u32  track 
)

+ Here is the caller graph for this function:

int AVI_get_audio_track ( avi_t AVI)
void AVI_set_audio_vbr ( avi_t AVI,
long  is_vbr 
)
long AVI_get_audio_vbr ( avi_t AVI)
int AVI_close ( avi_t AVI)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

avi_t* AVI_open_input_file ( char *  filename,
int  getIndex 
)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

avi_t* AVI_open_fd ( FILE *  fd,
int  getIndex 
)

+ Here is the call graph for this function:

int avi_parse_input_file ( avi_t AVI,
int  getIndex 
)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

long AVI_video_frames ( avi_t AVI)

+ Here is the caller graph for this function:

int AVI_video_width ( avi_t AVI)

+ Here is the caller graph for this function:

int AVI_video_height ( avi_t AVI)

+ Here is the caller graph for this function:

double AVI_frame_rate ( avi_t AVI)

+ Here is the caller graph for this function:

char* AVI_video_compressor ( avi_t AVI)

+ Here is the caller graph for this function:

long AVI_max_video_chunk ( avi_t AVI)
int AVI_audio_tracks ( avi_t AVI)

+ Here is the caller graph for this function:

int AVI_audio_channels ( avi_t AVI)

+ Here is the caller graph for this function:

long AVI_audio_mp3rate ( avi_t AVI)
long AVI_audio_padrate ( avi_t AVI)
int AVI_audio_bits ( avi_t AVI)
int AVI_audio_format ( avi_t AVI)
long AVI_audio_rate ( avi_t AVI)

+ Here is the caller graph for this function:

long AVI_frame_size ( avi_t AVI,
long  frame 
)

+ Here is the caller graph for this function:

long AVI_audio_size ( avi_t AVI,
long  frame 
)

+ Here is the caller graph for this function:

u64 AVI_get_video_position ( avi_t AVI,
long  frame 
)

+ Here is the caller graph for this function:

int AVI_seek_start ( avi_t AVI)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int AVI_set_video_position ( avi_t AVI,
long  frame 
)
int AVI_set_audio_bitrate ( avi_t AVI,
long  bitrate 
)
long AVI_read_frame ( avi_t AVI,
char *  vidbuf,
int *  keyframe 
)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

long AVI_get_audio_position_index ( avi_t AVI)
int AVI_set_audio_position_index ( avi_t AVI,
long  indexpos 
)
int AVI_set_audio_position ( avi_t AVI,
long  byte 
)

+ Here is the caller graph for this function:

long AVI_read_audio ( avi_t AVI,
char *  audbuf,
long  bytes,
int *  continuous 
)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int AVI_read_data ( avi_t AVI,
char *  vidbuf,
long  max_vidbuf,
char *  audbuf,
long  max_audbuf,
long *  len 
)

+ Here is the call graph for this function:

u64 AVI_max_size ( void  )

Variable Documentation

long AVI_errno = 0
char id_str[64]
static