コード例 #1
0
VideoFrameSource_sV::VideoFrameSource_sV(const Project_sV *project, const QString &filename)
throw(FrameSourceError) :
    AbstractFrameSource_sV(project),
    m_inFile(filename),
    m_fps(1,1),
    m_ffmpegSemaphore(1),
    m_initialized(false)
{
    if (!QFileInfo(filename).exists()) {
        throw FrameSourceError(tr("Video file %1 does not exist!").arg(filename));
    }

    m_videoInfo = new VideoInfoSV();

    *m_videoInfo = getInfo(filename.toStdString().c_str());
    if (m_videoInfo->streamsCount <= 0) {
        qDebug() << "Video info is invalid: " << filename;
        throw FrameSourceError(tr("Video is invalid, no streams found in %1").arg(filename));
    }
    m_fps = Fps_sV(m_videoInfo->frameRateNum, m_videoInfo->frameRateDen);



    createDirectories();
    locateFFmpeg();

    m_ffmpeg = new QProcess(this);
    m_timer = new QTimer(this);

    bool b = true;
    b &= connect(m_timer, SIGNAL(timeout()), this, SLOT(slotProgressUpdate()));
    Q_ASSERT(b);
}
コード例 #2
0
ImagesFrameSource_sV::ImagesFrameSource_sV(Project_sV *project, QStringList images) throw(FrameSourceError) :
    AbstractFrameSource_sV(project),
    m_fps(24, 1),
    m_initialized(false),
    m_stopInitialization(false),
    m_nextFrame(0)
{
    QString msg = validateImages(images);
    if (msg.length() > 0) {
        throw FrameSourceError("Image frame source: " + msg);
    }

    m_imagesList.append(images);
    m_imagesList.sort();

    QImage repImage(m_imagesList.at(0));
    if (repImage.isNull()) {
        qDebug() << "Image is null: " << m_imagesList.at(0);
        qDebug() << "Supported image formats: " << QImageReader::supportedImageFormats();
        throw FrameSourceError(QString("Cannot read image: %1").arg(m_imagesList.at(0)));
    }
    m_sizeSmall = repImage.size();
    if (m_sizeSmall.isEmpty()) {
        throw FrameSourceError(QString("Image read from %1 is empty.").arg(m_imagesList.at(0)));
    }
    while (m_sizeSmall.width() > 600) {
        m_sizeSmall = m_sizeSmall/2;
    }


    createDirectories();
}
コード例 #3
0
void VideoFrameSource_sV::locateFFmpeg()
{
    if (m_avconvInfo.locate(m_settings.value("binaries/ffmpeg", "").toString())) {
        m_settings.setValue("binaries/ffmpeg", m_avconvInfo.executablePath());
        m_settings.sync();
    } else {
        throw FrameSourceError(tr("ffmpeg/avconv executable not found! Cannot load video."
                                  "\n(It is also possible that it took a little long to respond "
                                  "due to high workload, so you might want to try again.)"));
    }
}
コード例 #4
0
void VideoFrameSource_sV::locateFFmpeg()
{
    if (m_avconvInfo.locate(m_settings.value("binaries/ffmpeg", "").toString())) {
        m_settings.setValue("binaries/ffmpeg", m_avconvInfo.executablePath());
        m_settings.sync();
    } else {
        throw FrameSourceError(tr("ffmpeg/avconv executable not found! Cannot load video."
                                  "\n(It is also possible that it took a little long to respond "
                                  "due to high workload, so you might want to try again.)"
                          #ifdef WINDOWS
                                  "\nPlease download the 32-bit static ffmpeg build from ffmpeg.zeranoe.com "
                                  "and extract ffmpeg.exe in the same directory as slowmoUI.exe."
                          #endif
                                  ));
    }
}
コード例 #5
0
ImagesFrameSource_sV::ImagesFrameSource_sV(Project_sV *project, QStringList images) throw(FrameSourceError) :
    AbstractFrameSource_sV(project),
    m_fps(24, 1),
    m_initialized(false),
    m_stopInitialization(false),
    m_nextFrame(0)
{
    QString msg = validateImages(images);
    if (msg.length() > 0) {
        throw FrameSourceError("Image frame source: " + msg);
    }

    m_imagesList.append(images);
    m_imagesList.sort();

    m_sizeSmall = QImage(m_imagesList.at(0)).size();
    while (m_sizeSmall.width() > 600) {
        m_sizeSmall = m_sizeSmall/2;
    }

    createDirectories();
}