1/* 2 * Copyright (C) 2010 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 M4V_H263_ENCODER_H_ 18 19#define M4V_H263_ENCODER_H_ 20 21#include <media/stagefright/MediaBuffer.h> 22#include <media/stagefright/MediaSource.h> 23 24struct tagvideoEncControls; 25struct tagvideoEncOptions; 26 27namespace android { 28 29struct MediaBuffer; 30struct MediaBufferGroup; 31 32struct M4vH263Encoder : public MediaSource, 33 public MediaBufferObserver { 34 M4vH263Encoder(const sp<MediaSource> &source, 35 const sp<MetaData>& meta); 36 37 virtual status_t start(MetaData *params); 38 virtual status_t stop(); 39 40 virtual sp<MetaData> getFormat(); 41 42 virtual status_t read( 43 MediaBuffer **buffer, const ReadOptions *options); 44 45 virtual void signalBufferReturned(MediaBuffer *buffer); 46 47protected: 48 virtual ~M4vH263Encoder(); 49 50private: 51 sp<MediaSource> mSource; 52 sp<MetaData> mFormat; 53 sp<MetaData> mMeta; 54 55 int32_t mVideoWidth; 56 int32_t mVideoHeight; 57 int32_t mVideoFrameRate; 58 int32_t mVideoBitRate; 59 int32_t mVideoColorFormat; 60 int64_t mNumInputFrames; 61 int64_t mNextModTimeUs; 62 int64_t mPrevTimestampUs; 63 status_t mInitCheck; 64 bool mStarted; 65 66 tagvideoEncControls *mHandle; 67 tagvideoEncOptions *mEncParams; 68 MediaBuffer *mInputBuffer; 69 uint8_t *mInputFrameData; 70 MediaBufferGroup *mGroup; 71 72 status_t initCheck(const sp<MetaData>& meta); 73 void releaseOutputBuffers(); 74 75 M4vH263Encoder(const M4vH263Encoder &); 76 M4vH263Encoder &operator=(const M4vH263Encoder &); 77}; 78 79} // namespace android 80 81#endif // M4V_H263_ENCODER_H_ 82