#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"
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 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 HEADERBYTES 2048 |
#define MAX_INFO_STRLEN 64 |
#define OUT4CC | ( | s | ) | if(nhb<=HEADERBYTES-4) memcpy(AVI_header+nhb,s,4); nhb += 4 |
if(nhb<=HEADERBYTES-1) { \ AVI_header[nhb ] = (n )&0xff; \ } \ nhb += 1
#define OUTLONG | ( | n | ) | if(nhb<=HEADERBYTES-4) long2str(AVI_header+nhb,n); nhb += 4 |
{ \ unsigned int s_ = (s); \ if(nhb <= HEADERBYTES-s_) \ memcpy(AVI_header+nhb, (d), s_); \ nhb += s_; \ }
if(nhb<=HEADERBYTES-2) { \ AVI_header[nhb ] = (n )&0xff; \ AVI_header[nhb+1] = (n>>8)&0xff; \ } \ nhb += 2
static int avi_add_chunk | ( | struct avi_t * | AVI, |
BYTE * | tag, | ||
BYTE * | data, | ||
int | length | ||
) | [static] |
static int avi_add_index_entry | ( | struct avi_t * | AVI, |
BYTE * | tag, | ||
long | flags, | ||
long | pos, | ||
long | len | ||
) | [static] |
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 | ) |
static int avi_close_output_file | ( | struct avi_t * | AVI | ) | [static] |
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 | ||
) | [static] |
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] |
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 | ||
) | [static] |
int AVI_write_frame | ( | struct avi_t * | AVI, |
BYTE * | data, | ||
long | bytes, | ||
int | keyframe | ||
) |
static void long2str | ( | unsigned char * | dst, |
int | n | ||
) | [static] |
char* avi_errors[] |
{ "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" }
char error_string[4096] [static] |
char id_str[MAX_INFO_STRLEN] [static] |
int num_avi_errors = sizeof(avi_errors)/sizeof(char*) [static] |