summaryrefslogtreecommitdiff
path: root/src/input/mms.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/input/mms.c')
-rw-r--r--src/input/mms.c56
1 files changed, 27 insertions, 29 deletions
diff --git a/src/input/mms.c b/src/input/mms.c
index 74087f7c5..ba584b4f8 100644
--- a/src/input/mms.c
+++ b/src/input/mms.c
@@ -15,9 +15,7 @@
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- *
- * $Id: mms.c,v 1.65 2007/02/20 00:34:56 dgp85 Exp $
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
*
* MMS over TCP protocol
* based on work from major mms
@@ -58,8 +56,8 @@
/*
#define LOG
*/
-#include "xine_internal.h"
-#include "xineutils.h"
+#include <xine/xine_internal.h>
+#include <xine/xineutils.h>
#include "bswap.h"
#include "http_helper.h"
@@ -208,8 +206,8 @@ static void print_command (char *data, int len) {
#ifdef LOG
int i;
- int dir = LE_32 (data + 36) >> 16;
- int comm = LE_32 (data + 36) & 0xFFFF;
+ int dir = _X_LE_32 (data + 36) >> 16;
+ int comm = _X_LE_32 (data + 36) & 0xFFFF;
printf ("----------------------------------------------\n");
if (dir == 3) {
@@ -217,18 +215,18 @@ static void print_command (char *data, int len) {
} else {
printf ("receive command 0x%02x, %d bytes\n", comm, len);
}
- printf (" start sequence %08x\n", LE_32 (data + 0));
- printf (" command id %08x\n", LE_32 (data + 4));
- printf (" length %8x \n", LE_32 (data + 8));
- printf (" protocol %08x\n", LE_32 (data + 12));
- printf (" len8 %8x \n", LE_32 (data + 16));
- printf (" sequence # %08x\n", LE_32 (data + 20));
- printf (" len8 (II) %8x \n", LE_32 (data + 32));
- printf (" dir | comm %08x\n", LE_32 (data + 36));
+ printf (" start sequence %08x\n", _X_LE_32 (data + 0));
+ printf (" command id %08x\n", _X_LE_32 (data + 4));
+ printf (" length %8x \n", _X_LE_32 (data + 8));
+ printf (" protocol %08x\n", _X_LE_32 (data + 12));
+ printf (" len8 %8x \n", _X_LE_32 (data + 16));
+ printf (" sequence # %08x\n", _X_LE_32 (data + 20));
+ printf (" len8 (II) %8x \n", _X_LE_32 (data + 32));
+ printf (" dir | comm %08x\n", _X_LE_32 (data + 36));
if (len >= 4)
- printf (" prefix1 %08x\n", LE_32 (data + 40));
+ printf (" prefix1 %08x\n", _X_LE_32 (data + 40));
if (len >= 8)
- printf (" prefix2 %08x\n", LE_32 (data + 44));
+ printf (" prefix2 %08x\n", _X_LE_32 (data + 44));
for (i = (CMD_HEADER_LEN + CMD_PREFIX_LEN); i < (CMD_HEADER_LEN + CMD_PREFIX_LEN + len); i += 1) {
unsigned char c = data[i];
@@ -355,14 +353,14 @@ static int get_packet_header (mms_t *this, mms_packet_header_t *header) {
if (len != 8)
goto error;
- if (LE_32(this->buf + 4) == 0xb00bface) {
+ if (_X_LE_32(this->buf + 4) == 0xb00bface) {
/* command packet */
header->flags = this->buf[3];
len = _x_io_tcp_read (this->stream, this->s, (char*)(this->buf + 8), 4);
if (len != 4)
goto error;
- header->packet_len = LE_32(this->buf + 8) + 4;
+ header->packet_len = _X_LE_32(this->buf + 8) + 4;
if (header->packet_len > BUF_SIZE - 12) {
header->packet_len = 0;
goto error;
@@ -370,10 +368,10 @@ static int get_packet_header (mms_t *this, mms_packet_header_t *header) {
lprintf("mms command\n");
packet_type = MMS_PACKET_COMMAND;
} else {
- header->packet_seq = LE_32(this->buf);
+ header->packet_seq = _X_LE_32(this->buf);
header->packet_id_type = this->buf[4];
header->flags = this->buf[5];
- header->packet_len = (LE_16(this->buf + 6) - 8) & 0xffff;
+ header->packet_len = (_X_LE_16(this->buf + 6) - 8) & 0xffff;
if (header->packet_id_type == ASF_HEADER_PACKET_ID_TYPE) {
lprintf("asf header\n");
packet_type = MMS_PACKET_ASF_HEADER;
@@ -407,14 +405,14 @@ static int get_packet_command (mms_t *this, uint32_t packet_len) {
print_command ((char*)this->buf, len);
/* check protocol type ("MMS ") */
- if (LE_32(this->buf + 12) != 0x20534D4D) {
+ if (_X_LE_32(this->buf + 12) != 0x20534D4D) {
lprintf("unknown protocol type: %c%c%c%c (0x%08X)\n",
this->buf[12], this->buf[13], this->buf[14], this->buf[15],
- LE_32(this->buf + 12));
+ _X_LE_32(this->buf + 12));
return 0;
}
- command = LE_32 (this->buf + 36) & 0xFFFF;
+ command = _X_LE_32 (this->buf + 36) & 0xFFFF;
lprintf("command = 0x%2x\n", command);
return command;
@@ -534,7 +532,7 @@ static int interp_asf_header (mms_t *this) {
return 1;
}
-static const char *const mmst_proto_s[] = { "mms", "mmst", NULL };
+static const char mmst_proto_s[][8] = { "mms", "mmst", "" };
static int mmst_valid_proto (char *proto) {
int i = 0;
@@ -544,7 +542,7 @@ static int mmst_valid_proto (char *proto) {
if (!proto)
return 0;
- while(mmst_proto_s[i]) {
+ while(*(mmst_proto_s[i])) {
if (!strcasecmp(proto, mmst_proto_s[i])) {
return 1;
}
@@ -603,7 +601,7 @@ static int mms_tcp_connect(mms_t *this) {
}
static void mms_gen_guid(char guid[]) {
- static char digit[16] = "0123456789ABCDEF";
+ static const char digit[16] = "0123456789ABCDEF";
int i = 0;
srand(time(NULL));
@@ -744,7 +742,7 @@ mms_t *mms_connect (xine_stream_t *stream, const char *url, int bandwidth) {
/* TODO: insert network timing request here */
/* command 0x2 */
lprintf("send command 0x02\n");
- string_utf16 (url_conv, &this->scmd_body[8], "\002\000\\\\192.168.0.129\\TCP\\1037\0000", 28);
+ string_utf16 (url_conv, &this->scmd_body[8], (ICONV_CONST char*)"\002\000\\\\192.168.0.129\\TCP\\1037\0000", 28);
memset (this->scmd_body, 0, 8);
if (!send_command (this, 2, 0, 0, 28 * 2 + 8)) {
xprintf(this->stream->xine, XINE_VERBOSITY_LOG,
@@ -937,7 +935,7 @@ static int get_media_packet (mms_t *this) {
uint32_t error_code;
/* Warning: sdp is incomplete. Do not stop if error_code==1 */
- error_code = LE_32(this->buf + CMD_HEADER_LEN);
+ error_code = _X_LE_32(this->buf + CMD_HEADER_LEN);
lprintf ("End of the current stream. Continue=%d\n", error_code);
if (error_code == 0) {