Skip to content

Commit

Permalink
Formatted code.
Browse files Browse the repository at this point in the history
  • Loading branch information
ggarra13 committed Feb 19, 2023
1 parent 0c0b0c5 commit 80503c9
Show file tree
Hide file tree
Showing 6 changed files with 138 additions and 122 deletions.
177 changes: 94 additions & 83 deletions mrv2/lib/mrvApp/App.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -335,11 +335,11 @@ namespace mrv
p.settingsObject->setDefaultValue(
"Devices/HDRMode", static_cast<int>(device::HDRMode::FromFile));
p.devicesModel->setHDRMode(static_cast<device::HDRMode>(
std_any_cast<int>(p.settingsObject->value("Devices/HDRMode"))));
std_any_cast<int>(p.settingsObject->value("Devices/HDRMode"))));
value = p.settingsObject->value("Devices/HDRData");
std::string s = value.type() == typeid(void)
? std::string()
: std_any_cast< std::string >(value);
? std::string()
: std_any_cast< std::string >(value);
if (!s.empty())
{
auto json = nlohmann::json::parse(s);
Expand All @@ -358,12 +358,12 @@ namespace mrv
switch (i.type)
{
case log::Type::Error:
{
std::string msg =
string::Format(_("ERROR: {0}")).arg(i.message);
{
std::string msg =
string::Format(_("ERROR: {0}")).arg(i.message);
_p->ui->uiStatusBar->timeout(errorTimeout);
_p->ui->uiStatusBar->copy_label(msg.c_str());
std::cerr << msg << std::endl;
std::cerr << msg << std::endl;
if (LogDisplay::prefs == LogDisplay::kWindowOnError)
{
if (!logsPanel)
Expand All @@ -377,7 +377,7 @@ namespace mrv
logsPanel->dock();
}
break;
}
}
default:
break;
}
Expand Down Expand Up @@ -704,19 +704,21 @@ namespace mrv
p.active[0]->inOutRange = p.timelinePlayers[0]->inOutRange();
p.active[0]->videoLayer = p.timelinePlayers[0]->videoLayer();
p.active[0]->audioOffset = p.timelinePlayers[0]->audioOffset();
p.active[0]->annotations = p.timelinePlayers[0]->getAllAnnotations();
p.active[0]->annotations =
p.timelinePlayers[0]->getAllAnnotations();
}

