OSDN Git Service

original
[gb-231r1-is01/Gingerbread_2.3.3_r1_IS01.git] / frameworks / base / media / libstagefright / include / M4vH263Decoder.h
1 /*
2  * Copyright (C) 2009 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 M4V_H263_DECODER_H_
18
19 #define M4V_H263_DECODER_H_
20
21 #include <media/stagefright/MediaBuffer.h>
22 #include <media/stagefright/MediaSource.h>
23
24 struct tagvideoDecControls;
25
26 namespace android {
27
28 struct M4vH263Decoder : public MediaSource,
29                         public MediaBufferObserver {
30     M4vH263Decoder(const sp<MediaSource> &source);
31
32     virtual status_t start(MetaData *params);
33     virtual status_t stop();
34
35     virtual sp<MetaData> getFormat();
36
37     virtual status_t read(
38             MediaBuffer **buffer, const ReadOptions *options);
39
40     virtual void signalBufferReturned(MediaBuffer *buffer);
41
42 protected:
43     virtual ~M4vH263Decoder();
44
45 private:
46     sp<MediaSource> mSource;
47     bool mStarted;
48     int32_t mWidth, mHeight;
49
50     sp<MetaData> mFormat;
51
52     tagvideoDecControls *mHandle;
53     MediaBuffer *mFrames[2];
54     MediaBuffer *mInputBuffer;
55
56     int64_t mNumSamplesOutput;
57     int64_t mTargetTimeUs;
58
59     void allocateFrames(int32_t width, int32_t height);
60     void releaseFrames();
61
62     M4vH263Decoder(const M4vH263Decoder &);
63     M4vH263Decoder &operator=(const M4vH263Decoder &);
64 };
65
66 }  // namespace android
67
68 #endif  // M4V_H263_DECODER_H_