QXAAudioEndpointSelector::QXAAudioEndpointSelector(QXARecordSession *session, QObject *parent)
    :QAudioEndpointSelector(parent), m_session(session)
{
    connect(m_session, SIGNAL(availableAudioInputsChanged()),
            this, SLOT(availableAudioInputsChanged()));
    connect(m_session, SIGNAL(activeEndpointChanged(QString)),
            this, SIGNAL(activeEndpointChanged(QString)));
}
void AudioEndpointSelector::setActiveEndpoint(const QString& name)
{
    if (m_audioInput.compare(name) != 0) {
        m_audioInput = name;
        m_session->setCaptureDevice(name);
        emit activeEndpointChanged(name);
    }
}
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>)));
}
void S60MediaPlayerAudioEndpointSelector::setActiveEndpoint(const QString& name)
{
    DP0("S60MediaPlayerAudioEndpointSelector::setActiveEndpoin +++");

    DP1("S60MediaPlayerAudioEndpointSelector::setActiveEndpoint - ", name);

    QString oldEndpoint = m_control->mediaControlSettings().audioEndpoint();

    if (name != oldEndpoint && (name == QString("Default") || name == QString("All") ||
        name == QString("None") || name == QString("Earphone") || name == QString("Speaker"))) {

        if (m_control->session()) {
            m_control->session()->setActiveEndpoint(name);
            emit activeEndpointChanged(name);
        }
        m_control->setAudioEndpoint(name);
    }

    DP0("S60MediaPlayerAudioEndpointSelector::setActiveEndpoin ---");
}
Example #5
0
void S60MediaPlayerAudioEndpointSelector::setActiveEndpoint(const QString &name)
{
    QString oldEndpoint = m_control->mediaControlSettings().audioEndpoint();

    if (name != oldEndpoint &&
           (
              name == QString("Default")
           || name == QString("All")
           || name == QString("None")
           || name == QString("Earphone")
           || name == QString("Speaker")
           )
        ) {
        TRACE("S60MediaPlayerAudioEndpointSelector::setActiveEndpoint" << qtThisPtr()
              << "name" << name);
        if (m_control->session()) {
            m_control->session()->setActiveEndpoint(name);
            emit activeEndpointChanged(name);
        }
        m_control->setAudioEndpoint(name);
    }
}
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
}
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>)));
}