|
41 | 41 | 'c2pa_reader_from_manifest_data_and_stream', |
42 | 42 | 'c2pa_reader_free', |
43 | 43 | 'c2pa_reader_json', |
| 44 | + 'c2pa_reader_detailed_json', |
44 | 45 | 'c2pa_reader_resource_to_stream', |
45 | 46 | 'c2pa_builder_from_json', |
46 | 47 | 'c2pa_builder_from_archive', |
@@ -379,6 +380,9 @@ def _setup_function(func, argtypes, restype=None): |
379 | 380 | _setup_function( |
380 | 381 | _lib.c2pa_reader_json, [ |
381 | 382 | ctypes.POINTER(C2paReader)], ctypes.c_void_p) |
| 383 | +_setup_function( |
| 384 | + _lib.c2pa_reader_detailed_json, [ |
| 385 | + ctypes.POINTER(C2paReader)], ctypes.c_void_p) |
382 | 386 | _setup_function(_lib.c2pa_reader_resource_to_stream, [ctypes.POINTER( |
383 | 387 | C2paReader), ctypes.c_char_p, ctypes.POINTER(C2paStream)], ctypes.c_int64) |
384 | 388 | _setup_function( |
@@ -1737,6 +1741,34 @@ def json(self) -> str: |
1737 | 1741 | self._manifest_json_str_cache = _convert_to_py_string(result) |
1738 | 1742 | return self._manifest_json_str_cache |
1739 | 1743 |
|
| 1744 | + def detailed_json(self) -> str: |
| 1745 | + """Get the detailed JSON representation of the C2PA manifest store. |
| 1746 | +
|
| 1747 | + This method returns a more detailed JSON string than Reader.json(), |
| 1748 | + providing additional information about the manifest structure. |
| 1749 | + Note that the returned JSON by this method has a slightly different |
| 1750 | + structure than the one returned by Reader.json(). |
| 1751 | +
|
| 1752 | + Returns: |
| 1753 | + A JSON string containing the detailed manifest store data. |
| 1754 | +
|
| 1755 | + Raises: |
| 1756 | + C2paError: If there is an error reading the manifest data or if |
| 1757 | + the Reader has been closed. |
| 1758 | + """ |
| 1759 | + |
| 1760 | + self._ensure_valid_state() |
| 1761 | + |
| 1762 | + result = _lib.c2pa_reader_detailed_json(self._reader) |
| 1763 | + |
| 1764 | + if result is None: |
| 1765 | + error = _parse_operation_result_for_error(_lib.c2pa_error()) |
| 1766 | + if error: |
| 1767 | + raise C2paError(error) |
| 1768 | + raise C2paError("Error during detailed manifest parsing in Reader") |
| 1769 | + |
| 1770 | + return _convert_to_py_string(result) |
| 1771 | + |
1740 | 1772 | def get_active_manifest(self) -> Optional[dict]: |
1741 | 1773 | """Get the active manifest from the manifest store. |
1742 | 1774 |
|
|
0 commit comments