View | Details | Raw Unified | Return to bug 387406
Collapse All | Expand All

(-)a/kdebase-runtime-4.0.4/knotify/notifybysound.cpp (+23 lines)
Lines 30-35 Link Here
30
30
31
// QT headers
31
// QT headers
32
#include <QHash>
32
#include <QHash>
33
#include <QtCore/QBasicTimer>
34
#include <QtCore/QTimerEvent>
33
#include <QtCore/QStack>
35
#include <QtCore/QStack>
34
#include <QSignalMapper>
36
#include <QSignalMapper>
35
37
Lines 78-83 Link Here
78
80
79
		Player *getPlayer();
81
		Player *getPlayer();
80
		void returnPlayer(Player *);
82
		void returnPlayer(Player *);
83
		void clear();
81
84
82
		void setVolume(float volume);
85
		void setVolume(float volume);
83
86
Lines 110-115 Link Here
110
	}
113
	}
111
}
114
}
112
115
116
void PlayerPool::clear()
117
{
118
	qDeleteAll(m_playerPool);
119
	m_playerPool.clear();
120
}
121
113
void PlayerPool::setVolume(float v)
122
void PlayerPool::setVolume(float v)
114
{
123
{
115
	m_volume = v;
124
	m_volume = v;
Lines 128-133 Link Here
128
		QHash<int, Player*> playerObjects;
137
		QHash<int, Player*> playerObjects;
129
		QSignalMapper *signalmapper;
138
		QSignalMapper *signalmapper;
130
		PlayerPool playerPool;
139
		PlayerPool playerPool;
140
		QBasicTimer poolTimer;
131
141
132
		int volume;
142
		int volume;
133
143
Lines 216-221 Link Here
216
	}
226
	}
217
227
218
	kDebug(300) << " going to play " << soundFile;
228
	kDebug(300) << " going to play " << soundFile;
229
	d->poolTimer.stop();
219
230
220
	if(d->playerMode == Private::UsePhonon)
231
	if(d->playerMode == Private::UsePhonon)
221
	{
232
	{
Lines 248-253 Link Here
248
}
259
}
249
260
250
261
262
void NotifyBySound::timerEvent(QTimerEvent *e)
263
{
264
	if (e->timerId() == d->poolTimer.timerId()) {
265
		d->poolTimer.stop();
266
		d->playerPool.clear();
267
		return;
268
	}
269
	KNotifyPlugin::timerEvent(e);
270
}
271
251
void NotifyBySound::slotSoundFinished(int id)
272
void NotifyBySound::slotSoundFinished(int id)
252
{
273
{
253
	kDebug(300) << id;
274
	kDebug(300) << id;
Lines 256-261 Link Here
256
		Player *player=d->playerObjects.take(id);
277
		Player *player=d->playerObjects.take(id);
257
		disconnect(player->media, SIGNAL(finished()), d->signalmapper, SLOT(map()));
278
		disconnect(player->media, SIGNAL(finished()), d->signalmapper, SLOT(map()));
258
		d->playerPool.returnPlayer(player);
279
		d->playerPool.returnPlayer(player);
280
		d->poolTimer.start(1000, this);
259
	}
281
	}
260
	if(d->processes.contains(id))
282
	if(d->processes.contains(id))
261
	{
283
	{
Lines 273-278 Link Here
273
		Player *p = d->playerObjects.take(id);
295
		Player *p = d->playerObjects.take(id);
274
		p->stop();
296
		p->stop();
275
		d->playerPool.returnPlayer(p);
297
		d->playerPool.returnPlayer(p);
298
		d->poolTimer.start(1000, this);
276
	}
299
	}
277
	if(d->processes.contains(id))
300
	if(d->processes.contains(id))
278
	{
301
	{
(-)a/kdebase-runtime-4.0.4/knotify/notifybysound.h (-1 / +3 lines)
Lines 44-50 Link Here
44
	public:
44
	public:
45
		void setVolume( int v );
45
		void setVolume( int v );
46
46
47
		
47
	protected:
48
		void timerEvent(QTimerEvent *);
49
48
	private Q_SLOTS:
50
	private Q_SLOTS:
49
		void slotSoundFinished(int id);
51
		void slotSoundFinished(int id);
50
};
52
};
(-)a/kdebase-runtime-4.0.4/phonon/xine/audiooutput.cpp (-5 / +12 lines)
Lines 43-50 Link Here
43
43
44
#define K_XT(type) (static_cast<type *>(SinkNode::threadSafeObject().data()))
44
#define K_XT(type) (static_cast<type *>(SinkNode::threadSafeObject().data()))
45
AudioOutput::AudioOutput(QObject *parent)
45
AudioOutput::AudioOutput(QObject *parent)
46
    : AbstractAudioOutput(new AudioOutputXT, parent),
46
    : AbstractAudioOutput(new AudioOutputXT, parent)
47
    m_device(1)
