SoftVPX.h revision 50f939d655a5156157564cb91434f1cce424b2dd
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_VPX_H_
18
19#define SOFT_VPX_H_
20
21#include "SoftVideoDecoderOMXComponent.h"
22
23#include "vpx/vpx_decoder.h"
24#include "vpx/vpx_codec.h"
25#include "vpx/vp8dx.h"
26
27namespace android {
28
29struct SoftVPX : public SoftVideoDecoderOMXComponent {
30    SoftVPX(const char *name,
31            const char *componentRole,
32            OMX_VIDEO_CODINGTYPE codingType,
33            const OMX_CALLBACKTYPE *callbacks,
34            OMX_PTR appData,
35            OMX_COMPONENTTYPE **component);
36
37protected:
38    virtual ~SoftVPX();
39
40    virtual void onQueueFilled(OMX_U32 portIndex);
41
42private:
43    enum {
44        kNumBuffers = 4
45    };
46
47    enum {
48        MODE_VP8,
49        MODE_VP9
50    } mMode;
51
52    void *mCtx;
53
54    vpx_image_t *mImg;
55
56    status_t initDecoder();
57
58    DISALLOW_EVIL_CONSTRUCTORS(SoftVPX);
59};
60
61}  // namespace android
62
63#endif  // SOFT_VPX_H_
64