2011-09-13 17:50:18 +03:00
|
|
|
#ifndef _framerate__hpp__included__
|
|
|
|
#define _framerate__hpp__included__
|
|
|
|
|
|
|
|
#include <cstdint>
|
|
|
|
|
|
|
|
/**
|
2011-10-20 17:42:29 +03:00
|
|
|
* Number clocks per field/frame on NTSC/PAL
|
2011-09-13 17:50:18 +03:00
|
|
|
*/
|
2011-10-20 17:42:29 +03:00
|
|
|
#define DURATION_NTSC_FRAME 357366
|
|
|
|
#define DURATION_NTSC_FIELD 357368
|
|
|
|
#define DURATION_PAL_FRAME 425568
|
|
|
|
#define DURATION_PAL_FIELD 425568
|
2011-09-13 17:50:18 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets the nominal frame rate. Framerate limiting tries to maintain the nominal framerate when there is no other
|
|
|
|
* explict framerate to maintain.
|
|
|
|
*/
|
|
|
|
void set_nominal_framerate(double fps) throw();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the current realized framerate.
|
2011-09-15 22:56:33 +03:00
|
|
|
*
|
2011-09-26 19:02:43 +03:00
|
|
|
* returns: The framerate the system is currently archiving.
|
2011-09-13 17:50:18 +03:00
|
|
|
*/
|
|
|
|
double get_framerate() throw();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Acknowledge frame start for timing purposes.
|
2011-09-15 22:56:33 +03:00
|
|
|
*
|
2011-10-02 19:05:45 +03:00
|
|
|
* parameter usec: Current time (relative to some unknown epoch) in microseconds.
|
2011-09-13 17:50:18 +03:00
|
|
|
*/
|
2011-10-02 19:05:45 +03:00
|
|
|
void ack_frame_tick(uint64_t usec) throw();
|
2011-09-13 17:50:18 +03:00
|
|
|
|
|
|
|
/**
|
2011-10-02 19:05:45 +03:00
|
|
|
* Computes the number of microseconds to wait for next frame.
|
2011-09-15 22:56:33 +03:00
|
|
|
*
|
2011-10-02 19:05:45 +03:00
|
|
|
* parameter usec: Current time (relative to some unknown epoch) in microseconds.
|
|
|
|
* returns: Number of more microseconds to wait.
|
2011-09-13 17:50:18 +03:00
|
|
|
*/
|
2011-10-02 19:05:45 +03:00
|
|
|
uint64_t to_wait_frame(uint64_t usec) throw();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return microsecond-resolution time since unix epoch.
|
|
|
|
*/
|
|
|
|
uint64_t get_utime();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Wait specified number of microseconds.
|
|
|
|
*/
|
|
|
|
void wait_usec(uint64_t usec);
|
2011-09-13 17:50:18 +03:00
|
|
|
|
|
|
|
#endif
|