[ Previous | Next | Contents | Glossary | Home | Search ]
Ultimedia Services Version 2 for AIX: Programmer's Guide and Reference

UMSAVSReadWrite Object

The AVS file read/write object provides methods to access, read, write, and parse files in the AVS format. In this document, the term track refers to what the audio-video subsystem (AVSS) format calls a stream.

To learn more about the UMSAVSReadWrite object, see:

For introductory information, see Formatted File Access Objects.

Structure Definitions

The following AVS file structures are defined in the avfile.h file in the /UMS/install directory.

/* Copyright:    Copyright (c) International Business Machines Corporation */
/*                1991, 1992.                                              */
/*                Copyright (c) Intel Corporation 1991, 1992.               */
 
/***************************************************************************/
/* Structure Name:   StdFileHdr                                            */
/* Description:      First structure at offset 0L in the AVS file          */
/***************************************************************************/
 
typedef struct {
   
   unsigned long    FileID;            /* File type identifier (4 chars)   */
   short    HdrSize;                   /* Byte size of entire header       */
   short    HdrVersion;                /* Header version number            */
   long     AnnOffset;                 /* Byte offset to annotation text   */
 
} StdFileHdr;
 
/***************************************************************************/
/* Structure Name:   AvLFile                                               */
/* Description:      Master file structure. Follows StdFileHdr immediately */
/***************************************************************************/
 
/*
The size of an "int" depends on the machine. These structures were originally
made for a machine with two byte integers. All references to "int" have been
or will be changed to "int2" or "uint2".  Change these to match your machine.
*/
typedef signed short int2;
typedef unsigned short uint2;
 
typedef struct {
 
   unsigned long    HdrID;             /* Header type id, 4 chars          */
   short    HdrSize;                   /* Size of this header              */
   short    HdrVer;                    /* Header Version number            */
   short    StrmGrpCnt;                /* Reserved. Always 0.              */
   short    StrmGrpSize;               /* Reserved. Always AVL_STRMGRP_SIZE*/
   unsigned long    StrmGrpOffset;     /* Reserved. Always 0.              */
   short    StrmGrpVer;                /* Reserved. Always AVL_STRMGRP_VER */
   short    StrmSize;                  /* Size of AvLStrm                  */
   short    StrmVer;                   /* AvLStrm version number           */
   short    StrmCnt;                   /* Number of streams                */
   unsigned long    StrmOffset;        /* Ptr to array of AvLStrm          */
   unsigned long    HdrPoolOffset;     /* Ptr to pool of stream headers    */
   long     LabelCnt;                  /* Reserved. Always 0.              */
   unsigned long    LabelOffset;       /* Reserved. Always 0.              */
   short    LabelSize;                 /* Reserved. Always AVL_LABEL_SIZE  */
   short    LabelVer;                  /* Reserved. Always AVL_LABEL_VER   */
   unsigned long    VshOffset;         /* Ptr to global decompression data */
   uint2    VshSize;                   /* Size of global decompression data*/
   short    FrmVer;                    /* AvLFrm version number            */
   long     FrmCnt;                    /* Number of frames in file         */
   long     FrmSize;                   /* !=0 if all frames have equal size*/
   unsigned long    FirstFrmOffset;    /* Ptr to first AvLFrm              */
   unsigned long    EndOfFrmsOffset;   /* Ptr to 1st byte after frame data */
   short    FrmHdrSize;                /* Frame Header Size                */
   short    FrmDirSize;                /* Size of 1 frame index entry      */
   unsigned long    FrmDirOffset;      /* Ptr to random access frame index */
   short    FrmDirVer;                 /* AvLFrmDir version number         */
   short    FrmsPerSec;                /* Default Frame rate to play video.*/
                                       /* if no pad stream                 */
   unsigned long    Flag;              /* AvLFile attribute flag bits      */
   unsigned long    FreeBlockOffset;   /* Offset to first block in freelist*/
   char     Patch[AVL_PATCH_SIZE];     /* Patch area for insurance         */
 
} AvLFile;
 
/***************************************************************************/
/* Structure Name:   AvLStrm                                               */
/* Description:      There is one AvLStrm for each stream. It identifies   */
/*                   the type and subtype of the stream. It also points to */
/*                   the header for the first of (perhaps several)         */
/*                   substreams.                                           */
/***************************************************************************/
 
