OSDN Git Service

gitattirubes test 2
[handbrake-jp/handbrake-jp.git] / libhb / ports.h
1 /* $Id: ports.h,v 1.7 2005/10/15 18:05:03 titer Exp $
2
3    This file is part of the HandBrake source code.
4    Homepage: <http://handbrake.fr/>.
5    It may be used under the terms of the GNU General Public License. */
6
7 #ifndef HB_PORTS_H
8 #define HB_PORTS_H
9
10 /************************************************************************
11  * Utils
12  ***********************************************************************/
13 uint64_t hb_get_date();
14 void     hb_snooze( int delay );
15 int      hb_get_cpu_count();
16
17 #ifdef __LIBHB__
18
19 /* Everything from now is only used internally and hidden to the UI */
20
21 /************************************************************************
22  * DVD utils
23  ***********************************************************************/
24 int hb_dvd_region(char *device, int *region_mask);
25
26 /************************************************************************
27  * Files utils
28  ***********************************************************************/
29 void hb_get_tempory_directory( hb_handle_t * h, char path[512] );
30 void hb_get_tempory_filename( hb_handle_t *, char name[1024],
31                               char * fmt, ... );
32 void hb_mkdir( char * name );
33
34 /************************************************************************
35  * Threads
36  ***********************************************************************/
37 typedef struct hb_thread_s hb_thread_t;
38
39 #if defined( SYS_BEOS )
40 #  define HB_LOW_PRIORITY    5
41 #  define HB_NORMAL_PRIORITY 10
42 #elif defined( SYS_DARWIN )
43 #  define HB_LOW_PRIORITY    0
44 #  define HB_NORMAL_PRIORITY 31
45 #elif defined( SYS_LINUX ) || defined( SYS_FREEBSD ) || defined ( SYS_SunOS )
46 #  define HB_LOW_PRIORITY    0
47 #  define HB_NORMAL_PRIORITY 0
48 #elif defined( SYS_CYGWIN )
49 #  define HB_LOW_PRIORITY    0
50 #  define HB_NORMAL_PRIORITY 1
51 #elif defined( SYS_MINGW )
52 #  define HB_LOW_PRIORITY    0
53 #  define HB_NORMAL_PRIORITY 0
54 #endif
55
56 hb_thread_t * hb_thread_init( char * name, void (* function)(void *),
57                               void * arg, int priority );
58 void          hb_thread_close( hb_thread_t ** );
59 int           hb_thread_has_exited( hb_thread_t * );
60
61 /************************************************************************
62  * Mutexes
63  ***********************************************************************/
64
65 hb_lock_t * hb_lock_init();
66 void        hb_lock_close( hb_lock_t ** );
67 void        hb_lock( hb_lock_t * );
68 void        hb_unlock( hb_lock_t * );
69
70 /************************************************************************
71  * Condition variables
72  ***********************************************************************/
73 typedef struct hb_cond_s hb_cond_t;
74
75 hb_cond_t * hb_cond_init();
76 void        hb_cond_wait( hb_cond_t *, hb_lock_t * );
77 void        hb_cond_signal( hb_cond_t * );
78 void        hb_cond_close( hb_cond_t ** );
79
80 /************************************************************************
81  * Network
82  ***********************************************************************/
83 typedef struct hb_net_s hb_net_t;
84
85 hb_net_t * hb_net_open( char * address, int port );
86 int        hb_net_send( hb_net_t *, char * );
87 int        hb_net_recv( hb_net_t *, char *, int );
88 void       hb_net_close( hb_net_t ** );
89
90 #endif /* __LIBHB__ */
91
92 #endif
93