blob: 70d0682a100bcbfec1829ec474ad013e26ff3fff [file] [log] [blame]
Andreas Huber4b3913a2011-05-11 14:13:42 -07001/*
2 * Copyright (C) 2011 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef SOFT_MP3_H_
18
19#define SOFT_MP3_H_
20
21#include "SimpleSoftOMXComponent.h"
22
23struct tPVMP3DecoderExternal;
24
25namespace android {
26
27struct SoftMP3 : public SimpleSoftOMXComponent {
28 SoftMP3(const char *name,
29 const OMX_CALLBACKTYPE *callbacks,
30 OMX_PTR appData,
31 OMX_COMPONENTTYPE **component);
32
33protected:
34 virtual ~SoftMP3();
35
36 virtual OMX_ERRORTYPE internalGetParameter(
37 OMX_INDEXTYPE index, OMX_PTR params);
38
39 virtual OMX_ERRORTYPE internalSetParameter(
40 OMX_INDEXTYPE index, const OMX_PTR params);
41
42 virtual void onQueueFilled(OMX_U32 portIndex);
43 virtual void onPortFlushCompleted(OMX_U32 portIndex);
44 virtual void onPortEnableCompleted(OMX_U32 portIndex, bool enabled);
45
46private:
47 enum {
48 kNumBuffers = 4,
49 kOutputBufferSize = 4608 * 2
50 };
51
52 tPVMP3DecoderExternal *mConfig;
53 void *mDecoderBuf;
54 int64_t mAnchorTimeUs;
55 int64_t mNumFramesOutput;
56
57 int32_t mNumChannels;
58 int32_t mSamplingRate;
59
60 bool mConfigured;
61
62 bool mSignalledError;
63
64 enum {
65 NONE,
66 AWAITING_DISABLED,
67 AWAITING_ENABLED
68 } mOutputPortSettingsChange;
69
70 void initPorts();
71 void initDecoder();
72
73 DISALLOW_EVIL_CONSTRUCTORS(SoftMP3);
74};
75
76} // namespace android
77
78#endif // SOFT_MP3_H_
79
80