Dharmaray Kundargi | 643290d | 2011-01-16 16:02:42 -0800 | [diff] [blame] | 1 | /*
|
Dharmaray Kundargi | 643290d | 2011-01-16 16:02:42 -0800 | [diff] [blame] | 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 |
|
| 19 | #define DUMMY_AUDIOSOURCE_H_
|
| 20 |
|
| 21 | #include <utils/RefBase.h>
|
| 22 | #include <utils/threads.h>
|
| 23 | #include <media/stagefright/MediaBufferGroup.h>
|
| 24 | #include <media/stagefright/MediaSource.h>
|
| 25 | #include <media/stagefright/DataSource.h>
|
| 26 |
|
| 27 |
|
| 28 | namespace android {
|
| 29 |
|
| 30 |
|
| 31 | class MediaBuffer;
|
| 32 | class MetaData;
|
| 33 | struct MediaBufferGroup;
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 | struct DummyAudioSource : public MediaSource {
|
| 38 |
|
| 39 | public:
|
| 40 | static sp<DummyAudioSource> Create(int32_t samplingRate,
|
| 41 | int32_t channelCount,
|
| 42 | int64_t frameDurationUs,
|
| 43 | int64_t audioDurationUs);
|
| 44 | virtual status_t start(MetaData *params = NULL);
|
| 45 | virtual status_t stop();
|
| 46 | virtual sp<MetaData> getFormat();
|
Rajneesh Chowdury | 1c97d9a | 2011-02-21 15:43:33 -0800 | [diff] [blame] | 47 | virtual status_t read (MediaBuffer **buffer,
|
Dharmaray Kundargi | 643290d | 2011-01-16 16:02:42 -0800 | [diff] [blame] | 48 | const MediaSource::ReadOptions *options = NULL);
|
Rajneesh Chowdury | 1c97d9a | 2011-02-21 15:43:33 -0800 | [diff] [blame] | 49 | void setDuration (int64_t audioDurationUs);
|
Dharmaray Kundargi | 643290d | 2011-01-16 16:02:42 -0800 | [diff] [blame] | 50 |
|
| 51 | protected:
|
| 52 | DummyAudioSource (int32_t samplingRate,
|
| 53 | int32_t channelCount,
|
| 54 | int64_t frameDurationUs,
|
| 55 | int64_t audioDurationUs);
|
| 56 | virtual ~DummyAudioSource();
|
| 57 |
|
| 58 | private:
|
| 59 | int32_t mSamplingRate;
|
| 60 | int32_t mChannelCount;
|
| 61 | int64_t mFrameDurationUs;
|
| 62 | int32_t mNumberOfSamplePerFrame;
|
| 63 | int64_t mAudioDurationUs;
|
| 64 | int64_t mTimeStampUs;
|
Rajneesh Chowdury | 1c97d9a | 2011-02-21 15:43:33 -0800 | [diff] [blame] | 65 | Mutex mLock;
|
| 66 |
|
Dharmaray Kundargi | 643290d | 2011-01-16 16:02:42 -0800 | [diff] [blame] | 67 | MediaBufferGroup *mBufferGroup;
|
| 68 |
|
| 69 | DummyAudioSource(const DummyAudioSource &);
|
| 70 | DummyAudioSource &operator=(const DummyAudioSource &);
|
| 71 |
|
| 72 | };
|
| 73 |
|
| 74 | }//namespace android
|
| 75 |
|
| 76 |
|
| 77 | #endif //DUMMY_AUDIOSOURCE_H_
|
| 78 |
|