Skip to content

Commit

Permalink
Merge branch 'darby_edit_original' into test_edit_merge
Browse files Browse the repository at this point in the history
  • Loading branch information
ggarra13 committed Sep 13, 2023
2 parents 4053edb + cf35586 commit 2edd36f
Show file tree
Hide file tree
Showing 53 changed files with 845 additions and 843 deletions.
13 changes: 4 additions & 9 deletions bin/tlbake/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,19 @@

#include <iostream>

int main(int argc, char* argv[])
TLRENDER_MAIN()
{
int r = 0;
int r = 1;
try
{
auto context = tl::system::Context::create();
tl::timeline::init(context);
auto app = tl::bake::App::create(argc, argv, context);
if (0 == app->getExit())
{
app->run();
r = app->getExit();
}
auto app = tl::bake::App::create(tl::app::convert(argc, argv), context);
r = app->run();
}
catch(const std::exception& e)
{
std::cerr << "ERROR: " << e.what() << std::endl;
r = 1;
}
return r;
}
14 changes: 13 additions & 1 deletion bin/tlplay-gl/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,19 @@
add_executable(tlplay-gl main.cpp)
add_executable(tlplay-gl WIN32 main.cpp)
target_link_libraries(tlplay-gl tlPlayGLApp)
set_target_properties(tlplay-gl PROPERTIES FOLDER bin)

install(
TARGETS tlplay-gl
RUNTIME DESTINATION bin)

if(WIN32)
add_executable(tlplay-gl. main.cpp)
target_link_libraries(tlplay-gl. tlPlayGLApp)
set_target_properties(
tlplay-gl. PROPERTIES
SUFFIX com
FOLDER bin)
install(
TARGETS tlplay-gl.
RUNTIME DESTINATION bin)
endif()
28 changes: 19 additions & 9 deletions bin/tlplay-gl/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,34 @@

#include <iostream>

int main(int argc, char* argv[])
#if defined(_WINDOWS)
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif // WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <tchar.h>
#endif // _WINDOWS

TLRENDER_MAIN()
{
int r = 0;
int r = 1;
try
{
auto context = tl::system::Context::create();
tl::timelineui::init(context);
auto app = tl::play_gl::App::create(argc, argv, context);
if (0 == app->getExit())
{
app->run();
r = app->getExit();
}
auto app = tl::play_gl::App::create(tl::app::convert(argc, argv), context);
r = app->run();
}
catch(const std::exception& e)
{
std::cerr << "ERROR: " << e.what() << std::endl;
r = 1;
}
return r;
}

#if defined(_WINDOWS)
int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE, PWSTR, int)
{
return wmain(__argc, __wargv);
}
#endif // _WINDOWS
3 changes: 1 addition & 2 deletions bin/tlplay-qt/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

int main(int argc, char* argv[])
{
int r = 0;
int r = 1;
try
{
auto context = tl::system::Context::create();
Expand All @@ -29,7 +29,6 @@ int main(int argc, char* argv[])
catch(const std::exception& e)
{
std::cerr << "ERROR: " << e.what() << std::endl;
r = 1;
}
return r;
}
13 changes: 4 additions & 9 deletions bin/tlresource/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,19 @@

#include <iostream>

int main(int argc, char* argv[])
TLRENDER_MAIN()
{
int r = 0;
int r = 1;
try
{
auto context = tl::system::Context::create();
tl::io::init(context);
auto app = tl::resource::App::create(argc, argv, context);
if (0 == app->getExit())
{
app->run();
r = app->getExit();
}
auto app = tl::resource::App::create(tl::app::convert(argc, argv), context);
r = app->run();
}
catch(const std::exception& e)
{
std::cerr << "ERROR: " << e.what() << std::endl;
r = 1;
}
return r;
}
3 changes: 1 addition & 2 deletions examples/filmstrip-qtwidget/App.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ namespace tl
QApplication(argc, argv)
{
IApp::_init(
argc,
argv,
app::convert(argc, argv),
context,
"filmstrip-qwidget",
"Example using the filmstrip widget.",
Expand Down
3 changes: 1 addition & 2 deletions examples/filmstrip-qtwidget/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

int main(int argc, char* argv[])
{
int r = 0;
int r = 1;
try
{
auto context = tl::system::Context::create();
Expand All @@ -31,7 +31,6 @@ int main(int argc, char* argv[])
catch(const std::exception& e)
{
std::cerr << "ERROR: " << e.what() << std::endl;
r = 1;
}
return r;
}
3 changes: 1 addition & 2 deletions examples/panorama-qtwidget/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ int main(int argc, char* argv[])
return 1;
}

int r = 0;
int r = 1;
try
{
// Create the Qt application.
Expand Down Expand Up @@ -67,7 +67,6 @@ int main(int argc, char* argv[])
catch (const std::exception& e)
{
std::cerr << "ERROR: " << e.what() << std::endl;
r = 1;
}
return r;
}
150 changes: 73 additions & 77 deletions examples/render-gl/App.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,10 @@ namespace tl
namespace render_gl
{
void App::_init(
int argc,
char* argv[],
const std::vector<std::string>& argv,
const std::shared_ptr<system::Context>& context)
{
IApp::_init(
argc,
argv,
context,
"render-gl",
Expand Down Expand Up @@ -112,100 +110,98 @@ namespace tl
{}

std::shared_ptr<App> App::create(
int argc,
char* argv[],
const std::vector<std::string>& argv,
const std::shared_ptr<system::Context>& context)
{
auto out = std::shared_ptr<App>(new App);
out->_init(argc, argv, context);
out->_init(argv, context);
return out;
}

void App::run()
int App::run()
{
if (_exit != 0)
if (0 == _exit)
{
return;
}

// Read the timelines.
auto timeline = timeline::Timeline::create(
file::Path(_input),
_context);
auto player = timeline::Player::create(timeline, _context);
_players.push_back(player);
auto ioInfo = player->getIOInfo();
if (!ioInfo.video.empty())
{
_videoSizes.push_back(ioInfo.video[0].size);
}
_videoData.push_back(timeline::VideoData());
if (!_options.compareFileName.empty())
{
timeline = timeline::Timeline::create(
file::Path(_options.compareFileName),
// Read the timelines.
auto timeline = timeline::Timeline::create(
file::Path(_input),
_context);
player = timeline::Player::create(timeline, _context);
player->setExternalTime(_players[0]);
auto player = timeline::Player::create(timeline, _context);
_players.push_back(player);
ioInfo = player->getIOInfo();
auto ioInfo = player->getIOInfo();
if (!ioInfo.video.empty())
{
_videoSizes.push_back(ioInfo.video[0].size);
}
_videoData.push_back(timeline::VideoData());
}
if (!_options.compareFileName.empty())
{
timeline = timeline::Timeline::create(
file::Path(_options.compareFileName),
_context);
player = timeline::Player::create(timeline, _context);
player->setExternalTime(_players[0]);
_players.push_back(player);
ioInfo = player->getIOInfo();
if (!ioInfo.video.empty())
{
_videoSizes.push_back(ioInfo.video[0].size);
}
_videoData.push_back(timeline::VideoData());
}

// Create the window.
_window = gl::GLFWWindow::create(
"render-gl",
_options.windowSize,
_context);
_frameBufferSize = _window->getFrameBufferSize();
_contentScale = _window->getContentScale();
_window->setFullScreen(_options.fullscreen);
_window->setFrameBufferSizeCallback(
[this](const math::Size2i& value)
// Create the window.
_window = gl::GLFWWindow::create(
"render-gl",
_options.windowSize,
_context);
_frameBufferSize = _window->getFrameBufferSize();
_contentScale = _window->getContentScale();
_window->setFullScreen(_options.fullscreen);
_window->setFrameBufferSizeCallback(
[this](const math::Size2i& value)
{
_frameBufferSize = value;
_renderDirty = true;
});
_window->setContentScaleCallback(
[this](const math::Vector2f& value)
{
_contentScale = value;
_renderDirty = true;
});
_window->setKeyCallback(
[this](int key, int scanCode, int action, int mods)
{
_keyCallback(key, scanCode, action, mods);
});

// Create the renderer.
_render = timeline::GLRender::create(_context);

// Print the shortcuts help.
_printShortcutsHelp();

// Start the main loop.
_hud = _options.hud;
if (time::isValid(_options.inOutRange))
{
_frameBufferSize = value;
_renderDirty = true;
});
_window->setContentScaleCallback(
[this](const math::Vector2f& value)
_players[0]->setInOutRange(_options.inOutRange);
_players[0]->seek(_options.inOutRange.start_time());
}
if (time::isValid(_options.seek))
{
_contentScale = value;
_renderDirty = true;
});
_window->setKeyCallback(
[this](int key, int scanCode, int action, int mods)
_players[0]->seek(_options.seek);
}
_players[0]->setPlayback(_options.playback);
_startTime = std::chrono::steady_clock::now();
while (_running && !_window->shouldClose())
{
_keyCallback(key, scanCode, action, mods);
});

// Create the renderer.
_render = timeline::GLRender::create(_context);

// Print the shortcuts help.
_printShortcutsHelp();

// Start the main loop.
_hud = _options.hud;
if (time::isValid(_options.inOutRange))
{
_players[0]->setInOutRange(_options.inOutRange);
_players[0]->seek(_options.inOutRange.start_time());
}
if (time::isValid(_options.seek))
{
_players[0]->seek(_options.seek);
}
_players[0]->setPlayback(_options.playback);
_startTime = std::chrono::steady_clock::now();
while (_running && !_window->shouldClose())
{
glfwPollEvents();
_tick();
glfwPollEvents();
_tick();
}
}
return _exit;
}

void App::exit()
Expand Down
8 changes: 3 additions & 5 deletions examples/render-gl/App.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ namespace tl

protected:
void _init(
int argc,
char* argv[],
const std::vector<std::string>&,
const std::shared_ptr<system::Context>&);

App();
Expand All @@ -51,12 +50,11 @@ namespace tl

//! Create a new application.
static std::shared_ptr<App> create(
int argc,
char* argv[],
const std::vector<std::string>&,
const std::shared_ptr<system::Context>&);

//! Run the application.
void run();
int run();

//! Exit the application.
void exit();
Expand Down
Loading

0 comments on commit 2edd36f

Please sign in to comment.