blob: b329bb4d4dce933770151585a2a7759dae7e04a4 [file] [log] [blame]
Dharmaray Kundargi643290d2011-01-16 16:02:42 -08001/*
Dharmaray Kundargi643290d2011-01-16 16:02:42 -08002 * 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
28namespace android {
29
30
31class MediaBuffer;
32class MetaData;
33struct MediaBufferGroup;
34
35
36
37struct DummyAudioSource : public MediaSource {
38
39public:
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 Chowdury1c97d9a2011-02-21 15:43:33 -080047 virtual status_t read (MediaBuffer **buffer,
Dharmaray Kundargi643290d2011-01-16 16:02:42 -080048 const MediaSource::ReadOptions *options = NULL);
Rajneesh Chowdury1c97d9a2011-02-21 15:43:33 -080049 void setDuration (int64_t audioDurationUs);
Dharmaray Kundargi643290d2011-01-16 16:02:42 -080050
51protected:
52 DummyAudioSource (int32_t samplingRate,
53 int32_t channelCount,
54 int64_t frameDurationUs,
55 int64_t audioDurationUs);
56 virtual ~DummyAudioSource();
57
58private:
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 Chowdury1c97d9a2011-02-21 15:43:33 -080065 Mutex mLock;
66
Dharmaray Kundargi643290d2011-01-16 16:02:42 -080067 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