demux: mkv: handle WAVE_FORMAT_MPEG_ADTS_AAC
[vlc.git] / modules / access / mms / mms.c
blob0adeea22e003ffdf01144d58edda7df60d7b3044
1 /*****************************************************************************
2 * mms.c: MMS over tcp, udp and http access plug-in
3 *****************************************************************************
4 * Copyright (C) 2002-2004 VLC authors and VideoLAN
5 * $Id$
7 * Authors: Laurent Aimar <fenrir@via.ecp.fr>
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU Lesser General Public License as published by
11 * the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public License
20 * along with this program; if not, write to the Free Software Foundation,
21 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22 *****************************************************************************/
24 /*****************************************************************************
25 * Preamble
26 *****************************************************************************/
28 #ifdef HAVE_CONFIG_H
29 # include "config.h"
30 #endif
32 #include <vlc_common.h>
33 #include <vlc_plugin.h>
34 #include <vlc_access.h>
36 #include "mms.h"
38 /****************************************************************************
39 * NOTES:
40 * MMSProtocole documentation found at http://get.to/sdp
41 ****************************************************************************/
43 /*****************************************************************************
44 * Module descriptor
45 *****************************************************************************/
46 static int Open ( vlc_object_t * );
47 static void Close( vlc_object_t * );
49 #define ALL_TEXT N_("Force selection of all streams")
50 #define ALL_LONGTEXT N_( \
51 "MMS streams can contain several elementary streams, with different " \
52 "bitrates. You can choose to select all of them." )
54 #define BITRATE_TEXT N_( "Maximum bitrate" )
55 #define BITRATE_LONGTEXT N_( \
56 "Select the stream with the maximum bitrate under that limit." )
58 #define TIMEOUT_TEXT N_("TCP/UDP timeout (ms)")
59 #define TIMEOUT_LONGTEXT N_("Amount of time (in ms) to wait before aborting network reception of data. Note that there will be 10 retries before completely giving up.")
61 vlc_module_begin ()
62 set_shortname( "MMS" )
63 set_description( N_("Microsoft Media Server (MMS) input") )
64 set_capability( "access", -1 )
65 set_category( CAT_INPUT )
66 set_subcategory( SUBCAT_INPUT_ACCESS )
68 add_integer( "mms-timeout", 5000, TIMEOUT_TEXT, TIMEOUT_LONGTEXT,
69 true )
71 add_bool( "mms-all", false, ALL_TEXT, ALL_LONGTEXT, true )
72 add_integer( "mms-maxbitrate", 0, BITRATE_TEXT, BITRATE_LONGTEXT ,
73 false )
74 add_obsolete_string( "mmsh-proxy" ) /* since 3.0.0 */
76 add_shortcut( "mms", "mmsu", "mmst", "mmsh" )
77 set_callbacks( Open, Close )
78 vlc_module_end ()
80 /*****************************************************************************
81 * Local prototypes
82 *****************************************************************************/
83 struct access_sys_t
85 int i_proto;
88 /*****************************************************************************
89 * Open:
90 *****************************************************************************/
91 static int Open( vlc_object_t *p_this )
93 access_t *p_access = (access_t*)p_this;
95 /* use specified method */
96 if( !strncmp( p_access->psz_name, "mmsu", 4 ) )
97 return MMSTUOpen ( p_access );
98 else if( !strncmp( p_access->psz_name, "mmst", 4 ) )
99 return MMSTUOpen ( p_access );
100 else if( !strncmp( p_access->psz_name, "mmsh", 4 ) )
101 return MMSHOpen ( p_access );
103 if( MMSTUOpen ( p_access ) )
104 { /* try mmsh if mmstu failed */
105 return MMSHOpen ( p_access );
107 return VLC_SUCCESS;
110 /*****************************************************************************
111 * Close: free unused data structures
112 *****************************************************************************/
113 static void Close( vlc_object_t *p_this )
115 access_t *p_access = (access_t*)p_this;
116 access_sys_t *p_sys = p_access->p_sys;
118 if( ( p_sys->i_proto == MMS_PROTO_TCP ) ||
119 ( p_sys->i_proto == MMS_PROTO_UDP ) )
121 MMSTUClose ( p_access );
123 else if( p_sys->i_proto == MMS_PROTO_HTTP )
125 MMSHClose ( p_access );