Commit Graph

48 Commits (39f4d09c1a554dc0a5b086a8eeeb62d218e1485e)

Author SHA1 Message Date
Christopher Snowhill 39f4d09c1a Use NSNumber Literals as much as possible
Replaced a bunch of [NSNumber numberWith...] with NSNumber Literals.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-06-17 06:39:02 -07:00
Christopher Snowhill b675ced77b [MAD Input] Don't do full file scans on CBR files
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>
2022-06-12 16:09:56 -07:00
Christopher Snowhill 854431b784 [MAD Input] Initialize state variable, fix crash
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>
2022-06-11 14:21:43 -07:00
Christopher Snowhill 1c9887053c [MAD Decoder] Fix crash on invalid files
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>
2022-06-10 02:55:13 -07:00
Christopher Snowhill ffdb6262c2 [MAD Decoder] Fix sample count calculation crash
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>
2022-06-10 02:44:02 -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 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 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 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 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
Chris Moeller 707bc85e24 Removed MAD plugin 2013-10-08 23:56:49 -07:00
Chris Moeller 74b6188772 Implemented floating point sample format support into CogAudio and all relevant plug-ins 2013-10-05 14:15:09 -07:00
Chris Moeller ec0e45381e Cleaned up most of the warnings, eliminated use of deprecated APIs, and fixed the hotkeys crashing. 2013-10-03 01:00:58 -07:00
vspader f1b965bf12 Patch from T. Million for 24-bit mad output. 2009-11-30 20:18:47 -08:00
vspader b78bae6e99 Small gapless fixes. 2009-02-27 21:25:54 -08:00
vspader 672c05ec14 Further tweaks to mp3 gapless logic. 2009-02-26 22:46:05 -08:00
vspader 94259fd366 Fix up gapless logic a little. 2009-02-26 22:12:05 -08:00
vspader 876efcde38 Rearranged comparison to prevent underflow. 2009-02-26 21:31:20 -08:00
vspader 549a0cf2da Fix for MAD sample scaling routine. 2008-05-03 19:37:10 +00:00
vspader a54f6ecfe5 Fixed bitrate calculation. 2008-02-20 01:09:15 +00:00
areff f20b10fdd4 Most of the Repeat logic is in place (needs some brush up here and there). Still missing Repeat Album. Disabled some annoying debug output from MADDecoder. Updated KnownIssues. 2008-02-19 19:59:35 +00:00
vspader 8434f6e3b3 Added RepeatTransformers with the beginnings of support for the repeat modes. MenuItems's reflect the repeat state (yet do not work to set the state yet), and the repeat button toggles w/images as expected.. 2008-02-19 03:39:43 +00:00
vspader 5434fe510b Fixed mp3 bitrate calculation. 2008-02-17 19:59:01 +00:00
vspader 5715522470 Moved to frame-based reading/seeking instead of byte/second based. Some formats have still not been updated and are broken.
Added icons for other formats.
2007-11-24 20:16:27 +00:00
vspader 97ff03f184 Preliminary gapless playback. 2007-10-18 02:33:12 +00:00
vspader 0e2dcf5014 Added m4a to taglib types. 2007-10-16 22:45:09 +00:00
vspader 4b814bdbf0 Added back update notifications back to the file drawer.
Removed no-longer-used files.
Removed debugging messages.
2007-10-15 03:29:30 +00:00
vspader 535e0e802f Updated mime-types. 2007-10-14 18:56:23 +00:00
vspader f1b9141f4b Added mime type support. 2007-10-14 18:12:15 +00:00
vspader d5919bc93e Further cleanup and memory leak fixes. 2007-10-13 07:51:42 +00:00
vspader 97a278a143 Cleaned up memory leaks. 2007-10-13 07:09:46 +00:00
vspader 139bab5e0e Fixed up streaming a bit.
Removed debugging code for http source. Was that in 0.06? Whoops.
2007-10-12 02:55:59 +00:00
vspader 50395e6e72 Basic cue sheet support working. Bug city. 2007-10-10 01:59:25 +00:00
vspader daba91b462 Removed debugging messages. 2007-07-11 01:20:32 +00:00
vspader 78a908274b Fixed bug where unseekable songs still allowed the user to move the slider and updated the time. 2007-05-27 15:11:30 +00:00
vspader 5f7215e5e7 Fixed overflow error. 2007-05-22 23:37:22 +00:00
vspader 4b3f31b51a Removed debugging message. 2007-03-04 00:33:41 +00:00
vspader 7d6c8fc6f5 MP3 streaming! 2007-03-04 00:17:05 +00:00
vspader 1aead1bf0d Merged decoder and converter threads to facilitate midstream format changing. 2007-03-03 17:19:37 +00:00
vspader eb5ee1586d Fixed up Vorbis Decoder and modified MAD to use new source system. 2007-03-03 00:33:36 +00:00
vspader 927b65a4a5 Merged with cog-audio-framework branch. Cog now uses plugins. 2007-02-24 20:36:27 +00:00