Commit 9fa2221a by xiongziliang

整理代码

parent 9bfbe02f
...@@ -90,7 +90,6 @@ void TsMuxer::inputFrame(const Frame::Ptr &frame) { ...@@ -90,7 +90,6 @@ void TsMuxer::inputFrame(const Frame::Ptr &frame) {
if(it == _codec_to_trackid.end()){ if(it == _codec_to_trackid.end()){
return; return;
} }
//mp4文件时间戳需要从0开始
auto &track_info = it->second; auto &track_info = it->second;
int64_t dts_out, pts_out; int64_t dts_out, pts_out;
_is_idr_fast_packet = !_have_video; _is_idr_fast_packet = !_have_video;
...@@ -132,7 +131,7 @@ void TsMuxer::inputFrame(const Frame::Ptr &frame) { ...@@ -132,7 +131,7 @@ void TsMuxer::inputFrame(const Frame::Ptr &frame) {
case CodecAAC: { case CodecAAC: {
if (frame->prefixSize() == 0) { if (frame->prefixSize() == 0) {
WarnL << "必须提供adts头才能mpegts打包"; WarnL << "必须提供adts头才能mpeg-ts打包";
break; break;
} }
} }
...@@ -155,18 +154,18 @@ void TsMuxer::resetTracks() { ...@@ -155,18 +154,18 @@ void TsMuxer::resetTracks() {
} }
void TsMuxer::init() { void TsMuxer::init() {
static mpeg_ts_func_t s_func= { static mpeg_ts_func_t s_func = {
[](void* param, size_t bytes){ [](void *param, size_t bytes) {
TsMuxer *muxer = (TsMuxer *)param; TsMuxer *muxer = (TsMuxer *) param;
assert(sizeof(TsMuxer::_tsbuf) >= bytes); assert(sizeof(TsMuxer::_tsbuf) >= bytes);
return (void *)muxer->_tsbuf; return (void *) muxer->_tsbuf;
}, },
[](void* param, void* packet){ [](void *param, void *packet) {
//do nothing //do nothing
}, },
[](void* param, const void* packet, size_t bytes){ [](void *param, const void *packet, size_t bytes) {
TsMuxer *muxer = (TsMuxer *)param; TsMuxer *muxer = (TsMuxer *) param;
muxer->onTs(packet, bytes,muxer->_timestamp,muxer->_is_idr_fast_packet); muxer->onTs(packet, bytes, muxer->_timestamp, muxer->_is_idr_fast_packet);
muxer->_is_idr_fast_packet = false; muxer->_is_idr_fast_packet = false;
} }
}; };
...@@ -176,7 +175,7 @@ void TsMuxer::init() { ...@@ -176,7 +175,7 @@ void TsMuxer::init() {
} }
void TsMuxer::uninit() { void TsMuxer::uninit() {
if(_context){ if (_context) {
mpeg_ts_destroy(_context); mpeg_ts_destroy(_context);
_context = nullptr; _context = nullptr;
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论