• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2 * Copyright (c) 2012 Intel Corporation.  All rights reserved.
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 
18 
19 #ifndef OMX_VIDEO_DECODER_VP9_HYBRID_H_
20 #define OMX_VIDEO_DECODER_VP9_HYBRID_H_
21 
22 #include "OMXVideoDecoderBase.h"
23 #include <dlfcn.h>
24 #define VPX_DECODE_BORDER 0
25 
26 class OMXVideoDecoderVP9Hybrid : public OMXVideoDecoderBase {
27 public:
28     OMXVideoDecoderVP9Hybrid();
29     virtual ~OMXVideoDecoderVP9Hybrid();
30 
31 protected:
32     virtual OMX_ERRORTYPE InitInputPortFormatSpecific(OMX_PARAM_PORTDEFINITIONTYPE *paramPortDefinitionInput);
33     virtual OMX_ERRORTYPE ProcessorInit(void);
34     virtual OMX_ERRORTYPE ProcessorDeinit(void);
35     virtual OMX_ERRORTYPE ProcessorStop(void);
36     virtual OMX_ERRORTYPE ProcessorFlush(OMX_U32 portIndex);
37     virtual OMX_ERRORTYPE ProcessorProcess(
38             OMX_BUFFERHEADERTYPE ***pBuffers,
39             buffer_retain_t *retains,
40             OMX_U32 numberBuffers);
41     virtual OMX_ERRORTYPE ProcessorReset(void);
42 
43     virtual OMX_ERRORTYPE ProcessorPreFillBuffer(OMX_BUFFERHEADERTYPE* buffer);
44     virtual bool IsAllBufferAvailable(void);
45 
46     virtual OMX_ERRORTYPE PrepareConfigBuffer(VideoConfigBuffer *p);
47     virtual OMX_ERRORTYPE PrepareDecodeBuffer(OMX_BUFFERHEADERTYPE *buffer, buffer_retain_t *retain, VideoDecodeBuffer *p);
48 
49     virtual OMX_ERRORTYPE BuildHandlerList(void);
50 
51     virtual OMX_ERRORTYPE FillRenderBuffer(OMX_BUFFERHEADERTYPE **pBuffer,  buffer_retain_t *retain, OMX_U32 inportBufferFlags, OMX_BOOL *isResolutionChange);
52 
53     virtual OMX_COLOR_FORMATTYPE GetOutputColorFormat(int width);
54     virtual OMX_ERRORTYPE GetDecoderOutputCropSpecific(OMX_PTR pStructure);
55     virtual OMX_ERRORTYPE GetNativeBufferUsageSpecific(OMX_PTR pStructure);
56     virtual OMX_ERRORTYPE SetNativeBufferModeSpecific(OMX_PTR pStructure);
57     virtual OMX_ERRORTYPE HandleFormatChange(void);
58     DECLARE_HANDLER(OMXVideoDecoderVP9Hybrid, ParamVideoVp9);
59 
60 private:
61     bool isReallocateNeeded(const uint8_t *data, uint32_t data_sz);
62     void *mCtx;
63     void *mHybridCtx;
64     void *mLibHandle;
65     // These members are for Adaptive playback
66     uint32_t mDecodedImageWidth;
67     uint32_t mDecodedImageHeight;
68     uint32_t mDecodedImageNewWidth;
69     uint32_t mDecodedImageNewHeight;
70     typedef bool (*OpenFunc)(void ** , void **);
71     typedef bool (*InitFunc)(void *,uint32_t, uint32_t, uint32_t, uint32_t, uint32_t,  bool, uint32_t *, bool);
72     typedef bool (*CloseFunc)(void *, void *);
73     typedef bool (*SingalRenderDoneFunc)(void *, unsigned int, bool);
74     typedef int (*DecodeFunc)(void *, void *, unsigned char *, unsigned int, bool);
75     typedef bool (*IsBufferAvailableFunc)(void *);
76     typedef int (*GetOutputFunc)(void*, void *, unsigned int *, unsigned int *);
77     typedef int (*GetRawDataOutputFunc)(void*, void *, unsigned char *, int, int);
78     typedef void (*DeinitFunc)(void *);
79     typedef bool (*GetFrameResolutionFunc)(const uint8_t *, uint32_t , uint32_t *, uint32_t *);
80     OpenFunc mOpenDecoder;
81     InitFunc mInitDecoder;
82     CloseFunc mCloseDecoder;
83     SingalRenderDoneFunc mSingalRenderDone;
84     DecodeFunc mDecoderDecode;
85     IsBufferAvailableFunc mCheckBufferAvailable;
86     GetOutputFunc mGetOutput;
87     GetRawDataOutputFunc mGetRawDataOutput;
88     GetFrameResolutionFunc mGetFrameResolution;
89     DeinitFunc mDeinitDecoder;
90     int64_t mLastTimeStamp;
91     enum {
92         // OMX_PARAM_PORTDEFINITIONTYPE
93         INPORT_MIN_BUFFER_COUNT = 1,
94         INPORT_ACTUAL_BUFFER_COUNT = 5,
95         INPORT_BUFFER_SIZE = 1382400,
96         OUTPORT_NATIVE_BUFFER_COUNT = 15, // 8 reference + 2 current + 4 for asynchronized mode + 1 free buffer
97     };
98 
99 };
100 
101 #endif
102 
103