Bug 511584 - Update libfishsound to rev 20b5cdf6fe38f6

This commit is contained in:
Chris Pearce 2009-08-31 13:23:16 +12:00
Родитель 0efe886b3a
Коммит 90b2c900a3
11 изменённых файлов: 253 добавлений и 180 удалений

Просмотреть файл

@ -15,13 +15,23 @@ lower level layer such as UDP datagrams. When these codecs are used in
files, they are commonly encapsulated in Ogg to produce Ogg FLAC, Speex
and Ogg Vorbis files.
libfishsound is a wrapper around the existing codec libraries and provides
a consistent, higher-level programming interface. It has been designed for
use in a wide variety of applications; it has no direct dependencies on
Ogg encapsulation, though it is most commonly used in conjunction with
liboggz to decode or encode FLAC, Speex or Vorbis audio tracks in Ogg files,
including Ogg Theora and Annodex.
This source tarball
-------------------
FishSound has been developed and tested on GNU/Linux, Darwin/MacOSX
and MS Windows. Installation uses the standard configure, make, make
install sequence; Full details are in the file INSTALL. Read the file
README.win32 for installing under MS Windows.
FishSound has been developed and tested on GNU/Linux, Darwin/MacOSX and
Win32. It probably also works on other Unix-like systems via GNU autoconf.
For Win32: nmake Makefiles, Visual Studio .NET 2003 solution files and
Visual C++ 6.0 workspace files are all provided in the source distribution.
Details for building with GNU autotools are in the file INSTALL. Read the
file README.win32 for installing under MS Windows.
src/libfishsound/ the library source code.
src/examples/ example tools for programming with libfishsound.

Просмотреть файл

@ -6,8 +6,10 @@ files for the Mozilla build system.
Some files are renamed during the copy to prevent clashes with object
file names with other Mozilla libraries.
The git commit id used was e98a05 from git://git.xiph.org/libfishsound.git
The git commit id used was 20b5cdf6fe38f61a9847e46e82da60d7ac4b7877
from git://git.xiph.org/libfishsound.git
endian.patch is applied to fix Bug 45269.
bug487519.patch: Fixes for bug487519

Просмотреть файл

@ -1,23 +0,0 @@
diff --git a/media/libfishsound/src/libfishsound/fishsound_vorbis.c b/media/libfishsound/src/libfishsound/fishsound_vorbis.c
index 0c93a35..b1efc48 100644
--- a/media/libfishsound/src/libfishsound/fishsound_vorbis.c
+++ b/media/libfishsound/src/libfishsound/fishsound_vorbis.c
@@ -423,16 +423,18 @@ fs_vorbis_init (FishSound * fsound)
fsv = fs_malloc (sizeof (FishSoundVorbisInfo));
if (fsv == NULL) return NULL;
fsv->packetno = 0;
fsv->finished = 0;
vorbis_info_init (&fsv->vi);
vorbis_comment_init (&fsv->vc);
+ vorbis_dsp_init (&fsv->vd);
+ vorbis_block_init (&fsv->vd, &fsv->vb);
fsv->pcm = NULL;
fsv->ipcm = NULL;
fsv->max_pcm = 0;
fsound->codec_data = fsv;
#if FS_ENCODE && HAVE_VORBISENC

Просмотреть файл

