2013-09-12 23:41:49 -05:00
|
|
|
/**
|
|
|
|
|
* @file
|
2015-02-07 16:48:43 -06:00
|
|
|
* @brief Source file for Example Executable (example app for libopenshot)
|
2013-09-12 23:41:49 -05:00
|
|
|
* @author Jonathan Thomas <jonathan@openshot.org>
|
|
|
|
|
*
|
|
|
|
|
* @section LICENSE
|
|
|
|
|
*
|
2014-03-29 18:49:22 -05:00
|
|
|
* Copyright (c) 2008-2014 OpenShot Studios, LLC
|
|
|
|
|
* <http://www.openshotstudios.com/>. This file is part of
|
|
|
|
|
* OpenShot Library (libopenshot), an open-source project dedicated to
|
|
|
|
|
* delivering high quality video editing and animation solutions to the
|
|
|
|
|
* world. For more information visit <http://www.openshot.org/>.
|
2013-09-12 23:41:49 -05:00
|
|
|
*
|
2014-03-29 18:49:22 -05:00
|
|
|
* OpenShot Library (libopenshot) is free software: you can redistribute it
|
2014-07-11 16:52:14 -05:00
|
|
|
* and/or modify it under the terms of the GNU Lesser General Public License
|
2014-03-29 18:49:22 -05:00
|
|
|
* as published by the Free Software Foundation, either version 3 of the
|
|
|
|
|
* License, or (at your option) any later version.
|
2013-09-12 23:41:49 -05:00
|
|
|
*
|
2014-03-29 18:49:22 -05:00
|
|
|
* OpenShot Library (libopenshot) is distributed in the hope that it will be
|
|
|
|
|
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2014-07-11 16:52:14 -05:00
|
|
|
* GNU Lesser General Public License for more details.
|
2013-09-12 23:41:49 -05:00
|
|
|
*
|
2014-07-11 16:52:14 -05:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
2014-03-29 18:49:22 -05:00
|
|
|
* along with OpenShot Library. If not, see <http://www.gnu.org/licenses/>.
|
2013-09-12 23:41:49 -05:00
|
|
|
*/
|
2011-10-11 08:44:27 -05:00
|
|
|
|
2012-07-19 15:03:55 -05:00
|
|
|
#include <fstream>
|
2011-10-11 08:44:27 -05:00
|
|
|
#include <iostream>
|
2017-08-20 17:37:39 -05:00
|
|
|
#include <memory>
|
2015-02-07 16:48:43 -06:00
|
|
|
#include "../../include/OpenShot.h"
|
2017-08-20 17:37:39 -05:00
|
|
|
#include "../../include/CrashHandler.h"
|
2013-11-17 15:12:08 -06:00
|
|
|
|
2011-10-11 08:44:27 -05:00
|
|
|
using namespace openshot;
|
|
|
|
|
|
2015-06-01 00:20:14 -07:00
|
|
|
|
2017-08-01 01:19:07 -05:00
|
|
|
int main(int argc, char* argv[]) {
|
2016-02-23 00:27:03 -06:00
|
|
|
|
2017-08-20 17:37:39 -05:00
|
|
|
// Create and open reader
|
|
|
|
|
FFmpegReader r("/home/jonathan/sintel-120fps-crash.mp4");
|
|
|
|
|
r.Open();
|
2016-02-23 00:27:03 -06:00
|
|
|
|
2017-08-20 17:37:39 -05:00
|
|
|
// Enable debug logging
|
|
|
|
|
ZmqLogger::Instance()->Enable(false);
|
|
|
|
|
ZmqLogger::Instance()->Path("/home/jonathan/.openshot_qt/libopenshot2.log");
|
|
|
|
|
CrashHandler::Instance();
|
2016-02-23 00:27:03 -06:00
|
|
|
|
2017-08-20 17:37:39 -05:00
|
|
|
// Loop a few times
|
|
|
|
|
for (int attempt = 1; attempt < 10; attempt++) {
|
|
|
|
|
cout << "** Attempt " << attempt << " **" << endl;
|
2015-09-28 22:05:50 -05:00
|
|
|
|
2018-01-06 16:44:54 -06:00
|
|
|
// Read every frame in reader as fast as possible
|
|
|
|
|
for (int64_t frame_number = 1; frame_number < r.info.video_length; frame_number++) {
|
|
|
|
|
// Get frame object
|
|
|
|
|
std::shared_ptr<Frame> f = r.GetFrame(frame_number);
|
2015-09-28 22:05:50 -05:00
|
|
|
|
2018-01-06 16:44:54 -06:00
|
|
|
// Print frame numbers
|
|
|
|
|
cout << frame_number << " [" << f->number << "], " << flush;
|
|
|
|
|
if (frame_number % 10 == 0)
|
|
|
|
|
cout << endl;
|
2017-08-20 17:37:39 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
cout << "Completed successfully!" << endl;
|
2015-06-01 00:20:14 -07:00
|
|
|
|
2017-08-20 17:37:39 -05:00
|
|
|
// Close reader
|
|
|
|
|
r.Close();
|
2015-02-05 00:06:07 -06:00
|
|
|
|
2017-08-01 01:19:07 -05:00
|
|
|
return 0;
|
|
|
|
|
}
|