Add decoded input slots for render workers
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
|
||||
#include "ipcmessage.h"
|
||||
|
||||
#include <QJsonArray>
|
||||
#include <QJsonDocument>
|
||||
#include <QIODevice>
|
||||
|
||||
@@ -78,9 +79,11 @@ QJsonObject HandshakeMsg::ToJson() const
|
||||
o["type"] = msgtype::kHandshake;
|
||||
o["protocol_version"] = protocol_version;
|
||||
o["shm_key"] = shm_key;
|
||||
o["input_shm_key"] = input_shm_key;
|
||||
o["input_slots"] = input_slots;
|
||||
o["output_slots"] = output_slots;
|
||||
o["slot_data_bytes"] = double(slot_data_bytes);
|
||||
o["input_slot_data_bytes"] = double(input_slot_data_bytes);
|
||||
return o;
|
||||
}
|
||||
|
||||
@@ -91,9 +94,11 @@ bool HandshakeMsg::FromJson(const QJsonObject &o, HandshakeMsg *out)
|
||||
}
|
||||
out->protocol_version = o["protocol_version"].toInt();
|
||||
out->shm_key = o["shm_key"].toString();
|
||||
out->input_shm_key = o["input_shm_key"].toString();
|
||||
out->input_slots = o["input_slots"].toInt();
|
||||
out->output_slots = o["output_slots"].toInt();
|
||||
out->slot_data_bytes = qint64(o["slot_data_bytes"].toDouble());
|
||||
out->input_slot_data_bytes = qint64(o["input_slot_data_bytes"].toDouble());
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -112,6 +117,12 @@ QJsonObject RenderFrameMsg::ToJson() const
|
||||
o["format"] = format;
|
||||
o["channels"] = channel_count;
|
||||
o["mode"] = mode;
|
||||
o["input_slot"] = input_slot;
|
||||
QJsonArray input_slot_array;
|
||||
for (int slot : input_slots) {
|
||||
input_slot_array.append(slot);
|
||||
}
|
||||
o["input_slots"] = input_slot_array;
|
||||
return o;
|
||||
}
|
||||
|
||||
@@ -129,6 +140,15 @@ bool RenderFrameMsg::FromJson(const QJsonObject &o, RenderFrameMsg *out)
|
||||
out->format = o["format"].toInt(-1);
|
||||
out->channel_count = o["channels"].toInt();
|
||||
out->mode = o["mode"].toInt();
|
||||
out->input_slot = o["input_slot"].toInt(-1);
|
||||
out->input_slots.clear();
|
||||
const QJsonArray input_slot_array = o["input_slots"].toArray();
|
||||
for (const QJsonValue &slot : input_slot_array) {
|
||||
out->input_slots.append(slot.toInt(-1));
|
||||
}
|
||||
if (out->input_slots.isEmpty() && out->input_slot >= 0) {
|
||||
out->input_slots.append(out->input_slot);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -192,4 +212,4 @@ bool LoadGraphMsg::FromJson(const QJsonObject &o, LoadGraphMsg *out)
|
||||
}
|
||||
|
||||
} // namespace ipc
|
||||
} // namespace olive
|
||||
} // namespace olive
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include <QByteArray>
|
||||
#include <QJsonObject>
|
||||
#include <QString>
|
||||
#include <QVector>
|
||||
|
||||
class QIODevice;
|
||||
|
||||
@@ -91,10 +92,12 @@ bool ReadMessage(QByteArray *buffer, QJsonObject *out, bool *ok = nullptr);
|
||||
|
||||
struct HandshakeMsg {
|
||||
int protocol_version = 0;
|
||||
QString shm_key; ///< Shared-memory segment key for this worker.
|
||||
QString shm_key; ///< Worker->main output shared-memory segment key.
|
||||
QString input_shm_key; ///< Main->worker input shared-memory segment key (optional).
|
||||
int input_slots = 0; ///< Number of main->worker input frame slots.
|
||||
int output_slots = 0; ///< Number of worker->main output frame slots.
|
||||
qint64 slot_data_bytes = 0; ///< Per-slot pixel block size (max frame size).
|
||||
qint64 slot_data_bytes = 0; ///< Per-output-slot pixel block size.
|
||||
qint64 input_slot_data_bytes = 0; ///< Per-input-slot pixel block size.
|
||||
|
||||
QJsonObject ToJson() const;
|
||||
static bool FromJson(const QJsonObject &o, HandshakeMsg *out);
|
||||
@@ -110,6 +113,8 @@ struct RenderFrameMsg {
|
||||
int format = -1; ///< Forced PixelFormat::Format (-1 = default/INVALID).
|
||||
int channel_count = 0; ///< 0 = default.
|
||||
int mode = 0; ///< RenderMode::Mode.
|
||||
int input_slot = -1; ///< Optional main->worker decoded input slot for footage nodes.
|
||||
QVector<int> input_slots; ///< Optional ordered decoded input slots for footage nodes.
|
||||
|
||||
QJsonObject ToJson() const;
|
||||
static bool FromJson(const QJsonObject &o, RenderFrameMsg *out);
|
||||
@@ -140,4 +145,4 @@ struct LoadGraphMsg {
|
||||
} // namespace ipc
|
||||
} // namespace olive
|
||||
|
||||
#endif // IPC_IPCMESSAGE_H
|
||||
#endif // IPC_IPCMESSAGE_H
|
||||
|
||||
Reference in New Issue
Block a user