SoftAAC2.h revision d089c2540e4f0897c166693f4f13e2023241720e
1fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera/*
2fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * Copyright (C) 2012 The Android Open Source Project
3fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera *
4fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * Licensed under the Apache License, Version 2.0 (the "License");
5fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * you may not use this file except in compliance with the License.
6fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * You may obtain a copy of the License at
7fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera *
8fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera *      http://www.apache.org/licenses/LICENSE-2.0
9fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera *
10fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * Unless required by applicable law or agreed to in writing, software
11fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * distributed under the License is distributed on an "AS IS" BASIS,
12fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * See the License for the specific language governing permissions and
14fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * limitations under the License.
15fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera */
16fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera
17fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera#ifndef SOFT_AAC_2_H_
18fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera#define SOFT_AAC_2_H_
19fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera
20fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera#include "SimpleSoftOMXComponent.h"
21fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera
22fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera#include "aacdecoder_lib.h"
23fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera
24fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbeheranamespace android {
25fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera
26fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbeherastruct SoftAAC2 : public SimpleSoftOMXComponent {
27fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera    SoftAAC2(const char *name,
28fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera            const OMX_CALLBACKTYPE *callbacks,
29fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera            OMX_PTR appData,
30fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera            OMX_COMPONENTTYPE **component);
31fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera
32fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbeheraprotected:
33fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera    virtual ~SoftAAC2();
34fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera
35fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera    virtual OMX_ERRORTYPE internalGetParameter(
36fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera            OMX_INDEXTYPE index, OMX_PTR params);
37fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera
38fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera    virtual OMX_ERRORTYPE internalSetParameter(
39fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera            OMX_INDEXTYPE index, const OMX_PTR params);
40fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera
41fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera    virtual void onQueueFilled(OMX_U32 portIndex);
42fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera    virtual void onPortFlushCompleted(OMX_U32 portIndex);
43fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera    virtual void onPortEnableCompleted(OMX_U32 portIndex, bool enabled);
44fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera    virtual void onReset();
45fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera
46fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbeheraprivate:
47fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera    enum {
48fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera        kNumInputBuffers        = 4,
49fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera        kNumOutputBuffers       = 4,
50fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera    };
51fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera
52fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera    HANDLE_AACDECODER mAACDecoder;
53fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera    CStreamInfo *mStreamInfo;
54fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera    bool mIsADTS;
55fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera    bool mDecoderHasData;
56fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera    size_t mInputBufferCount;
57fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera    bool mSignalledError;
58fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera    bool mSawInputEos;
59fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera    bool mSignalledOutputEos;
60fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera    int64_t mAnchorTimeUs;
61fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera    int64_t mNumSamplesOutput;
62fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera
63fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera    enum {
64fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera        NONE,
65fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera        AWAITING_DISABLED,
66fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera        AWAITING_ENABLED
67fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera    } mOutputPortSettingsChange;
68fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera
69fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera    void initPorts();
70fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera    status_t initDecoder();
71fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera    bool isConfigured() const;
72fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera    void maybeConfigureDownmix() const;
73fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera    void drainDecoder();
74fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera
75fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera    DISALLOW_EVIL_CONSTRUCTORS(SoftAAC2);
76fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera};
77fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera
78fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera}  // namespace android
79fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera
80fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera#endif  // SOFT_AAC_2_H_
81fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera