Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: BufferedSerial FatFileSystemCpp mbed
Diff: frameRates.h
- Revision:
- 0:97661408d0f9
- Child:
- 9:7214e3c3e5f8
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/frameRates.h Fri Jan 15 11:49:01 2021 +0000
@@ -0,0 +1,53 @@
+#ifndef __frameRates_h__
+#define __frameRates_h__
+
+namespace frameRateInfo {
+
+ const float FrameRates[] = {0, 23.976, 24, 25, 29.97, 30,
+ 47.95, 48, 50, 59.94, 60, 10000000};
+
+/// us
+const double FramePeriods[] = {1000000, 1000000 / 23.976, 1000000 / 24,
+ 1000000 / 25, 1000000 / 29.97, 1000000 / 30,
+ 1000000 / 47.95, 1000000 / 48, 1000000 / 50,
+ 1000000 / 59.94, 1000000 / 60, 10};
+
+const int numberOfRates = 11;
+}
+
+class frameRates {
+
+public:
+
+frameRates();
+
+ void setRate(int index);
+ void setDrop(bool drop) {_currentDrop = drop;};
+ bool isSyncable();
+ bool isValid() {return _currentRate!=0;};
+
+const char *frameRateString();
+// gets time since the start of the second in us.
+// in some frame drop modes this could be negative.
+static long getOffsetFromSecondStart(int minutes, int seconds, int frame,
+ int rateIndex, bool frameDrop);
+
+// gets time since the start of the second in us.
+// in some frame drop modes this could be negative.
+long getOffsetFromSecondStart(int minutes, int seconds, int frame);
+
+
+ float currentRate() {return _currentRate;};
+ double currentPeriodUS() {return _currentPeriod;};
+ int currentIndex() {return _currentIndex;};
+ bool currentDrop() {return _currentDrop;};
+
+private:
+float _currentRate;
+double _currentPeriod;
+int _currentIndex;
+bool _currentDrop;
+};
+
+
+#endif