Filtering in File Mode
To use the Filter file-based I/O
- Load the
kvfilter
library and obtain theKV_GetFilterInterfaceEx()
entry point by calling KV_GetFilterInterfaceEx(). Thefilter
sample program contains sample code for all platforms. - Initialize a filter session by calling fpInit() or fpInitWithLicenseData(). This function's return value,
pContext
, is passed as the first argument to the File Extraction interface and all other Filter functions. - Pass the context pointer from fpInit() or fpInitWithLicenseData() and the address of a structure that contains pointers to the File Extraction API functions in the call to KVGetExtractInterface().
- Declare the file path in the KVOpenFileArg structure.
- Open the file by calling fpOpenFile() and passing the
KVOpenFileArg
structure. This call defines the parameters necessary to open a file for extraction. - Determine whether the source file is a container file (that is, whether it contains subfiles) by calling fpGetMainFileInfo().
- If the call to
fpGetMainFileInfo()
determined that the source file contains subfiles, proceed to step 8; otherwise, proceed to step 11. - Determine whether the subfile is a container file by calling fpGetSubFileInfo().
- Extract the subfile or subfiles to a file by calling fpExtractSubFile() and setting
filePath
andextractDir
in theKVExtractSubFileArg
structure. - If the call to
fpGetSubFileInfo()
determined that the subfile is a container file, repeat step 4 through step 9 until all subfiles are extracted; otherwise, proceed to step 11. - Filter the file by calling fpFilterFile().
- Close the file by calling fpCloseFile().
- Repeat step 4 through step 12 as required for additional source files.
- Terminate the filter session by calling fpShutdown().