1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-02-13 11:51:57 +00:00

fix #229, support vs2010 for srslibrtmp.

This commit is contained in:
winlin 2015-08-18 14:08:54 +08:00
parent 01be68fe58
commit ccc4c05da9
3 changed files with 24 additions and 2 deletions

View file

@ -26,11 +26,11 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// for srs-librtmp, @see https://github.com/simple-rtmp-server/srs/issues/213 // for srs-librtmp, @see https://github.com/simple-rtmp-server/srs/issues/213
#ifndef _WIN32 #ifndef _WIN32
#include <unistd.h> #include <unistd.h>
#include <sys/uio.h>
#endif #endif
#include <fcntl.h> #include <fcntl.h>
#include <sstream> #include <sstream>
#include <sys/uio.h>
using namespace std; using namespace std;
#include <srs_kernel_log.hpp> #include <srs_kernel_log.hpp>

View file

@ -307,8 +307,13 @@ int srs_do_create_dir_recursively(string dir)
} }
// create curren dir. // create curren dir.
// for srs-librtmp, @see https://github.com/simple-rtmp-server/srs/issues/213
#ifndef _WIN32
mode_t mode = S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IWGRP|S_IXGRP|S_IROTH|S_IXOTH; mode_t mode = S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IWGRP|S_IXGRP|S_IROTH|S_IXOTH;
if (::mkdir(dir.c_str(), mode) < 0) { if (::mkdir(dir.c_str(), mode) < 0) {
#else
if (::mkdir(dir.c_str()) < 0) {
#endif
if (errno == EEXIST) { if (errno == EEXIST) {
return ERROR_SYSTEM_DIR_EXISTS; return ERROR_SYSTEM_DIR_EXISTS;
} }

View file

@ -49,6 +49,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
typedef unsigned long long u_int64_t; typedef unsigned long long u_int64_t;
typedef long long int64_t; typedef long long int64_t;
typedef unsigned int u_int32_t; typedef unsigned int u_int32_t;
typedef u_int32_t uint32_t;
typedef int int32_t; typedef int int32_t;
typedef unsigned char u_int8_t; typedef unsigned char u_int8_t;
typedef char int8_t; typedef char int8_t;
@ -1025,20 +1026,31 @@ typedef void* srs_hijack_io_t;
*************************************************************/ *************************************************************/
// for srs-librtmp, @see https://github.com/simple-rtmp-server/srs/issues/213 // for srs-librtmp, @see https://github.com/simple-rtmp-server/srs/issues/213
#ifdef _WIN32 #ifdef _WIN32
// for time.
#define _CRT_SECURE_NO_WARNINGS #define _CRT_SECURE_NO_WARNINGS
#include <time.h> #include <time.h>
int gettimeofday(struct timeval* tv, struct timezone* tz); int gettimeofday(struct timeval* tv, struct timezone* tz);
#define PRId64 "lld" #define PRId64 "lld"
// for inet helpers.
typedef int socklen_t; typedef int socklen_t;
const char *inet_ntop(int af, const void *src, char *dst, socklen_t size); const char *inet_ntop(int af, const void *src, char *dst, socklen_t size);
// for mkdir().
#include<direct.h>
// for open().
typedef int mode_t; typedef int mode_t;
#define S_IRUSR 0 #define S_IRUSR 0
#define S_IWUSR 0 #define S_IWUSR 0
#define S_IXUSR 0
#define S_IRGRP 0 #define S_IRGRP 0
#define S_IWGRP 0 #define S_IWGRP 0
#define S_IXGRP 0
#define S_IROTH 0 #define S_IROTH 0
#define S_IXOTH 0
// for file seek.
#include <io.h> #include <io.h>
#include <fcntl.h> #include <fcntl.h>
#define open _open #define open _open
@ -1047,14 +1059,19 @@ typedef void* srs_hijack_io_t;
#define write _write #define write _write
#define read _read #define read _read
// for pid.
typedef int pid_t; typedef int pid_t;
pid_t getpid(void); pid_t getpid(void);
#define snprintf _snprintf
// for socket.
ssize_t writev(int fd, const struct iovec *iov, int iovcnt); ssize_t writev(int fd, const struct iovec *iov, int iovcnt);
typedef int64_t useconds_t; typedef int64_t useconds_t;
int usleep(useconds_t usec); int usleep(useconds_t usec);
int socket_setup(); int socket_setup();
int socket_cleanup(); int socket_cleanup();
// others.
#define snprintf _snprintf
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus