mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2026-06-14 03:55:58 +08:00
rtsp/rtp 新增支持mjpeg编码 (#2166)
* Trying to send mjpeg via MultiMediaSourceMuxer * Improved JPEGRtpEncoder::inputFrame code but still not working * 优化代码 * 完善jpeg相关逻辑 * Micro fix * FrameJPEG renamed to JPEGFrame according to ZLM style * Modified JPEGRtpEncoder::inputFrame and JPEGRtpEncoder::rtp_send_jpeg * getVideoHeight(), getVideoWidth() and getVideoFps() in JPEGTrack * mjpeg rtp打包避免内存拷贝/修复mjpeg rtp解包huffman_table size字段错误的bug * 支持mjpeg pix type * 优化性能 * add bom header
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
#include "AACRtmp.h"
|
||||
#include "CommonRtmp.h"
|
||||
#include "H264Rtp.h"
|
||||
#include "JPEGRtp.h"
|
||||
#include "AACRtp.h"
|
||||
#include "H265Rtp.h"
|
||||
#include "CommonRtp.h"
|
||||
@@ -22,6 +23,7 @@
|
||||
#include "Opus.h"
|
||||
#include "G711.h"
|
||||
#include "L16.h"
|
||||
#include "JPEG.h"
|
||||
#include "Util/base64.h"
|
||||
#include "Common/Parser.h"
|
||||
#include "Common/config.h"
|
||||
@@ -89,6 +91,10 @@ Track::Ptr Factory::getTrackBySdp(const SdpTrack::Ptr &track) {
|
||||
return std::make_shared<H265Track>(vps, sps, pps, 0, 0, 0);
|
||||
}
|
||||
|
||||
case CodecJPEG : {
|
||||
return std::make_shared<JPEGTrack>();
|
||||
}
|
||||
|
||||
default: {
|
||||
//其他codec不支持
|
||||
WarnL << "暂不支持该rtsp编码类型:" << track->getName();
|
||||
@@ -113,6 +119,7 @@ Track::Ptr Factory::getTrackByAbstractTrack(const Track::Ptr& track) {
|
||||
case CodecOpus: return std::make_shared<OpusTrack>();
|
||||
case CodecH265: return std::make_shared<H265Track>();
|
||||
case CodecH264: return std::make_shared<H264Track>();
|
||||
case CodecJPEG: return std::make_shared<JPEGTrack>();
|
||||
|
||||
default: {
|
||||
//其他codec不支持
|
||||
@@ -141,6 +148,7 @@ RtpCodec::Ptr Factory::getRtpEncoderByCodecId(CodecId codec_id, uint32_t sample_
|
||||
}
|
||||
return std::make_shared<CommonRtpEncoder>(codec_id, ssrc, mtu, sample_rate, pt, interleaved);
|
||||
}
|
||||
case CodecJPEG: return std::make_shared<JPEGRtpEncoder>(ssrc, mtu, sample_rate, pt, interleaved);
|
||||
default: WarnL << "暂不支持该CodecId:" << codec_id; return nullptr;
|
||||
}
|
||||
}
|
||||
@@ -172,6 +180,7 @@ RtpCodec::Ptr Factory::getRtpDecoderByTrack(const Track::Ptr &track) {
|
||||
case CodecOpus :
|
||||
case CodecG711A :
|
||||
case CodecG711U : return std::make_shared<CommonRtpDecoder>(track->getCodecId());
|
||||
case CodecJPEG: return std::make_shared<JPEGRtpDecoder>();
|
||||
default : WarnL << "暂不支持该CodecId:" << track->getCodecName(); return nullptr;
|
||||
}
|
||||
}
|
||||
@@ -210,6 +219,7 @@ Track::Ptr getTrackByCodecId(CodecId codecId, int sample_rate = 0, int channels
|
||||
case CodecOpus: return std::make_shared<OpusTrack>();
|
||||
case CodecG711A :
|
||||
case CodecG711U : return (sample_rate && channels && sample_bit) ? std::make_shared<G711Track>(codecId, sample_rate, channels, sample_bit) : nullptr;
|
||||
case CodecJPEG : return std::make_shared<JPEGTrack>();
|
||||
default : WarnL << "暂不支持该CodecId:" << codecId; return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user