19969866cfe5b17c6e481b90d81b011a0cece78a0Chih-Chung Chang/*
29969866cfe5b17c6e481b90d81b011a0cece78a0Chih-Chung Chang * Copyright (C) 2011 The Android Open Source Project
39969866cfe5b17c6e481b90d81b011a0cece78a0Chih-Chung Chang *
49969866cfe5b17c6e481b90d81b011a0cece78a0Chih-Chung Chang * Licensed under the Apache License, Version 2.0 (the "License");
59969866cfe5b17c6e481b90d81b011a0cece78a0Chih-Chung Chang * you may not use this file except in compliance with the License.
69969866cfe5b17c6e481b90d81b011a0cece78a0Chih-Chung Chang * You may obtain a copy of the License at
79969866cfe5b17c6e481b90d81b011a0cece78a0Chih-Chung Chang *
89969866cfe5b17c6e481b90d81b011a0cece78a0Chih-Chung Chang *      http://www.apache.org/licenses/LICENSE-2.0
99969866cfe5b17c6e481b90d81b011a0cece78a0Chih-Chung Chang *
109969866cfe5b17c6e481b90d81b011a0cece78a0Chih-Chung Chang * Unless required by applicable law or agreed to in writing, software
119969866cfe5b17c6e481b90d81b011a0cece78a0Chih-Chung Chang * distributed under the License is distributed on an "AS IS" BASIS,
129969866cfe5b17c6e481b90d81b011a0cece78a0Chih-Chung Chang * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
139969866cfe5b17c6e481b90d81b011a0cece78a0Chih-Chung Chang * See the License for the specific language governing permissions and
149969866cfe5b17c6e481b90d81b011a0cece78a0Chih-Chung Chang * limitations under the License.
159969866cfe5b17c6e481b90d81b011a0cece78a0Chih-Chung Chang */
169969866cfe5b17c6e481b90d81b011a0cece78a0Chih-Chung Chang
179969866cfe5b17c6e481b90d81b011a0cece78a0Chih-Chung Chang#ifndef DUMMY_AUDIOSOURCE_H_
189969866cfe5b17c6e481b90d81b011a0cece78a0Chih-Chung Chang#define DUMMY_AUDIOSOURCE_H_
199969866cfe5b17c6e481b90d81b011a0cece78a0Chih-Chung Chang
209969866cfe5b17c6e481b90d81b011a0cece78a0Chih-Chung Chang#include <media/stagefright/MediaSource.h>
219969866cfe5b17c6e481b90d81b011a0cece78a0Chih-Chung Chang
229969866cfe5b17c6e481b90d81b011a0cece78a0Chih-Chung Chang
239969866cfe5b17c6e481b90d81b011a0cece78a0Chih-Chung Changnamespace android {
249969866cfe5b17c6e481b90d81b011a0cece78a0Chih-Chung Chang
259969866cfe5b17c6e481b90d81b011a0cece78a0Chih-Chung Changclass MetaData;
269969866cfe5b17c6e481b90d81b011a0cece78a0Chih-Chung Changstruct MediaBufferGroup;
279969866cfe5b17c6e481b90d81b011a0cece78a0Chih-Chung Chang
289969866cfe5b17c6e481b90d81b011a0cece78a0Chih-Chung Changstruct DummyAudioSource : public MediaSource {
299969866cfe5b17c6e481b90d81b011a0cece78a0Chih-Chung Chang
309969866cfe5b17c6e481b90d81b011a0cece78a0Chih-Chung Changpublic:
3100f742c087d92e5452d29be1fb668022b5f8a6c7James Dong    static sp<DummyAudioSource> Create(
3200f742c087d92e5452d29be1fb668022b5f8a6c7James Dong                int32_t samplingRate, int32_t channelCount,
3300f742c087d92e5452d29be1fb668022b5f8a6c7James Dong                int64_t frameDurationUs, int64_t audioDurationUs);
3400f742c087d92e5452d29be1fb668022b5f8a6c7James Dong
359969866cfe5b17c6e481b90d81b011a0cece78a0Chih-Chung Chang    virtual status_t start(MetaData *params = NULL);
369969866cfe5b17c6e481b90d81b011a0cece78a0Chih-Chung Chang    virtual status_t stop();
379969866cfe5b17c6e481b90d81b011a0cece78a0Chih-Chung Chang    virtual sp<MetaData> getFormat();
3800f742c087d92e5452d29be1fb668022b5f8a6c7James Dong
3900f742c087d92e5452d29be1fb668022b5f8a6c7James Dong    virtual status_t read(
4000f742c087d92e5452d29be1fb668022b5f8a6c7James Dong                MediaBuffer **buffer,
4100f742c087d92e5452d29be1fb668022b5f8a6c7James Dong                const MediaSource::ReadOptions *options = NULL);
4200f742c087d92e5452d29be1fb668022b5f8a6c7James Dong
4300f742c087d92e5452d29be1fb668022b5f8a6c7James Dong    void setDuration(int64_t audioDurationUs);
449969866cfe5b17c6e481b90d81b011a0cece78a0Chih-Chung Chang
459969866cfe5b17c6e481b90d81b011a0cece78a0Chih-Chung Changprotected:
469969866cfe5b17c6e481b90d81b011a0cece78a0Chih-Chung Chang    virtual ~DummyAudioSource();
479969866cfe5b17c6e481b90d81b011a0cece78a0Chih-Chung Chang
489969866cfe5b17c6e481b90d81b011a0cece78a0Chih-Chung Changprivate:
499969866cfe5b17c6e481b90d81b011a0cece78a0Chih-Chung Chang    int32_t mSamplingRate;
509969866cfe5b17c6e481b90d81b011a0cece78a0Chih-Chung Chang    int32_t mChannelCount;
519969866cfe5b17c6e481b90d81b011a0cece78a0Chih-Chung Chang    int64_t mFrameDurationUs;
529969866cfe5b17c6e481b90d81b011a0cece78a0Chih-Chung Chang    int32_t mNumberOfSamplePerFrame;
539969866cfe5b17c6e481b90d81b011a0cece78a0Chih-Chung Chang    int64_t mAudioDurationUs;
549969866cfe5b17c6e481b90d81b011a0cece78a0Chih-Chung Chang    int64_t mTimeStampUs;
559969866cfe5b17c6e481b90d81b011a0cece78a0Chih-Chung Chang    Mutex mLock;
569969866cfe5b17c6e481b90d81b011a0cece78a0Chih-Chung Chang
579969866cfe5b17c6e481b90d81b011a0cece78a0Chih-Chung Chang    MediaBufferGroup *mBufferGroup;
589969866cfe5b17c6e481b90d81b011a0cece78a0Chih-Chung Chang
5900f742c087d92e5452d29be1fb668022b5f8a6c7James Dong    DummyAudioSource(
6000f742c087d92e5452d29be1fb668022b5f8a6c7James Dong            int32_t samplingRate, int32_t channelCount,
6100f742c087d92e5452d29be1fb668022b5f8a6c7James Dong            int64_t frameDurationUs, int64_t audioDurationUs);
6200f742c087d92e5452d29be1fb668022b5f8a6c7James Dong
6300f742c087d92e5452d29be1fb668022b5f8a6c7James Dong    // Don't call me
649969866cfe5b17c6e481b90d81b011a0cece78a0Chih-Chung Chang    DummyAudioSource(const DummyAudioSource &);
659969866cfe5b17c6e481b90d81b011a0cece78a0Chih-Chung Chang    DummyAudioSource &operator=(const DummyAudioSource &);
669969866cfe5b17c6e481b90d81b011a0cece78a0Chih-Chung Chang
679969866cfe5b17c6e481b90d81b011a0cece78a0Chih-Chung Chang};
689969866cfe5b17c6e481b90d81b011a0cece78a0Chih-Chung Chang
699969866cfe5b17c6e481b90d81b011a0cece78a0Chih-Chung Chang}//namespace android
709969866cfe5b17c6e481b90d81b011a0cece78a0Chih-Chung Chang
719969866cfe5b17c6e481b90d81b011a0cece78a0Chih-Chung Chang
729969866cfe5b17c6e481b90d81b011a0cece78a0Chih-Chung Chang#endif //DUMMY_AUDIOSOURCE_H_
739969866cfe5b17c6e481b90d81b011a0cece78a0Chih-Chung Chang
74