48
{
47
{
49
}
48
}
50
49
Lines 60-66 Link Here
60
59
61
int AudioOutput::outputDevice() const
60
int AudioOutput::outputDevice() const
62
{
61
{
63
    return m_device;
62
    return m_device.index();
64
}
63
}
65
64
66
void AudioOutput::setVolume(qreal newVolume)
65
void AudioOutput::setVolume(qreal newVolume)
Lines 85-90 Link Here
85
84
86
bool AudioOutput::setOutputDevice(int newDevice)
85
bool AudioOutput::setOutputDevice(int newDevice)
87
{
86
{
87
    return setOutputDevice(AudioOutputDevice::fromIndex(newDevice));
88
}
89
90
bool AudioOutput::setOutputDevice(const AudioOutputDevice &newDevice)
91
{
88
    AudioPort newPort(newDevice);
92
    AudioPort newPort(newDevice);
89
    if (!newPort.isValid()) {
93
    if (!newPort.isValid()) {
90
        kDebug(610) << "new audio port is invalid";
94
        kDebug(610) << "new audio port is invalid";
Lines 92-98 Link Here
92
    }
96
    }
93
    m_device = newDevice;
97
    m_device = newDevice;
94
    K_XT(AudioOutputXT)->m_audioPort = newPort;
98
    K_XT(AudioOutputXT)->m_audioPort = newPort;
95
    K_XT(AudioOutputXT)->m_audioPort.setAudioOutput(this);
96
    SourceNode *src = source();
99
    SourceNode *src = source();
97
    if (src) {
100
    if (src) {
98
        QList<WireCall> wireCall;
101
        QList<WireCall> wireCall;
Lines 126-132 Link Here
126
    switch (ev->type()) {
129
    switch (ev->type()) {
127
    case Event::AudioDeviceFailed:
130
    case Event::AudioDeviceFailed:
128
        ev->accept();
131
        ev->accept();
129
        emit audioDeviceFailed();
132
        // we don't know for sure which AudioPort failed. but the one without any
133
        // capabilities must be the guilty one
134
        if (K_XT(AudioOutputXT)->m_audioPort.hasFailed()) {
135
            emit audioDeviceFailed();
136
        }
130
        return true;
137
        return true;
131
    default:
138
    default:
132
        return AbstractAudioOutput::event(ev);
139
        return AbstractAudioOutput::event(ev);
(-)a/kdebase-runtime-4.0.4/phonon/xine/audiooutput.h (-2 / +3 lines)
Lines 1-6 Link Here
1
/*  This file is part of the KDE project
1
/*  This file is part of the KDE project
2
    Copyright (C) 2006 Tim Beaulen <tbscope@gmail.com>
2
    Copyright (C) 2006 Tim Beaulen <tbscope@gmail.com>
3
    Copyright (C) 2006-2007 Matthias Kretz <kretz@kde.org>
3
    Copyright (C) 2006-2008 Matthias Kretz <kretz@kde.org>
4
4
5
    This program is free software; you can redistribute it and/or
5
    This program is free software; you can redistribute it and/or
6
    modify it under the terms of the GNU Library General Public
6
    modify it under the terms of the GNU Library General Public
Lines 63-68 Link Here
63
        // Attributes Setters:
63
        // Attributes Setters:
64
        void setVolume(qreal newVolume);
64
        void setVolume(qreal newVolume);
65
        bool setOutputDevice(int newDevice);
65
        bool setOutputDevice(int newDevice);
66
        bool setOutputDevice(const AudioOutputDevice &newDevice);
66
67
67
        void downstreamEvent(Event *);
68
        void downstreamEvent(Event *);
68
69
Lines 78-84 Link Here
78
79
79
    private:
80
    private:
80
        qreal m_volume;
81
        qreal m_volume;
81
        int m_device;
82
        AudioOutputDevice m_device;
82
};
83
};
83
}} //namespace Phonon::Xine
84
}} //namespace Phonon::Xine
84
85
(-)a/kdebase-runtime-4.0.4/phonon/xine/audioport.cpp (-50 / +62 lines)
Lines 1-5 Link Here
1
/*  This file is part of the KDE project
1
/*  This file is part of the KDE project
2
    Copyright (C) 2006-2007 Matthias Kretz <kretz@kde.org>
2
    Copyright (C) 2006-2008 Matthias Kretz <kretz@kde.org>
3
3
4
    This program is free software; you can redistribute it and/or
4
    This program is free software; you can redistribute it and/or
5
    modify it under the terms of the GNU Library General Public
5
    modify it under the terms of the GNU Library General Public
Lines 25-30 Link Here
25
#include <QByteArray>
25
#include <QByteArray>
26
#include <QStringList>
26
#include <QStringList>
27
#include <xine.h>
27
#include <xine.h>
28
#include <xine/audio_out.h>
28
#include <QSharedData>
29
#include <QSharedData>
29
#include <kdebug.h>
30
#include <kdebug.h>
30
#include <QtCore/QTimerEvent>
31
#include <QtCore/QTimerEvent>
Lines 98-153 Link Here
98
    waitALittleWithDying(); // xine still accesses the port after a rewire :(
99
    waitALittleWithDying(); // xine still accesses the port after a rewire :(
99
}
100
}
100
101
101
AudioPort::AudioPort(int deviceIndex)
102
AudioPort::AudioPort(const AudioOutputDevice &deviceDesc)
102
    : d(new AudioPortData)
103
    : d(new AudioPortData)
103
{
104
{
104
    QByteArray outputPlugin = XineEngine::audioDriverFor(deviceIndex);
105
    QVariant v = deviceDesc.property("driver");
105
    //kDebug(610) << outputPlugin << alsaDevices;
106
    if (!v.isValid()) {
107
        const QByteArray outputPlugin = XineEngine::audioDriverFor(deviceDesc.index());
108
        kDebug(610) << "use output plugin:" << outputPlugin;
109
        d->port = xine_open_audio_driver(XineEngine::xine(), outputPlugin.constData(), 0);
110
    } else {
111
        const QByteArray outputPlugin = v.toByteArray();
112
        v = deviceDesc.property("deviceIds");
113
        const QStringList deviceIds = v.toStringList();
114
        if (deviceIds.isEmpty()) {
115
            return;
116
        }
117
        kDebug(610) << "*** audio output plugin is: " <<  outputPlugin;
106
118
107
    if (outputPlugin == "alsa") {
119
        if (outputPlugin == "alsa") {
108
        QStringList alsaDevices = XineEngine::alsaDevicesFor(deviceIndex);
120
            foreach (const QString &device, deviceIds) {
109
        foreach (QString device, alsaDevices) {
121
                xine_cfg_entry_t alsaDeviceConfig;
110
            xine_cfg_entry_t alsaDeviceConfig;
122
                QByteArray deviceStr = device.toUtf8();
111
            QByteArray deviceStr = device.toUtf8();
112
            if(!xine_config_lookup_entry(XineEngine::xine(), "audio.device.alsa_default_device",
113
                        &alsaDeviceConfig)) {
114
                // the config key is not registered yet - it is registered when the alsa output
115
                // plugin is opened. So we open the plugin and close it again, then we can set the
116
                // setting. :(
117
                xine_audio_port_t *port = xine_open_audio_driver(XineEngine::xine(), outputPlugin.constData(), 0);
118
                if (port) {
119
                    xine_close_audio_driver(XineEngine::xine(), port);
120
                    // port == 0 does not have to be fatal, since it might be only the default device
121
                    // that cannot be opened
122
                    //kError(610) << "creating the correct ALSA output failed!";
123
                    //return;
124
                }
125
                // now the config key should be registered
126
                if(!xine_config_lookup_entry(XineEngine::xine(), "audio.device.alsa_default_device",
123
                if(!xine_config_lookup_entry(XineEngine::xine(), "audio.device.alsa_default_device",
127
                            &alsaDeviceConfig)) {
124
                            &alsaDeviceConfig)) {
128
                    kError(610) << "cannot set the ALSA device on Xine's ALSA output plugin";
125
                    // the config key is not registered yet - it is registered when the alsa output
129
                    return;
126
                    // plugin is opened. So we open the plugin and close it again, then we can set the
127
                    // setting. :(
128
                    xine_audio_port_t *port = xine_open_audio_driver(XineEngine::xine(), "alsa", 0);
129
                    if (port) {
130
                        xine_close_audio_driver(XineEngine::xine(), port);
131
                        // port == 0 does not have to be fatal, since it might be only the default device
132
                        // that cannot be opened
133
                    }
134
                    // now the config key should be registered
135
                    if(!xine_config_lookup_entry(XineEngine::xine(), "audio.device.alsa_default_device",
136
                                &alsaDeviceConfig)) {
137
                        kError(610) << "cannot set the ALSA device on Xine's ALSA output plugin";
138
                        return;
139
                    }
140
                }
141
                Q_ASSERT(alsaDeviceConfig.type == XINE_CONFIG_TYPE_STRING);
142
                alsaDeviceConfig.str_value = deviceStr.data();
143
                xine_config_update_entry(XineEngine::xine(), &alsaDeviceConfig);
144
145
                int err = xine_config_lookup_entry(XineEngine::xine(), "audio.device.alsa_front_device", &alsaDeviceConfig);
146
                Q_ASSERT(err);
147
                Q_ASSERT(alsaDeviceConfig.type == XINE_CONFIG_TYPE_STRING);
148
                alsaDeviceConfig.str_value = deviceStr.data();
149
                xine_config_update_entry(XineEngine::xine(), &alsaDeviceConfig);
150
151
                d->port = xine_open_audio_driver(XineEngine::xine(), "alsa", 0);
152
                if (d->port) {
153
                    kDebug(610) << "use ALSA device: " << device;
154
                    break;
130
                }
155
                }
131
            }
156
            }
132
            Q_ASSERT(alsaDeviceConfig.type == XINE_CONFIG_TYPE_STRING);
157
        } else if (outputPlugin == "oss") {
133
            alsaDeviceConfig.str_value = deviceStr.data();
158
            kDebug(610) << "use OSS output";
134
            xine_config_update_entry(XineEngine::xine(), &alsaDeviceConfig);
159
            d->port = xine_open_audio_driver(XineEngine::xine(), "oss", 0);
135
136
            int err = xine_config_lookup_entry(XineEngine::xine(), "audio.device.alsa_front_device", &alsaDeviceConfig);
137
            Q_ASSERT(err);
138
            Q_ASSERT(alsaDeviceConfig.type == XINE_CONFIG_TYPE_STRING);
139
            alsaDeviceConfig.str_value = deviceStr.data();
140
            xine_config_update_entry(XineEngine::xine(), &alsaDeviceConfig);
141
142
            d->port = xine_open_audio_driver(XineEngine::xine(), outputPlugin.constData(), 0);
143
            if (d->port) {
144
                kDebug(610) << "use ALSA device: " << device;
145
                break;
146
            }
147
        }
160
        }
148
    } else {
149
        kDebug(610) << "use output plugin:" << outputPlugin;
150
        d->port = xine_open_audio_driver(XineEngine::xine(), outputPlugin.constData(), 0);
151
    }
161
    }
152
    kDebug(610) << "----------------------------------------------- audio_port created";
162
    kDebug(610) << "----------------------------------------------- audio_port created";
153
}
163
}
Lines 186-199 Link Here
186
    return d->port;
196
    return d->port;
187
}
197
}
188
198
189
void AudioPort::setAudioOutput(QObject *audioOutput)
199
bool AudioPort::hasFailed() const
190
{
191
    d->audioOutput = audioOutput;
192
}
193
194
QObject *AudioPort::audioOutput() const
195
{
200
{
196
    return d->audioOutput;
201
    if (!d->port) {
202
        return true;
203
    }
204
    const uint32_t cap = d->port->get_capabilities(d->port);
205
    if (cap == AO_CAP_NOCAP) {
206
        return true;
207
    }
208
    return false;
197
}
209
}
198
210
199
} // namespace Xine
211
} // namespace Xine
(-)a/kdebase-runtime-4.0.4/phonon/xine/audioport.h (-7 / +4 lines)
Lines 1-5 Link Here
1
/*  This file is part of the KDE project
1
/*  This file is part of the KDE project
2
    Copyright (C) 2006-2007 Matthias Kretz <kretz@kde.org>
2
    Copyright (C) 2006-2008 Matthias Kretz <kretz@kde.org>
3
3
4
    This program is free software; you can redistribute it and/or
4
    This program is free software; you can redistribute it and/or
5
    modify it under the terms of the GNU Library General Public
5
    modify it under the terms of the GNU Library General Public
Lines 25-30 Link Here
25
#include <xine.h>
25
#include <xine.h>
26
#include <QSharedData>
26
#include <QSharedData>
27
#include <QObject>
27
#include <QObject>
28
#include <Phonon/AudioOutputDevice>
28
29
29
30
30
namespace Phonon
31
namespace Phonon
Lines 49-55 Link Here
49
    friend class EffectXT;
50
    friend class EffectXT;
50
    public:
51
    public:
51
        AudioPort();
52
        AudioPort();
52
        AudioPort(int deviceIndex);
53
        AudioPort(const AudioOutputDevice &deviceDesc);
53
54
54
        bool isValid() const;
55
        bool isValid() const;
55
        bool operator==(const AudioPort &rhs) const;
56
        bool operator==(const AudioPort &rhs) const;
Lines 60-70 Link Here
60
        operator xine_audio_port_t *() const;
61
        operator xine_audio_port_t *() const;
61
        xine_audio_port_t *xinePort() const;
62
        xine_audio_port_t *xinePort() const;
62
63
63
        /**
64
        bool hasFailed() const;
64
         * used to send XINE_EVENT_AUDIO_DEVICE_FAILED to the AudioOutput
65
         */
66
        void setAudioOutput(QObject *audioOutput);
67
        QObject *audioOutput() const;
68
65
69
        AudioPort(const AudioPort &);
66
        AudioPort(const AudioPort &);
70
        AudioPort &operator=(const AudioPort &);
67
        AudioPort &operator=(const AudioPort &);
(-)a/kdebase-runtime-4.0.4/phonon/xine/backend.cpp (-45 / +40 lines)
Lines 20-25 Link Here
20
*/
20
*/
21
21
22
#include "backend.h"
22
#include "backend.h"
23
//#include <phonon/experimental/backendinterface.h>
23
#include "mediaobject.h"
24
#include "mediaobject.h"
24
#include "effect.h"
25
#include "effect.h"
25
#include "events.h"
26
#include "events.h"
Lines 28-34 Link Here
28
#include "nullsink.h"
29
#include "nullsink.h"
29
#include "visualization.h"
30
#include "visualization.h"
30
#include "volumefadereffect.h"
31
#include "volumefadereffect.h"
31
#include "videodataoutput.h"
32
//#include "videodataoutput.h"
32
#include "videowidget.h"
33
#include "videowidget.h"
33
#include "wirecall.h"
34
#include "wirecall.h"
34
#include "xinethread.h"
35
#include "xinethread.h"
Lines 44-52 Link Here
44
#include <QtCore/QVariant>
45
#include <QtCore/QVariant>
45
#include <QtGui/QApplication>
46
#include <QtGui/QApplication>
46
47
47
#include <phonon/audiodevice.h>
48
#include <phonon/audiodeviceenumerator.h>
49
50
extern "C" {
48
extern "C" {
51
#include <xine/xine_plugin.h>
49
#include <xine/xine_plugin.h>
52
#include "shareddata.h"
50
#include "shareddata.h"
Lines 109-116 Link Here
109
        return new AudioDataOutput(parent);
107
        return new AudioDataOutput(parent);
110
    case VisualizationClass:
108
    case VisualizationClass:
111
        return new Visualization(parent);
109
        return new Visualization(parent);
112
    case VideoDataOutputClass:
110
    //case Phonon::Experimental::BackendInterface::VideoDataOutputClass:
113
        return new VideoDataOutput(parent);
111
        //return new VideoDataOutput(parent);
114
    case EffectClass:
112
    case EffectClass:
115
        {
113
        {
116
            Q_ASSERT(args.size() == 1);
114
            Q_ASSERT(args.size() == 1);
Lines 169-175 Link Here
169
        QString mimeTypes(mimeTypes_c);
167
        QString mimeTypes(mimeTypes_c);
170
        free(mimeTypes_c);
168
        free(mimeTypes_c);
171
        QStringList lstMimeTypes = mimeTypes.split(";", QString::SkipEmptyParts);
169
        QStringList lstMimeTypes = mimeTypes.split(";", QString::SkipEmptyParts);
172
        foreach (QString mimeType, lstMimeTypes)
170
        foreach (const QString &mimeType, lstMimeTypes)
173
            m_supportedMimeTypes << mimeType.left(mimeType.indexOf(':')).trimmed();
171
            m_supportedMimeTypes << mimeType.left(mimeType.indexOf(':')).trimmed();
174
        if (m_supportedMimeTypes.contains("application/ogg"))
172
        if (m_supportedMimeTypes.contains("application/ogg"))
175
            m_supportedMimeTypes << QLatin1String("audio/x-vorbis+ogg") << QLatin1String("application/ogg");
173
            m_supportedMimeTypes << QLatin1String("audio/x-vorbis+ogg") << QLatin1String("application/ogg");
Lines 185-199 Link Here
185
    {
183
    {
186
    case Phonon::AudioOutputDeviceType:
184
    case Phonon::AudioOutputDeviceType:
187
        return XineEngine::audioOutputIndexes();
185
        return XineEngine::audioOutputIndexes();
188
/*
186
#if KDE_IS_VERSION(4,1,0)
189
    case Phonon::AudioCaptureDeviceType:
187
    case Phonon::AudioCaptureDeviceType:
190
        {
191
            QList<AudioDevice> devlist = AudioDeviceEnumerator::availableCaptureDevices();
192
            foreach (AudioDevice dev, devlist) {
193
                list << dev.index();
194
            }
195
        }
196
        break;
188
        break;
189
#endif
190
/*
197
    case Phonon::VideoOutputDeviceType:
191
    case Phonon::VideoOutputDeviceType:
198
        {
192
        {
199
            const char *const *outputPlugins = xine_list_video_output_plugins(XineEngine::xine());
193
            const char *const *outputPlugins = xine_list_video_output_plugins(XineEngine::xine());
Lines 224-229 Link Here
224
            } */
218
            } */
225
            break;
219
            break;
226
        }
220
        }
221
#if KDE_IS_VERSION(4,1,0)
222
    case Phonon::AudioChannelType:
223
    case Phonon::SubtitleType:
224
        {
225
            ObjectDescriptionHash hash = XineEngine::objectDescriptions();
226
            ObjectDescriptionHash::iterator it = hash.find(type);
227
            if( it != hash.end() )
228
                list = it.value().keys();
229
        }
230
        break;
231
#endif
227
    }
232
    }
228
    return list;
233
    return list;
229
}
234
}
Lines 236-274 Link Here
236
    case Phonon::AudioOutputDeviceType:
241
    case Phonon::AudioOutputDeviceType:
237
        ret = XineEngine::audioOutputProperties(index);
242
        ret = XineEngine::audioOutputProperties(index);
238
        break;
243
        break;
239
        /*
244
#if KDE_IS_VERSION(4,1,0)
240
    case Phonon::AudioCaptureDeviceType:
245
    case Phonon::AudioCaptureDeviceType:
241
        {
242
            QList<AudioDevice> devlist = AudioDeviceEnumerator::availableCaptureDevices();
243
            foreach (AudioDevice dev, devlist) {
244
                if (dev.index() == index) {
245
                    ret.insert("name", dev.cardName());
246
                    switch (dev.driver()) {
247
                    case Solid::AudioInterface::Alsa:
248
                        ret.insert("description", i18n("ALSA Capture Device"));
249
                        break;
250
                    case Solid::AudioInterface::OpenSoundSystem:
251
                        ret.insert("description", i18n("OSS Capture Device"));
252
                        break;
253
                    case Solid::AudioInterface::UnknownAudioDriver:
254
                        break;
255
                    }
256
                    ret.insert("icon", dev.iconName());
257
                    ret.insert("available", dev.isAvailable());
258
                    break;
259
                }
260
            }
261
        }
262
        switch (index) {
263
        case 20000:
264
            ret.insert("name", QLatin1String("Soundcard"));
265
            break;
266
        case 20001:
267
            ret.insert("name", QLatin1String("DV"));
268
            break;
269
        }
270
        //kDebug(610) << ret["name"];
271
        break;
246
        break;
247
#endif
248
        /*
272
    case Phonon::VideoOutputDeviceType:
249
    case Phonon::VideoOutputDeviceType:
273
        {
250
        {
274
            const char *const *outputPlugins = xine_list_video_output_plugins(XineEngine::xine());
251
            const char *const *outputPlugins = xine_list_video_output_plugins(XineEngine::xine());
Lines 324-329 Link Here
324
            } */
301
            } */
325
        }
302
        }
326
        break;
303
        break;
304
#if KDE_IS_VERSION(4,1,0)
305
    case Phonon::AudioChannelType:
306
    case Phonon::SubtitleType:
307
        {
308
            ObjectDescriptionHash descriptionHash = XineEngine::objectDescriptions();
309
            ObjectDescriptionHash::iterator descIt = descriptionHash.find(type);
310
            if(descIt != descriptionHash.end())
311
            {
312
                ChannelIndexHash indexHash = descIt.value();
313
                ChannelIndexHash::iterator indexIt = indexHash.find(index);
314
                if(indexIt != indexHash.end() )
315
                {
316
                    ret = indexIt.value();
317
                }
318
            }
319
        }
320
        break;
321
#endif
327
    }
322
    }
