diff decoders/flac.c @ 477:3e705c9180e5

Fixed binary compatibility, added Sound_GetDuration().
author Ryan C. Gordon <icculus@icculus.org>
date Wed, 12 May 2004 02:15:00 +0000
parents c66080364dff
children 46d5f399cb35
line wrap: on
line diff
--- a/decoders/flac.c	Sat May 08 22:06:14 2004 +0000
+++ b/decoders/flac.c	Wed May 12 02:15:00 2004 +0000
@@ -233,6 +233,8 @@
     void *client_data)
 {
     flac_t *f = (flac_t *) client_data;
+    Sound_Sample *sample = f->sample;
+    Sound_SampleInternal *internal = (Sound_SampleInternal *) sample->opaque;
 
     SNDDBG(("FLAC: Metadata callback.\n"));
 
@@ -244,24 +246,27 @@
         SNDDBG(("FLAC: Metadata is streaminfo.\n"));
 
         f->is_flac = 1;
-        f->sample->actual.channels = metadata->data.stream_info.channels;
-        f->sample->actual.rate = metadata->data.stream_info.sample_rate;
+        sample->actual.channels = metadata->data.stream_info.channels;
+        sample->actual.rate = metadata->data.stream_info.sample_rate;
 
-	if (metadata->data.stream_info.sample_rate == 0 ||
+        if (metadata->data.stream_info.sample_rate == 0 ||
             metadata->data.stream_info.total_samples == 0)
-	  f->sample->total_time = -1;
-	else {
-	    f->sample->total_time = (metadata->data.stream_info.total_samples)
+        {
+            internal->total_time = -1;
+        } /* if */
+        else
+        {
+            internal->total_time = (metadata->data.stream_info.total_samples)
                 / metadata->data.stream_info.sample_rate * 1000;
-	    f->sample->total_time += (metadata->data.stream_info.total_samples
+            internal->total_time += (metadata->data.stream_info.total_samples
                 % metadata->data.stream_info.sample_rate) * 1000
                 / metadata->data.stream_info.sample_rate;
-	}
+        } /* else */
 
         if (metadata->data.stream_info.bits_per_sample > 8)
-            f->sample->actual.format = AUDIO_S16MSB;
+            sample->actual.format = AUDIO_S16MSB;
         else
-            f->sample->actual.format = AUDIO_S8;
+            sample->actual.format = AUDIO_S8;
     } /* if */
 } /* metadata_callback */