author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 06 Jul 2010 15:10:48 +0300 | |
changeset 30 | 5dc02b23752f |
parent 0 | 1918ee327afb |
permissions | -rw-r--r-- |
0 | 1 |
/* This file is part of the KDE project. |
2 |
||
3 |
Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
4 |
||
5 |
This library is free software: you can redistribute it and/or modify |
|
6 |
it under the terms of the GNU Lesser General Public License as published by |
|
7 |
the Free Software Foundation, either version 2.1 or 3 of the License. |
|
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 |
|
12 |
GNU Lesser General Public License for more details. |
|
13 |
||
14 |
You should have received a copy of the GNU Lesser General Public License |
|
15 |
along with this library. If not, see <http://www.gnu.org/licenses/>. |
|
16 |
*/ |
|
17 |
||
18 |
#ifndef Phonon_GSTREAMER_VIDEOSINK_H |
|
19 |
#define Phonon_GSTREAMER_VIDEOSINK_H |
|
20 |
||
21 |
#include "common.h" |
|
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
22 |
#include "qwidgetvideosink.h" |
0 | 23 |
|
24 |
#include <QtCore/QByteArray> |
|
25 |
#include <QtCore/QEvent> |
|
26 |
||
27 |
#include <gst/video/gstvideosink.h> |
|
28 |
||
29 |
QT_BEGIN_NAMESPACE |
|
30 |
||
31 |
class NewFrameEvent : public QEvent |
|
32 |
{ |
|
33 |
public: |
|
34 |
NewFrameEvent(const QByteArray &newFrame, int w, int h) : |
|
35 |
QEvent(QEvent::User), |
|
36 |
frame(newFrame), |
|
37 |
width(w), |
|
38 |
height(h) |
|
39 |
{ |
|
40 |
} |
|
41 |
||
42 |
QByteArray frame; |
|
43 |
int width; |
|
44 |
int height; |
|
45 |
}; |
|
46 |
||
47 |
namespace Phonon |
|
48 |
{ |
|
49 |
namespace Gstreamer |
|
50 |
{ |
|
51 |
||
52 |
enum VideoFormat { |
|
53 |
VideoFormat_YUV, |
|
54 |
VideoFormat_RGB |
|
55 |
}; |
|
56 |
||
57 |
class QWidgetVideoSinkBase |
|
58 |
{ |
|
59 |
public: |
|
60 |
GstVideoSink videoSink; |
|
61 |
||
62 |
QWidget * renderWidget; |
|
63 |
gint width; |
|
64 |
gint height; |
|
65 |
gint bpp; |
|
66 |
gint depth; |
|
67 |
}; |
|
68 |
||
69 |
template <VideoFormat FMT> |
|
70 |
class QWidgetVideoSink : public QWidgetVideoSinkBase |
|
71 |
{ |
|
72 |
public: |
|
73 |
static GstCaps* get_caps(GstBaseSink* sink); |
|
74 |
static gboolean set_caps(GstBaseSink* sink, GstCaps* caps); |
|
75 |
static GstStateChangeReturn change_state(GstElement* element, GstStateChange transition); |
|
76 |
static GstFlowReturn render(GstBaseSink* sink, GstBuffer* buf); |
|
77 |
static void base_init(gpointer g_class); |
|
78 |
static void instance_init(GTypeInstance *instance, gpointer g_class); |
|
79 |
}; |
|
80 |
||
81 |
template <VideoFormat FMT> |
|
82 |
struct QWidgetVideoSinkClass |
|
83 |
{ |
|
84 |
GstVideoSinkClass parent_class; |
|
85 |
static void class_init(gpointer g_class, gpointer class_data); |
|
86 |
static GType get_type(); |
|
87 |
static const char* get_name(); |
|
88 |
}; |
|
89 |
||
90 |
GType get_type_YUV(); |
|
91 |
GType get_type_RGB(); |
|
92 |
||
93 |
} |
|
94 |
} //namespace Phonon::Gstreamer |
|
95 |
||
96 |
QT_END_NAMESPACE |
|
97 |
||
98 |
#endif // Phonon_GSTREAMER_VIDEOSINK_H |