blob: 686e637d5d3200c9834648d6330e2e5b8e597b76 [file] [log] [blame]
Dharmaray Kundargi643290d2011-01-16 16:02:42 -08001/*
2 * Copyright (C) 2011 NXP Software
3 * Copyright (C) 2011 The Android Open Source Project
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18#ifndef DUMMY_VIDEOSOURCE_H_
19
20#define DUMMY_VIDEOSOURCE_H_
21
22#include <utils/RefBase.h>
23#include <utils/threads.h>
Dharmaray Kundargi643290d2011-01-16 16:02:42 -080024#include <media/stagefright/MediaSource.h>
25#include <media/stagefright/DataSource.h>
26#include "OMX_IVCommon.h"
27#include "VideoEditorTools.h"
28#include "M4OSA_Clock.h"
29#include "M4OSA_Time.h"
30#include "M4OSA_Types.h"
31
32
33namespace android {
34
35
36class MediaBuffer;
37class MetaData;
Dharmaray Kundargi643290d2011-01-16 16:02:42 -080038
39struct DummyVideoSource : public MediaSource {
40
41public:
42 static sp<DummyVideoSource> Create(uint32_t width,
43 uint32_t height,
44 uint64_t clipDuration,
45 const char *imageUri);
46
47 virtual status_t start(MetaData *params = NULL);
48 virtual status_t stop();
49 virtual sp<MetaData> getFormat();
50 virtual status_t read(MediaBuffer **buffer,
51 const MediaSource::ReadOptions *options = NULL);
52
53protected:
54 DummyVideoSource (uint32_t width, uint32_t height,
55 uint64_t clipDuration, const char *imageUri);
56 virtual ~DummyVideoSource();
57
58private:
59 uint32_t mFrameWidth;
60 uint32_t mFrameHeight;
61 uint64_t mImageClipDuration;
62 const char *mUri;
63 int64_t mFrameTimeUs;
Dharmaray Kundargi643290d2011-01-16 16:02:42 -080064 bool mIsFirstImageFrame;
65 void *mImageBuffer;
66 M4OSA_Time mImagePlayStartTime;
67 uint32_t mImageSeekTime;
68
69 DummyVideoSource(const DummyVideoSource &);
70 DummyVideoSource &operator=(const DummyVideoSource &);
71
72};
73
74
75}//namespace android
76
77
78#endif //DUMMY_VIDEOSOURCE_H_
79