Commit 19ebb034 by 夏楚 Committed by GitHub

media-server使用原仓库并适配 (#1180)

* remote media-server

* 适配第三方库media-server使用原仓库

* ireader/media-server库使用gitee镜像

Co-authored-by: monktan <monktan@tencent.com>
parent 6d384c4a
...@@ -3,4 +3,4 @@ ...@@ -3,4 +3,4 @@
url = https://gitee.com/xia-chu/ZLToolKit url = https://gitee.com/xia-chu/ZLToolKit
[submodule "3rdpart/media-server"] [submodule "3rdpart/media-server"]
path = 3rdpart/media-server path = 3rdpart/media-server
url = https://gitee.com/xia-chu/media-server url = https://gitee.com/ireader/media-server
media-server @ 0caa03c0
Subproject commit ec171caa4b28db0f6ea47bca2c0c9530f345698a Subproject commit 0caa03c07e2ed40ec996479d594f1a75e9bd3f03
...@@ -107,13 +107,13 @@ static struct mov_buffer_t s_io = { ...@@ -107,13 +107,13 @@ static struct mov_buffer_t s_io = {
MP4FileIO *thiz = (MP4FileIO *) ctx; MP4FileIO *thiz = (MP4FileIO *) ctx;
return thiz->onWrite(data, bytes); return thiz->onWrite(data, bytes);
}, },
[](void *ctx, uint64_t offset) { [](void *ctx, int64_t offset) {
MP4FileIO *thiz = (MP4FileIO *) ctx; MP4FileIO *thiz = (MP4FileIO *) ctx;
return thiz->onSeek(offset); return thiz->onSeek(offset);
}, },
[](void *ctx) { [](void *ctx) {
MP4FileIO *thiz = (MP4FileIO *) ctx; MP4FileIO *thiz = (MP4FileIO *) ctx;
return (uint64_t)thiz->onTell(); return (int64_t)thiz->onTell();
} }
}; };
......
...@@ -172,16 +172,14 @@ struct Context{ ...@@ -172,16 +172,14 @@ struct Context{
Frame::Ptr MP4Demuxer::readFrame(bool &keyFrame, bool &eof) { Frame::Ptr MP4Demuxer::readFrame(bool &keyFrame, bool &eof) {
keyFrame = false; keyFrame = false;
eof = 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; Context *ctx = (Context *) param;
ctx->pts = pts; ctx->pts = pts;
ctx->dts = dts; ctx->dts = dts;
ctx->flags = flags; ctx->flags = flags;
ctx->track_id = track_id; 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 = ctx->thiz->_buffer_pool.obtain();
ctx->buffer->setCapacity(bytes + DATA_OFFSET + 1); ctx->buffer->setCapacity(bytes + DATA_OFFSET + 1);
ctx->buffer->setSize(bytes + DATA_OFFSET); ctx->buffer->setSize(bytes + DATA_OFFSET);
...@@ -189,7 +187,7 @@ Frame::Ptr MP4Demuxer::readFrame(bool &keyFrame, bool &eof) { ...@@ -189,7 +187,7 @@ Frame::Ptr MP4Demuxer::readFrame(bool &keyFrame, bool &eof) {
}; };
Context ctx = {this, 0}; 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) { switch (ret) {
case 0 : { case 0 : {
eof = true; eof = true;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论