Exemplo n.º 1
0
void ExitPlatform ()
{
	/* if we have changed the current directory, we must restore the original */
	RestoreOriginalDirectory ();

	CloseLib (ElfBase, (struct Interface *) IElf);
	CloseLib (DOSBase, (struct Interface *) IDOS);
}
Exemplo n.º 2
0
VOID
FreeExit( LONG rc )
{
    if( Menus )
    {
        if( WindowPtr )
        {
            ClearMenuStrip( WindowPtr );
        }

        FreeMenus( Menus );
    }

    CloseGUI();

    if( Screen )
    {
        FreeScreenDrawInfo( Screen, DrawInfo );
        UnlockPubScreen (NULL, Screen );
    }

    if( GadToolsBase )
    {
        FreeVisualInfo( VisualInfo );
    }

    if( FileReq )
    {
        rtFreeRequest( FileReq );
    }

    if( DiskObject )
    {
        FreeDiskObject( DiskObject );
    }

    FreeArgs( RDArgs );
    FreeLocale();

    CloseLib( GadToolsBase );
    CloseLib( IconBase );
    CloseLib( IntuitionBase );
    CloseLib( ReqToolsBase );
    CloseLib( UtilityBase );

    CloseLibrary( ( struct Library * ) GfxBase );
    __exit( rc );
}
Exemplo n.º 3
0
void alc_pulse_deinit(void) //{{{
{
    ALuint i;

    for(i = 0;i < numDevNames;++i)
    {
        free(allDevNameMap[i].name);
        free(allDevNameMap[i].device_name);
    }
    free(allDevNameMap);
    allDevNameMap = NULL;
    numDevNames = 0;

    for(i = 0;i < numCaptureDevNames;++i)
    {
        free(allCaptureDevNameMap[i].name);
        free(allCaptureDevNameMap[i].device_name);
    }
    free(allCaptureDevNameMap);
    allCaptureDevNameMap = NULL;
    numCaptureDevNames = 0;

#ifdef HAVE_DYNLOAD
    if(pa_handle)
        CloseLib(pa_handle);
    pa_handle = NULL;
#endif
} //}}}
Exemplo n.º 4
0
static ALCboolean alsa_load(void)
{
    ALCboolean error = ALC_FALSE;

#ifdef HAVE_DYNLOAD
    if(!alsa_handle)
    {
        alsa_handle = LoadLib("libasound.so.2");
        if(!alsa_handle)
            return ALC_FALSE;

        error = ALC_FALSE;
#define LOAD_FUNC(f) do {                                                     \
    p##f = GetSymbol(alsa_handle, #f);                                        \
    if(p##f == NULL) {                                                        \
        error = ALC_TRUE;                                                     \
    }                                                                         \
} while(0)
        ALSA_FUNCS(LOAD_FUNC);
#undef LOAD_FUNC

        if(error)
        {
            CloseLib(alsa_handle);
            alsa_handle = NULL;
            return ALC_FALSE;
        }
    }
