[xiph-commits] r3288 - in
libfishsound/branches/1.0-stable-flac/src: libfishsound tests
conrad at svn.annodex.net
conrad at svn.annodex.net
Tue Dec 4 17:54:53 PST 2007
Author: conrad
Date: 2007-12-04 17:54:53 -0800 (Tue, 04 Dec 2007)
New Revision: 3288
Modified:
libfishsound/branches/1.0-stable-flac/src/libfishsound/flac.c
libfishsound/branches/1.0-stable-flac/src/tests/encdec-audio.c
Log:
backport flac support to 1.0-stable: fix compilation bugs ('make test' failure)
Modified: libfishsound/branches/1.0-stable-flac/src/libfishsound/flac.c
===================================================================
--- libfishsound/branches/1.0-stable-flac/src/libfishsound/flac.c 2007-12-05 01:44:28 UTC (rev 3287)
+++ libfishsound/branches/1.0-stable-flac/src/libfishsound/flac.c 2007-12-05 01:54:53 UTC (rev 3288)
@@ -59,90 +59,8 @@
fprintf(stderr, "fs_flac_write_callback\n");
#endif
fsound->frameno += frame->header.blocksize*frame->header.channels;
- switch (fsound->pcm_type) {
- case FISH_SOUND_PCM_SHORT:
- if (fsound->callback.decoded_short) {
- if (fsound->interleave) {
- FishSoundDecoded_ShortIlv dsi;
- short* retpcm;
- int shift = 16 - frame->header.bits_per_sample;
- fi->pcm = realloc(fi->pcm, sizeof(short)*frame->header.channels*frame->header.blocksize);
- retpcm = (short*) fi->pcm;
- if (shift < 0) {
- shift = abs(shift);
- for (i=0; i<frame->header.blocksize; i++) {
- offset = i*frame->header.channels;
- for (j=0; j<frame->header.channels; j++)
- retpcm[offset + j] = buffer[j][i] >> shift;
- }
- } else {
- for (i=0; i<frame->header.blocksize; i++) {
- offset = i*frame->header.channels;
- for (j=0; j<frame->header.channels; j++)
- retpcm[offset + j] = buffer[j][i] << shift;
- }
- }
- dsi = (FishSoundDecoded_ShortIlv)fsound->callback.decoded_short_ilv;
- dsi (fsound, (short **)retpcm, frame->header.blocksize, fsound->user_data);
- } else {
- FishSoundDecoded_Short ds;
- short** retpcm, *p;
- int shift = 16 - frame->header.bits_per_sample;
- fi->pcm = realloc(fi->pcm, sizeof(short)*frame->header.channels*frame->header.blocksize);
- retpcm = fi->pcm;
- if (shift < 0) {
- shift = abs(shift);
- for (i=0; i<frame->header.blocksize; i++)
- for (j=0; j<frame->header.channels; j++) {
- p = retpcm[j];
- p[i] = buffer[j][i] >> shift;
- }
- } else {
- for (i=0; i<frame->header.blocksize; i++)
- for (j=0; j<frame->header.channels; j++) {
- p = retpcm[j];
- p[i] = buffer[j][i] << shift;
- }
- }
- ds = (FishSoundDecoded_Short)fsound->callback.decoded_short;
- ds (fsound, retpcm, frame->header.blocksize, fsound->user_data);
- }
- }
- break;
- case FISH_SOUND_PCM_INT:
- if (fsound->callback.decoded_int) {
- if (fsound->interleave) {
- FishSoundDecoded_IntIlv dii;
- int* retpcm;
- int shift = 32 - frame->header.bits_per_sample;
- fi->pcm = realloc(fi->pcm, sizeof(int)*frame->header.channels*frame->header.blocksize);
- retpcm = (int*) fi->pcm;
- for (i=0; i<frame->header.blocksize; i++) {
- offset = i*frame->header.channels;
- for (j=0; j<frame->header.channels; j++)
- retpcm[offset + j] = buffer[j][i] << shift;
- }
- dii = (FishSoundDecoded_IntIlv)fsound->callback.decoded_int_ilv;
- dii (fsound, (int **)retpcm, frame->header.blocksize, fsound->user_data);
- } else {
- FishSoundDecoded_Int di;
- int** retpcm, *p;
- int shift = 32 - frame->header.bits_per_sample;
- fi->pcm = realloc(fi->pcm, sizeof(int)*frame->header.channels*frame->header.blocksize);
- retpcm = fi->pcm;
- for (i=0; i<frame->header.blocksize; i++)
- for (j=0; j<frame->header.channels; j++) {
- p = retpcm[j];
- p[i] = buffer[j][i] << shift;
- }
- di = (FishSoundDecoded_Int)fsound->callback.decoded_int;
- di (fsound, retpcm, frame->header.blocksize, fsound->user_data);
- }
- }
- break;
- case FISH_SOUND_PCM_FLOAT:
- if (fsound->callback.decoded_float) {
- if (fsound->interleave) {
+ if (fsound->callback.decoded_float) {
+ if (fsound->interleave) {
FishSoundDecoded_FloatIlv dfi;
float* retpcm, norm = 1.0 / (1 + (1 << (frame->header.bits_per_sample - 1)));
fi->pcm = realloc(fi->pcm, sizeof(float)*frame->header.channels*frame->header.blocksize);
@@ -166,41 +84,7 @@
}
df = (FishSoundDecoded_Float)fsound->callback.decoded_float;
df (fsound, retpcm, frame->header.blocksize, fsound->user_data);
- }
}
- break;
- case FISH_SOUND_PCM_DOUBLE:
- if (fsound->callback.decoded_double) {
- if (fsound->interleave) {
- FishSoundDecoded_DoubleIlv ddi;
- double* retpcm, norm = 1.0 / (1 + (1 << (frame->header.bits_per_sample - 1)));
- fi->pcm = realloc(fi->pcm, sizeof(double)*frame->header.channels*frame->header.blocksize);
- retpcm = (double*) fi->pcm;
- for (i=0; i<frame->header.blocksize; i++) {
- offset = i*frame->header.channels;
- for (j=0; j<frame->header.channels; j++)
- retpcm[offset + j] = buffer[j][i] * norm;
- }
- ddi = (FishSoundDecoded_DoubleIlv)fsound->callback.decoded_double_ilv;
- ddi (fsound, (double **)retpcm, frame->header.blocksize, fsound->user_data);
- } else {
- FishSoundDecoded_Double dd;
- double** retpcm, *p, norm = 1.0 / (1 + (1 << (frame->header.bits_per_sample - 1)));
- fi->pcm = realloc(fi->pcm, sizeof(double)*frame->header.channels*frame->header.blocksize);
- retpcm = fi->pcm;
- for (i=0; i<frame->header.blocksize; i++)
- for (j=0; j<frame->header.channels; j++) {
- p = retpcm[j];
- p[i] = buffer[j][i] * norm;
- }
- dd = (FishSoundDecoded_Double)fsound->callback.decoded_double;
- dd (fsound, retpcm, frame->header.blocksize, fsound->user_data);
- }
- }
- break;
- default:
- return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT;
- break;
}
return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE;
}
@@ -494,7 +378,7 @@
}
static int
-fs_flac_update (FishSound * fsound, int interleave, FishSoundPCM pcm_type)
+fs_flac_update (FishSound * fsound, int interleave)
{
return 0;
}
@@ -562,14 +446,8 @@
codec->update = fs_flac_update;
codec->command = fs_flac_command;
codec->decode = fs_flac_decode;
- codec->encode_s = NULL;
- codec->encode_s_ilv = NULL;
- codec->encode_i = NULL;
- codec->encode_i_ilv = fs_flac_encode_i_ilv;
codec->encode_f = NULL;
codec->encode_f_ilv = fs_flac_encode_f_ilv;
- codec->encode_d = NULL;
- codec->encode_d_ilv = NULL;
codec->flush = fs_flac_flush;
return codec;
Modified: libfishsound/branches/1.0-stable-flac/src/tests/encdec-audio.c
===================================================================
--- libfishsound/branches/1.0-stable-flac/src/tests/encdec-audio.c 2007-12-05 01:44:28 UTC (rev 3287)
+++ libfishsound/branches/1.0-stable-flac/src/tests/encdec-audio.c 2007-12-05 01:54:53 UTC (rev 3288)
@@ -336,7 +336,7 @@
/* Test FLAC */
if (test_flac) {
if (test_channels[c] <= 8) {
- fs_encdec_test (pcm_type, test_samplerates[s], test_channels[c],
+ fs_encdec_test (test_samplerates[s], test_channels[c],
FISH_SOUND_FLAC, 0, test_blocksizes[b]);
}
@@ -362,7 +362,7 @@
/* Test FLAC */
if (test_flac) {
if (test_channels[c] <= 8) {
- fs_encdec_test (pcm_type, test_samplerates[s], test_channels[c],
+ fs_encdec_test (test_samplerates[s], test_channels[c],
FISH_SOUND_FLAC, 1, test_blocksizes[b]);
}
More information about the commits
mailing list