00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #include <stdlib.h>
00029
00030 #include <vlc/vlc.h>
00031 #include <vlc/input.h>
00032
00033 #include "mms.h"
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043 static int Open ( vlc_object_t * );
00044 static void Close( vlc_object_t * );
00045
00046 #define CACHING_TEXT N_("Caching value in ms")
00047 #define CACHING_LONGTEXT N_( \
00048 "Allows you to modify the default caching value for MMS streams. This " \
00049 "value should be set in millisecond units." )
00050
00051 #define ALL_TEXT N_("Force selection of all streams")
00052
00053 #define BITRATE_TEXT N_( "Maximum bitrate" )
00054 #define BITRATE_LONGTEXT N_( \
00055 "If this is set, the stream with the maximum bitrate under that limit \
00056 will be selected" )
00057
00058 vlc_module_begin();
00059 set_shortname( _("MMS") );
00060 set_description( _("Microsoft Media Server (MMS) input") );
00061 set_capability( "access2", -1 );
00062 set_category( CAT_INPUT );
00063 set_subcategory( SUBCAT_INPUT_ACCESS );
00064
00065 add_integer( "mms-caching", 19 * DEFAULT_PTS_DELAY / 1000, NULL,
00066 CACHING_TEXT, CACHING_LONGTEXT, VLC_TRUE );
00067
00068 add_bool( "mms-all", 0, NULL, ALL_TEXT, "", VLC_TRUE );
00069 add_integer( "mms-maxbitrate", 0, NULL, BITRATE_TEXT, BITRATE_LONGTEXT ,
00070 VLC_FALSE );
00071
00072 add_shortcut( "mms" );
00073 add_shortcut( "mmsu" );
00074 add_shortcut( "mmst" );
00075 add_shortcut( "mmsh" );
00076 add_shortcut( "http" );
00077 set_callbacks( Open, Close );
00078 vlc_module_end();
00079
00080
00081
00082
00083 struct access_sys_t
00084 {
00085 int i_proto;
00086 };
00087
00088
00089
00090
00091
00092 static int Open( vlc_object_t *p_this )
00093 {
00094 access_t *p_access = (access_t*)p_this;
00095
00096
00097 var_Create( p_access, "ipv4", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
00098 var_Create( p_access, "ipv6", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
00099
00100
00101 var_Create( p_access, "mms-caching", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
00102
00103
00104 if( *p_access->psz_access )
00105 {
00106 if( !strncmp( p_access->psz_access, "mmsu", 4 ) )
00107 {
00108 return E_( MMSTUOpen )( p_access );
00109 }
00110 else if( !strncmp( p_access->psz_access, "mmst", 4 ) )
00111 {
00112 return E_( MMSTUOpen )( p_access );
00113 }
00114 else if( !strncmp( p_access->psz_access, "mmsh", 4 ) ||
00115 !strncmp( p_access->psz_access, "http", 4 ) )
00116 {
00117 return E_( MMSHOpen )( p_access );
00118 }
00119 }
00120
00121 if( E_( MMSTUOpen )( p_access ) )
00122 {
00123
00124 return E_( MMSHOpen )( p_access );
00125 }
00126 return VLC_SUCCESS;
00127 }
00128
00129
00130
00131
00132 static void Close( vlc_object_t *p_this )
00133 {
00134 access_t *p_access = (access_t*)p_this;
00135 access_sys_t *p_sys = p_access->p_sys;
00136
00137 if( p_sys->i_proto == MMS_PROTO_TCP || p_sys->i_proto == MMS_PROTO_UDP )
00138 {
00139 E_( MMSTUClose )( p_access );
00140 }
00141 else if( p_sys->i_proto == MMS_PROTO_HTTP )
00142 {
00143 E_( MMSHClose )( p_access );
00144 }
00145 }