public class Timebase
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static Timebase |
HZ_1
1 Hz (1 frame = 1 second)
|
static Timebase |
HZ_1000
1 kHz (1 frame = 1 millisecond.
|
static Timebase |
HZ_1000000
1 MHz (Vidispine transcoder default sampling rate)
|
static Timebase |
HZ_192000 |
static Timebase |
HZ_25 |
static Timebase |
HZ_27000000
27 MHz (sampling rate used by Carbon)
|
static Timebase |
HZ_30 |
static Timebase |
HZ_44100 |
static Timebase |
HZ_48000 |
static Timebase |
HZ_50 |
static Timebase |
HZ_96000 |
static Timebase |
NTSC
29.97 Hz (NTSC)
|
| Constructor and Description |
|---|
Timebase(int numerator,
int denominator) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(java.lang.Object obj) |
int |
getDenominator() |
static Timebase |
getInstance(java.lang.String rate)
Parses an encoded timebase.
|
int |
getIntSamplesPerSecond()
Samples per second, cast to an integer (accurate only if the numerator is 1)
|
int |
getNumerator() |
double |
getSamplesPerSecond()
The number of samples each second
|
double |
getSecondsPerSample()
The number of seconds each sample represents
|
int |
hashCode() |
double |
resample(double samples,
Timebase oldRate)
Convert a sample count from one timebase to another
|
long |
resample(long samples,
Timebase oldRate)
Convert a sample count from one timebase to another
Note that this may result in data loss due to rounding. |
long |
resample(long samples,
Timebase oldRate,
boolean failOnPrecisionLoss)
Convert a sample count from one timebase to another
Note that this may result in data loss due to rounding. |
long |
resamplePrecise(long samples,
Timebase oldRate)
Convert a sample count from one timebase to another, throwing an exception if precision is lost
|
java.lang.String |
toEncodedString()
Return the encoded string representation of this Timebase
N.B. |
java.lang.String |
toString() |
public static final Timebase HZ_25
public static final Timebase HZ_30
public static final Timebase HZ_50
public static final Timebase HZ_44100
public static final Timebase HZ_48000
public static final Timebase HZ_96000
public static final Timebase HZ_192000
public static final Timebase HZ_1000000
public static final Timebase HZ_27000000
public static final Timebase HZ_1000
public static final Timebase HZ_1
public static final Timebase NTSC
public Timebase(int numerator,
int denominator)
numerator - the numerator (the top part of the fraction) - generally 1denominator - the denominator (the bottom part of the fraction) - e.g. 25 for PAL (with a numerator of 1)public int getNumerator()
public int getDenominator()
public double getSamplesPerSecond()
public int getIntSamplesPerSecond()
public double getSecondsPerSample()
public long resample(long samples,
Timebase oldRate)
samples - oldRate - public long resamplePrecise(long samples,
Timebase oldRate)
throws ResamplingException
samples - oldRate - ResamplingException - if precision is lost during the conversionpublic long resample(long samples,
Timebase oldRate,
boolean failOnPrecisionLoss)
throws ResamplingException
samples - oldRate - failOnPrecisionLoss - if true, precision losing operations will fail by throwing a PrecisionLostExceptionResamplingExceptionpublic double resample(double samples,
Timebase oldRate)
samples - oldRate - public int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String toEncodedString()
public static Timebase getInstance(java.lang.String rate)
The following textual representations are valid for time bases:
The following TimeBaseConstants are currently defined:
| TimeBaseConstant | Time base |
|---|---|
| PAL | 25:1 |
| NTSC | 30000:1001 |
| NTSC30 | 30:1 |
rate - Copyright © 2014. All Rights Reserved.