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 26 #include <list> 27 28 namespace android { 29 30 struct AMessage; 31 32 class SoftwareRenderer { 33 public: 34 explicit SoftwareRenderer( 35 const sp<ANativeWindow> &nativeWindow, int32_t rotation = 0); 36 37 ~SoftwareRenderer(); 38 39 std::list<FrameRenderTracker::Info> render( 40 const void *data, size_t size, int64_t mediaTimeUs, nsecs_t renderTimeNs, 41 void *platformPrivate, const sp<AMessage> &format); 42 void clearTracker(); 43 44 private: 45 enum YUVMode { 46 None, 47 }; 48 49 OMX_COLOR_FORMATTYPE mColorFormat; 50 ColorConverter *mConverter; 51 YUVMode mYUVMode; 52 sp<ANativeWindow> mNativeWindow; 53 int32_t mWidth, mHeight; 54 int32_t mCropLeft, mCropTop, mCropRight, mCropBottom; 55 int32_t mCropWidth, mCropHeight; 56 int32_t mRotationDegrees; 57 android_dataspace mDataSpace; 58 FrameRenderTracker mRenderTracker; 59 60 SoftwareRenderer(const SoftwareRenderer &); 61 SoftwareRenderer &operator=(const SoftwareRenderer &); 62 63 void resetFormatIfChanged(const sp<AMessage> &format); 64 }; 65 66 } // namespace android 67 68 #endif // SOFTWARE_RENDERER_H_ 69