mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-22 19:00:01 +08:00
Changes to MP4Muxer for CodecJPEG
This commit is contained in:
parent
8bcc2cddc8
commit
afa6465178
@ -15,6 +15,7 @@
|
|||||||
#include "Extension/G711.h"
|
#include "Extension/G711.h"
|
||||||
#include "Extension/H264.h"
|
#include "Extension/H264.h"
|
||||||
#include "Extension/H265.h"
|
#include "Extension/H265.h"
|
||||||
|
#include "Extension/JPEG.h"
|
||||||
#include "Common/config.h"
|
#include "Common/config.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
@ -145,6 +146,7 @@ static uint8_t getObject(CodecId codecId) {
|
|||||||
case CodecAAC : return MOV_OBJECT_AAC;
|
case CodecAAC : return MOV_OBJECT_AAC;
|
||||||
case CodecH264 : return MOV_OBJECT_H264;
|
case CodecH264 : return MOV_OBJECT_H264;
|
||||||
case CodecH265 : return MOV_OBJECT_HEVC;
|
case CodecH265 : return MOV_OBJECT_HEVC;
|
||||||
|
case CodecJPEG : return MOV_OBJECT_JPEG;
|
||||||
default : return 0;
|
default : return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -302,6 +304,28 @@ bool MP4MuxerInterface::addTrack(const Track::Ptr &track) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case CodecJPEG: {
|
||||||
|
auto jpeg_track = dynamic_pointer_cast<JPEGTrack>(track);
|
||||||
|
if (!jpeg_track) {
|
||||||
|
WarnL << "不是JPEG Track";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto track_id = mp4_writer_add_video(_mov_writter.get(),
|
||||||
|
mp4_object,
|
||||||
|
jpeg_track->getVideoWidth(),
|
||||||
|
jpeg_track->getVideoHeight(),
|
||||||
|
nullptr,
|
||||||
|
0);
|
||||||
|
if (track_id < 0) {
|
||||||
|
WarnL << "添加JPEG Track失败:" << track_id;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
_codec_to_trackid[track->getCodecId()].track_id = track_id;
|
||||||
|
_have_video = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
default: WarnL << "MP4录制不支持该编码格式:" << track->getCodecName(); return false;
|
default: WarnL << "MP4录制不支持该编码格式:" << track->getCodecName(); return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user