Commit 79bfcf80 authored by Sam Hocevar's avatar Sam Hocevar

* ./modules/access/mms/var_buffer.h: this file is now a separate .c, to

    prevent gcc's optimizer to go amok with nested inline functions, loop
    unrolling and such things that we don't really need in an access plugin.
parent a4ff9947
SOURCES_access_mms = \
modules/access/mms/mms.c \
modules/access/mms/mms.h \
modules/access/mms/var_buffer.h \
modules/access/mms/buffer.c \
modules/access/mms/buffer.h \
modules/access/mms/asf.h \
$(NULL)
......@@ -2,7 +2,7 @@
* asf.h: MMS access plug-in
*****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN
* $Id: asf.h,v 1.2 2002/11/13 20:28:13 fenrir Exp $
* $Id: asf.h,v 1.3 2002/11/22 18:35:57 sam Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
......@@ -51,7 +51,7 @@ static inline int CmpGuid( const guid_t *p_guid1, const guid_t *p_guid2 )
p_guid1->v4[7] == p_guid2->v4[7] ) ? 1 : 0 );
}
static inline void GenerateGuid( guid_t *p_guid )
static void GenerateGuid( guid_t *p_guid )
{
int i;
......
/*****************************************************************************
* var_buffer.h: MMS access plug-in
* buffer.c: MMS access plug-in
*****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN
* $Id: var_buffer.h,v 1.1 2002/11/12 00:54:40 fenrir Exp $
* $Id: buffer.c,v 1.1 2002/11/22 18:35:57 sam Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
......@@ -21,52 +21,21 @@
* 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
* Preamble
*****************************************************************************/
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 );
#include <stdlib.h>
#include <vlc/vlc.h>
#include "asf.h"
#include "buffer.h"
/*****************************************************************************
* Buffer management functions
*****************************************************************************/
static inline int var_buffer_initwrite( var_buffer_t *p_buf,
int i_default_size )
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;
......@@ -76,8 +45,8 @@ static inline int var_buffer_initwrite( var_buffer_t *p_buf,
}
return( 0 );
}
static inline int var_buffer_reinitwrite( var_buffer_t *p_buf,
int i_default_size )
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 )
......@@ -101,7 +70,7 @@ static inline int var_buffer_reinitwrite( var_buffer_t *p_buf,
return( 0 );
}
static inline void var_buffer_add8 ( var_buffer_t *p_buf, uint8_t i_byte )
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 )
......@@ -113,25 +82,26 @@ static inline void var_buffer_add8 ( var_buffer_t *p_buf, uint8_t i_byte )
p_buf->i_data++;
}
static inline void var_buffer_add16( var_buffer_t *p_buf, uint16_t i_word )
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 )
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 )
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 )
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 )
......@@ -146,7 +116,7 @@ static inline void var_buffer_addmemory( var_buffer_t *p_buf,
p_buf->i_data += i_mem;
}
static inline void var_buffer_addUTF16( var_buffer_t *p_buf, char *p_str )
void var_buffer_addUTF16( var_buffer_t *p_buf, char *p_str )
{
int i;
if( !p_str )
......@@ -162,7 +132,7 @@ 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 )
void var_buffer_free( var_buffer_t *p_buf )
{
if( p_buf->p_data )
{
......@@ -172,15 +142,14 @@ static inline void var_buffer_free( var_buffer_t *p_buf )
p_buf->i_size = 0;
}
static inline void var_buffer_initread( var_buffer_t *p_buf,
void *p_data, int i_data )
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 var_buffer_get8 ( var_buffer_t *p_buf )
{
uint8_t i_byte;
if( p_buf->i_data >= p_buf->i_size )
......@@ -193,7 +162,7 @@ static inline uint8_t var_buffer_get8 ( var_buffer_t *p_buf )
}
static inline uint16_t var_buffer_get16( var_buffer_t *p_buf )
uint16_t var_buffer_get16( var_buffer_t *p_buf )
{
uint16_t i_b1, i_b2;
......@@ -203,7 +172,8 @@ static inline uint16_t var_buffer_get16( var_buffer_t *p_buf )
return( i_b1 + ( i_b2 << 8 ) );
}
static inline uint32_t var_buffer_get32( var_buffer_t *p_buf )
uint32_t var_buffer_get32( var_buffer_t *p_buf )
{
uint32_t i_w1, i_w2;
......@@ -212,7 +182,8 @@ static inline uint32_t var_buffer_get32( var_buffer_t *p_buf )
return( i_w1 + ( i_w2 << 16 ) );
}
static inline uint64_t var_buffer_get64( var_buffer_t *p_buf )
uint64_t var_buffer_get64( var_buffer_t *p_buf )
{
uint64_t i_dw1, i_dw2;
......@@ -221,8 +192,8 @@ static inline uint64_t var_buffer_get64( var_buffer_t *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 var_buffer_getmemory ( var_buffer_t *p_buf, void *p_mem, int i_mem )
{
int i_copy;
......@@ -235,12 +206,12 @@ static inline int var_buffer_getmemory ( var_buffer_t *p_buf,
return( i_copy );
}
static inline int var_buffer_readempty( var_buffer_t *p_buf )
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 )
void var_buffer_getguid( var_buffer_t *p_buf, guid_t *p_guid )
{
int i;
......
/*****************************************************************************
* buffer.h: MMS access plug-in
*****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN
* $Id: buffer.h,v 1.1 2002/11/22 18:35:57 sam 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
*****************************************************************************/
int var_buffer_initwrite( var_buffer_t *p_buf, int i_default_size );
int var_buffer_reinitwrite( var_buffer_t *p_buf, int i_default_size );
void var_buffer_add8 ( var_buffer_t *p_buf, uint8_t i_byte );
void var_buffer_add16( var_buffer_t *p_buf, uint16_t i_word );
void var_buffer_add32( var_buffer_t *p_buf, uint32_t i_word );
void var_buffer_add64( var_buffer_t *p_buf, uint64_t i_word );
void var_buffer_addmemory( var_buffer_t *p_buf, void *p_mem, int i_mem );
void var_buffer_addUTF16( var_buffer_t *p_buf, char *p_str );
void var_buffer_free( var_buffer_t *p_buf );
void var_buffer_initread( var_buffer_t *p_buf, void *p_data, int i_data );
uint8_t var_buffer_get8 ( var_buffer_t *p_buf );
uint16_t var_buffer_get16( var_buffer_t *p_buf );
uint32_t var_buffer_get32( var_buffer_t *p_buf );
uint64_t var_buffer_get64( var_buffer_t *p_buf );
int var_buffer_getmemory ( var_buffer_t *p_buf, void *p_mem, int i_mem );
int var_buffer_readempty( var_buffer_t *p_buf );
void var_buffer_getguid( var_buffer_t *p_buf, guid_t *p_guid );
......@@ -2,7 +2,7 @@
* mms.c: MMS access plug-in
*****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN
* $Id: mms.c,v 1.5 2002/11/14 16:32:43 fenrir Exp $
* $Id: mms.c,v 1.6 2002/11/22 18:35:57 sam Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
......@@ -60,8 +60,9 @@
#include "network.h"
#include "asf.h"
#include "var_buffer.h"
#include "buffer.h"
#include "mms.h"
/****************************************************************************
* NOTES:
* MMSProtocole documentation found at http://get.to/sdp
......
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