typedef struct {
 
   unsigned long    HdrID;             /* Header type id, 4 chars          */
   uint2    Type;                      /* Stream type                      */
   uint2    SubType;                   /* Stream subtype, dependent on type*/
   short    HdrCnt;                    /* Num of substream headers for this*/
                                       /* stream                           */
   short    NextStrmNum;               /* Number of next stream in StrmGrp */
   short    StrmGrpNum;                /* Number of StrmGrp this stream    */
                                       /* belongs to                       */
   short    Pad;                       /* Pad to 32 bit boundaries         */
   unsigned long    Flag;              /* Stream's attribute flag bits     */
   long     FrmSize;                   /* Maximum frame size in this stream*/
   unsigned long    FirstHdrOffset;    /* Offset to 1st header for stream  */
   char     StrmName[AVL_NAME_SIZE];   /* Name for this stream             */
 
} AvLStrm;
 
/***************************************************************************/
/* Structure Name:   AvLHdr                                                */
/* Description:      This header is present at the beginning of each sub-  */
/*                   stream header, irrespective of substream type         */
/***************************************************************************/
 
typedef struct  {
 
   unsigned long    HdrID;             /* Header type id, 4 chars          */
   short    HdrSize;                   /* Size of this stream header       */
   short    HdrVer;                    /* Header Version number            */
   char     OrigFile[AVL_PATH_SIZE];   /* Reserved and unused              */
   long     OrigFrm;                   /* Frame # within original file of  */
                                       /* first frame                      */
   short    OrigStrm;                  /* Stream # within original file    */
   short    Pad;                       /* Pad to 32 bit boundaries         */
   long     FrmCnt;                    /* Num of frames until next header  */
                                       /* applies, or AVL_LAST_HDR if there*/
                                       /* is only one substream or this    */
                                       /* is the last substream            */
   unsigned long    NextHdrOffset;     /* Offset from start of file to     */
                                       /* next substream header for this   */
                                       /* stream. Zero if no next header   */
 
} AvLHdr;
 
/***************************************************************************/
/* Structure Name:   AvLAud                                                */
/* Description:      Audio substream header. There is one of these headers */
/*                   for each segment of frames of audio in an audio stream*/
/***************************************************************************/
 
typedef struct  {
 
   unsigned long    HdrID;             /* Header type id, 4 chars          */
   short    HdrSize;                   /* Size of this stream header       */
   short    HdrVer;                    /* Header Version number            */
   char     OrigFile[AVL_PATH_SIZE];   /* Reserved and unused              */
   long     OrigFrm;                   /* Frame # within original file of  */
                                       /* first frame                      */
   short    OrigStrm;                  /* Stream # within original file    */
   short    Pad;                       /* Pad to 32 bit boundaries         */
   long     FrmCnt;                    /* Num of frames until next header  */
                                       /* applies or, AVL_LAST_HDR if there*/
                                       /* is only one substream or this    */
                                       /* is the last substream            */
   unsigned long    NextHdrOffset;     /* Offset from start of file to     */
                                       /* next substream header for this   */
                                       /* stream. Zero if no next header   */
   char     Lib[AVL_NAME_SIZE];        /* Reserved and unused              */
   char     Alg[AVL_NAME_SIZE];        /* Compression algorithm name       */
   long     Parm1;                     /* Audio data rate in Bits/Sec      */
   short    Parm2;                     /* Filter cutoff freq. (Samp/Sec)/2 */
   short    Parm3;                     /* Samples per subframe. Always 4   */
   short    LeftVol;                   /* Left audio volume: 0 to 100      */
   short    RightVol;                  /* Right audio volume: 0 to 100     */
   long     LoopOffset;                /* Reserved. Always -1              */
   long     StartFrm;                  /* Reserved. Always 0               */
   unsigned long    Flag;              /* Audio attribute flag bits        */
   short    Parm4;                     /* Audio frame rate                 */
   short    Pad2;                      /* Reserved. Always 0               */
   long     DCFId;                     /* Reserved. Always -1              */
 
} AvLAud;
 
/***************************************************************************/
/* Structure Name:   AvLCim                                                */
/* Description:      Compressed video/image substream header. There is one */
/*                   of these headers for each segment of frames of comp-  */
/*                   ressed video/images in a stream of compressed         */
/*                   video/images                                          */
/***************************************************************************/
 
typedef struct  {
 
   unsigned long    HdrID;             /* Header type id, 4 chars          */
   short    HdrSize;                   /* Size of this stream header       */
   short    HdrVer;                    /* Header Version number            */
   char     OrigFile[AVL_PATH_SIZE];   /* Reserved and unused              */
   long     OrigFrm;                   /* Frame # within original file of  */
                                       /* first frame                      */
   short    OrigStrm;                  /* Stream # within original file    */
   short    Pad;                       /* Pad to 32 bit boundaries         */
   long     FrmCnt;                    /* Num of frames until next header  */
                                       /* applies or, AVL_LAST_HDR if there*/
                                       /* is only one substream or this    */
                                       /* is the last substream            */
   unsigned long    NextHdrOffset;     /* Offset from start of file to     */
                                       /* next substream header for this   */
                                       /* stream. Zero if no next header   */
   short    XPos;                      /* Reserved. Always 0               */
   short    YPos;                      /* Reserved. Always 0               */
   short    XLen;                      /* Width of decomp. image in pels   */
   short    YLen;                      /* Height of decomp. image in pels  */
   short    XCrop;                     /* Reserved. Always 0               */
   short    YCrop;                     /* Reserved. Always 0               */
   short    DropFrm;                   /* Reserved. Always 0               */
   short    DropPhase;                 /* Reserved. Always 0               */
   long     StillPeriod;               /* Every Nth frame is a still, or   */
                                       /* AVL_CIM_RANDOM_STILL for random  */
                                       /* still frames                     */
   short    BufsMin;                   /* Reserved. Always 0               */
   short    BufsMax;                   /* Reserved. Always 0               */
   short    DeCodeAlg;                 /* Decomp. algorithm for playback   */
   short    Pad2;                      /* Reserved. Always 0               */
   long     DCFId;                     /* Reserved. Always -1              */
 
} AvLCim;
 
/***************************************************************************/
/* Structure Name:   AvLUim                                                */
/* Description:      Uncompressed image substream header. There is one of  */
/*                   these headers for each segment of frames of uncomp-   */
/*                   ressed image in a stream of uncompressed images       */
/***************************************************************************/
 
typedef   struct{
 
   unsigned long    HdrID;             /* Header type id, 4 chars          */
   short    HdrSize;                   /* Size of this stream header       */
   short    HdrVer;                    /* Header Version number            */
   char     OrigFile[AVL_PATH_SIZE];   /* Reserved and unused              */
   long     OrigFrm;                   /* Frame # within original file of  */
                                       /* first frame                      */
   short    OrigStrm;                  /* Stream # within original file    */
   short    Pad;                       /* Pad to 32 bit boundaries         */
   long     FrmCnt;                    /* Num of frames until next header  */
                                       /* applies or, AVL_LAST_HDR if there*/
                                       /* is only one substream or this    */
                                       /* is the last substream            */
   unsigned long    NextHdrOffset;     /* Offset from start of file to     */
                                       /* next substream header for this   */
                                       /* stream. Zero if no next header   */
   short    XPos;                      /* Reserved. Always 0               */
   short    YPos;                      /* Reserved. Always 0               */
   short    XLen;                      /* Width of image in pels           */
   short    YLen;                      /* Height of image in pels          */
   short    PixBits;                   /* Number of bits per pixel         */
   short    Pad2;                      /* Reserved. Always 0               */
   long     DCFId;                     /* Reserved. Always -1              */
 
} AvLUim;
 
/***************************************************************************/
/* Structure Name:   AvLUlay                                               */
/* Description:      Underlay substream header. Underlay streams areintend-*/
/*                   ed to hold digital data associated with the same      */
/*                   interval of time as the other streams that are present*/
/*                   in each frame. The only currently supported sub-type  */
/*                   is AVL_ST_TIMECODE - used to hold SMPTE BCD time codes*/
/***************************************************************************/
 
typedef struct {
 
   unsigned long    HdrID;             /* Header type id, 4 chars          */
   short    HdrSize;                   /* Size of this stream header       */
   short    HdrVer;                    /* Header Version number            */
   char     OrigFile[AVL_PATH_SIZE];   /* Reserved and unused              */
   long     OrigFrm;                   /* Frame # within original file of  */
                                       /* first frame                      */
   short    OrigStrm;                  /* Stream # within original file    */
   short    Pad;                       /* Pad to 32 bit boundaries         */
   long     FrmCnt;                    /* Num of frames until next header  */
                                       /* applies, or AVL_LAST_HDR if there*/
                                       /* is only one substream or this    */
                                       /* is the last substream            */
   unsigned long    NextHdrOffset;     /* Offset from start of file to     */
                                       /* next substream header for this   */
                                       /* stream. Zero if no next header   */
   long     DCFId;                     /* Reserved. Always -1              */
 
} AvLUlay;
 
/***************************************************************************/
/* Structure Name:   AvLPad                                                */
/* Description:      Pad substream header. Pad streams are inserted in the */
/*                   data to pad the data rate out to 153 600 bytes per    */
/*                   second - the standard CD-ROM rate. This allows video  */
/*                   files to be read smoothly from a CD-ROM source without*/
/*                   time-consuming seeks.                                 */
/*                   There is one of these headers for each segment of     */
/*                   frames of pad data in a stream of pad data. Pad data  */
/*                   usually consists of all zero bytes                    */
/***************************************************************************/
 
typedef struct {
 
   unsigned long    HdrID;             /* Header type id, 4 chars          */
   short    HdrSize;                   /* Size of this stream header       */
   short    HdrVer;                    /* Header Version number            */
   char     OrigFile[AVL_PATH_SIZE];   /* Reserved and unused              */
   long     OrigFrm;                   /* Frame # within original file of  */
                                       /* first frame                      */
   short    OrigStrm;                  /* Stream # within original file    */
   short    Pad;                       /* Pad to 32 bit boundaries         */
   long     FrmCnt;                    /* Num of frames until next header  */
                                       /* applies, or AVL_LAST_HDR if there*/
                                       /* is only one substream or this    */
                                       /* is the last substream            */
   unsigned long    NextHdrOffset;     /* Offset from start of file to     */
                                       /* next substream header for this   */
                                       /* stream. Zero if no next header   */
   long     ImagesPer;                 /* ImagesPer / Seconds = frame rate */
   long     Seconds;                   /* ImagesPer / Seconds = frame rate */
   long     VidFast;                   /* Reserved. Always 0.              */
   long     VidVar;                    /* Reserved. Always 0.              */
   long     VidRev;                    /* Reserved. Always 0.              */
   long     VidStart;                  /* Reserved. Always 0.              */
   short    UlayFast;                  /* Reserved. Always 0.              */
   short    UlayVar;                   /* Reserved. Always 0.              */
   short    UlayRev;                   /* Reserved. Always 0.              */
   short    UlayStart;                 /* Reserved. Always 0.              */
   short    PipeDepth;                 /* Reserved. Always 0.              */
   short    PipeStart;                 /* Reserved. Always 0.              */
   short    MinSeek;                   /* Reserved. Always 0.              */
   short    MinPad;                    /* Reserved. Always 0.              */
   long     DCFId;                     /* Reserved. Always -1              */
 
} AvLPad;
 
/***************************************************************************/
/* Structure Name:   AvLFrmDir                                             */
/* Description:      This structure identifies where each frame starts and */
/*                   whether all CIM streams use absolute encoding for that*/
/*                   frame. There is one additional entry at the end of the*/
/*                   frame index so that one can find the length of any    */
/*                   frame by subtracting two values.                      */
/*                   The 31 least significant bits of FrmOffset represent  */
/*                   the offset to the associated AvLFrm in the file.      */
/*                   The high order bit is set iff this frame can be used  */
/*                   for random access to the frame data for every stream  */
/*                   of the file.                                          */
/***************************************************************************/
 
typedef struct {
 
   unsigned long    FrmOffset;         /* Bits 0-30 are the offset in bytes*/
                                       /* of a frame header. Bit 31 is set */
                                       /* if all streams in the frame can  */
                                       /* be random accessed               */
 
} AvLFrmDir;
 
/***************************************************************************/
/* Structure Name:   AvLFrm                                                */
/* Description:      This header appears at the beginning of every frame   */
/*                   of data in the file unless AvLFile.Flag has the bit   */
/*                   described by AVL_FILE_NO_FRMHDR set. Note that if     */
/*                   there is more than one stream in the file, any appl-  */
/*                   ication using this structure will need to allocate    */
/*                   space for further StrmFrmSize entries.                */
/***************************************************************************/
 
typedef struct {
 
   long     FrmNum;                    /* Frame number, starts at 0        */
   long     RevOffset;                 /* Offset to previous frame header  */
   long     ChkSum;                    /* Header checksum. Consists of     */
                                       /*      AVL_FRM_ID              ^   */
                                       /*      AvLFrm.FrmNum           ^   */
                                       /*      AvLFrm.RevOffset        ^   */
                                       /*      AvLFrm.StrmFrmSize[ 0 ] ^   */
                                       /*      AvLFrm.StrmFrmSize[ 1 ] ^   */
                                       /*      AvLFrm.StrmFrmSize[ 2 ] ^   */
                                       /*      AvLFrm.StrmFrmSize[ n ]     */
   long     StrmFrmSize[ 1 ];          /* Array of stream frame sizes. This*/
                                       /* is just a place holder for an    */
                                       /* application allocated array of   */
                                       /* size:                            */
                                       /* AvLFile.StrmCnt * sizeof( long ) */
} AvLFrm;
 
/***************************************************************************/
/* Structure Name:   AvLBsh                                                */
/* Description:      For compressed image stream the actual data begins    */
/*                   with the following bit-stream header.                 */
/*                   NOTE: The random access flags are used as follows:    */
/*                           Bit 0 - Reserved                              */
/*                           Bit 1 - Reserved                              */
/*                           Bit 2 - Set iff intraframe encoded (reference */
/*                                   frame)                                */
/*                           Bit 3 to 6 - reserved                         */
/*                           Bit 7 - Zero means bits 8 and 9 indicate when */
/*                                   next reference frame occurs           */
/*                                   One means examine bit 12 to see if    */
/*                                   frame can be discarded                */
/*                           Bit 8 and 9 - 01 intraframe next frame        */
/*                                         10 intraframe one after next frm*/
/*                                         11 intraframe two after next frm*/
/*                           Bit 10 to 11 - reserved                       */
/*                           Bit 12 - Set if frame can be discarded        */
/*                                                                         */
/***************************************************************************/
 
typedef struct{
 
   uint2   AlgNum;                    /* Compression algorithm number      */
   uint2   Flags;                     /* Random image access flags         */
   unsigned long    NumBits;          /* Number of bits in image inc. hdr. */
   unsigned long    AlgSpec;          /* VSH data information              */
   uint2   YSize;                     /* Height of decomp. image in pels   */
   uint2   XSize;                     /* Width of decomp. image in pels    */
 
} AvLBsh;
 
/***************************************************************************/
/* Structure Name:   AvLSStrm                                              */
/* Description:      Structure used to reference all the different sub-    */
/*                   stream headers.                                       */
/***************************************************************************/
 
typedef struct {
 
   union {
 
    AvLAud      Audio;                /* Audio substream                  */
    AvLCim      CompVideo;            /* Compressed video substream       */
    AvLUim      UncompVideo;          /* Uncompressed video substream     */
    AvLPad      Padding;              /* Media read padding substream     */
    AvLUlay     Underlay;             /* Underlay data substream          */
 
   }SubStreamHeaders;
 
} AvLSStrm;
 
/***************************************************************************/
/* Structure Name:   AvLImHdr                                              */
/* Description:      Header structure for image files with the following   */
/*                   extensions:                                           */
/*                   .IMY, .IMU, .IMV  - three file uncomp. 9 bpp image    */
/*                   .CMY, .CMU, .CMV  - three file comp. 9 bpp image      */
/*                   .I16              - one file uncomp. 16 bpp image     */
/*                   .C16              - one file comp. 16 bpp image       */
/***************************************************************************/
 
