NuPlayerDecoder.h revision 1173118eace0e9e347cb007f0da817cee87579ed
1/*
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
27struct ABuffer;
28struct DecoderWrapper;
29
30struct NuPlayer::Decoder : public AHandler {
31    Decoder(const sp<AMessage> &notify,
32            const sp<NativeWindowWrapper> &nativeWindow = NULL);
33
34    void configure(const sp<MetaData> &meta);
35
36    void signalFlush();
37    void signalResume();
38    void initiateShutdown();
39
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;
51    sp<NativeWindowWrapper> mNativeWindow;
52
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_
69