/*****************************************************************************
* live555.cpp : LIVE555 Streaming Media support.
*****************************************************************************
- * Copyright (C) 2003-2007 the VideoLAN team
+ * Copyright (C) 2003-2007 VLC authors and VideoLAN
* $Id$
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Derk-Jan Hartman <djhartman at m2x .dot. nl> for M2X
* Sébastien Escudier <sebastien-devel celeos eu>
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
/*****************************************************************************
p_demux->pf_demux = Demux;
p_demux->pf_control= Control;
- p_demux->p_sys = p_sys = (demux_sys_t*)malloc( sizeof( demux_sys_t ) );
+ p_demux->p_sys = p_sys = (demux_sys_t*)calloc( 1, sizeof( demux_sys_t ) );
if( !p_sys ) return VLC_ENOMEM;
msg_Dbg( p_demux, "version "LIVEMEDIA_LIBRARY_VERSION_STRING );
- p_sys->p_sdp = NULL;
- p_sys->scheduler = NULL;
- p_sys->env = NULL;
- p_sys->ms = NULL;
- p_sys->rtsp = NULL;
TAB_INIT( p_sys->i_track, p_sys->track );
- p_sys->i_pcr = 0;
p_sys->f_npt = 0.;
p_sys->f_npt_start = 0.;
p_sys->f_npt_length = 0.;
- p_sys->p_out_asf = NULL;
p_sys->b_no_data = true;
- p_sys->i_no_data_ti = 0;
- p_sys->p_timeout = NULL;
- p_sys->i_timeout = 0;
- p_sys->b_timeout_call = false;
- p_sys->b_multicast = false;
- p_sys->b_real = false;
p_sys->psz_path = strdup( p_demux->psz_location );
p_sys->b_force_mcast = var_InheritBool( p_demux, "rtsp-mcast" );
- p_sys->b_get_param = false;
- p_sys->b_paused = false;
p_sys->f_seek_request = -1;
- p_sys->b_error = false;
- p_sys->i_live555_ret = 0;
/* parse URL for rtsp://[user:[passwd]@]serverip:port/options */
vlc_UrlParse( &p_sys->url, p_sys->psz_path, 0 );
{
RTSPClientVlc *client_vlc = static_cast<RTSPClientVlc *> (client);
demux_sys_t *p_sys = client_vlc->p_sys;
- p_sys->i_live555_ret = result_code;
- if ( result_code != 0 )
- {
- p_sys->b_error = true;
- p_sys->event_rtsp = 1;
- }
- else
- {
- p_sys->b_get_param = result_string != NULL && strstr( result_string, "GET_PARAMETER" ) != NULL;
- client->sendDescribeCommand( continueAfterDESCRIBE );
- }
+ p_sys->b_get_param =
+ // If OPTIONS fails, assume GET_PARAMETER is not supported but
+ // still continue on with the stream. Some servers (foscam)
+ // return 501/not implemented for OPTIONS.
+ result_code != 0
+ && result_string != NULL
+ && strstr( result_string, "GET_PARAMETER" ) != NULL;
+ client->sendDescribeCommand( continueAfterDESCRIBE );
delete[] result_string;
}
if( i_code == 0 )
msg_Dbg( p_demux, "connection timeout" );
else
+ {
msg_Dbg( p_demux, "connection error %d", i_code );
+ if( i_code == 403 )
+ dialog_Fatal( p_demux, _("RTSP connection failed"),
+ _("Access to the stream is denied by the server configuration.") );
+ }
if( p_sys->rtsp ) RTSPClient::close( p_sys->rtsp );
p_sys->rtsp = NULL;
}
}
/* Because the "faad" decoder does not handle the LATM
* data length field at the start of each returned LATM
- * frame, tell the RTP source to omit it. */
+ * frame, tell the RTP source to omit. */
((MPEG4LATMAudioRTPSource*)sub->rtpSource())->omitLATMDataLengthField();
}
else if( !strcmp( sub->codecName(), "MPEG4-GENERIC" ) )
if( p_sys->f_npt_length > 0 )
{
double d_length = p_sys->f_npt_length * 1000000.0;
- /* Not sure if -0.5 is needed, but better be safe */
- if( d_length - 0.5 > INT64_MAX )
+ if( d_length >= INT64_MAX )
*pi64 = INT64_MAX;
else
*pi64 = (int64_t)d_length;
if( !tk->p_asf_block )
{
- tk->p_asf_block = block_New( p_demux, i_packet_size );
+ tk->p_asf_block = block_Alloc( i_packet_size );
if( !tk->p_asf_block )
break;
tk->p_asf_block->i_buffer = 0;
{
AMRAudioSource *amrSource = (AMRAudioSource*)tk->sub->readSource();
- p_block = block_New( p_demux, i_size + 1 );
+ p_block = block_Alloc( i_size + 1 );
p_block->p_buffer[0] = amrSource->lastFrameHeader();
memcpy( p_block->p_buffer + 1, tk->p_buffer, i_size );
}
{
H261VideoRTPSource *h261Source = (H261VideoRTPSource*)tk->sub->rtpSource();
uint32_t header = h261Source->lastSpecialHeader();
- p_block = block_New( p_demux, i_size + 4 );
+ p_block = block_Alloc( i_size + 4 );
memcpy( p_block->p_buffer, &header, 4 );
memcpy( p_block->p_buffer + 4, tk->p_buffer, i_size );
msg_Warn( p_demux, "unsupported NAL type for H264" );
/* Normal NAL type */
- p_block = block_New( p_demux, i_size + 4 );
+ p_block = block_Alloc( i_size + 4 );
p_block->p_buffer[0] = 0x00;
p_block->p_buffer[1] = 0x00;
p_block->p_buffer[2] = 0x00;
}
else
{
- p_block = block_New( p_demux, i_size );
+ p_block = block_Alloc( i_size );
memcpy( p_block->p_buffer, tk->p_buffer, i_size );
}
}
/* Always smaller */
- p_header = block_New( p_demux, psz_end - psz_asf );
+ p_header = block_Alloc( psz_end - psz_asf );
p_header->i_buffer = vlc_b64_decode_binary_to_buffer( p_header->p_buffer,
p_header->i_buffer, psz_asf );
//msg_Dbg( p_demux, "Size=%d Hdrb64=%s", p_header->i_buffer, psz_asf );