1 /*****************************************************************************
2 * mms.c: MMS over tcp, udp and http access plug-in
3 *****************************************************************************
4 * Copyright (C) 2002-2004 the VideoLAN team
7 * Authors: Laurent Aimar <fenrir@via.ecp.fr>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22 *****************************************************************************/
25 /*****************************************************************************
27 *****************************************************************************/
31 #include <vlc/input.h>
35 /****************************************************************************
37 * MMSProtocole documentation found at http://get.to/sdp
38 ****************************************************************************/
40 /*****************************************************************************
42 *****************************************************************************/
43 static int Open ( vlc_object_t * );
44 static void Close( vlc_object_t * );
46 #define CACHING_TEXT N_("Caching value in ms")
47 #define CACHING_LONGTEXT N_( \
48 "Allows you to modify the default caching value for MMS streams. This " \
49 "value should be set in millisecond units." )
51 #define ALL_TEXT N_("Force selection of all streams")
53 #define BITRATE_TEXT N_( "Maximum bitrate" )
54 #define BITRATE_LONGTEXT N_( \
55 "If this is set, the stream with the maximum bitrate under that limit \
59 set_shortname( "MMS" );
60 set_description( _("Microsoft Media Server (MMS) input") );
61 set_capability( "access2", -1 );
62 set_category( CAT_INPUT );
63 set_subcategory( SUBCAT_INPUT_ACCESS );
65 add_integer( "mms-caching", 19 * DEFAULT_PTS_DELAY / 1000, NULL,
66 CACHING_TEXT, CACHING_LONGTEXT, VLC_TRUE );
68 add_bool( "mms-all", 0, NULL, ALL_TEXT, "", VLC_TRUE );
69 add_integer( "mms-maxbitrate", 0, NULL, BITRATE_TEXT, BITRATE_LONGTEXT ,
72 add_shortcut( "mms" );
73 add_shortcut( "mmsu" );
74 add_shortcut( "mmst" );
75 add_shortcut( "mmsh" );
76 add_shortcut( "http" );
77 set_callbacks( Open, Close );
80 /*****************************************************************************
82 *****************************************************************************/
89 /*****************************************************************************
91 *****************************************************************************/
92 static int Open( vlc_object_t *p_this )
94 access_t *p_access = (access_t*)p_this;
96 /* First set ipv4/ipv6 */
97 var_Create( p_access, "ipv4", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
98 var_Create( p_access, "ipv6", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
101 var_Create( p_access, "mms-caching", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
103 /* use specified method */
104 if( *p_access->psz_access )
106 if( !strncmp( p_access->psz_access, "mmsu", 4 ) )
108 return E_( MMSTUOpen )( p_access );
110 else if( !strncmp( p_access->psz_access, "mmst", 4 ) )
112 return E_( MMSTUOpen )( p_access );
114 else if( !strncmp( p_access->psz_access, "mmsh", 4 ) ||
115 !strncmp( p_access->psz_access, "http", 4 ) )
117 return E_( MMSHOpen )( p_access );
121 if( E_( MMSTUOpen )( p_access ) )
123 /* try mmsh if mmstu failed */
124 return E_( MMSHOpen )( p_access );
129 /*****************************************************************************
130 * Close: free unused data structures
131 *****************************************************************************/
132 static void Close( vlc_object_t *p_this )
134 access_t *p_access = (access_t*)p_this;
135 access_sys_t *p_sys = p_access->p_sys;
137 if( p_sys->i_proto == MMS_PROTO_TCP || p_sys->i_proto == MMS_PROTO_UDP )
139 E_( MMSTUClose )( p_access );
141 else if( p_sys->i_proto == MMS_PROTO_HTTP )
143 E_( MMSHClose )( p_access );