328
    return ret;
323
    return ret;
329
}
324
}
(-)a/kdebase-runtime-4.0.4/phonon/xine/backend.h (+3 lines)
Lines 21-29 Link Here
21
#ifndef Phonon_XINE_BACKEND_H
21
#ifndef Phonon_XINE_BACKEND_H
22
#define Phonon_XINE_BACKEND_H
22
#define Phonon_XINE_BACKEND_H
23
23
24
#include <QByteArray>
25
#include <QHash>
24
#include <QList>
26
#include <QList>
25
#include <QPointer>
27
#include <QPointer>
26
#include <QStringList>
28
#include <QStringList>
29
#include <QVariant>
27
30
28
#include <xine.h>
31
#include <xine.h>
29
#include <xine/xineutils.h>
32
#include <xine/xineutils.h>
(-)a/kdebase-runtime-4.0.4/phonon/xine/bytestream.cpp (-3 / +4 lines)
Lines 223-233 Link Here
223
    Q_ASSERT(m_eod);
223
    Q_ASSERT(m_eod);
224
    if (m_buffersize > 0) {
224
    if (m_buffersize > 0) {
225
        PXINE_VDEBUG << "calling pullBuffer with m_buffersize = " << m_buffersize;
225
        PXINE_VDEBUG << "calling pullBuffer with m_buffersize = " << m_buffersize;
226
        pullBuffer(static_cast<char *>(buf), m_buffersize);
226
        const int len = m_buffersize;
227
        m_currentPosition += m_buffersize;
227
        pullBuffer(static_cast<char *>(buf), len);
228
        m_currentPosition += len;
228
        PXINE_DEBUG << "returning less data than requested, the stream is at its end";
229
        PXINE_DEBUG << "returning less data than requested, the stream is at its end";
229
        //kDebug(610) << "UNLOCKING m_mutex: ";
230
        //kDebug(610) << "UNLOCKING m_mutex: ";
230
        return m_buffersize;
231
        return len;
231
    }
232
    }
232
    PXINE_DEBUG << "return 0, the stream is at its end";
233
    PXINE_DEBUG << "return 0, the stream is at its end";
233
    //kDebug(610) << "UNLOCKING m_mutex: ";
234
    //kDebug(610) << "UNLOCKING m_mutex: ";
