Chih-Chung Chang | 9969866 | 2011-06-30 14:21:38 +0800 | [diff] [blame] | 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_ |
Chih-Chung Chang | 9969866 | 2011-06-30 14:21:38 +0800 | [diff] [blame] | 18 | #define DUMMY_VIDEOSOURCE_H_ |
| 19 | |
Chih-Chung Chang | 9969866 | 2011-06-30 14:21:38 +0800 | [diff] [blame] | 20 | #include <media/stagefright/MediaSource.h> |
Chih-Chung Chang | 9969866 | 2011-06-30 14:21:38 +0800 | [diff] [blame] | 21 | #include "M4OSA_Clock.h" |
| 22 | #include "M4OSA_Time.h" |
| 23 | #include "M4OSA_Types.h" |
| 24 | |
Chih-Chung Chang | 9969866 | 2011-06-30 14:21:38 +0800 | [diff] [blame] | 25 | namespace android { |
| 26 | |
Chih-Chung Chang | 9969866 | 2011-06-30 14:21:38 +0800 | [diff] [blame] | 27 | class MediaBuffer; |
| 28 | class MetaData; |
| 29 | |
| 30 | struct DummyVideoSource : public MediaSource { |
| 31 | |
| 32 | public: |
James Dong | 00f742c | 2012-01-13 17:34:42 -0800 | [diff] [blame] | 33 | static sp<DummyVideoSource> Create( |
| 34 | uint32_t width, uint32_t height, |
| 35 | uint64_t clipDuration, const char *imageUri); |
Chih-Chung Chang | 9969866 | 2011-06-30 14:21:38 +0800 | [diff] [blame] | 36 | |
| 37 | virtual status_t start(MetaData *params = NULL); |
| 38 | virtual status_t stop(); |
| 39 | virtual sp<MetaData> getFormat(); |
James Dong | 00f742c | 2012-01-13 17:34:42 -0800 | [diff] [blame] | 40 | |
| 41 | virtual status_t read( |
| 42 | MediaBuffer **buffer, |
| 43 | const MediaSource::ReadOptions *options = NULL); |
Chih-Chung Chang | 9969866 | 2011-06-30 14:21:38 +0800 | [diff] [blame] | 44 | |
| 45 | protected: |
Chih-Chung Chang | 9969866 | 2011-06-30 14:21:38 +0800 | [diff] [blame] | 46 | virtual ~DummyVideoSource(); |
| 47 | |
| 48 | private: |
| 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 | |
James Dong | 00f742c | 2012-01-13 17:34:42 -0800 | [diff] [blame] | 59 | DummyVideoSource( |
| 60 | uint32_t width, uint32_t height, |
| 61 | uint64_t clipDuration, const char *imageUri); |
| 62 | |
| 63 | // Don't call me |
Chih-Chung Chang | 9969866 | 2011-06-30 14:21:38 +0800 | [diff] [blame] | 64 | DummyVideoSource(const DummyVideoSource &); |
| 65 | DummyVideoSource &operator=(const DummyVideoSource &); |
| 66 | |
| 67 | }; |
| 68 | |
| 69 | |
| 70 | }//namespace android |
| 71 | |
| 72 | |
| 73 | #endif //DUMMY_VIDEOSOURCE_H_ |
| 74 | |