# HG changeset patch # User nenolod # Date 1159686337 25200 # Node ID 5b0619b09745b4145a24ce97116205edbeb98926 # Parent 31799ddaf2e9e43ba0b57516f172a12d977eda96 [svn] Detect duration: - this took a lot of brute forcing - oh, and apparently apple has a sense of humour about their format, it uses a samplesize multiple of 251. diff -r 31799ddaf2e9 -r 5b0619b09745 ChangeLog --- a/ChangeLog Sat Sep 30 23:25:06 2006 -0700 +++ b/ChangeLog Sun Oct 01 00:05:37 2006 -0700 @@ -1,3 +1,11 @@ +2006-10-01 06:25:06 +0000 William Pitcock + revision [140] + - fix memory leaks + + trunk/src/alac/plugin.c | 3 +++ + 1 file changed, 3 insertions(+) + + 2006-10-01 06:18:01 +0000 William Pitcock revision [138] - about box diff -r 31799ddaf2e9 -r 5b0619b09745 src/alac/plugin.c --- a/src/alac/plugin.c Sat Sep 30 23:25:06 2006 -0700 +++ b/src/alac/plugin.c Sun Oct 01 00:05:37 2006 -0700 @@ -245,6 +245,8 @@ { demux_res_t demux_res; unsigned int output_size, i; + gulong duration = 0; /* samples added up */ + gint framesize; set_endian(); @@ -262,8 +264,12 @@ /* initialise the sound converter */ init_sound_converter(&demux_res); + /* Sample rates are multiples of 251?! Apple is *fucking* *insane*! -nenolod */ + duration = (demux_res.num_sample_byte_sizes * (float)((1024 * demux_res.sample_size) - 1.0) / + (float)(demux_res.sample_rate / 251)); + alac_ip.output->open_audio(FMT_S16_LE, demux_res.sample_rate, demux_res.num_channels); - alac_ip.set_info((char *) args, -1, -1, demux_res.sample_rate, demux_res.num_channels); + alac_ip.set_info((char *) args, duration, -1, demux_res.sample_rate, demux_res.num_channels); /* will convert the entire buffer */ GetBuffer(&demux_res);