[rtmpdump] r464 - in trunk/librtmp: amf.c amf.h bytes.h hashswf.c log.c log.h rtmp.c rtmp.h rtmp_sys.h

hyc subversion at mplayerhq.hu
Sat May 1 13:00:05 CEST 2010


Author: hyc
Date: Sat May  1 13:00:04 2010
New Revision: 464

Log:
XBOX compatibility patches (Mostly same as WIN32)

Modified:
   trunk/librtmp/amf.c
   trunk/librtmp/amf.h
   trunk/librtmp/bytes.h
   trunk/librtmp/hashswf.c
   trunk/librtmp/log.c
   trunk/librtmp/log.h
   trunk/librtmp/rtmp.c
   trunk/librtmp/rtmp.h
   trunk/librtmp/rtmp_sys.h

Modified: trunk/librtmp/amf.c
==============================================================================
--- trunk/librtmp/amf.c	Fri Apr 30 06:36:29 2010	(r463)
+++ trunk/librtmp/amf.c	Sat May  1 13:00:04 2010	(r464)
@@ -26,6 +26,7 @@
 #include <assert.h>
 #include <stdlib.h>
 
+#include "rtmp_sys.h"
 #include "amf.h"
 #include "log.h"
 #include "bytes.h"

Modified: trunk/librtmp/amf.h
==============================================================================
--- trunk/librtmp/amf.h	Fri Apr 30 06:36:29 2010	(r463)
+++ trunk/librtmp/amf.h	Sat May  1 13:00:04 2010	(r464)
@@ -25,7 +25,19 @@
  */
 
 #include <stdint.h>
+
+#ifdef _XBOX
+
+#ifndef __cplusplus
+#define bool _Bool
+typedef unsigned char _Bool;
+#define false 0
+#define true  1
+#endif
+
+#else
 #include <stdbool.h>
+#endif
 
 #ifdef __cplusplus
 extern "C"

Modified: trunk/librtmp/bytes.h
==============================================================================
--- trunk/librtmp/bytes.h	Fri Apr 30 06:36:29 2010	(r463)
+++ trunk/librtmp/bytes.h	Sat May  1 13:00:04 2010	(r464)
@@ -27,7 +27,7 @@
 
 #include <stdint.h>
 
-#ifdef WIN32
+#if defined(WIN32) || defined(_XBOX)
 /* Windows is little endian only */
 #define __LITTLE_ENDIAN 1234
 #define __BIG_ENDIAN    4321

Modified: trunk/librtmp/hashswf.c
==============================================================================
--- trunk/librtmp/hashswf.c	Fri Apr 30 06:36:29 2010	(r463)
+++ trunk/librtmp/hashswf.c	Sat May  1 13:00:04 2010	(r464)
@@ -136,7 +136,7 @@ HTTP_get(struct HTTP_ctx *http, const ch
     }
   sa.sin_port = htons(port);
   sb.sb_socket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
