summaryrefslogtreecommitdiff
path: root/DecoderOutputFramer.cpp
diff options
context:
space:
mode:
authorChristoph Berg <myon@debian.org>2026-10-09 14:12:49 +0200
committerChristoph Berg <myon@debian.org>2026-10-09 14:12:49 +0200
commit76956486fa7ef52a51d4e56df1e13a9f19a6c93c (patch)
treefe0c394439fdc167d1970372e8998874090854dd /DecoderOutputFramer.cpp
parent0685fcada9f95fe90f70b387cd7d757da8209624 (diff)
parentffc62c792c9a5196cb4ce7a353287dfe20db6524 (diff)
Update upstream source from tag 'upstream/3.3.0_beta1+dfsg'
Update to upstream version '3.3.0~beta1+dfsg' with Debian dir 85037bbb9376721108594b59b54ead82ac6924a3
Diffstat (limited to 'DecoderOutputFramer.cpp')
-rw-r--r--DecoderOutputFramer.cpp44
1 files changed, 43 insertions, 1 deletions
diff --git a/DecoderOutputFramer.cpp b/DecoderOutputFramer.cpp
index 92c9c1e9..151c6afb 100644
--- a/DecoderOutputFramer.cpp
+++ b/DecoderOutputFramer.cpp
@@ -10,7 +10,44 @@ void DecoderOutputFramer::drain (QIODevice& device,
auto const rawLine = device.readLine ();
Event event {EventType::Malformed, generation_, rawLine, {}};
- if (rawLine.startsWith ("<DecodeStarted>"))
+ if (rawLine.startsWith ("<DecoderReady")
+ || rawLine.startsWith ("<DecoderError"))
+ {
+ auto line = rawLine;
+ if (line.endsWith ('\n')) line.chop (1);
+ if (line.endsWith ('\r')) line.chop (1);
+ QByteArray const readyPrefix {"<DecoderReady> version="};
+ QByteArray const errorPrefix {"<DecoderError> status="};
+ if (line.startsWith (readyPrefix))
+ {
+ auto const versionText = line.mid (readyPrefix.size ());
+ bool valid = !versionText.isEmpty ();
+ for (auto const character : versionText)
+ valid = valid && character >= '0' && character <= '9';
+ bool numeric {false};
+ auto const version = versionText.toInt (&numeric);
+ if (valid && numeric && version > 0)
+ {
+ event.type = EventType::Ready;
+ event.protocolVersion = version;
+ }
+ }
+ else if (line.startsWith (errorPrefix))
+ {
+ auto const status = line.mid (errorPrefix.size ());
+ bool valid = !status.isEmpty ();
+ for (auto const character : status)
+ valid = valid && ((character >= 'a' && character <= 'z')
+ || (character >= '0' && character <= '9')
+ || character == '-');
+ if (valid)
+ {
+ event.type = EventType::Error;
+ event.errorStatus = status;
+ }
+ }
+ }
+ else if (rawLine.startsWith ("<DecodeStarted>"))
{
qint32 generation {0};
if (!generation_ && DecoderIpc::parseStart (rawLine, &generation))
@@ -20,6 +57,11 @@ void DecoderOutputFramer::drain (QIODevice& device,
event.generation = generation;
}
}
+ else if (rawLine.startsWith ("<DecodeRejected"))
+ {
+ if (generation_ && rawLine.startsWith ("<DecodeRejected> "))
+ event.type = EventType::Rejected;
+ }
else if (rawLine.startsWith ("<DecodeFinished>"))
{
DecoderIpc::Completion completion {};