Timecode stub implementation...

now passes Compiler and Linker again
This commit is contained in:
Fischlurch 2011-01-05 18:15:44 +01:00
parent 031f61f31d
commit 159d3928d8
6 changed files with 166 additions and 21 deletions

View file

@ -94,6 +94,11 @@ namespace time {
return string (lumiera_tmpbuf_print_time (t_)); return string (lumiera_tmpbuf_print_time (t_));
} }
TimeVar::operator string() const
{
return string (lumiera_tmpbuf_print_time (t_));
}
}} // namespace lib::Time }} // namespace lib::Time

View file

@ -23,6 +23,7 @@
#include "lib/time/quantiser.hpp" #include "lib/time/quantiser.hpp"
#include "lib/time/timevalue.hpp" #include "lib/time/timevalue.hpp"
#include "lib/time/timequant.hpp"
using std::string; using std::string;
@ -32,6 +33,24 @@ namespace time {
/** */ /** */
QuTime::QuTime (TimeValue raw, Symbol gridID)
: Time(raw) /////////////////////////////////////////////////TODO fetch quantiser
{ }
/** */
QuTime::QuTime (TimeValue raw, Quantiser const& quantisation_to_use)
: Time(raw) /////////////////////////////////////////////////TODO fetch quantiser
{ }
/** */
FixedFrameQuantiser::FixedFrameQuantiser (FSecs frames_per_second)
: Quantiser() /////////////////////////////////////////////////TODO we ought to do something
{ }

View file

@ -23,9 +23,15 @@
#include "lib/lumitime.hpp" #include "lib/lumitime.hpp"
#include "lib/time/timecode.hpp" #include "lib/time/timecode.hpp"
#include "lib/time/timevalue.hpp"
#include "lib/time/timequant.hpp" #include "lib/time/timequant.hpp"
#include "lib/time/formats.hpp" #include "lib/time/formats.hpp"
extern "C" {
#include "lib/time.h"
}
using std::string; using std::string;
@ -38,6 +44,90 @@ namespace time {
/** */ /** */
FrameNr::FrameNr (QuTime const& quantisedTime)
: FACTOR_TODO (1,25)
, nr_(TimeVar(quantisedTime) / (25*GAVL_TIME_SCALE))
{ } /////////////////////////////TODO temporary bullshit (of course that is the job of the quantiser)
/** */
SmpteTC::SmpteTC (QuTime const& quantisedTime)
: tpoint_(quantisedTime) /////////////////////////////TODO eternal bullshit
{ }
/** */
HmsTC::HmsTC (QuTime const& quantisedTime)
: tpoint_(quantisedTime) /////////////////////////////TODO bullshit
{ }
/** */
Secs::Secs (QuTime const& quantisedTime)
: sec_(TimeVar(quantisedTime) / GAVL_TIME_SCALE) /////////////TODO bullshit
{ }
/** */
int
SmpteTC::getSecs() const
{
return lumiera_time_seconds (tpoint_);
}
/** */
int
SmpteTC::getMins() const
{
return lumiera_time_minutes (tpoint_);
}
/** */
int
SmpteTC::getHours() const
{
return lumiera_time_hours (tpoint_);
}
/** */
int
SmpteTC::getFrames() const
{
UNIMPLEMENTED ("Frame-Quantisation");
}
/** */
int
HmsTC::getSecs() const
{
return lumiera_time_seconds (tpoint_);
}
/** */
int
HmsTC::getMins() const
{
return lumiera_time_minutes (tpoint_);
}
/** */
int
HmsTC::getHours() const
{
return lumiera_time_hours (tpoint_);
}
/** */
double
HmsTC::getMillis() const
{
TODO ("Frame-Quantisation");
return lumiera_time_millis (tpoint_);
}
/** */

View file

@ -26,9 +26,11 @@
#include "lib/time/timevalue.hpp" #include "lib/time/timevalue.hpp"
#include "lib/time/formats.hpp" #include "lib/time/formats.hpp"
#include "lib/symbol.hpp"
//#include <iostream> //#include <iostream>
//#include <boost/operators.hpp> //#include <boost/operators.hpp>
#include <boost/lexical_cast.hpp> ///////////////TODO
#include <string> #include <string>
@ -36,6 +38,8 @@ namespace lib {
namespace time { namespace time {
using std::string; using std::string;
using lib::Literal;
using boost::lexical_cast; /////////TODO
/** /**
@ -50,13 +54,13 @@ namespace time {
virtual ~TCode(); virtual ~TCode();
operator string() const { return show(); } operator string() const { return show(); }
string describe() const { return tcID(); } string describe() const { return string(tcID()); }
Time getTime() const { return Time(calc()); } Time getTime() const { return Time(value()); }
protected: protected:
virtual string show() const =0; virtual string show() const =0;
virtual string tcID() const =0; virtual Literal tcID() const =0;
virtual TimeValue calc() const =0; virtual TimeValue value() const =0;
}; };
@ -72,15 +76,19 @@ namespace time {
class FrameNr class FrameNr
: public TCode : public TCode
{ {
FSecs FACTOR_TODO; /////////////////////////////TODO temporary bullshit (of course that is the job of the quantiser)
virtual string show() const ; long nr_;
virtual string tcID() const ;
virtual TimeValue calc() const ;
string show() const { return lexical_cast<string>(nr_)+"fr"; }
Literal tcID() const { return "Frame-count"; }
TimeValue value() const { return Time(FACTOR_TODO * nr_); }
public: public:
FrameNr (QuTime const& quantisedTime); FrameNr (QuTime const& quantisedTime);
operator long() const; operator long() const { return nr_; }
}; };
@ -91,10 +99,11 @@ namespace time {
class SmpteTC class SmpteTC
: public TCode : public TCode
{ {
TimeVar tpoint_;
virtual string show() const ; virtual string show() const { return string(tpoint_); }
virtual string tcID() const ; virtual Literal tcID() const { return "SMPTE"; }
virtual TimeValue calc() const ; virtual TimeValue value() const { return tpoint_; }
public: public:
SmpteTC (QuTime const& quantisedTime); SmpteTC (QuTime const& quantisedTime);
@ -113,10 +122,11 @@ namespace time {
class HmsTC class HmsTC
: public TCode : public TCode
{ {
TimeVar tpoint_;
virtual string show() const ; virtual string show() const { return string(tpoint_); }
virtual string tcID() const ; virtual Literal tcID() const { return "Timecode"; }
virtual TimeValue calc() const ; virtual TimeValue value() const { return tpoint_; }
public: public:
HmsTC (QuTime const& quantisedTime); HmsTC (QuTime const& quantisedTime);
@ -135,10 +145,11 @@ namespace time {
class Secs class Secs
: public TCode : public TCode
{ {
FSecs sec_;
virtual string show() const ; virtual string show() const { return string(Time(sec_)); }
virtual string tcID() const ; virtual Literal tcID() const { return "Seconds"; }
virtual TimeValue calc() const ; virtual TimeValue value() const { return Time(sec_); }
public: public:
Secs (QuTime const& quantisedTime); Secs (QuTime const& quantisedTime);

View file

@ -62,5 +62,23 @@ namespace time {
/* == implementation == */
template<class FMT>
bool
QuTime::supports() const
{
return false; ////////////////TODO;
}
template<class FMT>
typename format::Traits<FMT>::TimeCode
QuTime::formatAs() const
{
typedef typename format::Traits<FMT>::TimeCode TimeCode;
return TimeCode(*this);
}
}} // lib::time }} // lib::time
#endif #endif

View file

@ -107,7 +107,7 @@ namespace time {
> > > >
{ {
public: public:
TimeVar (TimeValue time = TimeValue()) TimeVar (TimeValue const& time = TimeValue())
: TimeValue(time) : TimeValue(time)
{ } { }
@ -123,6 +123,8 @@ namespace time {
return *this; return *this;
} }
/** @internal diagnostics */
operator std::string () const;
// Supporting mixing with plain long int arithmetics // Supporting mixing with plain long int arithmetics
operator gavl_time_t () const { return t_; } operator gavl_time_t () const { return t_; }