📄 codec.c
字号:
//****************************************************************************unsigned longCodecGetNameByIndex(unsigned long ulIndex, const unsigned short **ppusName){ // // Make sure that the codec index is valid. // if(ulIndex >= NUMCODECS) { return(0); } // // Pass the codec name request to the entry point for the specified codec. // return((pfnIoctl[ulIndex])(IOCTL_CODEC_GETNAME, ulEndOfRAM, (unsigned long)ppusName, 0, 0));}//****************************************************************************//// CodecGetArtist gets the name of the artist associated with the file being// decoded by the currently opened codec.////****************************************************************************unsigned longCodecGetArtist(const unsigned short **ppusName){ // // If there is not a codec opened, then return an error. // if(!sCodec.bCodecOpen) { return(0); } // // Pass the artist name request to the entry point for the specified codec. // return((pfnIoctl[sCodec.ucCodec])(IOCTL_CODEC_GETARTIST, ulEndOfRAM, (unsigned long)ppusName, 0, 0));}//****************************************************************************//// CodecGetTitle gets the name of the song associated with the file being// decoded by the currently opened codec.////****************************************************************************unsigned longCodecGetTitle(const unsigned short **ppusName){ // // If there is not a codec opened, then return an error. // if(!sCodec.bCodecOpen) { return(0); } // // Pass the song name request to the entry point for the specified codec. // return((pfnIoctl[sCodec.ucCodec])(IOCTL_CODEC_GETTITLE, ulEndOfRAM, (unsigned long)ppusName, 0, 0));}//****************************************************************************//// CodecGetBitRate returns the bit rate of the encoded file.////****************************************************************************unsigned longCodecGetBitRate(unsigned long *pulBitRate){ // // If there is not a codec opened, then return an error. // if(!sCodec.bCodecOpen) { return(0); } // // Pass the bitrate request to the entry point for the specified codec. // return((pfnIoctl[sCodec.ucCodec])(IOCTL_CODEC_GETBITRATE, ulEndOfRAM, (unsigned long)pulBitRate, 0, 0));}//****************************************************************************//// CodecGetSampleRate returns the sample rate of the encoded file.////****************************************************************************unsigned longCodecGetSampleRate(unsigned long *pulSampleRate){ // // If there is not a codec opened, then return an error. // if(!sCodec.bCodecOpen) { return(0); } // // Pass the sample rate request to the entry point for the specified codec. // return((pfnIoctl[sCodec.ucCodec])(IOCTL_CODEC_GETSAMPLERATE, ulEndOfRAM, (unsigned long)pulSampleRate, 0, 0));}//****************************************************************************//// CodecGetChannels returns the number of channels in the encoded file.////****************************************************************************unsigned longCodecGetChannels(unsigned long *pulChannels){ // // If there is not a codec opened, then return an error. // if(!sCodec.bCodecOpen) { return(0); } // // Pass the channels request to the entry point for the specified codec. // return((pfnIoctl[sCodec.ucCodec])(IOCTL_CODEC_GETCHANNELS, ulEndOfRAM, (unsigned long)pulChannels, 0, 0));}//****************************************************************************//// CodecGetLength returns the length (in milliseconds) of the encoded file.////****************************************************************************unsigned longCodecGetLength(unsigned long *pulLength){ // // If there is not a codec opened, then return an error. // if(!sCodec.bCodecOpen) { return(0); } // // Pass the length request to the entry point for the specified codec. // return((pfnIoctl[sCodec.ucCodec])(IOCTL_CODEC_GETLENGTH, ulEndOfRAM, (unsigned long)pulLength, 0, 0));}//****************************************************************************//// CodecGetTime returns the current position (in milliseconds) within the// file.////****************************************************************************unsigned longCodecGetTime(unsigned long *pulTime){ // // If there is not a codec opened, then return an error. // if(!sCodec.bCodecOpen) { return(0); } // // Pass the time request to the entry point for the specified codec. // return((pfnIoctl[sCodec.ucCodec])(IOCTL_CODEC_GETTIME, ulEndOfRAM, (unsigned long)pulTime, 0, 0));}//****************************************************************************//// CodecGetCaptureBuffer gets the buffer to be used by the digital audio// interface for capturing data for the encoder.////****************************************************************************unsigned longCodecGetCaptureBuffer(short **ppsBuffer, long *plLength){ // // If there is not a codec opened, then return an error. // if(!sCodec.bCodecOpen) { return(0); } // // If this codec was not opened for encoding, then return an error. // if(!(sCodec.ucFlags & CODEC_OPEN_ENCODE)) { return(0); } // // Pass the get capture buffer request to the entry point for the specified // codec. // return((pfnIoctl[sCodec.ucCodec])(IOCTL_CODEC_GETCAPTUREBUFFER, ulEndOfRAM, (unsigned long)ppsBuffer, (unsigned long)plLength, 0));}//****************************************************************************//// CodecSetBuffer sets the buffer to which decoders write their output data or// from which encoders take their input data.////****************************************************************************unsigned longCodecSetBuffer(BufferState *psBuffer){ // // If there is not a codec opened, then return an error. // if(!sCodec.bCodecOpen) { return(0); } // // Pass the set buffer request to the entry point for the specified codec. // return((pfnIoctl[sCodec.ucCodec])(IOCTL_CODEC_SETBUFFER, ulEndOfRAM, (unsigned long)psBuffer, 0, 0));}//****************************************************************************//// CodecCanDecode determines if an additional "frame" of data can be decoded// with the current codec.////****************************************************************************unsigned longCodecCanDecode(void){ // // If there is not a codec opened, then return an error. // if(!sCodec.bCodecOpen) { return(0); } // // If this codec was not opened for decoding, then return an error. // if(!(sCodec.ucFlags & CODEC_OPEN_DECODE)) { return(0); } // // Pass the can decode request to the entry point for the specified codec. // return((pfnIoctl[sCodec.ucCodec])(IOCTL_CODEC_CAN_DECODE, ulEndOfRAM, 0, 0, 0));}//****************************************************************************//// CodecDecode decodes a "frame" of data with the current codec. The// definition of "frame" is codec dependent and relates to the amount of data// that can be decoded given the availablity of memory and to the natural// framing with the encoded stream (if there is any).////****************************************************************************unsigned longCodecDecode(void){ // // If there is not a codec opened, then return an error. // if(!sCodec.bCodecOpen) { return(0); } // // If this codec was not opened for decoding, then return an error. // if(!(sCodec.ucFlags & CODEC_OPEN_DECODE)) { return(0); } // // Pass the decode request to the entry point for the specified codec. // return((pfnIoctl[sCodec.ucCodec])(IOCTL_CODEC_DECODE, ulEndOfRAM, 0, 0, 0));}//****************************************************************************//// CodecCanEncode determines if an additional "frame" of data can be encoded// with the current codec.////****************************************************************************unsigned longCodecCanEncode(void){ // // If there is not a codec opened, then return an error. // if(!sCodec.bCodecOpen) { return(0); } // // If this codec was not opened for encoding, then return an error. // if(!(sCodec.ucFlags & CODEC_OPEN_ENCODE)) { return(0); } // // Pass the can encode request to the entry point for the specified codec. // return((pfnIoctl[sCodec.ucCodec])(IOCTL_CODEC_CAN_ENCODE, ulEndOfRAM, 0, 0, 0));}//****************************************************************************//// CodecEncode encodes a "frame" of data with the current codec. The// definition of "frame" is codec dependent and relates to the amount of data// that can be encoded given the availablity of memory and to the natural// framing with the encoded stream (if there is any).////****************************************************************************unsigned longCodecEncode(void){ // // If there is not a codec opened, then return an error. // if(!sCodec.bCodecOpen) { return(0); } // // If this codec was not opened for encoding, then return an error. // if(!(sCodec.ucFlags & CODEC_OPEN_ENCODE)) { return(0); } // // Pass the encode request to the entry point for the specified codec. // return((pfnIoctl[sCodec.ucCodec])(IOCTL_CODEC_ENCODE, ulEndOfRAM, 0, 0, 0));}//****************************************************************************//// CodecSeek repositions the input data stream to the specified time.////****************************************************************************unsigned longCodecSeek(unsigned long ulTime){ // // If there is not a codec opened, then return an error. // if(!sCodec.bCodecOpen) { return(0); } // // If this codec was not opened for decoding, then return an error. // if(!(sCodec.ucFlags & CODEC_OPEN_DECODE)) { return(0); } // // Pass the seek request to the entry point for the specified codec. // return((pfnIoctl[sCodec.ucCodec])(IOCTL_CODEC_SEEK, ulEndOfRAM, ulTime, 0, 0));}//****************************************************************************//// CodecClose closes the currently opened codec.////****************************************************************************unsigned longCodecClose(void){ unsigned long ulRet; // // If a codec is not currently opened, then return a failure. // if(!sCodec.bCodecOpen) { return(0); } // // Pass the close request to the entry point for the specified codec. // ulRet = (pfnIoctl[sCodec.ucCodec])(IOCTL_CODEC_CLOSE, ulEndOfRAM, sCodec.ucFlags, 0, 0); // // If the close succeeded, then keep track of the fact that a codec is not // currently opened. // if(ulRet) { sCodec.bCodecOpen = 0; } // // Return the result to the caller. // return(ulRet);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -