Added a function to reset all capabilities
[harmattan/cameraplus] / lib / qtcamviewfinderrenderermeego.h
1 // -*- c++ -*-
2
3 #ifndef QT_CAM_VIEWFINDER_RENDERER_MEEGO_H
4 #define QT_CAM_VIEWFINDER_RENDERER_MEEGO_H
5
6 #include "qtcamviewfinderrenderer.h"
7 #include <QImage>
8 #include <QMutex>
9 #include <QMatrix4x4>
10 #include <GLES2/gl2.h>
11
12 class QGLShaderProgram;
13
14 class QtCamViewfinderRendererMeeGo : public QtCamViewfinderRenderer {
15   Q_OBJECT
16
17 public:
18   Q_INVOKABLE QtCamViewfinderRendererMeeGo(QtCamConfig *config, QObject *parent = 0);
19
20   ~QtCamViewfinderRendererMeeGo();
21
22   virtual void paint(QPainter *painter);
23   virtual void resize(const QSizeF& size);
24   virtual void reset();
25   virtual GstElement *sinkElement();
26
27 private slots:
28   void setVideoSize(const QSizeF& size);
29
30 private:
31   static void frame_ready(GstElement *sink, int frame, QtCamViewfinderRendererMeeGo *r);
32   static void sink_notify(QtCamViewfinderRendererMeeGo *q, GObject *object, gboolean is_last_ref);
33   static void sink_caps_changed(GObject *obj, GParamSpec *pspec, QtCamViewfinderRendererMeeGo *q);
34
35   void calculateProjectionMatrix(const QRectF& rect);
36   void createProgram();
37   void paintFrame(QPainter *painter, int frame);
38   void calculateCoords();
39   QRectF renderArea();
40
41   QtCamConfig *m_conf;
42   GstElement *m_sink;
43   QMutex m_frameMutex;
44   int m_frame;
45   unsigned long m_id;
46   unsigned long m_notify;
47   bool m_needsInit;
48   QGLShaderProgram *m_program;
49   QMatrix4x4 m_projectionMatrix;
50   GLfloat m_vertexCoords[8];
51   GLfloat m_texCoords[8];
52   QSizeF m_size;
53   QSizeF m_videoSize;
54   QRectF m_renderArea;
55 };
56
57 #endif /* QT_CAM_VIEWFINDER_RENDERER_MEEGO_H */