]> git.sesse.net Git - vlc/commitdiff
* modules/demux/sgimb.c
authorDerk-Jan Hartman <hartman@videolan.org>
Wed, 21 Apr 2004 01:46:41 +0000 (01:46 +0000)
committerDerk-Jan Hartman <hartman@videolan.org>
Wed, 21 Apr 2004 01:46:41 +0000 (01:46 +0000)
  - when we open a kasenna multicast udp stream, don't pass along to RTSP.
  - set the correct mtu for Kasenna streams.
* rest
  --mtu can now be set via :mtu playlist option.\

modules/access/udp.c
modules/demux/sgimb.c
modules/misc/network/ipv4.c
modules/misc/network/ipv6.c

index 6cc7da471f909a40e598823f521351dbf44e10ce..cb91b6d5bf6f7272fc36323f2060b2add3926577 100644 (file)
@@ -2,7 +2,7 @@
  * udp.c: raw UDP & RTP input module
  *****************************************************************************
  * Copyright (C) 2001-2004 VideoLAN
- * $Id: udp.c,v 1.29 2004/01/31 18:02:32 alexis Exp $
+ * $Id$
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *          Tristan Leteurtre <tooney@via.ecp.fr>
@@ -215,7 +215,9 @@ static int Open( vlc_object_t *p_this )
     free( psz_name );
 
     /* FIXME */
-    p_input->i_mtu = config_GetInt( p_this, "mtu" );
+    var_Create( p_input, "mtu", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
+    var_Get( p_input, "mtu", &val);
+    p_input->i_mtu = val.i_int;
 
     /* fill p_input fields */
     p_input->pf_read = RTPChoose;
index 2d850abc623a154410afa921e84a220977c09250..974594b3043caea5dec644e0939e26fdd2c372a4 100644 (file)
@@ -2,7 +2,7 @@
  * sgimb.c: a meta demux to parse sgimb referrer files
  *****************************************************************************
  * Copyright (C) 2004 VideoLAN
- * $Id$
+ * $Id$
  *
  * Authors: Derk-Jan Hartman <hartman at videolan dot org>
  *
@@ -86,6 +86,9 @@ struct demux_sys_t
     char        *psz_name;      /* sgiShowingName= */
     char        *psz_user;      /* sgiUserAccount= */
     char        *psz_password;  /* sgiUserPassword= */
+    char        *psz_mcast_ip;  /* sgiMulticastAddress= */
+    int         i_mcast_port;   /* sgiMulticastPort= */
+    int         i_packet_size;  /* sgiPacketSize= */
     mtime_t     i_duration;     /* sgiDuration= */
     int         i_port;         /* sgiRtspPort= */
     int         i_sid;          /* sgiSid= */
@@ -113,6 +116,9 @@ static int Activate( vlc_object_t * p_this )
     p_sys->psz_name = NULL;
     p_sys->psz_user = NULL;
     p_sys->psz_password = NULL;
+    p_sys->psz_mcast_ip = NULL;
+    p_sys->i_mcast_port = 0;
+    p_sys->i_packet_size = 0;
     p_sys->i_duration = (mtime_t)0;
     p_sys->i_port = 0;
 
@@ -154,6 +160,8 @@ static void Deactivate( vlc_object_t *p_this )
         free( p_sys->psz_user );
     if( p_sys->psz_password )
         free( p_sys->psz_password );
+    if( p_sys->psz_mcast_ip )
+        free( p_sys->psz_mcast_ip );
     free( p_demux->p_sys );
     return;
 }
@@ -218,6 +226,21 @@ static int ParseLine ( demux_t *p_demux, char *psz_line )
         psz_bol += sizeof("sgiShowingName=") - 1;
         p_sys->psz_name = strdup( psz_bol );
     }