@ -1,6 +1,9 @@
/* config.h. Generated from config.h.in by configure. */
/* config.h.in. Generated from configure.ac by autoheader. */
/* Define if building universal (internal helper macro) */
/* #undef AC_APPLE_UNIVERSAL_BUILD */
/* Do not build decoding support */
#define FS_DECODE 1
@ -16,6 +19,12 @@
/* Define to 1 if you have libFLAC */
#define HAVE_FLAC 0
/* Define to 1 if you have libFLAC 1.1.2 */
/* #undef HAVE_FLAC_1_1_2 */
/* Define to 1 if you have libFLAC 1.1.3 */
/* #undef HAVE_FLAC_1_1_3 */
/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1
@ -34,6 +43,9 @@
/* Define to 1 if you have libspeex 1.1.x */
/* #undef HAVE_SPEEX_1_1 */
/* Define to 1 if speex_lib_get_mode() exists in libspeex */
/* #undef HAVE_SPEEX_LIB_GET_MODE */
/* Define to 1 if you have the <stdint.h> header file. */
/* #define HAVE_STDINT_H 1 */
@ -52,6 +64,9 @@
/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
/* Define to 1 if the system has the type `uintptr_t'. */
/* #define HAVE_UINTPTR_T 1 */
/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
@ -61,6 +76,10 @@
/* Define to 1 if you have libvorbisenc */
#define HAVE_VORBISENC 0
/* Define to the sub-directory in which libtool stores uninstalled libraries.
*/
#define LT_OBJDIR ".libs/"
/* Name of package */
#define PACKAGE "libfishsound"
@ -83,11 +102,19 @@
#define STDC_HEADERS 1
/* Version number of package */
#define VERSION "0.9.1"
#define VERSION "0.9.2"
/* Define to 1 if your processor stores words with the most significant byte
first (like Motorola and SPARC, unlike Intel and VAX). */
/* #undef WORDS_BIGENDIAN */
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
significant byte first (like Motorola and SPARC, unlike Intel). */
#if defined AC_APPLE_UNIVERSAL_BUILD
# if defined __BIG_ENDIAN__
# define WORDS_BIGENDIAN 1
# endif
#else
# ifndef WORDS_BIGENDIAN
/* # undef WORDS_BIGENDIAN */
# endif
#endif
/* Define to empty if `const' does not conform to ANSI C. */
/* #undef const */

Просмотреть файл

@ -1,6 +1,9 @@
/* config.h. Generated from config.h.in by configure. */
/* config.h.in. Generated from configure.ac by autoheader. */
/* Define if building universal (internal helper macro) */
/* #undef AC_APPLE_UNIVERSAL_BUILD */
/* Do not build decoding support */
#define FS_DECODE 1
@ -16,6 +19,12 @@
/* Define to 1 if you have libFLAC */
#define HAVE_FLAC 0
/* Define to 1 if you have libFLAC 1.1.2 */
/* #undef HAVE_FLAC_1_1_2 */
/* Define to 1 if you have libFLAC 1.1.3 */
/* #undef HAVE_FLAC_1_1_3 */
/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1
@ -34,6 +43,9 @@
/* Define to 1 if you have libspeex 1.1.x */
/* #undef HAVE_SPEEX_1_1 */
/* Define to 1 if speex_lib_get_mode() exists in libspeex */
/* #undef HAVE_SPEEX_LIB_GET_MODE */
/* Define to 1 if you have the <stdint.h> header file. */
/* #define HAVE_STDINT_H 1 */
@ -52,6 +64,9 @@
/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
/* Define to 1 if the system has the type `uintptr_t'. */
/* #define HAVE_UINTPTR_T 1 */
/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
@ -61,6 +76,10 @@
/* Define to 1 if you have libvorbisenc */
#define HAVE_VORBISENC 0
/* Define to the sub-directory in which libtool stores uninstalled libraries.
*/
#define LT_OBJDIR ".libs/"
/* Name of package */
#define PACKAGE "libfishsound"
@ -83,11 +102,19 @@
#define STDC_HEADERS 1
/* Version number of package */
#define VERSION "0.9.1"
#define VERSION "0.9.2"
/* Define to 1 if your processor stores words with the most significant byte
first (like Motorola and SPARC, unlike Intel and VAX). */
/* #undef WORDS_BIGENDIAN */
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
significant byte first (like Motorola and SPARC, unlike Intel). */
#if defined AC_APPLE_UNIVERSAL_BUILD
# if defined __BIG_ENDIAN__
# define WORDS_BIGENDIAN 1
# endif
#else
# ifndef WORDS_BIGENDIAN
/* # undef WORDS_BIGENDIAN */
# endif
#endif
/* Define to empty if `const' does not conform to ANSI C. */
/* #undef const */

Просмотреть файл

