blob: 16514f2b5754bbfd0ab8b2b31bfb7d66b7b49030 [file] [log] [blame]
Chih-Chung Chang99698662011-06-30 14:21:38 +08001/*
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 Chang99698662011-06-30 14:21:38 +080018#define DUMMY_VIDEOSOURCE_H_
19
Chih-Chung Chang99698662011-06-30 14:21:38 +080020#include <media/stagefright/MediaSource.h>
Chih-Chung Chang99698662011-06-30 14:21:38 +080021#include "M4OSA_Clock.h"
22#include "M4OSA_Time.h"
23#include "M4OSA_Types.h"
24
Chih-Chung Chang99698662011-06-30 14:21:38 +080025namespace android {
26
Chih-Chung Chang99698662011-06-30 14:21:38 +080027class MediaBuffer;
28class MetaData;
29
30struct DummyVideoSource : public MediaSource {
31
32public:
James Dong00f742c2012-01-13 17:34:42 -080033 static sp<DummyVideoSource> Create(
34 uint32_t width, uint32_t height,
35 uint64_t clipDuration, const char *imageUri);
Chih-Chung Chang99698662011-06-30 14:21:38 +080036
37 virtual status_t start(MetaData *params = NULL);
38 virtual status_t stop();
39 virtual sp<MetaData> getFormat();
James Dong00f742c2012-01-13 17:34:42 -080040
41 virtual status_t read(
42 MediaBuffer **buffer,
43 const MediaSource::ReadOptions *options = NULL);
Chih-Chung Chang99698662011-06-30 14:21:38 +080044
45protected:
Chih-Chung Chang99698662011-06-30 14:21:38 +080046 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
James Dong00f742c2012-01-13 17:34:42 -080059 DummyVideoSource(
60 uint32_t width, uint32_t height,
61 uint64_t clipDuration, const char *imageUri);
62
63 // Don't call me
Chih-Chung Chang99698662011-06-30 14:21:38 +080064 DummyVideoSource(const DummyVideoSource &);
65 DummyVideoSource &operator=(const DummyVideoSource &);
66
67};
68
69
70}//namespace android
71
72
73#endif //DUMMY_VIDEOSOURCE_H_
74