182b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON/*
282b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON* Copyright (c) 2009-2011 Intel Corporation.  All rights reserved.
382b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON*
482b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON* Licensed under the Apache License, Version 2.0 (the "License");
582b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON* you may not use this file except in compliance with the License.
682b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON* You may obtain a copy of the License at
782b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON*
882b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON* http://www.apache.org/licenses/LICENSE-2.0
982b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON*
1082b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON* Unless required by applicable law or agreed to in writing, software
1182b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON* distributed under the License is distributed on an "AS IS" BASIS,
1282b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1382b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON* See the License for the specific language governing permissions and
1482b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON* limitations under the License.
1582b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON*/
1682b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON
1782b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON#ifndef __PV_SOFT_MPEG4_ENCODER__
1882b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON#define __PV_SOFT_MPEG4_ENCODER__
1982b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON
2082b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON#include <va/va.h>
2182b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON#include <va/va_tpi.h>
2282b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON#include "VideoEncoderDef.h"
2382b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON#include "VideoEncoderInterface.h"
2482b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON#include "IntelMetadataBuffer.h"
2582b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON
2682b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON#include <media/stagefright/MediaBuffer.h>
2782b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON#include <media/stagefright/foundation/ABase.h>
2882b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON#include "SimpleSoftOMXComponent.h"
2982b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON#include "mp4enc_api.h"
3082b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON
3182b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTONclass PVSoftMPEG4Encoder : IVideoEncoder {
3282b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON
3382b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTONpublic:
3482b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON    PVSoftMPEG4Encoder(const char *name);
3582b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON    virtual ~PVSoftMPEG4Encoder();
3682b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON
3782b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON    virtual Encode_Status start(void) {return initEncoder();}
3882b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON    virtual void flush(void) { }
3982b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON    virtual Encode_Status stop(void) {return releaseEncoder();}
4082b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON    virtual Encode_Status encode(VideoEncRawBuffer *inBuffer, uint32_t timeout);
4182b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON
4282b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON    virtual Encode_Status getOutput(VideoEncOutputBuffer *outBuffer, uint32_t timeout);
4382b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON
4482b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON    virtual Encode_Status getParameters(VideoParamConfigSet *videoEncParams);
4582b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON    virtual Encode_Status setParameters(VideoParamConfigSet *videoEncParams);
4682b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON    virtual Encode_Status setConfig(VideoParamConfigSet *videoEncConfig) {return ENCODE_SUCCESS;}
4782b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON    virtual Encode_Status getConfig(VideoParamConfigSet *videoEncConfig) {return ENCODE_SUCCESS;}
4882b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON    virtual Encode_Status getMaxOutSize(uint32_t *maxSize) {return ENCODE_SUCCESS;}
4982b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON
5082b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTONprivate:
5182b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON    void setDefaultParams(void);
5282b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON    VideoParamsCommon mComParams;
5382b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON
5482b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON    MP4EncodingMode mEncodeMode;
5582b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON    int32_t  mVideoWidth;
5682b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON    int32_t  mVideoHeight;
5782b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON    int32_t  mVideoFrameRate;
5882b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON    int32_t  mVideoBitRate;
5982b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON    int32_t  mVideoColorFormat;
6082b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON    bool     mStoreMetaDataInBuffers;
6182b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON    int32_t  mIDRFrameRefreshIntervalInSec;
6282b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON
6382b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON    int64_t  mNumInputFrames;
6482b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON    bool     mStarted;
6582b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON    bool     mSawInputEOS;
6682b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON    bool     mSignalledError;
6782b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON    int64_t mCurTimestampUs;
6882b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON    int64_t mLastTimestampUs;
6982b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON
7082b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON    tagvideoEncControls   *mHandle;
7182b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON    tagvideoEncOptions    *mEncParams;
7282b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON    uint8_t               *mInputFrameData;
7382b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON    uint8_t               *mTrimedInputData;
7482b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON    uint8_t mVolHeader[256];
7582b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON    int32_t mVolHeaderLength;
7682b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON
7782b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON    Encode_Status initEncParams();
7882b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON    Encode_Status initEncoder();
7982b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON    Encode_Status releaseEncoder();
8082b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON
8182b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON    DISALLOW_EVIL_CONSTRUCTORS(PVSoftMPEG4Encoder);
8282b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON};
8382b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON
8482b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON#endif
85