mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2026-06-16 04:55:58 +08:00
修复bug
This commit is contained in:
@@ -39,7 +39,7 @@ namespace mediakit{
|
||||
#define ftell64 ftell
|
||||
#endif
|
||||
|
||||
MP4MuxerBase::MP4MuxerBase(int flags) {
|
||||
void MP4MuxerBase::init(int flags) {
|
||||
static struct mov_buffer_t s_io = {
|
||||
[](void* ctx, void* data, uint64_t bytes) {
|
||||
MP4MuxerBase *thiz = (MP4MuxerBase *)ctx;
|
||||
@@ -67,10 +67,6 @@ MP4MuxerBase::MP4MuxerBase(int flags) {
|
||||
|
||||
///////////////////////////////////
|
||||
|
||||
MP4Muxer::MP4Muxer(int flags) : MP4MuxerBase(flags) {
|
||||
}
|
||||
|
||||
|
||||
void MP4Muxer::onTrackFrame(const Frame::Ptr &frame) {
|
||||
if(frame->configFrame()){
|
||||
//忽略配置帧
|
||||
@@ -196,15 +192,23 @@ MP4MuxerFile::MP4MuxerFile(const char *file) {
|
||||
_file.reset(fp,[file_buf](FILE *fp) {
|
||||
fclose(fp);
|
||||
});
|
||||
|
||||
init(MOV_FLAG_FASTSTART);
|
||||
}
|
||||
|
||||
MP4MuxerFile::~MP4MuxerFile() {
|
||||
_mov_writter = nullptr;
|
||||
}
|
||||
|
||||
int MP4MuxerFile::onRead(void *data, uint64_t bytes) {
|
||||
return fread(data, 1, bytes, _file.get());
|
||||
if (bytes == fread(data, 1, bytes, _file.get())){
|
||||
return 0;
|
||||
}
|
||||
return 0 != ferror(_file.get()) ? ferror(_file.get()) : -1 /*EOF*/;
|
||||
}
|
||||
|
||||
int MP4MuxerFile::onWrite(const void *data, uint64_t bytes) {
|
||||
return fwrite(data, 1, bytes, _file.get());
|
||||
return bytes == fwrite(data, 1, bytes, _file.get()) ? 0 : ferror(_file.get());
|
||||
}
|
||||
|
||||
|
||||
@@ -224,7 +228,6 @@ uint64_t MP4MuxerFile::onTell() {
|
||||
return ftell64(_file.get());
|
||||
}
|
||||
|
||||
|
||||
}//namespace mediakit
|
||||
|
||||
#endif//#ifdef ENABLE_MP4RECORD
|
||||
|
||||
Reference in New Issue
Block a user