Commit eedf2620 by imp_rayjay Committed by GitHub

新增支持mjpeg负载的mp4文件点播 (#2898)

parent 67bc0273
...@@ -16,8 +16,10 @@ ...@@ -16,8 +16,10 @@
#include "Extension/AAC.h" #include "Extension/AAC.h"
#include "Extension/G711.h" #include "Extension/G711.h"
#include "Extension/Opus.h" #include "Extension/Opus.h"
using namespace toolkit; #include "Extension/JPEG.h"
using namespace std; using namespace std;
using namespace toolkit;
namespace mediakit { namespace mediakit {
...@@ -105,8 +107,9 @@ void MP4Demuxer::onVideoTrack(uint32_t track, uint8_t object, int width, int hei ...@@ -105,8 +107,9 @@ void MP4Demuxer::onVideoTrack(uint32_t track, uint8_t object, int width, int hei
video->inputFrame(std::make_shared<H264FrameNoCacheAble>((char *)config, size, 0, 0,4)); video->inputFrame(std::make_shared<H264FrameNoCacheAble>((char *)config, size, 0, 0,4));
} }
} }
}
break; break;
}
case MOV_OBJECT_HEVC: { case MOV_OBJECT_HEVC: {
auto video = std::make_shared<H265Track>(); auto video = std::make_shared<H265Track>();
_track_to_codec.emplace(track,video); _track_to_codec.emplace(track,video);
...@@ -120,12 +123,17 @@ void MP4Demuxer::onVideoTrack(uint32_t track, uint8_t object, int width, int hei ...@@ -120,12 +123,17 @@ void MP4Demuxer::onVideoTrack(uint32_t track, uint8_t object, int width, int hei
video->inputFrame(std::make_shared<H265FrameNoCacheAble>((char *) config, size, 0, 0,4)); video->inputFrame(std::make_shared<H265FrameNoCacheAble>((char *) config, size, 0, 0,4));
} }
} }
}
break; break;
default: }
WarnL << "不支持该编码类型的MP4,已忽略:" << getObjectName(object);
case MOV_OBJECT_JPEG: {
auto video = std::make_shared<JPEGTrack>();
_track_to_codec.emplace(track,video);
break; break;
} }
default: WarnL << "不支持该编码类型的MP4,已忽略:" << getObjectName(object); break;
}
} }
void MP4Demuxer::onAudioTrack(uint32_t track_id, uint8_t object, int channel_count, int bit_per_sample, int sample_rate, const void *extra, size_t bytes) { void MP4Demuxer::onAudioTrack(uint32_t track_id, uint8_t object, int channel_count, int bit_per_sample, int sample_rate, const void *extra, size_t bytes) {
...@@ -243,6 +251,11 @@ Frame::Ptr MP4Demuxer::makeFrame(uint32_t track_id, const Buffer::Ptr &buf, int6 ...@@ -243,6 +251,11 @@ Frame::Ptr MP4Demuxer::makeFrame(uint32_t track_id, const Buffer::Ptr &buf, int6
break; break;
} }
case CodecJPEG: {
ret = std::make_shared<JPEGFrame>(buf, (uint64_t)dts, 0, DATA_OFFSET);
break;
}
case CodecAAC: { case CodecAAC: {
AACTrack::Ptr track = dynamic_pointer_cast<AACTrack>(it->second); AACTrack::Ptr track = dynamic_pointer_cast<AACTrack>(it->second);
assert(track); assert(track);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论