Home | History | Annotate | Download | only in include
      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 AMR_WB_ENCODER_H
     18 #define AMR_WB_ENCODER_H
     19 
     20 #include <media/stagefright/MediaSource.h>
     21 #include <media/stagefright/MetaData.h>
     22 
     23 struct VO_AUDIO_CODECAPI;
     24 struct VO_MEM_OPERATOR;
     25 
     26 namespace android {
     27 
     28 struct MediaBufferGroup;
     29 
     30 class AMRWBEncoder: public MediaSource {
     31     public:
     32         AMRWBEncoder(const sp<MediaSource> &source, const sp<MetaData> &meta);
     33 
     34         virtual status_t start(MetaData *params);
     35         virtual status_t stop();
     36         virtual sp<MetaData> getFormat();
     37         virtual status_t read(
     38                 MediaBuffer **buffer, const ReadOptions *options);
     39 
     40 
     41     protected:
     42         virtual ~AMRWBEncoder();
     43 
     44     private:
     45         sp<MediaSource>   mSource;
     46         sp<MetaData>      mMeta;
     47         bool              mStarted;
     48         MediaBufferGroup *mBufferGroup;
     49         MediaBuffer      *mInputBuffer;
     50         status_t          mInitCheck;
     51         int32_t           mBitRate;
     52         void             *mEncoderHandle;
     53         VO_AUDIO_CODECAPI *mApiHandle;
     54         VO_MEM_OPERATOR  *mMemOperator;
     55 
     56         int64_t mAnchorTimeUs;
     57         int64_t mNumFramesOutput;
     58 
     59         int16_t mInputFrame[320];
     60         int32_t mNumInputSamples;
     61 
     62         status_t initCheck();
     63 
     64         AMRWBEncoder& operator=(const AMRWBEncoder &rhs);
     65         AMRWBEncoder(const AMRWBEncoder& copy);
     66 
     67 };
     68 
     69 }
     70 
     71 #endif  //#ifndef AMR_WB_ENCODER_H
     72 
     73