Dali: Avi Library -- C API

[ Header Files | Types | Constants | File | Stream | Video Stream | See Also ]

Header Files

#include <dvmavi.h>

Type Definitions

AviFile

This structure maintains the internal state corresponding to an open avi file.

        typedef struct AviFile {
            PAVIFILE aviHandle;
            short  numStreams;
            int length;
            int flags;
        } AviFile;
    
aviHandle
handle returned by AVIFileOpen
numStreams
The Number of media streams
length
Number of frames in the AVI file
flags
VFW specified flags

AviStream

This structure maintains the internal state corresponding to a single open stream in an avi file. The data in this structure is common to both audio and video streams.

        typedef struct AviStream {
            PAVISTREAM streamHandle;  
            int type;
            int codec;
            int length;
            int start;
            int sofar;
            void *data;
        } AviStream;
    
streamHandle
Handle returned by AVIGetStream
type
Either AVISTREAM_AUDIO or AVISTREAM_VIDEO
codec
The fcc (not used for audio)
length
Number of frames in the stream for video. Number of blocks for audio.
start
sample number of the first frame
sofar
sample number of the next frame to decompress
data
format specified data (AviVIdeoStream or AviAudioStream

AviVideoStream

This structure maintans information relevant to open video streams.

        typedef struct AviVideoStream {
            PGETFRAME gf;              /* getframe handle for decompression */
            PAVISTREAM cs;             /* handle to compressed stream (for writes) */
            unsigned char *fb;         /* framebuffer (for writes) */
            short width;               /* width of each frame */
            short height;              /* height of each frame */
            short fps;                 /* frames per second .. */
            short keyinterval;         /* Interval between key frames */
        } AviVideoStream;
    
gf
getframe handle for decompression
cs
handle for compressed stream (for writes)
fb
framebuffer (for writes)
width
width of each frame
height
height of each frame
fps
number of frames per second
keyInterval
interval between key frames

Constants

Return Code

These represent the possible return values from Dali avi functions. DVM_AVI_OK is returned if all goes well. The error codes are included below. Apart from these, standard video for windows errors may also be returned. These typically bave a AVIERR_ prefix, and are defined in the windows header files.

    #define DVM_AVI_BAD_SIZE             1     /* ByteImage size does not match stream size */
    #define DVM_AVI_NOT_VIDEO            2     /* Not a video stream */
    #define DVM_AVI_GET_FRAME_FAILED     3     /* Call to AVIStreamGetFrame() failed */
    #define DVM_AVI_UNINITIALIZED        4     /* Stream not initialized */
    #define DVM_AVI_WRITE_FAILED         5     /* Call to AVIStreamWrite() failed */
    #define DVM_AVI_FILE_OPEN_FAILED     7     /* AVIFileOpen() failed */
    #define DVM_AVI_FILE_INFO_FAILED     8     /* AVIFileInfo() failed */
    #define DVM_AVI_BAD_STREAM_NUM      10     /* Requested to read non-existent stream */
    #define DVM_AVI_GETSTREAM_FAILED    11     /* AVIFileGetStream() failed */
    #define DVM_AVI_STREAM_INFO_FAILED  12     /* AVIStreamInfo() failed */
    #define DVM_AVI_READ_FORMAT_FAILED  13     /* AVIStreamReadFormat() failed */
    #define DVM_AVI_NOT_RGB             14     /* Video stream is not RGB */
    #define DVM_AVI_UNSUPPORTED_TYPE    15     /* Stream type is not supported */
    #define DVM_AVI_NO_DECOMPRESSOR     16     /* Decompressor not installed */
  

Operators

File

int AviFileOpen(char *filename, AviFile **aviFilePtr)

int AviFileCreate(char *filename, AviFile **aviFilePtr)

int AviFileClose(AviFile *aviFile)


Stream

int AviStreamOpen(AviFile *aviFile, int streamnum, AviStream **strPtr)

int AviStreamClose(AviStream *aviStream)


Video Stream

int AviVideoStreamCreate (AviFile *aviFile, int codec, int w, int h int keyinterval, int quality, int bitrate, AviStream **strPtr)

int AviStreamStartDecode(AviStream *strPtr)

int AviStreamStopDecode(AviStream *strPtr)

int AviVideoFrameRead(AviStream *strPtr, ByteImage *r, ByteImage *g, ByteImage *b)

int AviVideoFrameWrite(AviStream *strPtr, ByteImage *r, ByteImage *g, ByteImage *b)

int AviVideoFrameSeek(AviStream *strPtr, int frameno)

int AviVideoFrameTell(AviStream *strPtr)

int AviVideoFrameSkip(AviStream *strPtr)

int AviVideoFrameRewind(AviStream *strPtr)

AviStreamGetType(AviStream *aviStream)
AviStreamGetCodec(AviStream *aviStream)
AviStreamGetLength(AviStream *aviStream)
AviStreamGetWidth(AviStream *aviStream)
AviStreamGetHeight(AviStream *aviStream)
AviStreamGetFps(AviStream *aviStream)


See Also

ByteImage , BitImage


Last updated : Saturday, November 14, 1998, 11:20 PM