Commit df3ce87c authored by Laurent Aimar's avatar Laurent Aimar

* mms/* : converted to access2. It should be reworked to use pf_block, but

that can wait ...
 * access2: little fix + added mms* shortcuts.
parent b2867914
...@@ -59,6 +59,11 @@ vlc_module_begin(); ...@@ -59,6 +59,11 @@ vlc_module_begin();
add_shortcut( "cdda" ); add_shortcut( "cdda" );
add_shortcut( "cddasimple" ); add_shortcut( "cddasimple" );
add_shortcut( "mms" );
add_shortcut( "mmsh" );
add_shortcut( "mmst" );
add_shortcut( "mmsu" );
vlc_module_end(); vlc_module_end();
/***************************************************************************** /*****************************************************************************
...@@ -191,7 +196,7 @@ static int Access2Open( vlc_object_t * p_this ) ...@@ -191,7 +196,7 @@ static int Access2Open( vlc_object_t * p_this )
access2_Control( p_access, ACCESS_CAN_CONTROL_PACE, &b_bool ); access2_Control( p_access, ACCESS_CAN_CONTROL_PACE, &b_bool );
p_input->stream.b_pace_control = b_bool; p_input->stream.b_pace_control = b_bool;
/* End of init */ /* End of init */
access2_Control( p_access, ACCESS_CAN_SEEK, &b_bool ); access2_Control( p_access, ACCESS_CAN_FASTSEEK, &b_bool );
if( b_bool ) if( b_bool )
p_input->stream.i_method = INPUT_METHOD_FILE; /* FIXME */ p_input->stream.i_method = INPUT_METHOD_FILE; /* FIXME */
else else
......
/***************************************************************************** /*****************************************************************************
* asf.c: MMS access plug-in * asf.c: MMS access plug-in
***************************************************************************** *****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN * Copyright (C) 2001-2004 VideoLAN
* $Id$ * $Id$
* *
* Authors: Laurent Aimar <fenrir@via.ecp.fr> * Authors: Laurent Aimar <fenrir@via.ecp.fr>
...@@ -59,8 +59,8 @@ void E_( GenerateGuid )( guid_t *p_guid ) ...@@ -59,8 +59,8 @@ void E_( GenerateGuid )( guid_t *p_guid )
} }
} }
void E_( asf_HeaderParse ) ( asf_header_t *hdr, void E_( asf_HeaderParse )( asf_header_t *hdr,
uint8_t *p_header, int i_header ) uint8_t *p_header, int i_header )
{ {
var_buffer_t buffer; var_buffer_t buffer;
guid_t guid; guid_t guid;
...@@ -117,7 +117,6 @@ void E_( asf_HeaderParse ) ( asf_header_t *hdr, ...@@ -117,7 +117,6 @@ void E_( asf_HeaderParse ) ( asf_header_t *hdr,
{ {
int i_stream_id; int i_stream_id;
guid_t stream_type; guid_t stream_type;
//msg_Dbg( p_input, "found stream_properties" );
var_buffer_getguid( &buffer, &stream_type ); var_buffer_getguid( &buffer, &stream_type );
var_buffer_getmemory( &buffer, NULL, 32 ); var_buffer_getmemory( &buffer, NULL, 32 );
...@@ -129,18 +128,15 @@ void E_( asf_HeaderParse ) ( asf_header_t *hdr, ...@@ -129,18 +128,15 @@ void E_( asf_HeaderParse ) ( asf_header_t *hdr,
if( CmpGuid( &stream_type, &asf_object_stream_type_video ) ) if( CmpGuid( &stream_type, &asf_object_stream_type_video ) )
{ {
//fprintf( stderr, "\nvideo stream[%d] found\n", i_stream_id ); //fprintf( stderr, "\nvideo stream[%d] found\n", i_stream_id );
//msg_Dbg( p_input, "video stream[%d] found", i_stream_id );
hdr->stream[i_stream_id].i_cat = ASF_STREAM_VIDEO; hdr->stream[i_stream_id].i_cat = ASF_STREAM_VIDEO;
} }
else if( CmpGuid( &stream_type, &asf_object_stream_type_audio ) ) else if( CmpGuid( &stream_type, &asf_object_stream_type_audio ) )
{ {
//fprintf( stderr, "\naudio stream[%d] found\n", i_stream_id ); //fprintf( stderr, "\naudio stream[%d] found\n", i_stream_id );
//msg_Dbg( p_input, "audio stream[%d] found", i_stream_id );
hdr->stream[i_stream_id].i_cat = ASF_STREAM_AUDIO; hdr->stream[i_stream_id].i_cat = ASF_STREAM_AUDIO;
} }
else else
{ {
// msg_Dbg( p_input, "unknown stream[%d] found", i_stream_id );
hdr->stream[i_stream_id].i_cat = ASF_STREAM_UNKNOWN; hdr->stream[i_stream_id].i_cat = ASF_STREAM_UNKNOWN;
} }
} }
...@@ -169,9 +165,7 @@ void E_( asf_HeaderParse ) ( asf_header_t *hdr, ...@@ -169,9 +165,7 @@ void E_( asf_HeaderParse ) ( asf_header_t *hdr,
} }
if( var_buffer_readempty( &buffer ) ) if( var_buffer_readempty( &buffer ) )
{
return; return;
}
} }
} }
...@@ -210,40 +204,6 @@ void E_( asf_StreamSelect ) ( asf_header_t *hdr, ...@@ -210,40 +204,6 @@ void E_( asf_StreamSelect ) ( asf_header_t *hdr,
} }
} }
#if 0
psz_stream = config_GetPsz( p_input, "mms-stream" );
if( psz_stream && *psz_stream )
{
char *psz_tmp = psz_stream;
while( *psz_tmp )
{
if( *psz_tmp == ',' )
{
psz_tmp++;
}
else
{
int i_stream;
i_stream = atoi( psz_tmp );
while( *psz_tmp != '\0' && *psz_tmp != ',' )
{
psz_tmp++;
}
if( i_stream > 0 && i_stream < 128 &&
stream[i_stream].i_cat != MMS_STREAM_UNKNOWN )
{
stream[i_stream].i_selected = 1;
}
}
}
FREE( psz_stream );
return;
}
FREE( psz_stream );
#endif
/* big test: /* big test:
* select a stream if * select a stream if
* - no audio nor video stream * - no audio nor video stream
...@@ -319,19 +279,5 @@ void E_( asf_StreamSelect ) ( asf_header_t *hdr, ...@@ -319,19 +279,5 @@ void E_( asf_StreamSelect ) ( asf_header_t *hdr,
} }
} }
#if 0
if( i_bitrate_max > 0 )
{
msg_Dbg( p_input,
"requested bitrate:%d real bitrate:%d",
i_bitrate_max, i_bitrate_total );
}
else
{
msg_Dbg( p_input,
"total bitrate:%d",
i_bitrate_total );
}
#endif
} }
/***************************************************************************** /*****************************************************************************
* asf.h: MMS access plug-in * asf.h: MMS access plug-in
***************************************************************************** *****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN * Copyright (C) 2001-2004 VideoLAN
* $Id$ * $Id$
* *
* Authors: Laurent Aimar <fenrir@via.ecp.fr> * Authors: Laurent Aimar <fenrir@via.ecp.fr>
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
#define ASF_STREAM_AUDIO 0x0002 #define ASF_STREAM_AUDIO 0x0002
#define ASF_STREAM_UNKNOWN 0xffff #define ASF_STREAM_UNKNOWN 0xffff
typedef struct asf_stream_s typedef struct
{ {
int i_cat; /* ASF_STREAM_VIDEO, ASF_STREAM_AUDIO */ int i_cat; /* ASF_STREAM_VIDEO, ASF_STREAM_AUDIO */
int i_bitrate; /* -1 if unknown */ int i_bitrate; /* -1 if unknown */
......
/***************************************************************************** /*****************************************************************************
* buffer.c: MMS access plug-in * buffer.c: MMS access plug-in
***************************************************************************** *****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN * Copyright (C) 2001-2004 VideoLAN
* $Id: buffer.c,v 1.3 2002/12/06 13:05:22 sam Exp $ * $Id$
* *
* Authors: Laurent Aimar <fenrir@via.ecp.fr> * Authors: Laurent Aimar <fenrir@via.ecp.fr>
* *
...@@ -34,7 +34,6 @@ ...@@ -34,7 +34,6 @@
/***************************************************************************** /*****************************************************************************
* Buffer management functions * Buffer management functions
*****************************************************************************/ *****************************************************************************/
int var_buffer_initwrite( var_buffer_t *p_buf, int i_default_size ) int var_buffer_initwrite( var_buffer_t *p_buf, int i_default_size )
{ {
p_buf->i_size = ( i_default_size > 0 ) ? i_default_size : 2048; p_buf->i_size = ( i_default_size > 0 ) ? i_default_size : 2048;
......
...@@ -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.2 2002/11/25 00:22:04 fenrir Exp $ * $Id$
* *
* Authors: Laurent Aimar <fenrir@via.ecp.fr> * Authors: Laurent Aimar <fenrir@via.ecp.fr>
* *
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/ *****************************************************************************/
typedef struct var_buffer_s typedef struct
{ {
uint8_t *p_data; // pointer on data uint8_t *p_data; // pointer on data
int i_data; // number of bytes set in p_data int i_data; // number of bytes set in p_data
......
...@@ -37,23 +37,12 @@ ...@@ -37,23 +37,12 @@
* MMSProtocole documentation found at http://get.to/sdp * MMSProtocole documentation found at http://get.to/sdp
****************************************************************************/ ****************************************************************************/
/*****************************************************************************
* Local prototypes
*****************************************************************************/
struct access_sys_t
{
int i_proto;
};
static int Open ( vlc_object_t * );
static void Close ( vlc_object_t * );
/***************************************************************************** /*****************************************************************************
* Module descriptor * Module descriptor
*****************************************************************************/ *****************************************************************************/
static int Open ( vlc_object_t * );
static void Close( vlc_object_t * );
#define CACHING_TEXT N_("Caching value in ms") #define CACHING_TEXT N_("Caching value in ms")
#define CACHING_LONGTEXT N_( \ #define CACHING_LONGTEXT N_( \
"Allows you to modify the default caching value for MMS streams. This " \ "Allows you to modify the default caching value for MMS streams. This " \
...@@ -67,7 +56,7 @@ static void Close ( vlc_object_t * ); ...@@ -67,7 +56,7 @@ static void Close ( vlc_object_t * );
vlc_module_begin(); vlc_module_begin();
set_description( _("Microsoft Media Server (MMS) input") ); set_description( _("Microsoft Media Server (MMS) input") );
set_capability( "access", 0 ); set_capability( "access2", 0 );
add_integer( "mms-caching", 4 * DEFAULT_PTS_DELAY / 1000, NULL, add_integer( "mms-caching", 4 * DEFAULT_PTS_DELAY / 1000, NULL,
CACHING_TEXT, CACHING_LONGTEXT, VLC_TRUE ); CACHING_TEXT, CACHING_LONGTEXT, VLC_TRUE );
...@@ -83,41 +72,50 @@ vlc_module_begin(); ...@@ -83,41 +72,50 @@ vlc_module_begin();
set_callbacks( Open, Close ); set_callbacks( Open, Close );
vlc_module_end(); vlc_module_end();
/*****************************************************************************
* Local prototypes
*****************************************************************************/
struct access_sys_t
{
int i_proto;
};
/***************************************************************************** /*****************************************************************************
* Open: * Open:
*****************************************************************************/ *****************************************************************************/
static int Open( vlc_object_t *p_this ) static int Open( vlc_object_t *p_this )
{ {
input_thread_t *p_input = (input_thread_t*)p_this; access_t *p_access = (access_t*)p_this;
/* First set ipv4/ipv6 */ /* First set ipv4/ipv6 */
var_Create( p_input, "ipv4", VLC_VAR_BOOL | VLC_VAR_DOINHERIT ); var_Create( p_access, "ipv4", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
var_Create( p_input, "ipv6", VLC_VAR_BOOL | VLC_VAR_DOINHERIT ); var_Create( p_access, "ipv6", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
/* mms-caching */ /* mms-caching */
var_Create( p_input, "mms-caching", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT ); var_Create( p_access, "mms-caching", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
/* use specified method */ /* use specified method */
if( *p_input->psz_access ) if( *p_access->psz_access )
{ {
if( !strncmp( p_input->psz_access, "mmsu", 4 ) ) if( !strncmp( p_access->psz_access, "mmsu", 4 ) )
{ {
return E_( MMSTUOpen )( p_input ); return E_( MMSTUOpen )( p_access );
} }
else if( !strncmp( p_input->psz_access, "mmst", 4 ) ) else if( !strncmp( p_access->psz_access, "mmst", 4 ) )
{ {
return E_( MMSTUOpen )( p_input ); return E_( MMSTUOpen )( p_access );
} }
else if( !strncmp( p_input->psz_access, "mmsh", 4 ) ) else if( !strncmp( p_access->psz_access, "mmsh", 4 ) )
{ {
return E_( MMSHOpen )( p_input ); return E_( MMSHOpen )( p_access );
} }
} }
if( E_( MMSTUOpen )( p_input ) ) if( E_( MMSTUOpen )( p_access ) )
{ {
/* try mmsh if mmstu failed */ /* try mmsh if mmstu failed */
return E_( MMSHOpen )( p_input ); return E_( MMSHOpen )( p_access );
} }
return VLC_SUCCESS; return VLC_SUCCESS;
} }
...@@ -127,131 +125,15 @@ static int Open( vlc_object_t *p_this ) ...@@ -127,131 +125,15 @@ static int Open( vlc_object_t *p_this )
*****************************************************************************/ *****************************************************************************/
static void Close( vlc_object_t *p_this ) static void Close( vlc_object_t *p_this )
{ {
input_thread_t * p_input = (input_thread_t *)p_this; access_t *p_access = (access_t*)p_this;
access_sys_t * p_sys = p_input->p_access_data; access_sys_t *p_sys = p_access->p_sys;
if( p_sys->i_proto == MMS_PROTO_TCP || p_sys->i_proto == MMS_PROTO_UDP ) if( p_sys->i_proto == MMS_PROTO_TCP || p_sys->i_proto == MMS_PROTO_UDP )
{ {
E_( MMSTUClose )( p_input ); E_( MMSTUClose )( p_access );
} }
else if( p_sys->i_proto == MMS_PROTO_HTTP ) else if( p_sys->i_proto == MMS_PROTO_HTTP )
{ {
E_( MMSHClose )( p_input ); E_( MMSHClose )( p_access );
}
}
/****************************************************************************
* parse hostname:port/path@username:password
* FIXME ipv6 ip will be baddly parsed (contain ':' )
****************************************************************************/
url_t *E_( url_new ) ( char * psz_url )
{
url_t *p_url = malloc( sizeof( url_t ) );
char *psz_dup = strdup( psz_url );
char *psz_parser = psz_dup;
char *psz_tmp;
/* 1: get hostname:port */
while( *psz_parser == '/' )
{
psz_parser++;
}
psz_tmp = psz_parser;
while( *psz_parser &&
*psz_parser != ':' && *psz_parser != '/' && *psz_parser != '@' )
{
psz_parser++;
}
p_url->psz_host = strndup( psz_tmp, psz_parser - psz_tmp );
if( *psz_parser == ':' )
{
psz_parser++;
psz_tmp = psz_parser;
while( *psz_parser && *psz_parser != '/' && *psz_parser != '@' )
{
psz_parser++;
}
p_url->i_port = atoi( psz_tmp );
}
else
{
p_url->i_port = 0;
} }
/* 2: get path */
if( *psz_parser == '/' )
{
//psz_parser++;
psz_tmp = psz_parser;
while( *psz_parser && *psz_parser != '@' )
{
psz_parser++;
}
p_url->psz_path = strndup( psz_tmp, psz_parser - psz_tmp );
}
else
{
p_url->psz_path = strdup( "" );
}
/* 3: usrname and password */
if( *psz_parser == '@' )
{
psz_parser++;
psz_tmp = psz_parser;
while( *psz_parser && *psz_parser != ':' )
{
psz_parser++;
}
p_url->psz_username = strndup( psz_tmp, psz_parser - psz_tmp );
if( *psz_parser == ':' )
{
psz_parser++;
p_url->psz_password = strdup( psz_parser );
}
else
{
p_url->psz_password = strdup( "" );
}
}
else
{
p_url->psz_username = strdup( "" );
p_url->psz_password = strdup( "" );
}
#if 0
fprintf( stderr,
"host=`%s' port=%d path=`%s' username=`%s' password=`%s'\n",
p_url->psz_host,
p_url->i_port,
p_url->psz_path,
p_url->psz_username,
p_url->psz_password );
#endif
free( psz_dup );
return p_url;
}
void E_( url_free ) ( url_t * p_url )
{
free( p_url->psz_host );
free( p_url->psz_path );
free( p_url->psz_username );
free( p_url->psz_password );
free( p_url );
} }
...@@ -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.10 2003/08/17 23:02:51 fenrir Exp $ * $Id$
* *
* Authors: Laurent Aimar <fenrir@via.ecp.fr> * Authors: Laurent Aimar <fenrir@via.ecp.fr>
* *
...@@ -28,27 +28,11 @@ ...@@ -28,27 +28,11 @@
/* mmst and mmsu */ /* mmst and mmsu */
int E_( MMSTUOpen ) ( input_thread_t * ); int E_( MMSTUOpen ) ( access_t * );
void E_( MMSTUClose ) ( input_thread_t * ); void E_( MMSTUClose ) ( access_t * );
/* mmsh */ /* mmsh */
int E_( MMSHOpen ) ( input_thread_t * ); int E_( MMSHOpen ) ( access_t * );
void E_( MMSHClose ) ( input_thread_t * ); void E_( MMSHClose ) ( access_t * );
#define FREE( p ) if( p ) { free( p ); (p) = NULL; } #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.
...@@ -58,8 +58,7 @@ struct access_sys_t ...@@ -58,8 +58,7 @@ struct access_sys_t
unsigned int i_packet_used; unsigned int i_packet_used;
unsigned int i_packet_length; unsigned int i_packet_length;
off_t i_pos; int64_t i_start;
off_t i_start;
asf_header_t asfh; asf_header_t asfh;
guid_t guid; guid_t 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: mmstu.h,v 1.1 2003/04/20 19:29:43 fenrir Exp $ * $Id$
* *
* Authors: Laurent Aimar <fenrir@via.ecp.fr> * Authors: Laurent Aimar <fenrir@via.ecp.fr>
* *
...@@ -21,23 +21,6 @@ ...@@ -21,23 +21,6 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. * 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_ANY 0
#define MMS_PACKET_CMD 1 #define MMS_PACKET_CMD 1
#define MMS_PACKET_HEADER 2 #define MMS_PACKET_HEADER 2
...@@ -47,36 +30,19 @@ typedef struct url_s ...@@ -47,36 +30,19 @@ typedef struct url_s
#define MMS_CMD_HEADERSIZE 48 #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 #define MMS_BUFFER_SIZE 100000
struct access_sys_t struct access_sys_t
{ {
int i_proto; /* MMS_PROTO_TCP, MMS_PROTO_UDP */ int i_proto; /* MMS_PROTO_TCP, MMS_PROTO_UDP */
input_socket_t socket_tcp; /* TCP socket for communication with server */ int i_handle_tcp; /* TCP socket for communication with server */
input_socket_t socket_udp; /* Optional UDP socket for data(media/header packet) */ int i_handle_udp; /* Optional UDP socket for data(media/header packet) */
/* send by server */ /* send by server */
char *psz_bind_addr; /* used by udp */ char *psz_bind_addr; /* used by udp */
url_t *p_url; /* connect to this server */ vlc_url_t url;
//asf_stream_t stream[128]; /* in asf never more than 1->127 streams */
asf_header_t asfh; asf_header_t asfh;
off_t i_pos; /* position of next byte to be read */
/* */ /* */
uint8_t buffer_tcp[MMS_BUFFER_SIZE]; uint8_t buffer_tcp[MMS_BUFFER_SIZE];
int i_buffer_tcp; int i_buffer_tcp;
...@@ -105,7 +71,6 @@ struct access_sys_t ...@@ -105,7 +71,6 @@ struct access_sys_t
/* extracted informations */ /* extracted informations */
int i_command; int i_command;
int i_eos;
/* from 0x01 answer (not yet set) */ /* from 0x01 answer (not yet set) */
char *psz_server_version; char *psz_server_version;
...@@ -121,5 +86,7 @@ struct access_sys_t ...@@ -121,5 +86,7 @@ struct access_sys_t
int i_max_bit_rate; int i_max_bit_rate;
int i_header_size; int i_header_size;
/* */
vlc_bool_t b_seekable;
}; };
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