~ubuntu-branches/ubuntu/saucy/phonon-backend-gstreamer/saucy-proposed

« back to all changes in this revision

Viewing changes to gstreamer/videowidget.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2011-04-15 14:43:30 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20110415144330-7uif3319lxdu4ltt
Tags: 4:4.7.0really4.5.0-0ubuntu2
* New upstream release
* Add kubuntu_02_install_codec.diff to fix codec install

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
#include <gst/interfaces/propertyprobe.h>
29
29
#include "abstractrenderer.h"
30
30
#include "backend.h"
31
 
#include "common.h"
32
31
#include "devicemanager.h"
33
32
#include "mediaobject.h"
34
 
#include "message.h"
35
33
 
36
34
#include "glrenderer.h"
37
35
#include "widgetrenderer.h"
61
59
    m_videoplug(0)
62
60
{
63
61
    setupVideoBin();
 
62
    setFocusPolicy(Qt::ClickFocus);
64
63
}
65
64
 
66
65
VideoWidget::~VideoWidget()
86
85
    gst_object_ref (GST_OBJECT (m_videoBin)); //Take ownership
87
86
    gst_object_sink (GST_OBJECT (m_videoBin));
88
87
    QByteArray tegraEnv = qgetenv("TEGRA_GST_OPENMAX");
89
 
    if(tegraEnv.isEmpty())
90
 
    {
 
88
    if (tegraEnv.isEmpty()) {
91
89
        //The videoplug element is the final element before the pluggable videosink
92
90
        m_videoplug = gst_element_factory_make ("identity", NULL);
93
91
 
128
126
                m_isValid = true; //initialization ok, accept input
129
127
            }
130
128
        }
131
 
    }
132
 
    else
133
 
    {
 
129
    } else {
134
130
        gst_bin_add_many (GST_BIN (m_videoBin), videoSink, NULL);
135
131
        GstPad *videopad = gst_element_get_pad (videoSink,"sink");
136
132
        gst_element_add_pad (m_videoBin, gst_ghost_pad_new ("sink", videopad));
139
135
        if (parentWidget)
140
136
            parentWidget->winId();  // Due to some existing issues with alien in 4.4,
141
137
                                    //  we must currently force the creation of a parent widget.
142
 
            m_isValid = true; //initialization ok, accept input
 
138
        m_isValid = true; //initialization ok, accept input
143
139
    }
144
140
}
145
141
 
302
298
void VideoWidget::setBrightness(qreal newValue)
303
299
{
304
300
   GstElement *videoSink = m_renderer->videoSink();
305
 
   QByteArray tegraEnv = qgetenv("TEGRA_GST_OPENMAX");
306
301
 
307
302
   newValue = clampedValue(newValue);
308
 
   
 
303
 
309
304
    if (newValue == m_brightness)
310
305
        return;
311
306
 
312
307
    m_brightness = newValue;
313
308
 
314
 
    if (tegraEnv.isEmpty())
315
 
    {
 
309
    QByteArray tegraEnv = qgetenv("TEGRA_GST_OPENMAX");
 
310
    if (tegraEnv.isEmpty()) {
316
311
        if (m_videoBalance)
317
 
        g_object_set(G_OBJECT(m_videoBalance), "brightness", newValue, (const char*)NULL); //gstreamer range is [-1, 1]
318
 
    }
319
 
    else
320
 
    {
321
 
        if (videoSink)   
322
 
        g_object_set(G_OBJECT(videoSink), "brightness", newValue, (const char*)NULL); //gstreamer range is [-1, 1]
323
 
 
 
312
            g_object_set(G_OBJECT(m_videoBalance), "brightness", newValue, (const char*)NULL); //gstreamer range is [-1, 1]
 
313
    } else {
 
314
        if (videoSink)
 
315
            g_object_set(G_OBJECT(videoSink), "brightness", newValue, (const char*)NULL); //gstreamer range is [-1, 1]
324
316
    }
325
317
}
326
318
 
342
334
 
343
335
    m_contrast = newValue;
344
336
 
345
 
    if (tegraEnv.isEmpty())
346
 
    {
 
337
    if (tegraEnv.isEmpty()) {
347
338
        if (m_videoBalance)
348
 
        g_object_set(G_OBJECT(m_videoBalance), "contrast", (newValue + 1.0), (const char*)NULL); //gstreamer range is [0-2]
349
 
    }
350
 
    else
351
 
    {
 
339
            g_object_set(G_OBJECT(m_videoBalance), "contrast", (newValue + 1.0), (const char*)NULL); //gstreamer range is [0-2]
 
340
    } else {
352
341
       if (videoSink)
353
 
       g_object_set(G_OBJECT(videoSink), "contrast", (newValue + 1.0), (const char*)NULL); //gstreamer range is [0-2]
 
342
           g_object_set(G_OBJECT(videoSink), "contrast", (newValue + 1.0), (const char*)NULL); //gstreamer range is [0-2]
354
343
    }
355
344
}
356
345
 
381
370
{
382
371
 
383
372
    GstElement *videoSink = m_renderer->videoSink();
384
 
    QByteArray tegraEnv = qgetenv("TEGRA_GST_OPENMAX");
385
373
 
386
374
    newValue = clampedValue(newValue);
387
375
 
390
378
 
391
379
    m_saturation = newValue;
392
380
 
393
 
    if (tegraEnv.isEmpty())
394
 
    {
395
 
    if (m_videoBalance)
396
 
        g_object_set(G_OBJECT(m_videoBalance), "saturation", newValue + 1.0, (const char*)NULL); //gstreamer range is [0, 2]
397
 
    }
398
 
    else
399
 
    {
400
 
       if (videoSink)
401
 
       g_object_set(G_OBJECT(videoSink), "saturation", newValue + 1.0, (const char*)NULL); //gstreamer range is [0, 2] 
 
381
    QByteArray tegraEnv = qgetenv("TEGRA_GST_OPENMAX");
 
382
    if (tegraEnv.isEmpty()) {
 
383
        if (m_videoBalance)
 
384
            g_object_set(G_OBJECT(m_videoBalance), "saturation", newValue + 1.0, (const char*)NULL); //gstreamer range is [0, 2]
 
385
    } else {
 
386
        if (videoSink)
 
387
            g_object_set(G_OBJECT(videoSink), "saturation", newValue + 1.0, (const char*)NULL); //gstreamer range is [0, 2]
402
388
    }
403
389
}
404
390