Home | History | Annotate | Download | only in lvpp
      1 /*
      2  * Copyright (C) 2011 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 DUMMY_AUDIOSOURCE_H_
     18 #define DUMMY_AUDIOSOURCE_H_
     19 
     20 #include <media/stagefright/MediaSource.h>
     21 
     22 
     23 namespace android {
     24 
     25 class MetaData;
     26 struct MediaBufferGroup;
     27 
     28 struct DummyAudioSource : public MediaSource {
     29 
     30 public:
     31     static sp<DummyAudioSource> Create(
     32                 int32_t samplingRate, int32_t channelCount,
     33                 int64_t frameDurationUs, int64_t audioDurationUs);
     34 
     35     virtual status_t start(MetaData *params = NULL);
     36     virtual status_t stop();
     37     virtual sp<MetaData> getFormat();
     38 
     39     virtual status_t read(
     40                 MediaBuffer **buffer,
     41                 const MediaSource::ReadOptions *options = NULL);
     42 
     43     void setDuration(int64_t audioDurationUs);
     44 
     45 protected:
     46     virtual ~DummyAudioSource();
     47 
     48 private:
     49     int32_t mSamplingRate;
     50     int32_t mChannelCount;
     51     int64_t mFrameDurationUs;
     52     int32_t mNumberOfSamplePerFrame;
     53     int64_t mAudioDurationUs;
     54     int64_t mTimeStampUs;
     55     Mutex mLock;
     56 
     57     MediaBufferGroup *mBufferGroup;
     58 
     59     DummyAudioSource(
     60             int32_t samplingRate, int32_t channelCount,
     61             int64_t frameDurationUs, int64_t audioDurationUs);
     62 
     63     // Don't call me
     64     DummyAudioSource(const DummyAudioSource &);
     65     DummyAudioSource &operator=(const DummyAudioSource &);
     66 
     67 };
     68 
     69 }//namespace android
     70 
     71 
     72 #endif //DUMMY_AUDIOSOURCE_H_
     73 
     74