Wei Jia | bc2fb72 | 2014-07-08 16:37:57 -0700 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (C) 2014 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_PASS_THROUGH_H_ |
| 18 | |
| 19 | #define NUPLAYER_DECODER_PASS_THROUGH_H_ |
| 20 | |
| 21 | #include "NuPlayer.h" |
| 22 | |
| 23 | #include "NuPlayerDecoder.h" |
| 24 | |
| 25 | namespace android { |
| 26 | |
| 27 | struct NuPlayer::DecoderPassThrough : public Decoder { |
| 28 | DecoderPassThrough(const sp<AMessage> ¬ify); |
| 29 | |
| 30 | virtual void configure(const sp<AMessage> &format); |
| 31 | virtual void init(); |
| 32 | |
| 33 | virtual void signalFlush(); |
| 34 | virtual void signalResume(); |
| 35 | virtual void initiateShutdown(); |
| 36 | |
| 37 | bool supportsSeamlessFormatChange(const sp<AMessage> &to) const; |
| 38 | |
| 39 | protected: |
| 40 | |
| 41 | virtual ~DecoderPassThrough(); |
| 42 | |
| 43 | virtual void onMessageReceived(const sp<AMessage> &msg); |
| 44 | |
| 45 | private: |
| 46 | enum { |
| 47 | kWhatRequestABuffer = 'reqB', |
| 48 | kWhatConfigure = 'conf', |
| 49 | kWhatInputBufferFilled = 'inpF', |
| 50 | kWhatBufferConsumed = 'bufC', |
| 51 | kWhatFlush = 'flus', |
| 52 | kWhatShutdown = 'shuD', |
| 53 | }; |
| 54 | |
| 55 | sp<AMessage> mNotify; |
| 56 | sp<ALooper> mDecoderLooper; |
| 57 | |
| 58 | void requestABuffer(); |
| 59 | bool isStaleReply(const sp<AMessage> &msg); |
| 60 | |
| 61 | void onConfigure(const sp<AMessage> &format); |
| 62 | void onFlush(); |
| 63 | void onInputBufferFilled(const sp<AMessage> &msg); |
| 64 | void onBufferConsumed(); |
| 65 | void onShutdown(); |
| 66 | |
| 67 | int32_t mBufferGeneration; |
| 68 | bool mReachedEOS; |
| 69 | int32_t mPendingBuffers; |
| 70 | AString mComponentName; |
| 71 | |
| 72 | DISALLOW_EVIL_CONSTRUCTORS(DecoderPassThrough); |
| 73 | }; |
| 74 | |
| 75 | } // namespace android |
| 76 | |
| 77 | #endif // NUPLAYER_DECODER_PASS_THROUGH_H_ |