📄 wmaudio.h
字号:
//*@@@+++@@@@******************************************************************//// Microsoft Windows Media// Copyright (C) Microsoft Corporation. All rights reserved.////*@@@---@@@@******************************************************************/* * Windows Media Audio (WMA) Decoder API * * Copyright (c) Microsoft Corporation 1999. All Rights Reserved. */#ifndef _WMAUDIO_API_H_#define _WMAUDIO_API_H_#if defined _WIN32#include <windows.h>#define _BOOL_DEFINED#endif#include "wmadefs.h" /* WMA9DEC_HAVE_WMDRM, DRM Implementation [FHA] */#ifdef WMDRM_NETWORK#include "drmcommon.h"#include "DrmAes.h"#endif//typedef struct _PCMFormat PCMFormat; //O.K. removed defined in pcmfmt.h#include "../include/pcmfmt.h"/*// added O.K.#ifdef WMA_TARGET_ARM #ifndef PACKED #ifdef __GNUCOMP_VERSION #define PACKED __attribute__((packed)) #else #define PACKED __packed #endif #endif#else #define PACKED#endif*///#define PACKED/*#ifdef _MSC_VER#define USE_PACK_HEADERS#define PACKED#else#undef USE_PACK_HEADERS#define PACKED __packed#endif#ifdef USE_PACK_HEADERS#include <pshpack1.h>#endif*//* ........................................................................... * * Types and Constants * =================== */#define WMA_NONSDMI_LIC 0x02#define WMA_SDMI_LIC 0x10#define WMA_BURNCD_LIC 0x08#define WMA_MAX_DATA_REQUESTED 128#define WMA_MAX_METADATA_LEN 512 // Max length (in bytes) of any metadata field - note that metadata is WCHAR, so use even numbers // We will truncate incoming metadata to this length (and skip past the remaining data). // If you want to support max allowable size, set this to 65535 (0xFFFF).enum { ECD_STRING = 0, ECD_BINARY = 1, ECD_BOOL = 2, ECD_DWORD = 3, ECD_QWORD = 4, ECD_WORD = 5};#if defined(_Embedded_x86)#pragma pack (1)#endif/* 8-bit signed type */#ifndef _WMAU8_DEFINED#define _WMAU8_DEFINEDtypedef unsigned char tWMA_U8;#endif /* _WMAU8_DEFINED *//* 16-bit signed type */#ifndef _WMAI16_DEFINED#define _WMAI16_DEFINEDtypedef short tWMA_I16;#endif /* _WMAI16_DEFINED *//* 16-bit unsigned type */#ifndef _WMAU16_DEFINED#define _WMAU16_DEFINEDtypedef unsigned short tWMA_U16;#endif /* _WMAU16_DEFINED *//* 32-bit unsigned type */#ifndef _WMAU32_DEFINED#define _WMAU32_DEFINEDtypedef unsigned long tWMA_U32;#endif /* _WMAU32_DEFINED *//* Bool */#ifndef _WMABool_DEFINED#define _WMABool_DEFINEDtypedef long tWMA_Bool;#endif /* _WMABool_DEFINED *//* 64-bit unsigned type */#ifndef _WMAU64_DEFINED#define _WMAU64_DEFINED#if defined(macintosh) || defined(_Embedded_x86) || defined(WMA_TARGET_ARM) //O.K. #ifdef __ARMCC_VERSION typedef unsigned __int64 tWMA_U64; #else typedef unsigned long long tWMA_U64; #endif #elsetypedef unsigned __int64 tWMA_U64;#endif#endif /* _WMAU64_DEFINED *//* 64-bit signed type */#ifndef _WMAI64_DEFINED#define _WMAI64_DEFINED#if defined(macintosh) || defined(_Embedded_x86)|| defined(WMA_TARGET_ARM) //O.K. #ifdef __ARMCC_VERSION typedef __int64 tWMA_I64; #else typedef long long tWMA_I64; #endif #elsetypedef __int64 tWMA_I64;#endif#endif /* _WMAI64_DEFINED */#ifndef _QWORD_DEFINED#define _QWORD_DEFINEDtypedef PACKED struct tQWORD{ tWMA_U32 dwLo; tWMA_U32 dwHi;} QWORD;#endif /* _QWORD_DEFINED */#define DESC_NAME_MAX_LENGTH 64typedef struct _MarkerEntry { QWORD m_qOffset; QWORD m_qtime; tWMA_U16 m_wEntryLen; tWMA_U32 m_dwSendTime; tWMA_U32 m_dwFlags; tWMA_U32 m_dwDescLen; tWMA_U16 m_pwDescName[DESC_NAME_MAX_LENGTH];} MarkerEntry;typedef struct _ECD_DESCRIPTOR { tWMA_U16 cbName; tWMA_U16 *pwszName; tWMA_U16 data_type; tWMA_U16 cbValue; union { tWMA_U16 *pwszString; tWMA_U8 *pbBinary; tWMA_Bool *pfBool; tWMA_U32 *pdwDword; tWMA_U64 *pqwQword; tWMA_U16 *pwWord; } uValue;} ECD_DESCRIPTOR;typedef struct tagWMAExtendedContentDescription{ tWMA_U16 cDescriptors; // number of descriptors ECD_DESCRIPTOR *pDescriptors; // pointer to all the descriptors} tWMAExtendedContentDesc;/* status */#ifndef _WMAFILESTATUS_DEFINED#define _WMAFILESTATUS_DEFINEDtypedef 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, cWMA_FBEnotReady, /* [OK] FBE not ready */ cWMA_FBElastFS /* [OK] FBE last FS */} tWMAFileStatus;#endif /* _WMAFILESTATUS_DEFINED *//* versions */#ifndef _WMAFILEVERSION_DEFINED#define _WMAFILEVERSION_DEFINEDtypedef enum tagWMAFileVersion{ cWMA_V1 = 1, cWMA_V2 = 2} tWMAFileVersion;#endif /* _WMAFILEVERSION_DEFINED *//* channels */#ifndef _WMAFILECHANNELS_DEFINED#define _WMAFILECHANNELS_DEFINEDtypedef enum tagWMAFileChannels{ cWMA_C_Mono = 1, cWMA_C_Stereo = 2} tWMAFileChannels;#endif /* _WMAFILECHANNELS_DEFINED *//* ........................................................................... * * Structures * ========== *//* header */#ifndef _WMAFILEHEADER_DEFINED#define _WMAFILEHEADER_DEFINEDtypedef 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 */ /* HongCho: what else? */} tWMAFileHeader;#endif /* _WMAFILEHEADER_DEFINED *//* content description */#ifndef _WMAFILECONTDESC_DEFINED#define _WMAFILECONTDESC_DEFINEDtypedef struct tagWMAFileContDesc//typedef PACKED struct tagWMAFileContDesc //O.K.{ /* *_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 */ /* 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_DEFINEDtypedef PACKED struct tagWMAFileLicParams{ unsigned char *pPMID; /* portable media id */ tWMA_U32 cbPMID; /* length of the pPMID buffer */} tWMAFileLicParams;#endif /* _WMAFILELICPARAMS_DEFINED */typedef void * tHWMAFileState;/* Date Params */#ifndef _WMADATEPARAMS_DEFINED#define _WMADATEPARAMS_DEFINEDtypedef PACKED struct tagWMADateParams{ tWMA_U16 year; tWMA_U8 month; tWMA_U8 day;} tWMADateParams; #endif /* _WMADATEPARAMS_DEFINED *//* another internal state */#ifndef _WMAFILEHDRSTATE_DEFINED#define _WMAFILEHDRSTATE_DEFINEDtypedef PACKED struct tagWMAFileHdrState{ unsigned char internal[ 240 #ifdef _ARM_ - 8 // [OK] WMA_MetaDataEntry *ptMetaDataEntry; + 8 // [LL] void* t_SongInfos takes 8bytes instead of 4B because of // alignment to U64 in thetagWMAFileHdrStateInternal structure#endif #ifdef WMDRM_PORTABLE + 8#endif#ifdef WMDRM_NETWORK + 144#endif ]; // additional 4 bytes for MBR support // unsigned char internal[212];} tWMAFileHdrState;#endif /* _WMAFILEHDRSTATE_DEFINED */#ifdef _Embedded_x86#pragma pack ()#endif/* ........................................................................... * * Functions * ========= */#ifdef __cplusplusextern "C"{#endif /* __cplusplus *//* * WMAFileDecodeCreate * =================== * * Description * ----------- * Create the WMAudio decoder. * * Must be called before WMAFileDecodeInit. * * Syntax * ------ * tWMAFileStatus WMAFileDecodeCreate(tHWMAFileState *phstate); * * where: * * phstate pointer to the handle that receives the Handle of the internal * state of the WMAudio decoder * * Return Value * ------------ * cWMA_NoErr decoder initialized * cWMA_Failed Memory allocation failed * cWMA_BadArgument bad argument passed in * */tWMAFileStatus WMAFileDecodeCreate (tHWMAFileState* phstate);#ifdef WMDRM_NETWORKtWMAFileStatus WMASetWMDRMNetworkAESKey( tHWMAFileState phstate, DRM_AES_KEY *pKey );#endif#ifdef _ELIMINATED/* * WMAFileDecodeInit * ================= * * Description * ----------- * Initializes the WMAudio decoder. * * This function or WMAFileDecodeInitEx must be called before starting to decode a WMA file. * * Syntax * ------ * tWMAFileStatus WMAFileDecodeInit (tHWMAFileState phstate, tWMA_U16 nPlayerOpt); * * where: * * phstate pointer to the handle that holds the internal * state of the WMAudio decoder * This memory should be cleared before the first call * to WMAFileDecodeInit * * nPlayerOpt: can be 0. * * Return Value * ------------ * cWMA_NoErr decoder initialized * cWMA_BadArgument bad argument passed in * cWMA_BadAsfHeader bad ASF header * cWMA_BadDRMType unknown encryption type * cWMA_DRMFailed DRM failed * cWMA_Failed decoder Initialization failed */tWMAFileStatus WMAFileDecodeInit (tHWMAFileState phstate, tWMA_U16 nPlayerOpt);#endif /*_ELIMINATED*//* * WMAFileDecodeInitEx * ================= * * Description * ----------- * Initializes the WMAudio decoder. * * Must be called before starting to decode a WMA file. * * Syntax * ------ * tWMAFileStatus WMAFileDecodeInitEx (tHWMAFileState phstate, tWMA_U16 nDecoderFlags, * tWMA_U16 nDRCSetting, tWMA_U32 nDstChannelMask, * tWMA_U32 nInterpResampRate, * PCMFORMAT *pPCMFormat, * tWMA_U16 wTargetAudioStream); * * where: * * phstate pointer to the handle that holds the internal
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -