Home | History | Annotate | Download | only in nuplayer
      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 protected:
     40     virtual ~Decoder();
     41 
     42     virtual void onMessageReceived(const sp<AMessage> &msg);
     43 
     44 private:
     45     enum {
     46         kWhatCodecNotify        = 'cdcN',
     47     };
     48 
     49     sp<AMessage> mNotify;
     50     sp<NativeWindowWrapper> mNativeWindow;
     51 
     52     sp<ACodec> mCodec;
     53     sp<ALooper> mCodecLooper;
     54 
     55     Vector<sp<ABuffer> > mCSD;
     56     size_t mCSDIndex;
     57 
     58     sp<AMessage> makeFormat(const sp<MetaData> &meta);
     59 
     60     void onFillThisBuffer(const sp<AMessage> &msg);
     61 
     62     DISALLOW_EVIL_CONSTRUCTORS(Decoder);
     63 };
     64 
     65 }  // namespace android
     66 
     67 #endif  // NUPLAYER_DECODER_H_
     68