Skip to content

Commit

Permalink
Refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
darbyjohnston committed Sep 17, 2024
1 parent c1e7752 commit 4d2d7b0
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 30 deletions.
2 changes: 1 addition & 1 deletion SuperBuild.bat
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ cmake --build superbuild-%BUILD_TYPE% -j 4 --config %BUILD_TYPE%

cmake -S toucan -B build-%BUILD_TYPE% -DCMAKE_INSTALL_PREFIX=%CD%\install-%BUILD_TYPE% -DCMAKE_PREFIX_PATH=%CD%\install-%BUILD_TYPE% -DCMAKE_BUILD_TYPE=%BUILD_TYPE%
cmake --build build-%BUILD_TYPE% -j 4 --config %BUILD_TYPE%
cmake --build build-%BUILD_TYPE% --target INSTALL
cmake --build build-%BUILD_TYPE% --config %BUILD_TYPE% --target INSTALL

2 changes: 1 addition & 1 deletion SuperBuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ cmake --build superbuild-$BUILD_TYPE -j 4 --config $BUILD_TYPE

cmake -S toucan -B build-$BUILD_TYPE -DCMAKE_INSTALL_PREFIX=$PWD/install-$BUILD_TYPE -DCMAKE_PREFIX_PATH=$PWD/install-$BUILD_TYPE -DCMAKE_BUILD_TYPE=$BUILD_TYPE
cmake --build build-$BUILD_TYPE -j 4 --config $BUILD_TYPE
cmake --build build-$BUILD_TYPE --target install
cmake --build build-$BUILD_TYPE --config $BUILD_TYPE --target install

55 changes: 41 additions & 14 deletions bin/toucan-render/App.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,11 @@ namespace toucan
_args.input,
"input",
"Input .otio file."));
_args.list.push_back(std::make_shared<CmdLineValueArg<std::string> >(
auto outArg = std::make_shared<CmdLineValueArg<std::string> >(
_args.output,
"output",
"Output image file. Use a dash ('-') to write raw frames to stdout."));
"Output image file. Use a dash ('-') to write raw frames to stdout.");
_args.list.push_back(outArg);

std::vector<std::string> rawList;
for (const auto& spec : rawSpecs)
Expand Down Expand Up @@ -83,35 +84,57 @@ namespace toucan
_options.verbose,
std::vector<std::string>{ "-v" },
"Print verbose output."));
_options.list.push_back(std::make_shared<CmdLineFlagOption>(
_options.help,
std::vector<std::string>{ "-h" },
"Print help."));

if (!argv.empty())
{
for (const auto& arg : _args.list)
{
arg->parse(argv);
}
for (const auto& option : _options.list)
{
option->parse(argv);
}
_args.outputRaw = "-" == _args.output;
if (_args.outputRaw)
if (_options.printStart ||
_options.printDuration ||
_options.printRate ||
_options.printSize)
{
_options.verbose = false;
auto i = std::find(_args.list.begin(), _args.list.end(), outArg);
if (i != _args.list.end())
{
_args.list.erase(i);
}
}
if (argv.size())
if (!_options.help)
{
_options.help = true;
for (const auto& arg : _args.list)
{
arg->parse(argv);
}
_args.outputRaw = "-" == _args.output;
if (_args.outputRaw)
{
_options.verbose = false;
}
if (argv.size())
{
_options.help = true;
}
}
}
else
{
_options.help = true;
}
}

App::~App()
{}

int App::run()
{
if (_args.input.empty() || _args.output.empty() || _options.help)
if (_options.help)
{
_printHelp();
return 1;
Expand Down Expand Up @@ -326,8 +349,12 @@ namespace toucan
buf);
p = &tmp;
}

fwrite(p->localpixels(), spec.width * spec.height * spec.nchannels, 1, stdout);

fwrite(
p->localpixels(),
spec.image_bytes(),
1,
stdout);
}

void App::_printHelp()
Expand Down
12 changes: 2 additions & 10 deletions cmake/SuperBuild/BuildFFmpeg.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,8 @@ endif()
set(FFmpeg_CONFIGURE_ARGS
--prefix=${CMAKE_INSTALL_PREFIX}
--disable-doc
--disable-postproc
--disable-avfilter
--disable-hwaccels
--disable-devices
--disable-filters
--disable-alsa
--disable-appkit
--disable-avfoundation
Expand Down Expand Up @@ -99,7 +96,6 @@ if(toucan_FFmpeg_MINIMAL)
--enable-decoder=aac
--enable-decoder=ac3
--enable-decoder=av1
--enable-decoder=ayuv
--enable-decoder=dnxhd
--enable-decoder=eac3
--enable-decoder=flac
Expand All @@ -110,7 +106,6 @@ if(toucan_FFmpeg_MINIMAL)
--enable-decoder=mpeg2video
--enable-decoder=mpeg4
--enable-decoder=pcm_alaw
--enable-decoder=pcm_alaw_at
--enable-decoder=pcm_bluray
--enable-decoder=pcm_dvd
--enable-decoder=pcm_f16le
Expand All @@ -121,7 +116,6 @@ if(toucan_FFmpeg_MINIMAL)
--enable-decoder=pcm_f64le
--enable-decoder=pcm_lxf
--enable-decoder=pcm_mulaw
--enable-decoder=pcm_mulaw_at
--enable-decoder=pcm_s16be
--enable-decoder=pcm_s16be_planar
--enable-decoder=pcm_s16le
Expand Down Expand Up @@ -158,22 +152,19 @@ if(toucan_FFmpeg_MINIMAL)
--disable-encoders
--enable-encoder=aac
--enable-encoder=ac3
--enable-encoder=ayuv
--enable-encoder=dnxhd
--enable-encoder=eac3
--enable-encoder=mjpeg
--enable-encoder=mpeg2video
--enable-encoder=mpeg4
--enable-encoder=pcm_alaw
--enable-encoder=pcm_alaw_at
--enable-encoder=pcm_bluray
--enable-encoder=pcm_dvd
--enable-encoder=pcm_f32be
--enable-encoder=pcm_f32le
--enable-encoder=pcm_f64be
--enable-encoder=pcm_f64le
--enable-encoder=pcm_mulaw
--enable-encoder=pcm_mulaw_at
--enable-encoder=pcm_s16be
--enable-encoder=pcm_s16be_planar
--enable-encoder=pcm_s16le
Expand Down Expand Up @@ -309,7 +300,8 @@ if(toucan_FFmpeg_MINIMAL)
--enable-protocol=httpproxy
--enable-protocol=https
--enable-protocol=md5
--enable-protocol=pipe)
--enable-protocol=pipe
--enable-protocol=tls)
endif()
if(NOT WIN32)
list(APPEND FFmpeg_CONFIGURE_ARGS
Expand Down
4 changes: 0 additions & 4 deletions lib/toucan/Read.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,6 @@ namespace toucan
{
offsetTime -= _timeOffset;
}
if (!_timeRange.start_time().is_invalid_time())
{
offsetTime -= _timeRange.start_time();
}

out = _ffRead->getImage(offsetTime);

Expand Down

0 comments on commit 4d2d7b0

Please sign in to comment.