Skip to content

Commit a39ec83

Browse files
committed
test without compression or diffing
1 parent 91314cb commit a39ec83

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+46
-42
lines changed

c2pa-compat/src/main.rs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -148,11 +148,12 @@ fn main() -> Result<()> {
148148
&mut signed_remote_asset,
149149
)?;
150150

151-
let signed_remote_asset_patch =
152-
diffy::create_patch_bytes(&original_asset, &signed_remote_asset.into_inner())
153-
.to_bytes();
151+
let signed_remote_asset_patch = signed_remote_asset.into_inner();
152+
// let signed_remote_asset_patch =
153+
// diffy::create_patch_bytes(&original_asset, &signed_remote_asset.into_inner())
154+
// .to_bytes();
154155
asset_details.uncompressed_remote_size = Some(signed_remote_asset_patch.len());
155-
let signed_remote_asset_patch = lz4_flex::compress(&signed_remote_asset_patch);
156+
// let signed_remote_asset_patch = lz4_flex::compress(&signed_remote_asset_patch);
156157

157158
fs::write(dir_path.join("remote.patch"), signed_remote_asset_patch)?;
158159
fs::write(dir_path.join("remote.c2pa"), remote_c2pa_manifest)?;
@@ -163,11 +164,12 @@ fn main() -> Result<()> {
163164
Err(err) => return Err(err),
164165
}
165166

166-
let signed_embedded_asset_patch =
167-
diffy::create_patch_bytes(&original_asset, &signed_embedded_asset.into_inner())
168-
.to_bytes();
167+
let signed_embedded_asset_patch = signed_embedded_asset.into_inner();
168+
// let signed_embedded_asset_patch =
169+
// diffy::create_patch_bytes(&original_asset, &signed_embedded_asset.into_inner())
170+
// .to_bytes();
169171
asset_details.uncompressed_embedded_size = Some(signed_embedded_asset_patch.len());
170-
let signed_embedded_asset_patch = lz4_flex::compress(&signed_embedded_asset_patch);
172+
// let signed_embedded_asset_patch = lz4_flex::compress(&signed_embedded_asset_patch);
171173

172174
fs::write(dir_path.join("embedded.patch"), signed_embedded_asset_patch)?;
173175
fs::write(dir_path.join("embedded.c2pa"), embedded_c2pa_manifest)?;