(-)a/kdebase-runtime-4.0.4/phonon/xine/bytestream.h (-2 / +1 lines)
Lines 26-32 Link Here
26
#include <xine.h>
26
#include <xine.h>
27
27
28
#include "xineengine.h"
28
#include "xineengine.h"
29
#include <phonon/streaminterface.h>
29
#include <Phonon/StreamInterface>
30
#include <QByteArray>
30
#include <QByteArray>
31
#include <QSharedData>
31
#include <QSharedData>
32
#include <QQueue>
32
#include <QQueue>
Lines 46-52 Link Here
46
class ByteStream : public QObject, public StreamInterface, public QSharedData
46
class ByteStream : public QObject, public StreamInterface, public QSharedData
47
{
47
{
48
    Q_OBJECT
48
    Q_OBJECT
49
    Q_INTERFACES(Phonon::StreamInterface)
50
    public:
49
    public:
51
        static ByteStream *fromMrl(const QByteArray &mrl);
50
        static ByteStream *fromMrl(const QByteArray &mrl);
52
        ByteStream(const MediaSource &, MediaObject *parent);
51
        ByteStream(const MediaSource &, MediaObject *parent);
(-)a/kdebase-runtime-4.0.4/phonon/xine/bytestreamplugin.cpp (-4 / +21 lines)
Lines 200-206 Link Here
200
    if (kbytestream_plugin_get_length (this_gen) == 0) {
200
    if (kbytestream_plugin_get_length (this_gen) == 0) {
201
        _x_message(that->stream(), XINE_MSG_FILE_EMPTY, that->mrl(), NULL);
201
        _x_message(that->stream(), XINE_MSG_FILE_EMPTY, that->mrl(), NULL);
202
        xine_log (that->stream()->xine, XINE_LOG_MSG,
202
        xine_log (that->stream()->xine, XINE_LOG_MSG,
203
                _("input_kbytestream: File empty: >%s<\n"), that->mrl());
203
                "input_kbytestream: File empty: >%s<\n", that->mrl());
204
        return 0;
204
        return 0;
205
    }
205
    }
206
206
Lines 249-270 Link Here
249
    return that;
249
    return that;
250
}
250
}
251
251
252
#define PLUGIN_DESCRIPTION "kbytestream input plugin"
253
#define PLUGIN_IDENTIFIER "kbytestream"
254
255
#if XINE_MAJOR_VERSION < 1 || ( XINE_MAJOR_VERSION == 1 && ( XINE_MINOR_VERSION < 1 || ( XINE_MINOR_VERSION == 1 && XINE_SUB_VERSION < 90 ) ) )
256
#define NEED_DESCRIPTION_FUNCTION 1
257
#else
258
#define NEED_DESCRIPTION_FUNCTION 0
259
#endif
260
261
#if NEED_DESCRIPTION_FUNCTION
252
#if (XINE_SUB_VERSION > 3 && XINE_MINOR_VERSION == 1) || (XINE_MINOR_VERSION > 1 && XINE_MAJOR_VERSION == 1) || XINE_MAJOR_VERSION > 1
262
#if (XINE_SUB_VERSION > 3 && XINE_MINOR_VERSION == 1) || (XINE_MINOR_VERSION > 1 && XINE_MAJOR_VERSION == 1) || XINE_MAJOR_VERSION > 1
253
static const char *kbytestream_class_get_description(input_class_t *)
263
static const char *kbytestream_class_get_description(input_class_t *)
254
{
264
{
255
    return _("kbytestream input plugin");
265
    return PLUGIN_DESCRIPTION;
256
}
266
}
257
#else
267
#else
258
static char *kbytestream_class_get_description(input_class_t *)
268
static char *kbytestream_class_get_description(input_class_t *)
259
{
269
{
260
    return const_cast<char *>(_("kbytestream input plugin"));
270
    return const_cast<char *>(PLUGIN_DESCRIPTION);
261
}
271
}
262
#endif
272
#endif
263
273
264
static const char *kbytestream_class_get_identifier(input_class_t *)
274
static const char *kbytestream_class_get_identifier(input_class_t *)
265
{
275
{
266
    return "kbytestream";
276
    return PLUGIN_IDENTIFIER;
267
}
277
}
278
#endif /* NEED_DESCRIPTION_FUNCTIONS */
268
279
269
static void kbytestream_class_dispose (input_class_t *this_gen)
280
static void kbytestream_class_dispose (input_class_t *this_gen)
270
{
281
{
Lines 279-286 Link Here
279
    memset(that, 0, sizeof(that));
290
    memset(that, 0, sizeof(that));
280
291
281
    that->get_instance       = kbytestream_class_get_instance;
292
    that->get_instance       = kbytestream_class_get_instance;
293
#if NEED_DESCRIPTION_FUNCTION
282
    that->get_identifier     = kbytestream_class_get_identifier;
294
    that->get_identifier     = kbytestream_class_get_identifier;
283
    that->get_description    = kbytestream_class_get_description;
295
    that->get_description    = kbytestream_class_get_description;
296
#else
297
    that->description        = PLUGIN_DESCRIPTION;
298
    that->text_domain        = "phonon-xine";
299
    that->identifier         = PLUGIN_IDENTIFIER;
300
#endif
284
    that->get_dir            = NULL;
301
    that->get_dir            = NULL;
285
    that->get_autoplay_list  = NULL;
302
    that->get_autoplay_list  = NULL;
286
    that->dispose            = kbytestream_class_dispose;
303
    that->dispose            = kbytestream_class_dispose;
(-)a/kdebase-runtime-4.0.4/phonon/xine/CMakeLists.txt (-2 / +2 lines)
Lines 18-24 Link Here
18
    effect.cpp
18
    effect.cpp
19
    audiooutput.cpp
19
    audiooutput.cpp
20
    mediaobject.cpp
20
    mediaobject.cpp
21
    videodataoutput.cpp
21
    #videodataoutput.cpp
22
    visualization.cpp
22
    visualization.cpp
23
    backend.cpp
23
    backend.cpp
24
    volumefadereffect.cpp
24
    volumefadereffect.cpp
Lines 43-49 Link Here
43
macro_log_feature(XCB_VIDEO "XCB" "XCB is needed for the video widget, libxine needs to be compiled with XCB" "http://xcb.freedesktop.org/")
43
macro_log_feature(XCB_VIDEO "XCB" "XCB is needed for the video widget, libxine needs to be compiled with XCB" "http://xcb.freedesktop.org/")
44
44
45
kde4_add_plugin(phonon_xine ${phonon_xine_PART_SRCS})
45
kde4_add_plugin(phonon_xine ${phonon_xine_PART_SRCS})
46
target_link_libraries(phonon_xine ${QT_QTGUI_LIBRARY} ${KDE4_KDEUI_LIBS} ${KDE4_PHONON_LIBS} ${XINE_LIBRARY} ${KDE4_KAUDIODEVICELIST_LIBS})
46
target_link_libraries(phonon_xine ${QT_QTGUI_LIBRARY} ${KDE4_KDECORE_LIBS} ${KDE4_KDEUI_LIBS} ${KDE4_PHONON_LIBS} ${XINE_LIBRARY} ${KDE4_KAUDIODEVICELIST_LIBS})
47
if(XCB_FOUND AND XINE_XCB_FOUND)
47
if(XCB_FOUND AND XINE_XCB_FOUND)
48
  target_link_libraries(phonon_xine ${LIBXCB_LIBRARIES})
48
  target_link_libraries(phonon_xine ${LIBXCB_LIBRARIES})
49
endif(XCB_FOUND AND XINE_XCB_FOUND)
49
endif(XCB_FOUND AND XINE_XCB_FOUND)
(-)a/kdebase-runtime-4.0.4/phonon/xine/mediaobject.cpp (-66 / +54 lines)
Lines 1-6 Link Here
1
/*  This file is part of the KDE project
1
/*  This file is part of the KDE project
2
    Copyright (C) 2006 Tim Beaulen <tbscope@gmail.com>
2
    Copyright (C) 2006 Tim Beaulen <tbscope@gmail.com>
3
    Copyright (C) 2006-2007 Matthias Kretz <kretz@kde.org>
3
    Copyright (C) 2006-2007 Matthias Kretz <kretz@kde.org>
4
    Copyright (C) 2008 Ian Monroe <imonroe@kde.org>
4
5
5
    This program is free software; you can redistribute it and/or
6
    This program is free software; you can redistribute it and/or
6
    modify it under the terms of the GNU Library General Public
7
    modify it under the terms of the GNU Library General Public
Lines 35-40 Link Here
35
36
36
#include <kdebug.h>
37
#include <kdebug.h>
37
#include <klocale.h>
38
#include <klocale.h>
39
#include <kdeversion.h>
38
40
39
#include <cmath>
41
#include <cmath>
40
#include "xinethread.h"
42
#include "xinethread.h"
Lines 76-81 Link Here
76
    connect(m_stream, SIGNAL(hasVideoChanged(bool)), SLOT(handleHasVideoChanged(bool)));
78
    connect(m_stream, SIGNAL(hasVideoChanged(bool)), SLOT(handleHasVideoChanged(bool)));
77
    connect(m_stream, SIGNAL(bufferStatus(int)), SIGNAL(bufferStatus(int)));
79
    connect(m_stream, SIGNAL(bufferStatus(int)), SIGNAL(bufferStatus(int)));
78
    connect(m_stream, SIGNAL(tick(qint64)), SIGNAL(tick(qint64)));
80
    connect(m_stream, SIGNAL(tick(qint64)), SIGNAL(tick(qint64)));
81
    connect(m_stream, SIGNAL(availableSubtitlesChanged()), SIGNAL(availableSubtitlesChanged()));
82
    connect(m_stream, SIGNAL(availableAudioChannelsChanged()), SIGNAL(availableAudioChannelsChanged()));
79
    connect(m_stream, SIGNAL(availableChaptersChanged(int)), SIGNAL(availableChaptersChanged(int)));
83
    connect(m_stream, SIGNAL(availableChaptersChanged(int)), SIGNAL(availableChaptersChanged(int)));
80
    connect(m_stream, SIGNAL(chapterChanged(int)), SIGNAL(chapterChanged(int)));
84
    connect(m_stream, SIGNAL(chapterChanged(int)), SIGNAL(chapterChanged(int)));
81
    connect(m_stream, SIGNAL(availableAnglesChanged(int)), SIGNAL(availableAnglesChanged(int)));
85
    connect(m_stream, SIGNAL(availableAnglesChanged(int)), SIGNAL(availableAnglesChanged(int)));
Lines 204-274 Link Here
204
    m_stream->setTickInterval(m_tickInterval);
208
    m_stream->setTickInterval(m_tickInterval);
205
}
209
}
206
210
207
/*
208
QList<AudioStreamDescription> MediaObject::availableAudioStreams() const
209
{
210
    // TODO
211
    QStringList ret;
212
    ret << QLatin1String("en") << QLatin1String("de");
213
    return ret;
214
}
215
216
QList<VideoStreamDescription> MediaObject::availableVideoStreams() const
217
{
218
    // TODO
219
    QStringList ret;
220
    ret << QLatin1String("en") << QLatin1String("de");
221
    return ret;
222
}
223
224
QList<SubtitleStreamDescription> MediaObject::availableSubtitleStreams() const
225
{
226
    // TODO
227
    QStringList ret;
228
    ret << QLatin1String("en") << QLatin1String("de");
229
    return ret;
230
}
231
232
AudioStreamDescription MediaObject::currentAudioStream(const QObject *audioPath) const
233
{
234
    // TODO
235
    return m_currentAudioStream[audioPath];
236
}
237
238
VideoStreamDescription MediaObject::currentVideoStream(const QObject *videoPath) const
239
{
240
    // TODO
241
    return m_currentVideoStream[videoPath];
242
}
243
244
SubtitleStreamDescription MediaObject::currentSubtitleStream(const QObject *videoPath) const
245
{
246
    // TODO
247
    return m_currentSubtitleStream[videoPath];
248
}
249
250
void MediaObject::setCurrentAudioStream(const QString &streamName, const QObject *audioPath)
251
{
252
    // TODO
253
    if(availableAudioStreams().contains(streamName))
254
        m_currentAudioStream[audioPath] = streamName;
255
}
256
257
void MediaObject::setCurrentVideoStream(const QString &streamName, const QObject *videoPath)
258
{
259
    // TODO
260
    if(availableVideoStreams().contains(streamName))
261
        m_currentVideoStream[videoPath] = streamName;
262
}
263
264
void MediaObject::setCurrentSubtitleStream(const QString &streamName, const QObject *videoPath)
265
{
266
    // TODO
267
    if(availableSubtitleStreams().contains(streamName))
268
        m_currentSubtitleStream[videoPath] = streamName;
269
}
270
*/
271
272
void MediaObject::play()
211
void MediaObject::play()
273
{
212
{
274
    kDebug(610) << green << "PLAY" << normal;
213
    kDebug(610) << green << "PLAY" << normal;
Lines 558-563 Link Here
558
            return true;
497
            return true;
559
        }
498
        }
560
        break;
499
        break;
500
#if KDE_IS_VERSION(4,1,0)
501
    case AddonInterface::SubtitleInterface:
502
        if (stream().subtitlesSize() > 0) { //subtitles off by default, enable if any
503
            return true;
504
        }
505
        break;
506
    case AddonInterface::AudioChannelInterface:
507
        if (stream().audioChannelsSize() > 1) { //first audio channel on by default, enable if > 1
508
            return true;
509
        }
510
        break;
511
#endif
561
    }
512
    }
