~ubuntu-branches/ubuntu/natty/phonon/natty

« back to all changes in this revision

Viewing changes to xine/events.h

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2011-01-24 10:12:11 UTC
  • mfrom: (0.5.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20110124101211-w9rew7q0dmwbwhqx
Tags: 4:4.7.0really4.4.4-0ubuntu1
* New upstream release
* Xine and GStreamer backends now split out source, remove build-deps and
  binary packages from debian/control
* Remove 02_no_rpath.patch, now upstream
* Disable kubuntu04_no_va_mangle.patch, no longer applies
* Remove kubuntu_05_gst_codec_installer_window_id.diff, kubuntu_06_forward_events.diff,
  kubuntu_07_include_fix.diff, gstreamer now separate

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*  This file is part of the KDE project
2
 
    Copyright (C) 2007 Matthias Kretz <kretz@kde.org>
3
 
 
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.
8
 
 
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.
13
 
 
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.
18
 
 
19
 
*/
20
 
 
21
 
#ifndef PHONON_XINE_EVENTS_H
22
 
#define PHONON_XINE_EVENTS_H
23
 
 
24
 
#include "wirecall.h"
25
 
#include "xinestream.h"
26
 
 
27
 
#include <QtCore/QEvent>
28
 
#include <QtCore/QSize>
29
 
#include <QtCore/QPair>
30
 
#include <QtCore/QList>
31
 
#include <QtGui/QImage>
32
 
 
33
 
#define QEVENT(type) Event(Event::type)
34
 
 
35
 
#define EVENT_CLASS0(type) \
36
 
class type##Event : public Event \
37
 
{ \
38
 
    public: \
39
 
        inline type##Event() : QEVENT(type) {} \
40
 
}; \
41
 
template <> inline type##Event *copyEvent<type##Event>(type##Event *) \
42
 
{ \
43
 
    return new type##Event(); \
44
 
}
45
 
#define EVENT_CLASS1(type, arg1, init1, member1type, member1name) \
46
 
class type##Event : public Event \
47
 
{ \
48
 
    public: \
49
 
        inline type##Event(arg1) : QEVENT(type), init1 {} \
50
 
        member1type member1name; \
51
 
}; \
52
 
template <> inline type##Event *copyEvent<type##Event>(type##Event *e) \
53
 
{ \
54
 
    return new type##Event(static_cast<type##Event *>(e)->member1name); \
55
 
}
56
 
#define EVENT_CLASS2(type, arg1, arg2, init1, init2, member1type, member1name, member2type, member2name) \
57
 
class type##Event : public Event \
58
 
{ \
59
 
    public: \
60
 
        inline type##Event(arg1, arg2) : QEVENT(type), init1, init2 {} \
61
 
        member1type member1name; \
62
 
        member2type member2name; \
63
 
}; \
64
 
template <> inline type##Event *copyEvent<type##Event>(type##Event *e) \
65
 
{ \
66
 
    return new type##Event(static_cast<type##Event *>(e)->member1name, static_cast<type##Event *>(e)->member2name); \
67
 
}
68
 
namespace Phonon
69
 
{
70
 
namespace Xine
71
 
{
72
 
 
73
 
 
74
 
class Event : public QEvent
75
 
{
76
 
public:
77
 
    enum Type {
78
 
        GetStreamInfo = 2001,
79
 
        UpdateVolume,
80
 
        RewireVideoToNull,
81
 
        PlayCommand,
82
 
        PauseCommand,
83
 
        StopCommand,
84
 
        SeekCommand,
85
 
        MrlChanged,
86
 
        TransitionTypeChanged,
87
 
        GaplessSwitch,
88
 
        UpdateTime,
89
 
        SetTickInterval,
90
 
        SetPrefinishMark,
91
 
        SetParam,
92
 
        EventSend,
93
 
        QuitLoop,
94
 
        PauseForBuffering,
95
 
        UnpauseForBuffering,
96
 
        Error,
97
 
        NewStream,
98
 
        NewMetaData,
99
 
        MediaFinished,
100
 
        Progress,
101
 
        NavButtonIn,
102
 
        NavButtonOut,
103
 
        AudioDeviceFailed,
104
 
        FrameFormatChange,
105
 
        UiChannelsChanged,
106
 
        Reference,
107
 
        Rewire,
108
 
        HasVideo,
109
 
        IsThereAXineEngineForMe,
110
 
        NoThereIsNoXineEngineForYou,
111
 
        HeresYourXineStream,
112
 
        Cleanup,
113
 
        RequestSnapshot,
114
 
        UnloadCommand
115
 
    };
116
 
 
117
 
    int ref;
118
 
 
119
 
    inline Event(Type t) : QEvent(static_cast<QEvent::Type>(t)), ref(1) {}
120
 
 
121
 
    inline Type type() const { return static_cast<Type>(QEvent::type()); }
122
 
}; // class Event
123
 
 
124
 
template<typename T>
125
 
inline T *copyEvent(T *)
126
 
{
127
 
    abort();
128
 
    return 0;
129
 
}
130
 
 
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)
138
 
 
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)
146
 
 
147
 
class FrameFormatChangeEvent : public Event
148
 
{
149
 
    public:
150
 
        FrameFormatChangeEvent(int w, int h, int a, bool ps)
151
 
            : QEVENT(FrameFormatChange),
152
 
            size(w, h), aspect(a), panScan(ps) {}
153
 
 
154
 
        const QSize size;
155
 
        const int aspect;
156
 
        const bool panScan;
157
 
};
158
 
template <> inline FrameFormatChangeEvent *copyEvent<FrameFormatChangeEvent>(FrameFormatChangeEvent *e)
159
 
{
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);
161
 
}
162
 
 
163
 
class SeekCommandEvent : public Event
164
 
{
165
 
    public:
166
 
        SeekCommandEvent(qint64 t) : QEVENT(SeekCommand), time(t) {}
167
 
        const qint64 time;
168
 
};
169
 
template <> inline SeekCommandEvent *copyEvent<SeekCommandEvent>(SeekCommandEvent *e)
170
 
{
171
 
    return new SeekCommandEvent(static_cast<SeekCommandEvent *>(e)->time);
172
 
}
173
 
 
174
 
} // namespace Xine
175
 
} // namespace Phonon
176
 
 
177
 
#undef EVENT_CLASS1
178
 
#undef EVENT_CLASS2
179
 
 
180
 
#endif // PHONON_XINE_EVENTS_H