Commit 5813fcd8 authored by Laurent Aimar's avatar Laurent Aimar

* modules/demux/asf/.cvsignore : put the good one.

 * modules/access/mms : add MMS (Microsoft Media Streaming) access (Support
only TCP, I will try to add UDP and HTTP as well).
 There are some problems with streams selections and we cannot seek, but
anyway it seems to work. (Usefull for some radio web)
 * other: enable mms access by default.
parent c0e8ae07
......@@ -582,7 +582,7 @@ PLUGINS="${PLUGINS} wav araw"
dnl
dnl Network modules
dnl
NETWORK_MODULES="access_udp access_http access_rtp ipv4"
NETWORK_MODULES="access_udp access_http access_rtp ipv4 access_mms"
dnl
dnl Accelerated modules
......
......@@ -4,6 +4,7 @@ EXTRA_DIST = \
access/dvd/Modules.am \
access/dvdplay/Modules.am \
access/dvdread/Modules.am \
access/mms/Modules.am \
access/satellite/Modules.am \
access/v4l/Modules.am \
access/vcd/Modules.am \
......
SOURCES_access_mms = modules/access/mms/mms.c
noinst_HEADERS += modules/access/mms/mms.h \
modules/access/mms/var_buffer.h \
modules/access/mms/asf.h
/*****************************************************************************
* asf.h: MMS access plug-in
*****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN
* $Id: asf.h,v 1.1 2002/11/12 00:54:40 fenrir Exp $
*
* Authors: Christophe Massiot <massiot@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
* (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.
*
* 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.
*****************************************************************************/
/****************************************************************************
* XXX:
* Definitions and data duplicated from asf demuxers but I want access
* and demux plugins to be independant
*
****************************************************************************/
typedef struct guid_s
{
u32 v1; /* le */
u16 v2; /* le */
u16 v3; /* le */
u8 v4[8];
} guid_t;
static inline int CmpGuid( const guid_t *p_guid1, const guid_t *p_guid2 )
{
return( ( p_guid1->v1 == p_guid2->v1 &&
p_guid1->v2 == p_guid2->v2 &&
p_guid1->v3 == p_guid2->v3 &&
p_guid1->v4[0] == p_guid2->v4[0] &&
p_guid1->v4[1] == p_guid2->v4[1] &&
p_guid1->v4[2] == p_guid2->v4[2] &&
p_guid1->v4[3] == p_guid2->v4[3] &&
p_guid1->v4[4] == p_guid2->v4[4] &&
p_guid1->v4[5] == p_guid2->v4[5] &&
p_guid1->v4[6] == p_guid2->v4[6] &&
p_guid1->v4[7] == p_guid2->v4[7] ) ? 1 : 0 );
}
static inline void GenerateGuid( guid_t *p_guid )
{
int i;
srand( mdate() & 0xffffffff );
/* FIXME should be generated using random data */
p_guid->v1 = 0xbabac001;
p_guid->v2 = ( (u64)rand() << 16 ) / RAND_MAX;
p_guid->v3 = ( (u64)rand() << 16 ) / RAND_MAX;
for( i = 0; i < 8; i++ )
{
p_guid->v4[i] = ( (u64)rand() * 256 ) / RAND_MAX;
}
}
#define GUID_FMT "%8.8x-%4.4x-%4.4x-%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x"
#define GUID_PRINT( guid ) \
(guid).v1, \
(guid).v2, \
(guid).v3, \
(guid).v4[0],(guid).v4[1],(guid).v4[2],(guid).v4[3], \
(guid).v4[4],(guid).v4[5],(guid).v4[6],(guid).v4[7]
static const guid_t asf_object_header_guid =
{
0x75B22630,
0x668E,
0x11CF,
{ 0xA6,0xD9, 0x00,0xAA,0x00,0x62,0xCE,0x6C }
};
static const guid_t asf_object_stream_properties_guid =
{
0xB7DC0791,
0xA9B7,
0x11CF,
{ 0x8E,0xE6, 0x00,0xC0,0x0C,0x20,0x53,0x65 }
};
static const guid_t asf_object_stream_type_audio =
{
0xF8699E40,
0x5B4D,
0x11CF,
{ 0xA8,0xFD, 0x00,0x80,0x5F,0x5C,0x44,0x2B }
};
static const guid_t asf_object_stream_type_video =
{
0xbc19efc0,
0x5B4D,
0x11CF,
{ 0xA8,0xFD, 0x00,0x80,0x5F,0x5C,0x44,0x2B }
};
static const guid_t asf_object_bitrate_properties_guid =
{
0x7BF875CE,
0x468D,
0x11D1,
{ 0x8D,0x82,0x00,0x60,0x97,0xC9,0xA2,0xB2 }
};
static const guid_t asf_object_bitrate_mutual_exclusion_guid =
{
0xD6E229DC,
0x35DA,
0x11D1,
{ 0x90,0x34,0x00,0xA0,0xC9,0x03,0x49,0xBE }
};
This diff is collapsed.
/*****************************************************************************
* mms.h: MMS access plug-in
*****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN
* $Id: mms.h,v 1.1 2002/11/12 00:54:40 fenrir Exp $
*
* Authors: Christophe Massiot <massiot@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
* (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.
*
* 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.
*****************************************************************************/
/* url: [/]host[:port][/path] */
typedef struct url_s
{
char *psz_server_addr;
int i_server_port;
char *psz_path;
// private
char *psz_private;
} url_t;
#define FREE( p ) if( p ) free( p )
#define MMS_PROTO_AUTO 0
#define MMS_PROTO_TCP 1
#define MMS_PROTO_UDP 2
#define MMS_PACKET_CMD 0
#define MMS_PACKET_HEADER 1
#define MMS_PACKET_MEDIA 2
#define MMS_PACKET_UDP_TIMING 3
#define MMS_STREAM_VIDEO 0x0001
#define MMS_STREAM_AUDIO 0x0002
#define MMS_STREAM_UNKNOWN 0xffff
#define MMS_CMD_HEADERSIZE 48
typedef struct mms_stream_s
{
int i_id; // 1 -> 127
int i_cat; // MMS_STREAM_VIDEO, MMS_STREAM_AUDIO
int i_bitrate; // -1 if unknown
// int i_selected;
} mms_stream_t;
typedef struct access_s
{
/* XXX must be the first field because of __input_FD* XXX */
input_socket_t _socket;
int i_proto; // MMS_PROTO_TCP, MMS_PROTO_UDP
input_socket_t socket_server; // TCP socket for communication with server
input_socket_t socket_data; // Optional UDP socket for data(media/header packet)
// send by server
url_t url; // connect to this server
mms_stream_t stream[128]; //in asf never more than 1->127 streams
off_t i_pos; // position of next byte to be read
/* data necessary to send data to server */
guid_t guid;
int i_command_level;
int i_seq_num;
uint32_t i_header_packet_id_type;
uint32_t i_media_packet_id_type;
int i_packet_seq_num;
uint8_t *p_cmd; // latest command read
int i_cmd; // allocated at the begining
uint8_t *p_header; // allocated by mms_ReadPacket
int i_header;
uint8_t *p_media; // allocated by mms_ReadPacket
int i_media;
int i_media_used;
// extracted informations
int i_command;
// from 0x01 answer (not yet set)
char *psz_server_version;
char *psz_tool_version;
char *psz_update_player_url;
char *psz_encryption_type;
// from 0x06 answer
uint32_t i_flags_broadcast;
uint32_t i_media_length;
int i_packet_length;
uint32_t i_packet_count;
int i_max_bit_rate;
int i_header_size;
} access_t;
static inline uint16_t GetWLE( u8 *p_buff )
{
return( (p_buff[0]) + ( p_buff[1] <<8 ) );
}
static inline uint32_t GetDWLE( u8 *p_buff )
{
return( p_buff[0] + ( p_buff[1] <<8 ) +
( p_buff[2] <<16 ) + ( p_buff[3] <<24 ) );
}
/*****************************************************************************
* var_buffer.h: MMS access plug-in
*****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN
* $Id: var_buffer.h,v 1.1 2002/11/12 00:54:40 fenrir Exp $
*
* 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
* (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.
*
* 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.
*****************************************************************************/
typedef struct var_buffer_s
{
uint8_t *p_data; // pointer on data
int i_data; // number of bytes set in p_data
// private
int i_size; // size of p_data memory allocated
} var_buffer_t;
/*****************************************************************************
* Macro/Function to create/manipulate buffer
*****************************************************************************/
static inline int var_buffer_initwrite( var_buffer_t *p_buf,
int i_default_size );
static inline int var_buffer_reinitwrite( var_buffer_t *p_buf,
int i_default_size );
static inline void var_buffer_add8 ( var_buffer_t *p_buf, uint8_t i_byte );
static inline void var_buffer_add16( var_buffer_t *p_buf, uint16_t i_word );
static inline void var_buffer_add32( var_buffer_t *p_buf, uint32_t i_word );
static inline void var_buffer_add64( var_buffer_t *p_buf, uint64_t i_word );
static inline void var_buffer_addmemory( var_buffer_t *p_buf,
void *p_mem, int i_mem );
static inline void var_buffer_addUTF16( var_buffer_t *p_buf, char *p_str );
static inline void var_buffer_free( var_buffer_t *p_buf );
static inline void var_buffer_initread( var_buffer_t *p_buf,
void *p_data, int i_data );
static inline uint8_t var_buffer_get8 ( var_buffer_t *p_buf );
static inline uint16_t var_buffer_get16( var_buffer_t *p_buf );
static inline uint32_t var_buffer_get32( var_buffer_t *p_buf );
static inline uint64_t var_buffer_get64( var_buffer_t *p_buf );
static inline int var_buffer_getmemory ( var_buffer_t *p_buf,
void *p_mem, int i_mem );
static inline int var_buffer_readempty( var_buffer_t *p_buf );
static inline void var_buffer_getguid( var_buffer_t *p_buf,
guid_t *p_guid );
/*****************************************************************************
*****************************************************************************/
static inline int var_buffer_initwrite( var_buffer_t *p_buf,
int i_default_size )
{
p_buf->i_size = ( i_default_size > 0 ) ? i_default_size : 2048;
p_buf->i_data = 0;
if( !( p_buf->p_data = malloc( p_buf->i_size ) ) )
{
return( -1 );
}
return( 0 );
}
static inline int var_buffer_reinitwrite( var_buffer_t *p_buf,
int i_default_size )
{
p_buf->i_data = 0;
if( p_buf->i_size < i_default_size )
{
p_buf->i_size = i_default_size;
if( p_buf->p_data )
{
free( p_buf->p_data );
}
p_buf->p_data = malloc( p_buf->i_size );
}
if( !p_buf->p_data )
{
p_buf->i_size = ( i_default_size > 0 ) ? i_default_size : 2048;
p_buf->p_data = malloc( p_buf->i_size );
}
if( !p_buf->p_data )
{
return( -1 );
}
return( 0 );
}
static inline void var_buffer_add8 ( var_buffer_t *p_buf, uint8_t i_byte )
{
/* check if there is enough data */
if( p_buf->i_data >= p_buf->i_size )
{
p_buf->i_size += 1024;
p_buf->p_data = realloc( p_buf->p_data, p_buf->i_size );
}
p_buf->p_data[p_buf->i_data] = i_byte&0xff;
p_buf->i_data++;
}
static inline void var_buffer_add16( var_buffer_t *p_buf, uint16_t i_word )
{
var_buffer_add8( p_buf, i_word&0xff );
var_buffer_add8( p_buf, ( i_word >> 8 )&0xff );
}
static inline void var_buffer_add32( var_buffer_t *p_buf, uint32_t i_dword )
{
var_buffer_add16( p_buf, i_dword&0xffff );
var_buffer_add16( p_buf, ( i_dword >> 16 )&0xffff );
}
static inline void var_buffer_add64( var_buffer_t *p_buf, uint64_t i_long )
{
var_buffer_add32( p_buf, i_long&0xffffffff );
var_buffer_add32( p_buf, ( i_long >> 32 )&0xffffffff );
}
static inline void var_buffer_addmemory( var_buffer_t *p_buf,
void *p_mem, int i_mem )
{
/* check if there is enough data */
if( p_buf->i_data + i_mem >= p_buf->i_size )
{
p_buf->i_size += i_mem + 1024;
p_buf->p_data = realloc( p_buf->p_data, p_buf->i_size );
}
memcpy( p_buf->p_data + p_buf->i_data,
p_mem,
i_mem );
p_buf->i_data += i_mem;
}
static inline void var_buffer_addUTF16( var_buffer_t *p_buf, char *p_str )
{
int i;
if( !p_str )
{
var_buffer_add16( p_buf, 0 );
}
else
{
for( i = 0; i < strlen( p_str ) + 1; i++ ) // and 0
{
var_buffer_add16( p_buf, p_str[i] );
}
}
}
static inline void var_buffer_free( var_buffer_t *p_buf )
{
if( p_buf->p_data )
{
free( p_buf->p_data );
}
p_buf->i_data = 0;
p_buf->i_size = 0;
}
static inline void var_buffer_initread( var_buffer_t *p_buf,
void *p_data, int i_data )
{
p_buf->i_size = i_data;
p_buf->i_data = 0;
p_buf->p_data = p_data;
}
static inline uint8_t var_buffer_get8 ( var_buffer_t *p_buf )
{
uint8_t i_byte;
if( p_buf->i_data >= p_buf->i_size )
{
return( 0 );
}
i_byte = p_buf->p_data[p_buf->i_data];
p_buf->i_data++;
return( i_byte );
}
static inline uint16_t var_buffer_get16( var_buffer_t *p_buf )
{
uint16_t i_b1, i_b2;
i_b1 = var_buffer_get8( p_buf );
i_b2 = var_buffer_get8( p_buf );
return( i_b1 + ( i_b2 << 8 ) );
}
static inline uint32_t var_buffer_get32( var_buffer_t *p_buf )
{
uint32_t i_w1, i_w2;
i_w1 = var_buffer_get16( p_buf );
i_w2 = var_buffer_get16( p_buf );
return( i_w1 + ( i_w2 << 16 ) );
}
static inline uint64_t var_buffer_get64( var_buffer_t *p_buf )
{
uint64_t i_dw1, i_dw2;
i_dw1 = var_buffer_get32( p_buf );
i_dw2 = var_buffer_get32( p_buf );
return( i_dw1 + ( i_dw2 << 32 ) );
}
static inline int var_buffer_getmemory ( var_buffer_t *p_buf,
void *p_mem, int i_mem )
{
int i_copy;
i_copy = __MIN( i_mem, p_buf->i_size - p_buf->i_data );
if( i_copy > 0 && p_mem != NULL)
{
memcpy( p_mem, p_buf + p_buf->i_data, i_copy );
}
p_buf->i_data += i_copy;
return( i_copy );
}
static inline int var_buffer_readempty( var_buffer_t *p_buf )
{
return( ( p_buf->i_data >= p_buf->i_size ) ? 1 : 0 );
}
static inline void var_buffer_getguid( var_buffer_t *p_buf, guid_t *p_guid )
{
int i;
p_guid->v1 = var_buffer_get32( p_buf );
p_guid->v2 = var_buffer_get16( p_buf );
p_guid->v3 = var_buffer_get16( p_buf );
for( i = 0; i < 8; i++ )
{
p_guid->v4[i] = var_buffer_get8( p_buf );
}
}
.dep
*.lo
*.o.*
*.lo.*
.deps
.dirstamp
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment