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