mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2026-06-14 12:05:58 +08:00
修复一些mp4点播不支持的问题
This commit is contained in:
@@ -142,7 +142,9 @@ struct Context{
|
||||
BufferRaw::Ptr buffer;
|
||||
};
|
||||
|
||||
Frame::Ptr MP4Demuxer::readFrame(bool &keyFrame) {
|
||||
Frame::Ptr MP4Demuxer::readFrame(bool &keyFrame, bool &eof) {
|
||||
keyFrame = false;
|
||||
eof = false;
|
||||
static mov_reader_onread mov_reader_onread = [](void *param, uint32_t track_id, const void *buffer, size_t bytes, int64_t pts, int64_t dts, int flags) {
|
||||
Context *ctx = (Context *) param;
|
||||
ctx->pts = pts;
|
||||
@@ -162,17 +164,21 @@ Frame::Ptr MP4Demuxer::readFrame(bool &keyFrame) {
|
||||
Context ctx = {this, 0};
|
||||
auto ret = mov_reader_read2(_mov_reader.get(), mov_onalloc, mov_reader_onread, &ctx);
|
||||
switch (ret) {
|
||||
case 0 :
|
||||
case 0 : {
|
||||
eof = true;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
case 1 : {
|
||||
keyFrame = ctx.flags & MOV_AV_FLAG_KEYFREAME;
|
||||
return makeFrame(ctx.track_id, ctx.buffer, ctx.pts, ctx.dts);
|
||||
}
|
||||
|
||||
default:
|
||||
default : {
|
||||
eof = true;
|
||||
WarnL << "读取mp4文件数据失败:" << ret;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user