* This file is a collection of common definitions and types
*/
+#ifndef PACKAGE
+/* Temporary regression test */
+#error You probably forgot to include config.h!!
+#endif
+
/*****************************************************************************
* Required vlc headers
*****************************************************************************/
-#if defined( __BORLANDC__ )
-# undef PACKAGE
-#endif
-
-#include "config.h"
-
-#if defined(PACKAGE)
-# undef PACKAGE_NAME
-# define PACKAGE_NAME PACKAGE
-#endif
-#if defined(VERSION)
-# undef PACKAGE_VERSION
-# define PACKAGE_VERSION VERSION
-#endif
-
#if defined( __BORLANDC__ )
# undef HAVE_VARIADIC_MACROS
# undef HAVE_STDINT_H
typedef struct stream_t stream_t;
typedef struct stream_sys_t stream_sys_t;
typedef struct demux_t demux_t;
+typedef struct demux_meta_t demux_meta_t;
typedef struct demux_sys_t demux_sys_t;
typedef struct es_out_t es_out_t;
typedef struct es_out_id_t es_out_id_t;
/* Video */
typedef struct vout_thread_t vout_thread_t;
typedef struct vout_sys_t vout_sys_t;
-typedef struct vout_synchro_t vout_synchro_t;
typedef struct chroma_sys_t chroma_sys_t;
typedef video_format_t video_frame_format_t;
typedef struct profile_parser_t profile_parser_t;
/* Decoders */
-typedef struct decoder_t decoder_t;
-typedef struct decoder_sys_t decoder_sys_t;
+typedef struct decoder_t decoder_t;
+typedef struct decoder_sys_t decoder_sys_t;
+typedef struct decoder_synchro_t decoder_synchro_t;
/* Encoders */
typedef struct encoder_t encoder_t;
typedef struct sockaddr sockaddr;
typedef struct addrinfo addrinfo;
typedef struct vlc_acl_t vlc_acl_t;
+typedef struct vlc_url_t vlc_url_t;
/* Misc */
typedef struct iso639_lang_t iso639_lang_t;
VLC_GC_MEMBERS
};
+#include <assert.h> /* FIXME: should not be included here */
+
static inline void __vlc_gc_incref( gc_object_t * p_gc )
{
+ assert( p_gc->i_gc_refcount > 0 );
+
p_gc->i_gc_refcount ++;
};
static inline void __vlc_gc_decref( gc_object_t *p_gc )
{
+ if( !p_gc ) return;
+
+ assert( p_gc->i_gc_refcount > 0 );
+
p_gc->i_gc_refcount -- ;
if( p_gc->i_gc_refcount == 0 )
{
p_gc->pf_destructor( p_gc );
/* Do not use the p_gc pointer from now on ! */
- }
+ }
+}
+
+static inline void
+__vlc_gc_init( gc_object_t * p_gc, void (*pf_destructor)( gc_object_t * ),
+ void * arg)
+{
+ p_gc->i_gc_refcount = 1;
+ p_gc->pf_destructor = pf_destructor;
+ p_gc->p_destructor_arg = arg;
}
#define vlc_gc_incref( a ) __vlc_gc_incref( (gc_object_t *)a )
#define vlc_gc_decref( a ) __vlc_gc_decref( (gc_object_t *)a )
-#define vlc_gc_init( a,b,c ) { ((gc_object_t *)a)->i_gc_refcount = 0; \
- ((gc_object_t *)a)->pf_destructor = b; \
- ((gc_object_t *)a)->p_destructor_arg = c; }
+#define vlc_gc_init( a,b,c ) __vlc_gc_init( (gc_object_t *)a,b,c )
/*****************************************************************************
# define __MIN(a, b) ( ((a) < (b)) ? (a) : (b) )
#endif
-static int64_t GCD( int64_t a, int64_t b )
+static inline int64_t GCD( int64_t a, int64_t b )
{
- if( b ) return GCD( b, a % b );
- else return a;
+ while( b )
+ {
+ int64_t c = a % b;
+ a = b;
+ b = c;
+ }
+ return a;
}
/* function imported from libavutil/common.h */
#define DECMALLOC_NULL( var, type ) type* var = (type*)malloc( sizeof(type) );\
if( !var ) return NULL;
-#define FREENULL(a) do { if( a ) { free( a ); a = NULL; } } while(0)
-#define FREE(a) do { if( a ) { free( a ); } } while(0)
+#define FREENULL(a) do { free( a ); a = NULL; } while(0)
#define EMPTY_STR(str) (!str || !*str)
#if defined (WIN32)
# include <dirent.h>
-VLC_INTERNAL( void *, vlc_wopendir, ( const wchar_t * ) );
-VLC_INTERNAL( struct _wdirent *, vlc_wreaddir, ( void * ) );
-VLC_EXPORT( int, vlc_wclosedir, ( void * ) );
-VLC_INTERNAL( void, vlc_rewinddir, ( void * ) );
-VLC_INTERNAL( void, vlc_seekdir, ( void *, long ) );
-VLC_INTERNAL( long, vlc_telldir, ( void * ) );
+ VLC_INTERNAL( void *, vlc_wopendir, ( const wchar_t * ) );
+ VLC_INTERNAL( struct _wdirent *, vlc_wreaddir, ( void * ) );
+ VLC_EXPORT( int, vlc_wclosedir, ( void * ) );
+ VLC_INTERNAL( void, vlc_rewinddir, ( void * ) );
+ VLC_INTERNAL( void, vlc_seekdir, ( void *, long ) );
+ VLC_INTERNAL( long, vlc_telldir, ( void * ) );
# define opendir Use_utf8_opendir_or_vlc_wopendir_instead!
# define readdir Use_utf8_readdir_or_vlc_wreaddir_instead!
# define closedir vlc_wclosedir
* I18n stuff
*****************************************************************************/
#ifdef WIN32
-VLC_EXPORT( char *, vlc_dgettext, ( const char *package, const char *msgid ) );
+ VLC_EXPORT( char *, vlc_dgettext, ( const char *package, const char *msgid ) );
#endif
#if defined( ENABLE_NLS ) && \