comparison foosdk/sdk/foobar2000/SDK/file_format_sanitizer.h @ 1:20d02a178406 default tip

*: check in everything else yay
author Paper <paper@tflc.us>
date Mon, 05 Jan 2026 02:15:46 -0500
parents
children
comparison
equal deleted inserted replaced
0:e9bb126753e7 1:20d02a178406
1 #pragma once
2
3 #ifdef FOOBAR2000_HAVE_FILE_FORMAT_SANITIZER
4 //! Utility service to perform file format specific cleanup routines, optimize tags layout, remove padding, etc.
5 class NOVTABLE file_format_sanitizer : public service_base {
6 FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT( file_format_sanitizer );
7 public:
8 //! Returns whether the file path appears to be of a supported format. \n
9 //! Used for display purposes (menu command will be disabled when no selected file can be cleaned up).
10 virtual bool is_supported_format( const char * path, const char * ext ) = 0;
11 //! Performs file format specific cleanup of the file: \n
12 //! Strips excessive padding, optimizes file layout for network streaming (MP4). \n
13 //! @param path File path to clean up. The file must be writeable. \n
14 //! @param bMinimizeSize Set to true to throw away all padding. If set to false, some padding will be left to allow future tag updates without full file rewrite.
15 //! @returns True if the file has been successfully processed, false if we do not resupport this file format.
16 virtual bool sanitize_file( const char * path, bool bMinimizeSize, abort_callback & aborter ) = 0;
17 };
18
19 //! \since 1.6 series
20 class NOVTABLE file_format_sanitizer_v2 : public file_format_sanitizer {
21 FB2K_MAKE_SERVICE_INTERFACE(file_format_sanitizer_v2, file_format_sanitizer);
22 public:
23 //! Perform additional cleanups in the file after an encode pass has finished. \n
24 //! Mainly meant to mitigate extremely annoying design of FLAC encoder.
25 virtual void after_encode(const char* path, abort_callback& aborter) = 0;
26 };
27
28 //! Utility service to perform sanitization of generic ID3v2 tags. Called by format-specific implementations of file_format_sanitizer.
29 class NOVTABLE file_format_sanitizer_stdtags : public service_base {
30 FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT( file_format_sanitizer_stdtags );
31 public:
32 //! Similar to file_format_sanitizer method of the same name. Performs sanitization of generic ID3v2 tags.
33 virtual bool sanitize_file( const char * path, bool bMinimizeSize, abort_callback & aborter ) = 0;
34 };
35
36 #endif // FOOBAR2000_HAVE_FILE_FORMAT_SANITIZER