blob: 78ea74a01bfeeea61734b287dc88eb80e819cbdb [file] [log] [blame]
Andreas Huberf9334412010-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 Huber5bc087c2010-12-23 10:27:40 -080027struct ABuffer;
Andreas Huberf9334412010-12-15 15:17:42 -080028
29struct NuPlayer::Decoder : public AHandler {
Glenn Kasten11731182011-02-08 17:26:17 -080030 Decoder(const sp<AMessage> &notify,
31 const sp<NativeWindowWrapper> &nativeWindow = NULL);
Andreas Huberf9334412010-12-15 15:17:42 -080032
Andreas Huber84066782011-08-16 09:34:26 -070033 void configure(const sp<AMessage> &format);
Andreas Huber3831a062010-12-21 10:22:33 -080034
Andreas Huberf9334412010-12-15 15:17:42 -080035 void signalFlush();
36 void signalResume();
Andreas Huber3831a062010-12-21 10:22:33 -080037 void initiateShutdown();
Andreas Huberf9334412010-12-15 15:17:42 -080038
Robert Shih0523da82014-01-23 16:18:22 -080039 bool supportsSeamlessFormatChange(const sp<AMessage> &to) const;
40
Andreas Huberf9334412010-12-15 15:17:42 -080041protected:
42 virtual ~Decoder();
43
44 virtual void onMessageReceived(const sp<AMessage> &msg);
45
46private:
47 enum {
Andreas Huber078cfcf2011-09-15 12:25:04 -070048 kWhatCodecNotify = 'cdcN',
Andreas Huberf9334412010-12-15 15:17:42 -080049 };
50
51 sp<AMessage> mNotify;
Glenn Kasten11731182011-02-08 17:26:17 -080052 sp<NativeWindowWrapper> mNativeWindow;
Andreas Huberf9334412010-12-15 15:17:42 -080053
Robert Shih0523da82014-01-23 16:18:22 -080054 sp<AMessage> mFormat;
Andreas Huberf9334412010-12-15 15:17:42 -080055 sp<ACodec> mCodec;
Andreas Huber078cfcf2011-09-15 12:25:04 -070056 sp<ALooper> mCodecLooper;
Andreas Huberf9334412010-12-15 15:17:42 -080057
58 Vector<sp<ABuffer> > mCSD;
59 size_t mCSDIndex;
60
61 sp<AMessage> makeFormat(const sp<MetaData> &meta);
62
63 void onFillThisBuffer(const sp<AMessage> &msg);
64
Robert Shih0523da82014-01-23 16:18:22 -080065 bool supportsSeamlessAudioFormatChange(const sp<AMessage> &targetFormat) const;
66
Andreas Huberf9334412010-12-15 15:17:42 -080067 DISALLOW_EVIL_CONSTRUCTORS(Decoder);
68};
69
70} // namespace android
71
72#endif // NUPLAYER_DECODER_H_