SoftVideoEncoderOMXComponent.h revision 2edda09a2ad1d112c52acd37d323f63f0a492d67
1/* 2 * Copyright 2014 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 SOFT_VIDEO_ENCODER_OMX_COMPONENT_H_ 18 19#define SOFT_VIDEO_ENCODER_OMX_COMPONENT_H_ 20 21#include "SimpleSoftOMXComponent.h" 22#include <system/window.h> 23 24struct hw_module_t; 25 26namespace android { 27 28struct SoftVideoEncoderOMXComponent : public SimpleSoftOMXComponent { 29 SoftVideoEncoderOMXComponent( 30 const char *name, 31 const OMX_CALLBACKTYPE *callbacks, 32 OMX_PTR appData, 33 OMX_COMPONENTTYPE **component); 34 35protected: 36 static void ConvertFlexYUVToPlanar( 37 uint8_t *dst, size_t dstStride, size_t dstVStride, 38 struct android_ycbcr *ycbcr, int32_t width, int32_t height); 39 40 static void ConvertYUV420SemiPlanarToYUV420Planar( 41 const uint8_t *inYVU, uint8_t* outYUV, int32_t width, int32_t height); 42 43 static void ConvertRGB32ToPlanar( 44 uint8_t *dstY, size_t dstStride, size_t dstVStride, 45 const uint8_t *src, size_t width, size_t height, size_t srcStride, 46 bool bgr); 47 48 const uint8_t *extractGraphicBuffer( 49 uint8_t *dst, size_t dstSize, const uint8_t *src, size_t srcSize, 50 size_t width, size_t height) const; 51 52 virtual OMX_ERRORTYPE getExtensionIndex(const char *name, OMX_INDEXTYPE *index); 53 54 enum { 55 kInputPortIndex = 0, 56 kOutputPortIndex = 1, 57 }; 58 59private: 60 mutable const hw_module_t *mGrallocModule; 61 62 DISALLOW_EVIL_CONSTRUCTORS(SoftVideoEncoderOMXComponent); 63}; 64 65} // namespace android 66 67#endif // SOFT_VIDEO_ENCODER_OMX_COMPONENT_H_ 68