| Class Overview |
BTimeCode();
BTimeCode(bigtime_t us,
timecode_type type = B_TIMECODE_DEFAULT);
BTimeCode(int hours,
int minutes,
int seconds,
int frames,
timecode_type type = B_TIMECODE_DEFAULT);
BTimeCode(const BTimeCode& clone);
The constructor prepares the BTimeCode
object for use. If you use the
first form of the constructor, without arguments, you'll have to call an
appropriate function to set the BTimeCode
's time information before using
it for translation purposes. This can be done by calling one or more of
SetData()
,
SetType()
,
SetMicroseconds()
, or
SetLinearFrames()
.
The second form of the constructor accepts as input a time in
microseconds, us
, and the timecode type
.
The third form accepts as input a time in hours
,
minutes
, seconds
, and
frames
, as well as the timecode type
.
The fourth form of the constructor duplicates an existing
BTimeCode
object.
void GetData(int* outHours,
int* outMinutes,
int* outSeconds,
int* outFrames,
timecode_type* outType);
void SetData(int hours,
int minutes,
int seconds,
int frames);
GetData()
returns the timecode's value
in hours
, minutes
, seconds
, and
frames
, and also returns the timecode type, if you specify a valid
pointer for outType
. SetData()
lets you set the timecode's value.
void GetString(char* str) const;
Fills str
, which must be at least 24 bytes long, with a string indicating
the current time in hours, minutes, seconds, and frames. The string is
formatted in a manner appropriate to the timecode type. A typical example
would be "01:24:09.18", which is 1 hour, 24 minutes, 9 seconds, and 18
frames.
void Hours() const;
void Minutes() const;
void Seconds() const;
void Frames() const;
These functions return the time's hours, minutes, seconds, and frames portions.
int32 LinearFrames() const;
void SetLinearFrames(int32 linearFrames);
LinearFrames()
returns the
BTimeCode
object's time in linear frames.
SetLinearFrames()
lets you change the time, specifying the new time in
linear frames.
bigtime_t LinearFrames() const;
void SetMicroseconds(bigtime_t us);
Microseconds()
returns the
BTimeCode
object's time, in microseconds.
SetMicroseconds()
lets you change the time,
specifying the new time in microseconds.
BTimeCode& operator =(const BTimeCode& clone);
Makes the current BTimeCode
identical to
the BTimeCode
object specified
BTimeCode& operator ==(const BTimeCode& other);
Determines whether or not the two BTimeCode
objects are equal (their
times are the same, regardless of their timecode types).
BTimeCode& operator <(const BTimeCode& other);
Indicates whether or not one BTimeCode
's time, in microseconds, is less
than the other's.
BTimeCode& operator +=(const BTimeCode& other);
Adds the time of the BTimeCode
object other
to the current BTimeCode
's time.
BTimeCode& operator -=(const BTimeCode& other);
Subtracts the time of the BTimeCode
object other from the current
BTimeCode
's time.
BTimeCode& operator +(const BTimeCode& other);
Adds two BTimeCode
values together, returning
a new BTimeCode
.
status_t frames_to_timecode(int32 linearFrames,
int* hours,
int* minutes,
int* seconds,
int* frames,
const timecode_info code = NULL);
status_t timecode_to_frames(int hours,
int minutes,
int seconds,
int frames,
const timecode_info code = NULL);
frames_to_timecode()
converts the
frame offset linearFrames
into hours
,
minutes
, seconds
, and
frames
.
timecode_to_frames()
converts the time from
hours
, minutes
, seconds
, and
frames
into a linear frame offset, storing the result
in linearFrames
.
The timecode_info structure code is used to determine how the conversion
should be made, if you specify it. Otherwise B_TIMECODE_DEFAULT
is
assumed.
Currently these functions always return B_OK
, but you should still check
for errors because you'd hate it if your app broke in the future,
wouldn't you?
status_t get_timecode_description(timecode_type type,
timecode_info* outTimeCode);
Fills out the timecode_info structure specified
by outTimeCode
with
information describing the specified timecode type.
Return Code | Description |
---|---|
| No error. |
| The specified timecode type isn't valid. |
status_t us_to_timecode(bigtime_t micros,
int* hours,
int* minutes,
int* seconds,
int* frames,
const timecode_info code = NULL);
status_t timecode_to_us(int hours,
int minutes,
int seconds,
int frames,
bigtime_t* micros,
const timecode_info code = NULL);
us_to_timecode()
converts the time
micros
, which is specified in
microseconds, into hours
, minutes
,
seconds
, and frames
.
timecode_to_us()
converts the time from
hours
, minutes
, seconds
, and
frames
into microseconds, storing the result in micros
.
The timecode_info structure code is used to determine how the conversion
should be made, if you specify it. Otherwise B_TIMECODE_DEFAULT
is
assumed.
Currently these functions always return B_OK
, but you should still check
for errors because you'd hate it if your app broke in the future,
wouldn't you?
Declared in: media/TimeCode.h
Constant | Description |
---|---|
| The default time code |
| 100 frames per second. |
| CD audio |
| MIDI |
| NTSC |
| Brazil |
| PAL |
| Film |
| Super8 |
Constants identifying the various timecode types supported by
BTimeCode
.
Declared in: media/TimeCode.h
struct timecode_info { timecode_type type; intdrop_frames
; intevery_nth
; intexcept_nth
; intfps_div
; charname
[32]; charformat
[32]; char_reserved_
[64]; };
The timecode_info structure describes the attributes of a timecode type.
You probably should just use the BTimeCode
class, or the global C
functions, though. It just makes your life easier.
Field | Description |
---|---|
| Indicates the timecode type described by the structure. |
| Indicates how many frames this timecode drops every
|
| Indicates the nominal frame rate of the format. |
| Is a printable name that can be used in constructing user interfaces. |
| Is a format to be used in calling |