Exemplo n.º 1
0
QT_BEGIN_NAMESPACE

CameraBinService::CameraBinService(GstElementFactory *sourceFactory, QObject *parent):
    QMediaService(parent),
    m_cameraInfoControl(0)
{
    m_captureSession = 0;
    m_metaDataControl = 0;

    m_audioInputSelector = 0;
    m_videoInputDevice = 0;

    m_videoOutput = 0;
    m_videoRenderer = 0;
    m_videoWindow = 0;
#if defined(HAVE_WIDGETS)
    m_videoWidgetControl = 0;
#endif
    m_imageCaptureControl = 0;

    m_captureSession = new CameraBinSession(sourceFactory, this);
    m_videoInputDevice = new QGstreamerVideoInputDeviceControl(sourceFactory, m_captureSession);
    m_imageCaptureControl = new CameraBinImageCapture(m_captureSession);

    connect(m_videoInputDevice, SIGNAL(selectedDeviceChanged(QString)),
            m_captureSession, SLOT(setDevice(QString)));

    if (m_videoInputDevice->deviceCount())
        m_captureSession->setDevice(m_videoInputDevice->deviceName(m_videoInputDevice->selectedDevice()));

#if defined(Q_WS_MAEMO_6) && defined(__arm__) && defined(HAVE_WIDGETS)
    m_videoRenderer = new QGstreamerGLTextureRenderer(this);
#else
    m_videoRenderer = new QGstreamerVideoRenderer(this);
#endif

#ifdef Q_WS_MAEMO_6
    m_videoWindow = new QGstreamerVideoWindow(this, "omapxvsink");
#else
    m_videoWindow = new QGstreamerVideoWindow(this);
#endif

#if defined(HAVE_WIDGETS)
    m_videoWidgetControl = new QGstreamerVideoWidgetControl(this);
#endif

    m_audioInputSelector = new QGstreamerAudioInputSelector(this);
    connect(m_audioInputSelector, SIGNAL(activeInputChanged(QString)), m_captureSession, SLOT(setCaptureDevice(QString)));

    if (m_captureSession && m_audioInputSelector->availableInputs().size() > 0)
        m_captureSession->setCaptureDevice(m_audioInputSelector->defaultInput());

    m_metaDataControl = new CameraBinMetaData(this);
    connect(m_metaDataControl, SIGNAL(metaDataChanged(QMap<QByteArray,QVariant>)),
            m_captureSession, SLOT(setMetaData(QMap<QByteArray,QVariant>)));

#if defined(Q_WS_MAEMO_6)
    new CameraButtonListener(this);
#endif
}
Exemplo n.º 2
0
QT_BEGIN_NAMESPACE

CameraBinService::CameraBinService(GstElementFactory *sourceFactory, QObject *parent):
    QMediaService(parent),
    m_cameraInfoControl(0),
    m_viewfinderSettingsControl(0),
    m_viewfinderSettingsControl2(0)
{
    m_captureSession = 0;
    m_metaDataControl = 0;

    m_audioInputSelector = 0;
    m_videoInputDevice = 0;

    m_videoOutput = 0;
    m_videoRenderer = 0;
    m_videoWindow = 0;
#if defined(HAVE_WIDGETS)
    m_videoWidgetControl = 0;
#endif
    m_imageCaptureControl = 0;

    m_captureSession = new CameraBinSession(sourceFactory, this);
    m_videoInputDevice = new QGstreamerVideoInputDeviceControl(sourceFactory, m_captureSession);
    m_imageCaptureControl = new CameraBinImageCapture(m_captureSession);

    connect(m_videoInputDevice, SIGNAL(selectedDeviceChanged(QString)),
            m_captureSession, SLOT(setDevice(QString)));

    if (m_videoInputDevice->deviceCount())
        m_captureSession->setDevice(m_videoInputDevice->deviceName(m_videoInputDevice->selectedDevice()));

#if defined(Q_WS_MAEMO_6) && defined(__arm__) && defined(HAVE_WIDGETS)
    m_videoRenderer = new QGstreamerGLTextureRenderer(this);
#else
    m_videoRenderer = new QGstreamerVideoRenderer(this);
#endif

#ifdef Q_WS_MAEMO_6
    m_videoWindow = new QGstreamerVideoWindow(this, "omapxvsink");
#else
    m_videoWindow = new QGstreamerVideoWindow(this);
#endif
    // If the GStreamer video sink is not available, don't provide the video window control since
    // it won't work anyway.
    if (!m_videoWindow->videoSink()) {
        delete m_videoWindow;
        m_videoWindow = 0;
    }
#if defined(HAVE_WIDGETS)
    m_videoWidgetControl = new QGstreamerVideoWidgetControl(this);

    // If the GStreamer video sink is not available, don't provide the video widget control since
    // it won't work anyway. QVideoWidget will fall back to QVideoRendererControl in that case.
    if (!m_videoWidgetControl->videoSink()) {
        delete m_videoWidgetControl;
        m_videoWidgetControl = 0;
    }
#endif

    m_audioInputSelector = new QGstreamerAudioInputSelector(this);
    connect(m_audioInputSelector, SIGNAL(activeInputChanged(QString)), m_captureSession, SLOT(setCaptureDevice(QString)));

    if (m_captureSession && m_audioInputSelector->availableInputs().size() > 0)
        m_captureSession->setCaptureDevice(m_audioInputSelector->defaultInput());

    m_metaDataControl = new CameraBinMetaData(this);
    connect(m_metaDataControl, SIGNAL(metaDataChanged(QMap<QByteArray,QVariant>)),
            m_captureSession, SLOT(setMetaData(QMap<QByteArray,QVariant>)));

#if defined(Q_WS_MAEMO_6)
    new CameraButtonListener(this);
#endif
}