@ -0,0 +1,92 @@
/*
* A generic debugging printer.
*
* Conrad Parker <conrad@metadecks.org>, May 2009
*
* Usage:
*
* #define DEBUG_LEVEL 3
* #include "debug.h"
*
* ...
* debug_printf (2, "Something went wrong");
* ...
*
* The macro print_debug(level, fmt) prints a formatted debugging message
* of level 'level' to stderr. You should set the maximum tolerable debug
* level before including debug.h. If it is 0, or if neither DEBUG_LEVEL
* nor DEBUG are defined, then the debug_printf() macro is ignored, and
* none of this file is included.
*/
#ifndef __DEBUG_H__
#define __DEBUG_H__
/* MSVC can't handle C99 */
#if (defined (_MSCVER) || defined (_MSC_VER))
#define debug_printf //
#else
#ifdef DEBUG
#ifndef DEBUG_LEVEL
#define DEBUG_LEVEL 1
#endif
#endif
#if (DEBUG_LEVEL > 0)
#define DEBUG_MAXLINE 4096
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include <errno.h>
/*
* debug_print_err (func, line, fmt)
*
* Print a formatted error message to stderr.
*/
static void
debug_print_err (const char * func, int line, const char * fmt, ...)
{
va_list ap;
int errno_save;
char buf[DEBUG_MAXLINE];
int n=0;
errno_save = errno;
va_start (ap, fmt);
if (func) {
snprintf (buf+n, DEBUG_MAXLINE-n, "%s():%d: ", func, line);
n = strlen (buf);
}
vsnprintf (buf+n, DEBUG_MAXLINE-n, fmt, ap);
n = strlen (buf);
fflush (stdout); /* in case stdout and stderr are the same */
fputs (buf, stderr);
fputc ('\n', stderr);
fflush (NULL);
va_end (ap);
}
/*
* debug_printf (level, fmt)
*
* Print a formatted debugging message of level 'level' to stderr
*/
#define debug_printf(x,y...) {if (x <= DEBUG_LEVEL) debug_print_err (__func__, __LINE__, y);}
#undef MAXLINE
#else
#define debug_printf(x,y...)
#endif
#endif /* non-C99 */
#endif /* __DEBUG_H__ */

Просмотреть файл

