GCC Code Coverage Report


Directory: ./
File: playlist/PlaylistEntryBase.h
Date: 2026-12-01 12:27:28
Exec Total Coverage
Lines: 10 14 71.4%
Functions: 10 14 71.4%
Branches: 0 4 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 LGPL v2.1 as described in the
11 * included LICENSE.LGPL file.
12 */
13
14 #include <pthread.h>
15 #include "fpp-json.h"
16
17 #include <string>
18
19 class Playlist;
20
21 class PlaylistEntryBase {
22 public:
23 PlaylistEntryBase(Playlist* playlist, PlaylistEntryBase* parent = NULL);
24 virtual ~PlaylistEntryBase();
25
26 virtual int Init(Json::Value& config);
27
28 virtual int StartPlaying(void);
29 // Back to "not started" for an entry that is about to be played again
30 // but will be started later than its parent (see PlaylistEntryBoth).
31 // FinishPlay() leaves the entry started and finished, and only
32 // StartPlaying() clears that, so without this a repeating playlist's
33 // second pass sees the first pass's state.
34 void ResetPlayState(void);
35 // StartPlaying(), then finish an entry that came back neither playing nor
36 // finished -- an early return that skipped FinishPlay() (e.g. a random
37 // media entry with no files). Callers only advance past a finished entry,
38 // so such an entry stalled the playlist for good. Use this wherever a
39 // playlist starts one of its entries.
40 int StartPlayingOrFinish(void);
41 virtual int IsStarted(void);
42 virtual int IsPlaying(void);
43 virtual int IsFinished(void);
44
45 virtual int Prep(void);
46 virtual int Process(void);
47 virtual int Stop(void);
48
49 65 virtual void Pause() {}
50 10097 virtual bool IsPaused() { return false; }
51 ✗ virtual void Resume() {}
52
53 virtual void Dump(void);
54
55 virtual Json::Value GetConfig(void);
56
57 virtual Json::Value GetMqttStatus(void);
58
59 virtual std::string ReplaceMatches(std::string in);
60
61 153472 virtual uint64_t GetLengthInMS() { return 0; }
62 239552 virtual uint64_t GetElapsedMS() { return 0; }
63
64 // This entry plays next: get its media ready now, as far as that can be
65 // done without playing it (Playlist::PrepareNextIfDue()).
66 1129 virtual void PrepareAhead() {}
67
68 181986 std::string GetType(void) { return m_type; }
69 int IsPrepped(void) { return m_isPrepped; }
70
71 15 int64_t GetTimeCode() const { return m_timeCode; }
72
73 enum class PlaylistBranchType {
74 NoBranch,
75 Index,
76 Offset,
77 Playlist
78 };
79 23409 virtual PlaylistBranchType GetNextBranchType() { return PlaylistBranchType::NoBranch; }
80 ✗ virtual std::string GetNextSection(void) { return ""; }
81 ✗ virtual int GetNextItem(void) { return 0; }
82 ✗ virtual std::string GetNextData(void) { return ""; }
83
84 5731 void SetPositionInPlaylist(int i) { m_playlistPosition = i; }
85 56051 int GetPositionInPlaylist() { return m_playlistPosition; }
86
87 protected:
88 int CanPlay(void);
89 void FinishPlay(void);
90
91 std::string m_type;
92 std::string m_note;
93 int m_enabled;
94 int m_isStarted;
95 int m_isPlaying;
96 int m_isFinished;
97 int m_playOnce;
98 int m_playCount;
99 int m_isPrepped;
100 int m_deprecated;
101 int m_playlistPosition;
102
103 Json::Value m_config;
104 PlaylistEntryBase* m_parent;
105 Playlist* m_parentPlaylist;
106
107 int64_t m_timeCode = -1;
108 };
109