sdk/tests/compat.rs

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -164,16 +164,17 @@ fn test_compat() -> Result<()> {
164164
let remote_asset_path = asset_dir.join("remote.patch");
165165
if remote_asset_path.exists() {
166166
let expected_remote_asset_patch = fs::read(remote_asset_path)?;
167-
let expected_remote_asset_patch = lz4_flex::decompress(
168-
&expected_remote_asset_patch,
169-
asset_details.uncompressed_remote_size.unwrap(),
170-
)
171-
.expect("TODO"); // TODO: err msg
172-
let expected_remote_asset = diffy::apply_bytes(
173-
&original_asset,
174-
&diffy::Patch::from_bytes(&expected_remote_asset_patch).expect("TODO"),
175-
)
176-
.expect("TODO");
167+
let expected_remote_asset = expected_remote_asset_patch;
168+
// let expected_remote_asset_patch = lz4_flex::decompress(
169+
// &expected_remote_asset_patch,
170+
// asset_details.uncompressed_remote_size.unwrap(),
171+
// )
172+
// .expect("TODO"); // TODO: err msg
173+
// let expected_remote_asset = diffy::apply_bytes(
174+
// &original_asset,
175+
// &diffy::Patch::from_bytes(&expected_remote_asset_patch).expect("TODO"),
176+
// )
177+
// .expect("TODO");
177178

178179
let expected_remote_reader: Reader =
179180
serde_json::from_reader(File::open(asset_dir.join("remote.json"))?)?;
@@ -193,16 +194,17 @@ fn test_compat() -> Result<()> {
193194
}
194195

195196
let expected_embedded_asset_patch = fs::read(asset_dir.join("embedded.patch"))?;
196-
let expected_embedded_asset_patch = lz4_flex::decompress(
197-
&expected_embedded_asset_patch,
198-
asset_details.uncompressed_embedded_size,
199-
)
200-
.expect("TODO"); // TODO: err msg
201-
let expected_embedded_asset = diffy::apply_bytes(
202-
&original_asset,
203-
&diffy::Patch::from_bytes(&expected_embedded_asset_patch).expect("TODO"),
204-
)
205-
.expect("TODO");
197+
let expected_embedded_asset = expected_embedded_asset_patch;
198+
// let expected_embedded_asset_patch = lz4_flex::decompress(
199+
// &expected_embedded_asset_patch,
200+
// asset_details.uncompressed_embedded_size,
201+
// )
202+
// .expect("TODO"); // TODO: err msg
203+
// let expected_embedded_asset = diffy::apply_bytes(
204+
// &original_asset,
205+
// &diffy::Patch::from_bytes(&expected_embedded_asset_patch).expect("TODO"),
206+
// )
207+
// .expect("TODO");
206208

207209
let expected_embedded_reader: Reader =
208210
serde_json::from_reader(File::open(asset_dir.join("embedded.json"))?)?;
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"manifest_store":{"active_manifest":"urn:uuid:22eb8f61-61a9-40a3-a9df-5f694f93340b","manifests":{"urn:uuid:22eb8f61-61a9-40a3-a9df-5f694f93340b":{"claim_generator":"test/1.0 c2pa-rs/0.33.0","claim_generator_info":[{"name":"test","version":"1.0"},{"name":"c2pa-rs","version":"0.33.0"}],"format":"video/mp4","instance_id":"xmp:iid:a1a80ffc-d6e4-40bd-856d-b41b020b1651","ingredients":[],"assertions":[{"label":"c2pa.actions.v2","data":{"actions":[{"action":"c2pa.opened","softwareAgent":{"name":"TestApp","version":"1.0","something":"else"},"parameters":{"description":"import"},"digitalSourceType":"http://cv.iptc.org/newscodes/digitalsourcetype/algorithmicMedia"}]}},{"label":"c2pa.hash.bmff.v2","data":{"exclusions":[{"xpath":"/uuid","length":null,"data":[{"offset":8,"value":[216,254,195,214,27,14,72,60,146,151,88,40,135,126,196,129]}],"subset":null,"version":null,"flags":null,"exact":null},{"xpath":"/ftyp","length":null,"data":null,"subset":null,"version":null,"flags":null,"exact":null},{"xpath":"/meta/iloc","length":null,"data":null,"subset":null,"version":null,"flags":null,"exact":null},{"xpath":"/mfra/tfra","length":null,"data":null,"subset":null,"version":null,"flags":null,"exact":null},{"xpath":"/moov/trak/mdia/minf/stbl/stco","length":null,"data":null,"subset":[{"offset":16,"length":0}],"version":null,"flags":null,"exact":null},{"xpath":"/moov/trak/mdia/minf/stbl/co64","length":null,"data":null,"subset":[{"offset":16,"length":0}],"version":null,"flags":null,"exact":null},{"xpath":"/moof/traf/tfhd","length":null,"data":null,"subset":[{"offset":16,"length":8}],"version":null,"flags":[1,0,0],"exact":null},{"xpath":"/moof/traf/trun","length":null,"data":null,"subset":[{"offset":16,"length":4}],"version":null,"flags":[1,0,0],"exact":null}],"alg":"sha256","hash":[200,32,148,169,15,166,231,86,102,210,152,227,69,66,172,110,226,206,198,129,95,47,38,164,140,189,109,46,157,228,177,15],"name":"jumbf manifest"}}],"signature_info":{"alg":"Ed25519","issuer":"C2PA Test Signing Cert","cert_serial_number":"638838410810235485828984295321338730070538954823"},"label":"urn:uuid:22eb8f61-61a9-40a3-a9df-5f694f93340b"}}}}
1+
{"manifest_store":{"active_manifest":"urn:uuid:61715312-fe4e-472b-bc14-9ffcc88bcaa2","manifests":{"urn:uuid:61715312-fe4e-472b-bc14-9ffcc88bcaa2":{"claim_generator":"test/1.0 c2pa-rs/0.33.0","claim_generator_info":[{"name":"test","version":"1.0"},{"name":"c2pa-rs","version":"0.33.0"}],"format":"video/mp4","instance_id":"xmp:iid:ad5c3fc2-2600-412e-a0b8-edc6cd592c6d","ingredients":[],"assertions":[{"label":"c2pa.actions.v2","data":{"actions":[{"action":"c2pa.opened","softwareAgent":{"name":"TestApp","version":"1.0","something":"else"},"parameters":{"description":"import"},"digitalSourceType":"http://cv.iptc.org/newscodes/digitalsourcetype/algorithmicMedia"}]}},{"label":"c2pa.hash.bmff.v2","data":{"exclusions":[{"xpath":"/uuid","length":null,"data":[{"offset":8,"value":[216,254,195,214,27,14,72,60,146,151,88,40,135,126,196,129]}],"subset":null,"version":null,"flags":null,"exact":null},{"xpath":"/ftyp","length":null,"data":null,"subset":null,"version":null,"flags":null,"exact":null},{"xpath":"/meta/iloc","length":null,"data":null,"subset":null,"version":null,"flags":null,"exact":null},{"xpath":"/mfra/tfra","length":null,"data":null,"subset":null,"version":null,"flags":null,"exact":null},{"xpath":"/moov/trak/mdia/minf/stbl/stco","length":null,"data":null,"subset":[{"offset":16,"length":0}],"version":null,"flags":null,"exact":null},{"xpath":"/moov/trak/mdia/minf/stbl/co64","length":null,"data":null,"subset":[{"offset":16,"length":0}],"version":null,"flags":null,"exact":null},{"xpath":"/moof/traf/tfhd","length":null,"data":null,"subset":[{"offset":16,"length":8}],"version":null,"flags":[1,0,0],"exact":null},{"xpath":"/moof/traf/trun","length":null,"data":null,"subset":[{"offset":16,"length":4}],"version":null,"flags":[1,0,0],"exact":null}],"alg":"sha256","hash":[200,32,148,169,15,166,231,86,102,210,152,227,69,66,172,110,226,206,198,129,95,47,38,164,140,189,109,46,157,228,177,15],"name":"jumbf manifest"}}],"signature_info":{"alg":"Ed25519","issuer":"C2PA Test Signing Cert","cert_serial_number":"638838410810235485828984295321338730070538954823"},"label":"urn:uuid:61715312-fe4e-472b-bc14-9ffcc88bcaa2"}}}}
Binary file not shown.
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"manifest_store":{"active_manifest":"urn:uuid:305b5b3d-2db6-4fb1-9d41-bcfd21bca7d1","manifests":{"urn:uuid:305b5b3d-2db6-4fb1-9d41-bcfd21bca7d1":{"claim_generator":"test/1.0 c2pa-rs/0.33.0","claim_generator_info":[{"name":"test","version":"1.0"},{"name":"c2pa-rs","version":"0.33.0"}],"format":"video/mp4","instance_id":"xmp:iid:3f80e941-cd18-4130-8aae-6d8ca0c33fcd","ingredients":[],"assertions":[{"label":"c2pa.actions.v2","data":{"actions":[{"action":"c2pa.opened","softwareAgent":{"name":"TestApp","version":"1.0","something":"else"},"parameters":{"description":"import"},"digitalSourceType":"http://cv.iptc.org/newscodes/digitalsourcetype/algorithmicMedia"}]}},{"label":"c2pa.hash.bmff.v2","data":{"exclusions":[{"xpath":"/uuid","length":null,"data":[{"offset":8,"value":[216,254,195,214,27,14,72,60,146,151,88,40,135,126,196,129]}],"subset":null,"version":null,"flags":null,"exact":null},{"xpath":"/ftyp","length":null,"data":null,"subset":null,"version":null,"flags":null,"exact":null},{"xpath":"/meta/iloc","length":null,"data":null,"subset":null,"version":null,"flags":null,"exact":null},{"xpath":"/mfra/tfra","length":null,"data":null,"subset":null,"version":null,"flags":null,"exact":null},{"xpath":"/moov/trak/mdia/minf/stbl/stco","length":null,"data":null,"subset":[{"offset":16,"length":0}],"version":null,"flags":null,"exact":null},{"xpath":"/moov/trak/mdia/minf/stbl/co64","length":null,"data":null,"subset":[{"offset":16,"length":0}],"version":null,"flags":null,"exact":null},{"xpath":"/moof/traf/tfhd","length":null,"data":null,"subset":[{"offset":16,"length":8}],"version":null,"flags":[1,0,0],"exact":null},{"xpath":"/moof/traf/trun","length":null,"data":null,"subset":[{"offset":16,"length":4}],"version":null,"flags":[1,0,0],"exact":null}],"alg":"sha256","hash":[184,150,116,156,174,50,81,9,210,20,52,43,49,218,250,178,241,170,78,24,130,120,178,139,133,227,229,58,224,106,28,178],"name":"jumbf manifest"}}],"signature_info":{"alg":"Ed25519","issuer":"C2PA Test Signing Cert","cert_serial_number":"638838410810235485828984295321338730070538954823"},"label":"urn:uuid:305b5b3d-2db6-4fb1-9d41-bcfd21bca7d1"}}}}
1+
{"manifest_store":{"active_manifest":"urn:uuid:8ef2297e-b32c-4cc0-93f8-006207822769","manifests":{"urn:uuid:8ef2297e-b32c-4cc0-93f8-006207822769":{"claim_generator":"test/1.0 c2pa-rs/0.33.0","claim_generator_info":[{"name":"test","version":"1.0"},{"name":"c2pa-rs","version":"0.33.0"}],"format":"video/mp4","instance_id":"xmp:iid:bcf15ff7-9d5d-4595-9f5d-1d9eadee5d83","ingredients":[],"assertions":[{"label":"c2pa.actions.v2","data":{"actions":[{"action":"c2pa.opened","softwareAgent":{"name":"TestApp","version":"1.0","something":"else"},"parameters":{"description":"import"},"digitalSourceType":"http://cv.iptc.org/newscodes/digitalsourcetype/algorithmicMedia"}]}},{"label":"c2pa.hash.bmff.v2","data":{"exclusions":[{"xpath":"/uuid","length":null,"data":[{"offset":8,"value":[216,254,195,214,27,14,72,60,146,151,88,40,135,126,196,129]}],"subset":null,"version":null,"flags":null,"exact":null},{"xpath":"/ftyp","length":null,"data":null,"subset":null,"version":null,"flags":null,"exact":null},{"xpath":"/meta/iloc","length":null,"data":null,"subset":null,"version":null,"flags":null,"exact":null},{"xpath":"/mfra/tfra","length":null,"data":null,"subset":null,"version":null,"flags":null,"exact":null},{"xpath":"/moov/trak/mdia/minf/stbl/stco","length":null,"data":null,"subset":[{"offset":16,"length":0}],"version":null,"flags":null,"exact":null},{"xpath":"/moov/trak/mdia/minf/stbl/co64","length":null,"data":null,"subset":[{"offset":16,"length":0}],"version":null,"flags":null,"exact":null},{"xpath":"/moof/traf/tfhd","length":null,"data":null,"subset":[{"offset":16,"length":8}],"version":null,"flags":[1,0,0],"exact":null},{"xpath":"/moof/traf/trun","length":null,"data":null,"subset":[{"offset":16,"length":4}],"version":null,"flags":[1,0,0],"exact":null}],"alg":"sha256","hash":[184,150,116,156,174,50,81,9,210,20,52,43,49,218,250,178,241,170,78,24,130,120,178,139,133,227,229,58,224,106,28,178],"name":"jumbf manifest"}}],"signature_info":{"alg":"Ed25519","issuer":"C2PA Test Signing Cert","cert_serial_number":"638838410810235485828984295321338730070538954823"},"label":"urn:uuid:8ef2297e-b32c-4cc0-93f8-006207822769"}}}}
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"assets":[{"asset":"C.jpg","category":"jpeg","uncompressed_remote_size":52926,"uncompressed_embedded_size":65326},{"asset":"sample1.gif","category":"gif","uncompressed_remote_size":2722,"uncompressed_embedded_size":14907},{"asset":"sample1.svg","category":"svg","uncompressed_remote_size":null,"uncompressed_embedded_size":18163},{"asset":"video1.mp4","category":"bmff","uncompressed_remote_size":96487,"uncompressed_embedded_size":49024},{"asset":"sample1.mp3","category":"mp3","uncompressed_remote_size":1447,"uncompressed_embedded_size":13896},{"asset":"libpng-test.png","category":"png","uncompressed_remote_size":3355,"uncompressed_embedded_size":15725},{"asset":"TUSCANY.TIF","category":"tiff","uncompressed_remote_size":4257,"uncompressed_embedded_size":16646}],"public_key":"certs/ed25519.pub","private_key":"certs/ed25519.pem"}
1+
{"assets":[{"asset":"C.jpg","category":"jpeg","uncompressed_remote_size":87041,"uncompressed_embedded_size":99441},{"asset":"sample1.gif","category":"gif","uncompressed_remote_size":741149,"uncompressed_embedded_size":753333},{"asset":"sample1.svg","category":"svg","uncompressed_remote_size":null,"uncompressed_embedded_size":39649},{"asset":"video1.mp4","category":"bmff","uncompressed_remote_size":795882,"uncompressed_embedded_size":811373},{"asset":"sample1.mp3","category":"mp3","uncompressed_remote_size":1954616,"uncompressed_embedded_size":1967065},{"asset":"libpng-test.png","category":"png","uncompressed_remote_size":4135,"uncompressed_embedded_size":16505},{"asset":"TUSCANY.TIF","category":"tiff","uncompressed_remote_size":206254,"uncompressed_embedded_size":218642}],"public_key":"certs/ed25519.pub","private_key":"certs/ed25519.pem"}
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"manifest_store":{"active_manifest":"urn:uuid:e7652c72-a4a6-480e-8129-387d41996512","manifests":{"urn:uuid:e7652c72-a4a6-480e-8129-387d41996512":{"claim_generator":"test/1.0 c2pa-rs/0.33.0","claim_generator_info":[{"name":"test","version":"1.0"},{"name":"c2pa-rs","version":"0.33.0"}],"format":"image/gif","instance_id":"xmp:iid:21d5b1b2-3975-491b-bc03-636abf940fec","ingredients":[],"assertions":[{"label":"c2pa.actions.v2","data":{"actions":[{"action":"c2pa.opened","softwareAgent":{"name":"TestApp","version":"1.0","something":"else"},"parameters":{"description":"import"},"digitalSourceType":"http://cv.iptc.org/newscodes/digitalsourcetype/algorithmicMedia"}]}}],"signature_info":{"alg":"Ed25519","issuer":"C2PA Test Signing Cert","cert_serial_number":"638838410810235485828984295321338730070538954823"},"label":"urn:uuid:e7652c72-a4a6-480e-8129-387d41996512"}}}}
1+
{"manifest_store":{"active_manifest":"urn:uuid:cba77be8-dc0f-41f4-92f6-a635ef3077de","manifests":{"urn:uuid:cba77be8-dc0f-41f4-92f6-a635ef3077de":{"claim_generator":"test/1.0 c2pa-rs/0.33.0","claim_generator_info":[{"name":"test","version":"1.0"},{"name":"c2pa-rs","version":"0.33.0"}],"format":"image/gif","instance_id":"xmp:iid:99a2a935-431c-48a2-9baf-6a4fffe461d8","ingredients":[],"assertions":[{"label":"c2pa.actions.v2","data":{"actions":[{"action":"c2pa.opened","softwareAgent":{"name":"TestApp","version":"1.0","something":"else"},"parameters":{"description":"import"},"digitalSourceType":"http://cv.iptc.org/newscodes/digitalsourcetype/algorithmicMedia"}]}}],"signature_info":{"alg":"Ed25519","issuer":"C2PA Test Signing Cert","cert_serial_number":"638838410810235485828984295321338730070538954823"},"label":"urn:uuid:cba77be8-dc0f-41f4-92f6-a635ef3077de"}}}}
Binary file not shown.
0 Bytes
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"manifest_store":{"active_manifest":"urn:uuid:ac12e1b4-312c-40a9-9abd-565e1d33a91a","manifests":{"urn:uuid:ac12e1b4-312c-40a9-9abd-565e1d33a91a":{"claim_generator":"test/1.0 c2pa-rs/0.33.0","claim_generator_info":[{"name":"test","version":"1.0"},{"name":"c2pa-rs","version":"0.33.0"}],"format":"image/gif","instance_id":"xmp:iid:f1eb70ae-f5af-481a-8e94-40fb07c55378","ingredients":[],"assertions":[{"label":"c2pa.actions.v2","data":{"actions":[{"action":"c2pa.opened","softwareAgent":{"name":"TestApp","version":"1.0","something":"else"},"parameters":{"description":"import"},"digitalSourceType":"http://cv.iptc.org/newscodes/digitalsourcetype/algorithmicMedia"}]}}],"signature_info":{"alg":"Ed25519","issuer":"C2PA Test Signing Cert","cert_serial_number":"638838410810235485828984295321338730070538954823"},"label":"urn:uuid:ac12e1b4-312c-40a9-9abd-565e1d33a91a"}}}}
1+
{"manifest_store":{"active_manifest":"urn:uuid:d98fad5e-65ab-4841-a376-aef5627b9856","manifests":{"urn:uuid:d98fad5e-65ab-4841-a376-aef5627b9856":{"claim_generator":"test/1.0 c2pa-rs/0.33.0","claim_generator_info":[{"name":"test","version":"1.0"},{"name":"c2pa-rs","version":"0.33.0"}],"format":"image/gif","instance_id":"xmp:iid:d987453c-fc2e-488f-8743-12964168f699","ingredients":[],"assertions":[{"label":"c2pa.actions.v2","data":{"actions":[{"action":"c2pa.opened","softwareAgent":{"name":"TestApp","version":"1.0","something":"else"},"parameters":{"description":"import"},"digitalSourceType":"http://cv.iptc.org/newscodes/digitalsourcetype/algorithmicMedia"}]}}],"signature_info":{"alg":"Ed25519","issuer":"C2PA Test Signing Cert","cert_serial_number":"638838410810235485828984295321338730070538954823"},"label":"urn:uuid:d98fad5e-65ab-4841-a376-aef5627b9856"}}}}
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)