📄 audio_filehdr.3
字号:
.\" @(#)audio_filehdr.3 1.1 92/07/30 SMI.ds Dc 7/30/92.TH AUDIO_FILEHDR 3 "\*(Dc" "" "Audio Library".SH NAMEaudio_filehdr, audio_isaudiofile,audio_read_filehdr,audio_decode_filehdr,audio_write_filehdr,audio_rewrite_filesize\- audio file header manipulation.SH DISCLAIMER.LPThe manual pages, header files, and object library associated with.B /usr/demo/SOUND/libaudio.aare furnished on an AS IS basis as a preliminary interface to severaluseful audio data-processing capabilities. A future release of theoperating system may redefine the syntax or semantics of some of thefunctions described herein..SH SYNOPSIS.nf.B #include <multimedia/libaudio.h>.LP.B int audio_isaudiofile(name).B char *name;.LP.B int audio_read_filehdr(fd, hp, infop, ilen).B int fd;.B Audio_hdr *hp;.B char *infop;.B unsigned ilen;.LP.B int audio_decode_filehdr(buf, hp, ilenp).B unsigned char *buf;.B Audio_hdr *hp;.B unsigned *ilenp;.LP.B int audio_write_filehdr(fd, hp, infop, ilen).B int fd;.B Audio_hdr *hp;.B char *infop;.B unsigned ilen;.LP.B int audio_rewrite_filesize(fd, size).B int fd;.B unsigned size;.fi.SH DESCRIPTIONAudio files contain a header that has a magic number (identifyingthe file as an audio file) and fields that describethe encoding format used to store the audio data. Immediately followingthe header is a variable-length information field in which, for instance,.SM ASCIIannotation may be stored..LPThe.B Audio_hdrstructure used by many of the.B libaudioroutines for describing audio data is not an exact duplicate of theaudio file header. Several routines are provided to read and write fileheaders so that programs need not be concerned with the detailsof the exact file header structure..LP.B audio_isaudiofile(\|)returns.SM TRUEif the named file appears to be an audio file,.SM FALSEotherwise. Note that only a limited degree of file header consistencychecking is performed. The.B audio_read_filehdr(\|)routine is somewhat more comprehensive in its tests. However,.B audio_isaudiofile(\|)is often sufficient to determine whether or not a particular file isof any interest to an application..LP.B audio_read_filehdr(\|)reads an audio file header from the given input stream, decoding itsfields into the.B Audio_hdrstructure whose address is given by.IR hp .If successful, the value.SB AUDIO_SUCCESSis returned and the current file position of the stream is updated torefer to the beginning of the audio data..LPThe.I data_sizefield of the returned.B Audio_hdrstructure is set to the length, in bytes, of the audio data. If thislength is indeterminate (for instance, if the data is being read from a pipe),this field is set to the value.SB AUDIO_UNKNOWN_SIZE\s0\fP..LPNote that the input file descriptor must not be set to a non-blocking i/omode. If non-blocking behavior is desired, it should be enabled afterthis routine returns..LPThe.I infopargument, if not.SM NULL\s0,specifies the address of a buffer, whose size is given by.IR ilen ,into which the information field of the audio file is copied. Thebuffer is always returned.SM NULL\s0-terminated, even if itwas not large enough to hold the entire file information field..LP.B audio_decode_filehdr(\|)decodes a buffer presumed to contain an audio file header.Though ordinarily called only by.BR audio_read_filehdr(\|) ,this routine may be used in cases where an application wishes toread the information structure itself. The.I bufargument specifies the address of the file header information to bedecoded.The length of the information field is returned at the address given by the.I ilenpargument..LP.B audio_write_filehdr(\|)encodes the given.B Audio_hdrstructure into an audio file header and writes it to the output streamdenoted by the.I fdargument. If the.I infopargument is not.SM NULL\s0,it specifies the address of a buffer containing.I ilenbytes of file information that will be written immediately following thefile header. The information structure is always zero-padded so that theaudio data begins on a double-word boundary.Note that the output file descriptor must not have been set to anon-blocking i/o mode..LP.B audio_rewrite_filesize(\|)attempts to rewrite the audio file header of the file specified by the.I fdargument, setting the data length to.IR size .If successful, the value.SB AUDIO_SUCCESSis returned. If the specified file descriptor is incapable of backward seeks(e.g., if it refers to a pipe),.SB AUDIO_ERR_NOEFFECTis returned..SH RETURN VALUEWith the exception of.BR audio_isaudiofile(\|) ,these routines return.SB AUDIO_SUCCESSon successful completion or, if unsuccessful, one of the following error codes:.TP 25.SM AUDIO_UNIXERRORAn error occurred while executing a system library function. The globalvalue.I errnocontains the error code..TP.SM AUDIO_ERR_BADHDRThe user-supplied.B Audio_hdrstructure contains an inconsistency or invalid value..TP.SM AUDIO_ERR_BADFILEHDRThe audio file header contains an inconsistency..TP.SM AUDIO_ERR_NOEFFECTThe requested operation could not be performed..SH SEE ALSO.BR audio_intro (3),.BR audio_hdr (3).
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -