• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2009 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 SOFTWARE_RENDERER_H_
18 
19 #define SOFTWARE_RENDERER_H_
20 
21 #include <media/stagefright/ColorConverter.h>
22 #include <media/stagefright/FrameRenderTracker.h>
23 #include <utils/RefBase.h>
24 #include <system/window.h>
25 #include <media/hardware/VideoAPI.h>
26 
27 #include <list>
28 
29 namespace android {
30 
31 struct AMessage;
32 
33 class SoftwareRenderer {
34 public:
35     explicit SoftwareRenderer(
36             const sp<ANativeWindow> &nativeWindow, int32_t rotation = 0);
37 
38     ~SoftwareRenderer();
39 
40     std::list<FrameRenderTracker::Info> render(
41             const void *data, size_t size, int64_t mediaTimeUs, nsecs_t renderTimeNs,
42             size_t numOutputBuffers, const sp<AMessage> &format);
43     void clearTracker();
44 
45 private:
46     enum YUVMode {
47         None,
48     };
49 
50     OMX_COLOR_FORMATTYPE mColorFormat;
51     ColorConverter *mConverter;
52     YUVMode mYUVMode;
53     sp<ANativeWindow> mNativeWindow;
54     int32_t mWidth, mHeight, mStride;
55     int32_t mCropLeft, mCropTop, mCropRight, mCropBottom;
56     int32_t mCropWidth, mCropHeight;
57     int32_t mRotationDegrees;
58     android_dataspace mDataSpace;
59     HDRStaticInfo mHDRStaticInfo;
60     FrameRenderTracker mRenderTracker;
61 
62     void resetFormatIfChanged(
63             const sp<AMessage> &format, size_t numOutputBuffers);
64 
65     SoftwareRenderer(const SoftwareRenderer &);
66     SoftwareRenderer &operator=(const SoftwareRenderer &);
67 };
68 
69 }  // namespace android
70 
71 #endif  // SOFTWARE_RENDERER_H_
72