DBG;
std::vector<TimelinePlayer*> newTimelinePlayers;
auto audioSystem = _context->getSystem<audio::System>();
for (size_t i = 0; i < items.size(); ++i)
{
const auto& item = items[i];
for (size_t i = 0; i < items.size(); ++i)
{
const auto& item = items[i];
TimelinePlayer* mrvTimelinePlayer = nullptr;

std::cerr << "item " << i << " " << item->path.get()
<< " annotations=" << item->annotations.size() << std::endl;
std::cerr << "item " << i << " " << item->path.get()
<< " annotations=" << item->annotations.size()
<< std::endl;

try
{
Expand Down Expand Up @@ -772,21 +774,26 @@ namespace mrv
255);

DBG;
auto otioTimeline = item->audioPath.isEmpty() ?
timeline::create(item->path.get(), _context, options) :
timeline::create(item->path.get(), item->audioPath.get(), _context, options);
auto otioTimeline =
item->audioPath.isEmpty()
? timeline::create(item->path.get(), _context, options)
: timeline::create(
item->path.get(), item->audioPath.get(), _context,
options);

if (0)
{
//createMemoryTimeline(otioTimeline, item->path.getDirectory(), options.pathOptions);
// createMemoryTimeline(otioTimeline,
// item->path.getDirectory(), options.pathOptions);
}
auto timeline =
timeline::Timeline::create(otioTimeline, _context, options);

// @todo:
// @todo:
// auto& info = timeline->getIOInfo();
// if (info.video.empty())
// throw std::runtime_error(string::Format("{0}: Error reading file").arg(item->path.get()));
// throw std::runtime_error(string::Format("{0}: Error
// reading file").arg(item->path.get()));
// p.settingsObject->addRecentFile(item->path.get());

timeline::PlayerOptions playerOptions;
Expand All @@ -795,60 +802,64 @@ namespace mrv

DBG;

value = std_any_cast<int>(p.settingsObject->value("Performance/TimerMode"));
value = std_any_cast<int>(
p.settingsObject->value("Performance/TimerMode"));
playerOptions.timerMode = (timeline::TimerMode)value;
value = std_any_cast<int>(p.settingsObject->value("Performance/AudioBufferFrameCount"));
value = std_any_cast<int>(p.settingsObject->value(
"Performance/AudioBufferFrameCount"));
playerOptions.audioBufferFrameCount =
(timeline::AudioBufferFrameCount)value;
if (item->init)
{
playerOptions.currentTime = items[0]->currentTime;
}
if (item->init)
{
playerOptions.currentTime = items[0]->currentTime;
}

auto timelinePlayer = timeline::TimelinePlayer::create(
timeline, _context, playerOptions);

mrvTimelinePlayer = new mrv::TimelinePlayer(timelinePlayer, _context);

item->timeRange = mrvTimelinePlayer->timeRange();
item->ioInfo = mrvTimelinePlayer->ioInfo();
if (!item->init)
{
loaded = true;
item->init = true;
item->speed = mrvTimelinePlayer->speed();
item->playback = mrvTimelinePlayer->playback();
item->loop = mrvTimelinePlayer->loop();
item->currentTime = mrvTimelinePlayer->currentTime();
item->inOutRange = mrvTimelinePlayer->inOutRange();
item->videoLayer = mrvTimelinePlayer->videoLayer();
item->audioOffset = mrvTimelinePlayer->audioOffset();
}
else if (0 == i)
{
mrvTimelinePlayer->setSpeed(items[0]->speed);
mrvTimelinePlayer->setLoop(items[0]->loop);
mrvTimelinePlayer->setInOutRange(items[0]->inOutRange);
mrvTimelinePlayer->setVideoLayer(items[0]->videoLayer);
mrvTimelinePlayer->setVolume(p.volume);
mrvTimelinePlayer->setMute(p.mute);
mrvTimelinePlayer->setAudioOffset(items[0]->audioOffset);

mrvTimelinePlayer->setAllAnnotations(items[0]->annotations);

mrvTimelinePlayer->setPlayback(items[0]->playback);
}
if (i > 0)
{
mrvTimelinePlayer->setVideoLayer(items[i]->videoLayer);
mrvTimelinePlayer->setAllAnnotations(items[i]->annotations);
mrvTimelinePlayer->timelinePlayer()->setExternalTime(
newTimelinePlayers[0]->timelinePlayer());
}
mrvTimelinePlayer =
new mrv::TimelinePlayer(timelinePlayer, _context);

item->timeRange = mrvTimelinePlayer->timeRange();
item->ioInfo = mrvTimelinePlayer->ioInfo();
if (!item->init)
{
loaded = true;
item->init = true;
item->speed = mrvTimelinePlayer->speed();
item->playback = mrvTimelinePlayer->playback();
item->loop = mrvTimelinePlayer->loop();
item->currentTime = mrvTimelinePlayer->currentTime();
item->inOutRange = mrvTimelinePlayer->inOutRange();
item->videoLayer = mrvTimelinePlayer->videoLayer();
item->audioOffset = mrvTimelinePlayer->audioOffset();
}
else if (0 == i)
{
mrvTimelinePlayer->setSpeed(items[0]->speed);
mrvTimelinePlayer->setLoop(items[0]->loop);
mrvTimelinePlayer->setInOutRange(items[0]->inOutRange);
mrvTimelinePlayer->setVideoLayer(items[0]->videoLayer);
mrvTimelinePlayer->setVolume(p.volume);
mrvTimelinePlayer->setMute(p.mute);
mrvTimelinePlayer->setAudioOffset(items[0]->audioOffset);

mrvTimelinePlayer->setAllAnnotations(items[0]->annotations);

mrvTimelinePlayer->setPlayback(items[0]->playback);
}
if (i > 0)
{
mrvTimelinePlayer->setVideoLayer(items[i]->videoLayer);
mrvTimelinePlayer->setAllAnnotations(items[i]->annotations);
mrvTimelinePlayer->timelinePlayer()->setExternalTime(
newTimelinePlayers[0]->timelinePlayer());
}
}
catch (const std::exception& e)
{
if (!logsPanel) logs_panel_cb(NULL, p.ui);
if (!logsPanel)
logs_panel_cb(NULL, p.ui);
_log(e.what(), log::Type::Error);
// Remove this invalid file
p.filesModel->close();
Expand All @@ -864,23 +875,23 @@ namespace mrv
}
}

std::vector<mrv::TimelinePlayer*> validTimelinePlayers;
for (const auto& i : newTimelinePlayers)
{
if (i)
{
validTimelinePlayers.push_back(i);
}
}
// Delete the previous timeline players.
for (size_t i = 0; i < p.timelinePlayers.size(); ++i)
{
delete p.timelinePlayers[i];
}

p.active = items;
p.timelinePlayers = newTimelinePlayers;
std::vector<mrv::TimelinePlayer*> validTimelinePlayers;
for (const auto& i : newTimelinePlayers)
{
if (i)
{
validTimelinePlayers.push_back(i);
}
}

// Delete the previous timeline players.
for (size_t i = 0; i < p.timelinePlayers.size(); ++i)
{
delete p.timelinePlayers[i];
}

p.active = items;
p.timelinePlayers = newTimelinePlayers;

if (p.ui)
{
Expand Down Expand Up @@ -912,7 +923,8 @@ namespace mrv
c->uiFPS->value(player->speed());

c->uiTimeline->setTimelinePlayer(player);
if (colorPanel) colorPanel->refresh();
if (colorPanel)
colorPanel->refresh();
if (imageInfoPanel)
{
imageInfoPanel->setTimelinePlayer(player);
Expand Down Expand Up @@ -975,7 +987,6 @@ namespace mrv
}
}
#endif

}

