source: trunk/src/3rdparty/phonon/gstreamer/qwidgetvideosink.h

Last change on this file was 846, checked in by Dmitry A. Kuminov, 15 years ago

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

File size: 2.4 KB
Line 
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"
22#include "qwidgetvideosink.h"
23
24#include <QtCore/QByteArray>
25#include <QtCore/QEvent>
26
27#include <gst/video/gstvideosink.h>
28
29QT_BEGIN_NAMESPACE
30
31class NewFrameEvent : public QEvent
32{
33public:
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
47namespace Phonon
48{
49namespace Gstreamer
50{
51
52enum VideoFormat {
53 VideoFormat_YUV,
54 VideoFormat_RGB
55};
56
57class QWidgetVideoSinkBase
58{
59public:
60 GstVideoSink videoSink;
61
62 QWidget * renderWidget;
63 gint width;
64 gint height;
65 gint bpp;
66 gint depth;
67};
68
69template <VideoFormat FMT>
70class QWidgetVideoSink : public QWidgetVideoSinkBase
71{
72public:
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
81template <VideoFormat FMT>
82struct 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
90GType get_type_YUV();
91GType get_type_RGB();
92
93}
94} //namespace Phonon::Gstreamer
95
96QT_END_NAMESPACE
97
98#endif // Phonon_GSTREAMER_VIDEOSINK_H
Note: See TracBrowser for help on using the repository browser.