Skip to content

Commit

Permalink
Extract new status property in status.
Browse files Browse the repository at this point in the history
  • Loading branch information
MayaPosch committed Dec 25, 2021
1 parent 0340e6d commit 333a242
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/nymphcast_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ void NymphCastClient::MediaStatusCallback(uint32_t session, NymphMessage* msg, v
NymphType* volume;
NymphType* artist;
NymphType* title;
NymphType* stopped;
if (!nstruct->getStructValue("status", status)) {
std::cerr << "MediaStatusCallback: Failed to find value 'status' in struct." << std::endl;
msg->discard();
Expand Down Expand Up @@ -194,12 +195,19 @@ void NymphCastClient::MediaStatusCallback(uint32_t session, NymphMessage* msg, v
return;
}

if (!nstruct->getStructValue("stopped", stopped)) {
std::cerr << "MediaStatusCallback: Failed to find value 'stopped' in struct." << std::endl;
msg->discard();
return;
}

stat.status = (NymphRemoteStatus) status->getUint32();
stat.duration = duration->getUint64();
stat.position = position->getDouble();
stat.volume = volume->getUint8();
stat.artist = artist->getString();
stat.title = title->getString();
stat.stopped = stopped->getBool();

if (statusUpdateFunction) {
statusUpdateFunction(session, stat);
Expand Down
4 changes: 3 additions & 1 deletion src/nymphcast_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ enum NymphRemoteStatus {
struct NymphPlaybackStatus {
NymphRemoteStatus status;
bool error;
bool stopped;
bool playing;
uint64_t duration;
double position;
Expand All @@ -52,7 +53,8 @@ struct NymphPlaybackStatus {
enum NymphMediaFileType {
FILE_TYPE_AUDIO = 0,
FILE_TYPE_VIDEO = 1,
FILE_TYPE_IMAGE = 2
FILE_TYPE_IMAGE = 2,
FILE_TYPE_PLAYLIST = 3
};


Expand Down

0 comments on commit 333a242

Please sign in to comment.