NuPlayerDecoder.h revision f933441648ef6a71dee783d733aac17b9508b452
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 DecoderWrapper;
28
29struct NuPlayer::Decoder : public AHandler {
30    Decoder(const sp<AMessage> &notify, const sp<Surface> &surface = NULL);
31
32    void configure(const sp<MetaData> &meta);
33    void signalFlush();
34    void signalResume();
35
36protected:
37    virtual ~Decoder();
38
39    virtual void onMessageReceived(const sp<AMessage> &msg);
40
41private:
42    enum {
43        kWhatCodecNotify,
44    };
45
46    sp<AMessage> mNotify;
47    sp<Surface> mSurface;
48
49    sp<ACodec> mCodec;
50    sp<DecoderWrapper> mWrapper;
51
52    Vector<sp<ABuffer> > mCSD;
53    size_t mCSDIndex;
54
55    sp<AMessage> makeFormat(const sp<MetaData> &meta);
56
57    void onFillThisBuffer(const sp<AMessage> &msg);
58
59    DISALLOW_EVIL_CONSTRUCTORS(Decoder);
60};
61
62}  // namespace android
63
64#endif  // NUPLAYER_DECODER_H_
65