Defines | Functions | Variables
avilib.c File Reference
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <time.h>
#include "avilib.h"
#include "defs.h"
Include dependency graph for avilib.c:

Go to the source code of this file.

Defines

#define AVIF_COPYRIGHTED   0x00020000
#define AVIF_COPYRIGHTED   0x00020000
#define AVIF_HASINDEX   0x00000010 /* Index at end of file */
#define AVIF_HASINDEX   0x00000010 /* Index at end of file */
#define AVIF_ISINTERLEAVED   0x00000100
#define AVIF_ISINTERLEAVED   0x00000100
#define AVIF_MUSTUSEINDEX   0x00000020
#define AVIF_MUSTUSEINDEX   0x00000020
#define AVIF_TRUSTCKTYPE   0x00000800 /* Use CKType to find key frames */
#define AVIF_TRUSTCKTYPE   0x00000800 /* Use CKType to find key frames */
#define AVIF_WASCAPTUREFILE   0x00010000
#define AVIF_WASCAPTUREFILE   0x00010000
#define ERR_EXIT(x)
#define HEADERBYTES   2048
#define INFO_LIST
#define MAX_INFO_STRLEN   64
#define OUT4CC(s)   if(nhb<=HEADERBYTES-4) memcpy(AVI_header+nhb,s,4); nhb += 4
#define OUTCHR(n)
#define OUTLONG(n)   if(nhb<=HEADERBYTES-4) long2str(AVI_header+nhb,n); nhb += 4
#define OUTMEM(d, s)
#define OUTSHRT(n)
#define PACKAGE   "guvcview"
#define PAD_EVEN(x)   ( ((x)+1) & ~1 )
#define S_IRGRP   00040 /* read permission: group */
#define S_IROTH   00004 /* read permission: other */
#define S_IRUSR   00400 /* read permission: owner */
#define S_IRWXG   00070 /* read, write, execute: group */
#define S_IRWXO   00007 /* read, write, execute: other */
#define S_IRWXU   00700 /* read, write, execute: owner */
#define S_IWGRP   00020 /* write permission: group */
#define S_IWOTH   00002 /* write permission: other */
#define S_IWUSR   00200 /* write permission: owner */
#define S_IXGRP   00010 /* execute permission: group */
#define S_IXOTH   00001 /* execute permission: other */
#define S_IXUSR   00100 /* execute permission: owner */
#define VERSION   "0.9"

Functions

static int avi_add_chunk (struct avi_t *AVI, BYTE *tag, BYTE *data, int length)
static int avi_add_index_entry (struct avi_t *AVI, BYTE *tag, long flags, long pos, long len)
int AVI_append_audio (struct avi_t *AVI, BYTE *data, long bytes)
ULONG AVI_bytes_remain (struct avi_t *AVI)
ULONG AVI_bytes_written (struct avi_t *AVI)
int AVI_close (struct avi_t *AVI)
static int avi_close_output_file (struct avi_t *AVI)
int AVI_dup_frame (struct avi_t *AVI)
int AVI_getErrno ()
int AVI_open_output_file (struct avi_t *AVI, const char *filename)
void AVI_print_error (char *str)
static int avi_sampsize (struct avi_t *AVI, int j)
void AVI_set_audio (struct avi_t *AVI, int channels, long rate, int mpgrate, int bits, int format)
int AVI_set_audio_track (struct avi_t *AVI, int track)
void AVI_set_audio_vbr (struct avi_t *AVI, long is_vbr)
ULONG AVI_set_MAX_LEN (ULONG len)
void AVI_set_video (struct avi_t *AVI, int width, int height, double fps, char *compressor)
char * AVI_strerror ()
static int avi_update_header (struct avi_t *AVI)
static ssize_t avi_write (int fd, BYTE *buf, size_t len)
int AVI_write_audio (struct avi_t *AVI, BYTE *data, long bytes)
static int avi_write_data (struct avi_t *AVI, BYTE *data, long length, int audio, int keyframe)
int AVI_write_frame (struct avi_t *AVI, BYTE *data, long bytes, int keyframe)
static void long2str (unsigned char *dst, int n)
static unsigned long str2ulong (BYTE *str)

Variables

