feat: receive ordered stream playback queues

This commit is contained in:
2026-10-22 14:06:47 +02:00
parent e7a33ff68e
commit 70672321a1
9 changed files with 239 additions and 7 deletions
+20 -2
View File
@@ -197,7 +197,7 @@ struct Player {
PlayerStatus status = PLAYER_EMPTY;
bool previewShown = false;
std::array<char, 512> error{};
std::unique_ptr<playback::ProgressReporter> reporter;
std::unique_ptr<playback::ProgressReports> reporter;
bool remoteReporting = false;
std::thread worker;
@@ -1432,7 +1432,7 @@ bool player_set_progress_file(Player *player, const char *path, char *error) {
if (player->reporter || player->stopping.load(std::memory_order_relaxed) ||
player->state.status != PLAYER_EMPTY || !player->commands.empty())
throw std::runtime_error("Progress reporting must be initialized once, before opening media");
player->reporter = std::make_unique<playback::ProgressReporter>(path);
player->reporter = std::make_unique<playback::ProgressReports>(path);
return true;
} catch (const std::exception &failure) {
if (error) copyError(error, failure.what());
@@ -1441,6 +1441,24 @@ bool player_set_progress_file(Player *player, const char *path, char *error) {
}
return false;
}
bool player_register_progress_file(Player *player, const char *identity, const char *path, char *error) {
if (error) error[0] = '\0';
try {
if (!player || !identity || !path) throw std::runtime_error("Queue progress identity and path are required");
std::lock_guard<std::mutex> lock(player->mutex);
if (player->stopping.load(std::memory_order_relaxed) ||
player->state.status != PLAYER_EMPTY || !player->commands.empty())
throw std::runtime_error("Queue reports must be registered before opening media");
if (!player->reporter) player->reporter = std::make_unique<playback::ProgressReports>();
player->reporter->registerFile(identity, path);
return true;
} catch (const std::exception &failure) {
if (error) copyError(error, failure.what());
} catch (...) {
if (error) copyError(error, "Could not register queue progress reporting");
}
return false;
}
bool player_get_progress_error(Player *player, char *error) {
if (error) error[0] = '\0';
if (!player || !player->reporter) return false;