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_VIDEOSOURCE_H_ 18#define DUMMY_VIDEOSOURCE_H_ 19 20#include <media/stagefright/MediaSource.h> 21#include "M4OSA_Clock.h" 22#include "M4OSA_Time.h" 23#include "M4OSA_Types.h" 24 25namespace android { 26 27class MediaBuffer; 28class MetaData; 29 30struct DummyVideoSource : public MediaSource { 31 32public: 33 static sp<DummyVideoSource> Create( 34 uint32_t width, uint32_t height, 35 uint64_t clipDuration, const char *imageUri); 36 37 virtual status_t start(MetaData *params = NULL); 38 virtual status_t stop(); 39 virtual sp<MetaData> getFormat(); 40 41 virtual status_t read( 42 MediaBuffer **buffer, 43 const MediaSource::ReadOptions *options = NULL); 44 45protected: 46 virtual ~DummyVideoSource(); 47 48private: 49 uint32_t mFrameWidth; 50 uint32_t mFrameHeight; 51 uint64_t mImageClipDuration; 52 const char *mUri; 53 int64_t mFrameTimeUs; 54 bool mIsFirstImageFrame; 55 void *mImageBuffer; 56 M4OSA_Time mImagePlayStartTime; 57 uint32_t mImageSeekTime; 58 59 DummyVideoSource( 60 uint32_t width, uint32_t height, 61 uint64_t clipDuration, const char *imageUri); 62 63 // Don't call me 64 DummyVideoSource(const DummyVideoSource &); 65 DummyVideoSource &operator=(const DummyVideoSource &); 66 67}; 68 69 70}//namespace android 71 72 73#endif //DUMMY_VIDEOSOURCE_H_ 74 75