• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2010 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 SEC_HARDWARE_RENDERER_H_
18 
19 #define SEC_HARDWARE_RENDERER_H_
20 
21 #include <media/stagefright/VideoRenderer.h>
22 #include <utils/RefBase.h>
23 #include <utils/Vector.h>
24 
25 #include <OMX_Component.h>
26 
27 #include <binder/MemoryHeapBase.h>
28 #include <binder/MemoryHeapPmem.h>
29 
30 namespace android {
31 
32 class ISurface;
33 class Overlay;
34 
35 class SecHardwareRenderer : public VideoRenderer {
36 public:
37     SecHardwareRenderer(
38             const sp<ISurface> &surface,
39             size_t displayWidth, size_t displayHeight,
40             size_t decodedWidth, size_t decodedHeight,
41             OMX_COLOR_FORMATTYPE colorFormat,
42             int32_t rotationDegrees,
43             bool fromHardwareDecoder);
44 
45     virtual ~SecHardwareRenderer();
46 
initCheck()47     status_t initCheck() const { return mInitCheck; }
48 
49     virtual void render(
50             const void *data, size_t size, void *platformPrivate);
51 
52 
53 private:
54     sp<ISurface> mISurface;
55     size_t mDisplayWidth, mDisplayHeight;
56     size_t mDecodedWidth, mDecodedHeight;
57     OMX_COLOR_FORMATTYPE mColorFormat;
58     status_t mInitCheck;
59     size_t mFrameSize;
60     sp<Overlay> mOverlay;
61     sp<MemoryHeapBase> mMemoryHeap;
62     Vector<void *> mOverlayAddresses;
63     bool mIsFirstFrame;
64     int mNumBuf;
65     size_t mIndex;
66     bool mCustomFormat;
67 
68 
69     SecHardwareRenderer(const SecHardwareRenderer &);
70     SecHardwareRenderer &operator=(const SecHardwareRenderer &);
71 
72     void handleYUV420Planar(const void *, size_t);
73 };
74 
75 }  // namespace android
76 
77 #endif  // SEC_HARDWARE_RENDERER_H_
78 
79