long AVI_errno = 0
char * avi_errors []
ULONG AVI_MAX_LEN = AVI_MAX_SIZE
static char error_string [4096]
static char id_str [MAX_INFO_STRLEN]
static int num_avi_errors = sizeof(avi_errors)/sizeof(char*)

Define Documentation

#define AVIF_COPYRIGHTED   0x00020000
#define AVIF_COPYRIGHTED   0x00020000
#define AVIF_HASINDEX   0x00000010 /* Index at end of file */
#define AVIF_HASINDEX   0x00000010 /* Index at end of file */
#define AVIF_ISINTERLEAVED   0x00000100
#define AVIF_ISINTERLEAVED   0x00000100
#define AVIF_MUSTUSEINDEX   0x00000020
#define AVIF_MUSTUSEINDEX   0x00000020
#define AVIF_TRUSTCKTYPE   0x00000800 /* Use CKType to find key frames */
#define AVIF_TRUSTCKTYPE   0x00000800 /* Use CKType to find key frames */
#define AVIF_WASCAPTUREFILE   0x00010000
#define AVIF_WASCAPTUREFILE   0x00010000
#define ERR_EXIT (   x)
Value:
{ \
   AVI_close(AVI); \
   AVI_errno = x; \
   return 0; \
}

Definition at line 1216 of file avilib.c.

#define HEADERBYTES   2048

Definition at line 84 of file avilib.c.

#define INFO_LIST

Definition at line 56 of file avilib.c.

#define MAX_INFO_STRLEN   64

Definition at line 58 of file avilib.c.

#define OUT4CC (   s)    if(nhb<=HEADERBYTES-4) memcpy(AVI_header+nhb,s,4); nhb += 4

Definition at line 228 of file avilib.c.

#define OUTCHR (   n)
Value:
if(nhb<=HEADERBYTES-1) { \
      AVI_header[nhb  ] = (n   )&0xff; \
   } \
   nhb += 1

Definition at line 241 of file avilib.c.

#define OUTLONG (   n)    if(nhb<=HEADERBYTES-4) long2str(AVI_header+nhb,n); nhb += 4

Definition at line 231 of file avilib.c.

#define OUTMEM (   d,
  s 
)
Value:
{ \
     unsigned int s_ = (s); \
     if(nhb <= HEADERBYTES-s_) \
        memcpy(AVI_header+nhb, (d), s_); \
     nhb += s_; \
   }

Definition at line 247 of file avilib.c.

#define OUTSHRT (   n)
Value:
if(nhb<=HEADERBYTES-2) { \
      AVI_header[nhb  ] = (n   )&0xff; \
      AVI_header[nhb+1] = (n>>8)&0xff; \
   } \
   nhb += 2

Definition at line 234 of file avilib.c.

#define PACKAGE   "guvcview"

Definition at line 62 of file avilib.c.

#define PAD_EVEN (   x)    ( ((x)+1) & ~1 )

Definition at line 86 of file avilib.c.

#define S_IRGRP   00040 /* read permission: group */

Definition at line 218 of file avilib.c.

#define S_IROTH   00004 /* read permission: other */

Definition at line 222 of file avilib.c.

#define S_IRUSR   00400 /* read permission: owner */

Definition at line 214 of file avilib.c.

#define S_IRWXG   00070 /* read, write, execute: group */

Definition at line 217 of file avilib.c.

#define S_IRWXO   00007 /* read, write, execute: other */

Definition at line 221 of file avilib.c.

#define S_IRWXU   00700 /* read, write, execute: owner */

Definition at line 213 of file avilib.c.

#define S_IWGRP   00020 /* write permission: group */

Definition at line 219 of file avilib.c.

#define S_IWOTH   00002 /* write permission: other */

Definition at line 223 of file avilib.c.

#define S_IWUSR   00200 /* write permission: owner */

Definition at line 215 of file avilib.c.

#define S_IXGRP   00010 /* execute permission: group */

Definition at line 220 of file avilib.c.

#define S_IXOTH   00001 /* execute permission: other */

Definition at line 224 of file avilib.c.

#define S_IXUSR   00100 /* execute permission: owner */

Definition at line 216 of file avilib.c.

#define VERSION   "0.9"

Definition at line 65 of file avilib.c.


