CameraBinService::CameraBinService(const QString &service, QObject *parent): QMediaService(parent) { m_captureSession = 0; m_cameraControl = 0; m_metaDataControl = 0; m_audioInputEndpointSelector = 0; m_videoInputDevice = 0; m_videoOutput = 0; m_videoRenderer = 0; m_videoWindow = 0; m_videoWidgetControl = 0; m_imageCaptureControl = 0; if (service == Q_MEDIASERVICE_CAMERA) { m_captureSession = new CameraBinSession(this); m_cameraControl = new CameraBinControl(m_captureSession); m_videoInputDevice = new QGstreamerVideoInputDeviceControl(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__) m_videoRenderer = new QGstreamerGLTextureRenderer(this); #else m_videoRenderer = new QGstreamerVideoRenderer(this); #endif #ifdef Q_WS_MAEMO_6 m_videoWindow = new QGstreamerVideoWindow(this, "omapxvsink"); //m_videoWindow = new QGstreamerVideoWindow(this); #else m_videoWindow = new QGstreamerVideoOverlay(this); #endif m_videoWidgetControl = new QGstreamerVideoWidgetControl(this); } if (!m_captureSession) { qWarning() << Q_FUNC_INFO << "Service type is not supported:" << service; return; } m_audioInputEndpointSelector = new QGstreamerAudioInputEndpointSelector(this); connect(m_audioInputEndpointSelector, SIGNAL(activeEndpointChanged(QString)), m_captureSession, SLOT(setCaptureDevice(QString))); if (m_captureSession && m_audioInputEndpointSelector->availableEndpoints().size() > 0) m_captureSession->setCaptureDevice(m_audioInputEndpointSelector->defaultEndpoint()); 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_5) || defined(Q_WS_MAEMO_6) new CameraButtonListener(this); #endif #if defined(Q_WS_MAEMO_5) //disable the system camera application QProcess::execute("/usr/sbin/dsmetool -k /usr/bin/camera-ui"); #endif }
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 }
QGstreamerCaptureService::QGstreamerCaptureService(const QString &service, QObject *parent): QMediaService(parent) { m_captureSession = 0; m_cameraControl = 0; m_metaDataControl = 0; m_videoInput = 0; m_audioInputEndpointSelector = 0; m_videoInputDevice = 0; m_videoOutput = 0; m_videoRenderer = 0; m_videoWindow = 0; m_videoWidgetControl = 0; m_imageCaptureControl = 0; if (service == Q_MEDIASERVICE_AUDIOSOURCE) { m_captureSession = new QGstreamerCaptureSession(QGstreamerCaptureSession::Audio, this); } if (service == Q_MEDIASERVICE_CAMERA) { m_captureSession = new QGstreamerCaptureSession(QGstreamerCaptureSession::AudioAndVideo, this); m_cameraControl = new QGstreamerCameraControl(m_captureSession); m_videoInput = new QGstreamerV4L2Input(this); m_captureSession->setVideoInput(m_videoInput); m_videoInputDevice = new QGstreamerVideoInputDeviceControl(this); connect(m_videoInputDevice, SIGNAL(selectedDeviceChanged(QString)), m_videoInput, SLOT(setDevice(QString))); if (m_videoInputDevice->deviceCount()) m_videoInput->setDevice(m_videoInputDevice->deviceName(m_videoInputDevice->selectedDevice())); m_videoRenderer = new QGstreamerVideoRenderer(this); #if defined(Q_WS_X11) && !defined(QT_NO_XVIDEO) m_videoWindow = new QGstreamerVideoOverlay(this); m_videoWidgetControl = new QGstreamerVideoWidgetControl(this); #endif m_imageCaptureControl = new QGstreamerImageCaptureControl(m_captureSession); } m_audioInputEndpointSelector = new QGstreamerAudioInputEndpointSelector(this); connect(m_audioInputEndpointSelector, SIGNAL(activeEndpointChanged(QString)), m_captureSession, SLOT(setCaptureDevice(QString))); if (m_captureSession && m_audioInputEndpointSelector->availableEndpoints().size() > 0) m_captureSession->setCaptureDevice(m_audioInputEndpointSelector->defaultEndpoint()); m_metaDataControl = new QGstreamerCaptureMetaDataControl(this); connect(m_metaDataControl, SIGNAL(metaDataChanged(QMap<QByteArray,QVariant>)), m_captureSession, SLOT(setMetaData(QMap<QByteArray,QVariant>))); }
QGstreamerCaptureService::QGstreamerCaptureService(const QString &service, QObject *parent): QMediaService(parent) { static bool initialized = false; if (!initialized) { initialized = true; gst_init(NULL, NULL); } m_captureSession = 0; m_metaDataControl = 0; m_videoInput = 0; m_audioInputEndpointSelector = 0; m_videoInputDevice = 0; m_videoOutput = 0; m_videoRenderer = 0; m_videoRendererFactory = 0; m_videoWindow = 0; m_videoWindowFactory = 0; m_videoWidgetControl = 0; m_videoWidgetFactory = 0; if (service == Q_MEDIASERVICE_AUDIOSOURCE) { m_captureSession = new QGstreamerCaptureSession(QGstreamerCaptureSession::Audio, this); } bool captureVideo = false; if (captureVideo) { m_captureSession = new QGstreamerCaptureSession(QGstreamerCaptureSession::AudioAndVideo, this); m_videoInput = new QGstreamerV4L2Input(this); m_captureSession->setVideoInput(m_videoInput); m_videoInputDevice = new QGstreamerVideoInputDeviceControl(this); connect(m_videoInputDevice, SIGNAL(selectedDeviceChanged(QString)), m_videoInput, SLOT(setDevice(QString))); if (m_videoInputDevice->deviceCount()) m_videoInput->setDevice(m_videoInputDevice->deviceName(m_videoInputDevice->selectedDevice())); m_videoRenderer = new QGstreamerVideoRenderer(this); m_videoRendererFactory = new QGstreamerVideoRendererWrapper(m_videoRenderer); #ifndef QT_NO_XVIDEO QGstreamerVideoOverlay *videoWindow = new QGstreamerVideoOverlay(this); m_videoWindow = videoWindow; m_videoWindowFactory = new QGstreamerVideoRendererWrapper(videoWindow); QGstreamerVideoWidgetControl *videoWidget = new QGstreamerVideoWidgetControl(this); m_videoWidgetControl = videoWidget; m_videoWidgetFactory = new QGstreamerVideoRendererWrapper(videoWidget); #endif } if (!m_captureSession) { qWarning() << "Service type is not supported:" << service; return; } m_audioInputEndpointSelector = new QGstreamerAudioInputEndpointSelector(this); connect(m_audioInputEndpointSelector, SIGNAL(activeEndpointChanged(QString)), m_captureSession, SLOT(setCaptureDevice(QString))); if (m_captureSession && m_audioInputEndpointSelector->availableEndpoints().size() > 0) m_captureSession->setCaptureDevice(m_audioInputEndpointSelector->defaultEndpoint()); m_metaDataControl = new QGstreamerCaptureMetaDataControl(this); connect(m_metaDataControl, SIGNAL(metaDataChanged(QMap<QByteArray,QVariant>)), m_captureSession, SLOT(setMetaData(QMap<QByteArray,QVariant>))); }
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 }