• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-2021 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef __MINIMP3_WRAPPER_H__
17 #define __MINIMP3_WRAPPER_H__
18 
19 #include "minimp3.h"
20 #include "minimp3_ex.h"
21 
22 typedef mp3dec_t            Minimp3WrapperMp3dec;
23 typedef mp3d_sample_t       Minimp3WrapperMp3dSample;
24 typedef mp3dec_frame_info_t Minimp3WrapperMp3decFrameInfo;
25 typedef mp3dec_io_t         Minimp3WrapperMp3decIO;
26 typedef MP3D_ITERATE_CB     MINIMP3_WRAPPER_MP3D_ITERATE_CB;
27 
28 #ifdef __cplusplus
29 extern "C"
30 {
31 #endif
32 
33     typedef struct {
34         void (*init)(Minimp3WrapperMp3dec *dec);
35 
36         int (*decoderFrame)(Minimp3WrapperMp3dec *dec, const uint8_t *mp3, int mp3Bytes,
37                             Minimp3WrapperMp3dSample *pcm, Minimp3WrapperMp3decFrameInfo *info);
38 
39         int (*detecBuf)(const uint8_t *buf, size_t bufSize);
40 
41         int (*detecCb)(Minimp3WrapperMp3decIO *io, uint8_t *buf, size_t bufSize);
42 
43         int (*iterateBuf)(const uint8_t *buf, size_t bufSize, MINIMP3_WRAPPER_MP3D_ITERATE_CB callback, void *userData);
44 
45         int (*iterateCb)(Minimp3WrapperMp3decIO *io, uint8_t *buf, size_t bufSize,
46                          MINIMP3_WRAPPER_MP3D_ITERATE_CB callback, void *userData);
47     } Minimp3DemuxerOp;
48 
49     void Minimp3WrapperMp3decInit(Minimp3WrapperMp3dec *dec);
50 
51     int Minimp3WrapperMp3decDecodeFrame(Minimp3WrapperMp3dec *dec, const uint8_t *mp3, int mp3Bytes,
52                                         Minimp3WrapperMp3dSample *pcm, Minimp3WrapperMp3decFrameInfo *info);
53 
54     int Minimp3WrapperMp3decDetectBuf(const uint8_t *buf, size_t bufSize);
55 
56     int Minimp3WrapperMp3decDetectCb(Minimp3WrapperMp3decIO *io, uint8_t *buf, size_t bufSize);
57 
58     int Minimp3WrapperMp3decIterateBuf(const uint8_t *buf, size_t bufSize,
59                                        MINIMP3_WRAPPER_MP3D_ITERATE_CB callback, void *userData);
60 
61     int Minimp3WrapperMp3decIterateCb(Minimp3WrapperMp3decIO *io, uint8_t *buf, size_t bufSize,
62                                       MINIMP3_WRAPPER_MP3D_ITERATE_CB callback, void *userData);
63 
64     Minimp3DemuxerOp MiniMp3GetOpt(void);
65 
66 #ifdef __cplusplus
67 }
68 #endif
69 
70 #endif