|
48 | 48 | 'c2pa_reader_from_manifest_data_and_stream', |
49 | 49 | 'c2pa_reader_json', |
50 | 50 | 'c2pa_reader_detailed_json', |
| 51 | + 'c2pa_reader_crjson', |
51 | 52 | 'c2pa_reader_resource_to_stream', |
52 | 53 | 'c2pa_reader_from_context', |
53 | 54 | 'c2pa_reader_with_stream', |
@@ -561,6 +562,9 @@ def _setup_function(func, argtypes, restype=None): |
561 | 562 | _setup_function( |
562 | 563 | _lib.c2pa_reader_detailed_json, [ |
563 | 564 | ctypes.POINTER(C2paReader)], ctypes.c_void_p) |
| 565 | +_setup_function( |
| 566 | + _lib.c2pa_reader_crjson, [ |
| 567 | + ctypes.POINTER(C2paReader)], ctypes.c_void_p) |
564 | 568 | _setup_function(_lib.c2pa_reader_resource_to_stream, [ctypes.POINTER( |
565 | 569 | C2paReader), ctypes.c_char_p, ctypes.POINTER(C2paStream)], ctypes.c_int64) |
566 | 570 | _setup_function( |
@@ -2631,6 +2635,27 @@ def detailed_json(self) -> str: |
2631 | 2635 |
|
2632 | 2636 | return _convert_to_py_string(result) |
2633 | 2637 |
|
| 2638 | + def crjson(self) -> str: |
| 2639 | + """Get the manifest store as a crJSON string. |
| 2640 | +
|
| 2641 | + crJSON is a standardized JSON format for C2PA manifest data. This |
| 2642 | + call yields empty JSON ("{}") when there are no Content Credentials. |
| 2643 | +
|
| 2644 | + Returns: |
| 2645 | + The manifest store as a crJSON string. |
| 2646 | +
|
| 2647 | + Raises: |
| 2648 | + C2paError: If the Reader has been closed or the underlying C |
| 2649 | + call returns null. |
| 2650 | + """ |
| 2651 | + |
| 2652 | + self._ensure_valid_state() |
| 2653 | + |
| 2654 | + result = _lib.c2pa_reader_crjson(self._handle) |
| 2655 | + _check_ffi_operation_result(result, "Error parsing crJSON") |
| 2656 | + |
| 2657 | + return _convert_to_py_string(result) |
| 2658 | + |
2634 | 2659 | def _get_manifest_field(self, extractor): |
2635 | 2660 | """Extract a field from (cached) manifest data, or None if unavailable. |
2636 | 2661 |
|
|
0 commit comments