Function Documentation

static int avi_add_chunk ( struct avi_t AVI,
BYTE tag,
BYTE data,
int  length 
) [static]

Definition at line 149 of file avilib.c.

static int avi_add_index_entry ( struct avi_t AVI,
BYTE tag,
long  flags,
long  pos,
long  len 
) [static]

Definition at line 179 of file avilib.c.

int AVI_append_audio ( struct avi_t AVI,
BYTE data,
long  bytes 
)

Definition at line 1116 of file avilib.c.

ULONG AVI_bytes_remain ( struct avi_t AVI)

Definition at line 1154 of file avilib.c.

ULONG AVI_bytes_written ( struct avi_t AVI)

Definition at line 1161 of file avilib.c.

int AVI_close ( struct avi_t AVI)

Definition at line 1189 of file avilib.c.

static int avi_close_output_file ( struct avi_t AVI) [static]

Definition at line 630 of file avilib.c.

int AVI_dup_frame ( struct avi_t AVI)

Definition at line 1087 of file avilib.c.

int AVI_getErrno ( )

Definition at line 1223 of file avilib.c.

int AVI_open_output_file ( struct avi_t AVI,
const char *  filename 
)

Definition at line 527 of file avilib.c.

void AVI_print_error ( char *  str)

Definition at line 1252 of file avilib.c.

static int avi_sampsize ( struct avi_t AVI,
int  j 
) [static]

Definition at line 115 of file avilib.c.

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

Definition at line 599 of file avilib.c.

int AVI_set_audio_track ( struct avi_t AVI,
int  track 
)

Definition at line 1168 of file avilib.c.

void AVI_set_audio_vbr ( struct avi_t AVI,
long  is_vbr 
)

Definition at line 1177 of file avilib.c.

Definition at line 73 of file avilib.c.

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

Definition at line 575 of file avilib.c.

char* AVI_strerror ( )

Definition at line 1272 of file avilib.c.

static int avi_update_header ( struct avi_t AVI) [static]

Definition at line 256 of file avilib.c.

static ssize_t avi_write ( int  fd,
BYTE buf,
size_t  len 
) [static]

Definition at line 130 of file avilib.c.

int AVI_write_audio ( struct avi_t AVI,
BYTE data,
long  bytes 
)

Definition at line 1099 of file avilib.c.

static int avi_write_data ( struct avi_t AVI,
BYTE data,
long  length,
int  audio,
int  keyframe 
) [static]

Definition at line 1029 of file avilib.c.

int AVI_write_frame ( struct avi_t AVI,
BYTE data,
long  bytes,
int  keyframe 
)

Definition at line 1068 of file avilib.c.

static void long2str ( unsigned char *  dst,
int  n 
) [static]

Definition at line 92 of file avilib.c.

static unsigned long str2ulong ( BYTE str) [static]

Definition at line 103 of file avilib.c.


Variable Documentation

long AVI_errno = 0

Definition at line 48 of file avilib.c.

char* avi_errors[]
Initial value:
{
   "avilib - No Error",
   "avilib - AVI file size limit reached",
   "avilib - Error opening AVI file",
   "avilib - Error reading from AVI file",
   "avilib - Error writing to AVI file",
   "avilib - Error writing index (file may still be useable)",
   "avilib - Error closing AVI file",
   "avilib - Operation (read/write) not permitted",
   "avilib - Out of memory (malloc failed)",
   "avilib - Not an AVI file",
   "avilib - AVI file has no header list (corrupted?)",
   "avilib - AVI file has no MOVI list (corrupted?)",
   "avilib - AVI file has no video data",
   "avilib - operation needs an index",
   "avilib - Unkown Error"
}

Definition at line 1230 of file avilib.c.

Definition at line 71 of file avilib.c.

char error_string[4096] [static]

Definition at line 1250 of file avilib.c.

char id_str[MAX_INFO_STRLEN] [static]

Definition at line 59 of file avilib.c.

int num_avi_errors = sizeof(avi_errors)/sizeof(char*) [static]

Definition at line 1248 of file avilib.c.



corobot_camera
Author(s): Morgan Cormier/mcormier@coroware.com
autogenerated on Tue Jan 7 2014 11:39:25