Skip the frame during decode, which will likely incur a BADDATAPTR error
on the first frame, as has already been logged in the development
process. Instead, skip the first frame, then proceed to the next one.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
This reverts commit 453e29b2f5. Also it
applies a different workaround for VBRI headers, which doesn't require
patching libmad to work.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
Sandbox Broker now returns a handle to the exact path object that was
retained by the caller, so it will be released correctly, regardless of
what happens to the list of bookmarked paths.
Also refined the bookmark path comparison function. For existing paths,
it will find the first match. For new paths, it will prefer the longest
path instead, to try to find the deepest matching bookmark.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
- Implemented App Sandboxing in a more friendly manner.
- All sandboxed paths will need to be set in Preferences. Set as loose
a path as you want. The shortest path will be preferred.
- Removed Last.fm client support, as it was non-functional by now,
unfortunately. Maybe something better can come in the future.
- Added support for insecure SSL to the HTTP/S reader, in case anyone
needs streams which are "protected" by self-signed or expired
certificates, without having to futz around by adding certificates to
the system settings, especially for expired certificates that can't
otherwise be dodged this way.
If you want to import your old playlists to the new version, copy the
contents of `~/Library/Application Support/Cog` to the alternate sandbox
path: `~/Library/Containers/org.cogx.cog/Data/Library/Application `...
...continued...`Support/Cog`. The preferences file will migrate to the
new version automatically.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
This header type was missing, causing some Fraunhofer VBR MP3 files to
decode the wrong length information.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
There was a slight bug with handling Xing/LAME headers with main data
pointers indicating data preceding the header frame. This should allow
decoding their information properly.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
Remove or rename obsolete English.lproj files, renaming where
en.lproj does not already exist, or removing if en.lproj has
already replaced it.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
Fix streaming metadata titles being overridden by the Icecast stream
strings. Now the Icy metadata only overrides missing strings, so Vorbis
Comments take priority.
Fixes#275
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
Reject system identifier numbers that aren't supported, outright, rather
than waiting until the decoder is initialized.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
The new Core Data interface is especially stringent with receiving
NSNumber for the numeric types rather than NSString as was mistakenly
allowed before. Fix that to prevent exceptions.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
Change most, if not all, possible import paths to use the full header
directory paths instead of relative or "assume include paths" settings.
This should fix building with the CI.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
These header files were imported from the wrong path. I really have no
idea why Xcode didn't catch these already with my build tree.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
Only do a rough estimation on files without Xing or LAME or iTunes
headers. This is much faster, even if less accurate, and may include
the footer tag if present.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
The inputs now have their own metadata function, so it should merge in
the track tags from the Cuesheet, and not just forward it to the
decoder.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
This should prevent a crash if the input is recycled for another file,
which would cause the output buffer to be freed, but the output size to
contain a count on first call to readAudio, which would cause a memory
access crash.
Possibly fixes#269
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
Now read all metadata and signal it, and also support pre-buffering
a small block of sample frames if there is embedded artwork, since the
embedded artwork must be handled by the sample decode function.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
Add support for plain "genre" tag, in addition to the previously
supported "icy-genre" field for streams, this one is for static files.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
The properties function should not be dereferencing an invalid index
into the layer codec name array if layer is not set to 1 through 3. This
could happen if, for instance, an MP3 file has an invalid ID3v2 tag.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
This condition would underflow when skipping a bunch of samples on the
start of playback, or otherwise seeking, and could cause an unsigned
underflow, which would cause the subsequent vDSP_vflt32 to overread into
the MAD sample buffer and crash.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>