Skip to content

Commit

Permalink
oal: fix crash if load failed
Browse files Browse the repository at this point in the history
  • Loading branch information
wang-bin committed Jun 11, 2016
1 parent 2b25d08 commit 3ace8ab
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion contrib/capi
1 change: 1 addition & 0 deletions src/capi/openal_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ namespace openal {
#ifndef CAPI_LINK_OPENAL
using namespace capi; // original header is in namespace capi, types are changed
#endif // CAPI_LINK_OPENAL
namespace capi { bool loaded();} // For link or NS style. Or load test for class style. api.loaded for class style.
class api_dll;
class api
{
Expand Down
8 changes: 7 additions & 1 deletion src/output/audio/AudioOutputOpenAL.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/******************************************************************************
QtAV: Media play library based on Qt and FFmpeg
QtAV: Multimedia framework based on Qt and FFmpeg
Copyright (C) 2012-2016 Wang Bin <[email protected]>
* This file is part of QtAV
Expand Down Expand Up @@ -222,6 +222,12 @@ AudioOutputOpenAL::AudioOutputOpenAL(QObject *parent)
, format_al(AL_FORMAT_STEREO16)
, state(0)
{
#if QTAV_HAVE(CAPI)
if (!openal::capi::loaded()) {
available = false;
return;
}
#endif
//setDeviceFeatures(AudioOutput::SetVolume);
// ensure we have a context to check format support
// TODO: AudioOutput::getDevices() => ao.setDevice() => ao.open
Expand Down

0 comments on commit 3ace8ab

Please sign in to comment.