# include "config.h"
#endif
-#include <vlc/vlc.h>
+#include <vlc_common.h>
#include <vlc_demux.h>
#include "playlist.h"
if( !strncasecmp( psz_bol, "rtsp://", sizeof("rtsp://") - 1 ) )
{
/* We found the link, it was inside a sgiQTFileBegin */
+ free( p_sys->psz_uri );
p_sys->psz_uri = strdup( psz_bol );
}
else if( !strncasecmp( psz_bol, "Stream=\"", sizeof("Stream=\"") - 1 ) )
psz_bol += sizeof("Stream=\"") - 1;
if ( !psz_bol )
return 0;
- strrchr( psz_bol, '"' )[0] = '\0';
+ char* psz_tmp = strrchr( psz_bol, '"' );
+ if( !psz_tmp )
+ return 0;
+ psz_tmp[0] = '\0';
/* We cheat around xdma. for some reason xdma links work different then rtsp */
if( !strncasecmp( psz_bol, "xdma://", sizeof("xdma://") - 1 ) )
{
psz_bol[2] = 's';
psz_bol[3] = 'p';
}
+ free( p_sys->psz_uri );
p_sys->psz_uri = strdup( psz_bol );
}
else if( !strncasecmp( psz_bol, "sgiNameServerHost=", sizeof("sgiNameServerHost=") - 1 ) )
{
psz_bol += sizeof("sgiNameServerHost=") - 1;
+ free( p_sys->psz_server );
p_sys->psz_server = strdup( psz_bol );
}
else if( !strncasecmp( psz_bol, "sgiMovieName=", sizeof("sgiMovieName=") - 1 ) )
{
psz_bol += sizeof("sgiMovieName=") - 1;
+ free( p_sys->psz_location );
p_sys->psz_location = strdup( psz_bol );
}
else if( !strncasecmp( psz_bol, "sgiUserAccount=", sizeof("sgiUserAccount=") - 1 ) )
{
psz_bol += sizeof("sgiUserAccount=") - 1;
+ free( p_sys->psz_user );
p_sys->psz_user = strdup( psz_bol );
}
else if( !strncasecmp( psz_bol, "sgiUserPassword=", sizeof("sgiUserPassword=") - 1 ) )
{
psz_bol += sizeof("sgiUserPassword=") - 1;
+ free( p_sys->psz_password );
p_sys->psz_password = strdup( psz_bol );
}
else if( !strncasecmp( psz_bol, "sgiShowingName=", sizeof("sgiShowingName=") - 1 ) )
{
psz_bol += sizeof("sgiShowingName=") - 1;
+ free( p_sys->psz_name );
p_sys->psz_name = strdup( psz_bol );
}
else if( !strncasecmp( psz_bol, "sgiFormatName=", sizeof("sgiFormatName=") - 1 ) )
else if( !strncasecmp( psz_bol, "sgiMulticastAddress=", sizeof("sgiMulticastAddress=") - 1 ) )
{
psz_bol += sizeof("sgiMulticastAddress=") - 1;
+ free( p_sys->psz_mcast_ip );
p_sys->psz_mcast_ip = strdup( psz_bol );
}
else if( !strncasecmp( psz_bol, "sgiMulticastPort=", sizeof("sgiMulticastPort=") - 1 ) )
input_item_t *p_child = NULL;
char *psz_line;
- INIT_PLAYLIST_STUFF;
+ input_item_t *p_current_input = GetCurrentItem(p_demux);
while( ( psz_line = stream_ReadLine( p_demux->s ) ) )
{
{
/* Definetly schedules multicast session */
/* We don't care if it's live or not */
- char *temp;
-
- asprintf( &temp, "udp://@" "%s:%i", p_sys->psz_mcast_ip, p_sys->i_mcast_port );
free( p_sys->psz_uri );
- p_sys->psz_uri = strdup( temp );
- free( temp );
+ if( asprintf( &p_sys->psz_uri, "udp://@" "%s:%i", p_sys->psz_mcast_ip, p_sys->i_mcast_port ) == -1 )
+ {
+ p_sys->psz_uri = NULL;
+ return -1;
+ }
}
if( p_sys->psz_uri == NULL )
{
if( p_sys->psz_server && p_sys->psz_location )
{
- char *temp;
-
- asprintf( &temp, "rtsp://" "%s:%i%s",
- p_sys->psz_server, p_sys->i_port > 0 ? p_sys->i_port : 554, p_sys->psz_location );
-
- p_sys->psz_uri = strdup( temp );
- free( temp );
+ if( asprintf( &p_sys->psz_uri, "rtsp://" "%s:%i%s",
+ p_sys->psz_server, p_sys->i_port > 0 ? p_sys->i_port : 554, p_sys->psz_location ) == -1 )
+ {
+ p_sys->psz_uri = NULL;
+ return -1;
+ }
}
}
{
/* It's definetly a simulcasted scheduled stream */
/* We don't care if it's live or not */
- char *temp;
-
if( p_sys->psz_uri == NULL )
{
msg_Err( p_demux, "no URI was found" );
return -1;
}
- asprintf( &temp, "%s%%3FMeDiAbAsEshowingId=%d%%26MeDiAbAsEconcert%%3FMeDiAbAsE",
- p_sys->psz_uri, p_sys->i_sid );
-
free( p_sys->psz_uri );
- p_sys->psz_uri = strdup( temp );
- free( temp );
+ if( asprintf( &p_sys->psz_uri, "%s%%3FMeDiAbAsEshowingId=%d%%26MeDiAbAsEconcert%%3FMeDiAbAsE",
+ p_sys->psz_uri, p_sys->i_sid ) == -1 )
+ {
+ p_sys->psz_uri = NULL;
+ return -1;
+ }
}
- p_child = input_ItemNewWithType( (vlc_object_t *)p_playlist, p_sys->psz_uri,
+ p_child = input_item_NewWithType( VLC_OBJECT(p_demux), p_sys->psz_uri,
p_sys->psz_name ? p_sys->psz_name : p_sys->psz_uri,
- 0, NULL, p_sys->i_duration, ITEM_TYPE_NET );
+ 0, NULL, 0, p_sys->i_duration, ITEM_TYPE_NET );
if( !p_child )
{
return -1;
}
- input_ItemCopyOptions( p_current_input, p_child );
+ input_item_CopyOptions( p_current_input, p_child );
if( p_sys->i_packet_size && p_sys->psz_mcast_ip )
{
char *psz_option;
p_sys->i_packet_size += 1000;
- asprintf( &psz_option, "mtu=%i", p_sys->i_packet_size );
- input_ItemAddOption( p_child, psz_option );
- free( psz_option );
+ if( asprintf( &psz_option, "mtu=%i", p_sys->i_packet_size ) != -1 )
+ {
+ input_item_AddOption( p_child, psz_option, VLC_INPUT_OPTION_TRUSTED );
+ free( psz_option );
+ }
}
if( !p_sys->psz_mcast_ip )
- {
- char *psz_option;
- asprintf( &psz_option, "rtsp-caching=5000" );
- input_ItemAddOption( p_child, psz_option );
- free( psz_option );
- }
+ input_item_AddOption( p_child, "rtsp-caching=5000", VLC_INPUT_OPTION_TRUSTED );
if( !p_sys->psz_mcast_ip && p_sys->b_rtsp_kasenna )
- {
- char *psz_option;
- asprintf( &psz_option, "rtsp-kasenna" );
- input_ItemAddOption( p_child, psz_option );
- free( psz_option );
- }
+ input_item_AddOption( p_child, "rtsp-kasenna", VLC_INPUT_OPTION_TRUSTED );
- input_ItemAddSubItem( p_current_input, p_child );
+ input_item_AddSubItem( p_current_input, p_child );
vlc_gc_decref( p_child );
- HANDLE_PLAY_AND_RELEASE
+ vlc_gc_decref(p_current_input);
return 0; /* Needed for correct operation of go back */
}