1
/* This file is part of the KDE project
2
Copyright (C) 2007 Matthias Kretz <kretz@kde.org>
4
This program is free software; you can redistribute it and/or
5
modify it under the terms of the GNU Library General Public
6
License as published by the Free Software Foundation; either
7
version 2 of the License, or (at your option) any later version.
9
This library is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
Library General Public License for more details.
14
You should have received a copy of the GNU Library General Public License
15
along with this library; see the file COPYING.LIB. If not, write to
16
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17
Boston, MA 02110-1301, USA.
21
#ifndef PHONON_XINE_EVENTS_H
22
#define PHONON_XINE_EVENTS_H
25
#include "xinestream.h"
27
#include <QtCore/QEvent>
28
#include <QtCore/QSize>
29
#include <QtCore/QPair>
30
#include <QtCore/QList>
31
#include <QtGui/QImage>
33
#define QEVENT(type) Event(Event::type)
35
#define EVENT_CLASS0(type) \
36
class type##Event : public Event \
39
inline type##Event() : QEVENT(type) {} \
41
template <> inline type##Event *copyEvent<type##Event>(type##Event *) \
43
return new type##Event(); \
45
#define EVENT_CLASS1(type, arg1, init1, member1type, member1name) \
46
class type##Event : public Event \
49
inline type##Event(arg1) : QEVENT(type), init1 {} \
50
member1type member1name; \
52
template <> inline type##Event *copyEvent<type##Event>(type##Event *e) \
54
return new type##Event(static_cast<type##Event *>(e)->member1name); \
56
#define EVENT_CLASS2(type, arg1, arg2, init1, init2, member1type, member1name, member2type, member2name) \
57
class type##Event : public Event \
60
inline type##Event(arg1, arg2) : QEVENT(type), init1, init2 {} \
61
member1type member1name; \
62
member2type member2name; \
64
template <> inline type##Event *copyEvent<type##Event>(type##Event *e) \
66
return new type##Event(static_cast<type##Event *>(e)->member1name, static_cast<type##Event *>(e)->member2name); \
74
class Event : public QEvent
86
TransitionTypeChanged,
109
IsThereAXineEngineForMe,
110
NoThereIsNoXineEngineForYou,
119
inline Event(Type t) : QEvent(static_cast<QEvent::Type>(t)), ref(1) {}
121
inline Type type() const { return static_cast<Type>(QEvent::type()); }
125
inline T *copyEvent(T *)
131
EVENT_CLASS1(HeresYourXineStream, QExplicitlySharedDataPointer<XineStream> s, stream(s), QExplicitlySharedDataPointer<XineStream>, stream)
132
EVENT_CLASS1(HasVideo, bool v, hasVideo(v), const bool, hasVideo)
133
EVENT_CLASS1(UpdateVolume, int v, volume(v), const int, volume)
134
EVENT_CLASS1(EventSend, const xine_event_t *const e, event(e), const xine_event_t *const, event)
135
EVENT_CLASS1(GaplessSwitch, const QByteArray &_mrl, mrl(_mrl), const QByteArray, mrl)
136
EVENT_CLASS1(SetTickInterval, qint32 i, interval(i), const qint32, interval)
137
EVENT_CLASS1(SetPrefinishMark, qint32 i, time(i), const qint32, time)
139
EVENT_CLASS2(RequestSnapshot, QImage& i, QWaitCondition *w, image(i), waitCondition(w), QImage&, image, QWaitCondition *, waitCondition)
140
EVENT_CLASS2(Rewire, QList<WireCall> _wireCalls, QList<WireCall> _unwireCalls, wireCalls(_wireCalls), unwireCalls(_unwireCalls), const QList<WireCall>, wireCalls, const QList<WireCall>, unwireCalls)
141
EVENT_CLASS2(Reference, bool alt, const QByteArray &m, alternative(alt), mrl(m), const bool, alternative, const QByteArray, mrl)
142
EVENT_CLASS2(Progress, const QString &d, int p, description(d), percent(p), const QString, description, const int, percent)
143
EVENT_CLASS2(Error, Phonon::ErrorType t, const QString &r, type(t), reason(r), const Phonon::ErrorType, type, const QString, reason)
144
EVENT_CLASS2(SetParam, int p, int v, param(p), value(v), const int, param, const int, value)
145
EVENT_CLASS2(MrlChanged, const QByteArray &_mrl, XineStream::StateForNewMrl _s, mrl(_mrl), stateForNewMrl(_s), const QByteArray, mrl, const XineStream::StateForNewMrl, stateForNewMrl)
147
class FrameFormatChangeEvent : public Event
150
FrameFormatChangeEvent(int w, int h, int a, bool ps)
151
: QEVENT(FrameFormatChange),
152
size(w, h), aspect(a), panScan(ps) {}
158
template <> inline FrameFormatChangeEvent *copyEvent<FrameFormatChangeEvent>(FrameFormatChangeEvent *e)
160
return new FrameFormatChangeEvent(static_cast<FrameFormatChangeEvent *>(e)->size.width(), static_cast<FrameFormatChangeEvent *>(e)->size.height(), static_cast<FrameFormatChangeEvent *>(e)->aspect, static_cast<FrameFormatChangeEvent *>(e)->panScan);
163
class SeekCommandEvent : public Event
166
SeekCommandEvent(qint64 t) : QEVENT(SeekCommand), time(t) {}
169
template <> inline SeekCommandEvent *copyEvent<SeekCommandEvent>(SeekCommandEvent *e)
171
return new SeekCommandEvent(static_cast<SeekCommandEvent *>(e)->time);
175
} // namespace Phonon
180
#endif // PHONON_XINE_EVENTS_H