ZLMediaKit/ext-codec/AACRtmp.h

92 lines
2.3 KiB
C++
Raw Normal View History

2018-10-25 10:00:17 +08:00
/*
2023-12-09 16:23:51 +08:00
* Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
2018-10-25 10:00:17 +08:00
*
2023-12-09 16:23:51 +08:00
* This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
2018-10-25 10:00:17 +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-25 10:00:17 +08:00
*/
2018-10-24 14:21:59 +08:00
#ifndef ZLMEDIAKIT_AACRTMPCODEC_H
#define ZLMEDIAKIT_AACRTMPCODEC_H
2023-12-10 10:21:40 +08:00
#include "AAC.h"
2019-06-28 17:30:13 +08:00
#include "Rtmp/RtmpCodec.h"
2018-10-30 14:59:42 +08:00
#include "Extension/Track.h"
2018-10-24 14:21:59 +08:00
2023-12-10 10:21:40 +08:00
namespace mediakit {
2018-10-24 14:21:59 +08:00
/**
* aac Rtmp转adts类
* aac Rtmp to adts class
* [AUTO-TRANSLATED:8b262ddb]
2018-10-24 14:21:59 +08:00
*/
2023-12-09 16:23:51 +08:00
class AACRtmpDecoder : public RtmpCodec {
2018-10-24 14:21:59 +08:00
public:
2022-12-02 14:43:06 +08:00
using Ptr = std::shared_ptr<AACRtmpDecoder>;
2018-10-24 14:21:59 +08:00
2023-12-09 16:23:51 +08:00
AACRtmpDecoder(const Track::Ptr &track) : RtmpCodec(track) {}
2018-10-24 14:21:59 +08:00
/**
* Rtmp并解码
* @param rtmp Rtmp数据包
* Input Rtmp and decode
* @param rtmp Rtmp data packet
* [AUTO-TRANSLATED:43b1eae8]
2018-10-24 14:21:59 +08:00
*/
void inputRtmp(const RtmpPacket::Ptr &rtmp) override;
2018-10-24 14:21:59 +08:00
};
/**
* aac adts转Rtmp类
* aac adts to Rtmp class
* [AUTO-TRANSLATED:2d9c53dd]
2018-10-24 14:21:59 +08:00
*/
2023-12-09 16:23:51 +08:00
class AACRtmpEncoder : public RtmpCodec {
2018-10-24 14:21:59 +08:00
public:
2022-12-02 14:43:06 +08:00
using Ptr = std::shared_ptr<AACRtmpEncoder>;
2018-10-24 14:21:59 +08:00
/**
* track可以为空inputFrame时输入adts头
* track不为空且包含adts头相关信息
* inputFrame时可以不输入adts头
* @param track
* Constructor, track can be empty, in which case the adts header is input when inputFrame is called
* If track is not empty and contains adts header related information,
* then the adts header can be omitted when inputFrame is called
* @param track
* [AUTO-TRANSLATED:fcf8f765]
*/
2023-12-09 16:23:51 +08:00
AACRtmpEncoder(const Track::Ptr &track) : RtmpCodec(track) {}
2018-10-24 14:21:59 +08:00
/**
* aac adts头
* @param frame aac数据
* Input aac data, can be without adts header
* @param frame aac data
* [AUTO-TRANSLATED:d9f4131a]
2018-10-24 14:21:59 +08:00
*/
bool inputFrame(const Frame::Ptr &frame) override;
2018-10-24 14:21:59 +08:00
/**
* config包
* Generate config package
* [AUTO-TRANSLATED:8f851364]
*/
void makeConfigPacket() override;
2018-10-24 14:21:59 +08:00
private:
2023-12-09 16:23:51 +08:00
uint8_t _audio_flv_flags {0};
2018-10-24 14:21:59 +08:00
};
2018-10-24 17:17:55 +08:00
}//namespace mediakit
2018-10-24 14:21:59 +08:00
#endif //ZLMEDIAKIT_AACRTMPCODEC_H