#endif

    return !error;
}
Exemplo n.º 5
0
Arquivo: alsa.c Projeto: 9heart/DT3
void alc_alsa_deinit(void)
{
    ALuint i;

    for(i = 0;i < numDevNames;++i)
    {
        free(allDevNameMap[i].name);
        free(allDevNameMap[i].card);
    }
    free(allDevNameMap);
    allDevNameMap = NULL;
    numDevNames = 0;

    for(i = 0;i < numCaptureDevNames;++i)
    {
        free(allCaptureDevNameMap[i].name);
        free(allCaptureDevNameMap[i].card);
    }
    free(allCaptureDevNameMap);
    allCaptureDevNameMap = NULL;
    numCaptureDevNames = 0;

#ifdef HAVE_DYNLOAD
    if(alsa_handle)
        CloseLib(alsa_handle);
    alsa_handle = NULL;
#endif
}
Exemplo n.º 6
0
bool PortBackendFactory::init()
{
    PaError err;

#ifdef HAVE_DYNLOAD
    if(!pa_handle)
    {
#ifdef _WIN32
# define PALIB "portaudio.dll"
#elif defined(__APPLE__) && defined(__MACH__)
# define PALIB "libportaudio.2.dylib"
#elif defined(__OpenBSD__)
# define PALIB "libportaudio.so"
#else
# define PALIB "libportaudio.so.2"
#endif

        pa_handle = LoadLib(PALIB);
        if(!pa_handle)
            return false;

#define LOAD_FUNC(f) do {                                                     \
    p##f = reinterpret_cast<decltype(p##f)>(GetSymbol(pa_handle, #f));        \
    if(p##f == nullptr)                                                       \
    {                                                                         \
        CloseLib(pa_handle);                                                  \
        pa_handle = nullptr;                                                  \
        return false;                                                         \
    }                                                                         \
} while(0)
        LOAD_FUNC(Pa_Initialize);
        LOAD_FUNC(Pa_Terminate);
        LOAD_FUNC(Pa_GetErrorText);
        LOAD_FUNC(Pa_StartStream);
        LOAD_FUNC(Pa_StopStream);
        LOAD_FUNC(Pa_OpenStream);
        LOAD_FUNC(Pa_CloseStream);
        LOAD_FUNC(Pa_GetDefaultOutputDevice);
        LOAD_FUNC(Pa_GetDefaultInputDevice);
        LOAD_FUNC(Pa_GetStreamInfo);
#undef LOAD_FUNC

        if((err=Pa_Initialize()) != paNoError)
        {
            ERR("Pa_Initialize() returned an error: %s\n", Pa_GetErrorText(err));
            CloseLib(pa_handle);
            pa_handle = nullptr;
            return false;
        }
    }
#else
    if((err=Pa_Initialize()) != paNoError)
    {
        ERR("Pa_Initialize() returned an error: %s\n", Pa_GetErrorText(err));
        return false;
    }
#endif
    return true;
}
Exemplo n.º 7
0
static ALCboolean pa_load(void)
{
    PaError err;

#ifdef HAVE_DYNLOAD
    if(!pa_handle)
    {
#ifdef _WIN32
# define PALIB "portaudio.dll"
#elif defined(__APPLE__) && defined(__MACH__)
# define PALIB "libportaudio.2.dylib"
#elif defined(__OpenBSD__)
# define PALIB "libportaudio.so"
#else
# define PALIB "libportaudio.so.2"
#endif

        pa_handle = LoadLib(PALIB);
        if(!pa_handle)
            return ALC_FALSE;

#define LOAD_FUNC(f) do {                                                     \
    p##f = GetSymbol(pa_handle, #f);                                          \
    if(p##f == NULL)                                                          \
    {                                                                         \
        CloseLib(pa_handle);                                                  \
        pa_handle = NULL;                                                     \
        return ALC_FALSE;                                                     \
    }                                                                         \
} while(0)
        LOAD_FUNC(Pa_Initialize);
        LOAD_FUNC(Pa_Terminate);
        LOAD_FUNC(Pa_GetErrorText);
        LOAD_FUNC(Pa_StartStream);
        LOAD_FUNC(Pa_StopStream);
        LOAD_FUNC(Pa_OpenStream);
        LOAD_FUNC(Pa_CloseStream);
        LOAD_FUNC(Pa_GetDefaultOutputDevice);
        LOAD_FUNC(Pa_GetDefaultInputDevice);
        LOAD_FUNC(Pa_GetStreamInfo);
#undef LOAD_FUNC

        if((err=Pa_Initialize()) != paNoError)
        {
            ERR("Pa_Initialize() returned an error: %s\n", Pa_GetErrorText(err));
            CloseLib(pa_handle);
            pa_handle = NULL;
            return ALC_FALSE;
        }
    }
#else
    if((err=Pa_Initialize()) != paNoError)
    {
        ERR("Pa_Initialize() returned an error: %s\n", Pa_GetErrorText(err));
        return ALC_FALSE;
    }
#endif
    return ALC_TRUE;
}
Exemplo n.º 8
0
void alc_pa_deinit(void)
{
    if(pa_handle)
    {
        Pa_Terminate();
#ifdef HAVE_DYNLOAD
        CloseLib(pa_handle);
#endif
        pa_handle = NULL;
    }
}
Exemplo n.º 9
0
void alc_pa_deinit(void)
{
#ifdef HAVE_DYNLOAD
    if(pa_handle)
    {
        Pa_Terminate();
        CloseLib(pa_handle);
        pa_handle = NULL;
    }
#else
    Pa_Terminate();
#endif
}
Exemplo n.º 10
0
bool InitPlatform ()
{
	if (OpenLib (&DOSBase, "dos.library", 52L, (struct Interface **) &IDOS, "main", 1))
		{
			if (OpenLib (&ElfBase, "elf.library", 52L, (struct Interface **) &IElf, "main", 1))
				{
					return true;
				}

			CloseLib (DOSBase, (struct Interface *) IDOS);
		}

	return false;
}
Exemplo n.º 11
0
void alcDSoundDeinit(void)
{
    ALuint i;

    for(i = 0;i < NumPlaybackDevices;++i)
        free(PlaybackDeviceList[i].name);
    free(PlaybackDeviceList);
    PlaybackDeviceList = NULL;
    NumPlaybackDevices = 0;

    for(i = 0;i < NumCaptureDevices;++i)
        free(CaptureDeviceList[i].name);
    free(CaptureDeviceList);
    CaptureDeviceList = NULL;
    NumCaptureDevices = 0;

    if(ds_handle)
        CloseLib(ds_handle);
    ds_handle = NULL;
}
Exemplo n.º 12
0
__arch int elfclose(Elf32_Exec* ex)
{
  if(!ex) return E_EMPTY;

  if(ex->complete)
    run_FINI_Array(ex);
  
  // Закрываем либы
  while(ex->libs)
  {
    Libs_Queue* lib = ex->libs;
    sub_clients(lib->lib);
    CloseLib(lib->lib, 0);
    ex->libs = lib->next;
    mfree(lib);
  }

  if(ex->hashtab) mfree(ex->hashtab);
  if(ex->body) mfree(ex->body);
  if(ex->temp_env) mfree(ex->temp_env);
  mfree(ex);
  return E_NO_ERROR;
}
Exemplo n.º 13
0
static ALCboolean jack_load(void)
{
    ALCboolean error = ALC_FALSE;

#ifdef HAVE_DYNLOAD
    if(!jack_handle)
    {
#ifdef _WIN32
#define JACKLIB "libjack.dll"
#else
#define JACKLIB "libjack.so.0"
#endif
        jack_handle = LoadLib(JACKLIB);
        if(!jack_handle)
            return ALC_FALSE;

        error = ALC_FALSE;
#define LOAD_FUNC(f) do {                                                     \
    p##f = GetSymbol(jack_handle, #f);                                        \
    if(p##f == NULL) {                                                        \
        error = ALC_TRUE;                                                     \
    }                                                                         \
} while(0)
        JACK_FUNCS(LOAD_FUNC);
#undef LOAD_FUNC

        if(error)
        {
            CloseLib(jack_handle);
            jack_handle = NULL;
            return ALC_FALSE;
        }
    }
