📄 wmadec.h
字号:
#ifndef __WMAUDIO_API_H__
#define __WMAUDIO_API_H__
/************************************************************************
* MACRO DEFINE
************************************************************************/
#define CHECK_ALL_LICENSE 3
#define WMA_MAX_DATA_REQUESTED 512
#define MIN_OBJECT_SIZE 24
#define THIS_DRM_NO 0x00000000
#define THIS_DRM_PD 0x00000001
#define THIS_DRM_JAUNS_V1 0x00000002
#define THIS_DRM_JAUNS_V2 0x00000004
#define THIS_DRM_ND 0x00000008
#define fWMADec_Standrad 0x00000000
#define fWMADec_Professional 0x00000001
#define fWMADec_Lossless 0x00000002
typedef struct tagWMAGlobal
{
unsigned int dwSCR;
int dwSendDuration;
int wTotalPacketNumber;
unsigned short wDuration;
unsigned short m_userFlag;
unsigned int nDecodedSamples;
unsigned int WMAType;
unsigned int ContentDescOffset;
unsigned int ContentDescSize;
unsigned int ExtendedContentDescOffset;
unsigned int ExtendedContentDescSize;
unsigned int IsVBR;
unsigned int MaxBitrate;
long long tPresTime;
short *g_RightBuffer;
}tWMAGlobal;
extern unsigned int gWHAT_DRM;
extern unsigned int gWHAT_DRM_PB;
extern tWMAGlobal WMAGlobal;
extern unsigned int gWMADec_SupportCodec;
#define min(a, b) (((a) < (b)) ? (a) : (b))
#ifndef _WMAU8_DEFINED //8-bit unsigned type
#define _WMAU8_DEFINED
typedef unsigned char tWMA_U8;
#endif // _WMAU8_DEFINED
#ifndef _WMAI16_DEFINED //16-bit signed type
#define _WMAI16_DEFINED
typedef short tWMA_I16;
#endif // _WMAI16_DEFINED
#ifndef _WMAU16_DEFINED // 16-bit unsigned type
#define _WMAU16_DEFINED
typedef short tWMA_U16;
#endif // _WMAU16_DEFINED
#ifndef _WMAU32_DEFINED // 32-bit unsigned type
#define _WMAU32_DEFINED
typedef unsigned long tWMA_U32;
#endif // _WMAU32_DEFINED
#ifndef _WMABool_DEFINED // Bool
#define _WMABool_DEFINED
typedef long tWMA_Bool;
#endif // _WMABool_DEFINED
#ifndef _WMAU64_DEFINED // 64-bit unsigned type
#define _WMAU64_DEFINED
typedef unsigned long long tWMA_U64;
#endif // _WMAU64_DEFINED
#ifndef _WMAI64_DEFINED // 64-bit signed type
#define _WMAI64_DEFINED
typedef long long tWMA_I64;
#endif // _WMAI64_DEFINED
#ifndef _WMAFILESTATUS_DEFINED // status
#define _WMAFILESTATUS_DEFINED
typedef enum tagWMAFileStatus
{
cWMA_NoErr, /* -> always first entry */
/* remaining entry order is not guaranteed */
cWMA_Failed,
cWMA_BadArgument,
cWMA_BadAsfHeader,
cWMA_BadPacketHeader,
cWMA_BrokenFrame,
cWMA_NoMoreFrames,
cWMA_BadSamplingRate,
cWMA_BadNumberOfChannels,
cWMA_BadVersionNumber,
cWMA_BadWeightingMode,
cWMA_BadPacketization,
cWMA_BadDRMType,
cWMA_DRMFailed,
cWMA_DRMUnsupported,
cWMA_DemoExpired,
cWMA_BadState,
cWMA_Internal, /* really bad */
cWMA_NoMoreDataThisTime
} tWMAFileStatus;
#endif // _WMAFILESTATUS_DEFINED
#ifndef _WMAFILEVERSION_DEFINED // versions
#define _WMAFILEVERSION_DEFINED
typedef enum tagWMAFileVersion
{
cWMA_V1 = 1,
cWMA_V2 = 2
} tWMAFileVersion;
#endif // _WMAFILEVERSION_DEFINED
#ifndef _WMAFILECHANNELS_DEFINED // channels
#define _WMAFILECHANNELS_DEFINED
typedef enum tagWMAFileChannels
{
cWMA_C_Mono = 1,
cWMA_C_Stereo = 2
} tWMAFileChannels;
#endif // _WMAFILECHANNELS_DEFINED
/************************************************************************
* STRUCTURE DEFINE
************************************************************************/
#ifndef _WMAFILEHEADER_DEFINED // header
#define _WMAFILEHEADER_DEFINED
typedef /*PACKED*/ struct tagWMAFileHeader
{
tWMAFileVersion version; /* version of the codec */
tWMA_U32 sample_rate; /* sampling rate */
tWMAFileChannels num_channels; /* number of audio channels */
tWMA_U32 duration; /* of the file in milliseconds */
tWMA_U32 packet_size; /* size of an ASF packet */
tWMA_U64 first_packet_offset; /* byte offset to the first ASF packet */
tWMA_U64 last_packet_offset; /* byte offset to the last ASF packet */
tWMA_U32 has_DRM; /* does it have DRM encryption? */
tWMA_U32 LicenseLength; /* License Length in the header */
tWMA_U32 bitrate; /* bit-rate of the WMA bitstream */
// Added in V9
tWMA_U16 pcm_format_tag; /* wFormatTag in pcm header */
tWMA_U16 bits_per_sample; /* number of bits per sample of mono data (container size, always multiple of 8) */
tWMA_U16 valid_bits_per_sample; /* actual valid bits per sample of mono data (less than or equal to bits_per_sample) */
tWMA_U32 subformat_data1; /* GUID information */
tWMA_U16 subformat_data2; /* GUID information */
tWMA_U16 subformat_data3; /* GUID information */
tWMA_U8 subformat_data4[8]; /* GUID information */
tWMA_U32 channel_mask; /* which channels are present in stream */
} tWMAFileHeader;
#endif // _WMAFILEHEADER_DEFINED
#ifndef _WMAFILECONTDESC_DEFINED // content description
#define _WMAFILECONTDESC_DEFINED
typedef /*PACKED*/ struct tagWMAFileContDesc
{
/* *_len: as [in], they specify how large the corresponding
* buffers below are.
* as [out], they specify how large the returned
* buffers actually are.
*/
tWMA_U16 title_len;
tWMA_U16 author_len;
tWMA_U16 copyright_len;
tWMA_U16 description_len; // rarely used
tWMA_U16 rating_len; // rarely used
tWMA_U16 temp_short;
/* these are two-byte strings
* for ASCII-type character set, to convert these
* into a single-byte characters, simply skip
* over every other bytes.
*/
unsigned char *pTitle;
unsigned char *pAuthor;
unsigned char *pCopyright;
unsigned char *pDescription;
unsigned char *pRating;
} tWMAFileContDesc;
#endif // _WMAFILECONTDESC_DEFINED
/* license params */
#ifndef _WMAFILELICPARAMS_DEFINED
#define _WMAFILELICPARAMS_DEFINED
typedef /*PACKED*/ struct tagWMAFileLicParams
{
unsigned char *pPMID; // portable media id
tWMA_U32 cbPMID; // length of the pPMID buffer
} tWMAFileLicParams;
#endif // _WMAFILELICPARAMS_DEFINED
#ifndef _WMAFILESTATE_DEFINED // internal state
#define _WMAFILESTATE_DEFINED
typedef /*PACKED*/ struct tagWMAFileState
{
#ifdef WMA_PRO_LSL_INCLUDE
unsigned int internal[10000]; //for PRO or LSL
#else
unsigned int internal[8000]; //for STD
#endif
} tWMAFileState;
#endif // _WMAFILESTATE_DEFINED
#ifndef _WMAFILEHDRSTATE_DEFINED // another internal state
#define _WMAFILEHDRSTATE_DEFINED
typedef /*PACKED*/ struct tagWMAFileHdrState
{
unsigned char internal[240];
} tWMAFileHdrState;
#endif // _WMAFILEHDRSTATE_DEFINED
#ifndef _QWORD_DEFINED
#define _QWORD_DEFINED
typedef /*PACKED*/ struct tQWORD
{
tWMA_U32 dwLo;
tWMA_U32 dwHi;
} QWORD;
#endif /* _QWORD_DEFINED */
typedef void * tHWMAFileState;
typedef struct _MarkerEntry
{
QWORD m_qOffset;
QWORD m_qtime;
tWMA_U16 m_wEntryLen; // in byte
tWMA_U16 xx; // in byte
tWMA_U32 m_dwSendTime;
tWMA_U32 m_dwFlags;
tWMA_U32 m_dwDescLen; // in wchar
tWMA_U16 m_pwDescName[64];
} MarkerEntry;
/************************************************************************
* FUCTION DEFINE
************************************************************************/
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
/*
* WMAFileIsWMA
* ============
*
* Description
* -----------
* Checks to see if the file is decodable. Uses WMAFileCBGetData(),
* but the first argument to it is not really of type tHWMAFileState,
* but tWMAFileIdState.
*
* To decode the file, the app should call WMAFileDecodeInit() or WMAFileDecodeInitEx()
* instead.
*
* This function was added in case the app wants to determine the
* type of the file without fully allocating tHWMAFileState.
*
* Syntax
* ------
* tWMAFileStatus WMAFileIsWMA(tWMAFileHdrState *state);
*
* where:
*
* state pointer to the smaller structure that contains
* state of the checking function
*
* Return Value
* ------------
* cWMA_NoErr yes, it's a WMA file
* cWMA_BadArgument bad argument passed in
* cWMA_BadAsfHeader bad ASF header
*
*/
tWMAFileStatus RK_WMAFileIsWMA(tWMAFileHdrState *state);
tWMAFileStatus RK_WMAFileIsWMA_PB(tWMAFileHdrState *state);
/*
* WMAFileDecodeInit
* =================
*
* Description
* -----------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -