Skip to content

Bindings for c2pa_reader_with_manifest_data_and_stream and c2pa_reader_with_fragment#237

Open
tmathern wants to merge 8 commits into
mainfrom
mathern/118-c2pa_reader_with_manifest_data_and_stream
Open

Bindings for c2pa_reader_with_manifest_data_and_stream and c2pa_reader_with_fragment#237
tmathern wants to merge 8 commits into
mainfrom
mathern/118-c2pa_reader_with_manifest_data_and_stream

Conversation

@tmathern

Copy link
Copy Markdown
Collaborator

@tmathern tmathern self-assigned this Jun 22, 2026
@tmathern tmathern requested a review from gpeacock June 22, 2026 16:47
@tmathern tmathern marked this pull request as ready for review June 22, 2026 20:38
@tmathern tmathern changed the title (WIP) Bindings for c2pa_reader_with_manifest_data_and_stream and c2pa_reader_with_fragment Bindings for c2pa_reader_with_manifest_data_and_stream and c2pa_reader_with_fragment Jun 22, 2026
Comment thread src/c2pa_reader.cpp

c2pa_reader = c2pa_reader_from_context(context.c_context());
if (c2pa_reader == nullptr) {
throw C2paException("Failed to create reader from context");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not use C2paException here?

@gpeacock gpeacock left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few questions but otherwise this looks fine.

Comment thread src/c2pa_reader.cpp
throw C2paException("Invalid Context provider IContextProvider");
}
if (manifest_jumbf.empty()) {
throw C2paException("manifest_jumbf must not be empty");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we don't have these checks in c_fii, we should add them there. Not required for this PR, but just wondering why we need to do extra validation at this level.

Comment thread src/c2pa_reader.cpp Outdated
ensure_initialized();

// Wrap both streams for the FFI call.
fragment_main_stream = std::make_unique<CppIStream>(stream);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are these not on the stack in this method?

Comment thread tests/reader.test.cpp
};

TEST_F(ReaderSidecarTest, ReaderCanReadSidecar) {
auto sc = make_test_sidecar_bytes(c2pa_test::get_fixture_path("C.jpg"), "image/jpeg");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

using C.jpg with an existing manifest is an interesting test in this case, the asset produced should have the manifest stripped and the manifest store should have two manifest in it. It is more complicated than a simple asset, but it should work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants