* access.c: Real rtsp input
*****************************************************************************
* Copyright (C) 2005 VideoLAN
- * $Id: file.c 10310 2005-03-11 22:36:40Z anil $
+ * $Id$
*
* Authors: Gildas Bazin <gbazin@videolan.org>
*
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
#include <vlc/vlc.h>
-#include <vlc/input.h>
+#include <vlc_access.h>
+#include <vlc_interface.h>
-#include "network.h"
+#include <vlc_network.h>
#include "rtsp.h"
#include "real.h"
#define CACHING_TEXT N_("Caching value (ms)")
#define CACHING_LONGTEXT N_( \
- "Allows you to modify the default caching value for RTSP streams. This " \
- "value should be set in millisecond units." )
+ "Caching value for RTSP streams. This " \
+ "value should be set in milliseconds." )
vlc_module_begin();
- set_description( _("Standard filesystem file input") );
+ set_description( _("Real RTSP") );
set_shortname( _("Real RTSP") );
set_category( CAT_INPUT );
set_subcategory( SUBCAT_INPUT_ACCESS );
set_callbacks( Open, Close );
add_shortcut( "realrtsp" );
add_shortcut( "rtsp" );
+ add_shortcut( "pnm" );
vlc_module_end();
access_sys_t *p_sys = p_access->p_sys;
/* Open connection */
- p_sys->fd = net_OpenTCP( p_access, psz_server, i_port );
+ p_sys->fd = net_ConnectTCP( p_access, psz_server, i_port );
if( p_sys->fd < 0 )
{
msg_Err( p_access, "cannot connect to %s:%d", psz_server, i_port );
+ intf_UserFatal( p_access, VLC_FALSE, _("Connection failed"),
+ _("VLC could not connect to \"%s:%d\"."), psz_server, i_port );
return VLC_EGENERIC;
}
char *psz_server = 0;
int i_result;
- if( !p_access->b_force ) return VLC_EGENERIC;
+ if( !p_access->psz_access || (
+ strncmp( p_access->psz_access, "rtsp", 4 ) &&
+ strncmp( p_access->psz_access, "pnm", 3 ) &&
+ strncmp( p_access->psz_access, "realrtsp", 8 ) ))
+ {
+ return VLC_EGENERIC;
+ }
p_access->pf_read = NULL;
p_access->pf_block = BlockRead;
msg_Err( p_access, "rtsp session can not be established" );
+ intf_UserFatal( p_access, VLC_FALSE, _("Session failed"),
+ _("The requested RTSP session could not be established.") );
goto error;
}
p_sys->p_header = block_New( p_access, 4096 );
p_sys->p_header->i_buffer =
- rmff_dump_header( h, p_sys->p_header->p_buffer, 1024 );
+ rmff_dump_header( h, (char *)p_sys->p_header->p_buffer, 1024 );
+ rmff_free_header( h );
}
else
{
- msg_Dbg( p_access, "only real/helix rtsp servers supported for now" );
+ msg_Warn( p_access, "only real/helix rtsp servers supported for now" );
goto error;
}
var_Create( p_access, "realrtsp-caching",
VLC_VAR_INTEGER | VLC_VAR_DOINHERIT);
+ if( psz_server ) free( psz_server );
return VLC_SUCCESS;
error:
{
access_sys_t *p_sys = p_access->p_sys;
block_t *p_block;
+ rmff_pheader_t pheader;
+ int i_size;
if( p_sys->p_header )
{
return p_block;
}
- p_block = block_New( p_access, 4096 );
- p_block->i_buffer = real_get_rdt_chunk( p_access->p_sys->p_rtsp,
+ i_size = real_get_rdt_chunk_header( p_access->p_sys->p_rtsp, &pheader );
+ if( i_size <= 0 ) return 0;
+
+ p_block = block_New( p_access, i_size );
+ p_block->i_buffer = real_get_rdt_chunk( p_access->p_sys->p_rtsp, &pheader,
&p_block->p_buffer );
return p_block;
*****************************************************************************/
static int Control( access_t *p_access, int i_query, va_list args )
{
- access_sys_t *p_sys = p_access->p_sys;
vlc_bool_t *pb_bool;
int *pi_int;
int64_t *pi_64;