typedef struct {
 
   unsigned long    ImIDCode;         /* Header type id, 4 chars           */
   uint2   ImByteSize;                /* Byte size of data structure       */
   uint2   ImVer;                     /* Release version of data structure */
   unsigned long    ImAnnOffset;      /* Byte offset to annotation text    */
   long     ImPlaneFlag;              /* Unsupported                       */
   short    ImXLen;                   /* Image width in pels               */
   short    ImYLen;                   /* Image height in pels              */
   short    ImPixBits;                /* Bits per pixel: 8 or 16           */
   uint2   ImCodeVer;                 /* Encoding version number, or zero */
   unsigned long    ImImageOff;        /* Byte offset to image data        */
   short    ImClutCnt;                 /* Unsupported                      */
   short    ImClutBits;                /* Unsupported                      */
   unsigned long    ImClutOff;         /* Unsupported                      */
   unsigned long    ImAppDataOff;      /* Unsupported                      */
   long     ImAppDataSize;             /* Unsupported                      */
   long     ImImageSize;               /* Byte length of image data        */
   short    ImColor;                   /* Unsupported                      */
   short    ImPlane;                   /* Unsupported                      */
   unsigned long    pad2;              /* Reserved. Always 0.              */
   unsigned long    pad3;              /* Reserved. Always 0.              */
 
} AvLImHdr;

Enumeration Lists

To avoid name collision on defines, integer values have been captured as enumerated lists. The set of valid values from an enumerated list may vary with the application. The detailed method descriptions describe the valid or possible values for the specific use. The enumerated lists that are defined for this object are:

enum ReturnCode { 
   Success, 
   Failure, 
   FileNotOpen, 
   StorageAllocationFailure, 
   InvalidArgument, 
   IncompatibleVersion, 
   EndOfFile 
   };

Method Descriptions

ReturnCode close()

Description

This function flushes buffers and closes the file. This may be called by the destructor if needed.

Return Values
Success
Failure

ReturnCode flush()

Description

This method flushes data held in the object to the file.

Return Values
Success
Failure

long get_audio_chunk_size()

Description

This returns the size of the next audio chunk from the AVS file. The sizes of the chunks are returned in the order they exist in the file. If track selection is used, only the sizes of chunks from the selected tracks are returned. The default is that all tracks are selected. This function skips past any video chunks to get at the next audio chunk. This method recognizes an audio track if its type is AVL_T_AUD. If an audio track is not marked with this type, it is not recognized by this method.

After this method is called, the get_chunk_track method applies to the next audio chunk to be read from the file with the get_audio_chunk method. Before this method is called, get_chunk_track may return information about some previous chunk.

Return Values

The return value is the size in bytes of the next video chunk. A size of -1 indicates an error. A size of 0 indicates end of file.

ReturnCode get_audio_chunk(in void *v)

Description

This returns the next audio chunk from the AVS file. The chunks are returned in the order they exist in the file. If track selection is used, only the selected tracks are returned. The default is that all tracks are selected. This function skips past any video chunks to get at the next audio chunk. This method recognizes an audio track if its type is AVL_T_AUD. If an audio track is not marked with this type, it is not recognized by this method.

Arguments
in void *v This returns the next audio chunk from the Ultimotion Matinee file. The caller should supply enough space for the chunk.
Return Values
Success
Failure
EndOfFile

ReturnCode get_AvLFile(in void *f)

Description

This method returns the AvLFile structure for the current file. This structure is defined in the avfile.h file.

Arguments
in void *f This is a pointer to an AvLFile structure to be filled by this call.
Return Values
Success
Failure

ReturnCode get_AvLFrmDir(in long count, in void *f)

Description

This method gets the AvLFrmDir structures from the current file. This structure is defined in the avfile.h file.

Arguments
in long count This is the number of AvLFrmDir structures pointed to by f.
in void *f This points to count AvLFrmDir structures to be filled by this method.
Return Values
Success
Failure

ReturnCode get_AvLHdr(in long count, in void *f)

Description

This method returns the AvLHdr structures for each track in the current file. These structures are defined in the avfile.h file. The current known types are AvLHdr, AvLAud, AvLCim, AvLUim, AvLUlay, and AvLPad.

Arguments
in long count This is the number of pointers to AvLHdr structures pointed to by f.
in void *f This is a pointer to an array of pointers to AvLHdr structures to be filled by this method. The user must allocate the space for the array and the structures.
Return Values
Success
Failure

ReturnCode get_AvLHdr_sizes(in long count, in long *f)

Description

This method returns the sizes of the AvLHdr structures for each track in the current file.

Arguments
in long count This is the number of long integers pointed to by f.
in long *f This is a pointer to count long integers to be filled by the sizes of the AvLHdr structures.
Return Values
Success
Failure

