summaryrefslogtreecommitdiff
path: root/plugins/alac/alac.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/alac/alac.c')
-rw-r--r--plugins/alac/alac.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/plugins/alac/alac.c b/plugins/alac/alac.c
index 469000da..a65270fa 100644
--- a/plugins/alac/alac.c
+++ b/plugins/alac/alac.c
@@ -150,12 +150,18 @@ void alac_set_info(alac_file *alac, char *inputbuffer)
alac->setinfo_8a_rate = *(uint32_t*)ptr;
if (!host_bigendian)
_Swap32(alac->setinfo_8a_rate);
+
ptr += 4;
allocate_buffers(alac);
}
+int
+alac_get_samplerate(alac_file *alac) {
+ return alac->setinfo_8a_rate;
+}
+
/* stream reading */
/* supports reading 1 to 16 bits, in big endian format */
@@ -1154,6 +1160,7 @@ void decode_frame(alac_file *alac,
alac_file *create_alac(int samplesize, int numchannels)
{
alac_file *newfile = malloc(sizeof(alac_file));
+ memset (newfile, 0, sizeof (alac_file));
newfile->samplesize = samplesize;
newfile->numchannels = numchannels;
@@ -1162,3 +1169,25 @@ alac_file *create_alac(int samplesize, int numchannels)
return newfile;
}
+void alac_file_free (alac_file *alac) {
+ if (alac->predicterror_buffer_a) {
+ free (alac->predicterror_buffer_a);
+ }
+ if (alac->predicterror_buffer_b) {
+ free (alac->predicterror_buffer_b);
+ }
+ if (alac->outputsamples_buffer_a) {
+ free (alac->outputsamples_buffer_a);
+ }
+ if (alac->outputsamples_buffer_b) {
+ free (alac->outputsamples_buffer_b);
+ }
+ if (alac->uncompressed_bytes_buffer_a) {
+ free (alac->uncompressed_bytes_buffer_a);
+ }
+ if (alac->uncompressed_bytes_buffer_b) {
+ free (alac->uncompressed_bytes_buffer_b);
+ }
+ free (alac);
+}
+