+    else if( !strncasecmp( psz_bol, "sgiMulticastAddress=", sizeof("sgiMulticastAddress=") - 1 ) )
+    {
+        psz_bol += sizeof("sgiMulticastAddress=") - 1;
+        p_sys->psz_mcast_ip = strdup( psz_bol );
+    }
+    else if( !strncasecmp( psz_bol, "sgiMulticastPort=", sizeof("sgiMulticastPort=") - 1 ) )
+    {
+        psz_bol += sizeof("sgiMulticastPort=") - 1;
+        p_sys->i_mcast_port = (int) strtol( psz_bol, NULL, 0 );
+    }
+    else if( !strncasecmp( psz_bol, "sgiPacketSize=", sizeof("sgiPacketSize=") - 1 ) )
+    {
+        psz_bol += sizeof("sgiPacketSize=") - 1;
+        p_sys->i_packet_size = (int) strtol( psz_bol, NULL, 0 );
+    }
     else if( !strncasecmp( psz_bol, "sgiDuration=", sizeof("sgiDuration=") - 1 ) )
     {
         psz_bol += sizeof("sgiDuration=") - 1;
@@ -244,6 +267,7 @@ static int Demux ( demux_t *p_demux )
 {
     demux_sys_t     *p_sys = p_demux->p_sys;
     playlist_t      *p_playlist;
+    playlist_item_t *p_item;
     
     char            *psz_line;
     int             i_position;
@@ -264,8 +288,18 @@ static int Demux ( demux_t *p_demux )
         ParseLine( p_demux, psz_line );
         if( psz_line ) free( psz_line );
     }
-    
-    if( p_sys->psz_uri == NULL )
+
+    if( p_sys->psz_mcast_ip )
+    {
+        char *temp;
+
+        temp = (char *)malloc( sizeof("udp/ts2://@000.000.000.000:123456789" ) );
+        sprintf( temp, "udp/ts2://@" "%s:%i", p_sys->psz_mcast_ip, p_sys->i_mcast_port );
+        if( p_sys->psz_uri ) free( p_sys->psz_uri );
+        p_sys->psz_uri = strdup( temp );
+        free( temp );
+    }
+    else if( p_sys->psz_uri == NULL )
     {
         if( p_sys->psz_server && p_sys->psz_location )
         {
@@ -280,10 +314,26 @@ static int Demux ( demux_t *p_demux )
             free( temp );
         }
     }
-    
-    playlist_AddExt( p_playlist, p_sys->psz_uri,
-        p_sys->psz_name ? p_sys->psz_name : p_sys->psz_uri,
-        PLAYLIST_INSERT, i_position, p_sys->i_duration, NULL, 0 );
+
+    p_item = playlist_ItemNew( p_playlist, p_sys->psz_uri,
+                      p_sys->psz_name ? p_sys->psz_name : p_sys->psz_uri );
+
+    if( !p_item || !p_item->input.psz_uri )
+    {
+        msg_Err( p_demux, "A valid playlistitem could not be created" );
+        return VLC_EGENERIC;
+    }
+
+    if( p_sys->i_packet_size && p_sys->psz_mcast_ip )
+    {
+        char *psz_option = (char *) malloc( 20 );
+        sprintf( psz_option, "mtu=%i", p_sys->i_packet_size );
+        playlist_ItemAddOption( p_item, psz_option );
+        free( psz_option );
+    }
+
+    playlist_ItemSetDuration( p_item, p_sys->i_duration );
+    playlist_AddItem( p_playlist, p_item, PLAYLIST_INSERT, i_position );
 
     vlc_object_release( p_playlist );
     return VLC_SUCCESS;
index 323542fd217f3b537d32c78fda9b5b48284ee75a..c71615632f2b6d8b10dee7098b37ac17d166cb77 100644 (file)
@@ -2,7 +2,7 @@
  * ipv4.c: IPv4 network abstraction layer
  *****************************************************************************
  * Copyright (C) 2001, 2002 VideoLAN
- * $Id: ipv4.c,v 1.25 2004/02/22 23:09:25 titer Exp $
+ * $Id$
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *          Mathias Kretschmer <mathias@research.att.com>
@@ -153,6 +153,7 @@ static int OpenUDP( vlc_object_t * p_this, network_socket_t * p_socket )
     int i_handle, i_opt;
     socklen_t i_opt_size;
     struct sockaddr_in sock;
+    vlc_value_t val;
 
     /* If IP_ADD_SOURCE_MEMBERSHIP is not defined in the headers
        (because it's not in glibc for example), we have to define the
@@ -420,7 +421,10 @@ static int OpenUDP( vlc_object_t * p_this, network_socket_t * p_socket )
     }
 
     p_socket->i_handle = i_handle;
-    p_socket->i_mtu = config_GetInt( p_this, "mtu" );
+
+    var_Create( p_this, "mtu", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
+    var_Get( p_this, "mtu", &val );
+    p_socket->i_mtu = val.i_int;
     return( 0 );
 }
 
index da422ea30e1538cdbcee239e73e5a9fc5d8981e6..c09dd98665c4c704228e61fc9e8b57b25ec7de95 100644 (file)
@@ -2,7 +2,7 @@
  * ipv6.c: IPv6 network abstraction layer
  *****************************************************************************
  * Copyright (C) 2002 VideoLAN
- * $Id: ipv6.c,v 1.16 2004/02/15 22:20:56 gbazin Exp $
+ * $Id$
  *
  * Authors: Alexis Guillard <alexis.guillard@bt.com>
  *          Christophe Massiot <massiot@via.ecp.fr>
@@ -250,6 +250,7 @@ static int OpenUDP( vlc_object_t * p_this, network_socket_t * p_socket )
     int i_handle, i_opt;
     socklen_t i_opt_size;
     struct sockaddr_in6 sock;
+    vlc_value_t val;
 
     /* Open a SOCK_DGRAM (UDP) socket, in the AF_INET6 domain, automatic (0)
      * protocol */
@@ -428,7 +429,10 @@ static int OpenUDP( vlc_object_t * p_this, network_socket_t * p_socket )
     }
 
     p_socket->i_handle = i_handle;
-    p_socket->i_mtu = config_GetInt( p_this, "mtu" );
+
+    var_Create( p_this, "mtu", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
+    var_Get( p_this, "mtu", &val );
+    p_socket->i_mtu = val.i_int;
 
     return( 0 );
 }