You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

65 lines
1.5 KiB
C

12 months ago
/*
* Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
*
* This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
*
* Use of this source code is governed by MIT-like license that can be found in the
* 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.
*/
#ifndef ZLMEDIAKIT_AACRTPCODEC_H
#define ZLMEDIAKIT_AACRTPCODEC_H
#include "AAC.h"
#include "Rtsp/RtpCodec.h"
namespace mediakit {
/**
* aac rtpadts
*/
class AACRtpDecoder : public RtpCodec {
public:
using Ptr = std::shared_ptr<AACRtpDecoder>;
AACRtpDecoder();
/**
* rtp
* @param rtp rtp
* @param key_pos false,
*/
bool inputRtp(const RtpPacket::Ptr &rtp, bool key_pos = false) override;
private:
void obtainFrame();
void flushData();
private:
uint64_t _last_dts = 0;
FrameImp::Ptr _frame;
};
/**
* aac adtsrtp
*/
class AACRtpEncoder : public RtpCodec {
public:
using Ptr = std::shared_ptr<AACRtpEncoder>;
/**
* aac dats
* @param frame datsaac
*/
bool inputFrame(const Frame::Ptr &frame) override;
private:
void outputRtp(const char *data, size_t len, size_t total_len, bool mark, uint64_t stamp);
};
}//namespace mediakit
#endif //ZLMEDIAKIT_AACRTPCODEC_H