get simple quantisation/timecode integration to run
passing the basic tests now; still missing: implementation of specific timecodes, e.g. SMPTE, HMS,....
This commit is contained in:
parent
02653621f6
commit
38844b9050
6 changed files with 64 additions and 21 deletions
|
|
@ -172,7 +172,7 @@ namespace time {
|
|||
struct CountFormatter
|
||||
: PrintfFormatter<long, 20>
|
||||
{
|
||||
CountFormatter() : PrintfFormatter<long,20>("%04l") { }
|
||||
CountFormatter() : PrintfFormatter<long,20>("%04ld") { }
|
||||
};
|
||||
|
||||
} //(End) digxel configuration namespace
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ namespace time {
|
|||
, public CountVal
|
||||
{
|
||||
|
||||
string show() const { return string(show())+"fr"; }
|
||||
string show() const { return string(CountVal::show())+"fr"; }
|
||||
Literal tcID() const { return "Frame-count"; }
|
||||
TimeValue value() const { return Format::evaluate (*this, *quantiser_); }
|
||||
|
||||
|
|
|
|||
|
|
@ -247,6 +247,7 @@ out: .+Digxel.+SexaFormatter.+--empty--00--\(val=42\)--42
|
|||
out: .+Digxel.+SexaFormatter.+--empty--00--\(val=-5\)---5
|
||||
out: .+Digxel.+HexaFormatter.+--empty--00--\(val=12\)--0C
|
||||
out: .+Digxel.+HexaFormatter.+--empty--00--\(val=111\)--6F
|
||||
out: .+Digxel.+CountFormatter.+--empty--0000--\(val=-1234567890\)---1234567890
|
||||
return: 0
|
||||
END
|
||||
|
||||
|
|
|
|||
|
|
@ -68,6 +68,7 @@ namespace test{
|
|||
verifyConfiguration<SexaDigit > (-5);
|
||||
verifyConfiguration<HexaDigit > (0xc);
|
||||
verifyConfiguration<HexaDigit > (0x6f);
|
||||
verifyConfiguration<CountVal > (-1234567890);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
|
||||
#include "lib/test/run.hpp"
|
||||
//#include "lib/test/test-helper.hpp"
|
||||
#include "lib/time/timecode.hpp"
|
||||
#include "lib/util.hpp"
|
||||
|
||||
|
|
@ -43,9 +44,10 @@ namespace test{
|
|||
|
||||
/********************************************************
|
||||
* @test verify handling of grid aligned timecode values.
|
||||
* - creating timecode values
|
||||
* - some conversions
|
||||
* - formatting
|
||||
* - full cycle from parsing to formatting
|
||||
* - mutating the components of timecode
|
||||
* - some formatting corner cases
|
||||
* - formatting in various formats
|
||||
*/
|
||||
class TimeFormats_test : public Test
|
||||
{
|
||||
|
|
@ -56,29 +58,55 @@ namespace test{
|
|||
|
||||
TimeValue ref (refval);
|
||||
|
||||
checkBasics (ref);
|
||||
checkComparisons (ref);
|
||||
checkComponentAccess();
|
||||
checkTimecodeUsageCycle (ref);
|
||||
checkFrames ();
|
||||
checkSeconds ();
|
||||
checkHms ();
|
||||
checkSmpte();
|
||||
checkDropFrame();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
checkBasics (TimeValue ref)
|
||||
checkTimecodeUsageCycle (TimeValue ref)
|
||||
{
|
||||
UNIMPLEMENTED ("full usage cycle for a timecode value");
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
checkComparisons (TimeValue ref)
|
||||
checkFrames ()
|
||||
{
|
||||
UNIMPLEMENTED ("verify frame count time format");
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
checkComponentAccess()
|
||||
checkSeconds ()
|
||||
{
|
||||
UNIMPLEMENTED ("verify seconds as timecode format");
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
checkHms ()
|
||||
{
|
||||
UNIMPLEMENTED ("verify hour-minutes-seconds-millis timecode");
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
checkSmpte ()
|
||||
{
|
||||
UNIMPLEMENTED ("verify SMPTE timecode format");
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
checkDropFrame ()
|
||||
{
|
||||
UNIMPLEMENTED ("verify especially SMPTE-drop-frame timecode");
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -31,12 +31,12 @@
|
|||
#include <boost/lexical_cast.hpp>
|
||||
#include <boost/algorithm/string/join.hpp>
|
||||
#include <iostream>
|
||||
//#include <cstdlib>
|
||||
#include <cstdlib>
|
||||
|
||||
using boost::lexical_cast;
|
||||
using util::isnil;
|
||||
using util::contains;
|
||||
//using std::rand;
|
||||
using std::rand;
|
||||
using std::cout;
|
||||
using std::endl;
|
||||
|
||||
|
|
@ -52,23 +52,36 @@ namespace test{
|
|||
|
||||
/********************************************************
|
||||
* @test verify handling of quantised time values.
|
||||
* - creating times and time intervals
|
||||
* - comparisons
|
||||
* - time arithmetics
|
||||
* - the simple usage, just referring to an
|
||||
* predefined grid by name
|
||||
* - explicitly defining an quantiser
|
||||
* - converting these quantised values into
|
||||
* various timecode formats
|
||||
* - error detection
|
||||
*/
|
||||
class TimeQuantisation_test : public Test
|
||||
{
|
||||
int
|
||||
random_or_get (Arg arg)
|
||||
{
|
||||
if (isnil(arg))
|
||||
return 1 + (rand() % 10000);
|
||||
else
|
||||
return lexical_cast<int> (arg[1]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
virtual void
|
||||
run (Arg arg)
|
||||
{
|
||||
long refval= isnil(arg)? 1 : lexical_cast<long> (arg[1]);
|
||||
|
||||
TimeValue ref (refval);
|
||||
Time ref (random_or_get(arg));
|
||||
CHECK (Time(0) < ref);
|
||||
|
||||
checkSimpleUsage (ref);
|
||||
check_theFullStory (ref);
|
||||
checkMultipleGrids (ref);
|
||||
checkGridBinding (ref);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -133,12 +146,12 @@ namespace test{
|
|||
|
||||
FrameNr palNr (palVal);
|
||||
FrameNr ntscNr(ntscVal);
|
||||
CHECK (palNr < ntscNr);
|
||||
CHECK (palNr <= ntscNr);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
checkGridLateBinding (TimeValue org)
|
||||
checkGridBinding (TimeValue org)
|
||||
{
|
||||
// refer to a grid not yet defined
|
||||
VERIFY_ERROR (UNKNOWN_GRID, QuTime wired(org, "special_funny_grid"));
|
||||
|
|
|
|||
Loading…
Reference in a new issue