562
    return false;
513
    return false;
563
}
514
}
Lines 581-586 Link Here
581
QVariant MediaObject::interfaceCall(Interface interface, int command, const QList<QVariant> &arguments)
532
QVariant MediaObject::interfaceCall(Interface interface, int command, const QList<QVariant> &arguments)
582
{
533
{
583
    kDebug(610) << interface << ", " << command;
534
    kDebug(610) << interface << ", " << command;
535
584
    switch (interface) {
536
    switch (interface) {
585
    case AddonInterface::ChapterInterface:
537
    case AddonInterface::ChapterInterface:
586
        switch (static_cast<AddonInterface::ChapterCommand>(command)) {
538
        switch (static_cast<AddonInterface::ChapterCommand>(command)) {
Lines 632-638 Link Here
632
                }
584
                }
633
                kDebug(610) << "change title from " << m_currentTitle << " to " << t;
585
                kDebug(610) << "change title from " << m_currentTitle << " to " << t;
634
                m_currentTitle = t;
586
                m_currentTitle = t;
635
                stream().setMrl(m_titles[t - 1], m_autoplayTitles ? XineStream::KeepState : XineStream::StoppedState);
587
                stream().setMrl(m_titles[t - 1],
588
                                m_autoplayTitles ? XineStream::KeepState : XineStream::StoppedState);
636
                if (m_mediaSource.discType() == Phonon::Cd) {
589
                if (m_mediaSource.discType() == Phonon::Cd) {
637
                    emit titleChanged(m_currentTitle);
590
                    emit titleChanged(m_currentTitle);
638
                }
591
                }
Lines 662-667 Link Here
662
                return true;
615
                return true;
663
            }
616
            }
664
        }
617
        }
618
        break;
619
#if KDE_IS_VERSION(4,1,0)
620
    case AddonInterface::SubtitleInterface:
621
        switch (static_cast<AddonInterface::SubtitleCommand>(command))
622
        {
623
            case AddonInterface::availableSubtitles:
624
                return QVariant::fromValue( m_stream->availableSubtitles() );
625
            case AddonInterface::currentSubtitle:
626
                return QVariant::fromValue(m_stream->currentSubtitle());
627
            case AddonInterface::setCurrentSubtitle:
628
                if (arguments.isEmpty() || !arguments.first().canConvert<SubtitleDescription>() ) {
629
                    kDebug(610) << "arguments invalid";
630
                    return false;
631
                }
632
                m_stream->setCurrentSubtitle( arguments.first().value<SubtitleDescription>() );
633
                return true;
634
        }
635
        break;
636
    case AddonInterface::AudioChannelInterface:
637
        switch (static_cast<AddonInterface::AudioChannelCommand>(command))
638
        {
639
            case AddonInterface::availableAudioChannels:
640
                return QVariant::fromValue( m_stream->availableAudioChannels() );
641
            case AddonInterface::currentAudioChannel:
642
                return QVariant::fromValue( m_stream->currentAudioChannel() );
643
            case AddonInterface::setCurrentAudioChannel:
644
                if (arguments.isEmpty() || !arguments.first().canConvert<AudioChannelDescription>() ) {
645
                    kDebug(610) << "arguments invalid";
646
                    return false;
647
                }
648
                m_stream->setCurrentAudioChannel( arguments.first().value<AudioChannelDescription>() );
649
                return true;
650
         }
651
         break;
652
#endif
665
    }
653
    }
666
    return QVariant();
654
    return QVariant();
667
}
655
}
(-)a/kdebase-runtime-4.0.4/phonon/xine/mediaobject.h (-18 / +2 lines)
Lines 62-81 Link Here
62
        Q_INVOKABLE qint64 remainingTime() const;
62
        Q_INVOKABLE qint64 remainingTime() const;
63
        qint32 tickInterval() const;
63
        qint32 tickInterval() const;
64
64
65
        /*
66
        QList<AudioStreamDescription> availableAudioStreams() const;
67
        QList<VideoStreamDescription> availableVideoStreams() const;
68
        QList<SubtitleStreamDescription> availableSubtitleStreams() const;
69
70
        AudioStreamDescription currentAudioStream(const QObject *audioPath) const;
71
        VideoStreamDescription currentVideoStream(const QObject *videoPath) const;
72
        SubtitleStreamDescription currentSubtitleStream(const QObject *videoPath) const;
73
74
        void setCurrentAudioStream(const QString &streamName, const QObject *audioPath);
75
        void setCurrentVideoStream(const QString &streamName, const QObject *videoPath);
76
        void setCurrentSubtitleStream(const QString &streamName, const QObject *videoPath);
77
        */
78
79
        void setTickInterval(qint32 newTickInterval);
65
        void setTickInterval(qint32 newTickInterval);
80
        void play();
66
        void play();
81
        void pause();
67
        void pause();
Lines 123-128 Link Here
123
        void asyncSeek(xine_stream_t *, qint64, bool);
109
        void asyncSeek(xine_stream_t *, qint64, bool);
124
110
125
        // AddonInterface
111
        // AddonInterface
112
        void availableSubtitlesChanged();
113
        void availableAudioChannelsChanged();
126
        void availableTitlesChanged(int);
114
        void availableTitlesChanged(int);
127
        void titleChanged(int);
115
        void titleChanged(int);
128
        void availableChaptersChanged(int);
116
        void availableChaptersChanged(int);
Lines 154-163 Link Here
154
        qint32 m_tickInterval;
142
        qint32 m_tickInterval;
155
        QPointer<ByteStream> m_bytestream;
143
        QPointer<ByteStream> m_bytestream;
156
144
157
        QHash<const QObject *, QString> m_currentAudioStream;
158
        QHash<const QObject *, QString> m_currentVideoStream;
159
        QHash<const QObject *, QString> m_currentSubtitleStream;
160
161
        mutable int m_currentTimeOverride;
145
        mutable int m_currentTimeOverride;
162
        MediaSource m_mediaSource;
146
        MediaSource m_mediaSource;
163
        QList<QByteArray> m_titles;
147
        QList<QByteArray> m_titles;