ReturnCode get_AvLStrm(in long count, in void *f)

Description

This method returns the AvLStrm structures for each track in the current file. This structure is defined in the avfile.h file.

Arguments
in long count This is the number of structures pointed to by f.
in void *f This is a pointer to an array of count AvLStrm structures to be filled by this method.
Return Values
Success
Failure

ReturnCode get_chunk(in void *f)

Description

This returns the next video or audio chunk from the AVS file. The type of the returned chunk can be determined from the track number. The tracks are returned in the order they exist in the file. If track selection is used, only the selected tracks are returned. The default is that all tracks are selected.

Arguments
in void *f This returns the next video or audio chunk from the AVS file. The caller must supply enough space to hold the chunk.
Return Values
Success
Failure
EndOfFile

long get_chunk_size()

Description

This gets the size of the next video or audio chunk in the AVS file. Unselected tracks are bypassed by this method.

Return Values

If successful, this method returns the size in bytes of the next chunk. A 0 is returned at the end of the file. A -1 is returned if unsuccessful.

long get_chunk_track()

Description

This method returns the track number for the chunk. This method applies to the next chunk to be read from the file.

Return Values

Possible return values are the track number for the current chunk or -1 if not successful.

long get_current_frame_number(in long *frame_number)

Description

This function returns the frame number for the next chunk to be read. Frame numbers start at 0. A file with 10 frames has frame numbers 0 to 9.

Arguments
in long *frame_number This is a return value. The caller should pass a pointer to a long integer. The frame number for the next frame to be read is returned as frame_number.
Return Values
Success
Failure

ReturnCode get_StdFileHdr(in void *f)

Description

This method returns the StdFileHdr structure for the current file. This structure is defined in the avfile.h file.

Arguments
in void *f This is a pointer to an StdFileHdr structure to be filled by this call.
Return Values
Success
Failure

long get_track_count()

Description

This returns the number of tracks in the file.

Return Values

Possible return values are the number of tracks in the file. A 0 is returned in case of an error.

ReturnCode get_video_chunk(in void *v)

Description

This returns the next video chunk from the AVS file. The chunks are returned in the order they exist in the file. If track selection is used, only the selected tracks are returned. The default is that all tracks are selected. This function skips past any audio chunks to get at the next video chunk. This method recognizes a video track if its type is AVL_T_CIM or AVL_T_UIM. If a video track is not marked with these types, it is not recognized by this method.

Arguments
in void *v This returns the next video chunk from the AVS file. The caller should supply enough space to hold the chunk.
Return Values
Success
Failure
EndOfFile

long get_video_chunk_size()

Description

This returns the size of the next video chunk from the AVS file. The sizes of the chunks are returned in the order they exist in the file. If track selection is used, only the sizes of chunks from the selected tracks are returned. The default is that all tracks are selected. This function skips past any audio chunks to get at the next video chunk. This method recognizes a video track if its type is AVL_T_CIM or AVL_T_UIM. If a video track is not marked with these types, it is not recognized by this method.

After this method is called, the get_chunk_track method applies to the next video chunk to be read from the file with the get_video_chunk method. Before this method is called, get_chunk_track may return information about some previous chunk.

Return Values

The return value is the size in bytes of the next video chunk. A size of -1 indicates an error. A size of 0 indicates end of file.

ReturnCode get_Vsh(in void *f)

Description

This method gets the Vsh data from the current file. The size of the data is given in VshSize field of the AvLFile structure.

Arguments
in void *f This is a pointer to the space to be filled with the Vsh data.
Return Values
Success
Failure

ReturnCode open(in string path, in long oflag, in long filemode)

Description

This function opens an AVS file for reading or writing.

Arguments
in string *path This is the path name of the AVS file to be opened.
in long oflag This is the bit-wise OR of the flags from the fcntl.h file used the same way as for the libc open function.
in long filemode This integer is the permissions modes for the file if it is being created. This value is ignored if the file already exists. It is used in the same way as for the libc open function.
Return Values
Success
Failure

ReturnCode put_AvLFile(in void *f)

Description

This method writes the AvLFile structure to the current file. This structure is defined in the avfile.h file. This header can be rewritten at any time. The object gets better performance and uses less temporary space if the header is written before writing frames.

Arguments
in void *f This is a pointer to the AvLFile structure to be written.
Return Values
Success
Failure

