Commit 881768ad authored by Laurent Aimar's avatar Laurent Aimar

* all: begin to add mms over udp support. It begin to work (at least

for me) but it still needs some work.
parent 1158db5f
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* buffer.c: MMS access plug-in * buffer.c: MMS access plug-in
***************************************************************************** *****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN * Copyright (C) 2001, 2002 VideoLAN
* $Id: buffer.c,v 1.1 2002/11/22 18:35:57 sam Exp $ * $Id: buffer.c,v 1.2 2002/11/25 00:22:04 fenrir Exp $
* *
* Authors: Laurent Aimar <fenrir@via.ecp.fr> * Authors: Laurent Aimar <fenrir@via.ecp.fr>
* *
...@@ -193,7 +193,7 @@ uint64_t var_buffer_get64( var_buffer_t *p_buf ) ...@@ -193,7 +193,7 @@ uint64_t var_buffer_get64( var_buffer_t *p_buf )
return( i_dw1 + ( i_dw2 << 32 ) ); return( i_dw1 + ( i_dw2 << 32 ) );
} }
int var_buffer_getmemory ( var_buffer_t *p_buf, void *p_mem, int i_mem ) int var_buffer_getmemory ( var_buffer_t *p_buf, void *p_mem, int64_t i_mem )
{ {
int i_copy; int i_copy;
...@@ -202,6 +202,11 @@ int var_buffer_getmemory ( var_buffer_t *p_buf, void *p_mem, int i_mem ) ...@@ -202,6 +202,11 @@ int var_buffer_getmemory ( var_buffer_t *p_buf, void *p_mem, int i_mem )
{ {
memcpy( p_mem, p_buf + p_buf->i_data, i_copy ); memcpy( p_mem, p_buf + p_buf->i_data, i_copy );
} }
if( i_copy < 0 )
{
// fprintf( stderr, "\n**************arrrrrrggggg\n" );
i_copy = 0;
}
p_buf->i_data += i_copy; p_buf->i_data += i_copy;
return( i_copy ); return( i_copy );
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* buffer.h: MMS access plug-in * buffer.h: MMS access plug-in
***************************************************************************** *****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN * Copyright (C) 2001, 2002 VideoLAN
* $Id: buffer.h,v 1.1 2002/11/22 18:35:57 sam Exp $ * $Id: buffer.h,v 1.2 2002/11/25 00:22:04 fenrir Exp $
* *
* Authors: Laurent Aimar <fenrir@via.ecp.fr> * Authors: Laurent Aimar <fenrir@via.ecp.fr>
* *
...@@ -50,7 +50,7 @@ uint8_t var_buffer_get8 ( var_buffer_t *p_buf ); ...@@ -50,7 +50,7 @@ uint8_t var_buffer_get8 ( var_buffer_t *p_buf );
uint16_t var_buffer_get16( var_buffer_t *p_buf ); uint16_t var_buffer_get16( var_buffer_t *p_buf );
uint32_t var_buffer_get32( var_buffer_t *p_buf ); uint32_t var_buffer_get32( var_buffer_t *p_buf );
uint64_t var_buffer_get64( var_buffer_t *p_buf ); uint64_t var_buffer_get64( var_buffer_t *p_buf );
int var_buffer_getmemory ( var_buffer_t *p_buf, void *p_mem, int i_mem ); int var_buffer_getmemory ( var_buffer_t *p_buf, void *p_mem, int64_t i_mem );
int var_buffer_readempty( var_buffer_t *p_buf ); int var_buffer_readempty( var_buffer_t *p_buf );
void var_buffer_getguid( var_buffer_t *p_buf, guid_t *p_guid ); void var_buffer_getguid( var_buffer_t *p_buf, guid_t *p_guid );
This diff is collapsed.
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* mms.h: MMS access plug-in * mms.h: MMS access plug-in
***************************************************************************** *****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN * Copyright (C) 2001, 2002 VideoLAN
* $Id: mms.h,v 1.3 2002/11/13 20:28:13 fenrir Exp $ * $Id: mms.h,v 1.4 2002/11/25 00:22:04 fenrir Exp $
* *
* Authors: Laurent Aimar <fenrir@via.ecp.fr> * Authors: Laurent Aimar <fenrir@via.ecp.fr>
* *
...@@ -26,9 +26,13 @@ typedef struct url_s ...@@ -26,9 +26,13 @@ typedef struct url_s
{ {
char *psz_server_addr; char *psz_server_addr;
int i_server_port; int i_server_port;
char *psz_bind_addr;
int i_bind_port;
char *psz_path; char *psz_path;
// private /* private */
char *psz_private; char *psz_private;
} url_t; } url_t;
...@@ -39,10 +43,11 @@ typedef struct url_s ...@@ -39,10 +43,11 @@ typedef struct url_s
#define MMS_PROTO_TCP 1 #define MMS_PROTO_TCP 1
#define MMS_PROTO_UDP 2 #define MMS_PROTO_UDP 2
#define MMS_PACKET_CMD 0 #define MMS_PACKET_ANY 0
#define MMS_PACKET_HEADER 1 #define MMS_PACKET_CMD 1
#define MMS_PACKET_MEDIA 2 #define MMS_PACKET_HEADER 2
#define MMS_PACKET_UDP_TIMING 3 #define MMS_PACKET_MEDIA 3
#define MMS_PACKET_UDP_TIMING 4
#define MMS_STREAM_VIDEO 0x0001 #define MMS_STREAM_VIDEO 0x0001
...@@ -54,26 +59,33 @@ typedef struct url_s ...@@ -54,26 +59,33 @@ typedef struct url_s
typedef struct mms_stream_s typedef struct mms_stream_s
{ {
int i_id; // 1 -> 127 int i_id; /* 1 -> 127 */
int i_cat; // MMS_STREAM_VIDEO, MMS_STREAM_AUDIO int i_cat; /* MMS_STREAM_VIDEO, MMS_STREAM_AUDIO */
int i_bitrate; // -1 if unknown int i_bitrate; /* -1 if unknown */
int i_selected; int i_selected;
} mms_stream_t; } mms_stream_t;
#define MMS_BUFFER_SIZE 100000
typedef struct access_s typedef struct access_s
{ {
int i_proto; // MMS_PROTO_TCP, MMS_PROTO_UDP int i_proto; /* MMS_PROTO_TCP, MMS_PROTO_UDP */
input_socket_t socket_server; // TCP socket for communication with server input_socket_t socket_tcp; /* TCP socket for communication with server */
input_socket_t socket_data; // Optional UDP socket for data(media/header packet) input_socket_t socket_udp; /* Optional UDP socket for data(media/header packet) */
// send by server /* send by server */
url_t url; /* connect to this server */
mms_stream_t stream[128]; /* in asf never more than 1->127 streams */
url_t url; // connect to this server off_t i_pos; /* position of next byte to be read */
mms_stream_t stream[128]; //in asf never more than 1->127 streams /* */
uint8_t buffer_tcp[MMS_BUFFER_SIZE];
int i_buffer_tcp;
off_t i_pos; // position of next byte to be read uint8_t buffer_udp[MMS_BUFFER_SIZE];
int i_buffer_udp;
/* data necessary to send data to server */ /* data necessary to send data to server */
guid_t guid; guid_t guid;
...@@ -84,26 +96,26 @@ typedef struct access_s ...@@ -84,26 +96,26 @@ typedef struct access_s
int i_packet_seq_num; int i_packet_seq_num;
uint8_t *p_cmd; // latest command read uint8_t *p_cmd; /* latest command read */
int i_cmd; // allocated at the begining int i_cmd; /* allocated at the begining */
uint8_t *p_header; // allocated by mms_ReadPacket uint8_t *p_header; /* allocated by mms_ReadPacket */
int i_header; int i_header;
uint8_t *p_media; // allocated by mms_ReadPacket uint8_t *p_media; /* allocated by mms_ReadPacket */
int i_media; int i_media;
int i_media_used; int i_media_used;
// extracted informations /* extracted informations */
int i_command; int i_command;
// from 0x01 answer (not yet set) /* from 0x01 answer (not yet set) */
char *psz_server_version; char *psz_server_version;
char *psz_tool_version; char *psz_tool_version;
char *psz_update_player_url; char *psz_update_player_url;
char *psz_encryption_type; char *psz_encryption_type;
// from 0x06 answer /* from 0x06 answer */
uint32_t i_flags_broadcast; uint32_t i_flags_broadcast;
uint32_t i_media_length; uint32_t i_media_length;
int i_packet_length; int i_packet_length;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment