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();
}
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();
}