mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-22 19:00:01 +08:00
mp4v2支持win32
This commit is contained in:
parent
1dbb08294f
commit
9c53248e39
@ -27,7 +27,7 @@ if (NOT WIN32)
|
|||||||
list(REMOVE_ITEM ToolKit_src_list ${ToolKit_Root}/win32/getopt.c)
|
list(REMOVE_ITEM ToolKit_src_list ${ToolKit_Root}/win32/getopt.c)
|
||||||
else()
|
else()
|
||||||
#防止Windows.h包含Winsock.h
|
#防止Windows.h包含Winsock.h
|
||||||
add_definitions(-DWIN32_LEAN_AND_MEAN)
|
add_definitions(-DWIN32_LEAN_AND_MEAN -DMP4V2_NO_STDINT_DEFS)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
#添加两个静态库
|
#添加两个静态库
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit 48065ffcac0fd7bfa115d62d6f1abb9decc1a3c9
|
Subproject commit 8cb7e825d9bb8b71992411632569938b897ec033
|
@ -26,13 +26,13 @@
|
|||||||
|
|
||||||
#ifdef ENABLE_MP4V2
|
#ifdef ENABLE_MP4V2
|
||||||
|
|
||||||
#include <netinet/in.h>
|
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include "Common/config.h"
|
#include "Common/config.h"
|
||||||
#include "Mp4Maker.h"
|
#include "Mp4Maker.h"
|
||||||
#include "MediaRecorder.h"
|
#include "MediaRecorder.h"
|
||||||
#include "Util/File.h"
|
#include "Util/File.h"
|
||||||
#include "Util/mini.h"
|
#include "Util/mini.h"
|
||||||
|
#include "Util/util.h"
|
||||||
#include "Util/NoticeCenter.h"
|
#include "Util/NoticeCenter.h"
|
||||||
|
|
||||||
using namespace ZL::Util;
|
using namespace ZL::Util;
|
||||||
@ -43,20 +43,17 @@ namespace MediaFile {
|
|||||||
string timeStr(const char *fmt) {
|
string timeStr(const char *fmt) {
|
||||||
std::tm tm_snapshot;
|
std::tm tm_snapshot;
|
||||||
auto time = ::time(NULL);
|
auto time = ::time(NULL);
|
||||||
#if defined(WIN32)
|
#if defined(_WIN32)
|
||||||
localtime_s(&tm_snapshot, &time); // thread-safe?
|
localtime_s(&tm_snapshot, &time); // thread-safe
|
||||||
std::ostringstream oss;
|
|
||||||
oss << std::put_time(const_cast<std::tm*>(&tm_snapshot), fmt);
|
|
||||||
return oss.str();
|
|
||||||
#else
|
#else
|
||||||
localtime_r(&time, &tm_snapshot); // POSIX
|
localtime_r(&time, &tm_snapshot); // POSIX
|
||||||
|
#endif
|
||||||
const size_t size = 1024;
|
const size_t size = 1024;
|
||||||
char buffer[size];
|
char buffer[size];
|
||||||
auto success = std::strftime(buffer, size, fmt, &tm_snapshot);
|
auto success = std::strftime(buffer, size, fmt, &tm_snapshot);
|
||||||
if (0 == success)
|
if (0 == success)
|
||||||
return string(fmt);
|
return string(fmt);
|
||||||
return buffer;
|
return buffer;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Mp4Maker::Mp4Maker(const string& strPath,
|
Mp4Maker::Mp4Maker(const string& strPath,
|
||||||
@ -171,7 +168,11 @@ void Mp4Maker::createFile() {
|
|||||||
+ strTime + ".mp4";
|
+ strTime + ".mp4";
|
||||||
//----record 业务逻辑----//
|
//----record 业务逻辑----//
|
||||||
|
|
||||||
|
#if !defined(_WIN32)
|
||||||
File::createfile_path(strFileTmp.data(), S_IRWXO | S_IRWXG | S_IRWXU);
|
File::createfile_path(strFileTmp.data(), S_IRWXO | S_IRWXG | S_IRWXU);
|
||||||
|
#else
|
||||||
|
File::createfile_path(strFileTmp.data(), 0);
|
||||||
|
#endif
|
||||||
m_hMp4 = MP4Create(strFileTmp.data());
|
m_hMp4 = MP4Create(strFileTmp.data());
|
||||||
if (m_hMp4 == MP4_INVALID_FILE_HANDLE) {
|
if (m_hMp4 == MP4_INVALID_FILE_HANDLE) {
|
||||||
WarnL << "创建MP4文件失败:" << strFileTmp;
|
WarnL << "创建MP4文件失败:" << strFileTmp;
|
||||||
|
Loading…
Reference in New Issue
Block a user