@ -43,6 +43,7 @@
#include "private.h"
/*#define DEBUG*/
#include "debug.h"
/* Ensure comment vector length can be expressed in 32 bits
* including space for the trailing NUL */
@ -141,9 +142,7 @@ fs_comment_validate_byname (const char * name, const char * value)
for (c = name; *c; c++) {
if (*c < 0x20 || *c > 0x7D || *c == 0x3D) {
#ifdef DEBUG
printf ("XXX char %c in %s invalid\n", *c, name);
#endif
debug_printf (1, "XXX char %c in %s invalid", *c, name);
return 0;
}
}
@ -437,17 +436,18 @@ fish_sound_comments_decode (FishSound * fsound, unsigned char * comments,
end = c+length;
len=readint(c, 0);
if (len<0) return -1;
c+=4;
if (len>end-c) return -1;
if (len > (unsigned long) length - 4) return -1;
/* Vendor */
if (len > 0) {
if ((nvalue = fs_strdup_len (c, len)) == NULL)
return FISH_SOUND_ERR_OUT_OF_MEMORY;
if (fish_sound_comment_set_vendor (fsound, nvalue) == FISH_SOUND_ERR_OUT_OF_MEMORY)
if (fish_sound_comment_set_vendor (fsound, nvalue) == FISH_SOUND_ERR_OUT_OF_MEMORY) {
fs_free (nvalue);
return FISH_SOUND_ERR_OUT_OF_MEMORY;
}
fs_free (nvalue);
}
@ -461,9 +461,7 @@ fish_sound_comments_decode (FishSound * fsound, unsigned char * comments,
/* This value gets checked effectively by the 'for' condition
and the checks within the loop for c running off the end. */
nb_fields=readint(c, 0);
#ifdef DEBUG
printf ("fish_sound_comments_decode: %d comments\n", nb_fields);
#endif
debug_printf (1, "%d comments", nb_fields);
c+=4;
for (i=0;i<nb_fields;i++)
@ -471,13 +469,10 @@ fish_sound_comments_decode (FishSound * fsound, unsigned char * comments,
if (c+4>end) return -1;
len=readint(c, 0);
#ifdef DEBUG
printf ("fish_sound_comments_decode: [%d] len %d\n", i, len);
#endif
if (len<0) return -1;
debug_printf (1, "[%d] len %d\n", i, len);
c+=4;
if (len>end-c) return -1;
if (len > (unsigned long) (end-c)) return -1;
name = c;
value = fs_index_len (c, '=', len);
@ -488,30 +483,35 @@ fish_sound_comments_decode (FishSound * fsound, unsigned char * comments,
n = c+len - value;
if ((nvalue = fs_strdup_len (value, n)) == NULL)
return FISH_SOUND_ERR_OUT_OF_MEMORY;
#ifdef DEBUG
printf ("fish_sound_comments_decode: %s -> %s (length %d)\n",
name, nvalue, n);
#endif
if ((comment = fs_comment_new (name, nvalue)) == NULL)
return FISH_SOUND_ERR_OUT_OF_MEMORY;
if (_fs_comment_add (fsound, comment) == NULL)
debug_printf (1, "%s -> %s (length %d)", name, nvalue, n);
if ((comment = fs_comment_new (name, nvalue)) == NULL) {
fs_free (nvalue);
return FISH_SOUND_ERR_OUT_OF_MEMORY;
}
if (_fs_comment_add (fsound, comment) == NULL) {
fs_free (nvalue);
return FISH_SOUND_ERR_OUT_OF_MEMORY;
}
fs_free (nvalue);
} else {
#ifdef DEBUG
printf ("fish_sound_comments_decode: [%d] %s (no value)\n",
i, name, len);
#endif
debug_printf (1, "[%d] %s (no value)", i, name, len);
if ((nvalue = fs_strdup_len (name, len)) == NULL)
return FISH_SOUND_ERR_OUT_OF_MEMORY;
if ((comment = fs_comment_new (nvalue, NULL)) == NULL)
if ((comment = fs_comment_new (nvalue, NULL)) == NULL) {
fs_free (nvalue);
return FISH_SOUND_ERR_OUT_OF_MEMORY;
}
if (_fs_comment_add (fsound, comment) == NULL)
if (_fs_comment_add (fsound, comment) == NULL) {
fs_free (nvalue);
return FISH_SOUND_ERR_OUT_OF_MEMORY;
}
fs_free (nvalue);
}
@ -519,9 +519,7 @@ fish_sound_comments_decode (FishSound * fsound, unsigned char * comments,
c+=len;
}
#ifdef DEBUG
printf ("fish_sound_comments_decode: done\n");
#endif
debug_printf (1, "OUT");
return FISH_SOUND_OK;
}
@ -577,10 +575,7 @@ fish_sound_comments_encode (FishSound * fsound, unsigned char * buf,
return 0;
}
#ifdef DEBUG
printf ("fish_sound_comments_encode: %s = %s\n",
comment->name, comment->value);
#endif
debug_printf (1, "%s = %s", comment->name, comment->value);
nb_fields++;
}

Просмотреть файл

@ -45,8 +45,10 @@
#include "private.h"
#include "convert.h"
/*#define DEBUG*/
/*#define DEBUG_VERBOSE*/
#define DEBUG_VERBOSE 2
/* #define DEBUG */
/* #define DEBUG_LEVEL DEBUG_VERBOSE */
#include "debug.h"
#if HAVE_FLAC
@ -82,9 +84,7 @@ fish_sound_flac_identify (unsigned char * buf, long bytes)
if (bytes < 8) return FISH_SOUND_UNKNOWN;
if (buf[0] != 0x7f) return FISH_SOUND_UNKNOWN;
if (!strncmp ((char *)buf+1, "FLAC", 4)) {
#ifdef DEBUG
printf("fish_sound_flac_identify: flac found\n");
#endif
debug_printf(1, "flac found");
/* if only a short buffer was passed, do a weak identify */
if (bytes == 8) return FISH_SOUND_FLAC;
@ -111,18 +111,12 @@ fs_flac_read_callback(const FLAC__StreamDecoder *decoder,
{
FishSound* fsound = (FishSound*)client_data;
FishSoundFlacInfo* fi = (FishSoundFlacInfo *)fsound->codec_data;
#ifdef DEBUG_VERBOSE
printf("fs_flac_read_callback: IN\n");
#endif
debug_printf(DEBUG_VERBOSE, "fs_flac_read_callback: IN");
if (fi->bufferlength > *bytes) {
#ifdef DEBUG
printf("fs_flac_read_callback: too much data\n");
#endif
debug_printf(1, "too much data");
return FLAC__STREAM_DECODER_READ_STATUS_ABORT;
} else if (fi->bufferlength < 1) {
#ifdef DEBUG
printf("fs_flac_read_callback: no data, %ld\n",fi->bufferlength);
#endif
debug_printf(1, "no data, %ld",fi->bufferlength);
return FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM;
}
@ -146,9 +140,7 @@ fs_flac_write_callback(const FLAC__StreamDecoder *decoder,
channels = frame->header.channels;
blocksize = frame->header.blocksize;
#ifdef DEBUG_VERBOSE
printf("fs_flac_write_callback: IN, blocksize %d\n", blocksize);
#endif
debug_printf(DEBUG_VERBOSE, "IN, blocksize %d", blocksize);
fsound->frameno += blocksize;
@ -200,23 +192,18 @@ fs_flac_meta_callback(const FLAC__StreamDecoder *decoder,
{
FishSound* fsound = (FishSound*)client_data;
/* FishSoundFlacInfo* fi = (FishSoundFlacInfo *)fsound->codec_data; */
#ifdef DEBUG
printf("fs_flac_meta_callback: IN\n");
#endif
debug_printf(1, "IN");
switch (metadata->type) {
case FLAC__METADATA_TYPE_STREAMINFO:
#ifdef DEBUG
printf("fs_flac_meta_callback: channels %d, samplerate %d\n",
debug_printf(1, "channels %d, samplerate %d",
metadata->data.stream_info.channels,
metadata->data.stream_info.sample_rate);
#endif
fsound->info.channels = metadata->data.stream_info.channels;
fsound->info.samplerate = metadata->data.stream_info.sample_rate;
break;
default:
#ifdef DEBUG
printf("fs_flac_meta_callback: not yet implemented type\n");
#endif
debug_printf(1, "not yet implemented type");
break;
}
}
@ -226,9 +213,7 @@ fs_flac_error_callback(const FLAC__StreamDecoder *decoder,
FLAC__StreamDecoderErrorStatus status,
void *client_data)
{
#ifdef DEBUG
printf("fs_flac_error_callback: IN\n");
#endif
debug_printf(1, "IN");
fprintf(stderr, "FLAC ERROR: %s\n", FLAC__StreamDecoderErrorStatusString[status]);
}
#endif
@ -243,20 +228,13 @@ fs_flac_decode_header (FishSound * fsound, unsigned char *buf, long bytes)
if (strncmp((char *)buf+1, "FLAC", 4) != 0) return NULL;
fi->version.major = buf[5];
fi->version.minor = buf[6];
#ifdef DEBUG
printf("fs_flac_decode_header : Flac Ogg Mapping Version: %d.%d\n",
debug_printf(1, "Flac Ogg Mapping Version: %d.%d",
fi->version.major, fi->version.minor);
#endif
fi->header_packets = buf[7] << 8 | buf[8];
#ifdef DEBUG
printf("fs_flac_decode_header: Number of Header packets: %d\n",
fi->header_packets);
#endif
debug_printf(1, "Number of Header packets: %d", fi->header_packets);
if ((fi->fsd = FLAC__stream_decoder_new()) == NULL) {
#ifdef DEBUG
printf ("fs_flac_decode_header: unable to create new stream_decoder\n");
#endif
debug_printf (1, "unable to create new stream_decoder");
return NULL;
}
@ -293,15 +271,11 @@ fs_flac_decode (FishSound * fsound, unsigned char * buf, long bytes)
{
FishSoundFlacInfo *fi = fsound->codec_data;
#ifdef DEBUG_VERBOSE
printf("fs_flac_decode: IN, fi->packetno = %ld\n", fi->packetno);
#endif
debug_printf(DEBUG_VERBOSE, "IN, fi->packetno = %ld", fi->packetno);
if (fi->packetno == 0) {
if (fs_flac_decode_header (fsound, buf, bytes) == NULL) {
#ifdef DEBUG
printf("fs_flac_decode: Error reading header\n");
#endif
debug_printf(1, "Error reading header");
return -1;
}
if ((fi->buffer = fs_malloc(sizeof(unsigned char)*bytes)) == NULL)
@ -312,10 +286,8 @@ fs_flac_decode (FishSound * fsound, unsigned char * buf, long bytes)
}
else if (fi->packetno <= fi->header_packets){
unsigned char* tmp;
#ifdef DEBUG
printf("fs_flac_decode: handling header (fi->header_packets = %d)\n",
fi->header_packets);
#endif
debug_printf(1, "handling header (fi->header_packets = %d)",
fi->header_packets);
#if 0
if (fi->packetno == 1) fish_sound_comments_decode (fsound, buf, bytes);
@ -323,9 +295,8 @@ fs_flac_decode (FishSound * fsound, unsigned char * buf, long bytes)
if ((buf[0] & 0x7) == 4) {
int len = (buf[1]<<16) + (buf[2]<<8) + buf[3];
#ifdef DEBUG
printf ("fs_flac_decode: got vorbiscomments len %d\n", len);
#endif
debug_printf (1, "got vorbiscomments len %d", len);
if (fish_sound_comments_decode (fsound, buf+4, len) == FISH_SOUND_ERR_OUT_OF_MEMORY) {
fi->packetno++;
return FISH_SOUND_ERR_OUT_OF_MEMORY;
@ -381,10 +352,10 @@ fs_flac_enc_write_callback(const FLAC__StreamEncoder *encoder,
{
FishSound* fsound = (FishSound*)client_data;
FishSoundFlacInfo *fi = fsound->codec_data;
#ifdef DEBUG
printf("fs_flac_enc_write_callback: IN\n");
printf("fs_flac_enc_write_callback: bytes: %d, samples: %d\n", bytes, samples);
#endif
debug_printf(1, "IN");
debug_printf(1, "bytes: %d, samples: %d", bytes, samples);
if (fsound->callback.encoded) {
FishSoundEncoded encoded = (FishSoundEncoded) fsound->callback.encoded;
if (fi->packetno == 0 && fi->header <= 1) {
@ -393,10 +364,9 @@ fs_flac_enc_write_callback(const FLAC__StreamEncoder *encoder,
* and a STREAMINFO block. Prepend the FLAC Ogg mapping header,
* as described in http://flac.sourceforge.net/ogg_mapping.html.
*/
#ifdef DEBUG
printf("fs_flac_enc_write_callback: generating FLAC header packet: "
"%c%c%c%c\n", buffer[0], buffer[1], buffer[2], buffer[3]);
#endif
debug_printf(1, "generating FLAC header packet: %c%c%c%c",
buffer[0], buffer[1], buffer[2], buffer[3]);
if ((fi->buffer = (unsigned char*)fs_malloc(sizeof(unsigned char)*(bytes+9))) == NULL)
return FLAC__STREAM_ENCODER_WRITE_STATUS_FATAL_ERROR;
@ -448,25 +418,20 @@ fs_flac_enc_meta_callback(const FLAC__StreamEncoder *encoder,
{
/* FishSound* fsound = (FishSound*)client_data; */
/* FishSoundFlacInfo* fi = (FishSoundFlacInfo *)fsound->codec_data; */
#ifdef DEBUG
printf("fs_flac_enc_meta_callback: IN\n");
#endif
debug_printf(1, "IN");
switch (metadata->type) {
case FLAC__METADATA_TYPE_STREAMINFO:
#ifdef DEBUG
printf("fs_flac_enc_meta_callback: channels %d, samplerate %d\n",
debug_printf(1, "channels %d, samplerate %d",
metadata->data.stream_info.channels,
metadata->data.stream_info.sample_rate);
#endif
/*
fsound->info.channels = metadata->data.stream_info.channels;
fsound->info.samplerate = metadata->data.stream_info.sample_rate;
*/
break;
default:
#ifdef DEBUG
printf("fs_flac_enc_meta_callback: metadata type not yet implemented\n");
#endif
debug_printf(1, "metadata type not yet implemented");
break;
}
@ -658,9 +623,7 @@ fs_flac_encode_f (FishSound * fsound, float * pcm[], long frames)
long i;
int j, channels = fsound->info.channels;
#ifdef DEBUG
printf("fs_flac_encode_f: IN, frames = %ld\n", frames);
#endif
debug_printf("IN, frames = %ld", frames);
if ((ipcm = realloc(fi->ipcm, sizeof(FLAC__int32) * channels * frames)) == NULL)
return FISH_SOUND_ERR_OUT_OF_MEMORY;
@ -704,9 +667,7 @@ fs_flac_encode_f_ilv (FishSound * fsound, float ** pcm, long frames)
float * p = (float*)pcm, norm = (1 << (BITS_PER_SAMPLE - 1));
long i, length = frames * fsound->info.channels;
#ifdef DEBUG
printf("fs_flac_encode_f_ilv: IN, frames = %ld\n", frames);
#endif
debug_printf(1, "IN, frames = %ld", frames);
if ((ipcm = realloc(fi->ipcm, sizeof(FLAC__int32)*fsound->info.channels*frames)) == NULL)
return FISH_SOUND_ERR_OUT_OF_MEMORY;
@ -749,9 +710,7 @@ fs_flac_delete (FishSound * fsound)
FishSoundFlacInfo * fi = (FishSoundFlacInfo *)fsound->codec_data;
int i;
#ifdef DEBUG
printf("fs_flac_delete: IN\n");
#endif
debug_printf("IN");
if (fsound->mode == FISH_SOUND_DECODE) {
if (fi->fsd) {
@ -810,10 +769,7 @@ fs_flac_flush (FishSound * fsound)
{
FishSoundFlacInfo * fi = (FishSoundFlacInfo *)fsound->codec_data;
#ifdef DEBUG
printf("fs_flac_flush: IN (%s)\n",
fsound->mode == FISH_SOUND_DECODE ? "decode" : "encode");
#endif
debug_printf("IN (%s)", fsound->mode == FISH_SOUND_DECODE ? "decode" : "encode");
if (fsound->mode == FISH_SOUND_DECODE) {
FLAC__stream_decoder_finish(fi->fsd);

Просмотреть файл

@ -46,6 +46,7 @@
#include "convert.h"
/*#define DEBUG*/
#include "debug.h"
#if HAVE_SPEEX
@ -207,10 +208,10 @@ process_header(unsigned char * buf, long bytes, int enh_enabled,
if (*channels == -1)
*channels = header->nb_channels;
#ifdef DEBUG
fprintf (stderr, "Decoding %d Hz audio using %s mode",
*rate, mode->modeName);
debug_printf (1, "Decoding %d Hz audio using %s mode",
*rate, mode->modeName);
#ifdef DEBUG
if (*channels==1)
fprintf (stderr, " (mono");
else
@ -287,9 +288,7 @@ fs_speex_decode (FishSound * fsound, unsigned char * buf, long bytes)
return FISH_SOUND_ERR_GENERIC;
}
#ifdef DEBUG
printf ("speex: got %d channels, %d Hz\n", channels, rate);
#endif
debug_printf (1, "speex: got %d channels, %d Hz", channels, rate);
fsound->info.samplerate = rate;
fsound->info.channels = channels;
@ -436,9 +435,7 @@ fs_speex_enc_headers (FishSound * fsound)
speex_encoder_ctl (fss->st, SPEEX_GET_FRAME_SIZE, &fss->frame_size);
#ifdef DEBUG
printf ("got frame size %d\n", fss->frame_size);
#endif
debug_printf (1, "got frame size %d", fss->frame_size);
/* XXX: set VBR etc. */

Просмотреть файл

@ -42,6 +42,7 @@
#include "convert.h"
/*#define DEBUG*/
#include "debug.h"
#if HAVE_VORBIS
@ -89,10 +90,8 @@ fish_sound_vorbis_identify (unsigned char * buf, long bytes)
if ((ret = vorbis_synthesis_headerin (&vi, &vc, &op)) == 0) {
if (vi.rate != 0) id = FISH_SOUND_VORBIS;
#ifdef DEBUG
} else {
printf ("vorbis_synthesis_headerin returned %d\n", ret);
#endif
debug_printf (1, "vorbis_synthesis_headerin returned %d", ret);
}
vorbis_info_clear (&vi);
@ -130,10 +129,8 @@ fs_vorbis_decode (FishSound * fsound, unsigned char * buf, long bytes)
if ((ret = vorbis_synthesis_headerin (&fsv->vi, &fsv->vc, &op)) == 0) {
if (fsv->vi.rate != 0) {
#ifdef DEBUG
printf ("Got vorbis info: version %d\tchannels %d\trate %ld\n",
fsv->vi.version, fsv->vi.channels, fsv->vi.rate);
#endif
debug_printf (1, "Got vorbis info: version %d\tchannels %d\trate %ld",
fsv->vi.version, fsv->vi.channels, fsv->vi.rate);
fsound->info.samplerate = fsv->vi.rate;
fsound->info.channels = fsv->vi.channels;
}
@ -230,10 +227,7 @@ fs_vorbis_enc_headers (FishSound * fsound)
/* Update the comments */
for (comment = fish_sound_comment_first (fsound); comment;
comment = fish_sound_comment_next (fsound, comment)) {
#ifdef DEBUG
fprintf (stderr, "fs_vorbis_enc_headers: %s = %s\n",
comment->name, comment->value);
#endif
debug_printf (1, "%s = %s", comment->name, comment->value);
vorbis_comment_add_tag (&fsv->vc, comment->name, comment->value);
}
@ -362,9 +356,7 @@ fs_vorbis_encode_f (FishSound * fsound, float * pcm[], long frames)
while (remaining > 0) {
len = MIN (1024, remaining);
#ifdef DEBUG
printf ("fs_vorbis_encode: processing %ld frames\n", len);
#endif
debug_printf (1, "processing %ld frames", len);
/* expose the buffer to submit data */
vpcm = vorbis_analysis_buffer (&fsv->vd, 1024);
@ -393,11 +385,8 @@ fs_vorbis_enc_init (FishSound * fsound)
{
FishSoundVorbisInfo * fsv = (FishSoundVorbisInfo *)fsound->codec_data;
#ifdef DEBUG
printf ("Vorbis enc init: %d channels, %d Hz\n", fsound->info.channels,
fsound->info.samplerate);
#endif
debug_printf (1, "Vorbis enc init: %d channels, %d Hz", fsound->info.channels,
fsound->info.samplerate);
vorbis_encode_init_vbr (&fsv->vi, fsound->info.channels,
fsound->info.samplerate, (float)0.3 /* quality */);

Просмотреть файл

@ -37,6 +37,7 @@ cp $1/src/libfishsound/encode.c ./src/libfishsound/fishsound_encode.c
cp $1/src/libfishsound/fs_vector.h ./src/libfishsound/fs_vector.h
cp $1/src/libfishsound/fs_vector.c ./src/libfishsound/fs_vector.c
cp $1/src/libfishsound/convert.h ./src/libfishsound/convert.h
cp $1/src/libfishsound/debug.h ./src/libfishsound/debug.h
cp $1/AUTHORS ./AUTHORS
patch -p3 <endian.patch
patch -p3 <bug487519.patch