(-)a/kdebase-runtime-4.0.4/phonon/xine/videodataoutput.cpp (-30 / +85 lines)
Lines 21-26 Link Here
21
#include "videodataoutput.h"
21
#include "videodataoutput.h"
22
#include <kdebug.h>
22
#include <kdebug.h>
23
#include "sourcenode.h"
23
#include "sourcenode.h"
24
#include <Phonon/Experimental/AbstractVideoDataOutput>
25
26
#define K_XT(type) (static_cast<type *>(SinkNode::threadSafeObject().data()))
24
27
25
namespace Phonon
28
namespace Phonon
26
{
29
{
Lines 29-41 Link Here
29
class VideoDataOutputXT : public SinkNodeXT
32
class VideoDataOutputXT : public SinkNodeXT
30
{
33
{
31
    public:
34
    public:
35
        VideoDataOutputXT();
36
        ~VideoDataOutputXT();
32
        xine_video_port_t *videoPort() const { return m_videoPort; }
37
        xine_video_port_t *videoPort() const { return m_videoPort; }
33
        void rewireTo(SourceNodeXT *);
38
        void rewireTo(SourceNodeXT *);
34
39
40
        Phonon::Experimental::AbstractVideoDataOutput *m_frontend;
35
    private:
41
    private:
42
        struct Frame
43
        {
44
            int format;
45
            int width;
46
            int height;
47
            double aspectRatio;
48
            void *data0;
49
            void *data1;
50
            void *data2;
51
        };
52
        static void raw_output_cb(void *user_data, int frame_format, int frame_width,
53
                int frame_height, double frame_aspect, void *data0, void *data1, void *data2);
54
        static void raw_overlay_cb(void *user_data, int num_ovl, raw_overlay_t *overlay_array);
55
56
#ifdef XINE_VISUAL_TYPE_RAW
57
        raw_visual_t m_visual;
58
#endif
36
        xine_video_port_t *m_videoPort;
59
        xine_video_port_t *m_videoPort;
37
};
60
};
38
61
62
void VideoDataOutputXT::raw_output_cb(void *user_data, int format, int width,
63
        int height, double aspect, void *data0, void *data1, void *data2)
64
{
65
    VideoDataOutputXT* vw = reinterpret_cast<VideoDataOutputXT *>(user_data);
66
    const Experimental::VideoFrame f = {
67
        width,
68
        height,
69
        aspect,
70
        ((format == XINE_VORAW_YV12) ? Experimental::VideoFrame::Format_YV12 :
71
         (format == XINE_VORAW_YUY2) ? Experimental::VideoFrame::Format_YUY2 :
72
         (format == XINE_VORAW_RGB ) ? Experimental::VideoFrame::Format_RGB888 :
73
                                       Experimental::VideoFrame::Format_Invalid),
74
        QByteArray::fromRawData(reinterpret_cast<const char *>(data0), ((format == XINE_VORAW_RGB) ? 3 : (format == XINE_VORAW_YUY2) ? 2 : 1) * width * height),
75
        QByteArray::fromRawData(reinterpret_cast<const char *>(data1), (format == XINE_VORAW_YV12) ? (width >> 1) + (height >> 1) : 0),
76
        QByteArray::fromRawData(reinterpret_cast<const char *>(data2), (format == XINE_VORAW_YV12) ? (width >> 1) + (height >> 1) : 0)
77
    };
78
    if (vw->m_frontend) {
79
        //kDebug(610) << "send frame to frontend";
80
        vw->m_frontend->frameReady(f);
81
    }
82
}
83
84
void VideoDataOutputXT::raw_overlay_cb(void *user_data, int num_ovl, raw_overlay_t *overlay_array)
85
{
86
    VideoDataOutputXT* vw = reinterpret_cast<VideoDataOutputXT *>(user_data);
87
    Q_UNUSED(vw);
88
    Q_UNUSED(num_ovl);
89
    Q_UNUSED(overlay_array);
90
}
91
92
VideoDataOutputXT::VideoDataOutputXT()
93
    : m_frontend(0),
94
    m_videoPort(0)
95
{
96
#ifdef XINE_VISUAL_TYPE_RAW
97
    m_visual.user_data = static_cast<void *>(this);
98
    m_visual.raw_output_cb = &Phonon::Xine::VideoDataOutputXT::raw_output_cb;
99
    m_visual.raw_overlay_cb = &Phonon::Xine::VideoDataOutputXT::raw_overlay_cb;
100
    m_visual.supported_formats = /*XINE_VORAW_YV12 | XINE_VORAW_YUY2 |*/ XINE_VORAW_RGB; // TODO
101
    m_videoPort = xine_open_video_driver(XineEngine::xine(), "auto", XINE_VISUAL_TYPE_RAW, static_cast<void *>(&m_visual));
102
#endif
103
}
104
105
VideoDataOutputXT::~VideoDataOutputXT()
106
{
107
    if (m_videoPort) {
108
        xine_video_port_t *vp = m_videoPort;
109
        m_videoPort = 0;
110
111
        xine_close_video_driver(XineEngine::xine(), vp);
112
    }
113
}
114
39
VideoDataOutput::VideoDataOutput(QObject *parent)
115
VideoDataOutput::VideoDataOutput(QObject *parent)
40
    : QObject(parent),
116
    : QObject(parent),
41
    SinkNode(new VideoDataOutputXT)
117
    SinkNode(new VideoDataOutputXT)
Lines 48-92 Link Here
48
124
49
void VideoDataOutputXT::rewireTo(SourceNodeXT *source)
125
void VideoDataOutputXT::rewireTo(SourceNodeXT *source)
50
{
126
{
127
    if (!source->videoOutputPort()) {
128
        return;
129
    }
51
    xine_post_wire_video_port(source->videoOutputPort(), videoPort());
130
    xine_post_wire_video_port(source->videoOutputPort(), videoPort());
52
}
131
}
53
132
54
quint32 VideoDataOutput::format() const
133
Experimental::AbstractVideoDataOutput *VideoDataOutput::frontendObject() const
55
{
56
    return m_fourcc;
57
}
58
59
int VideoDataOutput::frameRate() const
60
{
61
    return m_frameRate;
62
}
63
64
void VideoDataOutput::setFrameRate(int frameRate)
65
{
134
{
66
    m_frameRate = frameRate;
135
    return K_XT(const VideoDataOutputXT)->m_frontend;
67
}
136
}
68
137
69
QSize VideoDataOutput::naturalFrameSize() const
138
void VideoDataOutput::setFrontendObject(Experimental::AbstractVideoDataOutput *x)
70
{
139
{
71
    return QSize(320, 240);
140
    K_XT(VideoDataOutputXT)->m_frontend = x;
72
}
73
74
QSize VideoDataOutput::frameSize() const
75
{
76
    return m_frameSize;
77
}
78
79
void VideoDataOutput::setFrameSize(const QSize &frameSize)
80
{
81
    m_frameSize = frameSize;
82
}
83
84
void VideoDataOutput::setFormat(quint32 fourcc)
85
{
86
    m_fourcc = fourcc;
87
}
141
}
88
142
89
}} //namespace Phonon::Xine
143
}} //namespace Phonon::Xine
90
144
145
#undef K_XT
146
91
#include "videodataoutput.moc"
147
#include "videodataoutput.moc"
92
// vim: sw=4 ts=4
(-)a/kdebase-runtime-4.0.4/phonon/xine/videodataoutput.h (-35 / +18 lines)
Lines 1-5 Link Here
1
/*  This file is part of the KDE project
1
/*  This file is part of the KDE project
2
    Copyright (C) 2006 Matthias Kretz <kretz@kde.org>
2
    Copyright (C) 2006,2008 Matthias Kretz <kretz@kde.org>
3
3
4
    This program is free software; you can redistribute it and/or
4
    This program is free software; you can redistribute it and/or
5
    modify it under the terms of the GNU Library General Public
5
    modify it under the terms of the GNU Library General Public
Lines 17-73 Link Here
17
    Boston, MA 02110-1301, USA.
17
    Boston, MA 02110-1301, USA.
18
18
19
*/
19
*/
20
#ifndef Phonon_XINE_VIDEODATAOUTPUT_H
20
#ifndef PHONON_XINE_VIDEODATAOUTPUT_H
21
#define Phonon_XINE_VIDEODATAOUTPUT_H
21
#define PHONON_XINE_VIDEODATAOUTPUT_H
22
22
23
#include <phonon/experimental/videoframe.h>
24
#include <QVector>
25
#include <QByteArray>
26
#include <QObject>
27
#include <QSize>
28
#include <QList>
29
#include "sinknode.h"
23
#include "sinknode.h"
30
24
25
#include <Phonon/Experimental/VideoDataOutputInterface>
26
#include <Phonon/Experimental/VideoFrame>
27
28
#include <QtCore/QByteArray>
29
#include <QtCore/QList>
30
#include <QtCore/QObject>
31
#include <QtCore/QSize>
32
#include <QtCore/QVector>
33
31
#include <xine.h>
34
#include <xine.h>
32
35
33
namespace Phonon
36
namespace Phonon
34
{
37
{
35
namespace Xine
38
namespace Xine
36
{
39
{
37
/**
40
38
 * \author Matthias Kretz <kretz@kde.org>
41
class VideoDataOutput : public QObject, public Phonon::Experimental::VideoDataOutputInterface, public Phonon::Xine::SinkNode
39
 */
40
class VideoDataOutput : public QObject, public Phonon::Xine::SinkNode
41
{
42
{
42
    Q_OBJECT
43
    Q_OBJECT
43
    Q_INTERFACES(Phonon::Xine::SinkNode)
44
    Q_INTERFACES(Phonon::Experimental::VideoDataOutputInterface Phonon::Xine::SinkNode)
44
    public:
45
    public:
45
        VideoDataOutput(QObject *parent);
46
        VideoDataOutput(QObject *parent);
46
        ~VideoDataOutput();
47
        ~VideoDataOutput();
47
48
48
        MediaStreamTypes inputMediaStreamTypes() const { return Phonon::Xine::Video; }
49
        MediaStreamTypes inputMediaStreamTypes() const { return Phonon::Xine::Video; }
49
50
50
    public slots:
51
        Experimental::AbstractVideoDataOutput *frontendObject() const;
51
        int frameRate() const;
52
        void setFrontendObject(Experimental::AbstractVideoDataOutput *);
52
        void setFrameRate(int frameRate);
53
54
        QSize naturalFrameSize() const;
55
        QSize frameSize() const;
56
        void setFrameSize(const QSize &frameSize);
57
58
        quint32 format() const;
59
        void setFormat(quint32 fourcc);
60
61
    signals:
62
        void frameReady(const Phonon::Experimental::VideoFrame &frame);
63
        void endOfMedia();
64
65
    private:
66
        quint32 m_fourcc;
67
        int m_frameRate;
68
        QSize m_frameSize;
69
};
53
};
70
}} //namespace Phonon::Xine
54
}} //namespace Phonon::Xine
71
55
72
// vim: sw=4 ts=4 tw=80
56
#endif // PHONON_XINE_VIDEODATAOUTPUT_H
73
#endif // Phonon_XINE_VIDEODATAOUTPUT_H
(-)a/kdebase-runtime-4.0.4/phonon/xine/volumefader_plugin.cpp (-2 / +19 lines)
Lines 426-444 Link Here
426
    return &that->post;
426
    return &that->post;
427
}
427
}
428
428
429
#if XINE_MAJOR_VERSION < 1 || ( XINE_MAJOR_VERSION == 1 && ( XINE_MINOR_VERSION < 1 || ( XINE_MINOR_VERSION == 1 && XINE_SUB_VERSION < 90 ) ) )
430
#define NEED_DESCRIPTION_FUNCTION 1
431
#else
432
#define NEED_DESCRIPTION_FUNCTION 0
433
#endif
434
435
#define PLUGIN_DESCRIPTION I18N_NOOP("Fade in or fade out with different fade curves")
436
#define PLUGIN_IDENTIFIER "KVolumeFader"
437
438
#if NEED_DESCRIPTION_FUNCTION
429
static char *kvolumefader_get_identifier(post_class_t *class_gen)
439
static char *kvolumefader_get_identifier(post_class_t *class_gen)
430
{
440
{
431
    Q_UNUSED(class_gen);
441
    Q_UNUSED(class_gen);
432
    return "KVolumeFader";
442
    return PLUGIN_IDENTIFIER;
433
}
443
}
434
444
435
static char *kvolumefader_get_description(post_class_t *class_gen)
445
static char *kvolumefader_get_description(post_class_t *class_gen)
436
{
446
{
437
    Q_UNUSED(class_gen);
447
    Q_UNUSED(class_gen);
438
    static QByteArray description(
448
    static QByteArray description(
439
            i18n("Fade in or fade out with different fade curves").toUtf8());
449
            i18n(PLUGIN_DESCRIPTION).toUtf8());
440
    return description.data();
450
    return description.data();
441
}
451
}
452
#endif
442
453
443
static void kvolumefader_class_dispose(post_class_t *class_gen)
454
static void kvolumefader_class_dispose(post_class_t *class_gen)
444
{
455
{
Lines 455-462 Link Here
455
    }
466
    }
456
467
457
    _class->post_class.open_plugin     = kvolumefader_open_plugin;
468
    _class->post_class.open_plugin     = kvolumefader_open_plugin;
469
#if NEED_DESCRIPTION_FUNCTION
458
    _class->post_class.get_identifier  = kvolumefader_get_identifier;
470
    _class->post_class.get_identifier  = kvolumefader_get_identifier;
459
    _class->post_class.get_description = kvolumefader_get_description;
471
    _class->post_class.get_description = kvolumefader_get_description;
472
#else
473
    _class->post_class.description     = PLUGIN_DESCRIPTION;
474
    _class->post_class.text_domain     = "phonon-xine";
475
    _class->post_class.identifier      = PLUGIN_IDENTIFIER;
476
#endif
460
    _class->post_class.dispose         = kvolumefader_class_dispose;
477
    _class->post_class.dispose         = kvolumefader_class_dispose;
461
478
462
    _class->xine                       = xine;
479
    _class->xine                       = xine;
(-)a/kdebase-runtime-4.0.4/phonon/xine/xine.desktop (-2 / +12 lines)
Lines 4-23 Link Here
4
MimeType=application/x-annodex;video/quicktime;video/x-quicktime;audio/x-m4a;application/x-quicktimeplayer;video/mkv;video/msvideo;video/x-msvideo;video/x-flic;audio/x-aiff;audio/aiff;audio/x-pn-aiff;audio/x-realaudio;audio/basic;audio/x-basic;audio/x-pn-au;audio/x-8svx;audio/8svx;audio/x-16sv;audio/168sv;image/x-ilbm;image/ilbm;video/x-anim;video/anim;image/png;image/x-png;video/mng;video/x-mng;audio/x-ogg;audio/x-speex+ogg;application/ogg;application/ogg;audio/vnd.rn-realaudio;audio/x-pn-realaudio-plugin;audio/x-real-audio;application/vnd.rn-realmedia;video/mpeg;video/x-mpeg;audio/x-wav;audio/wav;audio/x-pn-wav;audio/x-pn-windows-acm;audio/mpeg2;audio/x-mpeg2;audio/mpeg3;audio/x-mpeg3;audio/mpeg;audio/x-mpeg;x-mpegurl;audio/x-mpegurl;audio/mp3;audio/mpeg;video/x-ms-asf;application/x-flash-video;
4
MimeType=application/x-annodex;video/quicktime;video/x-quicktime;audio/x-m4a;application/x-quicktimeplayer;video/mkv;video/msvideo;video/x-msvideo;video/x-flic;audio/x-aiff;audio/aiff;audio/x-pn-aiff;audio/x-realaudio;audio/basic;audio/x-basic;audio/x-pn-au;audio/x-8svx;audio/8svx;audio/x-16sv;audio/168sv;image/x-ilbm;image/ilbm;video/x-anim;video/anim;image/png;image/x-png;video/mng;video/x-mng;audio/x-ogg;audio/x-speex+ogg;application/ogg;application/ogg;audio/vnd.rn-realaudio;audio/x-pn-realaudio-plugin;audio/x-real-audio;application/vnd.rn-realmedia;video/mpeg;video/x-mpeg;audio/x-wav;audio/wav;audio/x-pn-wav;audio/x-pn-windows-acm;audio/mpeg2;audio/x-mpeg2;audio/mpeg3;audio/x-mpeg3;audio/mpeg;audio/x-mpeg;x-mpegurl;audio/x-mpegurl;audio/mp3;audio/mpeg;video/x-ms-asf;application/x-flash-video;
5
X-KDE-Library=phonon_xine
5
X-KDE-Library=phonon_xine
6
X-KDE-PhononBackendInfo-InterfaceVersion=1
6
X-KDE-PhononBackendInfo-InterfaceVersion=1
7
X-KDE-PhononBackendInfo-Version=0.1
7
X-KDE-PhononBackendInfo-Version=0.2
8
X-KDE-PhononBackendInfo-Website=http://www.xinehq.de/
8
X-KDE-PhononBackendInfo-Website=http://www.xinehq.de/
9
Icon=phonon-xine
9
Icon=phonon-xine
10
InitialPreference=15
10
InitialPreference=15
11
11
12
Name=Xine
12
Name=Xine
13
Name[hi]=एक्साइन
13
Name[hi]=एक्साइन
14
Name[ml]=സൈന്‍
15
Name[mr]=एक्साइन
14
Name[ne]=जाइन
16
Name[ne]=जाइन
15
Name[sr]=Ксине
17
Name[sr]=Ксине
18
Name[ta]=சைன்
16
Name[te]=క్సైన్
19
Name[te]=క్సైన్
17
Name[x-test]=xxXinexx
20
Name[x-test]=xxXinexx
18
21
19
Comment=Phonon Xine backend
22
Comment=Phonon Xine backend
20
Comment[bg]=Заден слой Phonon Xine
23
Comment[bg]=Заден слой Phonon Xine
24
Comment[bn_IN]=Phonon Xine ব্যাক-এন্ড
21
Comment[ca]=Dorsal Xine del Phonon
25
Comment[ca]=Dorsal Xine del Phonon
22
Comment[csb]=Czérownik Phonon Xine
26
Comment[csb]=Czérownik Phonon Xine
23
Comment[da]=Xine-motor til Phonon
27
Comment[da]=Xine-motor til Phonon
Lines 28-36 Link Here
28
Comment[et]=Phononi Xine taustaprogramm
32
Comment[et]=Phononi Xine taustaprogramm
29
Comment[eu]=Phonon Xine interfazea
33
Comment[eu]=Phonon Xine interfazea
30
Comment[fi]=Phonon Xine-taustaosa
34
Comment[fi]=Phonon Xine-taustaosa
31
Comment[fr]=Interface Xine pour Phonon
35
Comment[fr]=Moteur de traitement Xine pour Phonon
32
Comment[ga]=Inneall Phonon Xine
36
Comment[ga]=Inneall Phonon Xine
33
Comment[gl]=Infraestrutura Xine para Phonon
37
Comment[gl]=Infraestrutura Xine para Phonon
38
Comment[gu]=ફોનોન ઝાઇન બેકએન્ડ
34
Comment[he]=ממשק Phonon Xine
39
Comment[he]=ממשק Phonon Xine
35
Comment[hu]=Phonon Xine multimédia rendszer
40
Comment[hu]=Phonon Xine multimédia rendszer
36
Comment[is]=Phonon Xine bakendi
41
Comment[is]=Phonon Xine bakendi
Lines 40-45 Link Here
40
Comment[km]=Phonon Xine កម្មវិធី​ខាង​ក្រោយ​
45
Comment[km]=Phonon Xine កម្មវិធី​ខាង​ក្រោយ​
41
Comment[ko]=Phonon Xine 백엔드
46
Comment[ko]=Phonon Xine 백엔드
42
Comment[lv]=Phonon Xine aizmugure
47
Comment[lv]=Phonon Xine aizmugure
48
Comment[ml]=ഫോനോണ്‍ സൈന്‍ ബാക്കെന്‍ഡ്
49
Comment[mr]=फोनॉन Xine बॅकएन्ड
43
Comment[nb]=Phonon Xine-motor
50
Comment[nb]=Phonon Xine-motor
44
Comment[nds]=Hülpprogramm Xine för Phonon
51
Comment[nds]=Hülpprogramm Xine för Phonon
45
Comment[ne]=फोनोन जाइन ब्याकइन्ड
52
Comment[ne]=फोनोन जाइन ब्याकइन्ड
Lines 56-64 Link Here
56
Comment[sr]=Ксине као позадина Фонона
63
Comment[sr]=Ксине као позадина Фонона
57
Comment[sr@latin]=Xine kao pozadina Phonona
64
Comment[sr@latin]=Xine kao pozadina Phonona
58
Comment[sv]=Phonon Xine-gränssnitt
65
Comment[sv]=Phonon Xine-gränssnitt
66
Comment[tg]=Пуштибонии Phonon Xine
59
Comment[th]=โปรแกรมเบื้องหลัง Phonon Xine
67
Comment[th]=โปรแกรมเบื้องหลัง Phonon Xine
60
Comment[tr]=Phonon Xine arka ucu
68
Comment[tr]=Phonon Xine arka ucu
61
Comment[uk]=Програма Phonon Xine
69
Comment[uk]=Програма Phonon Xine
70
Comment[uz]=Xine tovush xizmati
71
Comment[uz@cyrillic]=Xine товуш хизмати
62
Comment[wa]=Bouye di fond di Phonon Xine
72
Comment[wa]=Bouye di fond di Phonon Xine
63
Comment[x-test]=xxPhonon Xine backendxx
73
Comment[x-test]=xxPhonon Xine backendxx
64
Comment[zh_CN]=Phonon Xine 后端
74
Comment[zh_CN]=Phonon Xine 后端
(-)a/kdebase-runtime-4.0.4/phonon/xine/xinestream.cpp (-8 / +122 lines)
Lines 1-5 Link Here
1
/*  This file is part of the KDE project
1
/*  This file is part of the KDE project
2
    Copyright (C) 2006-2007 Matthias Kretz <kretz@kde.org>
2
    Copyright (C) 2006-2007 Matthias Kretz <kretz@kde.org>
3
    Copyright (C) 2008      Ian Monroe <imonroe@kde.org>
3
4
4
    This program is free software; you can redistribute it and/or
5
    This program is free software; you can redistribute it and/or
5
    modify it under the terms of the GNU Library General Public
6
    modify it under the terms of the GNU Library General Public
Lines 19-37 Link Here
19
*/
20
*/
20
21
21
#include "xinestream.h"
22
#include "xinestream.h"
22
#include "xineengine.h"
23
23
#include <QMutexLocker>
24
#include <QMutexLocker>
24
#include <QEvent>
25
#include <QEvent>
25
#include <QCoreApplication>
26
#include <QCoreApplication>
26
#include <QTimer>
27
#include <QTimer>
28
27
#include <kurl.h>
29
#include <kurl.h>
30
#include <klocale.h>
31
28
#include "audioport.h"
32
#include "audioport.h"
29
#include "videowidget.h"
33
#include "backend.h"
34
#include "bytestream.h"
35
#include "events.h"
30
#include "mediaobject.h"
36
#include "mediaobject.h"
37
#include "videowidget.h"
38
#include "xineengine.h"
31
#include "xinethread.h"
39
#include "xinethread.h"
32
#include <klocale.h>
33
#include "events.h"
34
#include "bytestream.h"
35
40
36
extern "C" {
41
extern "C" {
37
#define this _this_xine_
42
#define this _this_xine_
Lines 65-70 Link Here
65
//    m_startTime(-1),
70
//    m_startTime(-1),
66
    m_totalTime(-1),
71
    m_totalTime(-1),
67
    m_currentTime(-1),
72
    m_currentTime(-1),
73
    m_availableSubtitles(-1),
74
    m_availableAudioChannels(-1),
68
    m_availableTitles(-1),
75
    m_availableTitles(-1),
69
    m_availableChapters(-1),
76
    m_availableChapters(-1),
70
    m_availableAngles(-1),
77
    m_availableAngles(-1),
Lines 130-142 Link Here
130
            // hmm?
137
            // hmm?
131
            abort();
138
            abort();
132
        case XINE_ERROR_NO_INPUT_PLUGIN:
139
        case XINE_ERROR_NO_INPUT_PLUGIN:
133
            error(Phonon::NormalError, i18n("cannot find input plugin for MRL [%1]", m_mrl.constData()));
140
            error(Phonon::NormalError, i18n("Cannot find input plugin for MRL [%1]", m_mrl.constData()));
134
            break;
141
            break;
135
        case XINE_ERROR_NO_DEMUX_PLUGIN:
142
        case XINE_ERROR_NO_DEMUX_PLUGIN:
136
            if (m_mrl.startsWith("kbytestream:/")) {
143
            if (m_mrl.startsWith("kbytestream:/")) {
137
                error(Phonon::FatalError, i18n("cannot find demultiplexer plugin for the given media data"));
144
                error(Phonon::FatalError, i18n("Cannot find demultiplexer plugin for the given media data"));
138
            } else {
145
            } else {
139
                error(Phonon::FatalError, i18n("cannot find demultiplexer plugin for MRL [%1]", m_mrl.constData()));
146
                error(Phonon::FatalError, i18n("Cannot find demultiplexer plugin for MRL [%1]", m_mrl.constData()));
140
            }
147
            }
141
            break;
148
            break;
142
        default:
149
        default:
Lines 547-552 Link Here
547
            QString::fromUtf8(xine_get_meta_info(m_stream, XINE_META_INFO_TRACK_NUMBER)));
554
            QString::fromUtf8(xine_get_meta_info(m_stream, XINE_META_INFO_TRACK_NUMBER)));
