Commit Graph

713 Commits (bca1b02dc4c4dfe72ea97f634642ecdc0a179aa8)

Author SHA1 Message Date
Christopher Snowhill f2b015c149 Merge branch 'xcode14' 2022-06-07 19:06:48 -07:00
Christopher Snowhill fc7a8dbcb7 [Vorbis Plugin] Fix compilation on case sensitive
Fix compilation when source code is checked out on a case sensitive file
system.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-06-07 18:58:45 -07:00
Christopher Snowhill 00ea4562dc Update project files for Xcode 14 recommendations
Update all project files with new upgrade version number, and add the
dead code stripping option. Don't touch MASShortcut because it's not my
project.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-06-07 18:56:11 -07:00
Christopher Snowhill 4d25b41462 GME Plugin: Silence a type truncation warning
Adding a cast here silences a warning from passing a long to a function
accepting an int. It doesn't really matter here anyway, as the long in
question is hard coded to initialize to a fixed sample rate. Even when
sample rate configuration is eventually added, this will still be hard
capped to well within the range of 32-bit integers.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-05-24 01:11:07 -07:00
Christopher Snowhill 872816f056 VGM Decoder: Change logic of dictionary creation
Metadata logic code should be using this dictionaryWithDictionary method
so that the resulting dictionary is actually immutable, like it claims
to be, rather than simply casting it. Safety coding, all that jazz. Not
really a major issue, just feels right.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-05-24 01:09:39 -07:00
Christopher Snowhill 8cf37cadf3 Unicode metadata: Change most logic to use guesser
Most file formats the player supports may or may not have UTF-8 safe
strings in their metadata. This should not be assumed to be UTF-8, and
when it is assumed, it results in nil NSString objects, which results in
inline initializers crashing due to uncaught exceptions.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-05-24 01:07:55 -07:00
Christopher Snowhill f7dc6beda1 Plugin utilities: Moved encoding guesser to header
Moved the string encoding guesser/converter to the Plugin.h header, so
it may be accessible from any plugin. I may make it a global member of
something eventually, but a static inline for such a simple function
should be fine for now.

This function facilitates converting arbitrary 8 bit encoded strings to
Unicode NSString objects. It should be used anywhere that UTF-8 is
expected, but not necessarily guaranteed, and where other 8-bit
encodings may also be supplied by a user's files.

Not using this setup for string inputs has already led to failed UTF-8
decoding resulting in nil NSStrings being passed to the inline array or
dictionary initializers, which results in crashes due to uncaught
exceptions.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-05-24 01:05:43 -07:00
Christopher Snowhill 5a47021f6d MAD Input: Fix gapless decoding of FFmpeg files
FFmpeg processed files may also contain the LAME tag magic of 'Lavf' or
'Lavc', not just 'LAME'. Missed this when I was maintaining the FFmpeg
code that handles this, or at least adding iTunes support to it.

Fixes #250 again.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-04-25 13:19:12 -07:00
Christopher Snowhill c6c76c696d FFmpeg Input: Change Monkey's Audio description
Apparently, Info.plist, as generated by Xcode, is perfectly fine with
raw apostrophes in the source code, and doesn't require it to be an XML
entity.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-04-21 14:20:35 -07:00
Christopher Snowhill 94f915b892 VGMStream Input: Fix subsong files dumping tracks
Fixed an issue with individual files that reference single subsongs
inadvertently dumping all tracks in the referenced bank to the playlist,
instead of only adding the one bookmark or txtp file. Now it matches the
behavior of foobar2000.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-04-20 01:50:44 -07:00
Christopher Snowhill d1c6950ec6 MAD Input: Further gapless decoding and seek fixes
This time, a two-fer. First, ensure that file start seeking still skips
over the Xing/LAME header packet properly. Then, ensure that decoding
the last desired packet of the file does not indicate having decoded
more sample data than desired, which may have caused errors when
resuming playback position on restart and then smoothly transitioning to
the next track.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-04-19 23:56:17 -07:00
Christopher Snowhill 299cc5a406 MAD Input: Possible further fix for seeking
This is a possible fix for another gap issue I experienced, and may be
exposed by seeking from the start of the file without decoding first.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-04-19 23:19:52 -07:00
Christopher Snowhill 36d2d7b7e0 MAD Input: Fixed gapless handling on file start
This error was caused by the necessary fix of the previous commit, only
it caused something completely different. Due to the fact that MP3 is
included in the list of formats supported for embedded CUE Sheets, the
open stage performs a seek to the file start after opening the file,
even if there is no sheet embedded. And the resulting seek was supposed
to be a null operation, since the file was already at the start. But, as
a result, this reset the start skip counter to zero, and because the
offset wasn't backwards, but to the same position, it didn't reset the
skip counter to the start of track delay. So, as a result, start of
track delay wasn't being removed, introducing a gap. Now, this change
bypasses the seek function altogether if seeking would do nothing from
the current playback position. Whew.

Fixes #250 and MP3 gaplessness in general, surprised I didn't notice
this sooner myself, but I guess I didn't bother to verify whether my
change would break anything. Whoops.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-04-19 22:57:21 -07:00
Christopher Snowhill 2ed463034f MAD Input: Fix seeking backwards and in general
A backwards comparison led to seeking forward doing a full seek up from
the file start, and seeking backwards being a non-functional operation,
so the file would just continue playing as if there were no seek.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-04-01 19:34:54 -07:00
Christopher Snowhill 69ebce32c0 Revert "VGMStream Input: Remove downmixing, add layout"
This reverts commit 0d4ee4c901.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-03-21 16:34:49 -07:00
Christopher Snowhill 9a0c598cf1 MAD Decoder: Correct length of iTunes MP3 files
The total frames count in the iTunSMPB header is the encoded length, so
add the start and end padding to it for the decoder implementation,
which expects this variable to contain the total decodable length
including the start and end padding. Fixes gapless decoding of iTunes
files.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-03-07 23:59:14 -08:00
Christopher Snowhill 183a03657d VGMStream Decoder: Fix mutable dictionary
This dictionary was replaced with an inline literal declaration, but
this defines an immutable dictionary. Change it to a mutable copy.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-03-06 03:57:03 -08:00
Christopher Snowhill 6741151423 Highly Complete / USF: Enable HLE again
Enable HLE processing for USF playback, based on previous commit filling
out the HLE operations list. It should be safe to enable it again now.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-03-05 20:44:41 -08:00
Christopher Snowhill 7f7e17a410 Correct capitalization of WavPack in codec info
Report the correct codec name for WavPack files. An info refresh will be
needed for it to take effect on existing playlist entries.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-03-04 02:08:55 -08:00
Christopher Snowhill b3247578ed MAD Decoder: Comment out unused variable
A variable wasn't being used, except in debug builds. Comment out its
use and only skip over the field in the LAME header.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-26 20:52:35 -08:00
Christopher Snowhill a978dfbf5a MAD Decoder: Fix MP3 decoding crash
There was a stupid bug in the previous commit I made, which caused local
or seekable MP3 files to crash the player on decode. This fixes that, by
checking that a packet has actually been decoded before touching the
packet info structures. Dumb, dumb, dumb error on my part.

Fixes #244

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-26 04:26:12 -08:00
Christopher Snowhill ca3dec4497 MAD Decoder: Support changing format
Support the weird scenario of format changes mid-stream. Probably
highly unlikely, and likely to break things if it does occur, but
whatever, it might actually happen in some weird file.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-26 01:43:54 -08:00
Christopher Snowhill 53209485c0 MAD Decoder: Correctly prepare buffer after free
The current buffer size argument is used to determine if a buffer should
be allocated on the next run. Just in case something reuses the same
decoder instance.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-26 01:38:17 -08:00
Christopher Snowhill 6b53a87784 Clean up a couple of warning notices on this file
There were several warnings due to the capitalization of the header
paths, and due to unused functions that are only required by the text
CUESheet parser, and we're only using the CUESheet generator, which has
been heavily modified to emit NSString output rather than a file on
disk.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-26 01:11:50 -08:00
Christopher Snowhill 2c0f04bbeb Possibly improve MAD sample conversion speed
No idea if this brings a noticeable improvement, but it probably makes
better sense to only do the division step one time instead of doing it
twice interleaved when processing stereo files, which are the most
common scenario anyway.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-26 01:08:55 -08:00
Christopher Snowhill 19556cc630 Brought back the MAD plugin from death
Now Cog supports freeformat MP3 once again. The plugin has been extended
to include sample accurate seeking, accurate length probing of files
missing headers, and iTunes gapless info reading using libid3tag.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-24 17:51:10 -08:00
Christopher Snowhill 90ed02302e Fix FFmpeg handling odd WMA files, at least
This small change brings the decoding more in line with what ffplay
does, and allows, for example, John McLaughlin.wma to play without
interruption from the stream warnings throughout the file.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-20 03:14:30 -08:00
Christopher Snowhill 81f5adfb5c Fix Info.plist having bare apostrophes
Xcode touched the Info.plist and fixed these, and I changed the file
type association definitions to print the correct thing in the future.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-20 01:51:11 -08:00
Christopher Snowhill 7f3bf052ca Update supported file name extensions for art
Art read from external files supports more formats than previously
listed here. Amend the list accordingly.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-16 01:56:34 -08:00
Christopher Snowhill 8c945b53de HTTP Reader: Guess encoding type of stream info
Stream metadata could be in any encoding, not necessarily UTF-8. Handle
this in an appropriate way.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-16 01:51:16 -08:00
Christopher Snowhill 0d4ee4c901 VGMStream Input: Remove downmixing, add layout
Downmixing should no longer be necessary, unless someone actually tries
to emit up to 64 channels, while we support only 32 channels, but really
only 18 channels. Also read the channel layout field from the decoder,
so that the speaker layout will propagate from the files to the player.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-15 22:55:34 -08:00
Christopher Snowhill 3274bc9fe7 Revert "HTTP Reader: Support more stream info"
This reverts commit 33388918b3.
2022-02-15 15:00:11 -08:00
Christopher Snowhill 33388918b3 HTTP Reader: Support more stream info
For streams offering a three way split in their ICY metadata blocks,
support album/artist/title using that three way split. Otherwise do the
usual of artist/title, or blank artist if there's no hyphen to split on.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-15 00:57:22 -08:00
Christopher Snowhill 5e8f066a01 Add include path for libogg
The new libogg directory must be included for <ogg/ogg.h> in one place.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-15 00:40:47 -08:00
Christopher Snowhill f071d3e90c Build several libraries out of tree now
Building libogg, libvorbis, libvorbisfile, libFLAC, libopus, and
libopusfile out of tree, to utilize their projects' CMake build scripts,
and also enable any platform optimizations that may have been missing.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-15 00:26:55 -08:00
Christopher Snowhill 934589ebdd FFmpeg: Enable AIFF support
The system AIFF reader seems unable to read some really old files, so
enable FFmpeg to do so instead.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-14 21:09:24 -08:00
Christopher Snowhill a8c9f748c7 FLAC Input: Correctly prioritize text CUESheet tag
Prioritize "cuesheet" Vorbis tag over binary CUESheet tag, as the former
can contain metadata, while the latter cannot.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-14 19:54:08 -08:00
Christopher Snowhill cad09b8912 CUE Reader: Fix enumerating sheets and tag reading
The reader should have been skipping the properties of CUE sheets when
reading the referenced data for the inner files.

