diff --git a/.gitignore b/.gitignore index febe4d97e..a7d153e6a 100644 --- a/.gitignore +++ b/.gitignore @@ -36,7 +36,7 @@ Xcode-config/SENTRY_SETTINGS.xcconfig /ThirdParty/ffmpeg/lib/libavformat.61.dylib /ThirdParty/ffmpeg/lib/libavutil.59.dylib /ThirdParty/ffmpeg/lib/libswresample.5.dylib -/ThirdParty/flac/lib/libFLAC.12.dylib +/ThirdParty/flac/lib/libFLAC.14.dylib /ThirdParty/libid3tag/lib/libid3tag.a /ThirdParty/libmad/lib/libmad.a /ThirdParty/libopenmpt/lib/libopenmpt.a diff --git a/Cog.xcodeproj/project.pbxproj b/Cog.xcodeproj/project.pbxproj index 08b01822a..351a309eb 100644 --- a/Cog.xcodeproj/project.pbxproj +++ b/Cog.xcodeproj/project.pbxproj @@ -129,7 +129,7 @@ 836EF0C827BB91E600BF35B2 /* libogg.0.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = 836EF0C427BB919300BF35B2 /* libogg.0.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; 836EF0C927BB91E900BF35B2 /* libvorbisfile.3.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = 836EF0C627BB91AB00BF35B2 /* libvorbisfile.3.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; 836EF0CA27BB91EB00BF35B2 /* libvorbis.0.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = 836EF0C527BB91AB00BF35B2 /* libvorbis.0.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; - 836EF0CB27BB91EE00BF35B2 /* libFLAC.12.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = 836EF0C727BB91BC00BF35B2 /* libFLAC.12.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 836EF0CB27BB91EE00BF35B2 /* libFLAC.14.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = 836EF0C727BB91BC00BF35B2 /* libFLAC.14.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; 836EF0E027BB98A800BF35B2 /* libopus.0.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = 836EF0CC27BB94E100BF35B2 /* libopus.0.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; 836EF0E127BB98AB00BF35B2 /* libopusfile.0.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = 836EF0CD27BB94F100BF35B2 /* libopusfile.0.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; 836F5BF91A357A01002730CC /* sidplay.bundle in CopyFiles */ = {isa = PBXBuildFile; fileRef = 8314D6411A354DFF00EEE8E6 /* sidplay.bundle */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; @@ -719,7 +719,7 @@ 836DF617298F6F1700CD0580 /* libsoxr.0.dylib in CopyFiles */, 836EF0E127BB98AB00BF35B2 /* libopusfile.0.dylib in CopyFiles */, 836EF0E027BB98A800BF35B2 /* libopus.0.dylib in CopyFiles */, - 836EF0CB27BB91EE00BF35B2 /* libFLAC.12.dylib in CopyFiles */, + 836EF0CB27BB91EE00BF35B2 /* libFLAC.14.dylib in CopyFiles */, 836EF0CA27BB91EB00BF35B2 /* libvorbis.0.dylib in CopyFiles */, 83256B69286661FC0036D9C0 /* libmpg123.0.dylib in CopyFiles */, 836EF0C927BB91E900BF35B2 /* libvorbisfile.3.dylib in CopyFiles */, @@ -948,7 +948,7 @@ 836EF0C427BB919300BF35B2 /* libogg.0.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libogg.0.dylib; path = ThirdParty/ogg/lib/libogg.0.dylib; sourceTree = ""; }; 836EF0C527BB91AB00BF35B2 /* libvorbis.0.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libvorbis.0.dylib; path = ThirdParty/vorbis/lib/libvorbis.0.dylib; sourceTree = ""; }; 836EF0C627BB91AB00BF35B2 /* libvorbisfile.3.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libvorbisfile.3.dylib; path = ThirdParty/vorbis/lib/libvorbisfile.3.dylib; sourceTree = ""; }; - 836EF0C727BB91BC00BF35B2 /* libFLAC.12.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libFLAC.12.dylib; path = ThirdParty/flac/lib/libFLAC.12.dylib; sourceTree = ""; }; + 836EF0C727BB91BC00BF35B2 /* libFLAC.14.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libFLAC.14.dylib; path = ThirdParty/flac/lib/libFLAC.14.dylib; sourceTree = ""; }; 836EF0CC27BB94E100BF35B2 /* libopus.0.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libopus.0.dylib; path = ThirdParty/opus/lib/libopus.0.dylib; sourceTree = ""; }; 836EF0CD27BB94F100BF35B2 /* libopusfile.0.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libopusfile.0.dylib; path = ThirdParty/opusfile/lib/libopusfile.0.dylib; sourceTree = ""; }; 836F6B2518BDB80D0095E648 /* vgmstream.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = vgmstream.xcodeproj; path = Plugins/vgmstream/vgmstream.xcodeproj; sourceTree = ""; }; @@ -1148,7 +1148,7 @@ 835FAC7D27BCDF5B00BA8562 /* libavif.a */, 836EF0CD27BB94F100BF35B2 /* libopusfile.0.dylib */, 836EF0CC27BB94E100BF35B2 /* libopus.0.dylib */, - 836EF0C727BB91BC00BF35B2 /* libFLAC.12.dylib */, + 836EF0C727BB91BC00BF35B2 /* libFLAC.14.dylib */, 836EF0C527BB91AB00BF35B2 /* libvorbis.0.dylib */, 836EF0C627BB91AB00BF35B2 /* libvorbisfile.3.dylib */, 836EF0C427BB919300BF35B2 /* libogg.0.dylib */, diff --git a/Frameworks/vgmstream/libvgmstream.xcodeproj/project.pbxproj b/Frameworks/vgmstream/libvgmstream.xcodeproj/project.pbxproj index e32ea229d..73d091a04 100644 --- a/Frameworks/vgmstream/libvgmstream.xcodeproj/project.pbxproj +++ b/Frameworks/vgmstream/libvgmstream.xcodeproj/project.pbxproj @@ -62,7 +62,7 @@ 8306B0EB20984590000302D4 /* wave_segmented.c in Sources */ = {isa = PBXBuildFile; fileRef = 8306B0D02098458F000302D4 /* wave_segmented.c */; }; 8306B0EC20984590000302D4 /* pcm_sre.c in Sources */ = {isa = PBXBuildFile; fileRef = 8306B0D12098458F000302D4 /* pcm_sre.c */; }; 8306B0ED20984590000302D4 /* txtp.c in Sources */ = {isa = PBXBuildFile; fileRef = 8306B0D22098458F000302D4 /* txtp.c */; }; - 8306B0EE20984590000302D4 /* smc_smh.c in Sources */ = {isa = PBXBuildFile; fileRef = 8306B0D32098458F000302D4 /* smc_smh.c */; }; + 8306B0EE20984590000302D4 /* smh_smc.c in Sources */ = {isa = PBXBuildFile; fileRef = 8306B0D32098458F000302D4 /* smh_smc.c */; }; 8306B0EF20984590000302D4 /* ubi_bao.c in Sources */ = {isa = PBXBuildFile; fileRef = 8306B0D420984590000302D4 /* ubi_bao.c */; }; 8306B0F020984590000302D4 /* atsl.c in Sources */ = {isa = PBXBuildFile; fileRef = 8306B0D520984590000302D4 /* atsl.c */; }; 8306B0F120984590000302D4 /* ppst.c in Sources */ = {isa = PBXBuildFile; fileRef = 8306B0D620984590000302D4 /* ppst.c */; }; @@ -154,6 +154,8 @@ 832BF82B21E0514B006F50F1 /* xopus.c in Sources */ = {isa = PBXBuildFile; fileRef = 832BF81921E0514A006F50F1 /* xopus.c */; }; 832BF82C21E0514B006F50F1 /* hca_keys_awb.h in Headers */ = {isa = PBXBuildFile; fileRef = 832BF81A21E0514A006F50F1 /* hca_keys_awb.h */; }; 832BF82D21E0514B006F50F1 /* nus3audio.c in Sources */ = {isa = PBXBuildFile; fileRef = 832BF81B21E0514B006F50F1 /* nus3audio.c */; }; + 832F9EA62E29047F00D08728 /* srcd.c in Sources */ = {isa = PBXBuildFile; fileRef = 832F9EA52E29047F00D08728 /* srcd.c */; }; + 832F9EA82E2905D500D08728 /* mhwk.c in Sources */ = {isa = PBXBuildFile; fileRef = 832F9EA72E2905D500D08728 /* mhwk.c */; }; 832FC36C278FA4CB0056A860 /* ubi_ckd_cwav_streamfile.h in Headers */ = {isa = PBXBuildFile; fileRef = 832FC367278FA4CB0056A860 /* ubi_ckd_cwav_streamfile.h */; }; 832FC36D278FA4CB0056A860 /* ubi_ckd_cwav.c in Sources */ = {isa = PBXBuildFile; fileRef = 832FC36B278FA4CB0056A860 /* ubi_ckd_cwav.c */; }; 832FC36F278FAE3E0056A860 /* encrypted_mc161_streamfile.h in Headers */ = {isa = PBXBuildFile; fileRef = 832FC36E278FAE3E0056A860 /* encrypted_mc161_streamfile.h */; }; @@ -515,7 +517,7 @@ 836F6F9418BDC2190095E648 /* iivb.c in Sources */ = {isa = PBXBuildFile; fileRef = 836F6E5818BDC2180095E648 /* iivb.c */; }; 836F6F9518BDC2190095E648 /* kraw.c in Sources */ = {isa = PBXBuildFile; fileRef = 836F6E5918BDC2180095E648 /* kraw.c */; }; 836F6F9618BDC2190095E648 /* lsf.c in Sources */ = {isa = PBXBuildFile; fileRef = 836F6E5A18BDC2180095E648 /* lsf.c */; }; - 836F6F9818BDC2190095E648 /* mattel_hyperscan.c in Sources */ = {isa = PBXBuildFile; fileRef = 836F6E5C18BDC2180095E648 /* mattel_hyperscan.c */; }; + 836F6F9818BDC2190095E648 /* kvag.c in Sources */ = {isa = PBXBuildFile; fileRef = 836F6E5C18BDC2180095E648 /* kvag.c */; }; 836F6F9918BDC2190095E648 /* maxis_xa.c in Sources */ = {isa = PBXBuildFile; fileRef = 836F6E5D18BDC2180095E648 /* maxis_xa.c */; }; 836F6F9A18BDC2190095E648 /* meta.h in Headers */ = {isa = PBXBuildFile; fileRef = 836F6E5E18BDC2180095E648 /* meta.h */; }; 836F6F9C18BDC2190095E648 /* mp4.c in Sources */ = {isa = PBXBuildFile; fileRef = 836F6E6018BDC2180095E648 /* mp4.c */; }; @@ -1020,7 +1022,7 @@ 8306B0D02098458F000302D4 /* wave_segmented.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = wave_segmented.c; sourceTree = ""; }; 8306B0D12098458F000302D4 /* pcm_sre.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pcm_sre.c; sourceTree = ""; }; 8306B0D22098458F000302D4 /* txtp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = txtp.c; sourceTree = ""; }; - 8306B0D32098458F000302D4 /* smc_smh.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = smc_smh.c; sourceTree = ""; }; + 8306B0D32098458F000302D4 /* smh_smc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = smh_smc.c; sourceTree = ""; }; 8306B0D420984590000302D4 /* ubi_bao.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ubi_bao.c; sourceTree = ""; }; 8306B0D520984590000302D4 /* atsl.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = atsl.c; sourceTree = ""; }; 8306B0D620984590000302D4 /* ppst.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ppst.c; sourceTree = ""; }; @@ -1112,6 +1114,8 @@ 832BF81921E0514A006F50F1 /* xopus.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = xopus.c; sourceTree = ""; }; 832BF81A21E0514A006F50F1 /* hca_keys_awb.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = hca_keys_awb.h; sourceTree = ""; }; 832BF81B21E0514B006F50F1 /* nus3audio.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = nus3audio.c; sourceTree = ""; }; + 832F9EA52E29047F00D08728 /* srcd.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = srcd.c; sourceTree = ""; }; + 832F9EA72E2905D500D08728 /* mhwk.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = mhwk.c; sourceTree = ""; }; 832FC367278FA4CB0056A860 /* ubi_ckd_cwav_streamfile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ubi_ckd_cwav_streamfile.h; sourceTree = ""; }; 832FC36B278FA4CB0056A860 /* ubi_ckd_cwav.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ubi_ckd_cwav.c; sourceTree = ""; }; 832FC36E278FAE3E0056A860 /* encrypted_mc161_streamfile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = encrypted_mc161_streamfile.h; sourceTree = ""; }; @@ -1473,7 +1477,7 @@ 836F6E5818BDC2180095E648 /* iivb.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = iivb.c; sourceTree = ""; }; 836F6E5918BDC2180095E648 /* kraw.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = kraw.c; sourceTree = ""; }; 836F6E5A18BDC2180095E648 /* lsf.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = lsf.c; sourceTree = ""; }; - 836F6E5C18BDC2180095E648 /* mattel_hyperscan.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mattel_hyperscan.c; sourceTree = ""; }; + 836F6E5C18BDC2180095E648 /* kvag.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = kvag.c; sourceTree = ""; }; 836F6E5D18BDC2180095E648 /* maxis_xa.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = maxis_xa.c; sourceTree = ""; }; 836F6E5E18BDC2180095E648 /* meta.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = meta.h; sourceTree = ""; }; 836F6E6018BDC2180095E648 /* mp4.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mp4.c; sourceTree = ""; }; @@ -2498,6 +2502,7 @@ 83D20074248DDB760048BD24 /* ktsr.c */, 834F7CFE2C7085EA003AC386 /* ktsr_streamfile.h */, 830EBE122004656E0023AA10 /* ktss.c */, + 836F6E5C18BDC2180095E648 /* kvag.c */, 8373342423F60CDB00DE14DC /* kwb.c */, 835B9B8C2730BF2C00F87EE3 /* lopu_fb.c */, 836F6E9918BDC2180095E648 /* lp_ap_lep.c */, @@ -2509,11 +2514,11 @@ 8373341F23F60CDB00DE14DC /* lrmd_streamfile.h */, 836F6E5A18BDC2180095E648 /* lsf.c */, 83EDE5D61A70951A005F5D84 /* madp.c */, - 836F6E5C18BDC2180095E648 /* mattel_hyperscan.c */, 836F6E5D18BDC2180095E648 /* maxis_xa.c */, 836F6E9D18BDC2180095E648 /* mcg.c */, 83709E011ECBC1A4005C03D3 /* mcss.c */, 836F6E5E18BDC2180095E648 /* meta.h */, + 832F9EA72E2905D500D08728 /* mhwk.c */, 834FE0DE215C79EB000A5D3D /* mib_mih.c */, 836F6EAC18BDC2180095E648 /* mic_koei.c */, 83B73C4A2D8FF19800A57F08 /* mio.c */, @@ -2660,7 +2665,7 @@ 83CBF5422D46339200AA2D75 /* skex.c */, 836F6EBB18BDC2180095E648 /* sl3.c */, 836F6EF218BDC2190095E648 /* sli.c */, - 8306B0D32098458F000302D4 /* smc_smh.c */, + 8306B0D32098458F000302D4 /* smh_smc.c */, 837CEAEB23487F2B00E62A4A /* smk.c */, 83F0AA5C21E2028B004BBC04 /* smp.c */, 836F6EBC18BDC2180095E648 /* smpl.c */, @@ -2679,6 +2684,7 @@ 83A21F84201D8981000F04B9 /* sqex_sead.c */, 837CEAF023487F2C00E62A4A /* sqex_streamfile.h */, 83C0C75C2AA435C60056AFD8 /* squeak.c */, + 832F9EA52E29047F00D08728 /* srcd.c */, 834FE0D6215C79E9000A5D3D /* sscf.c */, 8396BE792935FC2F00CD0580 /* sscf_encrypted.h */, 8396BE782935FC2F00CD0580 /* sscf_encrypted.c */, @@ -3245,7 +3251,7 @@ 83A21F8D201D8982000F04B9 /* sqex_sead.c in Sources */, 834F7ED32C70A786003AC386 /* mixing.c in Sources */, 83EED5D3203A8BC7008BEB45 /* ea_swvr.c in Sources */, - 8306B0EE20984590000302D4 /* smc_smh.c in Sources */, + 8306B0EE20984590000302D4 /* smh_smc.c in Sources */, 834F7DAB2C7093EA003AC386 /* asf_decoder.c in Sources */, 834F7E0C2C7093EA003AC386 /* ws_decoder.c in Sources */, 834F7EDB2C70A786003AC386 /* streamfile_api.c in Sources */, @@ -3553,7 +3559,7 @@ 834F7E962C70A45C003AC386 /* txtp_parser.c in Sources */, 834FE0EA215C79ED000A5D3D /* aif_asobo.c in Sources */, 836F700418BDC2190095E648 /* vas_kceo.c in Sources */, - 836F6F9818BDC2190095E648 /* mattel_hyperscan.c in Sources */, + 836F6F9818BDC2190095E648 /* kvag.c in Sources */, 8306B0BA20984552000302D4 /* blocked_wsi.c in Sources */, 834F7E802C709EA0003AC386 /* adp_ongakukan.c in Sources */, 83BAFB6C19F45EB3005DAB60 /* bfstm.c in Sources */, @@ -3667,6 +3673,7 @@ 834F7DB62C7093EA003AC386 /* compresswave_lib.c in Sources */, 834F7E042C7093EA003AC386 /* vorbis_custom_utils_awc.c in Sources */, 8306B0EC20984590000302D4 /* pcm_sre.c in Sources */, + 832F9EA62E29047F00D08728 /* srcd.c in Sources */, 836F6FC818BDC2190095E648 /* pos.c in Sources */, 836F6F8918BDC2190095E648 /* gca.c in Sources */, 836F6FA418BDC2190095E648 /* nds_hwas.c in Sources */, @@ -3805,6 +3812,7 @@ 836F6FA918BDC2190095E648 /* ngc_adpdtk.c in Sources */, 836F6FDC18BDC2190095E648 /* iab.c in Sources */, 83C7282122BC893D00678B4A /* msf_konami.c in Sources */, + 832F9EA82E2905D500D08728 /* mhwk.c in Sources */, 833E82F72A2858EF00CD0580 /* reader.c in Sources */, 83B69B222845A26600D2435A /* bw_mp3_riff.c in Sources */, 834F7E192C709A1D003AC386 /* ea_schl_abk.c in Sources */, diff --git a/Info.plist.template b/Info.plist.template index b97685aef..4a0904033 100644 --- a/Info.plist.template +++ b/Info.plist.template @@ -656,6 +656,7 @@ mds mdsp med + mhwk mjb mi4 mib @@ -829,7 +830,7 @@ skx slb sli - smc + smh smk smp smv @@ -851,6 +852,7 @@ spsd spw srsa + srcd ss2 ssd ssf diff --git a/Plugins/Flac/Flac.xcodeproj/project.pbxproj b/Plugins/Flac/Flac.xcodeproj/project.pbxproj index 10d4fb495..b4f320d02 100644 --- a/Plugins/Flac/Flac.xcodeproj/project.pbxproj +++ b/Plugins/Flac/Flac.xcodeproj/project.pbxproj @@ -10,7 +10,7 @@ 17C93F080B8FF67A008627D6 /* FlacDecoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 17C93F040B8FF67A008627D6 /* FlacDecoder.m */; }; 8301C147287805F500651A6E /* NSDictionary+Merge.m in Sources */ = {isa = PBXBuildFile; fileRef = 8301C146287805F500651A6E /* NSDictionary+Merge.m */; }; 834D18FE2D7F949900F13B89 /* CogAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 834D18FD2D7F949900F13B89 /* CogAudio.framework */; }; - 836EF0DA27BB970B00BF35B2 /* libFLAC.12.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 836EF0D927BB970B00BF35B2 /* libFLAC.12.dylib */; }; + 836EF0DA27BB970B00BF35B2 /* libFLAC.14.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 836EF0D927BB970B00BF35B2 /* libFLAC.14.dylib */; }; 83AA660B27B7DAE40098D4B8 /* cuesheet.m in Sources */ = {isa = PBXBuildFile; fileRef = 83AA660A27B7DAE40098D4B8 /* cuesheet.m */; }; 8D5B49B4048680CD000E48DA /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7ADFEA557BF11CA2CBB /* Cocoa.framework */; }; /* End PBXBuildFile section */ @@ -40,7 +40,7 @@ 834A42B4287AF7AA00EB9D9B /* AudioChunk.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AudioChunk.h; path = ../../Audio/Chain/AudioChunk.h; sourceTree = ""; }; 834D18FD2D7F949900F13B89 /* CogAudio.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = CogAudio.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 8356BD1927B3CCBB0074E50C /* HTTPSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HTTPSource.h; path = ../HTTPSource/HTTPSource.h; sourceTree = ""; }; - 836EF0D927BB970B00BF35B2 /* libFLAC.12.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libFLAC.12.dylib; path = ../../ThirdParty/flac/lib/libFLAC.12.dylib; sourceTree = ""; }; + 836EF0D927BB970B00BF35B2 /* libFLAC.14.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libFLAC.14.dylib; path = ../../ThirdParty/flac/lib/libFLAC.14.dylib; sourceTree = ""; }; 83747C4A2862DCF40021245F /* Shared.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Shared.xcconfig; sourceTree = ""; }; 8384912D180816C900E7332D /* Logging.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Logging.h; path = ../../Utils/Logging.h; sourceTree = ""; }; 83AA660A27B7DAE40098D4B8 /* cuesheet.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = cuesheet.m; sourceTree = ""; }; @@ -56,7 +56,7 @@ buildActionMask = 2147483647; files = ( 834D18FE2D7F949900F13B89 /* CogAudio.framework in Frameworks */, - 836EF0DA27BB970B00BF35B2 /* libFLAC.12.dylib in Frameworks */, + 836EF0DA27BB970B00BF35B2 /* libFLAC.14.dylib in Frameworks */, 8D5B49B4048680CD000E48DA /* Cocoa.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -115,7 +115,7 @@ 1058C7ACFEA557BF11CA2CBB /* Linked Frameworks */ = { isa = PBXGroup; children = ( - 836EF0D927BB970B00BF35B2 /* libFLAC.12.dylib */, + 836EF0D927BB970B00BF35B2 /* libFLAC.14.dylib */, 1058C7ADFEA557BF11CA2CBB /* Cocoa.framework */, ); name = "Linked Frameworks"; diff --git a/Plugins/Flac/FlacDecoder.m b/Plugins/Flac/FlacDecoder.m index 23d770b3a..ec4a060d1 100644 --- a/Plugins/Flac/FlacDecoder.m +++ b/Plugins/Flac/FlacDecoder.m @@ -337,6 +337,8 @@ void ErrorCallback(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorS FLAC__StreamDecoderInitStatus ret; if(isOggFlac) { + FLAC__stream_decoder_set_decode_chained_stream(decoder, true); + ret = FLAC__stream_decoder_init_ogg_stream(decoder, ReadCallback, ([source seekable] ? SeekCallback : NULL), @@ -384,8 +386,13 @@ void ErrorCallback(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorS AudioChunk *chunk = nil; while (blockBufferFrames <= 0) { - if(FLAC__stream_decoder_get_state(decoder) == FLAC__STREAM_DECODER_END_OF_STREAM) { + FLAC__StreamDecoderState state = FLAC__stream_decoder_get_state(decoder); + if(state == FLAC__STREAM_DECODER_END_OF_STREAM) { return nil; + } else if(state == FLAC__STREAM_DECODER_END_OF_LINK) { + if(!FLAC__stream_decoder_finish_link(decoder)) { + return nil; + } } if(!FLAC__stream_decoder_process_single(decoder)) { diff --git a/Plugins/Opus/OpusPlugin.xcodeproj/project.pbxproj b/Plugins/Opus/OpusPlugin.xcodeproj/project.pbxproj index 59e73f508..4471179ed 100644 --- a/Plugins/Opus/OpusPlugin.xcodeproj/project.pbxproj +++ b/Plugins/Opus/OpusPlugin.xcodeproj/project.pbxproj @@ -7,7 +7,7 @@ objects = { /* Begin PBXBuildFile section */ - 8301C14928780C1A00651A6E /* libFLAC.12.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 8301C14828780C1A00651A6E /* libFLAC.12.dylib */; }; + 8301C14928780C1A00651A6E /* libFLAC.14.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 8301C14828780C1A00651A6E /* libFLAC.14.dylib */; }; 83186316285CEC91001422CC /* NSDictionary+Merge.m in Sources */ = {isa = PBXBuildFile; fileRef = 83186315285CEC91001422CC /* NSDictionary+Merge.m */; }; 834D19102D7F956400F13B89 /* CogAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 834D190F2D7F956400F13B89 /* CogAudio.framework */; }; 836EF0CF27BB952F00BF35B2 /* libopusfile.0.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 836EF0CE27BB952F00BF35B2 /* libopusfile.0.dylib */; }; @@ -29,7 +29,7 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ - 8301C14828780C1A00651A6E /* libFLAC.12.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libFLAC.12.dylib; path = ../../ThirdParty/flac/lib/libFLAC.12.dylib; sourceTree = ""; }; + 8301C14828780C1A00651A6E /* libFLAC.14.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libFLAC.14.dylib; path = ../../ThirdParty/flac/lib/libFLAC.14.dylib; sourceTree = ""; }; 83186314285CEC91001422CC /* NSDictionary+Merge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "NSDictionary+Merge.h"; path = "../../../Utils/NSDictionary+Merge.h"; sourceTree = ""; }; 83186315285CEC91001422CC /* NSDictionary+Merge.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "NSDictionary+Merge.m"; path = "../../../Utils/NSDictionary+Merge.m"; sourceTree = ""; }; 833F68411CDBCABC00AFB9F0 /* es */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = es; path = es.lproj/InfoPlist.strings; sourceTree = ""; }; @@ -61,7 +61,7 @@ files = ( 834D19102D7F956400F13B89 /* CogAudio.framework in Frameworks */, 8375B04017FFEA400092A79F /* Cocoa.framework in Frameworks */, - 8301C14928780C1A00651A6E /* libFLAC.12.dylib in Frameworks */, + 8301C14928780C1A00651A6E /* libFLAC.14.dylib in Frameworks */, 836EF0CF27BB952F00BF35B2 /* libopusfile.0.dylib in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -100,7 +100,7 @@ isa = PBXGroup; children = ( 834D190F2D7F956400F13B89 /* CogAudio.framework */, - 8301C14828780C1A00651A6E /* libFLAC.12.dylib */, + 8301C14828780C1A00651A6E /* libFLAC.14.dylib */, 836EF0CE27BB952F00BF35B2 /* libopusfile.0.dylib */, 8375B03F17FFEA400092A79F /* Cocoa.framework */, 8375B04117FFEA400092A79F /* Other Frameworks */, diff --git a/Plugins/Vorbis/VorbisPlugin.xcodeproj/project.pbxproj b/Plugins/Vorbis/VorbisPlugin.xcodeproj/project.pbxproj index 53ad3c928..62d53a864 100644 --- a/Plugins/Vorbis/VorbisPlugin.xcodeproj/project.pbxproj +++ b/Plugins/Vorbis/VorbisPlugin.xcodeproj/project.pbxproj @@ -8,7 +8,7 @@ /* Begin PBXBuildFile section */ 17C93D360B8FDA66008627D6 /* VorbisDecoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 17C93D340B8FDA66008627D6 /* VorbisDecoder.m */; }; - 8301C14B287810F300651A6E /* libFLAC.12.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 8301C14A287810F300651A6E /* libFLAC.12.dylib */; }; + 8301C14B287810F300651A6E /* libFLAC.14.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 8301C14A287810F300651A6E /* libFLAC.14.dylib */; }; 83186313285CEBD2001422CC /* NSDictionary+Merge.m in Sources */ = {isa = PBXBuildFile; fileRef = 83186312285CEBD2001422CC /* NSDictionary+Merge.m */; }; 834D19172D7F95A600F13B89 /* CogAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 834D19162D7F95A600F13B89 /* CogAudio.framework */; }; 836EF0D627BB969D00BF35B2 /* libvorbisfile.3.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 836EF0D427BB969D00BF35B2 /* libvorbisfile.3.dylib */; }; @@ -26,7 +26,7 @@ 17C93D330B8FDA66008627D6 /* VorbisDecoder.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = VorbisDecoder.h; sourceTree = ""; }; 17C93D340B8FDA66008627D6 /* VorbisDecoder.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = VorbisDecoder.m; sourceTree = ""; }; 32DBCF630370AF2F00C91783 /* VorbisPlugin_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VorbisPlugin_Prefix.pch; sourceTree = ""; }; - 8301C14A287810F300651A6E /* libFLAC.12.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libFLAC.12.dylib; path = ../../ThirdParty/flac/lib/libFLAC.12.dylib; sourceTree = ""; }; + 8301C14A287810F300651A6E /* libFLAC.14.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libFLAC.14.dylib; path = ../../ThirdParty/flac/lib/libFLAC.14.dylib; sourceTree = ""; }; 83186311285CEBD2001422CC /* NSDictionary+Merge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "NSDictionary+Merge.h"; path = "../../Utils/NSDictionary+Merge.h"; sourceTree = ""; }; 83186312285CEBD2001422CC /* NSDictionary+Merge.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "NSDictionary+Merge.m"; path = "../../Utils/NSDictionary+Merge.m"; sourceTree = ""; }; 834A42AB287AF0B000EB9D9B /* AudioChunk.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AudioChunk.h; path = ../../Audio/Chain/AudioChunk.h; sourceTree = ""; }; @@ -51,7 +51,7 @@ buildActionMask = 2147483647; files = ( 834D19172D7F95A600F13B89 /* CogAudio.framework in Frameworks */, - 8301C14B287810F300651A6E /* libFLAC.12.dylib in Frameworks */, + 8301C14B287810F300651A6E /* libFLAC.14.dylib in Frameworks */, 8D5B49B4048680CD000E48DA /* Cocoa.framework in Frameworks */, 836EF0DF27BB987000BF35B2 /* libvorbis.0.dylib in Frameworks */, 836EF0D627BB969D00BF35B2 /* libvorbisfile.3.dylib in Frameworks */, @@ -111,7 +111,7 @@ 1058C7ACFEA557BF11CA2CBB /* Linked Frameworks */ = { isa = PBXGroup; children = ( - 8301C14A287810F300651A6E /* libFLAC.12.dylib */, + 8301C14A287810F300651A6E /* libFLAC.14.dylib */, 836EF0DE27BB987000BF35B2 /* libvorbis.0.dylib */, 836EF0D427BB969D00BF35B2 /* libvorbisfile.3.dylib */, 1058C7ADFEA557BF11CA2CBB /* Cocoa.framework */, diff --git a/ThirdParty/flac/README.md b/ThirdParty/flac/README.md index bfb54c7d7..fda22518e 100644 --- a/ThirdParty/flac/README.md +++ b/ThirdParty/flac/README.md @@ -1,18 +1,21 @@ Build with CMake, using the following options: ``` -cmake -B build-x86 -DCMAKE_OSX_ARCHITECTURES="x86_64" -DCMAKE_OSX_DEPLOYMENT_TARGET="10.13" -DBUILD_SHARED_LIBS=ON -cmake -B build-arm -DCMAKE_OSX_ARCHITECTURES="arm64" -DCMAKE_OSX_DEPLOYMENT_TARGET="11.0" -DBUILD_SHARED_LIBS=ON +cmake -B build-x86 -DCMAKE_LIBRARY_PATH=/usr/local/lib -DCMAKE_OSX_ARCHITECTURES="x86_64" \ + -DCMAKE_OSX_DEPLOYMENT_TARGET="10.13" -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_SHARED_LIBS=ON +cmake -B build-arm -DCMAKE_OSX_ARCHITECTURES="arm64" -DCMAKE_OSX_DEPLOYMENT_TARGET="11.0" \ + -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_SHARED_LIBS=ON ``` +For the debug overlay, BUILD_TYPE was replaced with `Debug`. -And some minor tweaks with `install_name_tool -id` to make sure that the -resulting libFLAC.12.dylib referred to itself with @rpath and not full -paths of the build directory, and imported libogg.0.dylib with an @rpath. +And some minor tweaks with `install_name_tool -change` to fix up the +resulting libFLAC.14.dylib so that it imports libogg.0.dylib using an +@rpath path instead of an absolute path to Homebrew's install. -Version 1.4.3 was used from the official source code download: +Version 1.5.0 was used from the official source code download: -https://downloads.xiph.org/releases/flac/flac-1.4.3.tar.xz +https://downloads.xiph.org/releases/flac/flac-1.5.0.tar.xz x86_64 and arm64 were built separately, to allow for intrinsic functions to be used for x86_64. diff --git a/ThirdParty/flac/include/FLAC/FLAC_assert.h b/ThirdParty/flac/include/FLAC/FLAC_assert.h index ee3ee080b..7b98526d7 100644 --- a/ThirdParty/flac/include/FLAC/FLAC_assert.h +++ b/ThirdParty/flac/include/FLAC/FLAC_assert.h @@ -1,6 +1,6 @@ /* libFLAC - Free Lossless Audio Codec library * Copyright (C) 2001-2009 Josh Coalson - * Copyright (C) 2011-2023 Xiph.Org Foundation + * Copyright (C) 2011-2025 Xiph.Org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/ThirdParty/flac/include/FLAC/all.h b/ThirdParty/flac/include/FLAC/all.h index 101f9fc95..551ca55ff 100644 --- a/ThirdParty/flac/include/FLAC/all.h +++ b/ThirdParty/flac/include/FLAC/all.h @@ -1,6 +1,6 @@ /* libFLAC - Free Lossless Audio Codec library * Copyright (C) 2000-2009 Josh Coalson - * Copyright (C) 2011-2023 Xiph.Org Foundation + * Copyright (C) 2011-2025 Xiph.Org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -436,6 +436,56 @@ * */ +/** \defgroup porting_1_4_3_to_1_5_0 Porting from FLAC 1.4.3 to 1.5.0 + * \ingroup porting + * + * \brief + * This module describes porting from FLAC 1.4.3 to FLAC 1.5.0. + * + * \section porting_1_4_3_to_1_5_0_summary Summary + * + * Between FLAC 1.4.3 and FLAC 1.5.0, there have been changes to + * existing C functions and enums: + * - the functions FLAC__metadata_get_streaminfo, + * FLAC__metadata_get_tags and FLAC__metadata_get_cuesheet can now + * read from Ogg FLAC files + * - when encoding Ogg FLAC files, the 'samples' argument of the + * write callback no longer always returns 0. + * - two error statuses have been added to the + * FLAC__StreamDecoderErrorStatus enum + * - one status is added to FLAC__StreamDecoderState, which is only + * used when the new decoding of chained streams functionality is + * enabled + * - one status is added to FLAC__StreamDecoderReadStatus, which is + * only used when the new decoding of chained streams functionality + * is enabled + * - the function + * FLAC__metadata_chain_write_with_callbacks_and_tempfile can now + * be used regardless of whether a tempfile is actually needed, + * which is useful when writing to a new file is desired anyway + * + * Furthermore, there have been the following additions: + * - the functions FLAC__stream_decoder_set_decode_chained_stream, + * FLAC__stream_decoder_get_decode_chained_stream, + * FLAC__stream_decoder_finish_link, + * FLAC__stream_decoder_skip_single_link, + * FLAC__stream_decoder_process_until_end_of_link and + * FLAC__stream_decoder_get_link_lengths have been added + * to support decoding of chained streams + * - the function FLAC__metadata_chain_write_new_file has been added, + * which is useful to combine copying of a file with changing its + * metadata + * - the function FLAC__stream_decoder_find_total_samples was added, + * which seeks to the end of a file to find the total number of + * samples + * - the function FLAC__stream_encoder_set_num_threads and + * FLAC__stream_encoder_get_num_threads have been added, which + * can be used to enable multithreading in the encoder + * + * For the C++ API, changes are the same, but in C++ nomenclature + * + */ + /** \defgroup flac FLAC C API * * The FLAC C API is the interface to libFLAC, a set of structures diff --git a/ThirdParty/flac/include/FLAC/callback.h b/ThirdParty/flac/include/FLAC/callback.h index 4babcd324..a3b65cae3 100644 --- a/ThirdParty/flac/include/FLAC/callback.h +++ b/ThirdParty/flac/include/FLAC/callback.h @@ -1,6 +1,6 @@ /* libFLAC - Free Lossless Audio Codec library * Copyright (C) 2004-2009 Josh Coalson - * Copyright (C) 2011-2023 Xiph.Org Foundation + * Copyright (C) 2011-2025 Xiph.Org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/ThirdParty/flac/include/FLAC/export.h b/ThirdParty/flac/include/FLAC/export.h index d14728a50..b52033929 100644 --- a/ThirdParty/flac/include/FLAC/export.h +++ b/ThirdParty/flac/include/FLAC/export.h @@ -1,6 +1,6 @@ /* libFLAC - Free Lossless Audio Codec library * Copyright (C) 2000-2009 Josh Coalson - * Copyright (C) 2011-2023 Xiph.Org Foundation + * Copyright (C) 2011-2025 Xiph.Org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -95,9 +95,9 @@ /** These \#defines will mirror the libtool-based library version number, see * http://www.gnu.org/software/libtool/manual/libtool.html#Libtool-versioning */ -#define FLAC_API_VERSION_CURRENT 13 +#define FLAC_API_VERSION_CURRENT 14 #define FLAC_API_VERSION_REVISION 0 /**< see above */ -#define FLAC_API_VERSION_AGE 1 /**< see above */ +#define FLAC_API_VERSION_AGE 0 /**< see above */ #ifdef __cplusplus extern "C" { diff --git a/ThirdParty/flac/include/FLAC/format.h b/ThirdParty/flac/include/FLAC/format.h index ef7c8b219..48876d673 100644 --- a/ThirdParty/flac/include/FLAC/format.h +++ b/ThirdParty/flac/include/FLAC/format.h @@ -1,6 +1,6 @@ /* libFLAC - Free Lossless Audio Codec library * Copyright (C) 2000-2009 Josh Coalson - * Copyright (C) 2011-2023 Xiph.Org Foundation + * Copyright (C) 2011-2025 Xiph.Org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/ThirdParty/flac/include/FLAC/metadata.h b/ThirdParty/flac/include/FLAC/metadata.h index 4747a5f3f..3783bc9da 100644 --- a/ThirdParty/flac/include/FLAC/metadata.h +++ b/ThirdParty/flac/include/FLAC/metadata.h @@ -1,6 +1,6 @@ /* libFLAC - Free Lossless Audio Codec library * Copyright (C) 2001-2009 Josh Coalson - * Copyright (C) 2011-2023 Xiph.Org Foundation + * Copyright (C) 2011-2025 Xiph.Org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -62,9 +62,9 @@ * This module provides functions for creating and manipulating FLAC * metadata blocks in memory, and three progressively more powerful * interfaces for traversing and editing metadata in native FLAC files. - * Note that currently only the Chain interface (level 2) supports Ogg - * FLAC files, and it is read-only i.e. no writing back changed - * metadata to file. + * Note that currently only the Chain interface (level 2) and some + * functions in level 0 supports Ogg FLAC files, and they are + * read-only i.e. no writing back changed metadata to file. * * There are three metadata interfaces of increasing complexity: * @@ -144,10 +144,11 @@ extern "C" { * \{ */ -/** Read the STREAMINFO metadata block of the given FLAC file. This function - * will try to skip any ID3v2 tag at the head of the file. +/** Read the STREAMINFO metadata block of the given FLAC or Ogg FLAC + * file. This function will try to skip any ID3v2 tag at the head + * of the file. * - * \param filename The path to the FLAC file to read. + * \param filename The path to the FLAC or Ogg FLAC file to read. * \param streaminfo A pointer to space for the STREAMINFO block. Since * FLAC__StreamMetadata is a simple structure with no * memory allocation involved, you pass the address of @@ -163,10 +164,11 @@ extern "C" { */ FLAC_API FLAC__bool FLAC__metadata_get_streaminfo(const char *filename, FLAC__StreamMetadata *streaminfo); -/** Read the VORBIS_COMMENT metadata block of the given FLAC file. This - * function will try to skip any ID3v2 tag at the head of the file. +/** Read the VORBIS_COMMENT metadata block of the given FLAC or Ogg FLAC + * file. This function will try to skip any ID3v2 tag at the head + * of the file. * - * \param filename The path to the FLAC file to read. + * \param filename The path to the FLAC or Ogg FLAC file to read. * \param tags The address where the returned pointer will be * stored. The \a tags object must be deleted by * the caller using FLAC__metadata_object_delete(). @@ -182,10 +184,11 @@ FLAC_API FLAC__bool FLAC__metadata_get_streaminfo(const char *filename, FLAC__St */ FLAC_API FLAC__bool FLAC__metadata_get_tags(const char *filename, FLAC__StreamMetadata **tags); -/** Read the CUESHEET metadata block of the given FLAC file. This - * function will try to skip any ID3v2 tag at the head of the file. +/** Read the CUESHEET metadata block of the given FLAC or Ogg FLAC + * file. This function will try to skip any ID3v2 tag at the head + * of the file. * - * \param filename The path to the FLAC file to read. + * \param filename The path to the FLAC or Ogg FLAC file to read. * \param cuesheet The address where the returned pointer will be * stored. The \a cuesheet object must be deleted by * the caller using FLAC__metadata_object_delete(). @@ -207,7 +210,8 @@ FLAC_API FLAC__bool FLAC__metadata_get_cuesheet(const char *filename, FLAC__Stre * function takes a number of parameters that act as constraints to * the search. The PICTURE block with the largest area matching all * the constraints will be returned, or \a *picture will be set to - * \c NULL if there was no such block. + * \c NULL if there was no such block. This function does not + * currently support reading from Ogg FLAC files. * * \param filename The path to the FLAC file to read. * \param picture The address where the returned pointer will be @@ -784,9 +788,6 @@ typedef enum { /**< FLAC__metadata_chain_write_with_callbacks() was called when the * chain write requires a tempfile; use * FLAC__metadata_chain_write_with_callbacks_and_tempfile() instead. - * Or, FLAC__metadata_chain_write_with_callbacks_and_tempfile() was - * called when the chain write does not require a tempfile; use - * FLAC__metadata_chain_write_with_callbacks() instead. * Always check FLAC__metadata_chain_check_if_tempfile_needed() * before writing via callbacks. */ @@ -923,11 +924,11 @@ FLAC_API FLAC__bool FLAC__metadata_chain_read_ogg_with_callbacks(FLAC__Metadata_ * edited metadata back to the FLAC file does not require rewriting the * entire file. If rewriting is required, then a temporary workfile is * required. When writing metadata using callbacks, you must check - * this function to know whether to call - * FLAC__metadata_chain_write_with_callbacks() or - * FLAC__metadata_chain_write_with_callbacks_and_tempfile(). When - * writing with FLAC__metadata_chain_write(), the temporary file is - * handled internally. + * this function to know whether + * FLAC__metadata_chain_write_with_callbacks() can be used or + * FLAC__metadata_chain_write_with_callbacks_and_tempfile() is + * necessary. When writing with FLAC__metadata_chain_write(), the + * temporary file is handled internally. * * \param chain A pointer to an existing chain. * \param use_padding @@ -990,6 +991,28 @@ FLAC_API FLAC__bool FLAC__metadata_chain_check_if_tempfile_needed(FLAC__Metadata */ FLAC_API FLAC__bool FLAC__metadata_chain_write(FLAC__Metadata_Chain *chain, FLAC__bool use_padding, FLAC__bool preserve_file_stats); +/** Write all metadata out to a new FLAC file. + * + * This function works similar to FLAC__metadata_chain_write(), but is + * useful if writing to a new file is desired. This is more efficient + * than copying the file before changing it. + * + * For this write function to be used, the chain must have been read with + * FLAC__metadata_chain_read()/FLAC__metadata_chain_read_ogg(), not + * FLAC__metadata_chain_read_with_callbacks()/FLAC__metadata_chain_read_ogg_with_callbacks(). + * See also FLAC__metadata_chain_write_with_callbacks_and_tempfile() + * + * \param chain A pointer to an existing chain. + * \param use_padding See FLAC__metadata_chain_write() + * \param filename The filename of the new file. + * \assert + * \code chain != NULL \endcode + * \retval FLAC__bool + * \c true if the write succeeded, else \c false. On failure, + * check the status with FLAC__metadata_chain_status(). + */ +FLAC_API FLAC__bool FLAC__metadata_chain_write_new_file(FLAC__Metadata_Chain *chain, const char *filename, FLAC__bool use_padding); + /** Write all metadata out to a FLAC stream via callbacks. * * (See FLAC__metadata_chain_write() for the details on how padding is @@ -1031,7 +1054,8 @@ FLAC_API FLAC__bool FLAC__metadata_chain_write_with_callbacks(FLAC__Metadata_Cha * FLAC file to edit, and a temporary handle to which the new FLAC * file will be written. It is the caller's job to move this temporary * FLAC file on top of the original FLAC file to complete the metadata - * edit. + * edit. This version of the write-with-callbacks function can also be + * used if writing to a new file is desired anyway. * * The \a handle must be open for reading and be seekable. The * equivalent minimum stdio fopen() file mode is \c "r" (or \c "rb" @@ -1046,8 +1070,6 @@ FLAC_API FLAC__bool FLAC__metadata_chain_write_with_callbacks(FLAC__Metadata_Cha * For this write function to be used, the chain must have been read with * FLAC__metadata_chain_read_with_callbacks()/FLAC__metadata_chain_read_ogg_with_callbacks(), * not FLAC__metadata_chain_read()/FLAC__metadata_chain_read_ogg(). - * Also, FLAC__metadata_chain_check_if_tempfile_needed() must have returned - * \c true. * * \param chain A pointer to an existing chain. * \param use_padding See FLAC__metadata_chain_write() diff --git a/ThirdParty/flac/include/FLAC/ordinals.h b/ThirdParty/flac/include/FLAC/ordinals.h index d61aac578..1a4131583 100644 --- a/ThirdParty/flac/include/FLAC/ordinals.h +++ b/ThirdParty/flac/include/FLAC/ordinals.h @@ -1,6 +1,6 @@ /* libFLAC - Free Lossless Audio Codec library * Copyright (C) 2000-2009 Josh Coalson - * Copyright (C) 2011-2023 Xiph.Org Foundation + * Copyright (C) 2011-2025 Xiph.Org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/ThirdParty/flac/include/FLAC/stream_decoder.h b/ThirdParty/flac/include/FLAC/stream_decoder.h index 2272bcac9..a0e779456 100644 --- a/ThirdParty/flac/include/FLAC/stream_decoder.h +++ b/ThirdParty/flac/include/FLAC/stream_decoder.h @@ -1,6 +1,6 @@ /* libFLAC - Free Lossless Audio Codec library * Copyright (C) 2000-2009 Josh Coalson - * Copyright (C) 2011-2023 Xiph.Org Foundation + * Copyright (C) 2011-2025 Xiph.Org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -235,12 +235,20 @@ typedef enum { * state and can no longer be used. */ - FLAC__STREAM_DECODER_UNINITIALIZED + FLAC__STREAM_DECODER_UNINITIALIZED, /**< The decoder is in the uninitialized state; one of the * FLAC__stream_decoder_init_*() functions must be called before samples * can be processed. */ + FLAC__STREAM_DECODER_END_OF_LINK + /**< The decoder has reached the end of an Ogg FLAC chain link and a new + * link follows; FLAC__stream_decoder_finish_link() has to be called to + * progress. This state is only returned when decoding of chained + * streams is enabled with + * FLAC__stream_decoder_set_decode_chained_stream() + */ + } FLAC__StreamDecoderState; /** Maps a FLAC__StreamDecoderState to a C string. @@ -307,9 +315,14 @@ typedef enum { * of \c 0. */ - FLAC__STREAM_DECODER_READ_STATUS_ABORT + FLAC__STREAM_DECODER_READ_STATUS_ABORT, /**< An unrecoverable error occurred. The decoder will return from the process call. */ + FLAC__STREAM_DECODER_READ_STATUS_END_OF_LINK + /**< The read was attempted while at the end of the link. The semantics + * are the same as for FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM. + */ + } FLAC__StreamDecoderReadStatus; /** Maps a FLAC__StreamDecoderReadStatus to a C string. @@ -442,9 +455,21 @@ typedef enum { FLAC__STREAM_DECODER_ERROR_STATUS_UNPARSEABLE_STREAM, /**< The decoder encountered reserved fields in use in the stream. */ - FLAC__STREAM_DECODER_ERROR_STATUS_BAD_METADATA + FLAC__STREAM_DECODER_ERROR_STATUS_BAD_METADATA, /**< The decoder encountered a corrupted metadata block. */ + FLAC__STREAM_DECODER_ERROR_STATUS_OUT_OF_BOUNDS, + /**< The decoder encountered a otherwise valid frame in which + * the decoded samples exceeded the range offered by the stated + * bit depth. */ + + FLAC__STREAM_DECODER_ERROR_STATUS_MISSING_FRAME + /**< Two adjacent frames had frame numbers increasing by more than + * 1 or sample numbers increasing by more than the blocksize, + * indicating that one or more frame/frames was missing between + * them. The decoder will sent out one or more ´fake' constant + * subframes to fill up the gap. */ + } FLAC__StreamDecoderErrorStatus; /** Maps a FLAC__StreamDecoderErrorStatus to a C string. @@ -782,6 +807,33 @@ FLAC_API void FLAC__stream_decoder_delete(FLAC__StreamDecoder *decoder); */ FLAC_API FLAC__bool FLAC__stream_decoder_set_ogg_serial_number(FLAC__StreamDecoder *decoder, long serial_number); +/** Set the "decode chained stream" flag. If set to \c false, the + * decoder will stop decoding when it encounters the end-of-stream + * of the first link in the chain. If set to \c true, decoding will + * continue: at the start of each link, FLAC__stream_decoder_get_state + * will return FLAC__STREAM_DECODER_SEARCH_FOR_METADATA. + * + * This function was made to decode chained Ogg streams, but it should + * be possible to chain regular FLAC files through the read callback + * by using FLAC__STREAM_DECODER_READ_STATUS_END_OF_LINK + * appropriately. + * + * Note that when this flag is set to true, the serial number set + * with FLAC__stream_decoder_set_ogg_serial_number is ignored. + * + * \note + * This function has no effect with native FLAC decoding. + * + * \default \c false + * \param decoder A decoder instance to set. + * \param allow Whether to allow chained streams. + * \assert + * \code decoder != NULL \endcode + * \retval FLAC__bool + * \c false if the decoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__stream_decoder_set_decode_chained_stream(FLAC__StreamDecoder* decoder, FLAC__bool value); + /** Set the "MD5 signature checking" flag. If \c true, the decoder will * compute the MD5 signature of the unencoded audio data while decoding * and compare it to the signature from the STREAMINFO block, if it @@ -814,7 +866,7 @@ FLAC_API FLAC__bool FLAC__stream_decoder_set_md5_checking(FLAC__StreamDecoder *d * \code decoder != NULL \endcode * \a type is valid * \retval FLAC__bool - * \c false if the decoder is already initialized, else \c true. + * \c false if type is invalid, else \c true. */ FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_respond(FLAC__StreamDecoder *decoder, FLAC__MetadataType type); @@ -829,7 +881,7 @@ FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_respond(FLAC__StreamDecode * \code decoder != NULL \endcode * \code id != NULL \endcode * \retval FLAC__bool - * \c false if the decoder is already initialized, else \c true. + * \c false when memory allocation fails, else \c true. */ FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_respond_application(FLAC__StreamDecoder *decoder, const FLAC__byte id[4]); @@ -841,7 +893,7 @@ FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_respond_application(FLAC__ * \assert * \code decoder != NULL \endcode * \retval FLAC__bool - * \c false if the decoder is already initialized, else \c true. + * \c always \c true. */ FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_respond_all(FLAC__StreamDecoder *decoder); @@ -855,7 +907,7 @@ FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_respond_all(FLAC__StreamDe * \code decoder != NULL \endcode * \a type is valid * \retval FLAC__bool - * \c false if the decoder is already initialized, else \c true. + * \c false if type is invalid, else \c true. */ FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_ignore(FLAC__StreamDecoder *decoder, FLAC__MetadataType type); @@ -870,7 +922,7 @@ FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_ignore(FLAC__StreamDecoder * \code decoder != NULL \endcode * \code id != NULL \endcode * \retval FLAC__bool - * \c false if the decoder is already initialized, else \c true. + * \c false if memory allocation fails, else \c true. */ FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_ignore_application(FLAC__StreamDecoder *decoder, const FLAC__byte id[4]); @@ -882,7 +934,7 @@ FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_ignore_application(FLAC__S * \assert * \code decoder != NULL \endcode * \retval FLAC__bool - * \c false if the decoder is already initialized, else \c true. + * \c always \c true. */ FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_ignore_all(FLAC__StreamDecoder *decoder); @@ -906,6 +958,17 @@ FLAC_API FLAC__StreamDecoderState FLAC__stream_decoder_get_state(const FLAC__Str */ FLAC_API const char *FLAC__stream_decoder_get_resolved_state_string(const FLAC__StreamDecoder *decoder); +/** Get the "decode chained stream" flag as described in + * \code FLAC__stream_decoder_set_decode_chained_stream \endcode. + * + * \param decoder A decoder instance to query. + * \assert + * \code decoder != NULL \endcode + * \retval FLAC__bool + * See above. + */ +FLAC_API FLAC__bool FLAC__stream_decoder_get_decode_chained_stream(const FLAC__StreamDecoder* decoder); + /** Get the "MD5 signature checking" flag. * This is the value of the setting, not whether or not the decoder is * currently checking the MD5 (remember, it can be turned off automatically @@ -932,6 +995,32 @@ FLAC_API FLAC__bool FLAC__stream_decoder_get_md5_checking(const FLAC__StreamDeco */ FLAC_API FLAC__uint64 FLAC__stream_decoder_get_total_samples(const FLAC__StreamDecoder *decoder); +/** Seek to the end of the file being decoded to find the total number + * of samples. This will return a number of samples even if + * FLAC__stream_decoder_get_total_samples() returns 0. It can also + * be used to find the total number of samples of a chained stream, + * as it returns the total number of samples in all chain links + * combined. See FLAC__stream_decoder_set_decode_chained_stream() + * + * For this function to work, the stream must be seekable. Also, as + * seeking can fail, this function returns 0 when it was unable to + * find the total number of samples. Use + * FLAC__stream_decoder_get_state() in that case to find out whether + * the decoder is still valid. + * + * The state in which the decoder is left after calling this function + * is undefined and might change in the future. Use + * FLAC__stream_decoder_reset() to return the decoder to a defined + * state. + * + * \param decoder A decoder instance to query. + * \assert + * \code decoder != NULL \endcode + * \retval uint32_t + * See above. + */ +FLAC_API FLAC__uint64 FLAC__stream_decoder_find_total_samples(FLAC__StreamDecoder *decoder); + /** Get the current number of channels in the stream being decoded. * Will only be valid after decoding has started and will contain the * value from the most recently decoded frame header. @@ -1023,6 +1112,43 @@ FLAC_API FLAC__bool FLAC__stream_decoder_get_decode_position(const FLAC__StreamD */ FLAC_API const void *FLAC__stream_decoder_get_client_data(FLAC__StreamDecoder *decoder); +#define FLAC__STREAM_DECODER_GET_LINK_LENGTHS_INVALID -1 +#define FLAC__STREAM_DECODER_GET_LINK_LENGTHS_NOT_INDEXED -2 +#define FLAC__STREAM_DECODER_GET_LINK_LENGTHS_MEMORY_ALLOCATION_ERROR -3 + +/** Get the link lengths in samples in a chained stream + * + * After either processing the whole file or using + * FLAC__stream_decoder_find_total_samples, this function + * returns an array with link lengths in samples. If it fails, + * it returns a negative number as error code, currently either + * FLAC__STREAM_DECODER_GET_LINK_LENGTHS_INVALID if the current + * decoder is not in a valid state or not processing a chained + * stream, FLAC__STREAM_DECODER_GET_LINK_LENGTHS_NOT_INDEXED if + * the stream hasn't been indexed yet, and + * FLAC__STREAM_DECODER_GET_LINK_LENGTHS_MEMORY_ALLOCATION_ERROR + * if allocating memory failed. + * + * If the function succeeds, the return value is the number of + * links. The link_lengths parameter is a FLAC__uint64 pointer + * which is allocated by the call, and must be freed by the user. + * If a null pointer is passed, the function only returns the + * number of links, not their lengths. The length of the returned + * array is equal to the number of links and thus to the return + * value of the function. + * + * \param decoder A decoder instance to query. + * \param link_lengths Address at which to return the link lengths + * array. + * \assert + * \code decoder != NULL \endcode + * \retval int32_t + * \c the number of links if successful, zero or a negative + * number if unsuccessful + */ + +FLAC_API int32_t FLAC__stream_decoder_get_link_lengths(FLAC__StreamDecoder *decoder, FLAC__uint64 **link_lengths); + /** Initialize the decoder instance to decode native FLAC streams. * * This flavor of initialization sets up the decoder to decode from a @@ -1394,6 +1520,23 @@ FLAC_API FLAC__StreamDecoderInitStatus FLAC__stream_decoder_init_ogg_file( */ FLAC_API FLAC__bool FLAC__stream_decoder_finish(FLAC__StreamDecoder *decoder); +/** Finish the decoding process of the current link. + * Checks MD5 for current link and start processing of the next link. This + * function should only be used when the decoder state is + * FLAC__STREAM_DECODER_END_OF_LINK. After calling this function, the state + * is set to FLAC__STREAM_DECODER_SEARCH_FOR_METADATA. + * + * \param decoder An uninitialized decoder instance. + * \assert + * \code decoder != NULL \endcode + * \retval FLAC__bool + * \c false if MD5 checking is on AND a STREAMINFO block was available + * AND the MD5 signature in the STREAMINFO block was non-zero AND the + * signature does not match the one computed by the decoder; else + * \c true. + */ +FLAC_API FLAC__bool FLAC__stream_decoder_finish_link(FLAC__StreamDecoder *decoder); + /** Flush the stream input. * The decoder's input buffer will be cleared and the state set to * \c FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC. This will also turn @@ -1495,6 +1638,31 @@ FLAC_API FLAC__bool FLAC__stream_decoder_process_single(FLAC__StreamDecoder *dec */ FLAC_API FLAC__bool FLAC__stream_decoder_process_until_end_of_metadata(FLAC__StreamDecoder *decoder); +/** Decode until the end of the Ogg chain link. + * This version instructs the decoder to decode from the current + * position and continue until the end of link or until the + * callbacks return a fatal error. This function should not be + * used without enabling decoding of chained streams with + * FLAC__stream_decoder_set_decode_chained_stream() + * + * To start processing the next link after calling this function, + * call FLAC__stream_decoder_finish_link() + * + * As the decoder needs more input it will call the read callback. + * As each metadata block and frame is decoded, the metadata or write + * callback will be called with the decoded metadata or frame. + * + * \param decoder An initialized decoder instance. + * \assert + * \code decoder != NULL \endcode + * \retval FLAC__bool + * \c false if any fatal read, write, or memory allocation error + * occurred (meaning decoding must stop), else \c true; for more + * information about the decoder, check the decoder state with + * FLAC__stream_decoder_get_state(). + */ +FLAC_API FLAC__bool FLAC__stream_decoder_process_until_end_of_link(FLAC__StreamDecoder *decoder); + /** Decode until the end of the stream. * This version instructs the decoder to decode from the current position * and continue until the end of stream (the read callback returns @@ -1557,6 +1725,34 @@ FLAC_API FLAC__bool FLAC__stream_decoder_process_until_end_of_stream(FLAC__Strea */ FLAC_API FLAC__bool FLAC__stream_decoder_skip_single_frame(FLAC__StreamDecoder *decoder); +/** Skip one Ogg chain link. + * This version instructs the decoder to 'skip' the current ogg chain + * link. This function should not be used without enabling decoding + * of chained streams with + * FLAC__stream_decoder_set_decode_chained_stream() + * + * When the location ot the next link is already known (for example, + * because there has already been a seek in the stream) this function + * will seek to the end of the link and start processing, but when it + * is not, it will do various seeks (when possible) to find the end + * of the link. If seeking is not possible (or the tell and length + * callback do not work) it will simply read forward instead of + * seeking, much like a muted (but faster) version of + * FLAC__stream_decoder_process_until_end_of_link(). + * + * \param decoder An initialized decoder instance not in a metadata + * state. + * \assert + * \code decoder != NULL \endcode + * \retval FLAC__bool + * \c false if any fatal read, write, or memory allocation error + * occurred (meaning decoding must stop), or when decoding a format + * that does not support chaining, else \c true; for more + * information about the decoder, check the decoder state with + * FLAC__stream_decoder_get_state(). + */ +FLAC_API FLAC__bool FLAC__stream_decoder_skip_single_link(FLAC__StreamDecoder *decoder); + /** Flush the input and seek to an absolute sample. * Decoding will resume at the given sample. Note that because of * this, the next write callback may contain a partial block. The @@ -1566,6 +1762,14 @@ FLAC_API FLAC__bool FLAC__stream_decoder_skip_single_frame(FLAC__StreamDecoder * * with FLAC__stream_decoder_flush() or reset with * FLAC__stream_decoder_reset() before decoding can continue. * + * When seeking in a chained stream with decoding of such streams + * enabled with FLAC__stream_decoder_set_decode_chained_stream(), + * this function seeks in the whole stream, over all links. When + * a seek to another link is performed, the decoder will also + * return metadata blocks of that link. If this is not desired, + * use FLAC__stream_decoder_set_metadata_ignore_all() before + * seeking. + * * \param decoder A decoder instance. * \param sample The target sample number to seek to. * \assert diff --git a/ThirdParty/flac/include/FLAC/stream_encoder.h b/ThirdParty/flac/include/FLAC/stream_encoder.h index a0d026397..f9ced5a9b 100644 --- a/ThirdParty/flac/include/FLAC/stream_encoder.h +++ b/ThirdParty/flac/include/FLAC/stream_encoder.h @@ -1,6 +1,6 @@ /* libFLAC - Free Lossless Audio Codec library * Copyright (C) 2000-2009 Josh Coalson - * Copyright (C) 2011-2023 Xiph.Org Foundation + * Copyright (C) 2011-2025 Xiph.Org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -288,6 +288,11 @@ typedef enum { extern FLAC_API const char * const FLAC__StreamEncoderStateString[]; +#define FLAC__STREAM_ENCODER_SET_NUM_THREADS_OK 0 +#define FLAC__STREAM_ENCODER_SET_NUM_THREADS_NOT_COMPILED_WITH_MULTITHREADING_ENABLED 1 +#define FLAC__STREAM_ENCODER_SET_NUM_THREADS_ALREADY_INITIALIZED 2 +#define FLAC__STREAM_ENCODER_SET_NUM_THREADS_TOO_MANY_THREADS 3 + /** Possible return values for the FLAC__stream_encoder_init_*() functions. */ typedef enum { @@ -533,11 +538,17 @@ typedef FLAC__StreamEncoderReadStatus (*FLAC__StreamEncoderReadCallback)(const F * callback is being called to write metadata. * * \note - * Unlike when writing to native FLAC, when writing to Ogg FLAC the - * write callback will be called twice when writing each audio - * frame; once for the page header, and once for the page body. - * When writing the page header, the \a samples argument to the - * write callback will be \c 0. + * Unlike when writing to native FLAC, when writing to Ogg FLAC the write + * callback will be called at least twice when writing each audio frame; once + * for the page header and once for the page body, possibly repeating this + * pair of calls several times in a batch with the same value of + * \a current_frame. When writing the page header, as well as in all but the + * first page body write of the batch, the \a samples argument to the write + * callback will be \c 0. For the write callback call containing the first + * page body, the \a samples argument is the number of samples contained in + * all newly added complete packets (not pages). This means that in case a + * packet is split over two pages, they are counted in the samples argument + * of the page on which the packet is completed. * * \note In general, FLAC__StreamEncoder functions which change the * state should not be called on the \a encoder while in the callback. @@ -1102,6 +1113,52 @@ FLAC_API FLAC__bool FLAC__stream_encoder_set_min_residual_partition_order(FLAC__ */ FLAC_API FLAC__bool FLAC__stream_encoder_set_max_residual_partition_order(FLAC__StreamEncoder *encoder, uint32_t value); +/** Set the maximum number of threads to use during encoding. + * Set to a value different than 1 to enable multithreaded encoding. + * + * Note that enabling multithreading encoding (i.e., setting a value + * different than 1) results in the behaviour of + * FLAC__stream_encoder_finish(), FLAC__stream_encoder_process(), + * FLAC__stream_encoder_process_interleaved() subtly changing. + * For example, calling one of the process functions with enough + * samples to fill a block might not always result in a call to + * the write callback with a frame coding these samples. Instead, + * blocks with samples are distributed among worker threads, + * meaning that the first few calls to those functions will + * return very quickly, while later calls might block if all + * threads are occupied. Also, certain calls to the process + * functions will results in several calls to the write callback, + * while subsequent calls might again return very quickly with no + * calls to the write callback. + * + * Also, a call to FLAC__stream_encoder_finish() blocks while + * waiting for all threads to finish, and therefore might take much + * longer than when not multithreading and result in multiple calls + * to the write callback. + * + * Calls to the write callback are guaranteed to be in the correct + * order. + * + * Currently, passing a value of 0 is synonymous with a value of 1, + * but this might change in the future. + * + * \default \c 1 + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval uint32_t + * - \c FLAC__STREAM_ENCODER_SET_NUM_THREADS_OK if the number of threads was set correctly, + * - \c FLAC__STREAM_ENCODER_SET_NUM_THREADS_NOT_COMPILED_WITH_MULTITHREADING_ENABLED when + * multithreading was not enabled at compilation, + * - \c FLAC__STREAM_ENCODER_SET_NUM_THREADS_ALREADY_INITIALIZED when the encoder was + * already initialized, + * - \c FLAC__STREAM_ENCODER_SET_NUM_THREADS_TOO_MANY_THREADS when + * the number of threads was larger than the maximum allowed number of threads (currently + * 128). + */ +FLAC_API uint32_t FLAC__stream_encoder_set_num_threads(FLAC__StreamEncoder *encoder, uint32_t value); + /** Deprecated. Setting this value has no effect. * * \default \c 0 @@ -1435,6 +1492,16 @@ FLAC_API uint32_t FLAC__stream_encoder_get_min_residual_partition_order(const FL */ FLAC_API uint32_t FLAC__stream_encoder_get_max_residual_partition_order(const FLAC__StreamEncoder *encoder); +/** Get maximum number of threads setting. + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval uint32_t + * See FLAC__stream_encoder_set_num_threads(). + */ +FLAC_API uint32_t FLAC__stream_encoder_get_num_threads(const FLAC__StreamEncoder *encoder); + /** Get the Rice parameter search distance setting. * * \param encoder An encoder instance to query. diff --git a/ThirdParty/libraries-debug-overlay.tar.xz b/ThirdParty/libraries-debug-overlay.tar.xz index 2b39c3ed5..eb20177e2 100644 Binary files a/ThirdParty/libraries-debug-overlay.tar.xz and b/ThirdParty/libraries-debug-overlay.tar.xz differ diff --git a/ThirdParty/libraries.tar.xz b/ThirdParty/libraries.tar.xz index 688ff93f5..253662b4c 100644 Binary files a/ThirdParty/libraries.tar.xz and b/ThirdParty/libraries.tar.xz differ diff --git a/ThirdParty/libvgm/README.md b/ThirdParty/libvgm/README.md index 4f7a943b1..1f78aa4d5 100644 --- a/ThirdParty/libvgm/README.md +++ b/ThirdParty/libvgm/README.md @@ -2,12 +2,17 @@ This is verbatim from the following repository: https://github.com/ValleyBell/libvgm.git -Built on an M1 Mac mini, using CMake from Homebrew, with the following +Built on an M4 Mac mini, using CMake from Homebrew, with the following options: ``` cmake .. -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" -DCMAKE_OSX_DEPLOYMENT_TARGET="10.13" \ - -DBUILD_LIBAUDIO=NO -DBUILD_PLAYER=NO -DBUILD_VGM2WAV=NO + -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_LIBAUDIO=NO -DBUILD_PLAYER=NO -DBUILD_VGM2WAV=NO ``` -As of this edit, commit: 82ba45d3906a0b54b6de2555468dd9e9598f617d \ No newline at end of file +And the debug overlays were made with the above, except for: +``` +-DCMAKE_BUILD_TYPE=Debug +``` + +As of this edit, commit: 7cad78367fa35c3f7b3ae16a296d31063cd3a7e4 diff --git a/ThirdParty/libvgm/include/libvgm/emu/EmuCores.h b/ThirdParty/libvgm/include/libvgm/emu/EmuCores.h index f0dfc316b..5534cd854 100644 --- a/ThirdParty/libvgm/include/libvgm/emu/EmuCores.h +++ b/ThirdParty/libvgm/include/libvgm/emu/EmuCores.h @@ -17,5 +17,6 @@ #define FCC_CTR_ 0x43545200 // superctr #define FCC_LAOO 0x4C414F4F // laoo #define FCC_RN22 0x524E3232 // Mao757 (RN22) +#define FCC_EITO 0x4549544F // eito #endif // __EMUCORES_H__ diff --git a/ThirdParty/libvgm/include/libvgm/emu/SoundDevs.h b/ThirdParty/libvgm/include/libvgm/emu/SoundDevs.h index 7d7feca7a..6d28a48ed 100644 --- a/ThirdParty/libvgm/include/libvgm/emu/SoundDevs.h +++ b/ThirdParty/libvgm/include/libvgm/emu/SoundDevs.h @@ -44,6 +44,6 @@ #define DEVID_GA20 0x28 #define DEVID_MIKEY 0x29 #define DEVID_K007232 0x2A -#define DEVID_K005289 0x2B - +#define DEVID_K005289 0x2B +#define DEVID_MSM5205 0x2C // variants: MSM5205, MSM6585 #endif // __SOUNDDEVS_H__ diff --git a/ThirdParty/libvgm/include/libvgm/player/vgmplayer.hpp b/ThirdParty/libvgm/include/libvgm/player/vgmplayer.hpp index 6e0ed0a79..97a511075 100644 --- a/ThirdParty/libvgm/include/libvgm/player/vgmplayer.hpp +++ b/ThirdParty/libvgm/include/libvgm/player/vgmplayer.hpp @@ -248,6 +248,7 @@ protected: void Cmd_GGStereo(void); // command 4F - set GameGear Stereo mask void Cmd_SN76489(void); // command 50 - SN76489 register write void Cmd_Reg8_Data8(void); // command 51/54/55/5A..5D - Register, Data (8-bit) + void Cmd_MSM5205_Reg(void); // command 32 - MSM5205 register write (4-bit offset, 4-bit data) void Cmd_CPort_Reg8_Data8(void); // command 52/53/56..59/5E/5F - Port (in command byte), Register, Data (8-bit) void Cmd_Port_Reg8_Data8(void); // command D0..D2 - Port, Register, Data (8-bit) void Cmd_Ofs8_Data8(void); // command B3/B5..BB/BE/BF - Offset (8-bit), Data (8-bit) @@ -281,8 +282,8 @@ protected: enum { _HDR_BUF_SIZE = 0x100, - _OPT_DEV_COUNT = 0x2c, - _CHIP_COUNT = 0x2c, + _OPT_DEV_COUNT = 0x2d, + _CHIP_COUNT = 0x2d, _PCM_BANK_COUNT = 0x40 }; diff --git a/ThirdParty/ogg/README.md b/ThirdParty/ogg/README.md index 0faf9042a..40eee98c1 100644 --- a/ThirdParty/ogg/README.md +++ b/ThirdParty/ogg/README.md @@ -1,10 +1,10 @@ Build with CMake, using the following options: ``` -cmake .. -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" -DCMAKE_OSX_DEPLOYMENT_TARGET="10.12" -DBUILD_SHARED_LIBS=ON +cmake .. -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" -DCMAKE_OSX_DEPLOYMENT_TARGET="10.12" \ + -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_SHARED_LIBS=ON ``` -And some minor tweaks with `install_name_tool -id` to make sure that the -resulting libogg.0.dylib referred to itself with @rpath. +And for the debug overlay, replacing the BUILD_TYPE with `Debug`. -Version 1.3.5 was used. +Version 1.3.6 was used. diff --git a/ThirdParty/opus/README.md b/ThirdParty/opus/README.md index 5dce01253..0c9143f11 100644 --- a/ThirdParty/opus/README.md +++ b/ThirdParty/opus/README.md @@ -1,13 +1,12 @@ Build with CMake, using the following options: ``` -cmake .. -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" -DCMAKE_OSX_DEPLOYMENT_TARGET="10.12" -DBUILD_SHARED_LIBS=ON +cmake .. -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" -DCMAKE_OSX_DEPLOYMENT_TARGET="10.13" \ + -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_SHARED_LIBS=ON ``` -And some minor tweaks with `install_name_tool -id` to make sure that the -resulting libopus.0.dylib referred to itself with @rpath and not full -paths of the build directory. +The debug overlay was built the same, except with BUILD_TYPE set to `Debug`. -Version v1.3.1-101-g66d060c7 was used from the following repository: +Version v1.5.2-153-g7aa5be98 was used from the following repository: https://github.com/xiph/opus.git diff --git a/ThirdParty/opus/include/opus.h b/ThirdParty/opus/include/opus.h index d282f21d2..edf455289 100644 --- a/ThirdParty/opus/include/opus.h +++ b/ThirdParty/opus/include/opus.h @@ -103,7 +103,7 @@ extern "C" { * @endcode * * where opus_encoder_get_size() returns the required size for the encoder state. Note that - * future versions of this code may change the size, so no assuptions should be made about it. + * future versions of this code may change the size, so no assumptions should be made about it. * * The encoder state is always continuous in memory and only a shallow copy is sufficient * to copy it (e.g. memcpy()) @@ -198,7 +198,7 @@ OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_encoder_get_size(int channels); * This must be one of 8000, 12000, 16000, * 24000, or 48000. * @param [in] channels int: Number of channels (1 or 2) in input signal - * @param [in] application int: Coding mode (@ref OPUS_APPLICATION_VOIP/@ref OPUS_APPLICATION_AUDIO/@ref OPUS_APPLICATION_RESTRICTED_LOWDELAY) + * @param [in] application int: Coding mode (one of @ref OPUS_APPLICATION_VOIP, @ref OPUS_APPLICATION_AUDIO, or @ref OPUS_APPLICATION_RESTRICTED_LOWDELAY) * @param [out] error int*: @ref opus_errorcodes * @note Regardless of the sampling rate and number channels selected, the Opus encoder * can switch to a lower audio bandwidth or number of channels if the bitrate @@ -222,7 +222,7 @@ OPUS_EXPORT OPUS_WARN_UNUSED_RESULT OpusEncoder *opus_encoder_create( * This must be one of 8000, 12000, 16000, * 24000, or 48000. * @param [in] channels int: Number of channels (1 or 2) in input signal - * @param [in] application int: Coding mode (OPUS_APPLICATION_VOIP/OPUS_APPLICATION_AUDIO/OPUS_APPLICATION_RESTRICTED_LOWDELAY) + * @param [in] application int: Coding mode (one of OPUS_APPLICATION_VOIP, OPUS_APPLICATION_AUDIO, or OPUS_APPLICATION_RESTRICTED_LOWDELAY) * @retval #OPUS_OK Success or @ref opus_errorcodes */ OPUS_EXPORT int opus_encoder_init( @@ -268,6 +268,42 @@ OPUS_EXPORT OPUS_WARN_UNUSED_RESULT opus_int32 opus_encode( opus_int32 max_data_bytes ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(2) OPUS_ARG_NONNULL(4); +/** Encodes an Opus frame. + * @param [in] st OpusEncoder*: Encoder state + * @param [in] pcm opus_int32*: Input signal (interleaved if 2 channels) representing (or slightly exceeding) 24-bit values. length is frame_size*channels*sizeof(opus_int32) + * @param [in] frame_size int: Number of samples per channel in the + * input signal. + * This must be an Opus frame size for + * the encoder's sampling rate. + * For example, at 48 kHz the permitted + * values are 120, 240, 480, 960, 1920, + * and 2880. + * Passing in a duration of less than + * 10 ms (480 samples at 48 kHz) will + * prevent the encoder from using the LPC + * or hybrid modes. + * @param [out] data unsigned char*: Output payload. + * This must contain storage for at + * least \a max_data_bytes. + * @param [in] max_data_bytes opus_int32: Size of the allocated + * memory for the output + * payload. This may be + * used to impose an upper limit on + * the instant bitrate, but should + * not be used as the only bitrate + * control. Use #OPUS_SET_BITRATE to + * control the bitrate. + * @returns The length of the encoded packet (in bytes) on success or a + * negative error code (see @ref opus_errorcodes) on failure. + */ +OPUS_EXPORT OPUS_WARN_UNUSED_RESULT opus_int32 opus_encode24( + OpusEncoder *st, + const opus_int32 *pcm, + int frame_size, + unsigned char *data, + opus_int32 max_data_bytes +) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(2) OPUS_ARG_NONNULL(4); + /** Encodes an Opus frame from floating point input. * @param [in] st OpusEncoder*: Encoder state * @param [in] pcm float*: Input in float format (interleaved if 2 channels), with a normal range of +/-1.0. @@ -357,7 +393,7 @@ OPUS_EXPORT int opus_encoder_ctl(OpusEncoder *st, int request, ...) OPUS_ARG_NON * error = opus_decoder_init(dec, Fs, channels); * @endcode * where opus_decoder_get_size() returns the required size for the decoder state. Note that - * future versions of this code may change the size, so no assuptions should be made about it. + * future versions of this code may change the size, so no assumptions should be made about it. * * The decoder state is always continuous in memory and only a shallow copy is sufficient * to copy it (e.g. memcpy()) @@ -398,6 +434,21 @@ OPUS_EXPORT int opus_encoder_ctl(OpusEncoder *st, int request, ...) OPUS_ARG_NON */ typedef struct OpusDecoder OpusDecoder; +/** Opus DRED decoder. + * This contains the complete state of an Opus DRED decoder. + * It is position independent and can be freely copied. + * @see opus_dred_decoder_create,opus_dred_decoder_init + */ +typedef struct OpusDREDDecoder OpusDREDDecoder; + + +/** Opus DRED state. + * This contains the complete state of an Opus DRED packet. + * It is position independent and can be freely copied. + * @see opus_dred_create,opus_dred_init + */ +typedef struct OpusDRED OpusDRED; + /** Gets the size of an OpusDecoder structure. * @param [in] channels int: Number of channels. * This must be 1 or 2. @@ -468,6 +519,31 @@ OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_decode( int decode_fec ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(4); +/** Decode an Opus packet. + * @param [in] st OpusDecoder*: Decoder state + * @param [in] data char*: Input payload. Use a NULL pointer to indicate packet loss + * @param [in] len opus_int32: Number of bytes in payload* + * @param [out] pcm opus_int32*: Output signal (interleaved if 2 channels) representing (or slightly exceeding) 24-bit values. length + * is frame_size*channels*sizeof(opus_int32) + * @param [in] frame_size Number of samples per channel of available space in \a pcm. + * If this is less than the maximum packet duration (120ms; 5760 for 48kHz), this function will + * not be capable of decoding some packets. In the case of PLC (data==NULL) or FEC (decode_fec=1), + * then frame_size needs to be exactly the duration of audio that is missing, otherwise the + * decoder will not be in the optimal state to decode the next incoming packet. For the PLC and + * FEC cases, frame_size must be a multiple of 2.5 ms. + * @param [in] decode_fec int: Flag (0 or 1) to request that any in-band forward error correction data be + * decoded. If no such data is available, the frame is decoded as if it were lost. + * @returns Number of decoded samples or @ref opus_errorcodes + */ +OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_decode24( + OpusDecoder *st, + const unsigned char *data, + opus_int32 len, + opus_int32 *pcm, + int frame_size, + int decode_fec +) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(4); + /** Decode an Opus packet with floating point output. * @param [in] st OpusDecoder*: Decoder state * @param [in] data char*: Input payload. Use a NULL pointer to indicate packet loss @@ -511,6 +587,113 @@ OPUS_EXPORT int opus_decoder_ctl(OpusDecoder *st, int request, ...) OPUS_ARG_NON */ OPUS_EXPORT void opus_decoder_destroy(OpusDecoder *st); +/** Gets the size of an OpusDREDDecoder structure. + * @returns The size in bytes. + */ +OPUS_EXPORT int opus_dred_decoder_get_size(void); + +/** Allocates and initializes an OpusDREDDecoder state. + * @param [out] error int*: #OPUS_OK Success or @ref opus_errorcodes + */ +OPUS_EXPORT OpusDREDDecoder *opus_dred_decoder_create(int *error); + +/** Initializes an OpusDREDDecoder state. + * @param[in] dec OpusDREDDecoder*: State to be initialized. + */ +OPUS_EXPORT int opus_dred_decoder_init(OpusDREDDecoder *dec); + +/** Frees an OpusDREDDecoder allocated by opus_dred_decoder_create(). + * @param[in] dec OpusDREDDecoder*: State to be freed. + */ +OPUS_EXPORT void opus_dred_decoder_destroy(OpusDREDDecoder *dec); + +/** Perform a CTL function on an Opus DRED decoder. + * + * Generally the request and subsequent arguments are generated + * by a convenience macro. + * @param dred_dec OpusDREDDecoder*: DRED Decoder state. + * @param request This and all remaining parameters should be replaced by one + * of the convenience macros in @ref opus_genericctls or + * @ref opus_decoderctls. + * @see opus_genericctls + * @see opus_decoderctls + */ +OPUS_EXPORT int opus_dred_decoder_ctl(OpusDREDDecoder *dred_dec, int request, ...); + +/** Gets the size of an OpusDRED structure. + * @returns The size in bytes. + */ +OPUS_EXPORT int opus_dred_get_size(void); + +/** Allocates and initializes a DRED state. + * @param [out] error int*: #OPUS_OK Success or @ref opus_errorcodes + */ +OPUS_EXPORT OpusDRED *opus_dred_alloc(int *error); + +/** Frees an OpusDRED allocated by opus_dred_create(). + * @param[in] dec OpusDRED*: State to be freed. + */ +OPUS_EXPORT void opus_dred_free(OpusDRED *dec); + +/** Decode an Opus DRED packet. + * @param [in] dred_dec OpusDRED*: DRED Decoder state + * @param [in] dred OpusDRED*: DRED state + * @param [in] data char*: Input payload + * @param [in] len opus_int32: Number of bytes in payload + * @param [in] max_dred_samples opus_int32: Maximum number of DRED samples that may be needed (if available in the packet). + * @param [in] sampling_rate opus_int32: Sampling rate used for max_dred_samples argument. Needs not match the actual sampling rate of the decoder. + * @param [out] dred_end opus_int32*: Number of non-encoded (silence) samples between the DRED timestamp and the last DRED sample. + * @param [in] defer_processing int: Flag (0 or 1). If set to one, the CPU-intensive part of the DRED decoding is deferred until opus_dred_process() is called. + * @returns Offset (positive) of the first decoded DRED samples, zero if no DRED is present, or @ref opus_errorcodes + */ +OPUS_EXPORT int opus_dred_parse(OpusDREDDecoder *dred_dec, OpusDRED *dred, const unsigned char *data, opus_int32 len, opus_int32 max_dred_samples, opus_int32 sampling_rate, int *dred_end, int defer_processing) OPUS_ARG_NONNULL(1); + +/** Finish decoding an Opus DRED packet. The function only needs to be called if opus_dred_parse() was called with defer_processing=1. + * The source and destination will often be the same DRED state. + * @param [in] dred_dec OpusDRED*: DRED Decoder state + * @param [in] src OpusDRED*: Source DRED state to start the processing from. + * @param [out] dst OpusDRED*: Destination DRED state to store the updated state after processing. + * @returns @ref opus_errorcodes + */ +OPUS_EXPORT int opus_dred_process(OpusDREDDecoder *dred_dec, const OpusDRED *src, OpusDRED *dst); + +/** Decode audio from an Opus DRED packet with 16-bit output. + * @param [in] st OpusDecoder*: Decoder state + * @param [in] dred OpusDRED*: DRED state + * @param [in] dred_offset opus_int32: position of the redundancy to decode (in samples before the beginning of the real audio data in the packet). + * @param [out] pcm opus_int16*: Output signal (interleaved if 2 channels). length + * is frame_size*channels*sizeof(opus_int16) + * @param [in] frame_size Number of samples per channel to decode in \a pcm. + * frame_size must be a multiple of 2.5 ms. + * @returns Number of decoded samples or @ref opus_errorcodes + */ +OPUS_EXPORT int opus_decoder_dred_decode(OpusDecoder *st, const OpusDRED *dred, opus_int32 dred_offset, opus_int16 *pcm, opus_int32 frame_size); + +/** Decode audio from an Opus DRED packet with 24-bit output. + * @param [in] st OpusDecoder*: Decoder state + * @param [in] dred OpusDRED*: DRED state + * @param [in] dred_offset opus_int32: position of the redundancy to decode (in samples before the beginning of the real audio data in the packet). + * @param [out] pcm opus_int32*: Output signal (interleaved if 2 channels). length + * is frame_size*channels*sizeof(opus_int16) + * @param [in] frame_size Number of samples per channel to decode in \a pcm. + * frame_size must be a multiple of 2.5 ms. + * @returns Number of decoded samples or @ref opus_errorcodes + */ +OPUS_EXPORT int opus_decoder_dred_decode24(OpusDecoder *st, const OpusDRED *dred, opus_int32 dred_offset, opus_int32 *pcm, opus_int32 frame_size); + +/** Decode audio from an Opus DRED packet with floating point output. + * @param [in] st OpusDecoder*: Decoder state + * @param [in] dred OpusDRED*: DRED state + * @param [in] dred_offset opus_int32: position of the redundancy to decode (in samples before the beginning of the real audio data in the packet). + * @param [out] pcm float*: Output signal (interleaved if 2 channels). length + * is frame_size*channels*sizeof(float) + * @param [in] frame_size Number of samples per channel to decode in \a pcm. + * frame_size must be a multiple of 2.5 ms. + * @returns Number of decoded samples or @ref opus_errorcodes + */ +OPUS_EXPORT int opus_decoder_dred_decode_float(OpusDecoder *st, const OpusDRED *dred, opus_int32 dred_offset, float *pcm, opus_int32 frame_size); + + /** Parse an opus packet into one or more frames. * Opus_decode will perform this operation internally so most applications do * not need to use this function. @@ -583,6 +766,14 @@ OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_packet_get_nb_frames(const unsigned */ OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_packet_get_nb_samples(const unsigned char packet[], opus_int32 len, opus_int32 Fs) OPUS_ARG_NONNULL(1); +/** Checks whether an Opus packet has LBRR. + * @param [in] packet char*: Opus packet + * @param [in] len opus_int32: Length of packet + * @returns 1 is LBRR is present, 0 otherwise + * @retval OPUS_INVALID_PACKET The compressed data passed is corrupted or of an unsupported type + */ +OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_packet_has_lbrr(const unsigned char packet[], opus_int32 len); + /** Gets the number of samples of an Opus packet. * @param [in] dec OpusDecoder*: Decoder state * @param [in] packet char*: Opus packet diff --git a/ThirdParty/opus/include/opus_custom.h b/ThirdParty/opus/include/opus_custom.h index 2227be011..9464377cd 100644 --- a/ThirdParty/opus/include/opus_custom.h +++ b/ThirdParty/opus/include/opus_custom.h @@ -104,7 +104,8 @@ typedef struct OpusCustomDecoder OpusCustomDecoder; /** The mode contains all the information necessary to create an encoder. Both the encoder and decoder need to be initialized with exactly the same mode, otherwise the output will be - corrupted. + corrupted. The mode MUST NOT BE DESTROYED until the encoders and + decoders that use it are destroyed as well. @brief Mode configuration */ typedef struct OpusCustomMode OpusCustomMode; @@ -229,6 +230,27 @@ OPUS_CUSTOM_EXPORT OPUS_WARN_UNUSED_RESULT int opus_custom_encode( int maxCompressedBytes ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(2) OPUS_ARG_NONNULL(4); +/** Encodes a frame of audio. + * @param [in] st OpusCustomEncoder*: Encoder state + * @param [in] pcm opus_int32*: PCM audio in signed 32-bit format (native endian) representing (or slightly exceeding) 24-bit values. + * There must be exactly frame_size samples per channel. + * @param [in] frame_size int: Number of samples per frame of input signal + * @param [out] compressed char *: The compressed data is written here. This may not alias pcm and must be at least maxCompressedBytes long. + * @param [in] maxCompressedBytes int: Maximum number of bytes to use for compressing the frame + * (can change from one frame to another) + * @return Number of bytes written to "compressed". + * If negative, an error has occurred (see error codes). It is IMPORTANT that + * the length returned be somehow transmitted to the decoder. Otherwise, no + * decoding is possible. + */ +OPUS_CUSTOM_EXPORT OPUS_WARN_UNUSED_RESULT int opus_custom_encode24( + OpusCustomEncoder *st, + const opus_int32 *pcm, + int frame_size, + unsigned char *compressed, + int maxCompressedBytes +) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(2) OPUS_ARG_NONNULL(4); + /** Perform a CTL function on an Opus custom encoder. * * Generally the request and subsequent arguments are generated @@ -325,6 +347,23 @@ OPUS_CUSTOM_EXPORT OPUS_WARN_UNUSED_RESULT int opus_custom_decode( int frame_size ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(4); +/** Decode an opus custom frame + * @param [in] st OpusCustomDecoder*: Decoder state + * @param [in] data char*: Input payload. Use a NULL pointer to indicate packet loss + * @param [in] len int: Number of bytes in payload + * @param [out] pcm opus_int32*: Output signal (interleaved if 2 channels) representing (or slightly exceeding) 24-bit values. length + * is frame_size*channels*sizeof(opus_int32) + * @param [in] frame_size Number of samples per channel of available space in *pcm. + * @returns Number of decoded samples or @ref opus_errorcodes + */ +OPUS_CUSTOM_EXPORT OPUS_WARN_UNUSED_RESULT int opus_custom_decode24( + OpusCustomDecoder *st, + const unsigned char *data, + int len, + opus_int32 *pcm, + int frame_size +) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(4); + /** Perform a CTL function on an Opus custom decoder. * * Generally the request and subsequent arguments are generated diff --git a/ThirdParty/opus/include/opus_defines.h b/ThirdParty/opus/include/opus_defines.h index ceee5b840..cd8f4dde8 100644 --- a/ThirdParty/opus/include/opus_defines.h +++ b/ThirdParty/opus/include/opus_defines.h @@ -169,15 +169,32 @@ extern "C" { #define OPUS_SET_PHASE_INVERSION_DISABLED_REQUEST 4046 #define OPUS_GET_PHASE_INVERSION_DISABLED_REQUEST 4047 #define OPUS_GET_IN_DTX_REQUEST 4049 +#define OPUS_SET_DRED_DURATION_REQUEST 4050 +#define OPUS_GET_DRED_DURATION_REQUEST 4051 +#define OPUS_SET_DNN_BLOB_REQUEST 4052 +/*#define OPUS_GET_DNN_BLOB_REQUEST 4053 */ /** Defines for the presence of extended APIs. */ #define OPUS_HAVE_OPUS_PROJECTION_H /* Macros to trigger compilation errors when the wrong types are provided to a CTL */ #define __opus_check_int(x) (((void)((x) == (opus_int32)0)), (opus_int32)(x)) + +#ifdef DISABLE_PTR_CHECK +/* Disable checks to prevent ubsan from complaining about NULL checks + in test_opus_api. */ +#define __opus_check_int_ptr(ptr) (ptr) +#define __opus_check_uint_ptr(ptr) (ptr) +#define __opus_check_uint8_ptr(ptr) (ptr) +#define __opus_check_val16_ptr(ptr) (ptr) +#define __opus_check_void_ptr(ptr) (ptr) +#else #define __opus_check_int_ptr(ptr) ((ptr) + ((ptr) - (opus_int32*)(ptr))) #define __opus_check_uint_ptr(ptr) ((ptr) + ((ptr) - (opus_uint32*)(ptr))) +#define __opus_check_uint8_ptr(ptr) ((ptr) + ((ptr) - (opus_uint8*)(ptr))) #define __opus_check_val16_ptr(ptr) ((ptr) + ((ptr) - (opus_val16*)(ptr))) +#define __opus_check_void_ptr(x) ((void)((void *)0 == (x)), (x)) +#endif /** @endcond */ /** @defgroup opus_ctlvalues Pre-defined values for CTL interface @@ -482,7 +499,8 @@ extern "C" { * @param[in] x opus_int32: Allowed values: *
*
0
Disable inband FEC (default).
- *
1
Enable inband FEC.
+ *
1
Inband FEC enabled. If the packet loss rate is sufficiently high, Opus will automatically switch to SILK even at high rates to enable use of that FEC.
+ *
2
Inband FEC enabled, but does not necessarily switch to SILK if we have music.
*
* @hideinitializer */ #define OPUS_SET_INBAND_FEC(x) OPUS_SET_INBAND_FEC_REQUEST, __opus_check_int(x) @@ -491,7 +509,8 @@ extern "C" { * @param[out] x opus_int32 *: Returns one of the following values: *
*
0
Inband FEC disabled (default).
- *
1
Inband FEC enabled.
+ *
1
Inband FEC enabled. If the packet loss rate is sufficiently high, Opus will automatically switch to SILK even at high rates to enable use of that FEC.
+ *
2
Inband FEC enabled, but does not necessarily switch to SILK if we have music.
*
* @hideinitializer */ #define OPUS_GET_INBAND_FEC(x) OPUS_GET_INBAND_FEC_REQUEST, __opus_check_int_ptr(x) @@ -618,6 +637,18 @@ extern "C" { * @hideinitializer */ #define OPUS_GET_PREDICTION_DISABLED(x) OPUS_GET_PREDICTION_DISABLED_REQUEST, __opus_check_int_ptr(x) +/** If non-zero, enables Deep Redundancy (DRED) and use the specified maximum number of 10-ms redundant frames + * @hideinitializer */ +#define OPUS_SET_DRED_DURATION(x) OPUS_SET_DRED_DURATION_REQUEST, __opus_check_int(x) +/** Gets the encoder's configured Deep Redundancy (DRED) maximum number of frames. + * @hideinitializer */ +#define OPUS_GET_DRED_DURATION(x) OPUS_GET_DRED_DURATION_REQUEST, __opus_check_int_ptr(x) + +/** Provide external DNN weights from binary object (only when explicitly built without the weights) + * @hideinitializer */ +#define OPUS_SET_DNN_BLOB(data, len) OPUS_SET_DNN_BLOB_REQUEST, __opus_check_void_ptr(data), __opus_check_int(len) + + /**@}*/ /** @defgroup opus_genericctls Generic CTLs diff --git a/ThirdParty/opus/include/opus_multistream.h b/ThirdParty/opus/include/opus_multistream.h index babcee690..752703b66 100644 --- a/ThirdParty/opus/include/opus_multistream.h +++ b/ThirdParty/opus/include/opus_multistream.h @@ -143,7 +143,7 @@ extern "C" { * Vorbis * channel ordering. A decoder may wish to apply an additional permutation * to the mapping the encoder used to achieve a different output channel - * order (e.g. for outputing in WAV order). + * order (e.g. for outputting in WAV order). * * Each multistream packet contains an Opus packet for each stream, and all of * the Opus packets in a single multistream packet must have the same @@ -382,6 +382,44 @@ OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_multistream_encode( opus_int32 max_data_bytes ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(2) OPUS_ARG_NONNULL(4); +/** Encodes a multistream Opus frame. + * @param st OpusMSEncoder*: Multistream encoder state. + * @param[in] pcm const opus_int32*: The input signal as interleaved + * samples representing (or slightly exceeding) 24-bit values. + * This must contain + * frame_size*channels + * samples. + * @param frame_size int: Number of samples per channel in the input + * signal. + * This must be an Opus frame size for the + * encoder's sampling rate. + * For example, at 48 kHz the permitted values + * are 120, 240, 480, 960, 1920, and 2880. + * Passing in a duration of less than 10 ms + * (480 samples at 48 kHz) will prevent the + * encoder from using the LPC or hybrid modes. + * @param[out] data unsigned char*: Output payload. + * This must contain storage for at + * least \a max_data_bytes. + * @param [in] max_data_bytes opus_int32: Size of the allocated + * memory for the output + * payload. This may be + * used to impose an upper limit on + * the instant bitrate, but should + * not be used as the only bitrate + * control. Use #OPUS_SET_BITRATE to + * control the bitrate. + * @returns The length of the encoded packet (in bytes) on success or a + * negative error code (see @ref opus_errorcodes) on failure. + */ +OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_multistream_encode24( + OpusMSEncoder *st, + const opus_int32 *pcm, + int frame_size, + unsigned char *data, + opus_int32 max_data_bytes +) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(2) OPUS_ARG_NONNULL(4); + /** Encodes a multistream Opus frame from floating point input. * @param st OpusMSEncoder*: Multistream encoder state. * @param[in] pcm const float*: The input signal as interleaved @@ -510,7 +548,7 @@ OPUS_EXPORT OPUS_WARN_UNUSED_RESULT OpusMSDecoder *opus_multistream_decoder_crea int *error ) OPUS_ARG_NONNULL(5); -/** Intialize a previously allocated decoder state object. +/** Initialize a previously allocated decoder state object. * The memory pointed to by \a st must be at least the size returned by * opus_multistream_encoder_get_size(). * This is intended for applications which use their own allocator instead of @@ -591,6 +629,44 @@ OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_multistream_decode( int decode_fec ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(4); +/** Decode a multistream Opus packet. + * @param st OpusMSDecoder*: Multistream decoder state. + * @param[in] data const unsigned char*: Input payload. + * Use a NULL + * pointer to indicate packet + * loss. + * @param len opus_int32: Number of bytes in payload. + * @param[out] pcm opus_int32*: Output signal, with interleaved + * samples representing (or slightly exceeding) 24-bit values. + * This must contain room for + * frame_size*channels + * samples. + * @param frame_size int: The number of samples per channel of + * available space in \a pcm. + * If this is less than the maximum packet duration + * (120 ms; 5760 for 48kHz), this function will not be capable + * of decoding some packets. In the case of PLC (data==NULL) + * or FEC (decode_fec=1), then frame_size needs to be exactly + * the duration of audio that is missing, otherwise the + * decoder will not be in the optimal state to decode the + * next incoming packet. For the PLC and FEC cases, frame_size + * must be a multiple of 2.5 ms. + * @param decode_fec int: Flag (0 or 1) to request that any in-band + * forward error correction data be decoded. + * If no such data is available, the frame is + * decoded as if it were lost. + * @returns Number of samples decoded on success or a negative error code + * (see @ref opus_errorcodes) on failure. + */ +OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_multistream_decode24( + OpusMSDecoder *st, + const unsigned char *data, + opus_int32 len, + opus_int32 *pcm, + int frame_size, + int decode_fec +) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(4); + /** Decode a multistream Opus packet with floating point output. * @param st OpusMSDecoder*: Multistream decoder state. * @param[in] data const unsigned char*: Input payload. diff --git a/ThirdParty/opus/include/opus_projection.h b/ThirdParty/opus/include/opus_projection.h index 9dabf4e85..76c75e564 100644 --- a/ThirdParty/opus/include/opus_projection.h +++ b/ThirdParty/opus/include/opus_projection.h @@ -260,6 +260,44 @@ OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_projection_encode( opus_int32 max_data_bytes ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(2) OPUS_ARG_NONNULL(4); +/** Encodes a projection Opus frame. + * @param st OpusProjectionEncoder*: Projection encoder state. + * @param[in] pcm const opus_int32*: The input signal as interleaved + * samples representing (or slightly exceeding) 24-bit values. + * This must contain + * frame_size*channels + * samples. + * @param frame_size int: Number of samples per channel in the input + * signal. + * This must be an Opus frame size for the + * encoder's sampling rate. + * For example, at 48 kHz the permitted values + * are 120, 240, 480, 960, 1920, and 2880. + * Passing in a duration of less than 10 ms + * (480 samples at 48 kHz) will prevent the + * encoder from using the LPC or hybrid modes. + * @param[out] data unsigned char*: Output payload. + * This must contain storage for at + * least \a max_data_bytes. + * @param [in] max_data_bytes opus_int32: Size of the allocated + * memory for the output + * payload. This may be + * used to impose an upper limit on + * the instant bitrate, but should + * not be used as the only bitrate + * control. Use #OPUS_SET_BITRATE to + * control the bitrate. + * @returns The length of the encoded packet (in bytes) on success or a + * negative error code (see @ref opus_errorcodes) on failure. + */ +OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_projection_encode24( + OpusProjectionEncoder *st, + const opus_int32 *pcm, + int frame_size, + unsigned char *data, + opus_int32 max_data_bytes +) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(2) OPUS_ARG_NONNULL(4); + /** Encodes a projection Opus frame from floating point input. * @param st OpusProjectionEncoder*: Projection encoder state. @@ -405,7 +443,7 @@ OPUS_EXPORT OPUS_WARN_UNUSED_RESULT OpusProjectionDecoder *opus_projection_decod ) OPUS_ARG_NONNULL(5); -/** Intialize a previously allocated projection decoder state object. +/** Initialize a previously allocated projection decoder state object. * The memory pointed to by \a st must be at least the size returned by * opus_projection_decoder_get_size(). * This is intended for applications which use their own allocator instead of @@ -493,6 +531,43 @@ OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_projection_decode( int decode_fec ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(4); +/** Decode a projection Opus packet. + * @param st OpusProjectionDecoder*: Projection decoder state. + * @param[in] data const unsigned char*: Input payload. + * Use a NULL + * pointer to indicate packet + * loss. + * @param len opus_int32: Number of bytes in payload. + * @param[out] pcm opus_int32*: Output signal, with interleaved + * samples representing (or slightly exceeding) 24-bit values. + * This must contain room for + * frame_size*channels + * samples. + * @param frame_size int: The number of samples per channel of + * available space in \a pcm. + * If this is less than the maximum packet duration + * (120 ms; 5760 for 48kHz), this function will not be capable + * of decoding some packets. In the case of PLC (data==NULL) + * or FEC (decode_fec=1), then frame_size needs to be exactly + * the duration of audio that is missing, otherwise the + * decoder will not be in the optimal state to decode the + * next incoming packet. For the PLC and FEC cases, frame_size + * must be a multiple of 2.5 ms. + * @param decode_fec int: Flag (0 or 1) to request that any in-band + * forward error correction data be decoded. + * If no such data is available, the frame is + * decoded as if it were lost. + * @returns Number of samples decoded on success or a negative error code + * (see @ref opus_errorcodes) on failure. + */ +OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_projection_decode24( + OpusProjectionDecoder *st, + const unsigned char *data, + opus_int32 len, + opus_int32 *pcm, + int frame_size, + int decode_fec +) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(4); /** Decode a projection Opus packet with floating point output. * @param st OpusProjectionDecoder*: Projection decoder state. diff --git a/ThirdParty/opusfile/README.md b/ThirdParty/opusfile/README.md index d308b7c7d..09a2b8282 100644 --- a/ThirdParty/opusfile/README.md +++ b/ThirdParty/opusfile/README.md @@ -1,13 +1,22 @@ Build with CMake, using the following options: ``` -cmake .. -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" -DCMAKE_OSX_DEPLOYMENT_TARGET="10.12" -DBUILD_SHARED_LIBS=ON +env PATH=/usr/local/bin:$PATH cmake -B build-x86 -DCMAKE_LIBRARY_PATH=/usr/local/lib \ + -DCMAKE_OSX_ARCHITECTURES="x86_64" -DCMAKE_OSX_DEPLOYMENT_TARGET="10.13" \ + -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_SHARED_LIBS=ON -DOP_DISABLE_HTTP=ON -DOP_DISABLE_DOCS=ON +cmake build-arm -DCMAKE_OSX_ARCHITECTURES="arm64" -DCMAKE_OSX_DEPLOYMENT_TARGET="11.0" \ + -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_SHARED_LIBS=ON -DOP_DISABLE_HTTP=ON \ + -DOP_DISABLE_DOCS=ON ``` -And some minor tweaks with `install_name_tool -id` to make sure that the -resulting libopusfile.0.dylib referred to itself with @rpath and not full -paths of the build directory. +The debug overlay was built the same, except with BUILD_TYPE set to `Debug`. -Version v0.12-38-gcf218fb was used from the following repository: +The CMakeCache.txt also needed hacking to replace the libopus with our own build for compatible version +numbers in the import. + +Finally, `install_name_tool -change` was needed to change the import path for libogg. The version +numbers were already compatible. + +Version v0.12-51-g24d6e75 was used from the following repository: https://github.com/xiph/opusfile.git diff --git a/ThirdParty/opusfile/include/opusfile.h b/ThirdParty/opusfile/include/opusfile.h index 8e7aa09cb..ba2c8ea47 100644 --- a/ThirdParty/opusfile/include/opusfile.h +++ b/ThirdParty/opusfile/include/opusfile.h @@ -1816,7 +1816,7 @@ void op_set_decode_callback(OggOpusFile *_of, #define OP_TRACK_GAIN (3008) /**Gain offset type that indicates that the provided offset should be used as - the gain directly, without applying any the header or track gains.*/ + the gain directly, without applying any of the header or track gains.*/ #define OP_ABSOLUTE_GAIN (3009) /**Sets the gain to be used for decoded output.