#endif

    return !error;
}
Exemplo n.º 14
0
static ALCboolean pulse_load(void) //{{{
{
    ALCboolean ret = ALC_FALSE;
    if(!pa_handle)
    {
        pa_threaded_mainloop *loop;

#ifdef HAVE_DYNLOAD

#ifdef _WIN32
#define PALIB "libpulse-0.dll"
#elif defined(__APPLE__) && defined(__MACH__)
#define PALIB "libpulse.0.dylib"
#else
#define PALIB "libpulse.so.0"
#endif
        pa_handle = LoadLib(PALIB);
        if(!pa_handle)
            return ALC_FALSE;

#define LOAD_FUNC(x) do {                                                     \
    p##x = GetSymbol(pa_handle, #x);                                          \
    if(!(p##x)) {                                                             \
        CloseLib(pa_handle);                                                  \
        pa_handle = NULL;                                                     \
        return ALC_FALSE;                                                     \
    }                                                                         \
} while(0)
        LOAD_FUNC(pa_context_unref);
        LOAD_FUNC(pa_sample_spec_valid);
        LOAD_FUNC(pa_stream_drop);
        LOAD_FUNC(pa_strerror);
        LOAD_FUNC(pa_context_get_state);
        LOAD_FUNC(pa_stream_get_state);
        LOAD_FUNC(pa_threaded_mainloop_signal);
        LOAD_FUNC(pa_stream_peek);
        LOAD_FUNC(pa_threaded_mainloop_wait);
        LOAD_FUNC(pa_threaded_mainloop_unlock);
        LOAD_FUNC(pa_threaded_mainloop_in_thread);
        LOAD_FUNC(pa_context_new);
        LOAD_FUNC(pa_threaded_mainloop_stop);
        LOAD_FUNC(pa_context_disconnect);
        LOAD_FUNC(pa_threaded_mainloop_start);
        LOAD_FUNC(pa_threaded_mainloop_get_api);
        LOAD_FUNC(pa_context_set_state_callback);
        LOAD_FUNC(pa_stream_write);
        LOAD_FUNC(pa_xfree);
        LOAD_FUNC(pa_stream_connect_record);
        LOAD_FUNC(pa_stream_connect_playback);
        LOAD_FUNC(pa_stream_readable_size);
        LOAD_FUNC(pa_stream_writable_size);
        LOAD_FUNC(pa_stream_cork);
        LOAD_FUNC(pa_stream_is_suspended);
        LOAD_FUNC(pa_stream_get_device_name);
        LOAD_FUNC(pa_path_get_filename);
        LOAD_FUNC(pa_get_binary_name);
        LOAD_FUNC(pa_threaded_mainloop_free);
        LOAD_FUNC(pa_context_errno);
        LOAD_FUNC(pa_xmalloc);
        LOAD_FUNC(pa_stream_unref);
        LOAD_FUNC(pa_threaded_mainloop_accept);
        LOAD_FUNC(pa_stream_set_write_callback);
        LOAD_FUNC(pa_threaded_mainloop_new);
        LOAD_FUNC(pa_context_connect);
        LOAD_FUNC(pa_stream_set_buffer_attr);
        LOAD_FUNC(pa_stream_get_buffer_attr);
        LOAD_FUNC(pa_stream_get_sample_spec);
        LOAD_FUNC(pa_stream_get_time);
        LOAD_FUNC(pa_stream_set_read_callback);
        LOAD_FUNC(pa_stream_set_state_callback);
        LOAD_FUNC(pa_stream_set_moved_callback);
        LOAD_FUNC(pa_stream_set_underflow_callback);
        LOAD_FUNC(pa_stream_new);
        LOAD_FUNC(pa_stream_disconnect);
        LOAD_FUNC(pa_threaded_mainloop_lock);
        LOAD_FUNC(pa_channel_map_init_auto);
        LOAD_FUNC(pa_channel_map_parse);
        LOAD_FUNC(pa_channel_map_snprint);
        LOAD_FUNC(pa_channel_map_equal);
        LOAD_FUNC(pa_context_get_server_info);
        LOAD_FUNC(pa_context_get_sink_info_by_name);
        LOAD_FUNC(pa_context_get_sink_info_list);
        LOAD_FUNC(pa_context_get_source_info_list);
        LOAD_FUNC(pa_operation_get_state);
        LOAD_FUNC(pa_operation_unref);
#undef LOAD_FUNC
#define LOAD_OPTIONAL_FUNC(x) do {                                            \
    p##x = GetSymbol(pa_handle, #x);                                          \
} while(0)
#if PA_CHECK_VERSION(0,9,15)
        LOAD_OPTIONAL_FUNC(pa_channel_map_superset);
        LOAD_OPTIONAL_FUNC(pa_stream_set_buffer_attr_callback);
#endif
#if PA_CHECK_VERSION(0,9,16)
        LOAD_OPTIONAL_FUNC(pa_stream_begin_write);
#endif
#undef LOAD_OPTIONAL_FUNC

#else /* HAVE_DYNLOAD */
        pa_handle = (void*)0xDEADBEEF;
#endif

        if((loop=pa_threaded_mainloop_new()) &&
           pa_threaded_mainloop_start(loop) >= 0)
        {
            pa_context *context;

            pa_threaded_mainloop_lock(loop);
            context = connect_context(loop, AL_TRUE);
            if(context)
            {
                ret = ALC_TRUE;

                pa_context_disconnect(context);
                pa_context_unref(context);
            }
            pa_threaded_mainloop_unlock(loop);
            pa_threaded_mainloop_stop(loop);
        }
        if(loop)
            pa_threaded_mainloop_free(loop);

        if(!ret)
        {
#ifdef HAVE_DYNLOAD
            CloseLib(pa_handle);
#endif
            pa_handle = NULL;
        }
    }
    return ret;
} //}}}
Exemplo n.º 15
0
CXvidDecoder::~CXvidDecoder()
{
    DPRINTF("Destructor");
	CloseLib();
}
Exemplo n.º 16
0
 static void Deinit()
 {
     if(sndfile_handle)
         CloseLib(sndfile_handle);
     sndfile_handle = NULL;
 }
Exemplo n.º 17
0
CDynPatcher::~CDynPatcher()
{
   CloseLib();
}
Exemplo n.º 18
0
 static void Deinit()
 {
     if(fsynth_handle)
         CloseLib(fsynth_handle);
     fsynth_handle = NULL;
 }
Exemplo n.º 19
0
HRESULT CXvidDecoder::CheckInputType(const CMediaType * mtIn)
{
	DPRINTF("CheckInputType");
	BITMAPINFOHEADER * hdr;

	ar_x = ar_y = 0;
	
	if (*mtIn->Type() != MEDIATYPE_Video)
	{
		DPRINTF("Error: Unknown Type");
		CloseLib();
		return VFW_E_TYPE_NOT_ACCEPTED;
	}

    if (m_hdll == NULL)
    {
		HRESULT hr = OpenLib();

        if (FAILED(hr) || (m_hdll == NULL)) // Paranoid checks.
			return VFW_E_TYPE_NOT_ACCEPTED;
    }

	if (*mtIn->FormatType() == FORMAT_VideoInfo)
	{
		VIDEOINFOHEADER * vih = (VIDEOINFOHEADER *) mtIn->Format();
		hdr = &vih->bmiHeader;
	}
	else if (*mtIn->FormatType() == FORMAT_VideoInfo2)
	{
		VIDEOINFOHEADER2 * vih2 = (VIDEOINFOHEADER2 *) mtIn->Format();
		hdr = &vih2->bmiHeader;
		if (g_config.aspect_ratio == 0 || g_config.aspect_ratio == 1) {
			ar_x = vih2->dwPictAspectRatioX;
			ar_y = vih2->dwPictAspectRatioY;
		}
		DPRINTF("VIDEOINFOHEADER2 AR: %d:%d", ar_x, ar_y);
	}
  else if (*mtIn->FormatType() == FORMAT_MPEG2Video) {
    MPEG2VIDEOINFO * mpgvi = (MPEG2VIDEOINFO*)mtIn->Format();
    VIDEOINFOHEADER2 * vih2 = &mpgvi->hdr;
		hdr = &vih2->bmiHeader;
		if (g_config.aspect_ratio == 0 || g_config.aspect_ratio == 1) {
			ar_x = vih2->dwPictAspectRatioX;
			ar_y = vih2->dwPictAspectRatioY;
		}
		DPRINTF("VIDEOINFOHEADER2 AR: %d:%d", ar_x, ar_y);

    /* haali media splitter reports VOL information in the format header */

    if (mpgvi->cbSequenceHeader>0) {

      xvid_dec_stats_t stats;
	    memset(&stats, 0, sizeof(stats));
	    stats.version = XVID_VERSION;

	    if (m_create.handle == NULL) {
		    if (xvid_decore_func == NULL)
			    return E_FAIL;
		    if (xvid_decore_func(0, XVID_DEC_CREATE, &m_create, 0) < 0) {
          DPRINTF("*** XVID_DEC_CREATE error");
			    return E_FAIL;
		    }
	    }

      m_frame.general = 0;
      m_frame.bitstream = (void*)mpgvi->dwSequenceHeader;
      m_frame.length = mpgvi->cbSequenceHeader;
      m_frame.output.csp = XVID_CSP_NULL;

      int ret = 0;
      if ((ret=xvid_decore_func(m_create.handle, XVID_DEC_DECODE, &m_frame, &stats)) >= 0) {
        /* honour video dimensions reported in VOL header */
	      if (stats.type == XVID_TYPE_VOL) {
          hdr->biWidth = stats.data.vol.width;
          hdr->biHeight = stats.data.vol.height;
        }
      }
      if (ret == XVID_ERR_MEMORY) return E_FAIL;
    }
  }
	else
	{
		DPRINTF("Error: Unknown FormatType");
		CloseLib();
		return VFW_E_TYPE_NOT_ACCEPTED;
	}

	if (hdr->biHeight < 0)
	{
		DPRINTF("colorspace: inverted input format not supported");
	}

	m_create.width = hdr->biWidth;
	m_create.height = hdr->biHeight;

	switch(hdr->biCompression)
	{
  case FOURCC_mp4v:
	case FOURCC_MP4V:
		if (!(g_config.supported_4cc & SUPPORT_MP4V)) {
			CloseLib();
			return VFW_E_TYPE_NOT_ACCEPTED;
		}
		break;	
	case FOURCC_DIVX :
		if (!(g_config.supported_4cc & SUPPORT_DIVX)) {
			CloseLib();
			return VFW_E_TYPE_NOT_ACCEPTED;
		}
		break;
	case FOURCC_DX50 :
		if (!(g_config.supported_4cc & SUPPORT_DX50)) {
			CloseLib();
			return VFW_E_TYPE_NOT_ACCEPTED;
		}
	case FOURCC_XVID :
		break;
		

	default :
		DPRINTF("Unknown fourcc: 0x%08x (%c%c%c%c)",
			hdr->biCompression,
			(hdr->biCompression)&0xff,
			(hdr->biCompression>>8)&0xff,
			(hdr->biCompression>>16)&0xff,
			(hdr->biCompression>>24)&0xff);
		CloseLib();
		return VFW_E_TYPE_NOT_ACCEPTED;
	}
	return S_OK;
}