GCC Code Coverage Report


Directory: ./
File: mediaoutput/MediaOutputStatus.h
Date: 2026-10-29 08:11:58
Exec Total Coverage
Lines: 15 15 100.0%
Functions: 3 3 100.0%
Branches: 0 0 -%

Line Branch Exec Source
1 #pragma once
2 /*
3 * This file is part of the Falcon Player (FPP) and is Copyright (C)
4 * 2013-2022 by the Falcon Player Developers.
5 *
6 * The Falcon Player (FPP) is free software, and is covered under
7 * multiple Open Source licenses. Please see the included 'LICENSES'
8 * file for descriptions of what files are covered by each license.
9 *
10 * This source file is covered under the GPL v2 as described in the
11 * included LICENSE.GPL file.
12 */
13
14 #include <atomic>
15 #include <mutex>
16 #include <string>
17
18 class MediaOutputStatus {
19 public:
20 // The timing fields are written by whoever owns the output -- the
21 // playlist on the main loop, a command's thread -- and read for status by
22 // the API threads, and a resume or a slot's reset writes them from another
23 // thread again. Writes and those cross-thread reads hold this. A leaf:
24 // held only to copy or write fields, never across a call.
25 677367 static std::mutex& FieldsLock() {
26 static std::mutex m;
27 677367 return m;
28 }
29
30 // Set from GStreamer's bus thread when media ends or fails, read by the
31 // playlist on the main loop.
32 std::atomic<int> status{ 0 };
33 // Zero until the output first reports: Play Media's private status is a
34 // member of a heap object, and Media Slot Status read it before then.
35 int secondsElapsed = 0;
36 int subSecondsElapsed = 0;
37 int secondsRemaining = 0;
38 int subSecondsRemaining = 0;
39 int minutesTotal = 0;
40 int secondsTotal = 0;
41 float mediaSeconds = 0.0f;
42 std::string output;
43 bool mediaLoading = false;
44
45 21405 MediaOutputStatus() = default;
46 // Copyable as it was before status became atomic (slots reset theirs by
47 // assigning a fresh one).
48 MediaOutputStatus(const MediaOutputStatus& o) { *this = o; }
49 10197 MediaOutputStatus& operator=(const MediaOutputStatus& o) {
50 20394 status = o.status.load();
51 10197 secondsElapsed = o.secondsElapsed;
52 10197 subSecondsElapsed = o.subSecondsElapsed;
53 10197 secondsRemaining = o.secondsRemaining;
54 10197 subSecondsRemaining = o.subSecondsRemaining;
55 10197 minutesTotal = o.minutesTotal;
56 10197 secondsTotal = o.secondsTotal;
57 10197 mediaSeconds = o.mediaSeconds;
58 10197 output = o.output;
59 10197 mediaLoading = o.mediaLoading;
60 10197 return *this;
61 }
62 };
63