Main Page Modules Alphabetical List Compound List File List Compound Members File Members

# decmpa.h

Go to the documentation of this file.

    00001 /*  DecMPA - simple MPEG Audio decoding library.
    00002     Copyright (C) 2002  Hauke Duden
    00003
    00004     This library is free software; you can redistribute it and/or
    00005     modify it under the terms of the GNU Lesser General Public
    00006     License as published by the Free Software Foundation; either
    00007     version 2.1 of the License, or (at your option) any later version.
    00008
    00009     This library is distributed in the hope that it will be useful,
    00010     but WITHOUT ANY WARRANTY; without even the implied warranty of
    00011     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00012     Lesser General Public License for more details.
    00013
    00014     You should have received a copy of the GNU Lesser General Public
    00015     License along with this library; if not, write to the Free Software
    00016     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    00017
    00018         For more information look at the file License.txt in this package.
    00019
    00020         email: hazard_hd@users.sourceforge.net
    00021 */
    00022
    00023 #ifndef _DECMPA_H_
    00024 #define _DECMPA_H_
    00025
    00026
    00031 #ifndef DECMPA_VERSION
    00032
    00034         #define DECMPA_VERSION 1
    00035
    00036 #endif
    00037
    00038 #if defined(_WINDOWS) || defined(_WIN32)
    00039
    00040         #ifndef CALLBACK
    00041                 #include <windows.h>
    00042         #endif
    00043         #define DECMPA_CC CALLBACK
    00044
    00045 #else
    00046
    00047         #define DECMPA_CC
    00048
    00049 #endif
    00050
    00077
    00080 typedef struct
    00081 {
    00099         long (DECMPA_CC* Read)(void* pContext,void* pBuffer,long nBytes);
    00100
    00101
    00102
    00116         int (DECMPA_CC* Seek)(void* pContext,long DestPos);
    00117
    00118
    00119
    00133         long (DECMPA_CC* GetLength)(void* pContext);
    00134
    00135
    00136
    00149         long (DECMPA_CC* GetPosition)(void* pContext);
    00150
    00151 } DecMPA_Callbacks;
    00152
    00153
    00154
    00156 typedef struct
    00157 {
    00159         unsigned char aRawData[4];
    00160
    00162         int bProtection;
    00164         int nLayer;
    00166         int nVersion;
    00168         int bPadding;
    00170         int nFrequencyIndex;
    00172         int nFrequency;
    00174         int nBitRateIndex;
    00176         int nExtendedMode;
    00178         int nMode;
    00180         int bInputStereo;
    00182         int bMPEG25;
    00183
    00185         int nFrameSize;
    00188         int nDecodedSamplesPerFrame;
    00190         int nBitRateKbps;
    00191
    00192 } DecMPA_MPEGHeader;
    00193
    00194
    00197 typedef struct
    00198 {
    00201         int nType;
    00202
    00204         int nFrequency;
    00205
    00207         int nChannels;
    00208
    00209 } DecMPA_OutputFormat;
    00210
    00216
    00218 #define DECMPA_OK                                       0
    00219
    00221 #define DECMPA_END                                      1
    00222
    00224 #define DECMPA_ERROR_PARAM                      (-1)
    00225
    00227 #define DECMPA_ERROR_UNSUPPORTED        (-2)
    00228
    00230 #define DECMPA_ERROR_MEMORY                     (-3)
    00231
    00233 #define DECMPA_ERROR_INTERNAL           (-4)
    00234
    00237 #define DECMPA_ERROR_DECODE                     (-5)
    00238
    00240 #define DECMPA_ERROR_READ                       (-6)
    00241
    00244 #define DECMPA_ERROR_SEEK                       (-7)
    00245
    00247 #define DECMPA_ERROR_OPENFILE           (-8)
    00248
    00251 #define DECMPA_ERROR_WRONGSTATE         (-9)
    00252
    00254 #define DECMPA_ERROR_NOTAVAILABLE       (-10)
    00255
    00257 #define DECMPA_ERROR_INCOMPATIBLEVERSION        (-11)
    00258
    00259
    00267
    00272 #define DECMPA_PARAM_OUTPUT                     0
    00273
    00279 #define DECMPA_PARAM_PROVIDEID3V2       1
    00280
    00284 #define DECMPA_PARAMCOUNT                       2
    00285
    00286
    00287
    00290
    00293
    00295 #define DECMPA_YES      1
    00296
    00298 #define DECMPA_NO       0
    00299
    00304
    00311 #define DECMPA_OUTPUT_INT16                     0
    00312
    00319 #define DECMPA_OUTPUT_FLOAT                     1
    00320
    00324
    00325
    00326
    00327
    00330
    00331
    00346 int DECMPA_CC DecMPA_CreateUsingFile(void** ppDecoder,const char* sFilePath,int APIVersion);
    00347
    00348
    00349
    00365 int DECMPA_CC DecMPA_CreateUsingCallbacks(void** ppDecoder,const DecMPA_Callbacks* pCallbacks,void* pCallbackContext,int APIVersion);
    00366
    00367
    00368
    00384 int DECMPA_CC DecMPA_SetParam(void* pDecoder,int ID,long Value);
    00385
    00386
    00387
    00395 long DECMPA_CC DecMPA_GetParam(void* pDecoder,int ID);
    00396
    00397
    00398
    00414 int DECMPA_CC DecMPA_Decode(void* pDecoder,void* pBuffer,long nBufferBytes,long* pBytesDecoded);
    00415
    00416
    00417
    00436 int DECMPA_CC DecMPA_DecodeNoData(void* pDecoder,long* pDecodedBytes);
    00437
    00438
    00439
    00450 int DECMPA_CC DecMPA_SeekToTime(void* pDecoder,long Millis);
    00451
    00452
    00453
    00460 int DECMPA_CC DecMPA_GetTime(void* pDecoder,long* pTime);
    00461
    00462
    00463
    00480 int DECMPA_CC DecMPA_GetDuration(void* pDecoder,long* pDuration);
    00481
    00482
    00483
    00500 int DECMPA_CC DecMPA_GetOutputFormat(void* pDecoder,DecMPA_OutputFormat* pFormat);
    00501
    00502
    00503
    00508 int DECMPA_CC DecMPA_OutputFormatChanged(void* pDecoder);
    00509
    00510
    00511
    00518 int DECMPA_CC DecMPA_GetMPEGHeader(void* pDecoder,DecMPA_MPEGHeader* pHeader);
    00519
    00520
    00521
    00539 int DECMPA_CC DecMPA_GetID3v2Data(void* pDecoder,unsigned char** ppData,long* pDataSize);
    00540
    00541
    00542
    00546 void DECMPA_CC DecMPA_Destroy(void* pDecoder);
    00547
    00548
    00550 int DECMPA_CC DecMPA_GetVersion(void);
    00551
    00554 #endif
    00555
    00556