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.

110 lines
2.8 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_H265RTMPCODEC_H
#define ZLMEDIAKIT_H265RTMPCODEC_H
#include "H265.h"
#include "Rtmp/RtmpCodec.h"
#include "Extension/Track.h"
namespace mediakit {
/**
* h265 Rtmp
* h265 over rtmp h265-Frame
7 months ago
* h265 Rtmp decoder class
* Demultiplex h265-Frame from h265 over rtmp
* [AUTO-TRANSLATED:2768e4bd]
12 months ago
*/
class H265RtmpDecoder : public RtmpCodec {
public:
using Ptr = std::shared_ptr<H265RtmpDecoder>;
H265RtmpDecoder(const Track::Ptr &track) : RtmpCodec(track) {}
/**
* 265 Rtmp
* @param rtmp Rtmp
7 months ago
* Input 265 Rtmp packet
* @param rtmp Rtmp packet
* [AUTO-TRANSLATED:63dbe33f]
12 months ago
*/
void inputRtmp(const RtmpPacket::Ptr &rtmp) override;
protected:
void outputFrame(const char *data, size_t size, uint32_t dts, uint32_t pts);
void splitFrame(const uint8_t *data, size_t size, uint32_t dts, uint32_t pts);
protected:
RtmpPacketInfo _info;
};
/**
* 265 Rtmp
7 months ago
* 265 Rtmp packaging class
* [AUTO-TRANSLATED:5891c800]
12 months ago
*/
class H265RtmpEncoder : public RtmpCodec {
public:
using Ptr = std::shared_ptr<H265RtmpEncoder>;
/**
* trackinputFramesps pps
* tracksps pps
* inputFramesps pps
* @param track
7 months ago
* Constructor, track can be empty, in which case sps pps is input when inputFrame
* If track is not empty and contains sps pps information,
* Then sps pps can be omitted when inputFrame
* @param track
* [AUTO-TRANSLATED:e61fdfed]
12 months ago
*/
H265RtmpEncoder(const Track::Ptr &track) : RtmpCodec(track) {}
/**
* 265sps pps
* @param frame
7 months ago
* Input 265 frame, sps pps can be omitted
* @param frame Frame data
* [AUTO-TRANSLATED:7d1be1e7]
12 months ago
*/
bool inputFrame(const Frame::Ptr &frame) override;
/**
* frame
7 months ago
* Flush all frame cache output
* [AUTO-TRANSLATED:adaea568]
12 months ago
*/
void flush() override;
/**
* config
7 months ago
* Generate config packet
* [AUTO-TRANSLATED:8f851364]
12 months ago
*/
void makeConfigPacket() override;
private:
RtmpPacket::Ptr _rtmp_packet;
FrameMerger _merger { FrameMerger::mp4_nal_size };
};
} // namespace mediakit
#endif // ZLMEDIAKIT_H265RTMPCODEC_H