1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

For #2815: Extract macros and headers for platform.

This commit is contained in:
winlin 2021-12-26 17:50:19 +08:00
parent 716e578a19
commit 13103ec7d5
5 changed files with 56 additions and 34 deletions

2
trunk/configure vendored
View file

@ -200,7 +200,7 @@ MODULE_ID="CORE"
MODULE_DEPENDS=()
ModuleLibIncs=(${SRS_OBJS_DIR})
MODULE_FILES=("srs_core" "srs_core_version5" "srs_core_autofree" "srs_core_performance"
"srs_core_time")
"srs_core_time" "srs_core_platform")
CORE_INCS="src/core"; MODULE_DIR=${CORE_INCS} . auto/modules.sh
CORE_OBJS="${MODULE_OBJS[@]}"
#

View file

@ -32,34 +32,8 @@
#define VERSION_STABLE 4
#define VERSION_STABLE_BRANCH SRS_XSTR(VERSION_STABLE) ".0release"
// For 32bit os, 2G big file limit for unistd io,
// ie. read/write/lseek to use 64bits size for huge file.
#ifndef _FILE_OFFSET_BITS
#define _FILE_OFFSET_BITS 64
#endif
// For int64_t print using PRId64 format.
#ifndef __STDC_FORMAT_MACROS
#define __STDC_FORMAT_MACROS
#endif
// For RTC/FFMPEG build.
#if defined(SRS_RTC) && !defined(__STDC_CONSTANT_MACROS)
#define __STDC_CONSTANT_MACROS
#endif
// For srs-librtmp, @see https://github.com/ossrs/srs/issues/213
#ifndef _WIN32
#include <inttypes.h>
#endif
#include <assert.h>
#ifndef srs_assert
#define srs_assert(expression) assert(expression)
#endif
#include <stddef.h>
#include <sys/types.h>
// For platform specified headers and defines.
#include <srs_core_platform.hpp>
// The time unit for timeout, interval or duration.
#include <srs_core_time.hpp>

View file

@ -0,0 +1,8 @@
//
// Copyright (c) 2013-2021 The SRS Authors
//
// SPDX-License-Identifier: MIT
//
#include <srs_core_platform.hpp>

View file

@ -0,0 +1,45 @@
//
// Copyright (c) 2013-2021 The SRS Authors
//
// SPDX-License-Identifier: MIT
//
#ifndef SRS_CORE_PLATFORM_HPP
#define SRS_CORE_PLATFORM_HPP
// For 32bit os, 2G big file limit for unistd io,
// ie. read/write/lseek to use 64bits size for huge file.
#ifndef _FILE_OFFSET_BITS
#define _FILE_OFFSET_BITS 64
#endif
// For int64_t print using PRId64 format.
#ifndef __STDC_FORMAT_MACROS
#define __STDC_FORMAT_MACROS
#endif
// For RTC/FFMPEG build.
#if defined(SRS_RTC) && !defined(__STDC_CONSTANT_MACROS)
#define __STDC_CONSTANT_MACROS
#endif
// For srs-librtmp, @see https://github.com/ossrs/srs/issues/213
#ifndef _WIN32
#include <inttypes.h>
#endif
#include <assert.h>
#ifndef srs_assert
#define srs_assert(expression) assert(expression)
#endif
#include <stddef.h>
#include <sys/types.h>
// For CentOS 6 or C++98, @see https://github.com/ossrs/srs/issues/2815
#ifndef UINT32_MAX
#define UINT32_MAX (4294967295U)
#endif
#endif

View file

@ -19,11 +19,6 @@
#include <iomanip>
using namespace std;
// For CentOS 6 or C++98, @see https://github.com/ossrs/srs/issues/2815
#ifndef UINT32_MAX
#define UINT32_MAX (4294967295U)
#endif
#define SRS_MP4_EOF_SIZE 0
#define SRS_MP4_USE_LARGE_SIZE 1