Changeset 2dad070c9fadba304775b44b6e41edbf67c16784
- Timestamp:
- 06/01/02 16:31:32
(6 years ago)
- Author:
- Sam Hocevar <sam@videolan.org>
- git-committer:
- Sam Hocevar <sam@videolan.org> 1022941892 +0000
- git-parent:
[23379347d1a9b87795f717c9ffaee06d0b42e938]
- git-author:
- Sam Hocevar <sam@videolan.org> 1022941892 +0000
- Message:
- ./src/misc/beos_specific.cpp: BeOS fixes, removed a static variable.
- ./include/main.h: replaced p_sys with explicit variables because it's
really much simpler this way. Gildas, will you ever forgive me ? :-)
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r9e3ab28 |
r2dad070 |
|
| 4 | 4 | ***************************************************************************** |
|---|
| 5 | 5 | * Copyright (C) 1999, 2000, 2001, 2002 VideoLAN |
|---|
| 6 | | * $Id: main.h,v 1.36 2002/06/01 12:31:57 sam Exp $ |
|---|
| | 6 | * $Id: main.h,v 1.37 2002/06/01 14:31:32 sam Exp $ |
|---|
| 7 | 7 | * |
|---|
| 8 | 8 | * Authors: Vincent Seguin <seguin@via.ecp.fr> |
|---|
| … | … | |
| 79 | 79 | |
|---|
| 80 | 80 | /* Private data */ |
|---|
| 81 | | main_sys_t* p_sys; /* for system specific properties */ |
|---|
| | 81 | #if defined( SYS_BEOS ) |
|---|
| | 82 | vlc_object_t p_appthread; |
|---|
| | 83 | #elif defined( WIN32 ) |
|---|
| | 84 | SIGNALOBJECTANDWAIT SignalObjectAndWait; |
|---|
| | 85 | vlc_bool_t b_fast_pthread; |
|---|
| | 86 | #endif |
|---|
| 82 | 87 | }; |
|---|
| 83 | 88 | |
|---|
| r9e3ab28 |
r2dad070 |
|
| 4 | 4 | ***************************************************************************** |
|---|
| 5 | 5 | * Copyright (C) 1998, 1999, 2000 VideoLAN |
|---|
| 6 | | * $Id: vlc_common.h,v 1.1 2002/06/01 12:31:58 sam Exp $ |
|---|
| | 6 | * $Id: vlc_common.h,v 1.2 2002/06/01 14:31:32 sam Exp $ |
|---|
| 7 | 7 | * |
|---|
| 8 | 8 | * Authors: Samuel Hocevar <sam@via.ecp.fr> |
|---|
| … | … | |
| 114 | 114 | *****************************************************************************/ |
|---|
| 115 | 115 | |
|---|
| 116 | | /* System */ |
|---|
| 117 | | VLC_DECLARE_STRUCT(main_sys) |
|---|
| 118 | | |
|---|
| 119 | 116 | /* Messages */ |
|---|
| 120 | 117 | VLC_DECLARE_STRUCT(msg_bank) |
|---|
| … | … | |
| 187 | 184 | * OS-specific headers and thread types |
|---|
| 188 | 185 | *****************************************************************************/ |
|---|
| 189 | | #include "os_specific.h" |
|---|
| | 186 | #if defined( WIN32 ) |
|---|
| | 187 | # define WIN32_LEAN_AND_MEAN |
|---|
| | 188 | # include <windows.h> |
|---|
| | 189 | typedef BOOL (WINAPI *SIGNALOBJECTANDWAIT)( HANDLE, HANDLE, DWORD, BOOL ); |
|---|
| | 190 | #endif |
|---|
| | 191 | |
|---|
| 190 | 192 | #include "vlc_threads.h" |
|---|
| 191 | 193 | |
|---|
| r9e3ab28 |
r2dad070 |
|
| 3 | 3 | ***************************************************************************** |
|---|
| 4 | 4 | * Copyright (C) 2001 VideoLAN |
|---|
| 5 | | * $Id: win32_specific.h,v 1.3 2002/06/01 12:31:58 sam Exp $ |
|---|
| | 5 | * $Id: win32_specific.h,v 1.4 2002/06/01 14:31:32 sam Exp $ |
|---|
| 6 | 6 | * |
|---|
| 7 | 7 | * Authors: Samuel Hocevar <sam@zoy.org> |
|---|
| … | … | |
| 23 | 23 | *****************************************************************************/ |
|---|
| 24 | 24 | |
|---|
| 25 | | #define WIN32_LEAN_AND_MEAN |
|---|
| 26 | | #include <windows.h> |
|---|
| 27 | | |
|---|
| 28 | | typedef BOOL (WINAPI *SIGNALOBJECTANDWAIT)( HANDLE, HANDLE, DWORD, BOOL ); |
|---|
| 29 | | |
|---|
| 30 | | /***************************************************************************** |
|---|
| 31 | | * main_sys_t: system specific descriptor |
|---|
| 32 | | ***************************************************************************** |
|---|
| 33 | | * This structure is a system specific descriptor. It describes the Win32 |
|---|
| 34 | | * properties of the program. |
|---|
| 35 | | *****************************************************************************/ |
|---|
| 36 | | struct main_sys_s |
|---|
| 37 | | { |
|---|
| 38 | | SIGNALOBJECTANDWAIT SignalObjectAndWait; |
|---|
| 39 | | vlc_bool_t b_fast_pthread; |
|---|
| 40 | | }; |
|---|
| 41 | | |
|---|
| r9e3ab28 |
r2dad070 |
|
| 5 | 5 | ***************************************************************************** |
|---|
| 6 | 6 | * Copyright (C) 1998-2001 VideoLAN |
|---|
| 7 | | * $Id: libvlc.c,v 1.1 2002/06/01 12:32:01 sam Exp $ |
|---|
| | 7 | * $Id: libvlc.c,v 1.2 2002/06/01 14:31:32 sam Exp $ |
|---|
| 8 | 8 | * |
|---|
| 9 | 9 | * Authors: Vincent Seguin <seguin@via.ecp.fr> |
|---|
| … | … | |
| 66 | 66 | |
|---|
| 67 | 67 | #include "vlc_cpu.h" /* CPU detection */ |
|---|
| | 68 | #include "os_specific.h" |
|---|
| 68 | 69 | |
|---|
| 69 | 70 | #include "netutils.h" /* network_ChannelJoin */ |
|---|
| r2337934 |
r2dad070 |
|
| 3 | 3 | ***************************************************************************** |
|---|
| 4 | 4 | * Copyright (C) 1999-2001 VideoLAN |
|---|
| 5 | | * $Id: beos_specific.cpp,v 1.20 2002/06/01 13:52:24 sam Exp $ |
|---|
| | 5 | * $Id: beos_specific.cpp,v 1.21 2002/06/01 14:31:32 sam Exp $ |
|---|
| 6 | 6 | * |
|---|
| 7 | 7 | * Authors: Jean-Marc Dressler <polux@via.ecp.fr> |
|---|
| … | … | |
| 40 | 40 | { |
|---|
| 41 | 41 | public: |
|---|
| 42 | | vlc_object_t *p_object; |
|---|
| | 42 | vlc_object_t *p_this; |
|---|
| 43 | 43 | |
|---|
| 44 | 44 | VlcApplication(char* ); |
|---|
| … | … | |
| 53 | 53 | *****************************************************************************/ |
|---|
| 54 | 54 | static char * psz_program_path; |
|---|
| 55 | | static vlc_object_t * p_appthread; |
|---|
| 56 | 55 | |
|---|
| 57 | 56 | extern "C" |
|---|
| … | … | |
| 68 | 67 | void system_Init( vlc_object_t *p_this, int *pi_argc, char *ppsz_argv[] ) |
|---|
| 69 | 68 | { |
|---|
| 70 | | p_appthread = vlc_object_create( p_this, sizeof(vlc_object_t) ); |
|---|
| | 69 | p_this->p_vlc->p_appthread = |
|---|
| | 70 | (vlc_object_t *)vlc_object_create( p_this, sizeof(vlc_object_t) ); |
|---|
| 71 | 71 | |
|---|
| 72 | 72 | /* Create the BApplication thread and wait for initialization */ |
|---|
| 73 | | vlc_thread_create( p_appthread, "app thread", AppThread, 1 ); |
|---|
| 74 | | |
|---|
| 75 | | vlc_object_attach( p_appthread, p_this->p_vlc ); |
|---|
| | 73 | vlc_thread_create( p_this->p_vlc->p_appthread, "app thread", AppThread, 1 ); |
|---|
| 76 | 74 | } |
|---|
| 77 | 75 | |
|---|
| … | … | |
| 89 | 87 | void system_End( vlc_object_t *p_this ) |
|---|
| 90 | 88 | { |
|---|
| 91 | | vlc_object_unlink_all( p_appthread ); |
|---|
| 92 | | |
|---|
| 93 | 89 | /* Tell the BApplication to die */ |
|---|
| 94 | 90 | be_app->PostMessage( B_QUIT_REQUESTED ); |
|---|
| 95 | | vlc_thread_join( p_appthread ); |
|---|
| 96 | 91 | |
|---|
| 97 | | vlc_object_destroy( p_appthread ); |
|---|
| | 92 | vlc_thread_join( p_this->p_vlc->p_appthread ); |
|---|
| | 93 | vlc_object_destroy( p_this->p_vlc->p_appthread ); |
|---|
| 98 | 94 | |
|---|
| 99 | 95 | free( psz_program_path ); |
|---|
| … | … | |
| 111 | 107 | |
|---|
| 112 | 108 | /***************************************************************************** |
|---|
| 113 | | * system_AppThread: the BApplication thread. |
|---|
| | 109 | * AppThread: the BApplication thread. |
|---|
| 114 | 110 | *****************************************************************************/ |
|---|
| 115 | | static void system_AppThread( void * args ) |
|---|
| | 111 | static void AppThread( vlc_object_t * p_this ) |
|---|
| 116 | 112 | { |
|---|
| 117 | 113 | VlcApplication *BeApp = new VlcApplication("application/x-vnd.Ink-vlc"); |
|---|
| | 114 | vlc_object_attach( p_this, p_this->p_vlc ); |
|---|
| | 115 | BeApp->p_this = p_this; |
|---|
| 118 | 116 | BeApp->Run(); |
|---|
| | 117 | vlc_object_unlink_all( p_this ); |
|---|
| 119 | 118 | delete BeApp; |
|---|
| 120 | 119 | } |
|---|
| … | … | |
| 167 | 166 | |
|---|
| 168 | 167 | /* Tell the main thread we are finished initializing the BApplication */ |
|---|
| 169 | | vlc_thread_ready( p_appthread ); |
|---|
| | 168 | vlc_thread_ready( p_this ); |
|---|
| 170 | 169 | } |
|---|
| 171 | 170 | |
|---|
| r9e3ab28 |
r2dad070 |
|
| 3 | 3 | ***************************************************************************** |
|---|
| 4 | 4 | * Copyright (C) 1999, 2000, 2001, 2002 VideoLAN |
|---|
| 5 | | * $Id: threads.c,v 1.1 2002/06/01 12:32:01 sam Exp $ |
|---|
| | 5 | * $Id: threads.c,v 1.2 2002/06/01 14:31:32 sam Exp $ |
|---|
| 6 | 6 | * |
|---|
| 7 | 7 | * Authors: Jean-Marc Dressler <polux@via.ecp.fr> |
|---|
| … | … | |
| 174 | 174 | * As this function is not available on Win9x, we can use the faster |
|---|
| 175 | 175 | * CriticalSections */ |
|---|
| 176 | | if( (GetVersion() < 0x80000000) && !p_this->p_vlc->p_sys->b_fast_pthread ) |
|---|
| | 176 | if( (GetVersion() < 0x80000000) && !p_this->p_vlc->b_fast_pthread ) |
|---|
| 177 | 177 | { |
|---|
| 178 | 178 | /* We are running on NT/2K/XP, we can use SignalObjectAndWait */ |
|---|
| 179 | 179 | p_mutex->mutex = CreateMutex( 0, FALSE, 0 ); |
|---|
| 180 | | p_mutex->SignalObjectAndWait = |
|---|
| 181 | | p_this->p_vlc->p_sys->SignalObjectAndWait; |
|---|
| | 180 | p_mutex->SignalObjectAndWait = p_this->p_vlc->SignalObjectAndWait; |
|---|
| 182 | 181 | return ( p_mutex->mutex ? 0 : 1 ); |
|---|
| 183 | 182 | } |
|---|
| r9e3ab28 |
r2dad070 |
|
| 3 | 3 | ***************************************************************************** |
|---|
| 4 | 4 | * Copyright (C) 2001 VideoLAN |
|---|
| 5 | | * $Id: win32_specific.c,v 1.8 2002/06/01 12:32:02 sam Exp $ |
|---|
| | 5 | * $Id: win32_specific.c,v 1.9 2002/06/01 14:31:32 sam Exp $ |
|---|
| 6 | 6 | * |
|---|
| 7 | 7 | * Authors: Samuel Hocevar <sam@zoy.org> |
|---|
| … | … | |
| 40 | 40 | HINSTANCE hInstLib; |
|---|
| 41 | 41 | |
|---|
| 42 | | /* Allocate structure */ |
|---|
| 43 | | p_this->p_vlc->p_sys = malloc( sizeof( main_sys_t ) ); |
|---|
| 44 | | if( p_this->p_vlc->p_sys == NULL ) |
|---|
| 45 | | { |
|---|
| 46 | | fprintf( stderr, "error: out of memory\n" ); |
|---|
| 47 | | exit(-1); |
|---|
| 48 | | } |
|---|
| 49 | | |
|---|
| 50 | 42 | /* dynamically get the address of SignalObjectAndWait */ |
|---|
| 51 | 43 | hInstLib = LoadLibrary( "kernel32" ); |
|---|
| 52 | | p_this->p_vlc->p_sys->SignalObjectAndWait = |
|---|
| | 44 | p_this->p_vlc->SignalObjectAndWait = |
|---|
| 53 | 45 | (SIGNALOBJECTANDWAIT)GetProcAddress( hInstLib, "SignalObjectAndWait" ); |
|---|
| 54 | 46 | |
|---|
| … | … | |
| 69 | 61 | void system_Configure( vlc_object_t *p_this ) |
|---|
| 70 | 62 | { |
|---|
| 71 | | p_this->p_vlc->p_sys->b_fast_pthread = config_GetInt( p_this, |
|---|
| 72 | | "fast_pthread" ); |
|---|
| | 63 | p_this->p_vlc->b_fast_pthread = config_GetInt( p_this, "fast_pthread" ); |
|---|
| 73 | 64 | } |
|---|
| 74 | 65 | |
|---|