The UMSFiletypeDetector object calls a list of loadable detectors until the file format has been recognized or the list is exhausted.
Each loadable detector returns either 0 (False) or nonzero (True). If a loadable detector returns 0, the UMSFiletypeDetector object goes on to the next loadable detector. If a loadable detector returns nonzero, it recognized the file type.
To learn more about the UMSFiletypeDetector object, see:
For introductory information, see Formatted File Access Objects.
Each loadable detector is an executable of the following form:
typedef int (*detector_function_type)(char *filename)
char *filename | Specifies the name of the file as you would pass it to an open or fopen libc function call. |
This function type returns a True or False value that indicates the file is or is not the type that the function recognizes. The function may open the file. It may look at the file name for a pattern, such as .wav or .raw. This typedef is of the load function when called to load a module listed in the configuration.
The return value is 0 if the file is not of the type that the function recognizes. The return value is nonzero if the file is the type that the function recognizes.
The supplied detectors recognize the following file formats:
The part of the configuration file that deals with the detector is of the following form:
Detector: detection_module "../src/d_AVI" file_type_alias "This is an AVI file" *NEXT: detection_module "../src/d_AVSS" file_type_alias "This is an AVSS file" *NEXT: detection_module "../src/d_WAVE" file_type_alias "This is a WAVE file" *NEXT: detection_module "../src/d_SND" file_type_alias "This is a SND file" *NEXT: detection_module "../src/d_RAW" file_type_alias "This is a RAW file" *NEXT: detection_module "../src/d_anyfile" file_type_alias "This is a RAW file (2)"
Each loadable detector to be called is specified by path name in the detection_module property. Each specified detector is called in sequence until one returns a True value (nonzero). The UMSFiletypeDetector object returns the string specified in the file_type_alias property. If none of the loadable detectors recognize the file, the UMSFiletypeDetector object returns Null.
This method calls the UMSConfig object seek_alias method. If no match is found, this method returns Null. If a match is found, this method returns the string that the UMSConfig object seek_alias method returned. The return value is a pointer that points to data held inside the UMSFiletypeDetector object and should not be freed. This data is overwritten by the next call to the object. If the caller needs to keep the returned string, the caller should make a copy.
in string cat | This is the category to be used for the search of the configuration file. |
If successful, returns the string that represents the category found. If not successful, returns Null.
This function returns a string name for a file type given the file name. The string names come from the file type alias properties of the configuration file. The return value is a pointer that points to data held inside the UMSFiletypeDetector object and should not be freed. This data is overwritten by the next call to the object. If the caller needs to keep the returned string, the caller should make a copy.
in string filename | This is the name of the file as you would pass it to an open or fopen libc function call. |
The return value is a pointer to a string giving the name of the file type or format. The pointer points to static data and should not be freed. The return value is Null if the file type cannot be determined.
For introductory information, see Formatted File Access Objects.