2018-10-30 14:59:42 +08:00
|
|
|
|
/*
|
2023-12-09 16:23:51 +08:00
|
|
|
|
* Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
|
2018-10-30 14:59:42 +08:00
|
|
|
|
*
|
2023-12-09 16:23:51 +08:00
|
|
|
|
* This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
|
2018-10-30 14:59:42 +08:00
|
|
|
|
*
|
2023-12-09 16:23:51 +08:00
|
|
|
|
* Use of this source code is governed by MIT-like license that can be found in the
|
2020-04-04 20:30:09 +08:00
|
|
|
|
* LICENSE file in the root of the source tree. All contributing project authors
|
|
|
|
|
* may be found in the AUTHORS file in the root of the source tree.
|
2018-10-30 14:59:42 +08:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef ZLMEDIAKIT_AAC_H
|
|
|
|
|
#define ZLMEDIAKIT_AAC_H
|
|
|
|
|
|
2023-12-10 10:21:40 +08:00
|
|
|
|
#include "Extension/Frame.h"
|
|
|
|
|
#include "Extension/Track.h"
|
2020-05-11 23:25:12 +08:00
|
|
|
|
#define ADTS_HEADER_LEN 7
|
2018-10-30 14:59:42 +08:00
|
|
|
|
|
|
|
|
|
namespace mediakit{
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* aac音频通道
|
|
|
|
|
*/
|
2023-12-09 16:23:51 +08:00
|
|
|
|
class AACTrack : public AudioTrack {
|
2018-10-30 14:59:42 +08:00
|
|
|
|
public:
|
2021-02-05 11:51:16 +08:00
|
|
|
|
using Ptr = std::shared_ptr<AACTrack>;
|
2018-10-30 14:59:42 +08:00
|
|
|
|
|
2021-02-05 11:51:16 +08:00
|
|
|
|
AACTrack() = default;
|
2024-07-12 09:48:01 +08:00
|
|
|
|
AACTrack(int samplerate, int channel, int profile=1);
|
2018-10-30 14:59:42 +08:00
|
|
|
|
/**
|
2023-12-09 16:23:51 +08:00
|
|
|
|
* 通过aac extra data 构造对象
|
2018-10-30 14:59:42 +08:00
|
|
|
|
*/
|
2022-02-02 20:34:50 +08:00
|
|
|
|
AACTrack(const std::string &aac_cfg);
|
2018-10-30 14:59:42 +08:00
|
|
|
|
|
2023-12-09 16:23:51 +08:00
|
|
|
|
bool ready() const override;
|
2021-02-05 11:51:16 +08:00
|
|
|
|
CodecId getCodecId() const override;
|
|
|
|
|
int getAudioChannel() const override;
|
|
|
|
|
int getAudioSampleRate() const override;
|
|
|
|
|
int getAudioSampleBit() const override;
|
2021-09-27 13:12:53 +08:00
|
|
|
|
bool inputFrame(const Frame::Ptr &frame) override;
|
2023-12-09 16:23:51 +08:00
|
|
|
|
toolkit::Buffer::Ptr getExtraData() const override;
|
|
|
|
|
void setExtraData(const uint8_t *data, size_t size) override;
|
2023-11-07 23:36:41 +08:00
|
|
|
|
bool update() override;
|
2020-08-08 12:19:04 +08:00
|
|
|
|
|
|
|
|
|
private:
|
2023-12-09 16:23:51 +08:00
|
|
|
|
Sdp::Ptr getSdp(uint8_t payload_type) const override;
|
|
|
|
|
Track::Ptr clone() const override;
|
2021-09-27 13:12:53 +08:00
|
|
|
|
bool inputFrame_l(const Frame::Ptr &frame);
|
2020-05-11 22:33:10 +08:00
|
|
|
|
|
2018-10-30 14:59:42 +08:00
|
|
|
|
private:
|
2022-02-02 20:34:50 +08:00
|
|
|
|
std::string _cfg;
|
2021-02-05 11:51:16 +08:00
|
|
|
|
int _channel = 0;
|
2018-10-30 14:59:42 +08:00
|
|
|
|
int _sampleRate = 0;
|
|
|
|
|
int _sampleBit = 16;
|
2018-10-30 17:58:10 +08:00
|
|
|
|
};
|
|
|
|
|
|
2018-10-30 14:59:42 +08:00
|
|
|
|
}//namespace mediakit
|
2020-05-11 22:33:10 +08:00
|
|
|
|
#endif //ZLMEDIAKIT_AAC_H
|