/*****************************************************************************
* mmstu.c: MMS access plug-in
*****************************************************************************
- * Copyright (C) 2001, 2002 the VideoLAN team
+ * Copyright (C) 2001, 2002 VLC authors and VideoLAN
* $Id$
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
- * 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.
*****************************************************************************/
#include <errno.h>
#include <assert.h>
-#ifdef HAVE_UNISTD_H
-# include <unistd.h>
-#endif
#include <sys/types.h>
+#include <unistd.h>
#ifdef HAVE_POLL
# include <poll.h>
#endif
{ /* first try with TCP and then UDP*/
if( ( i_status = MMSOpen( p_access, &p_sys->url, MMS_PROTO_TCP ) ) )
{
- if( !p_access->b_die )
+ if( vlc_object_alive(p_access) )
i_status = MMSOpen( p_access, &p_sys->url, MMS_PROTO_UDP );
}
}
else
{
p_sys->b_seekable = true;
- p_access->info.i_size =
+ p_sys->i_size =
(uint64_t)p_sys->i_header +
(uint64_t)p_sys->i_packet_count * (uint64_t)p_sys->i_packet_length;
}
switch( i_query )
{
- /* */
case ACCESS_CAN_SEEK:
pb_bool = (bool*)va_arg( args, bool* );
*pb_bool = p_sys->b_seekable;
*pb_bool = true;
break;
- /* */
+ case ACCESS_GET_SIZE:
+ *va_arg( args, uint64_t * ) = p_sys->i_size;
+ break;
+
case ACCESS_GET_PTS_DELAY:
pi_64 = (int64_t*)va_arg( args, int64_t * );
*pi_64 = INT64_C(1000)
*pb_bool = p_sys->asfh.stream[i_int].i_selected ? true : false;
break;
- /* */
case ACCESS_SET_PAUSE_STATE:
b_bool = (bool)va_arg( args, int );
if( b_bool )
}
break;
- case ACCESS_GET_TITLE_INFO:
- case ACCESS_SET_TITLE:
- case ACCESS_SET_SEEKPOINT:
- case ACCESS_SET_PRIVATE_ID_STATE:
- case ACCESS_GET_CONTENT_TYPE:
- case ACCESS_GET_META:
- return VLC_EGENERIC;
-
-
default:
- msg_Warn( p_access, "unimplemented query in control" );
return VLC_EGENERIC;
-
}
return VLC_SUCCESS;
}
{
const size_t i_copy = p_sys->i_header - p_access->info.i_pos;
- block_t *p_block = block_New( p_access, i_copy );
+ block_t *p_block = block_Alloc( i_copy );
if( !p_block )
return NULL;
if( __MAX( p_sys->i_media, p_sys->i_media_used ) < p_sys->i_packet_length )
i_padding = p_sys->i_packet_length - __MAX( p_sys->i_media, p_sys->i_media_used );
- block_t *p_block = block_New( p_access, i_copy + i_padding );
+ block_t *p_block = block_Alloc( i_copy + i_padding );
if( !p_block )
return NULL;
for( i = 1; i < 128; i++ )
{
- if( p_sys->asfh.stream[i].i_cat != ASF_STREAM_UNKNOWN )
+ if( p_sys->asfh.stream[i].i_cat != ASF_CODEC_TYPE_UNKNOWN )
{
i_streams++;
if( i_first != -1 )
msg_Info( p_access,
"selecting stream[0x%x] %s (%d Kib/s)",
i,
- ( p_sys->asfh.stream[i].i_cat == ASF_STREAM_AUDIO ) ?
+ ( p_sys->asfh.stream[i].i_cat == ASF_CODEC_TYPE_AUDIO ) ?
"audio" : "video" ,
p_sys->asfh.stream[i].i_bitrate / 1024);
}
msg_Info( p_access,
"ignoring stream[0x%x] %s (%d Kib/s)",
i,
- ( p_sys->asfh.stream[i].i_cat == ASF_STREAM_AUDIO ) ?
+ ( p_sys->asfh.stream[i].i_cat == ASF_CODEC_TYPE_AUDIO ) ?
"audio" : "video" ,
p_sys->asfh.stream[i].i_bitrate / 1024);
static int NetFillBuffer( access_t *p_access )
{
-#ifdef UNDER_CE
- return -1;
-
-#else
access_sys_t *p_sys = p_access->p_sys;
int i_ret;
struct pollfd ufd[2];
if( i_ret < 0 )
{
- msg_Err( p_access, "network poll error (%m)" );
+ msg_Err( p_access, "network poll error: %s", vlc_strerror_c(errno) );
return -1;
}
if( i_udp_read > 0 ) p_sys->i_buffer_udp += i_udp_read;
return i_tcp_read + i_udp_read;
-#endif
}
static int mms_ParseCommand( access_t *p_access,
msleep( 10 * CLOCK_FREQ );
}
- assert(0);
+ vlc_assert_unreachable();
}
static void KeepAliveStart( access_t *p_access )