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

merge from allspace srs-librtmp for win vs2010. 2.0.36

This commit is contained in:
winlin 2014-11-28 10:33:36 +08:00
parent 14fca601f9
commit 7f121efd7a
6 changed files with 68 additions and 53 deletions

View file

@ -133,47 +133,29 @@ struct Context
return 0;
}
int open(const char *pathname, int flags)
int socket_setup()
{
return open(pathname, flags, 0);
}
WORD wVersionRequested;
WSADATA wsaData;
int err;
int open(const char *pathname, int flags, mode_t mode)
{
FILE* file = NULL;
/* Use the MAKEWORD(lowbyte, highbyte) macro declared in Windef.h */
wVersionRequested = MAKEWORD(2, 2);
if ((flags & O_RDONLY) == O_RDONLY) {
file = fopen(pathname, "r");
} else {
file = fopen(pathname, "w+");
}
if (file == NULL) {
err = WSAStartup(wVersionRequested, &wsaData);
if (err != 0) {
/* Tell the user that we could not find a usable */
/* Winsock DLL. */
//printf("WSAStartup failed with error: %d\n", err);
return -1;
}
return (int)file;
return 0;
}
int close(int fd)
int socket_cleanup()
{
FILE* file = (FILE*)fd;
return fclose(file);
}
off_t lseek(int fd, off_t offset, int whence)
{
return (off_t)fseek((FILE*)fd, offset, whence);
}
ssize_t write(int fd, const void *buf, size_t count)
{
return (ssize_t)fwrite(buf, count, 1, (FILE*)fd);
}
ssize_t read(int fd, void *buf, size_t count)
{
return (ssize_t)fread(buf, count, 1, (FILE*)fd);
WSACleanup();
return 0;
}
pid_t getpid(void)