Commit a2dbff92 authored by Harald Sitter's avatar Harald Sitter 🌹
Browse files

Merge branch 'master' into qml

parents c41b4327 2232f13e
......@@ -24,11 +24,9 @@ set(phonon_vlc_SRCS
audio/audiooutput.cpp
audio/audiodataoutput.cpp
backend.cpp
utils/debug.cpp
devicemanager.cpp
effect.cpp
effectmanager.cpp
utils/libvlc.cpp
media.cpp
mediacontroller.cpp
mediaobject.cpp
......@@ -40,6 +38,8 @@ set(phonon_vlc_SRCS
${phonon_vlc_experimental_SRCS}
# video/videodataoutput.cpp
video/videowidget.cpp
utils/debug.cpp
utils/libvlc.cpp
)
if(APPLE)
......
......@@ -86,7 +86,7 @@ Backend::Backend(QObject *parent, const QVariantList &)
#endif
QMessageBox msg;
msg.setIcon(QMessageBox::Critical);
msg.setWindowTitle(tr("LibVLC failed to initialize"));
msg.setWindowTitle(tr("LibVLC Failed to Initialize"));
msg.setText(tr("Phonon's VLC backend failed to start."
"\n\n"
"This usually means a problem with your VLC installation,"
......
......@@ -30,6 +30,7 @@
#include "backend.h"
#include "utils/debug.h"
#include "utils/libvlc.h"
#include "utils/vstring.h"
QT_BEGIN_NAMESPACE
......@@ -237,8 +238,8 @@ void DeviceManager::updateDeviceList()
const int deviceCount = libvlc_audio_output_device_count(libvlc, soundSystem);
for (int i = 0; i < deviceCount; i++) {
const char *idName = libvlc_audio_output_device_id(libvlc, soundSystem, i);
const char *longName = libvlc_audio_output_device_longname(libvlc, soundSystem, i);
VString idName(libvlc_audio_output_device_id(libvlc, soundSystem, i));
VString longName(libvlc_audio_output_device_longname(libvlc, soundSystem, i));
DeviceInfo device(longName, true);
device.addAccess(DeviceAccess(soundSystem, idName));
......
......@@ -22,6 +22,7 @@
#include <vlc/vlc.h>
#include "utils/libvlc.h"
#include "utils/vstring.h"
namespace Phonon {
namespace VLC {
......@@ -62,7 +63,7 @@ void Media::addOption(const QString &option)
QString Media::meta(libvlc_meta_t meta)
{
return QString::fromUtf8(libvlc_media_get_meta(m_media, meta));
return VString(libvlc_media_get_meta(m_media, meta)).toQString();
}
void Media::event_cb(const libvlc_event_t *event, void *opaque)
......
......@@ -19,9 +19,10 @@
#define LIBVLC_H
#include <QtCore/QtGlobal>
#include <QtCore/QStringList>
#include <vlc/libvlc_version.h>
class QLibrary;
struct libvlc_instance_t;
......@@ -56,7 +57,12 @@ struct libvlc_instance_t;
for (libvlc_##type##_t *variable = getter; variable; \
variable = variable->p_next, !variable ? releaseSuffix(variable) : (void)0)
// TODO: once VLC1 support is dropped unify the FOREACH macro to only require the type
#if (LIBVLC_VERSION_INT >= LIBVLC_VERSION(2, 0, 0, 0))
#define VLC_TRACK_FOREACH(variable, getter) VLC_FOREACH(track_description, variable, getter, libvlc_track_description_list_release)
#else
#define VLC_TRACK_FOREACH(variable, getter) VLC_FOREACH(track_description, variable, getter, libvlc_track_description_release)
#endif // >= VLC 2
#define VLC_MODULE_FOREACH(variable, getter) VLC_FOREACH(module_description, variable, getter, libvlc_module_description_list_release)
/**
......
/*
Copyright (C) 2012 Harald Sitter <sitter@kde.org>
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, see <http://www.gnu.org/licenses/>.
*/
#ifndef PHONON_VLC_VSTRING_H
#define PHONON_VLC_VSTRING_H
#include <QtCore/QString>
#include <vlc/libvlc.h>
#include <vlc/libvlc_version.h>
class VString
{
public:
VString(char *vlcString) : m_vlcString(vlcString) {}
~VString()
{
#if (LIBVLC_VERSION_INT >= LIBVLC_VERSION(2, 0, 0, 0))
libvlc_free(m_vlcString);
#else
free(m_vlcString);
#endif // >= VLC 2
}
// VLC internally only uses UTF8!
QString toQString() { return QString::fromUtf8(m_vlcString); }
operator QString() { return toQString(); }
private:
VString() {}
char *m_vlcString;
};
#endif // PHONON_VLC_VSTRING_H
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment