From bd6c68fd585ed3d4102d59d860b67770c8cef385 Mon Sep 17 00:00:00 2001 From: Josh Coalson Date: Thu, 7 Nov 2002 05:05:45 +0000 Subject: [PATCH] initial import --- include/share/grabbag/Makefile.am | 8 +++++ include/share/grabbag/file.h | 54 ++++++++++++++++++++++++++++++++ include/share/grabbag/replaygain.h | 64 ++++++++++++++++++++++++++++++++++++++ include/share/grabbag/seektable.h | 38 ++++++++++++++++++++++ 4 files changed, 164 insertions(+) create mode 100644 include/share/grabbag/Makefile.am create mode 100644 include/share/grabbag/file.h create mode 100644 include/share/grabbag/replaygain.h create mode 100644 include/share/grabbag/seektable.h diff --git a/include/share/grabbag/Makefile.am b/include/share/grabbag/Makefile.am new file mode 100644 index 0000000..d860a6e --- /dev/null +++ b/include/share/grabbag/Makefile.am @@ -0,0 +1,8 @@ +## Process this file with automake to produce Makefile.in + +AUTOMAKE_OPTIONS = foreign + +EXTRA_DIST = \ + file.h \ + replaygain.h \ + seektable.h diff --git a/include/share/grabbag/file.h b/include/share/grabbag/file.h new file mode 100644 index 0000000..77ae213 --- /dev/null +++ b/include/share/grabbag/file.h @@ -0,0 +1,54 @@ +/* grabbag - Convenience lib for various routines common to several tools + * Copyright (C) 2002 Josh Coalson + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/* Convenience routines for manipulating files */ + +/* This .h cannot be included by itself; #include "share/grabbag.h" instead. */ + +#ifndef GRABAG__FILE_H +#define GRABAG__FILE_H + +#include /* for off_t */ +#include /* for FILE */ +#include "FLAC/ordinals.h" + +#ifdef __cplusplus +extern "C" { +#endif + +GRABBAG_API void grabbag__file_copy_metadata(const char *srcpath, const char *destpath); +GRABBAG_API off_t grabbag__file_get_filesize(const char *srcpath); +GRABBAG_API const char *grabbag__file_get_basename(const char *srcpath); + +/* read_only == false means "make file writable by user" + * read_only == true means "make file read-only for everyone" + */ +GRABBAG_API FLAC__bool grabbag__file_change_stats(const char *filename, FLAC__bool read_only); + +/* attempts to make writable before unlinking */ +GRABBAG_API FLAC__bool grabbag__file_remove_file(const char *filename); + +/* these will forcibly set stdin/stdout to binary mode (for OSes that require it) */ +GRABBAG_API FILE *grabbag__file_get_binary_stdin(); +GRABBAG_API FILE *grabbag__file_get_binary_stdout(); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/include/share/grabbag/replaygain.h b/include/share/grabbag/replaygain.h new file mode 100644 index 0000000..ac4d34d --- /dev/null +++ b/include/share/grabbag/replaygain.h @@ -0,0 +1,64 @@ +/* grabbag - Convenience lib for various routines common to several tools + * Copyright (C) 2002 Josh Coalson + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/* + * This wraps the gain_analysis lib, which is LGPL. This wrapper + * allows analysis of different input resolutions by automatically + * scaling the input signal + */ + +/* This .h cannot be included by itself; #include "share/grabbag.h" instead. */ + +#ifndef GRABBAG__REPLAYGAIN_H +#define GRABBAG__REPLAYGAIN_H + +#include "FLAC/metadata.h" + +#ifdef __cplusplus +extern "C" { +#endif + +extern GRABBAG_API const unsigned GRABBAG__REPLAYGAIN_MAX_TAG_SPACE_REQUIRED; + +GRABBAG_API FLAC__bool grabbag__replaygain_is_valid_sample_frequency(unsigned sample_frequency); + +GRABBAG_API FLAC__bool grabbag__replaygain_init(unsigned sample_frequency); + +/* 'bps' must be valid for FLAC, i.e. >=4 and <= 32 */ +GRABBAG_API FLAC__bool grabbag__replaygain_analyze(const FLAC__int32 * const input[], FLAC__bool is_stereo, unsigned bps, unsigned samples); + +GRABBAG_API void grabbag__replaygain_get_album(float *gain, float *peak); +GRABBAG_API void grabbag__replaygain_get_title(float *gain, float *peak); + +/* These three functions return an error string on error, or NULL if successful */ +GRABBAG_API const char *grabbag__replaygain_analyze_file(const char *filename, float *title_gain, float *title_peak); +GRABBAG_API const char *grabbag__replaygain_store_to_vorbiscomment(FLAC__StreamMetadata *block, float album_gain, float album_peak, float title_gain, float title_peak); +GRABBAG_API const char *grabbag__replaygain_store_to_vorbiscomment_album(FLAC__StreamMetadata *block, float album_gain, float album_peak); +GRABBAG_API const char *grabbag__replaygain_store_to_vorbiscomment_title(FLAC__StreamMetadata *block, float title_gain, float title_peak); +GRABBAG_API const char *grabbag__replaygain_store_to_file(const char *filename, float album_gain, float album_peak, float title_gain, float title_peak, FLAC__bool preserve_modtime); +GRABBAG_API const char *grabbag__replaygain_store_to_file_album(const char *filename, float album_gain, float album_peak, FLAC__bool preserve_modtime); +GRABBAG_API const char *grabbag__replaygain_store_to_file_title(const char *filename, float title_gain, float title_peak, FLAC__bool preserve_modtime); + +GRABBAG_API FLAC__bool grabbag__replaygain_load_from_vorbiscomment(const FLAC__StreamMetadata *block, FLAC__bool album_mode, double *gain, double *peak); +GRABBAG_API double grabbag__replaygain_compute_scale_factor(double peak, double gain, double preamp, FLAC__bool prevent_clipping); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/include/share/grabbag/seektable.h b/include/share/grabbag/seektable.h new file mode 100644 index 0000000..3f3a2d4 --- /dev/null +++ b/include/share/grabbag/seektable.h @@ -0,0 +1,38 @@ +/* grabbag - Convenience lib for various routines common to several tools + * Copyright (C) 2002 Josh Coalson + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/* Convenience routines for working with seek tables */ + +/* This .h cannot be included by itself; #include "share/grabbag.h" instead. */ + +#ifndef GRABAG__SEEKTABLE_H +#define GRABAG__SEEKTABLE_H + +#include "FLAC/format.h" + +#ifdef __cplusplus +extern "C" { +#endif + +GRABBAG_API FLAC__bool grabbag__seektable_convert_specification_to_template(const char *spec, FLAC__bool only_explicit_placeholders, FLAC__uint64 total_samples_to_encode, unsigned sample_rate, FLAC__StreamMetadata *seektable_template, FLAC__bool *spec_has_real_points); + +#ifdef __cplusplus +} +#endif + +#endif -- 2.7.4