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 A_MPEG4_AUDIO_ASSEMBLER_H_
18
19#define A_MPEG4_AUDIO_ASSEMBLER_H_
20
21#include "ARTPAssembler.h"
22
23#include <utils/List.h>
24
25#include <stdint.h>
26
27namespace android {
28
29struct AMessage;
30struct AString;
31
32struct AMPEG4AudioAssembler : public ARTPAssembler {
33    AMPEG4AudioAssembler(
34            const sp<AMessage> &notify, const AString &params);
35
36protected:
37    virtual ~AMPEG4AudioAssembler();
38
39    virtual AssemblyStatus assembleMore(const sp<ARTPSource> &source);
40    virtual void onByeReceived();
41    virtual void packetLost();
42
43private:
44    sp<AMessage> mNotifyMsg;
45
46    bool mMuxConfigPresent;
47    unsigned mNumSubFrames;
48    unsigned mFrameLengthType;
49    ssize_t mFixedFrameLength;
50    bool mOtherDataPresent;
51    unsigned mOtherDataLenBits;
52
53    uint32_t mAccessUnitRTPTime;
54    bool mNextExpectedSeqNoValid;
55    uint32_t mNextExpectedSeqNo;
56    bool mAccessUnitDamaged;
57    List<sp<ABuffer> > mPackets;
58
59    AssemblyStatus addPacket(const sp<ARTPSource> &source);
60    void submitAccessUnit();
61
62    sp<ABuffer> removeLATMFraming(const sp<ABuffer> &buffer);
63
64    DISALLOW_EVIL_CONSTRUCTORS(AMPEG4AudioAssembler);
65};
66
67}  // namespace android
68
69#endif  // A_MPEG4_AUDIO_ASSEMBLER_H_
70