]> git.sesse.net Git - vlc/blobdiff - modules/access/mms/mms.c
Trailing ;
[vlc] / modules / access / mms / mms.c
index 00585681ec555c6afabaff2c7079ad8af7ec0595..6af74bbae79502e890f4ba8334ba10584bfab169 100644 (file)
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
-
 /*****************************************************************************
  * Preamble
  *****************************************************************************/
-#include <stdlib.h>
 
-#include <vlc/vlc.h>
-#include <vlc/input.h>
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <vlc_common.h>
+#include <vlc_plugin.h>
+#include <vlc_access.h>
 
 #include "mms.h"
 
@@ -45,7 +48,7 @@ static void Close( vlc_object_t * );
 
 #define CACHING_TEXT N_("Caching value in ms")
 #define CACHING_LONGTEXT N_( \
-    "Default caching value for MMS streams. This " \
+    "Caching value for MMS streams. This " \
     "value should be set in milliseconds." )
 
 #define ALL_TEXT N_("Force selection of all streams")
@@ -57,27 +60,41 @@ static void Close( vlc_object_t * );
 #define BITRATE_LONGTEXT N_( \
     "Select the stream with the maximum bitrate under that limit."  )
 
-vlc_module_begin();
-    set_shortname( "MMS" );
-    set_description( _("Microsoft Media Server (MMS) input") );
-    set_capability( "access2", -1 );
-    set_category( CAT_INPUT );
-    set_subcategory( SUBCAT_INPUT_ACCESS );
+#define PROXY_TEXT N_("HTTP proxy")
+#define PROXY_LONGTEXT N_( \
+    "HTTP proxy to be used It must be of the form " \
+    "http://[user[:pass]@]myproxy.mydomain:myport/ ; " \
+    "if empty, the http_proxy environment variable will be tried." )
+
+#define TIMEOUT_TEXT N_("TCP/UDP timeout (ms)")
+#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.")
+
+vlc_module_begin ()
+    set_shortname( "MMS" )
+    set_description( N_("Microsoft Media Server (MMS) input") )
+    set_capability( "access", -1 )
+    set_category( CAT_INPUT )
+    set_subcategory( SUBCAT_INPUT_ACCESS )
 
     add_integer( "mms-caching", 19 * DEFAULT_PTS_DELAY / 1000, NULL,
-                 CACHING_TEXT, CACHING_LONGTEXT, VLC_TRUE );
+                 CACHING_TEXT, CACHING_LONGTEXT, true )
 
-    add_bool( "mms-all", 0, NULL, ALL_TEXT, ALL_LONGTEXT, VLC_TRUE );
-    add_integer( "mms-maxbitrate", 0, NULL, BITRATE_TEXT, BITRATE_LONGTEXT ,
-                 VLC_FALSE );
+    add_integer( "mms-timeout", 5000, NULL, TIMEOUT_TEXT, TIMEOUT_LONGTEXT,
+                 true )
 
-    add_shortcut( "mms" );
-    add_shortcut( "mmsu" );
-    add_shortcut( "mmst" );
-    add_shortcut( "mmsh" );
-    add_shortcut( "http" );
-    set_callbacks( Open, Close );
-vlc_module_end();
+    add_bool( "mms-all", 0, NULL, ALL_TEXT, ALL_LONGTEXT, true )
+    add_integer( "mms-maxbitrate", 0, NULL, BITRATE_TEXT, BITRATE_LONGTEXT ,
+                 false )
+    add_string( "mmsh-proxy", NULL, NULL, PROXY_TEXT, PROXY_LONGTEXT,
+                    false )
+
+    add_shortcut( "mms" )
+    add_shortcut( "mmsu" )
+    add_shortcut( "mmst" )
+    add_shortcut( "mmsh" )
+    add_shortcut( "http" )
+    set_callbacks( Open, Close )
+vlc_module_end ()
 
 /*****************************************************************************
  * Local prototypes
@@ -87,7 +104,6 @@ struct access_sys_t
     int i_proto;
 };
 
-
 /*****************************************************************************
  * Open:
  *****************************************************************************/
@@ -107,23 +123,26 @@ static int Open( vlc_object_t *p_this )
     {
         if( !strncmp( p_access->psz_access, "mmsu", 4 ) )
         {
-            return E_( MMSTUOpen )( p_access );
+            return  MMSTUOpen ( p_access );
         }
         else if( !strncmp( p_access->psz_access, "mmst", 4 ) )
         {
-            return E_( MMSTUOpen )( p_access );
+            return  MMSTUOpen ( p_access );
         }
         else if( !strncmp( p_access->psz_access, "mmsh", 4 ) ||
                  !strncmp( p_access->psz_access, "http", 4 ) )
         {
-            return E_( MMSHOpen )( p_access );
+            return  MMSHOpen ( p_access );
         }
     }
 
-    if( E_( MMSTUOpen )( p_access ) )
+    if( MMSTUOpen ( p_access ) )
     {
+        if( p_access->b_die )
+            return VLC_EGENERIC;
+
         /* try mmsh if mmstu failed */
-        return E_( MMSHOpen )( p_access );
+        return  MMSHOpen ( p_access );
     }
     return VLC_SUCCESS;
 }
@@ -136,12 +155,13 @@ static void Close( vlc_object_t *p_this )
     access_t     *p_access = (access_t*)p_this;
     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_access );
+         MMSTUClose ( p_access );
     }
     else if( p_sys->i_proto == MMS_PROTO_HTTP )
     {
-        E_( MMSHClose )( p_access );
+         MMSHClose ( p_access );
     }
 }