WIP enough stubbing to get it through the Compiler...
...but NOT yet the linker
This commit is contained in:
parent
62f9e84f2d
commit
607c8a2338
5 changed files with 57 additions and 6 deletions
|
|
@ -21,7 +21,7 @@
|
|||
* *****************************************************/
|
||||
|
||||
|
||||
#include "lib/lumitime.hpp"
|
||||
#include "lib/time/quantiser.hpp"
|
||||
#include "lib/time/timevalue.hpp"
|
||||
|
||||
using std::string;
|
||||
|
|
@ -35,5 +35,9 @@ namespace time {
|
|||
|
||||
|
||||
|
||||
LUMIERA_ERROR_DEFINE (UNKNOWN_GRID, "referring to an undefined grid or scale in value quantisation");
|
||||
|
||||
|
||||
|
||||
}} // lib::time
|
||||
|
||||
|
|
|
|||
|
|
@ -24,16 +24,20 @@
|
|||
#ifndef LIB_TIME_QUANTISER_H
|
||||
#define LIB_TIME_QUANTISER_H
|
||||
|
||||
#include "lib/error.hpp"
|
||||
#include "lib/time/timevalue.hpp"
|
||||
#include "lib/time/formats.hpp"
|
||||
#include "lib/iter-adapter.hpp"
|
||||
|
||||
//#include <boost/operators.hpp>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
|
||||
namespace lib {
|
||||
namespace time {
|
||||
|
||||
LUMIERA_ERROR_DECLARE (UNKNOWN_GRID); ///< referring to an undefined grid or scale in value quantisation
|
||||
|
||||
/**
|
||||
* Facility to create grid-aligned time values.
|
||||
|
|
@ -42,8 +46,17 @@ namespace time {
|
|||
*/
|
||||
class Quantiser
|
||||
{
|
||||
typedef std::vector<Format*> _FormatTable;
|
||||
typedef _FormatTable::const_iterator _SrcIter;
|
||||
typedef lib::PtrDerefIter<_SrcIter> _Iter;
|
||||
|
||||
public:
|
||||
template<class FMT>
|
||||
bool supports() const;
|
||||
|
||||
typedef _Iter iterator;
|
||||
iterator getSupportedFormats() const;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -34,6 +34,8 @@
|
|||
namespace lib {
|
||||
namespace time {
|
||||
|
||||
using std::string;
|
||||
|
||||
|
||||
/**
|
||||
* fixed format time specification.
|
||||
|
|
@ -46,6 +48,10 @@ namespace time {
|
|||
{
|
||||
|
||||
public:
|
||||
|
||||
string describe() const;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -64,11 +70,31 @@ namespace time {
|
|||
|
||||
public:
|
||||
FrameNr (QuTime const& quantisedTime);
|
||||
FrameNr (TCode<format::Frames> const&);
|
||||
|
||||
operator long() const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class SmpteTC
|
||||
: public TCode<format::Smpte>
|
||||
{
|
||||
|
||||
public:
|
||||
SmpteTC (QuTime const& quantisedTime);
|
||||
SmpteTC (TCode<format::Smpte> const&);
|
||||
|
||||
int getSecs () const;
|
||||
int getMins () const;
|
||||
int getHours () const;
|
||||
int getFrames () const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
}} // lib::time
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -45,11 +45,18 @@ namespace time {
|
|||
* @todo WIP-WIP-WIP
|
||||
*/
|
||||
class QuTime
|
||||
: public Time
|
||||
{
|
||||
|
||||
public:
|
||||
QuTime (TimeValue raw, Symbol gridID);
|
||||
QuTime (TimeValue raw, Quantiser const& quantisation_to_use);
|
||||
|
||||
template<class FMT>
|
||||
bool supports() const;
|
||||
|
||||
template<class FMT>
|
||||
TCode<FMT> formatAs() const;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -92,8 +92,8 @@ namespace test{
|
|||
FixedFrameQuantiser fixQ(25);
|
||||
QuTime qVal (org, fixQ);
|
||||
|
||||
CHECK (contains (qVal.supportedFormats(), format::FRAMES));
|
||||
CHECK (contains (qVal.supportedFormats(), format::SMPTE));
|
||||
CHECK ( qVal.supports<format::Frames>());
|
||||
CHECK ( qVal.supports<format::Smpte>());
|
||||
|
||||
TCode<format::Smpte> smpteTCode = qVal.formatAs<format::Smpte>();
|
||||
showTimeCode (smpteTCode);
|
||||
|
|
@ -102,14 +102,14 @@ namespace test{
|
|||
showTimeCode (frameTCode);
|
||||
|
||||
FrameNr count(frameTCode);
|
||||
CHECK (string(count) == *(frameTCode.components()));
|
||||
// CHECK (string(count) == frameTCode.part[0]));
|
||||
}
|
||||
|
||||
template<class TC>
|
||||
void
|
||||
showTimeCode (TC timecodeValue)
|
||||
{
|
||||
cout << timecodeValue.describe() << " = " << join (timecodeValue.components(), ":") << endl;
|
||||
// cout << timecodeValue.describe() << " = " << join (timecodeValue.part(), ":") << endl;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -140,7 +140,8 @@ namespace test{
|
|||
|
||||
TimeGrid::build("special_funny_grid", 1); // provide the grid's definition (1 frame per second)
|
||||
|
||||
int cnt = funny.formatAs<format::Frames>(); // and now performing quantisation is OK
|
||||
int cnt = 0;//////funny.formatAs<format::Frames>().part["count"];
|
||||
// and now performing quantisation is OK
|
||||
SmpteTC smpte (funny); // also converting into SMPTE (which implies frame quantisation)
|
||||
CHECK (0 == smpte.getFrames()); // we have 1fps, thus the frame part is always zero!
|
||||
CHECK (cnt % 60 == smpte.getSecs()); // and the seconds part will be in sync with the frame count
|
||||
|
|
|
|||
Loading…
Reference in a new issue