blob: 732f0903b10324cebdd81864f8ed8b7365c1cd4b [file] [log] [blame]
Andreas Hubera1587462010-12-15 15:17:42 -08001/*
2 * Copyright (C) 2010 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 NUPLAYER_DECODER_H_
18
19#define NUPLAYER_DECODER_H_
20
21#include "NuPlayer.h"
22
23#include <media/stagefright/foundation/AHandler.h>
24
25namespace android {
26
Andreas Huber54e66492010-12-23 10:27:40 -080027struct ABuffer;
Andreas Hubera1587462010-12-15 15:17:42 -080028struct DecoderWrapper;
29
30struct NuPlayer::Decoder : public AHandler {
Glenn Kastencc562a32011-02-08 17:26:17 -080031 Decoder(const sp<AMessage> &notify,
32 const sp<NativeWindowWrapper> &nativeWindow = NULL);
Andreas Hubera1587462010-12-15 15:17:42 -080033
Andreas Huber54e66492010-12-23 10:27:40 -080034 void configure(const sp<MetaData> &meta);
Andreas Huber41c3f742010-12-21 10:22:33 -080035
Andreas Hubera1587462010-12-15 15:17:42 -080036 void signalFlush();
37 void signalResume();
Andreas Huber41c3f742010-12-21 10:22:33 -080038 void initiateShutdown();
Andreas Hubera1587462010-12-15 15:17:42 -080039
40protected:
41 virtual ~Decoder();
42
43 virtual void onMessageReceived(const sp<AMessage> &msg);
44
45private:
46 enum {
47 kWhatCodecNotify,
48 };
49
50 sp<AMessage> mNotify;
Glenn Kastencc562a32011-02-08 17:26:17 -080051 sp<NativeWindowWrapper> mNativeWindow;
Andreas Hubera1587462010-12-15 15:17:42 -080052
53 sp<ACodec> mCodec;
54 sp<DecoderWrapper> mWrapper;
55
56 Vector<sp<ABuffer> > mCSD;
57 size_t mCSDIndex;
58
59 sp<AMessage> makeFormat(const sp<MetaData> &meta);
60
61 void onFillThisBuffer(const sp<AMessage> &msg);
62
63 DISALLOW_EVIL_CONSTRUCTORS(Decoder);
64};
65
66} // namespace android
67
68#endif // NUPLAYER_DECODER_H_