Beispiel #1
0
void GstVideoPlayerBackend::setVideoBuffer(VideoHttpBuffer *videoHttpBuffer)
{
    if (m_videoBuffer)
    {
        disconnect(m_videoBuffer, 0, this, 0);
        m_videoBuffer->clearPlayback();
        m_videoBuffer->deleteLater();
    }

    m_videoBuffer = videoHttpBuffer;

    if (m_videoBuffer)
    {
        connect(m_videoBuffer, SIGNAL(bufferingStarted()), this, SIGNAL(bufferingStarted()));
        connect(m_videoBuffer, SIGNAL(bufferingStopped()), this, SIGNAL(bufferingStopped()));
        connect(m_videoBuffer, SIGNAL(bufferingReady()), SLOT(playIfReady()));
        connect(m_videoBuffer, SIGNAL(streamError(QString)), SLOT(streamError(QString)));
    }
}
bool VideoHttpBuffer::startBuffering()
{
    Q_ASSERT(!media);

    media = bcApp->mediaDownloadManager()->acquireMediaDownload(m_url);
    connect(media, SIGNAL(fileSizeChanged(uint)), SLOT(fileSizeChanged(uint)), Qt::DirectConnection);
    connect(media, SIGNAL(finished()), SIGNAL(bufferingFinished()));
    connect(media, SIGNAL(stopped()), SIGNAL(bufferingStopped()));
    connect(media, SIGNAL(error(QString)), SLOT(sendStreamError(QString)));

    media->start();

    qDebug("VideoHttpBuffer: started");
    emit bufferingStarted();

    return true;
}