Remove "Played to end" and replace it with "Playlist end" state

"Ended" can now be used to also detect the end of individual playlist
items.
This commit is contained in:
WarmUpTill
2022-03-15 21:03:16 +01:00
committed by WarmUpTill
parent 11fede6cc3
commit ddc2ee4fa5
3 changed files with 129 additions and 105 deletions

View File

@@ -31,7 +31,7 @@ enum class MediaState {
// Just a marker
LAST_OBS_MEDIA_STATE,
// states added for use in the plugin
PLAYED_TO_END = custom_media_states_offset,
PLAYLIST_ENDED = custom_media_states_offset,
ANY,
};
@@ -58,6 +58,7 @@ public:
void ResetSignalHandler();
static void MediaStopped(void *data, calldata_t *);
static void MediaEnded(void *data, calldata_t *);
static void MediaNext(void *data, calldata_t *);
MediaSourceType _sourceType = MediaSourceType::SOURCE;
SceneSelection _scene;
@@ -70,17 +71,19 @@ public:
bool _onlyMatchonChagne = false;
private:
bool CheckTime();
bool CheckState();
bool CheckPlaylistEnd(const obs_media_state);
bool CheckMediaMatch();
bool _stopped = false;
bool _ended = false;
bool _next = false;
// TODO: Remove _alreadyMatched as it does not make much sense when
// time restrictions for macro conditions are available.
// Trigger scene change only once even if media state might trigger repeatedly
bool _alreadyMatched = false;
// Workaround to enable use of "ended" to specify end of VLC playlist
bool _previousStateEnded = false;
bool _playedToEnd = false;
static bool _registered;
static const std::string id;