Skip to content

Commit

Permalink
Move comments to box.h to make a clean api
Browse files Browse the repository at this point in the history
  • Loading branch information
dukesook committed Oct 27, 2023
1 parent 3f61d3a commit bd5de49
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 43 deletions.
48 changes: 48 additions & 0 deletions libheif/box.h
Original file line number Diff line number Diff line change
Expand Up @@ -1076,11 +1076,47 @@ class Box_taic : public FullBox

Error write(StreamWriter& writer) const override;

/**
* time_uncertainty.
*
* The standard deviation measurement uncertainty in nanoseconds for the timestamp generation process.
* If unknown, the value is set to "all ones".
*/
void set_time_uncertainty(uint64_t time_uncertainty) { m_time_uncertainty = time_uncertainty;}

/**
* correction_offset.
*
* The difference in nanoseconds between the clock’s reported timestamp and true time value of the measurement event.
* If unknown, the value shall be set to the maximum positive value.
*/
void set_correction_offset(int64_t correction_offset) { m_correction_offset = correction_offset; }

/**
* clock_drift_rate.
*
* The difference between the synchronized and unsynchronized time, over a period of one second.
* If unknown, the value shall be set to an IEEE 754 quiet NaN value of 0x7FC0 0000.
*/
void set_clock_drift_rate(float clock_drift_rate) { m_clock_drift_rate = clock_drift_rate; }

/**
* clock_source.
*
* 0 = Clock type is unkown
* 1 = The clock does not synchronize to an atomic source of absolute TAI time
* 2 = The clock can synchronize to an atomic source of absolute TAI time
*/
void set_clock_source(uint8_t clock_source) { m_clock_source = clock_source; }

uint64_t get_time_uncertainty() { return m_time_uncertainty; }

int64_t get_correction_offset() { return m_correction_offset; }

float get_clock_drift_rate() { return m_clock_drift_rate; }

uint8_t get_clock_source() { return m_clock_source; }

protected:
Error parse(BitstreamRange& range) override;

Expand Down Expand Up @@ -1109,8 +1145,20 @@ class Box_itai : public FullBox

Error write(StreamWriter& writer) const override;

/**
* timestamp.
*
* The number of nanoseconds since the TAI epoch of 1958-01-01T00:00:00.0Z.
*/
void set_TAI_timestamp(uint64_t timestamp) { m_TAI_timestamp = timestamp; }

/**
* status_bits.
*
* Bit 0: Synchronization Status (0=unsynchronized, 1=synchronized)
* Bit 1: Timestamp validity (0=invalid, 1=valid)
* Bits 2-7: Reserved
*/
void set_status_bits(uint8_t status_bits) { m_status_bits = status_bits; }

uint64_t get_TAI_timestamp() const { return m_TAI_timestamp; }
Expand Down
45 changes: 2 additions & 43 deletions libheif/heif_properties.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,37 +142,9 @@ struct heif_property_clock_info
uint32_t version;
uint8_t flags;

/**
* time_uncertainty.
*
* The standard deviation measurement uncertainty in nanoseconds for the timestamp generation process.
* If unknown, the value is set to "all ones".
*/
uint64_t time_uncertainty;

/**
* correction_offset.
*
* The difference in nanoseconds between the clock’s reported timestamp and true time value of the measurement event.
* If unknown, the value shall be set to the maximum positive value.
*/
int64_t correction_offset;

/**
* clock_drift_rate.
*
* The difference between the synchronized and unsynchronized time, over a period of one second.
* If unknown, the value shall be set to an IEEE 754 quiet NaN value of 0x7FC0 0000.
*/
float clock_drift_rate;

/**
* clock_source.
*
* 0 = Clock type is unkown
* 1 = The clock does not synchronize to an atomic source of absolute TAI time
* 2 = The clock can synchronize to an atomic source of absolute TAI time
*/
uint8_t clock_source;
};

Expand All @@ -191,21 +163,8 @@ struct heif_property_timestamp
{
uint32_t version;
uint8_t flags;

/**
* timestamp.
*
* The number of nanoseconds since the TAI epoch of 1958-01-01T00:00:00.0Z.
*/

uint64_t tai_timestamp;

/**
* status_bits.
*
* Bit 0: Synchronization Status (0=unsynchronized, 1=synchronized)
* Bit 1: Timestamp validity (0=invalid, 1=valid)
* Bits 2-7: Reserved
*/
uint8_t status_bits;
};

Expand All @@ -217,7 +176,7 @@ struct heif_error heif_property_add_timestamp(const struct heif_context* context

LIBHEIF_API
struct heif_error heif_property_get_timestamp(const struct heif_context* context,
heif_item_id itemId,
heif_item_id itemId, //Is this needed?
heif_property_id propertyId,
struct heif_property_timestamp* timestamp_out);

Expand Down

0 comments on commit bd5de49

Please sign in to comment.