• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
25 namespace android {
26 
27 struct ABuffer;
28 
29 struct NuPlayer::Decoder : public AHandler {
30     Decoder(const sp<AMessage> &notify,
31             const sp<NativeWindowWrapper> &nativeWindow = NULL);
32 
33     void configure(const sp<AMessage> &format);
34 
35     void signalFlush();
36     void signalResume();
37     void initiateShutdown();
38 
39     bool supportsSeamlessFormatChange(const sp<AMessage> &to) const;
40 
41 protected:
42     virtual ~Decoder();
43 
44     virtual void onMessageReceived(const sp<AMessage> &msg);
45 
46 private:
47     enum {
48         kWhatCodecNotify        = 'cdcN',
49     };
50 
51     sp<AMessage> mNotify;
52     sp<NativeWindowWrapper> mNativeWindow;
53 
54     sp<AMessage> mFormat;
55     sp<ACodec> mCodec;
56     sp<ALooper> mCodecLooper;
57 
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 
65     bool supportsSeamlessAudioFormatChange(const sp<AMessage> &targetFormat) const;
66 
67     DISALLOW_EVIL_CONSTRUCTORS(Decoder);
68 };
69 
70 }  // namespace android
71 
72 #endif  // NUPLAYER_DECODER_H_
73