120111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber/*
220111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber * Copyright (C) 2009 The Android Open Source Project
320111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber *
420111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber * Licensed under the Apache License, Version 2.0 (the "License");
520111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber * you may not use this file except in compliance with the License.
620111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber * You may obtain a copy of the License at
720111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber *
820111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber *      http://www.apache.org/licenses/LICENSE-2.0
920111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber *
1020111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber * Unless required by applicable law or agreed to in writing, software
1120111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber * distributed under the License is distributed on an "AS IS" BASIS,
1220111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1320111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber * See the License for the specific language governing permissions and
1420111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber * limitations under the License.
1520111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber */
1620111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber
1720111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber#ifndef SOFTWARE_RENDERER_H_
1820111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber
1920111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber#define SOFTWARE_RENDERER_H_
2020111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber
212a4a7d5af053a17586a262a1267ba993e31790f1Andreas Huber#include <media/stagefright/ColorConverter.h>
2220111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber#include <utils/RefBase.h>
239eeafeb52fecf90882e9b44eeefcb7c3e16aa915Mathias Agopian#include <system/window.h>
2420111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber
2520111aa043c5f404472bc63b90bc5aad906b1101Andreas Hubernamespace android {
2620111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber
27475da7ef08c05a482ced8d318832cf5aa1141affRonghua Wustruct AMessage;
2820111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber
290a5ca668c6f7d45706e9aec4a1dfec0aacc6d233Andreas Huberclass SoftwareRenderer {
3020111aa043c5f404472bc63b90bc5aad906b1101Andreas Huberpublic:
31475da7ef08c05a482ced8d318832cf5aa1141affRonghua Wu    explicit SoftwareRenderer(const sp<ANativeWindow> &nativeWindow);
3220111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber
330a5ca668c6f7d45706e9aec4a1dfec0aacc6d233Andreas Huber    ~SoftwareRenderer();
3420111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber
350a5ca668c6f7d45706e9aec4a1dfec0aacc6d233Andreas Huber    void render(
36475da7ef08c05a482ced8d318832cf5aa1141affRonghua Wu            const void *data, size_t size, int64_t timestampNs,
37475da7ef08c05a482ced8d318832cf5aa1141affRonghua Wu            void *platformPrivate, const sp<AMessage> &format);
3820111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber
3920111aa043c5f404472bc63b90bc5aad906b1101Andreas Huberprivate:
405daeb129a2c2ba3d14ccd94af283b5f561c783eaAndreas Huber    enum YUVMode {
415daeb129a2c2ba3d14ccd94af283b5f561c783eaAndreas Huber        None,
425daeb129a2c2ba3d14ccd94af283b5f561c783eaAndreas Huber    };
435daeb129a2c2ba3d14ccd94af283b5f561c783eaAndreas Huber
4410f75b8c71beb7f327e50bbac8e528af4e40fa24Andreas Huber    OMX_COLOR_FORMATTYPE mColorFormat;
455daeb129a2c2ba3d14ccd94af283b5f561c783eaAndreas Huber    ColorConverter *mConverter;
465daeb129a2c2ba3d14ccd94af283b5f561c783eaAndreas Huber    YUVMode mYUVMode;
471173118eace0e9e347cb007f0da817cee87579edGlenn Kasten    sp<ANativeWindow> mNativeWindow;
48f5ab57c2d5e02af7483c94eddb177e4f5c9e9892Andreas Huber    int32_t mWidth, mHeight;
49f5ab57c2d5e02af7483c94eddb177e4f5c9e9892Andreas Huber    int32_t mCropLeft, mCropTop, mCropRight, mCropBottom;
503571d50a2582bc9c63f09cd81b4f490ea3522bd9Andreas Huber    int32_t mCropWidth, mCropHeight;
5120111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber
5220111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber    SoftwareRenderer(const SoftwareRenderer &);
5320111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber    SoftwareRenderer &operator=(const SoftwareRenderer &);
54475da7ef08c05a482ced8d318832cf5aa1141affRonghua Wu
55475da7ef08c05a482ced8d318832cf5aa1141affRonghua Wu    void resetFormatIfChanged(const sp<AMessage> &format);
5620111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber};
5720111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber
5820111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber}  // namespace android
5920111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber
6020111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber#endif  // SOFTWARE_RENDERER_H_
61