Home | History | Annotate | Download | only in include
      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 <utils/RefBase.h>
     23 #include <system/window.h>
     24 
     25 namespace android {
     26 
     27 struct AMessage;
     28 
     29 class SoftwareRenderer {
     30 public:
     31     explicit SoftwareRenderer(const sp<ANativeWindow> &nativeWindow);
     32 
     33     ~SoftwareRenderer();
     34 
     35     void render(
     36             const void *data, size_t size, int64_t timestampNs,
     37             void *platformPrivate, const sp<AMessage> &format);
     38 
     39 private:
     40     enum YUVMode {
     41         None,
     42     };
     43 
     44     OMX_COLOR_FORMATTYPE mColorFormat;
     45     ColorConverter *mConverter;
     46     YUVMode mYUVMode;
     47     sp<ANativeWindow> mNativeWindow;
     48     int32_t mWidth, mHeight;
     49     int32_t mCropLeft, mCropTop, mCropRight, mCropBottom;
     50     int32_t mCropWidth, mCropHeight;
     51 
     52     SoftwareRenderer(const SoftwareRenderer &);
     53     SoftwareRenderer &operator=(const SoftwareRenderer &);
     54 
     55     void resetFormatIfChanged(const sp<AMessage> &format);
     56 };
     57 
     58 }  // namespace android
     59 
     60 #endif  // SOFTWARE_RENDERER_H_
     61