[vlc-devel] [PATCH 22/41] Implement OS/2 specific initialization
KO Myung-Hun
komh78 at gmail.com
Tue Oct 11 13:18:08 CEST 2011
Rémi Denis-Courmont wrote:
> Le lundi 10 octobre 2011 14:44:01 KO Myung-Hun, vous avez écrit :
>> ---
>> src/Makefile.am | 2 +-
>> src/os2/specific.c | 83
>> ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 84
>> insertions(+), 1 deletions(-)
>> create mode 100644 src/os2/specific.c
>>
>> diff --git a/src/Makefile.am b/src/Makefile.am
>> index 9cfa200..6f775ed 100644
>> --- a/src/Makefile.am
>> +++ b/src/Makefile.am
>> @@ -281,7 +281,7 @@ SOURCES_libvlc_os2 = \
>> misc/atomic.c \
>> posix/filesystem.c \
>> os2/thread.c \
>> - posix/specific.c \
>> + os2/specific.c \
>> $(NULL)
>>
>> SOURCES_libvlc_other = \
>> diff --git a/src/os2/specific.c b/src/os2/specific.c
>> new file mode 100644
>> index 0000000..0cb01a7
>> --- /dev/null
>> +++ b/src/os2/specific.c
>> @@ -0,0 +1,83 @@
>> +/*************************************************************************
>> **** + * specific.c: OS/2 specific features
>> +
>> **************************************************************************
>> *** + * Copyright (C) 2010 KO Myung-Hun
>> + *
>> + * 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
>> + * the Free Software Foundation; either version 2 of the License, or
>> + * (at your option) any later version.
>> + *
>> + * This program is distributed in the hope that it will be useful,
>> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
>> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
>> + * GNU General Public License for more details.
>> + *
>> + * You should have received a copy of the GNU General Public License
>> + * along with this program; if not, write to the Free Software
>> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA
>> 02110-1301, USA. +
>> **************************************************************************
>> ***/ +
>> +#ifdef HAVE_CONFIG_H
>> +# include "config.h"
>> +#endif
>> +
>> +#include <vlc_common.h>
>> +#include "../libvlc.h"
>> +
>> +#include <fcntl.h>
>> +#include <io.h>
>> +
>> +extern int _fmode_bin;
>> +
>> +void system_Init( void )
>> +{
>> + PPIB ppib;
>> + CHAR psz_path[ CCHMAXPATH ];
>> + PSZ psz_dirsep;
>> +
>> + DosGetInfoBlocks( NULL, &ppib );
>> +
>> + DosQueryModuleName( ppib->pib_hmte, sizeof( psz_path ), psz_path );
>> +
>> + /* remove the executable name */
>> + psz_dirsep = strrchr( psz_path, '\\');
>> + if( psz_dirsep )
>> + *psz_dirsep = '\0';
>> +
>> + /* remove the last directory, i.e, \\bin */
>> + psz_dirsep = strrchr( psz_path, '\\' );
>> + if( psz_dirsep )
>> + *psz_dirsep = '\0';
>> +
>> + asprintf( &psz_vlcpath, "%s\\lib\\vlc", psz_path );
>
> This works for VLC. I don't mind but this may be a problem with LibVLC, as
> system_Init() may be entered multiple tines.
>
I don't understand why this may be a problem when being entered multiple
times.
And LibVLC call system_Init() many times without system_End() ?
>> +
>> + /* Set the default file-translation mode */
>> + _fmode_bin = 1;
>> + setmode( fileno( stdin ), O_BINARY ); /* Needed for pipes */
>> +
>> + /* Call mdate() once to make sure it is initialized properly */
>> + mdate();
>
> This should not be needed as far as I understand your implementation of
> mdate().
>
Ok.
>> +}
>> +
>> +void system_Configure( libvlc_int_t *p_this, int i_argc, const char *const
>> ppsz_argv[] ) +{
>> + VLC_UNUSED( i_argc ); VLC_UNUSED( ppsz_argv );
>> + if( var_InheritBool( p_this, "high-priority" ) )
>> + {
>> + if( !DosSetPriority( PRTYS_PROCESS, PRTYC_REGULAR, PRTYD_MAXIMUM,
>> 0 ) ) + {
>> + msg_Dbg( p_this, "raised process priority" );
>> + }
>> + else
>> + {
>> + msg_Dbg( p_this, "could not raise process priority" );
>> + }
>> + }
>> +}
>> +
>> +void system_End( void )
>> +{
>> + free( psz_vlcpath );
>> + psz_vlcpath = NULL;
>> +}
>
>
--
KO Myung-Hun
Using Mozilla SeaMonkey 2.0.14
Under OS/2 Warp 4 for Korean with FixPak #15
On AMD ThunderBird 1GHz with 512 MB RAM
Korean OS/2 User Community : http://www.ecomstation.co.kr
More information about the vlc-devel
mailing list