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