| 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 | 67 | virtual void Pause() {} | |
| 50 | 7339 | 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 | 111204 | virtual uint64_t GetLengthInMS() { return 0; } | |
| 62 | 222404 | virtual uint64_t GetElapsedMS() { return 0; } | |
| 63 | |||
| 64 | 196293 | std::string GetType(void) { return m_type; } | |
| 65 | int IsPrepped(void) { return m_isPrepped; } | ||
| 66 | |||
| 67 | ✗ | int64_t GetTimeCode() const { return m_timeCode; } | |
| 68 | |||
| 69 | enum class PlaylistBranchType { | ||
| 70 | NoBranch, | ||
| 71 | Index, | ||
| 72 | Offset, | ||
| 73 | Playlist | ||
| 74 | }; | ||
| 75 | 15904 | virtual PlaylistBranchType GetNextBranchType() { return PlaylistBranchType::NoBranch; } | |
| 76 | ✗ | virtual std::string GetNextSection(void) { return ""; } | |
| 77 | ✗ | virtual int GetNextItem(void) { return 0; } | |
| 78 | ✗ | virtual std::string GetNextData(void) { return ""; } | |
| 79 | |||
| 80 | 4055 | void SetPositionInPlaylist(int i) { m_playlistPosition = i; } | |
| 81 | 3129 | int GetPositionInPlaylist() { return m_playlistPosition; } | |
| 82 | |||
| 83 | protected: | ||
| 84 | int CanPlay(void); | ||
| 85 | void FinishPlay(void); | ||
| 86 | |||
| 87 | std::string m_type; | ||
| 88 | std::string m_note; | ||
| 89 | int m_enabled; | ||
| 90 | int m_isStarted; | ||
| 91 | int m_isPlaying; | ||
| 92 | int m_isFinished; | ||
| 93 | int m_playOnce; | ||
| 94 | int m_playCount; | ||
| 95 | int m_isPrepped; | ||
| 96 | int m_deprecated; | ||
| 97 | int m_playlistPosition; | ||
| 98 | |||
| 99 | Json::Value m_config; | ||
| 100 | PlaylistEntryBase* m_parent; | ||
| 101 | Playlist* m_parentPlaylist; | ||
| 102 | |||
| 103 | int64_t m_timeCode = -1; | ||
| 104 | }; | ||
| 105 |