_cacheUpdate();
Expand Down
2 changes: 1 addition & 1 deletion mrv2/lib/mrvApp/mrvFilesModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ namespace mrv
bool mute = false;
double audioOffset = 0.0;

std::vector<std::shared_ptr<draw::Annotation > > annotations;
std::vector<std::shared_ptr<draw::Annotation > > annotations;
};

//! Files model.
Expand Down
2 changes: 1 addition & 1 deletion mrv2/lib/mrvCore/Linux/mrvStackTrace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ void printStackTrace()
int frames = backtrace(callstack, 128);
char** symbols = backtrace_symbols(callstack, frames);

// Skip first frame which is this stack trace function
// Skip first frame which is this stack trace function
for (int i = 1; i < frames; i++)
{
printf("frame %d: ", i);
Expand Down
53 changes: 26 additions & 27 deletions mrv2/lib/mrvFLU/Flu_File_Chooser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,33 +137,32 @@ std::string Flu_File_Chooser::renameErrTxt = "Unable to rename '%s' to '%s'";

#define DEFAULT_ENTRY_WIDTH 235

Fl_Pixmap up_folder_img((char* const*)big_folder_up_xpm),
trash((char* const*)trash_xpm),
new_folder((char* const*)big_folder_new_xpm),
reload((char* const*)reload_xpm), preview_img((char* const*)monalisa_xpm),
file_list_img((char* const*)filelist_xpm),
file_listwide_img((char* const*)filelistwide_xpm),
fileDetails((char* const*)filedetails_xpm),
add_to_favorite_folder((char* const*)folder_favorite_xpm),
home((char* const*)bighome_xpm), favorites((char* const*)bigfavorites_xpm),
desktop((char* const*)desktop_xpm),
folder_closed((char* const*)folder_closed_xpm),
default_file((char* const*)textdoc_xpm),
my_computer((char* const*)my_computer_xpm),
computer((char* const*)computer_xpm),
disk_drive((char* const*)disk_drive_xpm),
cd_drive((char* const*)cd_drive_xpm),
floppy_drive((char* const*)floppy_drive_xpm),
removable_drive((char* const*)removable_drive_xpm),
ram_drive((char* const*)ram_drive_xpm),
network_drive((char* const*)network_drive_xpm),
documents((char* const*)filled_folder_xpm),
littlehome((char* const*)home_xpm),
little_favorites((char* const*)mini_folder_favorites_xpm),
little_desktop((char* const*)mini_desktop_xpm),
bigdocuments((char* const*)bigdocuments_xpm),
bigtemporary((char* const*)bigtemporary_xpm), reel((char* const*)reel_xpm),
picture((char* const*)image_xpm), music((char* const*)music_xpm);
Fl_Pixmap up_folder_img((char*const*)big_folder_up_xpm),
trash((char*const*)trash_xpm), new_folder((char*const*)big_folder_new_xpm),
reload((char*const*)reload_xpm), preview_img((char*const*)monalisa_xpm),
file_list_img((char*const*)filelist_xpm),
file_listwide_img((char*const*)filelistwide_xpm),
fileDetails((char*const*)filedetails_xpm),
add_to_favorite_folder((char*const*)folder_favorite_xpm),
home((char*const*)bighome_xpm), favorites((char*const*)bigfavorites_xpm),
desktop((char*const*)desktop_xpm),
folder_closed((char*const*)folder_closed_xpm),
default_file((char*const*)textdoc_xpm),
my_computer((char*const*)my_computer_xpm),
computer((char*const*)computer_xpm),
disk_drive((char*const*)disk_drive_xpm),
cd_drive((char*const*)cd_drive_xpm),
floppy_drive((char*const*)floppy_drive_xpm),
removable_drive((char*const*)removable_drive_xpm),
ram_drive((char*const*)ram_drive_xpm),
network_drive((char*const*)network_drive_xpm),
documents((char*const*)filled_folder_xpm),
littlehome((char*const*)home_xpm),
little_favorites((char*const*)mini_folder_favorites_xpm),
little_desktop((char*const*)mini_desktop_xpm),
bigdocuments((char*const*)bigdocuments_xpm),
bigtemporary((char*const*)bigtemporary_xpm), reel((char*const*)reel_xpm),
picture((char*const*)image_xpm), music((char*const*)music_xpm);

#define streq(a, b) (strcmp(a, b) == 0)

Expand Down
4 changes: 2 additions & 2 deletions mrv2/lib/mrvGL/mrvGLOffscreenContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -362,15 +362,15 @@ namespace mrv
if (p.dpy)
{
XLockDisplay(p.dpy);

Bool ok = glXMakeContextCurrent(p.dpy, None, None, NULL);
if (ok != True)
{
LOG_ERROR("Could not make the null context current");
}
glXDestroyPbuffer(p.dpy, p.x11_pbuffer);
glXDestroyContext(p.dpy, p.x11_context);

XUnlockDisplay(p.dpy);
}
#endif
Expand Down
Loading

0 comments on commit 80503c9

Please sign in to comment.