Main Page | Modules | Class Hierarchy | Class List | Directories | File List | Class Members | File Members | Related Pages

mms.c

00001 /*****************************************************************************
00002  * mms.c: MMS over tcp, udp and http access plug-in
00003  *****************************************************************************
00004  * Copyright (C) 2002-2004 the VideoLAN team
00005  * $Id: mms.c 12821 2005-10-11 17:16:13Z zorglub $
00006  *
00007  * Authors: Laurent Aimar <[email protected]>
00008  *
00009  * This program is free software; you can redistribute it and/or modify
00010  * it under the terms of the GNU General Public License as published by
00011  * the Free Software Foundation; either version 2 of the License, or
00012  * (at your option) any later version.
00013  *
00014  * This program is distributed in the hope that it will be useful,
00015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  * GNU General Public License for more details.
00018  *
00019  * You should have received a copy of the GNU General Public License
00020  * along with this program; if not, write to the Free Software
00021  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
00022  *****************************************************************************/
00023 
00024 
00025 /*****************************************************************************
00026  * Preamble
00027  *****************************************************************************/
00028 #include <stdlib.h>
00029 
00030 #include <vlc/vlc.h>
00031 #include <vlc/input.h>
00032 
00033 #include "mms.h"
00034 
00035 /****************************************************************************
00036  * NOTES:
00037  *  MMSProtocole documentation found at http://get.to/sdp
00038  ****************************************************************************/
00039 
00040 /*****************************************************************************
00041  * Module descriptor
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  * Local prototypes
00082  *****************************************************************************/
00083 struct access_sys_t
00084 {
00085     int i_proto;
00086 };
00087 
00088 
00089 /*****************************************************************************
00090  * Open:
00091  *****************************************************************************/
00092 static int Open( vlc_object_t *p_this )
00093 {
00094     access_t *p_access = (access_t*)p_this;
00095 
00096     /* First set ipv4/ipv6 */
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     /* mms-caching */
00101     var_Create( p_access, "mms-caching", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
00102 
00103     /* use specified method */
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         /* try mmsh if mmstu failed */
00124         return E_( MMSHOpen )( p_access );
00125     }
00126     return VLC_SUCCESS;
00127 }
00128 
00129 /*****************************************************************************
00130  * Close: free unused data structures
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 }

Generated on Tue Dec 20 10:14:26 2005 for vlc-0.8.4a by  doxygen 1.4.2