Exemplo n.º 1
0
bool VideoPreview::showConfigDialog(QWidget *parent)
{
    VideoPreviewConfigDialog d(parent);

    d.setVideoFile(videoFile());
    d.setDVDDevice(DVDDevice());
    d.setCols(cols());
    d.setRows(rows());
    d.setInitialStep(initialStep());
    d.setMaxWidth(maxWidth());
    d.setDisplayOSD(displayOSD());
    d.setAspectRatio(aspectRatio());
    d.setFormat(extractFormat());
    d.setSaveLastDirectory(save_last_directory);

    if (d.exec() == QDialog::Accepted) {
        setVideoFile(d.videoFile());
        setDVDDevice(d.DVDDevice());
        setCols(d.cols());
        setRows(d.rows());
        setInitialStep(d.initialStep());
        setMaxWidth(d.maxWidth());
        setDisplayOSD(d.displayOSD());
        setAspectRatio(d.aspectRatio());
        setExtractFormat(d.format());
        save_last_directory = d.saveLastDirectory();

        return true;
    }

    return false;
}
Exemplo n.º 2
0
void VideoPreview::saveSettings()
{
    qDebug("VideoPreview::saveSettings");

    set->beginGroup("videopreview");

    set->setValue("columns", cols());
    set->setValue("rows", rows());
    set->setValue("initial_step", initialStep());
    set->setValue("max_width", maxWidth());
    set->setValue("osd", displayOSD());
    set->setValue("format", extractFormat());
    set->setValue("save_last_directory", save_last_directory);

    if (save_last_directory) {
        set->setValue("last_directory", last_directory);
    }

    set->setValue("filename", videoFile());
    set->setValue("dvd_device", DVDDevice());

    set->setValue("show_info", toggleInfoAct->isChecked());

    set->endGroup();
}
Exemplo n.º 3
0
void VideoPreview::loadSettings()
{
    qDebug("VideoPreview::loadSettings");

    set->beginGroup("videopreview");

    setCols(set->value("columns", cols()).toInt());
    setRows(set->value("rows", rows()).toInt());
    setInitialStep(set->value("initial_step", initialStep()).toInt());
    setMaxWidth(set->value("max_width", maxWidth()).toInt());
    setDisplayOSD(set->value("osd", displayOSD()).toBool());
    setExtractFormat((ExtractFormat) set->value("format", extractFormat()).toInt());
    save_last_directory = set->value("save_last_directory", save_last_directory).toBool();
    last_directory = set->value("last_directory", last_directory).toString();

    setVideoFile(set->value("filename", videoFile()).toString());
    setDVDDevice(set->value("dvd_device", DVDDevice()).toString());

    toggleInfoAct->setChecked(set->value("show_info", true).toBool());

    set->endGroup();
}
Exemplo n.º 4
0
Arquivo: vid.cpp Projeto: JonnyH/ktftd
int main(int argc, char **argv)
{
	if (argc != 2)
	{
		printUsage();
		return EXIT_FAILURE;
	}
	std::ifstream videoFile(argv[1]);
	auto* video = ktftd::vid::loadFLC(videoFile);

	for (int frameNo = 0; frameNo < video->getTotalFrameCount(); frameNo++)
	{
		std::stringstream audioOutName;
		audioOutName << "out" << std::setw(6) << std::setfill('0') << frameNo << ".flac";
		std::stringstream imageOutName;
		imageOutName << "out" << std::setw(6) << std::setfill('0') << frameNo << ".png";
		assert(video->hasNextFrame());
		auto &frame = video->getNextFrame();
		frame.getImage().writePNG(imageOutName.str().c_str());
		frame.getAudioFile().writeFLAC(audioOutName.str().c_str());
	}

	delete video;
}
Exemplo n.º 5
0
void VlcEncodingSystem::_DoEncode(const QString &paramFile)
{
	QFileInfo	videoFile(QFileInfo(QFileInfo(paramFile).completeBaseName()).completeBaseName());

	QDir		dir(VlcStreamerApp::Instance()->DocumentRoot());
	QString		name;
	if(dir.exists(videoFile.completeBaseName())) {
		for(unsigned i = 1; i != ~0U; ++i) {
			if(dir.exists(videoFile.completeBaseName() + "_" + QString::number(i)) == false) {
				name = videoFile.completeBaseName() + "_" + QString::number(i);
				break;
			}
		}
	} else {
		name = videoFile.completeBaseName();
	}

	if(name.isEmpty() == false) {
		dir.mkdir(name);
		dir.cd(name);
		dir.rename(paramFile, "params.txt");

#ifdef Q_WS_WIN
		QFileInfo	scriptInfo(dir.path() + "/encode.bat");
#else
		QFileInfo	scriptInfo(dir.path() + "/encode.sh");
#endif
		QFile		script(scriptInfo.filePath());
		QFile		params(dir.path() + "/params.txt");

		if(params.open(QIODevice::ReadWrite)) {
			QString paramData = params.readAll();
			params.close();

			bool ok;
			QJson::Parser	parser;
			QVariantMap		map = parser.parse(paramData.toAscii(), &ok).toMap();
			if(ok && script.open(QIODevice::WriteOnly)) {
				QString	scriptData;
				//#!/bin/bash 
				//vlc -I dummy --ignore-config "/home/paulm/Videos/troops.avi" 
				//		'--sout=#transcode{vcodec=h264,soverlay,acodec=mp3,channels=2,venc=x264{profile=baseline,level=2.2,keyint=30,bframes=0,ref=1,nocabac},width=480,vb=200,ab=40,fps=25,deinterlace}:
				//				std{access=livehttp{seglen=10,index="/home/paulm/.Hobbyist_Software/VLC_Streamer/Root/troops/stream.m3u8",index-url=stream-###.ts},
				//				mux=ts{use-key-frames},
				//				dst="/home/paulm/.Hobbyist_Software/VLC_Streamer/Root/troops/stream-###.ts"}'
				//		vlc://quit
				scriptData = "#!/bin/bash\n";
				QString	temp = map.value("sout").toString();
				temp.replace("##dest##", dir.path());
				scriptData += "vlc -I dummy --ignore-config " + map.value("args").toString() + " \"" + map.value("file").toString() + "\" vlc://quit " + "'" + temp + "' -vvv\n";
				script.write(scriptData.toAscii());
				script.close();
				script.setPermissions(QFile::ReadUser | QFile::WriteUser | QFile::ExeUser);

				VlcEncoder *encoder = new VlcEncoder(scriptInfo.filePath());
				QThreadPool::globalInstance()->start(encoder);
			} else {
				qDebug() << "Not ok or script didn't open" << ok << script.error();
			}
		}
	}
}