SoftMPEG4.h revision 3503cef001eded7330ac600b8e826e6d3d55737a
1/*
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_MPEG4_H_
18
19#define SOFT_MPEG4_H_
20
21#include "SoftVideoDecoderOMXComponent.h"
22
23struct tagvideoDecControls;
24
25namespace android {
26
27struct SoftMPEG4 : public SoftVideoDecoderOMXComponent {
28    SoftMPEG4(const char *name,
29            const char *componentRole,
30            OMX_VIDEO_CODINGTYPE codingType,
31            const CodecProfileLevel *profileLevels,
32            size_t numProfileLevels,
33            const OMX_CALLBACKTYPE *callbacks,
34            OMX_PTR appData,
35            OMX_COMPONENTTYPE **component);
36
37protected:
38    virtual ~SoftMPEG4();
39
40    virtual void onQueueFilled(OMX_U32 portIndex);
41    virtual void onPortFlushCompleted(OMX_U32 portIndex);
42    virtual void onReset();
43
44private:
45    enum {
46        kNumInputBuffers  = 4,
47        kNumOutputBuffers = 2,
48    };
49
50    enum {
51        MODE_MPEG4,
52        MODE_H263,
53    } mMode;
54
55    tagvideoDecControls *mHandle;
56
57    size_t mInputBufferCount;
58
59    bool mSignalledError;
60    bool mInitialized;
61    bool mFramesConfigured;
62
63    int32_t mNumSamplesOutput;
64    int32_t mPvTime;
65    KeyedVector<int32_t, OMX_TICKS> mPvToOmxTimeMap;
66
67    status_t initDecoder();
68
69    virtual void updatePortDefinitions(bool updateCrop = true);
70    bool handlePortSettingsChange();
71
72    DISALLOW_EVIL_CONSTRUCTORS(SoftMPEG4);
73};
74
75}  // namespace android
76
77#endif  // SOFT_MPEG4_H_
78
79
80