[xiph-commits] r3329 - in
libfishsound/branches/1.0-stable-flac/src: examples libfishsound
conrad at svn.annodex.net
conrad at svn.annodex.net
Thu Jan 10 00:19:48 PST 2008
Author: conrad
Date: 2008-01-10 00:19:48 -0800 (Thu, 10 Jan 2008)
New Revision: 3329
Modified:
libfishsound/branches/1.0-stable-flac/src/examples/fishsound-encode.c
libfishsound/branches/1.0-stable-flac/src/libfishsound/flac.c
Log:
fix compile warnings in flac.c, and add dummy functions for --disable-flac
Modified: libfishsound/branches/1.0-stable-flac/src/examples/fishsound-encode.c
===================================================================
--- libfishsound/branches/1.0-stable-flac/src/examples/fishsound-encode.c 2008-01-10 08:16:38 UTC (rev 3328)
+++ libfishsound/branches/1.0-stable-flac/src/examples/fishsound-encode.c 2008-01-10 08:19:48 UTC (rev 3329)
@@ -42,6 +42,8 @@
#include <fishsound/fishsound.h>
#include <sndfile.h>
+#define ENCODE_BLOCK_SIZE (1152)
+
long serialno;
int b_o_s = 1;
@@ -121,13 +123,13 @@
fish_sound_set_interleave (fsound, 1);
- while (sf_readf_float (sndfile, pcm, 1024) > 0) {
- fish_sound_encode (fsound, (float **)pcm, 1024);
- while ((n = oggz_write (oggz, 1024)) > 0);
+ while (sf_readf_float (sndfile, pcm, ENCODE_BLOCK_SIZE) > 0) {
+ fish_sound_encode (fsound, (float **)pcm, ENCODE_BLOCK_SIZE);
+ oggz_run (oggz);
}
fish_sound_flush (fsound);
- while ((n = oggz_write (oggz, 1024)) > 0);
+ oggz_run (oggz);
oggz_close (oggz);
Modified: libfishsound/branches/1.0-stable-flac/src/libfishsound/flac.c
===================================================================
--- libfishsound/branches/1.0-stable-flac/src/libfishsound/flac.c 2008-01-10 08:16:38 UTC (rev 3328)
+++ libfishsound/branches/1.0-stable-flac/src/libfishsound/flac.c 2008-01-10 08:19:48 UTC (rev 3329)
@@ -39,6 +39,8 @@
#include "config.h"
#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
#include "private.h"
#include "convert.h"
@@ -46,6 +48,7 @@
#define DEBUG
#if HAVE_FLAC
+
#include "FLAC/all.h"
#define BITS_PER_SAMPLE 24
@@ -65,7 +68,10 @@
} FishSoundFlacInfo;
#ifdef FS_DECODE
-FLAC__StreamDecoderReadStatus fs_flac_read_callback(const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], unsigned *bytes, void *client_data)
+static FLAC__StreamDecoderReadStatus
+fs_flac_read_callback(const FLAC__StreamDecoder *decoder,
+ FLAC__byte buffer[], unsigned *bytes,
+ void *client_data)
{
FishSound* fsound = (FishSound*)client_data;
FishSoundFlacInfo* fi = (FishSoundFlacInfo *)fsound->codec_data;
@@ -79,7 +85,7 @@
return FLAC__STREAM_DECODER_READ_STATUS_ABORT;
} else if (fi->bufferlength < 1) {
#ifdef DEBUG
- fprintf(stderr, "no data, %d\n",fi->bufferlength);
+ fprintf(stderr, "no data, %ld\n",fi->bufferlength);
#endif
return FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM;
}
@@ -89,7 +95,11 @@
return FLAC__STREAM_DECODER_READ_STATUS_CONTINUE;
}
-FLAC__StreamDecoderWriteStatus fs_flac_write_callback(const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data)
+static FLAC__StreamDecoderWriteStatus
+fs_flac_write_callback(const FLAC__StreamDecoder *decoder,
+ const FLAC__Frame *frame,
+ const FLAC__int32 * const buffer[],
+ void *client_data)
{
FishSound* fsound = (FishSound*)client_data;
FishSoundFlacInfo* fi = (FishSoundFlacInfo *)fsound->codec_data;
@@ -128,7 +138,10 @@
return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE;
}
-void fs_flac_meta_callback(const FLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data)
+static void
+fs_flac_meta_callback(const FLAC__StreamDecoder *decoder,
+ const FLAC__StreamMetadata *metadata,
+ void *client_data)
{
FishSound* fsound = (FishSound*)client_data;
/* FishSoundFlacInfo* fi = (FishSoundFlacInfo *)fsound->codec_data; */
@@ -148,7 +161,10 @@
}
}
-void fs_flac_error_callback(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data)
+static void
+fs_flac_error_callback(const FLAC__StreamDecoder *decoder,
+ FLAC__StreamDecoderErrorStatus status,
+ void *client_data)
{
#ifdef DEBUG
fprintf(stderr, "fs_flac_error_callback\n");
@@ -158,7 +174,7 @@
#endif
#ifdef FS_ENCODE
-FLAC__StreamEncoderWriteStatus
+static FLAC__StreamEncoderWriteStatus
fs_flac_enc_write_callback(const FLAC__StreamEncoder *encoder,
const FLAC__byte buffer[], unsigned bytes,
unsigned samples, unsigned current_frame,
@@ -171,7 +187,7 @@
printf("bytes: %d, samples: %d\n", bytes, samples);
#endif
if (fsound->callback.encoded) {
- FishSoundEncoded encoded = (FishSoundEncoded)fsound->callback.encoded;
+ FishSoundEncoded encoded = (FishSoundEncoded) fsound->callback.encoded;
if (fi->packetno == 0 && fi->header <= 1) {
if (fi->header == 0) {
/* libFLAC has called us with data containing the normal fLaC header
@@ -218,10 +234,13 @@
return FLAC__STREAM_ENCODER_WRITE_STATUS_OK;
}
-void fs_flac_enc_meta_callback(const FLAC__StreamEncoder *encoder, const FLAC__StreamMetadata *metadata, void *client_data)
+static void
+fs_flac_enc_meta_callback(const FLAC__StreamEncoder *encoder,
+ const FLAC__StreamMetadata *metadata,
+ void *client_data)
{
- FishSound* fsound = (FishSound*)client_data;
- /* FishSoundFlacInfo* fi = (FishSoundFlacInfo *)fsound->codec_data; */
+ /* FishSound* fsound = (FishSound*)client_data; */
+ /* FishSoundFlacInfo* fi = (FishSoundFlacInfo *)fsound->codec_data; */
#ifdef DEBUG
fprintf(stderr, "fs_flac_meta_callback\n");
#endif
@@ -263,8 +282,7 @@
}
static int
-fs_flac_command (FishSound * fsound, int command, void * data,
- int datasize)
+fs_flac_command (FishSound * fsound, int command, void * data, int datasize)
{
return 0;
}
@@ -281,11 +299,12 @@
FLAC__stream_encoder_set_write_callback(fi->fse, fs_flac_enc_write_callback);
FLAC__stream_encoder_set_metadata_callback(fi->fse, fs_flac_enc_meta_callback);
FLAC__stream_encoder_set_client_data(fi->fse, fsound);
- // FLAC__stream_encoder_set_total_samples_estimate(fi->fse, );
+ /* FLAC__stream_encoder_set_total_samples_estimate(fi->fse, );*/
if (FLAC__stream_encoder_init(fi->fse) != FLAC__STREAM_ENCODER_OK) return NULL;
return fsound;
}
+#if 0
static long
fs_flac_encode_i_ilv (FishSound * fsound, int ** pcm, long frames)
{
@@ -296,10 +315,11 @@
#endif
if (fi->packetno == 0)
fs_flac_enc_headers (fsound);
- // FLAC__stream_encoder_process_interleaved(fi->fse, pcm, frames);
+ /* FLAC__stream_encoder_process_interleaved(fi->fse, pcm, frames); */
fi->packetno++;
return frames;
}
+#endif
static long
fs_flac_encode_f_ilv (FishSound * fsound, float ** pcm, long frames)
@@ -331,7 +351,7 @@
{
FishSoundFlacInfo *fi = fsound->codec_data;
if (buf[0] != 0x7f) return NULL;
- if (strncmp(buf+1, "FLAC", 4) != 0) return NULL;
+ if (strncmp((char *)buf+1, "FLAC", 4) != 0) return NULL;
fi->version.major = buf[5];
fi->version.minor = buf[6];
#ifdef DEBUG
@@ -394,8 +414,10 @@
fi->buffer = buf+9;
fi->bufferlength = bytes-9;
FLAC__stream_decoder_process_until_end_of_metadata(fi->fsd);
- // } else if (fi->packetno == 1) {
- // fish_sound_comments_decode (fsound, buf, bytes);
+#if 0
+ } else if (fi->packetno == 1) {
+ fish_sound_comments_decode (fsound, buf, bytes);
+#endif
} else if (fi->packetno <= fi->header_packets) {
buf[0] |= 0x80;
fi->buffer = buf;
@@ -445,13 +467,13 @@
static int
fs_flac_reset (FishSound * fsound)
{
- FishSoundFlacInfo * fi = (FishSoundFlacInfo *)fsound->codec_data;
- /*
+ /*FishSoundFlacInfo * fi = (FishSoundFlacInfo *)fsound->codec_data;*/
+#if 0
if (fsound->mode == FISH_SOUND_DECODE) {
FLAC__stream_decoder_reset(fi->fsd);
} else if (fsound->mode == FISH_SOUND_ENCODE) {
}
- */
+#endif
return 0;
}
@@ -512,4 +534,18 @@
return codec;
}
+#else /* !HAVE_FLAC */
+
+int
+fish_sound_flac_identify (unsigned char * buf, long bytes)
+{
+ return FISH_SOUND_UNKNOWN;
+}
+
+FishSoundCodec *
+fish_sound_flac_codec (void)
+{
+ return NULL;
+}
+
#endif
More information about the commits
mailing list