ReturnCode put_AvLFrmDir(in long count, in void *f)

Description

This method copies bit 31 from the FrmOffset field of the AvLFrmDir structures pointed to by f to bit 31 of the frame directory held internally by the object. If this bit is set, it marks the frame as seekable without having to decompress previous frames to generate the frame. The AvLFrmDir structure is defined in the avfile.h file.

Arguments
in long count This is the number of AvLFrmDir structures pointed to by f.
in void *f This is a pointer to an array of count AvLFrmDir structures.
Return Values
Success
Failure

ReturnCode put_AvLHdr(in long count, in void *f, in long *sizes)

Description

This method writes the AvLHdr structures to the current file. These structures are defined in the avfile.h file. The current known types are AvLHdr, AvLAud, AvLCim, AvLUim, AvLUlay, and AvLPad. This header can be rewritten at any time. The object gets better performance and uses less temporary space if the header is written before writing frames.

Arguments
in long count This is the number of pointers to AvLHdr structures pointed to by f and the number of long integer values pointed to by sizes.
in void *f This is a pointer to an array of count AvLHdr structure pointers. These point to the AvLHdr structures to be written.
in long *sizes This is a pointer to an array of count long integers that gives the sizes of the AvLHdr structures pointed to by array of AvLHdr structure pointers pointed to by f.
Return Values
Success
Failure

ReturnCode put_AvLStrm(in long count, in void *f)

Description

This method writes AvLStrm structures to the current file. This structure is defined in the avfile.h file. This header can be rewritten at any time. The object gets better performance and uses less temporary space if the header is written before writing frames.

Arguments
in long count This is the number of AvLStrm structures pointed to by f.
in void *f This is a pointer to an array of AvLStrm structures to be written.
Return Values
Success
Failure

ReturnCode put_chunk(in void *v, in long size, in long track, in long flags)

Description

This method inserts (writes) a chunk to the file at the current position. No byte-swapping is done on the data. The flags value is ignored if the file does not have an index. The file header is updated to reflect the real number of frames written to the file. This method is not affected by the select_track and un_select_track methods.

Arguments
in void *v This is a pointer to the chunk data to be written.
in long size This is the size of the data.
in long track This is the track number for the new chunk.
in long flags This is the flags value that is placed in the index entry for this new chunk.
Return Values
Success
Failure

ReturnCode put_StdFileHdr(in void *f)

Description

This method writes the StdFileHdr to the current file. This structure is defined in the avfile.h file. This header must be written at least once to indicate the number of tracks in the file before writing frames. This header can be rewritten at any time. The object gets better performance and uses less temporary space if the header is written before writing frames.

Arguments
in void *f This is a pointer to the StdFileHdr structure to be written.
Return Values
Success
Failure

ReturnCode put_Vsh(in void *f, in long size)

Description

This method writes the Vsh data to the current file.

Arguments
in void *f This is a pointer to the Vsh data to be written.
in long size This is the size in bytes of the data pointed to by f.
Return Values
Success
Failure

ReturnCode seek_to_frame(in long frame_number)

Description

This function attempts to seek to the frame number specified as an argument. If unsuccessful, the file position is unmodified. Frame numbers start at 0. A file with 10 frames has frame numbers 0 to 9.

Arguments
in long frame_number This is the frame number desired.
Return Values
Success
Failure

ReturnCode select_track(in long track)

Description

This function is used to select which tracks are returned by the get_*chunk functions. All tracks are selected by default when the file is opened. Multiple tracks can be selected by multiple use of this call. This method only applies when reading chunks from the file.

Arguments
in long track This is the number of the track to be selected. A -1 value means to select all tracks.
Return Values
Success
Failure

ReturnCode status_ok()

Description

This function checks the status of the object. If the file is not open, this function returns an error.

Return Values
Success
Failure

ReturnCode un_select_track(in long track)

Description

This function is used to select which tracks are returned by the get_*chunk functions. All tracks are selected by default when the file is opened. Multiple tracks can be unselected by multiple use of this method. This method only applies when reading chunks from the file.

Arguments
in long track This is the number of the track to be deselected. A -1 value means to deselect all tracks.
Return Values
Success
Failure

For introductory information, see Formatted File Access Objects.


[ Previous | Next | Contents | Glossary | Home | Search ]