From 19ebb03458c85f5138d036462b6f5799833d3bda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=8F=E6=A5=9A?= <771730766@qq.com> Date: Fri, 22 Oct 2021 14:16:39 +0800 Subject: [PATCH] =?UTF-8?q?media-server=E4=BD=BF=E7=94=A8=E5=8E=9F?= =?UTF-8?q?=E4=BB=93=E5=BA=93=E5=B9=B6=E9=80=82=E9=85=8D=20(#1180)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * remote media-server * 适配第三方库media-server使用原仓库 * ireader/media-server库使用gitee镜像 Co-authored-by: monktan --- .gitmodules | 2 +- 3rdpart/media-server | 2 +- src/Record/MP4.cpp | 4 ++-- src/Record/MP4Demuxer.cpp | 8 +++----- 4 files changed, 7 insertions(+), 9 deletions(-) diff --git a/.gitmodules b/.gitmodules index f525392b..68b49644 100644 --- a/.gitmodules +++ b/.gitmodules @@ -3,4 +3,4 @@ url = https://gitee.com/xia-chu/ZLToolKit [submodule "3rdpart/media-server"] path = 3rdpart/media-server - url = https://gitee.com/xia-chu/media-server + url = https://gitee.com/ireader/media-server diff --git a/3rdpart/media-server b/3rdpart/media-server index ec171caa..0caa03c0 160000 --- a/3rdpart/media-server +++ b/3rdpart/media-server @@ -1 +1 @@ -Subproject commit ec171caa4b28db0f6ea47bca2c0c9530f345698a +Subproject commit 0caa03c07e2ed40ec996479d594f1a75e9bd3f03 diff --git a/src/Record/MP4.cpp b/src/Record/MP4.cpp index 292bc793..b4919222 100644 --- a/src/Record/MP4.cpp +++ b/src/Record/MP4.cpp @@ -107,13 +107,13 @@ static struct mov_buffer_t s_io = { MP4FileIO *thiz = (MP4FileIO *) ctx; return thiz->onWrite(data, bytes); }, - [](void *ctx, uint64_t offset) { + [](void *ctx, int64_t offset) { MP4FileIO *thiz = (MP4FileIO *) ctx; return thiz->onSeek(offset); }, [](void *ctx) { MP4FileIO *thiz = (MP4FileIO *) ctx; - return (uint64_t)thiz->onTell(); + return (int64_t)thiz->onTell(); } }; diff --git a/src/Record/MP4Demuxer.cpp b/src/Record/MP4Demuxer.cpp index 7df9ed27..08d59f6c 100644 --- a/src/Record/MP4Demuxer.cpp +++ b/src/Record/MP4Demuxer.cpp @@ -172,16 +172,14 @@ struct Context{ 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) { + + static mov_reader_onread2 mov_onalloc = [](void *param, uint32_t track_id, size_t bytes, int64_t pts, int64_t dts, int flags) -> void * { Context *ctx = (Context *) param; ctx->pts = pts; ctx->dts = dts; ctx->flags = flags; ctx->track_id = track_id; - }; - static mov_onalloc mov_onalloc = [](void *param, int bytes) -> void * { - Context *ctx = (Context *) param; ctx->buffer = ctx->thiz->_buffer_pool.obtain(); ctx->buffer->setCapacity(bytes + DATA_OFFSET + 1); ctx->buffer->setSize(bytes + DATA_OFFSET); @@ -189,7 +187,7 @@ Frame::Ptr MP4Demuxer::readFrame(bool &keyFrame, bool &eof) { }; Context ctx = {this, 0}; - auto ret = mov_reader_read2(_mov_reader.get(), mov_onalloc, mov_reader_onread, &ctx); + auto ret = mov_reader_read2(_mov_reader.get(), mov_onalloc, &ctx); switch (ret) { case 0 : { eof = true;