*****************************************************************************/
#include <stdlib.h>
#include <stdarg.h>
+#include <assert.h>
#include <string.h>
#include <stdio.h>
/* 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;
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 */
#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 ) && \