コード例 #1
0
void VideoFrameSource_sV::slotExtractSmallFrames()
{
    emit signalNextTask(tr("Extracting thumbnail-sized frames from the video file"), m_videoInfo->framesCount);
    m_timer->start(100);
    if (rebuildRequired(FrameSize_Small)) {

        m_ffmpegSemaphore.acquire();

        m_ffmpeg->waitForFinished(2000);
        m_ffmpeg->terminate();

        disconnect(m_ffmpeg, SIGNAL(finished(int)), this, 0);
        connect(m_ffmpeg, SIGNAL(finished(int)), this, SLOT(slotExtractOrigFrames()));

        extractFramesFor(FrameSize_Small, m_ffmpeg);

        m_ffmpegSemaphore.release();

    } else {
コード例 #2
0
/// \todo What if image missing?
void ImagesFrameSource_sV::slotContinueInitialization()
{
    emit signalNextTask("Creating preview images from the input images", m_imagesList.size());
    for (; m_nextFrame < m_imagesList.size(); m_nextFrame++) {

        QString outputFile(framePath(m_nextFrame, FrameSize_Small));
        if (QFile(outputFile).exists()) {
            emit signalTaskItemDescription("Resized image already exists for " + QFileInfo(m_imagesList.at(m_nextFrame)).fileName());
        } else {
            emit signalTaskItemDescription(QString("Re-sizing image %1 to:\n%2")
                                           .arg(QFileInfo(m_imagesList.at(m_nextFrame)).fileName())
                                           .arg(outputFile));
            QImage small = QImage(m_imagesList.at(m_nextFrame)).scaled(m_sizeSmall, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
            small.save(outputFile);
        }

        emit signalTaskProgress(m_nextFrame);
        if (m_stopInitialization) {
            break;
        }
    }
    m_initialized = true;
    emit signalAllTasksFinished();
}