Fixes #235

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-13 12:18:58 -08:00
Christopher Snowhill 1309672adc CUE Sheet Reader: Merge metadata the other way
The file metadata should be merged into the CUE Sheet metadata, as we
want the CUE Sheet to take priority, wherever it happens to have fields
set.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-12 07:57:13 -08:00
Christopher Snowhill a618073203 Highly Complete: Keep USF RSP HLE disabled for now
There is a missing effect in the relevant tracks from Conker's Bad Fur
Day, an overdrive effect.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-12 07:45:10 -08:00
Christopher Snowhill a05d4537c1 Various tagging fixes
- Fix Vorbis, Opus, and FLAC tag reading
- Fix Vorbis getting a 0 length if passing through the CUE Sheet reader
- Implement support for FLAC binary CUE Sheets

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-12 07:16:59 -08:00
Christopher Snowhill 1df166b060 Updated lazyusf2, and disabled RSP HLE warnings
The warn logging was preventing working USFs from playing due
to warnings occurring during the playback that didn't otherwise
affect the ability to play the files.
2022-02-12 03:29:43 -08:00
Christopher Snowhill d5aecaf6a2 Fix outstanding crashes and issues with CUE reader
CUE reader was crashing due to nil metadata pointers, which the new
inplace initializer I was using didn't like. Change it to use a mutable
regular dictionary, and only add items if they're not nil.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-11 06:49:41 -08:00
Christopher Snowhill e695e33537 SID Input: Bring back file hints, better this time
Now file hint stashes the whole file in memory, so that any other
threads reading the file at the same time will just grab the same memory
block and read it, rather than opening the file repeatedly.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-11 04:43:20 -08:00
Christopher Snowhill 425306129f SID Input: Clean up memory leaks
Two were potential memory leaks on file errors, one was a guaranteed
leak when reading metadata.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-11 04:19:27 -08:00
Christopher Snowhill b40b8521dd SID Input: Open the files for decoding regardless
No more file handle caching, this was probably a source of crashes.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-11 04:18:39 -08:00
Christopher Snowhill 4f5e5a9e4e SID Input: Synchronize cross file access
The same file may be accessed from other threads, thanks to this cache
thing. Synchronize access so that only one thread is reading the file at
a time.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-11 03:56:50 -08:00
Christopher Snowhill be6fda4663 SID Input: Don't close hinted source files
The SID decoder uses a hint cache so that when the library requests the
current file open, it will return the exact file already opened, rather
than opening it again. Unfortunately, I was closing the file regardless,
and sometimes, libsidplayfp will reopen the file multiple times, from
other threads, even.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-11 03:55:26 -08:00
Christopher Snowhill 68c3f3b1d8 Highly Complete: Disable USF HLE
The HLE is incomplete, and sometimes buggy. Disable it for now.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-10 20:57:44 -08:00
Christopher Snowhill 39dcb88728 FFmpeg input: Support reading metadata
Where TagLib is not being employed, use FFmpeg to read tags where
possible. This allows reading tags from files like IFF. It reads it
through properties, otherwise allowing tag readers to function like
usual.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-10 15:29:13 -08:00