Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timestamp Properties #1011

Closed
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
59ebd8e
API Draft
dukesook Oct 24, 2023
e6c6af1
minor cleanup
dukesook Oct 24, 2023
109869a
Condensed Comments
dukesook Oct 27, 2023
7de6e25
In progress: heif_property_add_timestamp()
dukesook Oct 27, 2023
10e8306
Merge branch 'master' of https://github.com/strukturag/libheif into t…
dukesook Oct 27, 2023
e3a5950
Update libheif/heif_properties.h
dukesook Oct 27, 2023
fe5add9
add box definitions
dukesook Oct 27, 2023
3f61d3a
Merge branch 'timestamp_boxes' of https://github.com/dukesook/libheif…
dukesook Oct 27, 2023
bd5de49
Move comments to box.h to make a clean api
dukesook Oct 27, 2023
1d43250
implemented heif_property_add_clock_info()
dukesook Oct 27, 2023
99fe7f1
Improved Comments
dukesook Oct 27, 2023
c845ffa
Fix a small bug
kleisauke Oct 29, 2023
89ddc1c
nclx: use default values that match sRGB
kleisauke Oct 29, 2023
8cacd4d
Merge pull request #1015 from kleisauke/srgb-default
farindk Oct 30, 2023
127c1ca
alternative implementation of PR #1015
farindk Oct 30, 2023
136cf01
turn off macOS_compatibility_workaround_no_nclx_profile by default
farindk Oct 30, 2023
36326c5
fix heif_transfer_characteristic_unspecified
farindk Oct 30, 2023
2698eef
use matrix_coefficients=5 for sRGB
farindk Oct 30, 2023
d5a5559
Merge pull request #1017 from strukturag/unspecified-nclx-handling
farindk Oct 30, 2023
4809d30
use MC=6 for sRGB because of potential incompatibility of Safari/iOS …
farindk Oct 30, 2023
7cd873f
use MC=6 for sRGB because of potential incompatibility of Safari/iOS …
farindk Oct 30, 2023
30d9ead
limit maximum colr box size
farindk Oct 30, 2023
c431edb
fix integer overflow
farindk Oct 30, 2023
01e4f63
fix decoding of uncompressed greyscale
farindk Oct 31, 2023
8ff8227
fix reading images with unspecified jpgC box
farindk Oct 31, 2023
e547b74
show correct compression format name (not just AV1/HEVC)
farindk Oct 31, 2023
7e427d7
return 'unknown' encoder name
farindk Oct 31, 2023
3746885
jpeg2000: use chroma444 if nothing is specified explicitly
farindk Oct 31, 2023
b93a437
jpeg: fix encoding several images successively
farindk Oct 31, 2023
ca74385
jpeg2000: add encoding of alpha channel
farindk Oct 31, 2023
06f13d1
add heif_context_add_generic_uri_metadata()
farindk Oct 31, 2023
230baa7
Merge branch 'master' into timestamp_boxes
dukesook Nov 1, 2023
42395cd
verify if the two timestamp boxes truly need to be paired together
dukesook Nov 1, 2023
2289041
Revert "add heif_context_add_generic_uri_metadata()"
farindk Nov 1, 2023
3b1f465
check whether libpng supports iTXt chunks (#1020)
farindk Nov 2, 2023
c469dcb
increase version to v1.17.2
farindk Nov 2, 2023
d23cca4
Merge branch 'master' of https://github.com/strukturag/libheif into t…
dukesook Nov 2, 2023
47265d3
Use standard name for JPEG 2000
kmilos Nov 2, 2023
ab48741
Merge pull request #1022 from kmilos/kmilos/jp2_label
farindk Nov 2, 2023
e29fcc7
fix returning version number parts (#1023)
farindk Nov 2, 2023
3d09f49
Merge branch 'master' of https://github.com/strukturag/libheif into t…
dukesook Nov 2, 2023
4a6e47c
Cleaned up timestamp api
dukesook Nov 2, 2023
f3ef516
If the taic is missing, add it
dukesook Nov 3, 2023
b2f46d7
set default values for itai
dukesook Nov 3, 2023
d5308a1
Do not use designated initializers
dukesook Nov 4, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions libheif/heif_properties.cc
Original file line number Diff line number Diff line change
Expand Up @@ -300,3 +300,35 @@ void heif_property_user_description_release(struct heif_property_user_descriptio
delete udes;
}


struct heif_error heif_property_add_clock_info(const struct heif_context* context,
heif_item_id itemId,
const struct heif_property_clock_info* clock_info,
heif_property_id* out_propertyId)
{
return {heif_error_Unsupported_feature, heif_suberror_Unsupported_data_version, "not yet implemented"};
}

struct heif_error heif_property_get_clock_info(const struct heif_context* context,
heif_item_id itemId,
struct heif_property_clock_info** out)
{
return {heif_error_Unsupported_feature, heif_suberror_Unsupported_data_version, "not yet implemented"};
}

struct heif_error heif_property_add_timestamp(const struct heif_context* context,
heif_item_id itemId,
const struct heif_property_timestamp* timestamp,
heif_property_id* out_propertyId)
{
return {heif_error_Unsupported_feature, heif_suberror_Unsupported_data_version, "not yet implemented"};
}

struct heif_error heif_property_get_timestamp(const struct heif_context* context,
heif_item_id itemId,
struct heif_property_timestamp** out)
{
return {heif_error_Unsupported_feature, heif_suberror_Unsupported_data_version, "not yet implemented"};
}


92 changes: 91 additions & 1 deletion libheif/heif_properties.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ enum heif_item_property_type
heif_item_property_type_transform_mirror = heif_fourcc('i', 'm', 'i', 'r'),
heif_item_property_type_transform_rotation = heif_fourcc('i', 'r', 'o', 't'),
heif_item_property_type_transform_crop = heif_fourcc('c', 'l', 'a', 'p'),
heif_item_property_type_image_size = heif_fourcc('i', 's', 'p', 'e')
heif_item_property_type_image_size = heif_fourcc('i', 's', 'p', 'e'),
heif_item_property_type_tai_clock_info = heif_fourcc('t', 'a', 'i', 'c'),
heif_item_property_type_tai_timestamp = heif_fourcc('i', 't', 'a', 'i'),
};

// Get the heif_property_id for a heif_item_id.
Expand Down Expand Up @@ -131,6 +133,94 @@ void heif_item_get_property_transform_crop_borders(const struct heif_context* co
int image_width, int image_height,
int* left, int* top, int* right, int* bottom);


// ========================= Timestamps =========================
// The 'taic' Clock Info Property provides metadata about the source
// clock that used to record the TAI timestamps.
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 unkown, the value is set to "all ones".
dukesook marked this conversation as resolved.
Show resolved Hide resolved
*/
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;
};

LIBHEIF_API
struct heif_error heif_property_add_clock_info(const struct heif_context* context,
heif_item_id itemId,
const struct heif_property_clock_info* clock_info,
heif_property_id* out_propertyId);

LIBHEIF_API
struct heif_error heif_property_get_clock_info(const struct heif_context* context,
heif_item_id itemId,
struct heif_property_clock_info** out);

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 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;
};

LIBHEIF_API
struct heif_error heif_property_add_timestamp(const struct heif_context* context,
heif_item_id itemId,
const struct heif_property_timestamp* timestamp,
heif_property_id* out_propertyId);

LIBHEIF_API
struct heif_error heif_property_get_timestamp(const struct heif_context* context,
heif_item_id itemId,
struct heif_property_timestamp** out);


#ifdef __cplusplus
}
#endif
Expand Down