]> git.sesse.net Git - vlc/blobdiff - include/vlc_common.h
* src/misc/image.c, include/vlc_image.h: new image handler facility making use of...
[vlc] / include / vlc_common.h
index a55d2be869c47ce9e16825e6d6b254115a0424ff..b43913fc322801477a5da5f282142239eac99ede 100644 (file)
@@ -7,7 +7,7 @@
  *
  * Authors: Samuel Hocevar <sam@via.ecp.fr>
  *          Vincent Seguin <seguin@via.ecp.fr>
- *          Gildas Bazin <gbazin@netcourrier.com>
+ *          Gildas Bazin <gbazin@videolan.org>
  *
  * 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
 
 #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
@@ -113,7 +122,7 @@ typedef int                 ptrdiff_t;
 #   endif
 #endif
 
-#if defined( WIN32 )
+#if defined( WIN32 ) || defined( UNDER_CE )
 #   include <malloc.h>
 #   ifndef PATH_MAX
 #       define PATH_MAX MAX_PATH
@@ -196,18 +205,27 @@ typedef struct msg_subscription_t msg_subscription_t;
  * Playlist commands
  */
 typedef enum {
-    PLAYLIST_PLAY,                              /**< Starts playing. No arg. */
-    PLAYLIST_PAUSE,                     /**< Toggles playlist pause. No arg. */
-    PLAYLIST_STOP,                               /**< Stops playing. No arg. */
-    PLAYLIST_SKIP,                               /**< Skip X items and play. */
-    PLAYLIST_GOTO,                                       /**< Goto Xth item. */
+    PLAYLIST_PLAY,      /**< No arg.                            res=can fail*/
+    PLAYLIST_AUTOPLAY,  /**< No arg.                            res=cant fail*/
+    PLAYLIST_VIEWPLAY,  /**< arg1= int, arg2= playlist_item_t*,*/
+                        /**  arg3 = playlist_item_t*          , res=can fail */
+    PLAYLIST_ITEMPLAY,  /** <arg1 = playlist_item_t *         , res=can fail */
+    PLAYLIST_PAUSE,     /**< No arg                             res=can fail*/
+    PLAYLIST_STOP,      /**< No arg                             res=can fail*/
+    PLAYLIST_SKIP,      /**< arg1=int,                          res=can fail*/
+    PLAYLIST_GOTO,      /**< arg1=int                           res=can fail */
+    PLAYLIST_VIEWGOTO,      /**< arg1=int                       res=can fail */
 } playlist_command_t;
 
 
 typedef struct playlist_t playlist_t;
 typedef struct playlist_item_t playlist_item_t;
-typedef struct playlist_group_t playlist_group_t;
+typedef struct playlist_view_t playlist_view_t;
 typedef struct playlist_export_t playlist_export_t;
+typedef struct services_discovery_t services_discovery_t;
+typedef struct services_discovery_sys_t services_discovery_sys_t;
+typedef struct playlist_add_t playlist_add_t;
+typedef struct playlist_preparse_t playlist_preparse_t;
 
 /* Modules */
 typedef struct module_bank_t module_bank_t;
@@ -216,6 +234,8 @@ typedef struct module_config_t module_config_t;
 typedef struct module_symbols_t module_symbols_t;
 typedef struct module_cache_t module_cache_t;
 
+typedef struct config_category_t config_category_t;
+
 /* Interface */
 typedef struct intf_thread_t intf_thread_t;
 typedef struct intf_sys_t intf_sys_t;
@@ -270,18 +290,22 @@ typedef struct aout_filter_t aout_filter_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 picture_t picture_t;
 typedef struct picture_sys_t picture_sys_t;
 typedef struct picture_heap_t picture_heap_t;
+
+typedef struct spu_t spu_t;
 typedef struct subpicture_t subpicture_t;
 typedef struct subpicture_sys_t subpicture_sys_t;
 typedef struct subpicture_region_t subpicture_region_t;
-typedef struct vout_synchro_t vout_synchro_t;
-typedef struct text_renderer_sys_t text_renderer_sys_t;
 typedef struct text_style_t text_style_t;
 
+typedef struct image_handler_t image_handler_t;
+
 /* Stream output */
 typedef struct sout_instance_t sout_instance_t;
 typedef struct sout_instance_sys_t sout_instance_sys_t;
@@ -325,6 +349,7 @@ typedef struct data_buffer_t data_buffer_t;
 typedef struct stream_ctrl_t stream_ctrl_t;
 typedef struct pes_packet_t pes_packet_t;
 typedef struct network_socket_t network_socket_t;
+typedef struct virtual_socket_t v_socket_t;
 typedef struct iso639_lang_t iso639_lang_t;
 
 /* block */
@@ -345,6 +370,22 @@ typedef int (*httpd_file_callback_t)( httpd_file_sys_t*, httpd_file_t *, uint8_t
 typedef struct httpd_redirect_t httpd_redirect_t;
 typedef struct httpd_stream_t httpd_stream_t;
 
+/* TLS support */
+typedef struct tls_t tls_t;
+typedef struct tls_server_t tls_server_t;
+typedef struct tls_session_t tls_session_t;
+
+/* XML */
+typedef struct xml_t xml_t;
+typedef struct xml_sys_t xml_sys_t;
+typedef struct xml_reader_t xml_reader_t;
+typedef struct xml_reader_sys_t xml_reader_sys_t;
+
+/* vod server */
+typedef struct vod_t     vod_t;
+typedef struct vod_sys_t vod_sys_t;
+typedef struct vod_media_t vod_media_t;
+
 /* opengl */
 typedef struct opengl_t     opengl_t;
 typedef struct opengl_sys_t opengl_sys_t;
@@ -381,7 +422,11 @@ typedef int ( * vlc_callback_t ) ( vlc_object_t *,      /* variable's object */
 #if defined( WIN32 ) || defined( UNDER_CE )
 #   define WIN32_LEAN_AND_MEAN
 #   include <windows.h>
-#   define IS_WINNT ( GetVersion() < 0x80000000 )
+#   if defined( UNDER_CE )
+#      define IS_WINNT 0
+#   else
+#      define IS_WINNT ( GetVersion() < 0x80000000 )
+#   endif
 #endif
 
 #include "vlc_threads.h"
@@ -414,6 +459,7 @@ typedef int ( * vlc_callback_t ) ( vlc_object_t *,      /* variable's object */
     volatile vlc_bool_t b_die;                   /**< set by the outside */ \
     volatile vlc_bool_t b_dead;                   /**< set by the object */ \
     volatile vlc_bool_t b_attached;               /**< set by the object */ \
+    vlc_bool_t b_force;      /**< set by the outside (eg. module_Need()) */ \
                                                                             \
     /* Object variables */                                                  \
     vlc_mutex_t     var_lock;                                               \
@@ -465,6 +511,12 @@ typedef int ( * vlc_callback_t ) ( vlc_object_t *,      /* variable's object */
 #   define __MIN(a, b)   ( ((a) < (b)) ? (a) : (b) )
 #endif
 
+static int64_t GCD( int64_t a, int64_t b )
+{
+    if( b ) return GCD( b, a % b );
+    else return a;
+}
+
 /* Dynamic array handling: realloc array, move data, increment position */
 #define INSERT_ELEM( p_ar, i_oldsize, i_pos, elem )                           \
     do                                                                        \
@@ -607,7 +659,6 @@ static inline uint64_t GetQWLE( void const * _p )
 #define GetQWBE( p )    U64_AT( p )
 
 /* Helper writer functions */
-
 #define SetWLE( p, v ) _SetWLE( (uint8_t*)p, v)
 static inline void _SetWLE( uint8_t *p, uint16_t i_dw )
 {
@@ -629,6 +680,27 @@ static inline void _SetQWLE( uint8_t *p, uint64_t i_qw )
     SetDWLE( p,   i_qw&0xffffffff );
     SetDWLE( p+4, ( i_qw >> 32)&0xffffffff );
 }
+#define SetWBE( p, v ) _SetWBE( (uint8_t*)p, v)
+static inline void _SetWBE( uint8_t *p, uint16_t i_dw )
+{
+    p[0] = ( i_dw >>  8 )&0xff;
+    p[1] = ( i_dw       )&0xff;
+}
+
+#define SetDWBE( p, v ) _SetDWBE( (uint8_t*)p, v)
+static inline void _SetDWBE( uint8_t *p, uint32_t i_dw )
+{
+    p[0] = ( i_dw >> 24 )&0xff;
+    p[1] = ( i_dw >> 16 )&0xff;
+    p[2] = ( i_dw >>  8 )&0xff;
+    p[3] = ( i_dw       )&0xff;
+}
+#define SetQWBE( p, v ) _SetQWBE( (uint8_t*)p, v)
+static inline void _SetQWBE( uint8_t *p, uint64_t i_qw )
+{
+    SetDWBE( p+4,   i_qw&0xffffffff );
+    SetDWBE( p, ( i_qw >> 32)&0xffffffff );
+}
 
 #if WORDS_BIGENDIAN
 #   define hton16(i)   ( i )
@@ -730,6 +802,12 @@ static inline void _SetQWLE( uint8_t *p, uint64_t i_qw )
 #   define vlc_atof NULL
 #endif
 
+#ifndef HAVE_STRTOF
+#   ifdef HAVE_STRTOD
+#       define strtof strtod
+#   endif
+#endif
+
 #ifndef HAVE_ATOLL
 #   define atoll vlc_atoll
     VLC_EXPORT( int64_t, vlc_atoll, ( const char *nptr ) );
@@ -737,6 +815,13 @@ static inline void _SetQWLE( uint8_t *p, uint64_t i_qw )
 #   define vlc_atoll NULL
 #endif
 
+#ifndef HAVE_STRTOLL
+#   define strtoll vlc_strtoll
+    VLC_EXPORT( int64_t, vlc_strtoll, ( const char *nptr, char **endptr, int base ) );
+#elif !defined(__PLUGIN__)
+#   define vlc_strtoll NULL
+#endif
+
 #ifndef HAVE_GETENV
 #   define getenv vlc_getenv
     VLC_EXPORT( char *, vlc_getenv, ( const char *name ) );
@@ -868,6 +953,13 @@ typedef __int64 off_t;
 #       define vsnprintf _vsnprintf
 #   endif
 
+#   ifndef _T
+#       ifdef UNICODE
+#           define _T(q) L##q
+#       else
+#           define _T(q) q
+#       endif
+#   endif
 #endif
 
 /* lseek (defined in src/extras/libc.c) */
@@ -878,10 +970,19 @@ typedef __int64 off_t;
 #   define vlc_lseek NULL
 #endif
 
+VLC_EXPORT( vlc_bool_t, vlc_reduce, ( int *, int *, int64_t, int64_t, int64_t ) );
+VLC_EXPORT( char **, vlc_parse_cmdline, ( const char *, int * ) );
+
 /* vlc_wraptext (defined in src/extras/libc.c) */
 #define wraptext vlc_wraptext
 VLC_EXPORT( char *, vlc_wraptext, ( const char *, int, vlc_bool_t ) );
 
+/* iconv wrappers (defined in src/extras/libc.c) */
+typedef void *vlc_iconv_t;
+VLC_EXPORT( vlc_iconv_t, vlc_iconv_open, ( const char *, const char * ) );
+VLC_EXPORT( size_t, vlc_iconv, ( vlc_iconv_t, char **, size_t *, char **, size_t * ) );
+VLC_EXPORT( int, vlc_iconv_close, ( vlc_iconv_t ) );
+
 /*****************************************************************************
  * CPU capabilities
  *****************************************************************************/
@@ -908,17 +1009,13 @@ VLC_EXPORT( char *, vlc_dgettext, ( const char *package, const char *msgid ) );
       defined(MODULE_NAME_IS_pda))
     /* Declare nothing: gnome.h will do it for us */
 #elif defined( ENABLE_NLS )
-#if defined( HAVE_INCLUDED_GETTEXT )
-#   include "libintl.h"
-#else
-#   include <libintl.h>
-#endif
+#   if defined( HAVE_INCLUDED_GETTEXT )
+#       include "libintl.h"
+#   else
+#       include <libintl.h>
+#   endif
 #   undef _
-#if defined( __BORLANDC__ )
-#define _(String) vlc_dgettext (PACKAGE_TARNAME, String)
-#else
-#   define _(String) vlc_dgettext (PACKAGE, String)
-#endif
+#   define _(String) vlc_dgettext (PACKAGE_NAME, String)
 #   define N_(String) ((char*)(String))
 #else
 #   define _(String) ((char*)(String))