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-18 23:48:00 +08:00
|
|
|
|
|
|
|
|
|
#ifndef ZLMEDIAKIT_AACRTPCODEC_H
|
|
|
|
|
#define ZLMEDIAKIT_AACRTPCODEC_H
|
|
|
|
|
|
2023-12-10 10:21:40 +08:00
|
|
|
|
#include "AAC.h"
|
2019-06-28 17:30:13 +08:00
|
|
|
|
#include "Rtsp/RtpCodec.h"
|
2023-12-10 10:21:40 +08:00
|
|
|
|
|
|
|
|
|
namespace mediakit {
|
2018-10-21 22:24:24 +08:00
|
|
|
|
/**
|
|
|
|
|
* aac rtp转adts类
|
2024-09-19 14:53:50 +08:00
|
|
|
|
* aac rtp to adts class
|
|
|
|
|
|
|
|
|
|
* [AUTO-TRANSLATED:8ff7580f]
|
2018-10-21 22:24:24 +08:00
|
|
|
|
*/
|
2021-02-05 11:51:16 +08:00
|
|
|
|
class AACRtpDecoder : public RtpCodec {
|
2018-10-18 23:48:00 +08:00
|
|
|
|
public:
|
2022-12-02 14:43:06 +08:00
|
|
|
|
using Ptr = std::shared_ptr<AACRtpDecoder>;
|
2018-10-23 18:39:17 +08:00
|
|
|
|
|
2023-12-09 16:23:51 +08:00
|
|
|
|
AACRtpDecoder();
|
2018-10-21 21:45:44 +08:00
|
|
|
|
|
2018-10-21 22:24:24 +08:00
|
|
|
|
/**
|
|
|
|
|
* 输入rtp并解码
|
|
|
|
|
* @param rtp rtp数据包
|
|
|
|
|
* @param key_pos 此参数内部强制转换为false,请忽略之
|
2024-09-19 14:53:50 +08:00
|
|
|
|
* input rtp and decode
|
|
|
|
|
* @param rtp rtp data packet
|
|
|
|
|
* @param key_pos this parameter is internally forced to false, please ignore it
|
|
|
|
|
|
|
|
|
|
* [AUTO-TRANSLATED:2993fcbe]
|
2018-10-21 22:24:24 +08:00
|
|
|
|
*/
|
2018-10-23 18:39:17 +08:00
|
|
|
|
bool inputRtp(const RtpPacket::Ptr &rtp, bool key_pos = false) override;
|
2018-10-23 11:09:21 +08:00
|
|
|
|
|
2018-10-18 23:48:00 +08:00
|
|
|
|
private:
|
2020-08-01 10:22:12 +08:00
|
|
|
|
void obtainFrame();
|
2020-03-11 18:52:28 +08:00
|
|
|
|
void flushData();
|
2020-06-11 19:21:46 +08:00
|
|
|
|
|
2018-10-18 23:48:00 +08:00
|
|
|
|
private:
|
2022-08-08 17:13:39 +08:00
|
|
|
|
uint64_t _last_dts = 0;
|
2021-01-17 18:31:50 +08:00
|
|
|
|
FrameImp::Ptr _frame;
|
2018-10-18 23:48:00 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2018-10-21 22:24:24 +08:00
|
|
|
|
/**
|
|
|
|
|
* aac adts转rtp类
|
2024-09-19 14:53:50 +08:00
|
|
|
|
* aac adts to rtp class
|
|
|
|
|
|
|
|
|
|
* [AUTO-TRANSLATED:1ed889e2]
|
2018-10-21 22:24:24 +08:00
|
|
|
|
*/
|
2023-12-09 16:23:51 +08:00
|
|
|
|
class AACRtpEncoder : public RtpCodec {
|
2018-10-21 21:45:44 +08:00
|
|
|
|
public:
|
2022-12-02 14:43:06 +08:00
|
|
|
|
using Ptr = std::shared_ptr<AACRtpEncoder>;
|
2018-10-23 18:39:17 +08:00
|
|
|
|
|
2018-10-21 22:24:24 +08:00
|
|
|
|
/**
|
|
|
|
|
* 输入aac 数据,必须带dats头
|
|
|
|
|
* @param frame 带dats头的aac数据
|
2024-09-19 14:53:50 +08:00
|
|
|
|
* input aac data, must have dats header
|
|
|
|
|
* @param frame aac data with dats header
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
* [AUTO-TRANSLATED:459bba30]
|
2018-10-21 22:24:24 +08:00
|
|
|
|
*/
|
2021-09-27 13:12:53 +08:00
|
|
|
|
bool inputFrame(const Frame::Ptr &frame) override;
|
2020-06-11 19:21:46 +08:00
|
|
|
|
|
2018-10-21 21:45:44 +08:00
|
|
|
|
private:
|
2023-12-09 16:23:51 +08:00
|
|
|
|
void outputRtp(const char *data, size_t len, size_t total_len, bool mark, uint64_t stamp);
|
2020-06-11 19:21:46 +08:00
|
|
|
|
|
2018-10-21 21:45:44 +08:00
|
|
|
|
};
|
|
|
|
|
|
2018-10-24 17:17:55 +08:00
|
|
|
|
}//namespace mediakit
|
2018-10-21 21:21:14 +08:00
|
|
|
|
|
2018-10-18 23:48:00 +08:00
|
|
|
|
#endif //ZLMEDIAKIT_AACRTPCODEC_H
|