From bd5de490cb08310802f0104caf6a94d4cc62875b Mon Sep 17 00:00:00 2001 From: dukesook Date: Fri, 27 Oct 2023 16:35:26 -0600 Subject: [PATCH] Move comments to box.h to make a clean api --- libheif/box.h | 48 +++++++++++++++++++++++++++++++++++++++ libheif/heif_properties.h | 45 ++---------------------------------- 2 files changed, 50 insertions(+), 43 deletions(-) diff --git a/libheif/box.h b/libheif/box.h index 6045946e69..d295d6329e 100644 --- a/libheif/box.h +++ b/libheif/box.h @@ -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; @@ -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; } diff --git a/libheif/heif_properties.h b/libheif/heif_properties.h index 45493527e7..3aec79bb34 100644 --- a/libheif/heif_properties.h +++ b/libheif/heif_properties.h @@ -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; }; @@ -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; }; @@ -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);