548
    metaDataMap.insert(QLatin1String("DESCRIPTION"),
555
    metaDataMap.insert(QLatin1String("DESCRIPTION"),
549
            QString::fromUtf8(xine_get_meta_info(m_stream, XINE_META_INFO_COMMENT)));
556
            QString::fromUtf8(xine_get_meta_info(m_stream, XINE_META_INFO_COMMENT)));
557
    metaDataMap.insert(QLatin1String("MUSICBRAINZ_DISCID"),
558
            QString::fromUtf8(xine_get_meta_info(m_stream, XINE_META_INFO_CDINDEX_DISCID)));
550
    if(metaDataMap == m_metaDataMap)
559
    if(metaDataMap == m_metaDataMap)
551
        return;
560
        return;
552
    m_metaDataMap = metaDataMap;
561
    m_metaDataMap = metaDataMap;
Lines 708-713 Link Here
708
                emit availableAnglesChanged(m_availableAngles);
717
                emit availableAnglesChanged(m_availableAngles);
709
            }
718
            }
710
719
720
            {
721
                int availableSubtitles = subtitlesSize();
722
                if(availableSubtitles != m_availableSubtitles)
723
                {
724
                    kDebug(610) << "available subtitles changed: " << availableSubtitles;
725
                    m_availableSubtitles = availableSubtitles;
726
                    emit availableSubtitlesChanged();
727
                }
728
            }
729
            {
730
                int availableAudioChannels = audioChannelsSize();
731
                if(availableAudioChannels != m_availableAudioChannels)
732
                {
733
                    kDebug(610) << "available audio channels changed: " << availableAudioChannels;
734
                    m_availableAudioChannels = availableAudioChannels;
735
                    emit availableAudioChannelsChanged();
736
                }
737
            }
738
711
            int currentTitle   = xine_get_stream_info(m_stream, XINE_STREAM_INFO_DVD_TITLE_NUMBER);
739
            int currentTitle   = xine_get_stream_info(m_stream, XINE_STREAM_INFO_DVD_TITLE_NUMBER);
712
            int currentChapter = xine_get_stream_info(m_stream, XINE_STREAM_INFO_DVD_CHAPTER_NUMBER);
740
            int currentChapter = xine_get_stream_info(m_stream, XINE_STREAM_INFO_DVD_CHAPTER_NUMBER);
713
            int currentAngle   = xine_get_stream_info(m_stream, XINE_STREAM_INFO_DVD_ANGLE_NUMBER);
741
            int currentAngle   = xine_get_stream_info(m_stream, XINE_STREAM_INFO_DVD_ANGLE_NUMBER);
Lines 1250-1255 Link Here
1250
    return m_errorType;
1278
    return m_errorType;
1251
}
1279
}
1252
1280
1281
#if KDE_IS_VERSION(4,1,0)
1282
QList<SubtitleDescription> XineStream::availableSubtitles() const
1283
{
1284
    uint hash = streamHash();
1285
    QList<SubtitleDescription> subtitles;
1286
    if( !m_stream )
1287
        return subtitles;
1288
    const int channels = subtitlesSize();
1289
    for( int index = 0; index < channels; index++ )
1290
    {
1291
        subtitles << streamDescription<SubtitleDescription>( index, hash, SubtitleType, xine_get_spu_lang );
1292
    }
1293
    return subtitles;
1294
}
1295
1296
1297
QList<AudioChannelDescription> XineStream::availableAudioChannels() const
1298
{
1299
    const uint hash = streamHash();
1300
    QList<AudioChannelDescription> audios;
1301
    if( !m_stream )
1302
        return audios;
1303
    const int channels = audioChannelsSize();
1304
    for( int index = 0; index < channels; index++ )
1305
    {
1306
        audios << streamDescription<AudioChannelDescription>( index, hash, AudioChannelType, xine_get_audio_lang );
1307
    }
1308
    return audios;
1309
}
1310
#endif
1311
1312
int XineStream::subtitlesSize() const
1313
{
1314
    return xine_get_stream_info( m_stream, XINE_STREAM_INFO_MAX_SPU_CHANNEL );
1315
}
1316
1317
int XineStream::audioChannelsSize() const
1318
{
1319
    return xine_get_stream_info( m_stream, XINE_STREAM_INFO_MAX_AUDIO_CHANNEL );
1320
}
1321
1322
#if KDE_IS_VERSION(4,1,0)
1323
void XineStream::setCurrentAudioChannel(const AudioChannelDescription& streamDesc)
1324
{
1325
    xine_set_param( m_stream, XINE_PARAM_AUDIO_CHANNEL_LOGICAL, streamDesc.index() - streamHash() );
1326
}
1327
1328
void XineStream::setCurrentSubtitle(const SubtitleDescription& streamDesc)
1329
{
1330
    kDebug() << "setting the subtitle to: " << streamDesc.index();
1331
    xine_set_param( m_stream, XINE_PARAM_SPU_CHANNEL, streamDesc.index() - streamHash() );
1332
}
1333
#endif
1334
1335
uint XineStream::streamHash() const
1336
{
1337
    return qHash( m_mrl );
1338
}
1339
1340
template<class S>
1341
S XineStream::streamDescription(int index, uint hash, ObjectDescriptionType type, int(*get_xine_stream_text)(xine_stream_t *stream, int channel, char *lang)) const
1342
{
1343
    QByteArray lang;
1344
    lang.resize( 150 );
1345
    get_xine_stream_text( m_stream, index, lang.data() );
1346
    QHash<QByteArray, QVariant> properities;
1347
    properities.insert( "name", QString( lang ) );
1348
    //XineEngine::setObjectDescriptionProperities( type, index + hash, properities );
1349
    return S( index + hash, properities );
1350
}
1351
1352
#if KDE_IS_VERSION(4,1,0)
1353
AudioChannelDescription XineStream::currentAudioChannel() const
1354
{
1355
    const int index = xine_get_param( m_stream, XINE_PARAM_AUDIO_CHANNEL_LOGICAL );
1356
    return streamDescription<AudioChannelDescription>( index, streamHash(), AudioChannelType, xine_get_audio_lang );
1357
}
1358
1359
SubtitleDescription XineStream::currentSubtitle() const
1360
{
1361
    int index = xine_get_param( m_stream, XINE_PARAM_SPU_CHANNEL );
1362
    return streamDescription<SubtitleDescription>( index, streamHash(), SubtitleType, xine_get_spu_lang );
1363
}
1364
#endif
1365
1366
1253
xine_post_out_t *XineStream::audioOutputPort() const
1367
xine_post_out_t *XineStream::audioOutputPort() const
1254
{
1368
{
1255
    if (!m_stream) {
1369
    if (!m_stream) {
(-)a/kdebase-runtime-4.0.4/phonon/xine/xinestream.h (+23 lines)
Lines 31-38 Link Here
31
#include <QtCore/QTimer>
31
#include <QtCore/QTimer>
32
32
33
#include <Phonon/Global>
33
#include <Phonon/Global>
34
#include <Phonon/ObjectDescription>
34
35
35
#include <xine.h>
36
#include <xine.h>
37
#include <kdeversion.h>
36
38
37
#include <sys/time.h>
39
#include <sys/time.h>
38
#include <time.h>
40
#include <time.h>
Lines 105-110 Link Here
105
        int currentAngle()      const { return m_currentAngle;      }
107
        int currentAngle()      const { return m_currentAngle;      }
106
        int currentTitle()      const { return m_currentTitle;      }
108
        int currentTitle()      const { return m_currentTitle;      }
107
109
110
#if KDE_IS_VERSION(4,1,0)
111
        QList<AudioChannelDescription> availableAudioChannels() const;
112
        QList<SubtitleDescription> availableSubtitles() const;
113
114
        AudioChannelDescription currentAudioChannel() const;
115
        SubtitleDescription currentSubtitle() const;
116
117
        void setCurrentAudioChannel(const AudioChannelDescription& streamDesc);
118
        void setCurrentSubtitle(const SubtitleDescription& streamDesc);
119
#endif
120
121
        int subtitlesSize() const;
122
        int audioChannelsSize() const;
123
108
        enum StateForNewMrl {
124
        enum StateForNewMrl {
109
            // no use: Loading, Error, Buffering
125
            // no use: Loading, Error, Buffering
110
            StoppedState = Phonon::StoppedState,
126
            StoppedState = Phonon::StoppedState,
Lines 143-148 Link Here
143
        void hasVideoChanged(bool);
159
        void hasVideoChanged(bool);
144
        void bufferStatus(int);
160
        void bufferStatus(int);
145
161
162
        void availableSubtitlesChanged();
163
        void availableAudioChannelsChanged();
146
        void availableChaptersChanged(int);
164
        void availableChaptersChanged(int);
147
        void chapterChanged(int);
165
        void chapterChanged(int);
148
        void availableAnglesChanged(int);
166
        void availableAnglesChanged(int);
Lines 177-182 Link Here
177
        void internalPause();
195
        void internalPause();
178
        void internalPlay();
196
        void internalPlay();
179
        void setMrlInternal(const QByteArray &newMrl);
197
        void setMrlInternal(const QByteArray &newMrl);
198
        template<class S>
199
        S streamDescription(int index, uint hash, ObjectDescriptionType type, int(*get_xine_stream_text)(xine_stream_t *stream, int channel, char *lang)) const;
200
        uint streamHash() const;
180
201
181
        xine_stream_t *m_stream;
202
        xine_stream_t *m_stream;
182
        xine_event_queue_t *m_event_queue;
203
        xine_event_queue_t *m_event_queue;
Lines 209-214 Link Here
209
        int m_totalTime;
230
        int m_totalTime;
210
        int m_currentTime;
231
        int m_currentTime;
211
        int m_waitForPlayingTimerId;
232
        int m_waitForPlayingTimerId;
233
        int m_availableSubtitles;
234
        int m_availableAudioChannels;
212
        int m_availableTitles;
235
        int m_availableTitles;
213
        int m_availableChapters;
236
        int m_availableChapters;
214
        int m_availableAngles;
237
        int m_availableAngles;

Return to bug 387406