Skip to content

Commit

Permalink
openal: add to config.tests
Browse files Browse the repository at this point in the history
  • Loading branch information
wang-bin committed Jan 7, 2014
1 parent 56a645f commit 675d4c8
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 10 deletions.
10 changes: 8 additions & 2 deletions QtAV.pro
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,14 @@ OTHER_FILES += \


EssentialDepends = avutil avcodec avformat swscale
OptionalDepends = portaudio direct2d gdiplus gl \
swresample avresample
OptionalDepends = \
swresample \
avresample \
gl \
openal \
portaudio \
direct2d \
gdiplus
win32 {
OptionalDepends += dxva
}
Expand Down
33 changes: 33 additions & 0 deletions config.tests/openal/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/******************************************************************************
QtAV: Media play library based on Qt and FFmpeg
Copyright (C) 2014 Wang Bin <[email protected]>
* This file is part of QtAV
This library 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 library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
******************************************************************************/

#if defined(HEADER_OPENAL_PREFIX)
#include <OpenAL/al.h>
#include <OpenAL/alc.h>
#else
#include <AL/al.h>
#include <AL/alc.h>
#endif

int main()
{
return 0;
}
11 changes: 11 additions & 0 deletions config.tests/openal/openal.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
CONFIG -= qt
CONFIG += console

SOURCES += main.cpp

win32: LIBS += -lOpenAL32
unix:!mac:!blackberry: LIBS += -lopenal
blackberry: LIBS += -lOpenAL
mac: LIBS += -framework OpenAL
mac: DEFINES += HEADER_OPENAL_PREFIX

14 changes: 9 additions & 5 deletions src/AOOpenAL.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/******************************************************************************
AOOpenAL.cpp: description
Copyright (C) 2012 Wang Bin <[email protected]>
Copyright (C) 2012-2014 Wang Bin <[email protected]>
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
Expand All @@ -21,10 +21,14 @@
#include "private/AudioOutput_p.h"
#include <QtCore/QVector>
#include <QtCore/QElapsedTimer>
#include <string>

#if defined(HEADER_OPENAL_PREFIX)
#include <OpenAL/al.h>
#include <OpenAL/alc.h>
#else
#include <AL/al.h>
#include <AL/alc.h>
#include <AL/alext.h>
#endif

namespace QtAV {

Expand Down Expand Up @@ -144,7 +148,7 @@ bool AOOpenAL::open()
{
DPTR_D(AOOpenAL);
d.available = false; // TODO: d.reset()
QVector<std::string> _devices;
QVector<QByteArray> _devices;
const char *p = NULL;
if (alcIsExtensionPresent(NULL, "ALC_ENUMERATE_ALL_EXT"))
p = alcGetString(NULL, ALC_ALL_DEVICES_SPECIFIER);
Expand All @@ -156,7 +160,7 @@ bool AOOpenAL::open()
}
qDebug("OpenAL devices available: %d", _devices.size());
for (int i = 0; i < _devices.size(); i++) {
qDebug("device %d: %s", i, _devices[i].c_str());
qDebug("device %d: %s", i, _devices[i].constData());
}
const ALCchar *default_device = alcGetString(NULL, ALC_DEFAULT_DEVICE_SPECIFIER);
qDebug("AOOpenAL Opening default device: %s", default_device);
Expand Down
8 changes: 5 additions & 3 deletions src/libQtAV.pro
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,13 @@ config_openal {
}
config_openal {
SOURCES += AOOpenAL.cpp
HEADERS += QtAV/private/AOOpenAL_p.h
SDK_HEADERS += QtAV/AOOpenAL.h
DEFINES *= QTAV_HAVE_OPENAL=1
win32:LIBS *= -lOpenAL32
else: LIBS *= -lopenal
win32: LIBS += -lOpenAL32
unix:!mac:!blackberry: LIBS += -lopenal
blackberry: LIBS += -lOpenAL
mac: LIBS += -framework OpenAL
mac: DEFINES += HEADER_OPENAL_PREFIX
}
config_gdiplus {
DEFINES *= QTAV_HAVE_GDIPLUS=1
Expand Down

0 comments on commit 675d4c8

Please sign in to comment.