-  if (sb.sb_socket < 0)
+  if (sb.sb_socket == -1)
     return HTTPRES_LOST_CONNECTION;
   i =
     sprintf(sb.sb_buf,
@@ -464,12 +464,19 @@ RTMP_HashSWF(const char *url, unsigned i
   AVal home, hpre;
 
   date[0] = '\0';
-#ifdef WIN32
+#if defined(WIN32) || defined(_XBOX)
+#ifdef _XBOX
+  hpre.av_val = "Q:";
+  hpre.av_len = 2;
+  home.av_val = "\\UserData\\cache";
+#else
   hpre.av_val = getenv("HOMEDRIVE");
   hpre.av_len = strlen(hpre.av_val);
   home.av_val = getenv("HOMEPATH");
+#endif
 #define DIRSEP	"\\"
-#else
+
+#else /* !WIN32 */
   hpre.av_val = "";
   hpre.av_len = 0;
   home.av_val = getenv("HOME");

Modified: trunk/librtmp/log.c
==============================================================================
--- trunk/librtmp/log.c	Fri Apr 30 06:36:29 2010	(r463)
+++ trunk/librtmp/log.c	Sat May  1 13:00:04 2010	(r464)
@@ -26,6 +26,7 @@
 #include <assert.h>
 #include <ctype.h>
 
+#include "rtmp_sys.h"
 #include "log.h"
 
 #define MAX_PRINT_LEN	2048

Modified: trunk/librtmp/log.h
==============================================================================
--- trunk/librtmp/log.h	Fri Apr 30 06:36:29 2010	(r463)
+++ trunk/librtmp/log.h	Sat May  1 13:00:04 2010	(r464)
@@ -58,4 +58,5 @@ RTMP_LogLevel RTMP_LogGetLevel(void);
 #ifdef __cplusplus
 }
 #endif
+
 #endif

Modified: trunk/librtmp/rtmp.c
==============================================================================
--- trunk/librtmp/rtmp.c	Fri Apr 30 06:36:29 2010	(r463)
+++ trunk/librtmp/rtmp.c	Sat May  1 13:00:04 2010	(r464)
@@ -807,7 +807,7 @@ RTMP_Connect0(RTMP *r, struct sockaddr *
       }
   }
 
-  setsockopt(r->m_sb.sb_socket, IPPROTO_TCP, TCP_NODELAY, &on, sizeof(on));
+  setsockopt(r->m_sb.sb_socket, IPPROTO_TCP, TCP_NODELAY, (char *) &on, sizeof(on));
 
   return true;
 }
@@ -3524,7 +3524,7 @@ HTTP_read(RTMP *r, int fill)
  * packets, 0 if ignorable error, >0 if there is a media packet
  */
 static int
-Read_1_Packet(RTMP *r, char *buf, int buflen)
+Read_1_Packet(RTMP *r, char *buf, unsigned int buflen)
 {
   uint32_t prevTagSize = 0;
   int rtnGetNextMediaPacket = 0, ret = RTMP_READ_EOF;

Modified: trunk/librtmp/rtmp.h
==============================================================================
--- trunk/librtmp/rtmp.h	Fri Apr 30 06:36:29 2010	(r463)
+++ trunk/librtmp/rtmp.h	Sat May  1 13:00:04 2010	(r464)
@@ -24,7 +24,7 @@
  *  http://www.gnu.org/copyleft/lgpl.html
  */
 
-#ifndef NO_CRYPTO
+#if !defined(NO_CRYPTO) && !defined(CRYPTO)
 #define CRYPTO
 #endif
 

Modified: trunk/librtmp/rtmp_sys.h
==============================================================================
--- trunk/librtmp/rtmp_sys.h	Fri Apr 30 06:36:29 2010	(r463)
+++ trunk/librtmp/rtmp_sys.h	Sat May  1 13:00:04 2010	(r464)
@@ -21,16 +21,28 @@
  *  http://www.gnu.org/copyleft/lgpl.html
  */
 
-#ifdef WIN32
+#if defined(WIN32) || defined(_XBOX)
+
+#ifdef _XBOX
+#include <xtl.h>
+#include <winsockx.h>
+#define snprintf _snprintf
+#define strcasecmp stricmp
+#define strncasecmp strnicmp
+#define vsnprintf _vsnprintf
+
+#else /* !_XBOX */
 #include <winsock2.h>
 #include <ws2tcpip.h>
+#endif
+
 #define GetSockError()	WSAGetLastError()
 #define setsockopt(a,b,c,d,e)	(setsockopt)(a,b,c,(const char *)d,(int)e)
 #define EWOULDBLOCK	WSAETIMEDOUT	/* we don't use nonblocking, but we do use timeouts */
 #define sleep(n)	Sleep(n*1000)
 #define msleep(n)	Sleep(n)
 #define SET_RCVTIMEO(tv,s)	int tv = s*1000
-#else
+#else /* !WIN32 && !_XBOX */
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <sys/times.h>


More information about the rtmpdump mailing list