Skip to content

Commit

Permalink
Add parsing for streaming status command
Browse files Browse the repository at this point in the history
  • Loading branch information
AronHetLam committed Dec 2, 2023
1 parent 9a057ce commit 36f30b7
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 1 deletion.
69 changes: 68 additions & 1 deletion libraries/ATEMmin/ATEMmin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ ATEMmin::ATEMmin(){}
* Added by Aron N. Het Lam
* Functionality to parse and retrieve streaming status.
*/
else
else
if(!strcmp_P(cmdStr, PSTR("StRS"))) {
#if ATEM_debug
temp = streamingStatusFlags;
Expand All @@ -357,6 +357,18 @@ ATEMmin::ATEMmin(){}
Serial.println(streamingStatusFlags);
}
#endif
} else
if(!strcmp_P(cmdStr, PSTR("RTMS"))) {
#if ATEM_debug
temp = recordingStatusFlags;
#endif
streamingStatusFlags = word(_packetBuffer[0], _packetBuffer[1]);
#if ATEM_debug
if ((_serialOutput==0x80 && recordingStatusFlags!=temp) || (_serialOutput==0x81 && !hasInitialized())) {
Serial.print(F("streamingStatusFlags = "));
Serial.println(recordingStatusFlags);
}
#endif
}
}

Expand Down Expand Up @@ -697,3 +709,58 @@ ATEMmin::ATEMmin(){}
bool ATEMmin::getStreamUnknownError() {
return streamingStatusFlags & 1 << 15;
}

/**
* Get raw recording status flags
*/
uint16_t ATEMmin::getRecordingStatusFlags() { return recordingStatusFlags; }

/**
* Get recording status idle flag
*/
bool ATEMmin::getRecordingIdle() { return recordingStatusFlags == 0; }

/**
* Get recording status is recording flag
*/
bool ATEMmin::getRecordingRecording() { return recordingStatusFlags & 1 << 0; }

/**
* Get recording status is stopping flag
*/
bool ATEMmin::getRecordingStopping() { return recordingStatusFlags & 1 << 7; }

/**
* Get recording status error none flag
*/
bool ATEMmin::getRecordingErrorNone() { return recordingStatusFlags & 1 << 1; }

/**
* Get recording status error no media flag
*/
bool ATEMmin::getRecordingNoMedial() { return recordingStatusFlags == 0; }

/**
* Get recording status error media full flag
*/
bool ATEMmin::getRecordingMediaFull() { return recordingStatusFlags & 1 << 2; }

/**
* Get recording status media error flag
*/
bool ATEMmin::getRecordingMediaError() { return recordingStatusFlags & 1 << 3; }

/**
* Get recording status media unformatted flag
*/
bool ATEMmin::getRecordingMediaUnformatted() { return recordingStatusFlags & 1 << 4; }

/**
* Get recording status error dropping frames flag
*/
bool ATEMmin::getRecordingDroppingFrames() { return recordingStatusFlags & 1 << 5; }

/**
* Get recording status unknown error flag
*/
bool ATEMmin::getRecordingUnknownError() { return recordingStatusFlags & 1 << 15; }
12 changes: 12 additions & 0 deletions libraries/ATEMmin/ATEMmin.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ class ATEMmin : public ATEMbase
uint16_t atemTallyByIndexSources;
uint8_t atemTallyByIndexTallyFlags[41];
uint16_t streamingStatusFlags; //Added by Aron N. Het Lam
uint16_t recordingStatusFlags; //Added by Aron N. Het Lam

public:
// Public Methods in ATEM.h:
Expand Down Expand Up @@ -123,6 +124,17 @@ class ATEMmin : public ATEMbase
bool getStreamInvalidState();
bool getStreamStopping();
bool getStreamUnknownError();
uint16_t getRecordingStatusFlags();
bool getRecordingIdle();
bool getRecordingRecording();
bool getRecordingStopping();
bool getRecordingErrorNone();
bool getRecordingNoMedial();
bool getRecordingMediaFull();
bool getRecordingMediaError();
bool getRecordingMediaUnformatted();
bool getRecordingDroppingFrames();
bool getRecordingUnknownError();
};

#endif
Expand Down

0 comments on commit 36f30b7

Please sign in to comment.