Skip to content

Commit

Permalink
Bug fixes (#51)
Browse files Browse the repository at this point in the history
* Bug fixes

Signed-off-by: Al Crate <al@dneg.com>
  • Loading branch information
alatdneg authored Aug 7, 2023
1 parent 38d2b07 commit b83ddbe
Show file tree
Hide file tree
Showing 16 changed files with 136 additions and 74 deletions.
9 changes: 0 additions & 9 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1 @@










2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)

set(XSTUDIO_GLOBAL_VERSION "0.11.0" CACHE STRING "Version string")
set(XSTUDIO_GLOBAL_VERSION "0.11.2" CACHE STRING "Version string")
set(XSTUDIO_GLOBAL_NAME xStudio)

project(${XSTUDIO_GLOBAL_NAME} VERSION ${XSTUDIO_GLOBAL_VERSION} LANGUAGES CXX)
Expand Down
2 changes: 1 addition & 1 deletion docs/build_guides/centos_7.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Install 5.15 dev tools, using Qt5 online installer, requires login account (free
wget https://github.com/nlohmann/json/archive/refs/tags/v3.11.2.tar.gz
tar -xf v3.11.2.tar.gz
mkdir json-3.11.2/build
cd json-3.7.3/build
cd json-3.11.2/build
cmake .. -DJSON_BuildTests=Off
make -j $JOBS
sudo make install
Expand Down
2 changes: 1 addition & 1 deletion docs/build_guides/rocky_linux_9_1.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
wget https://github.com/nlohmann/json/archive/refs/tags/v3.11.2.tar.gz
tar -xf v3.11.2.tar.gz
mkdir json-3.11.2/build
cd json-3.7.3/build
cd json-3.11.2/build
cmake .. -DJSON_BuildTests=Off
make -j $JOBS
sudo make install
Expand Down
2 changes: 1 addition & 1 deletion include/xstudio/ui/qml/session_model_ui.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ class SessionModel : public caf::mixin::actor_object<JSONTreeModel> {
Q_INVOKABLE void relinkMedia(const QModelIndexList &indexes, const QUrl &path);
Q_INVOKABLE void decomposeMedia(const QModelIndexList &indexes);
Q_INVOKABLE void rescanMedia(const QModelIndexList &indexes);
Q_INVOKABLE QModelIndex getPlaylistIndex(const QModelIndex &index) const;

signals:
void bookmarkActorAddrChanged();
Expand Down Expand Up @@ -296,7 +297,6 @@ class SessionModel : public caf::mixin::actor_object<JSONTreeModel> {
const utility::JsonTree &tree,
const QPersistentModelIndex &search_hint = QModelIndex());
utility::Uuid refreshId(nlohmann::json &ij);
QModelIndex getPlaylistIndex(const QModelIndex &index) const;

QFuture<QList<QUuid>> handleMediaIdDropFuture(
const int proposedAction, const utility::JsonStore &drop, const QModelIndex &index);
Expand Down
3 changes: 2 additions & 1 deletion src/media/src/media_source_actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ MediaSourceActor::MediaSourceActor(
base_.set_media_reference(mr);


anon_send(actor_cast<actor>(this), acquire_media_detail_atom_v, media_reference.rate());
// special case , when duplicating, as that'll suppy streams.
// anon_send(actor_cast<actor>(this), acquire_media_detail_atom_v, media_reference.rate());

init();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -757,7 +757,12 @@ ShotgunDataSourceActor<T>::ShotgunDataSourceActor(

// do we need the UI to have spun up before we can issue calls to shotgun...
// erm...
[=](use_data_atom, const caf::uri &uri) -> result<UuidActorVector> {
[=](use_data_atom atom, const caf::uri &uri) {
delegate(actor_cast<caf::actor>(this), atom, uri, FrameRate());
},
[=](use_data_atom,
const caf::uri &uri,
const FrameRate &media_rate) -> result<UuidActorVector> {
// check protocol == shotgun..
if (uri.scheme() != "shotgun")
return UuidActorVector();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,7 @@ XsWindow {
)

publishNotesDialog.payload = tmp
// console.log(tmp)
publish_func(tmp, playlist_uuid)
// onAccepted: push_playlist_note_promise(data_source, payload, playlist, playlist_uuid, error)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -992,16 +992,15 @@ Item {
let inds = app_window.sessionSelectionModel.selectedIndexes
inds.forEach(
function (item, index) {
let type = item.model.get(item, "typeRole")
if(type == "Playlist") {
// get playlist name
let uuid = item.model.get(item, "actorUuidRole")

push_notes_dialog.publishSelected = selected_media
push_notes_dialog.playlist_uuid = uuid
push_notes_dialog.updatePublish()
push_notes_dialog.show()
}
// find playlist..
let plind = app_window.sessionModel.getPlaylistIndex(item)
// get playlist name
let uuid = item.model.get(plind, "actorUuidRole")

push_notes_dialog.publishSelected = selected_media
push_notes_dialog.playlist_uuid = uuid
push_notes_dialog.updatePublish()
push_notes_dialog.show()
}
)
}
Expand Down
11 changes: 6 additions & 5 deletions src/plugin/media_reader/openexr/src/openexr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -580,22 +580,23 @@ xstudio::media::MediaDetail OpenEXRMediaReader::detail(const caf::uri &uri) cons
else if (timecode_rate)
fr = static_cast<double>(timecode_rate->value());

if (fr == 0.0)
fr = 24.0;

if (timecode) {
// note if frame rate is no known from metadata we use 24pfs
// as a default
tc = utility::Timecode(
timecode->value().hours(),
timecode->value().minutes(),
timecode->value().seconds(),
timecode->value().frame(),
fr,
fr == 0.0 ? 24.0 : fr,
timecode->value().dropFrame());
} else if (rate) {
tc = utility::Timecode("00:00:00:00", fr);
}

frd.set_rate(utility::FrameRate(1.0 / fr));
// if frame rate is not known, return null frame rate so xSTUDIO will
// apply its global frame rate
frd.set_rate(fr == 0.0 ? utility::FrameRate() : utility::FrameRate(1.0 / fr));

std::vector<std::string> stream_ids;
for (int prt = 0; prt < parts; ++prt) {
Expand Down
66 changes: 33 additions & 33 deletions src/plugin_manager/src/plugin_manager_actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,39 @@ PluginManagerActor::PluginManagerActor(caf::actor_config &cfg) : caf::event_base
delegate(actor_cast<caf::actor>(this), json_store::update_atom_v, full);
},

// helper for dealing with URI's
[=](data_source::use_data_atom,
const caf::uri &uri,
const FrameRate &media_rate) -> result<UuidActorVector> {
// send to resident enabled datasource plugins
auto actors = std::vector<caf::actor>();

for (const auto &i : manager_.factories()) {
if (i.second.factory()->type() == PluginType::PT_DATA_SOURCE and
resident_.count(i.first))
actors.push_back(resident_[i.first]);
}

if (actors.empty())
return UuidActorVector();

auto rp = make_response_promise<UuidActorVector>();

fan_out_request<policy::select_all>(
actors, infinite, data_source::use_data_atom_v, uri, media_rate)
.then(
[=](const std::vector<UuidActorVector> results) mutable {
for (const auto &i : results) {
if (not i.empty())
return rp.deliver(i);
}
rp.deliver(UuidActorVector());
},
[=](error &err) mutable { rp.deliver(std::move(err)); });

return rp;
},

// helper for dealing with Media sources back population's
[=](data_source::use_data_atom,
const caf::actor &media,
Expand Down Expand Up @@ -166,39 +199,6 @@ PluginManagerActor::PluginManagerActor(caf::actor_config &cfg) : caf::event_base
return rp;
},

// helper for dealing with URI's
[=](data_source::use_data_atom,
const caf::uri &uri,
const FrameRate &media_rate) -> result<UuidActorVector> {
// send to resident enabled datasource plugins
auto actors = std::vector<caf::actor>();

for (const auto &i : manager_.factories()) {
if (i.second.factory()->type() == PluginType::PT_DATA_SOURCE and
resident_.count(i.first))
actors.push_back(resident_[i.first]);
}

if (actors.empty())
return UuidActorVector();

auto rp = make_response_promise<UuidActorVector>();

fan_out_request<policy::select_all>(
actors, infinite, data_source::use_data_atom_v, uri, media_rate)
.then(
[=](const std::vector<UuidActorVector> results) mutable {
for (const auto &i : results) {
if (not i.empty())
return rp.deliver(i);
}
rp.deliver(UuidActorVector());
},
[=](error &err) mutable { rp.deliver(std::move(err)); });

return rp;
},

[=](json_store::update_atom, const JsonStore &js) {
try {
// this will trash manually enabled/disabled plugins.
Expand Down
44 changes: 40 additions & 4 deletions src/ui/qml/session/src/session_model_handler_ui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,39 @@ void SessionModel::init(caf::actor_system &_system) {
}
},

[=](utility::event_atom, media::add_media_stream_atom, const UuidActor &) {},

// NEVER TRIGGERS ? NOT TESTED !
[=](utility::event_atom, media::add_media_stream_atom, const UuidActor &) {
// spdlog::warn("media::add_media_stream_atom");
try {
auto src = caf::actor_cast<caf::actor>(self()->current_sender());
auto src_str = actorToString(system(), src);

auto indexes = search_recursive_list(
QVariant::fromValue(QStringFromStd(src_str)),
actorRole,
QModelIndex(),
0,
1);

if (not indexes.empty() and indexes[0].isValid()) {
const nlohmann::json &j = indexToData(indexes[0]);

// spdlog::warn("media::add_media_stream_atom REQUEST");

requestData(
QVariant::fromValue(QStringFromStd(src_str)),
actorRole,
getPlaylistIndex(indexes[0]),
j,
childrenRole);
} else {
spdlog::warn("FAIELD");
}
} catch (const std::exception &err) {
spdlog::warn("{} {}", __PRETTY_FUNCTION__, err.what());
}
},

[=](utility::event_atom,
playlist::move_media_atom,
Expand All @@ -656,18 +688,22 @@ void SessionModel::init(caf::actor_system &_system) {
auto index = search_recursive(
QVariant::fromValue(QStringFromStd(src_str)), actorRole);

spdlog::info("utility::event_atom, utility::move_media_atom {}", src_str);
// spdlog::info("utility::event_atom, utility::move_media_atom {}",
// src_str);

// trigger update of model..
if (index.isValid()) {
const nlohmann::json &j = indexToData(index);
// spdlog::warn("{}", j.dump(2));
if (j.at("type") == "Subset" or j.at("type") == "Timeline") {
auto media_id = j.at("children").at(0).at("id");
const auto tree = *(indexToTree(index)->child(0));
auto media_id = tree.data().at("id");

requestData(
QVariant::fromValue(QUuidFromUuid(media_id)),
idRole,
index,
j.at("children").at(0),
tree.data(),
childrenRole);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/ui/qml/session/src/session_model_methods_ui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ QVariant SessionModel::playlists() const {
auto data = R"([])"_json;
try {
auto value = R"({"text": null, "uuid":null})"_json;
for (const auto &i : data_) {
for (const auto &i : *(data_.child(0))) {
value["text"] = i.data().at("name");
value["uuid"] = i.data().at("actor_uuid");
data.push_back(value);
Expand Down
8 changes: 8 additions & 0 deletions src/ui/qml/session/src/session_model_ui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,14 @@ void SessionModel::processChildren(const nlohmann::json &rj, const QModelIndex &
// spdlog::warn("processChildren {} {} {}", type, ptree->data().dump(2), rj.dump(2));
// spdlog::warn("processChildren {}", tree_to_json( *ptree,"children").dump(2));
// spdlog::warn("processChildren {}", rj.dump(2));
if (type == "MediaSource" and rj.at(0).at("children").empty() and
rj.at(1).at("children").empty()) {
// spdlog::warn("RETRY {}", rj.dump(2));
// force retry
emit dataChanged(parent_index, parent_index, roles);
return;
}


try {
if (type == "Session" or type == "Container List" or type == "Media" or
Expand Down
3 changes: 3 additions & 0 deletions ui/qml/xstudio/menus/XsMediaMenu.qml
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ XsMenu {
fakeDisabled: false
Repeater {
model: app_window.mediaImageSource.streams
onItemAdded: stream_menu.insertItem(index, item)
onItemRemoved: stream_menu.removeItem(item)

XsMenuItem {
mytext: modelData.name
enabled: true
Expand Down
28 changes: 24 additions & 4 deletions ui/qml/xstudio/panels/playlist/XsPlaylistsPanelNew.qml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import QuickFuture 1.0
import QuickPromise 1.0

import xStudio 1.1
import xstudio.qml.helpers 1.0

Rectangle {
id: panel
Expand Down Expand Up @@ -132,14 +133,33 @@ Rectangle {
}

if("xstudio/media-ids" in data) {
media_move_copy_dialog.data = data
let before = null
let internal_copy = false

if(previousItem) {
media_move_copy_dialog.index = previousItem.modelIndex()
before = previousItem.modelIndex()
}

// does media exist in our parent.
if(before) {
let mi = app_window.sessionModel.search_recursive(
helpers.QVariantFromUuidString(data["xstudio/media-ids"].split("\n")[0]), "idRole"
)

if(app_window.sessionModel.getPlaylistIndex(before) == app_window.sessionModel.getPlaylistIndex(mi)) {
internal_copy = true
}
}

if(internal_copy) {
Future.promise(
app_window.sessionModel.handleDropFuture(Qt.CopyAction, data, before)
).then(function(quuids){})
} else {
media_move_copy_dialog.index = null
media_move_copy_dialog.data = data
media_move_copy_dialog.index = before
media_move_copy_dialog.open()
}
media_move_copy_dialog.open()

} else {
if(previousItem) {
Expand Down

0 comments on commit b83ddbe

Please sign in to comment.