Commit e0c8d4ac authored by Laurent Aimar's avatar Laurent Aimar

* mms/* : begining of a m$-http-for-asf-streaming support.

 Proxy aren't yet supported. Use mmsh to force it, else mms will try it
at the end (after mmst and mmsu). Some http url are in fact mmsh but
not yet auto-detected.
 *Please report* not working url and any regression for mmst and mmsu.
parent 3b768aef
SOURCES_access_mms = \
modules/access/mms/mms.c \
modules/access/mms/mms.h \
modules/access/mms/mmsh.c \
modules/access/mms/mmsh.h \
modules/access/mms/mmstu.c \
modules/access/mms/mmstu.h \
modules/access/mms/buffer.c \
modules/access/mms/buffer.h \
modules/access/mms/asf.h \
modules/access/mms/asf.c \
$(NULL)
This diff is collapsed.
......@@ -2,7 +2,7 @@
* asf.h: MMS access plug-in
*****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN
* $Id: asf.h,v 1.4 2003/03/02 18:17:58 fenrir Exp $
* $Id: asf.h,v 1.5 2003/04/20 19:29:43 fenrir Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
......@@ -28,6 +28,30 @@
*
****************************************************************************/
#define ASF_STREAM_VIDEO 0x0001
#define ASF_STREAM_AUDIO 0x0002
#define ASF_STREAM_UNKNOWN 0xffff
typedef struct asf_stream_s
{
int i_id; /* 1 -> 127 */
int i_cat; /* ASF_STREAM_VIDEO, ASF_STREAM_AUDIO */
int i_bitrate; /* -1 if unknown */
int i_selected;
} asf_stream_t;
typedef struct
{
int64_t i_file_size;
int64_t i_data_packets_count;
int32_t i_min_data_packet_size;
asf_stream_t stream[128];
} asf_header_t;
typedef struct guid_s
{
uint32_t v1; /* le */
......@@ -36,36 +60,13 @@ typedef struct guid_s
uint8_t v4[8];
} guid_t;
static inline int CmpGuid( const guid_t *p_guid1, const guid_t *p_guid2 )
{
return( ( p_guid1->v1 == p_guid2->v1 &&
p_guid1->v2 == p_guid2->v2 &&
p_guid1->v3 == p_guid2->v3 &&
p_guid1->v4[0] == p_guid2->v4[0] &&
p_guid1->v4[1] == p_guid2->v4[1] &&
p_guid1->v4[2] == p_guid2->v4[2] &&
p_guid1->v4[3] == p_guid2->v4[3] &&
p_guid1->v4[4] == p_guid2->v4[4] &&
p_guid1->v4[5] == p_guid2->v4[5] &&
p_guid1->v4[6] == p_guid2->v4[6] &&
p_guid1->v4[7] == p_guid2->v4[7] ) ? 1 : 0 );
}
static void GenerateGuid( guid_t *p_guid )
{
int i;
srand( mdate() & 0xffffffff );
/* FIXME should be generated using random data */
p_guid->v1 = 0xbabac001;
p_guid->v2 = ( (uint64_t)rand() << 16 ) / RAND_MAX;
p_guid->v3 = ( (uint64_t)rand() << 16 ) / RAND_MAX;
for( i = 0; i < 8; i++ )
{
p_guid->v4[i] = ( (uint64_t)rand() * 256 ) / RAND_MAX;
}
}
void E_( GenerateGuid ) ( guid_t * );
void E_( asf_HeaderParse ) ( asf_header_t *, uint8_t *, int );
void E_( asf_StreamSelect ) ( asf_header_t *,
int i_bitrate_max, vlc_bool_t b_all, vlc_bool_t b_audio,
vlc_bool_t b_video );
#define GUID_FMT "%8.8x-%4.4x-%4.4x-%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x"
#define GUID_PRINT( guid ) \
......
This diff is collapsed.
......@@ -2,7 +2,7 @@
* mms.h: MMS access plug-in
*****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN
* $Id: mms.h,v 1.8 2003/03/03 01:38:07 fenrir Exp $
* $Id: mms.h,v 1.9 2003/04/20 19:29:43 fenrir Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
......@@ -21,112 +21,19 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
/* url: [/]host[:port][/path] */
typedef struct url_s
{
char *psz_server_addr;
int i_server_port;
char *psz_bind_addr;
int i_bind_port;
char *psz_path;
/* private */
char *psz_private;
} url_t;
#define FREE( p ) if( p ) { free( p ); (p ) = NULL; }
#define MMS_PROTO_AUTO 0
#define MMS_PROTO_TCP 1
#define MMS_PROTO_UDP 2
#define MMS_PROTO_HTTP 3
#define MMS_PACKET_ANY 0
#define MMS_PACKET_CMD 1
#define MMS_PACKET_HEADER 2
#define MMS_PACKET_MEDIA 3
#define MMS_PACKET_UDP_TIMING 4
#define MMS_STREAM_VIDEO 0x0001
#define MMS_STREAM_AUDIO 0x0002
#define MMS_STREAM_UNKNOWN 0xffff
#define MMS_CMD_HEADERSIZE 48
typedef struct mms_stream_s
{
int i_id; /* 1 -> 127 */
int i_cat; /* MMS_STREAM_VIDEO, MMS_STREAM_AUDIO */
int i_bitrate; /* -1 if unknown */
int i_selected;
} mms_stream_t;
#define MMS_BUFFER_SIZE 100000
typedef struct access_s
{
int i_proto; /* MMS_PROTO_TCP, MMS_PROTO_UDP */
input_socket_t socket_tcp; /* TCP socket for communication with server */
input_socket_t socket_udp; /* Optional UDP socket for data(media/header packet) */
/* send by server */
char *psz_bind_addr; /* used by udp */
url_t url; /* connect to this server */
mms_stream_t stream[128]; /* in asf never more than 1->127 streams */
off_t i_pos; /* position of next byte to be read */
/* */
uint8_t buffer_tcp[MMS_BUFFER_SIZE];
int i_buffer_tcp;
uint8_t buffer_udp[MMS_BUFFER_SIZE];
int i_buffer_udp;
/* data necessary to send data to server */
guid_t guid;
int i_command_level;
int i_seq_num;
uint32_t i_header_packet_id_type;
uint32_t i_media_packet_id_type;
int i_packet_seq_num;
uint8_t *p_cmd; /* latest command read */
int i_cmd; /* allocated at the begining */
uint8_t *p_header; /* allocated by mms_ReadPacket */
int i_header;
uint8_t *p_media; /* allocated by mms_ReadPacket */
size_t i_media;
size_t i_media_used;
/* extracted informations */
int i_command;
int i_eos;
/* from 0x01 answer (not yet set) */
char *psz_server_version;
char *psz_tool_version;
char *psz_update_player_url;
char *psz_encryption_type;
/* from 0x06 answer */
uint32_t i_flags_broadcast;
uint32_t i_media_length;
size_t i_packet_length;
uint32_t i_packet_count;
int i_max_bit_rate;
int i_header_size;
} access_t;
/* mmst and mmsu */
int E_( MMSTUOpen ) ( input_thread_t * );
void E_( MMSTUClose ) ( input_thread_t * );
/* mmsh */
int E_( MMSHOpen ) ( input_thread_t * );
void E_( MMSHClose ) ( input_thread_t * );
static inline uint16_t GetWLE( uint8_t *p_buff )
{
......@@ -139,3 +46,20 @@ static inline uint32_t GetDWLE( uint8_t *p_buff )
( p_buff[2] <<16 ) + ( p_buff[3] <<24 ) );
}
#define FREE( p ) if( p ) { free( p ); (p) = NULL; }
/* url: [/]host[:port][/path][@username[:password]] */
typedef struct url_s
{
char *psz_host;
int i_port;
char *psz_path;
char *psz_username;
char *psz_password;
} url_t;
url_t *E_( url_new ) ( char * );
void E_( url_free ) ( url_t * );
This diff is collapsed.
/*****************************************************************************
* mmsh.h:
*****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN
* $Id: mmsh.h,v 1.1 2003/04/20 19:29:43 fenrir Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* 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, USA.
*****************************************************************************/
#if 0
/* url: [/]host[:port][/path][@username[:password]] */
typedef struct url_s
{
char *psz_host;
int i_port;
char *psz_path;
char *psz_username;
char *psz_password;
} url_t;
static url_t *url_new ( char * );
static void url_free ( url_t * );
#endif
typedef struct
{
uint16_t i_type;
uint16_t i_size;
uint32_t i_sequence;
uint16_t i_unknown;
uint16_t i_size2;
int i_data;
uint8_t *p_data;
} chunk_t;
static int chunk_parse( chunk_t *, uint8_t *, int );
#define BUFFER_SIZE 150000
struct access_sys_t
{
int i_proto;
input_socket_t *p_socket;
url_t *p_url;
int i_request_context;
int i_buffer;
int i_buffer_pos;
uint8_t buffer[BUFFER_SIZE + 1];
vlc_bool_t b_broadcast;
uint8_t *p_header;
int i_header;
uint8_t *p_packet;
uint32_t i_packet_sequence;
unsigned int i_packet_used;
unsigned int i_packet_length;
off_t i_pos;
asf_header_t asfh;
guid_t guid;
};
static input_socket_t * NetOpenTCP ( input_thread_t *, url_t * );
static ssize_t NetRead ( input_thread_t *, input_socket_t *, byte_t *, size_t );
static ssize_t NetWrite ( input_thread_t *, input_socket_t *, byte_t *, size_t );
static void NetClose ( input_thread_t *, input_socket_t * );
static ssize_t NetFill( input_thread_t *, access_sys_t *, int );
typedef struct http_field_s
{
char *psz_name;
char *psz_value;
struct http_field_s *p_next;
} http_field_t;
typedef struct
{
int i_version;
int i_error;
char *psz_answer;
http_field_t *p_fields;
uint8_t *p_body;
int i_body;
} http_answer_t;
static http_answer_t *http_answer_parse ( uint8_t *, int );
static void http_answer_free ( http_answer_t * );
static char *http_field_get_value ( http_answer_t *, char * );
static http_field_t *http_field_find ( http_field_t *, char * );
static int mmsh_start( input_thread_t *, access_sys_t *, off_t );
static void mmsh_stop ( input_thread_t *, access_sys_t * );
This diff is collapsed.
/*****************************************************************************
* mms.h: MMS access plug-in
*****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN
* $Id: mmstu.h,v 1.1 2003/04/20 19:29:43 fenrir Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* 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, USA.
*****************************************************************************/
#if 0
/* url: [/]host[:port][/path] */
typedef struct url_s
{
char *psz_server_addr;
int i_server_port;
char *psz_bind_addr;
int i_bind_port;
char *psz_path;
/* private */
char *psz_private;
} url_t;
#endif
#define MMS_PACKET_ANY 0
#define MMS_PACKET_CMD 1
#define MMS_PACKET_HEADER 2
#define MMS_PACKET_MEDIA 3
#define MMS_PACKET_UDP_TIMING 4
#define MMS_CMD_HEADERSIZE 48
#if 0
#define MMS_STREAM_VIDEO 0x0001
#define MMS_STREAM_AUDIO 0x0002
#define MMS_STREAM_UNKNOWN 0xffff
typedef struct mms_stream_s
{
int i_id; /* 1 -> 127 */
int i_cat; /* MMS_STREAM_VIDEO, MMS_STREAM_AUDIO */
int i_bitrate; /* -1 if unknown */
int i_selected;
} mms_stream_t;
#endif
#define MMS_BUFFER_SIZE 100000
struct access_sys_t
{
int i_proto; /* MMS_PROTO_TCP, MMS_PROTO_UDP */
input_socket_t socket_tcp; /* TCP socket for communication with server */
input_socket_t socket_udp; /* Optional UDP socket for data(media/header packet) */
/* send by server */
char *psz_bind_addr; /* used by udp */
url_t *p_url; /* connect to this server */
//asf_stream_t stream[128]; /* in asf never more than 1->127 streams */
asf_header_t asfh;
off_t i_pos; /* position of next byte to be read */
/* */
uint8_t buffer_tcp[MMS_BUFFER_SIZE];
int i_buffer_tcp;
uint8_t buffer_udp[MMS_BUFFER_SIZE];
int i_buffer_udp;
/* data necessary to send data to server */
guid_t guid;
int i_command_level;
int i_seq_num;
uint32_t i_header_packet_id_type;
uint32_t i_media_packet_id_type;
int i_packet_seq_num;
uint8_t *p_cmd; /* latest command read */
int i_cmd; /* allocated at the begining */
uint8_t *p_header; /* allocated by mms_ReadPacket */
int i_header;
uint8_t *p_media; /* allocated by mms_ReadPacket */
size_t i_media;
size_t i_media_used;
/* extracted informations */
int i_command;
int i_eos;
/* from 0x01 answer (not yet set) */
char *psz_server_version;
char *psz_tool_version;
char *psz_update_player_url;
char *psz_encryption_type;
/* from 0x06 answer */
uint32_t i_flags_broadcast;
uint32_t i_media_length;
size_t i_packet_length;
uint32_t i_packet_count;
int i_max_bit_rate;
int i_header_size;
};
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