mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
SRT: Build SRT from source by SRS. 4.0.115
This commit is contained in:
parent
262f0fc8c8
commit
90f1b482ab
115 changed files with 44513 additions and 19 deletions
105
trunk/3rdparty/srt-1-fit/srtcore/srt_compat.h
vendored
Normal file
105
trunk/3rdparty/srt-1-fit/srtcore/srt_compat.h
vendored
Normal file
|
@ -0,0 +1,105 @@
|
|||
/*
|
||||
* SRT - Secure, Reliable, Transport
|
||||
* Copyright (c) 2018 Haivision Systems Inc.
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
written by
|
||||
Haivision Systems Inc.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef HAISRT_COMPAT_H__
|
||||
#define HAISRT_COMPAT_H__
|
||||
|
||||
#include <stddef.h>
|
||||
#include <time.h>
|
||||
|
||||
#ifndef SRT_API
|
||||
#ifdef _WIN32
|
||||
#ifndef __MINGW__
|
||||
#ifdef SRT_DYNAMIC
|
||||
#ifdef SRT_EXPORTS
|
||||
#define SRT_API __declspec(dllexport)
|
||||
#else
|
||||
#define SRT_API __declspec(dllimport)
|
||||
#endif
|
||||
#else
|
||||
#define SRT_API
|
||||
#endif
|
||||
#else
|
||||
#define SRT_API
|
||||
#endif
|
||||
#else
|
||||
#define SRT_API __attribute__ ((visibility("default")))
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
// https://msdn.microsoft.com/en-us/library/tcxf1dw6.aspx
|
||||
// printf() Format for ssize_t
|
||||
#if !defined(PRIzd)
|
||||
#define PRIzd "Id"
|
||||
#endif
|
||||
// printf() Format for size_t
|
||||
#if !defined(PRIzu)
|
||||
#define PRIzu "Iu"
|
||||
#endif
|
||||
#else
|
||||
// http://www.gnu.org/software/libc/manual/html_node/Integer-Conversions.html
|
||||
// printf() Format for ssize_t
|
||||
#if !defined(PRIzd)
|
||||
#define PRIzd "zd"
|
||||
#endif
|
||||
// printf() Format for size_t
|
||||
#if !defined(PRIzu)
|
||||
#define PRIzu "zu"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Ensures that we store the error in the buffer and return the bufer. */
|
||||
SRT_API const char * SysStrError(int errnum, char * buf, size_t buflen);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern C
|
||||
|
||||
|
||||
// Extra C++ stuff. Included only in C++ mode.
|
||||
|
||||
|
||||
#include <string>
|
||||
inline std::string SysStrError(int errnum)
|
||||
{
|
||||
char buf[1024];
|
||||
return SysStrError(errnum, buf, 1024);
|
||||
}
|
||||
|
||||
inline struct tm SysLocalTime(time_t tt)
|
||||
{
|
||||
struct tm tms;
|
||||
memset(&tms, 0, sizeof tms);
|
||||
#ifdef _WIN32
|
||||
errno_t rr = localtime_s(&tms, &tt);
|
||||
if (rr == 0)
|
||||
return tms;
|
||||
#else
|
||||
tms = *localtime_r(&tt, &tms);
|
||||
#endif
|
||||
|
||||
return tms;
|
||||
}
|
||||
|
||||
|
||||
#endif // defined C++
|
||||
|
||||
#endif // HAISRT_COMPAT_H__
|
Loading…
Add table
Add a link
Reference in a new issue