ZLMediaKit/ext-codec/AAC.h

64 lines
1.7 KiB
C++
Raw Permalink Normal View History

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音频通道
* AAC audio channel
* [AUTO-TRANSLATED:0d58b638]
2018-10-30 14:59:42 +08:00
*/
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;
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
* Construct object through AAC extra data
* [AUTO-TRANSLATED:1fa035c8]
2018-10-30 14:59:42 +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;
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;
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;
bool inputFrame_l(const Frame::Ptr &frame);
2020-05-11 22:33:10 +08:00
2018-10-30 14:59:42 +08:00
private:
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