/*****************************************************************************
* dmo.c : DirectMedia Object decoder module for vlc
*****************************************************************************
- * Copyright (C) 2002, 2003 the VideoLAN team
+ * Copyright (C) 2002, 2003 VLC authors and VideoLAN
* $Id$
*
* Author: 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
- * the Free Software Foundation; either version 2 of the License, or
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 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.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser 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.
+ * You should have received a copy of the GNU Lesser 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.
*****************************************************************************/
/*****************************************************************************
#include <vlc_codec.h>
#include <vlc_codecs.h>
-#ifndef WIN32
-# define LOADER
-#else
+#ifdef _WIN32
# include <objbase.h>
# include <vlc_charset.h>
#endif
-#ifdef LOADER
-/* Need the w32dll loader from mplayer */
-# include <wine/winerror.h>
-# include <ldt_keeper.h>
-# include <wine/windef.h>
-#endif
-
#include <vlc_codecs.h>
#include "dmo.h"
# define DMO_DEBUG 1
#endif
-#ifdef LOADER
-/* Not Needed */
-long CoInitialize( void *pvReserved ) { VLC_UNUSED(pvReserved); return -1; }
-void CoUninitialize( void ) { }
-
-/* A few prototypes */
-HMODULE WINAPI LoadLibraryA(LPCSTR);
-#define LoadLibrary LoadLibraryA
-FARPROC WINAPI GetProcAddress(HMODULE,LPCSTR);
-int WINAPI FreeLibrary(HMODULE);
-#endif /* LOADER */
-
typedef long (STDCALL *GETCLASS) ( const GUID*, const GUID*, void** );
static const int pi_channels_maps[7] =
date_t end_date;
-#ifdef LOADER
- ldt_fs_t *ldt_fs;
-#endif
-
vlc_thread_t thread;
vlc_mutex_t lock;
vlc_cond_t wait_input, wait_output;
VIDEOINFOHEADER *p_vih = NULL;
WAVEFORMATEX *p_wf = NULL;
-#ifdef LOADER
- ldt_fs_t *ldt_fs = Setup_LDT_Keeper();
-#else
/* Initialize OLE/COM */
- CoInitialize( 0 );
-#endif /* LOADER */
+ CoInitializeEx( NULL, COINIT_APARTMENTTHREADED );
if( LoadDMO( VLC_OBJECT(p_dec), &hmsdmo_dll, &p_dmo, &p_dec->fmt_in, false )
!= VLC_SUCCESS )
/* Allocate the memory needed to store the decoder's structure */
p_sys->hmsdmo_dll = hmsdmo_dll;
p_sys->p_dmo = p_dmo;
-#ifdef LOADER
- p_sys->ldt_fs = ldt_fs;
-#endif
/* Find out some properties of the output */
{
if( p_dmo ) p_dmo->vt->Release( (IUnknown *)p_dmo );
if( hmsdmo_dll ) FreeLibrary( hmsdmo_dll );
-#ifdef LOADER
- Restore_LDT_Keeper( ldt_fs );
-#else
/* Uninitialize OLE/COM */
CoUninitialize();
-#endif /* LOADER */
free( p_vih );
free( p_wf );
DMO_PARTIAL_MEDIATYPE dmo_partial_type;
int i_err;
-#ifndef LOADER
long (STDCALL *OurDMOEnum)( const GUID *, uint32_t, uint32_t,
const DMO_PARTIAL_MEDIATYPE *,
uint32_t, const DMO_PARTIAL_MEDIATYPE *,
WCHAR *psz_dmo_name;
GUID clsid_dmo;
uint32_t i_dummy;
-#endif
GETCLASS GetClass;
IClassFactory *cFactory = NULL;
dmo_partial_type.subtype.Data1 = p_fmt->i_original_fourcc ?: p_fmt->i_codec;
}
-#ifndef LOADER
/* Load msdmo DLL */
- *p_hmsdmo_dll = LoadLibrary( "msdmo.dll" );
+ *p_hmsdmo_dll = LoadLibraryA( "msdmo.dll" );
if( *p_hmsdmo_dll == NULL )
{
msg_Dbg( p_this, "failed loading msdmo.dll" );
return VLC_SUCCESS;
loader:
-#endif /* LOADER */
for( i_codec = 0; codecs_table[i_codec].i_fourcc != 0; i_codec++ )
{
if( codecs_table[i_codec].i_fourcc == 0 )
return VLC_EGENERIC; /* Can't happen */
- *p_hmsdmo_dll = LoadLibrary( codecs_table[i_codec].psz_dll );
+ *p_hmsdmo_dll = LoadLibraryA( codecs_table[i_codec].psz_dll );
if( *p_hmsdmo_dll == NULL )
{
msg_Dbg( p_this, "failed loading '%s'",
if( p_sys->p_dmo ) p_sys->p_dmo->vt->Release( (IUnknown *)p_sys->p_dmo );
FreeLibrary( p_sys->hmsdmo_dll );
-#ifdef LOADER
-#if 0
- Restore_LDT_Keeper( p_sys->ldt_fs );
-#endif
-#else
- /* Uninitialize OLE/COM */
CoUninitialize();
-#endif
free( p_sys->p_buffer );
}
date_t end_date;
-#ifdef LOADER
- ldt_fs_t *ldt_fs;
-#endif
};
/*****************************************************************************
IMediaObject *p_dmo = NULL;
HINSTANCE hmsdmo_dll = NULL;
-#ifdef LOADER
- ldt_fs_t *ldt_fs = Setup_LDT_Keeper();
-#else
/* Initialize OLE/COM */
- CoInitialize( 0 );
-#endif /* LOADER */
+ CoInitializeEx( NULL, COINIT_APARTMENTTHREADED );
if( LoadDMO( p_this, &hmsdmo_dll, &p_dmo, &p_enc->fmt_out, true )
!= VLC_SUCCESS )
p_sys->hmsdmo_dll = hmsdmo_dll;
p_sys->p_dmo = p_dmo;
-#ifdef LOADER
- p_sys->ldt_fs = ldt_fs;
-#endif
/* Find out some properties of the inputput */
{
if( p_dmo ) p_dmo->vt->Release( (IUnknown *)p_dmo );
if( hmsdmo_dll ) FreeLibrary( hmsdmo_dll );
-#ifdef LOADER
- Restore_LDT_Keeper( ldt_fs );
-#else
/* Uninitialize OLE/COM */
CoUninitialize();
-#endif /* LOADER */
free( p_sys );
p_enc->fmt_in.video.i_height *
p_enc->fmt_in.video.i_bits_per_pixel / 8;
- p_block_in = block_New( p_enc, i_buffer );
+ p_block_in = block_Alloc( i_buffer );
/* Copy picture stride by stride */
p_dst = p_block_in->p_buffer;
else
{
block_t *p_aout_buffer = (block_t *)p_data;
- p_block_in = block_New( p_enc, p_aout_buffer->i_buffer );
+ p_block_in = block_Alloc( p_aout_buffer->i_buffer );
memcpy( p_block_in->p_buffer, p_aout_buffer->p_buffer,
p_block_in->i_buffer );
block_t *p_block_out;
CMediaBuffer *p_out;
- p_block_out = block_New( p_enc, p_sys->i_min_output );
+ p_block_out = block_Alloc( p_sys->i_min_output );
p_block_out->i_buffer = 0;
p_out = CMediaBufferCreate(p_block_out, p_sys->i_min_output, false);
memset( &db, 0, sizeof(db) );
if( p_sys->p_dmo ) p_sys->p_dmo->vt->Release( (IUnknown *)p_sys->p_dmo );
FreeLibrary( p_sys->hmsdmo_dll );
-#ifdef LOADER
-#if 0
- Restore_LDT_Keeper( p_sys->ldt_fs );
-#endif
-#else
/* Uninitialize OLE/COM */
CoUninitialize();
-#endif
free( p_sys );
}