rebuilt by autoport with build requirements: libshine-devel>=3.0.0-1mamba [release 0.1.1-2mamba;Thu May 14 2015]

This commit is contained in:
Silvan Calarco 2024-01-06 08:02:21 +01:00
parent 8e68f2136f
commit da5fd3f3cf
2 changed files with 262 additions and 1 deletions

View File

@ -0,0 +1,254 @@
From f60e576eaef3b4050207a4c3f0bf601d855a3f07 Mon Sep 17 00:00:00 2001
From: Romain Beauxis <toots@rastageeks.org>
Date: Mon, 24 Jun 2013 22:47:57 -0500
Subject: [PATCH] Update to shine 3.0.0
---
CHANGES | 4 ++++
configure.ac | 4 ++--
src/shine.ml | 56 ++++++++++++++++++++++++++++++-------------------------
src/shine.mli | 13 ++++++++-----
src/shine_stubs.c | 34 +++++++++++++++++----------------
5 files changed, 63 insertions(+), 48 deletions(-)
diff --git a/CHANGES b/CHANGES
index d3a6f6f..3451867 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,7 @@
+0.2.0 ()
+=====
+* Updated to shine 3.0.0
+
0.1.1 (2013-04-15)
=====
* Updated to shine 2.0.0
diff --git a/configure.ac b/configure.ac
index 018e20b..eb0522f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,6 +1,6 @@
# check for one particular file of the sources
-AC_INIT([ocaml-shine],[0.1.1],[savonet-users@lists.sourceforge.net])
+AC_INIT([ocaml-shine],[0.2.0],[savonet-users@lists.sourceforge.net])
VERSION=$PACKAGE_VERSION
AC_MSG_RESULT([configuring $PACKAGE_STRING])
@@ -13,7 +13,7 @@ AC_C_BIGENDIAN(AC_DEFINE([BIGENDIAN], [1], [The target is big endian]),[])
AC_BASE_CHECKS()
PKG_PROG_PKG_CONFIG()
-PKG_CONFIG_CHECK_MODULE([shine],[2.0.0])
+PKG_CONFIG_CHECK_MODULE([shine],[3.0.0])
# substitutions to perform
AC_SUBST(VERSION)
diff --git a/src/shine.ml b/src/shine.ml
index b9176ea..97ee03e 100644
--- a/src/shine.ml
+++ b/src/shine.ml
@@ -20,7 +20,13 @@
(** OCaml bindings for the libshine. *)
-type t
+type enc
+
+type t =
+ {
+ enc : enc;
+ samples_per_pass : int;
+ }
type parameters =
{
@@ -29,44 +35,44 @@ type parameters =
bitrate : int;
}
-exception Samples_per_frame
-exception Invalid_bitrate
-exception Invalid_samplerate
+exception Invalid_buffer_size
+exception Invalid_configuration
exception Invalid_channels
-external samples_per_frame : unit -> int = "ocaml_shine_samples_per_frames"
-
-let samples_per_frame = samples_per_frame()
+external check_config : int -> int -> bool = "ocaml_shine_check_config"
-external samplerate_index : int -> int = "ocaml_shine_samplerate_index"
+external samples_per_pass : enc -> int = "ocaml_shine_samples_per_pass"
-external bitrate_index : int -> int = "ocaml_shine_bitrate_index"
-
-external create : int -> int -> int -> t = "ocaml_shine_init"
+external create : int -> int -> int -> enc = "ocaml_shine_init"
let create params =
- if samplerate_index params.samplerate < 0 then
- raise Invalid_samplerate;
- if bitrate_index params.bitrate < 0 then
- raise Invalid_bitrate;
+ if not (check_config params.samplerate params.bitrate) then
+ raise Invalid_configuration;
if params.channels < 1 || params.channels > 2 then
raise Invalid_channels;
- create params.channels params.samplerate params.bitrate
+ let enc =
+ create params.channels params.samplerate params.bitrate
+ in
+ { enc = enc; samples_per_pass = (samples_per_pass enc) }
+
+let samples_per_pass enc = enc.samples_per_pass
-external encode_buffer : t -> float array array -> string = "ocaml_shine_encode_float"
+external encode_buffer : enc -> float array array -> string = "ocaml_shine_encode_float"
let encode_buffer enc buf =
- if (Array.length buf == 0) || (Array.length buf.(0) != samples_per_frame) then
- raise Samples_per_frame;
+ if (Array.length buf == 0) || (Array.length buf.(0) != enc.samples_per_pass) then
+ raise Invalid_buffer_size;
- encode_buffer enc buf
+ encode_buffer enc.enc buf
-external encode_s16le : t -> string -> int -> string = "ocaml_shine_encode_s16le"
+external encode_s16le : enc -> string -> int -> string = "ocaml_shine_encode_s16le"
let encode_s16le enc data chans =
- if String.length data < 2*samples_per_frame*chans then
- raise Samples_per_frame;
+ if String.length data < 2*enc.samples_per_pass*chans then
+ raise Invalid_buffer_size;
+
+ encode_s16le enc.enc data chans
- encode_s16le enc data chans
+external flush : enc -> string = "ocaml_shine_flush"
-external flush : t -> string = "ocaml_shine_flush"
+let flush enc = flush enc.enc
diff --git a/src/shine.mli b/src/shine.mli
index e958231..a3b0afd 100644
--- a/src/shine.mli
+++ b/src/shine.mli
@@ -29,15 +29,18 @@ type parameters =
bitrate : int;
}
-exception Samples_per_frame
-exception Invalid_bitrate
-exception Invalid_samplerate
-exception Invalid_channels
+exception Invalid_buffer_size
+
+(** Raised when samplerate and/or bitrate
+ * is invalid. *)
+exception Invalid_configuration
-val samples_per_frame : int
+exception Invalid_channels
val create : parameters -> t
+val samples_per_pass : t -> int
+
val encode_buffer : t -> float array array -> string
val encode_s16le : t -> string -> int -> string
diff --git a/src/shine_stubs.c b/src/shine_stubs.c
index c6a7c98..a4d2b6c 100644
--- a/src/shine_stubs.c
+++ b/src/shine_stubs.c
@@ -53,22 +53,20 @@ static struct custom_operations encoder_ops =
custom_deserialize_default
};
-CAMLprim value ocaml_shine_samples_per_frames(value unit)
+CAMLprim value ocaml_shine_samples_per_pass(value e)
{
- CAMLparam0();
- CAMLreturn(Val_int(samp_per_frame));
+ CAMLparam1(e);
+ CAMLreturn(Val_int(shine_samples_per_pass(Encoder_val(e))));
}
-CAMLprim value ocaml_shine_bitrate_index(value br)
+CAMLprim value ocaml_shine_check_config(value samplerate, value bitrate)
{
CAMLparam0();
- CAMLreturn(Val_int(shine_find_bitrate_index(Int_val(br))));
-}
-CAMLprim value ocaml_shine_samplerate_index(value sr)
-{
- CAMLparam0();
- CAMLreturn(Val_int(shine_find_samplerate_index(Int_val(sr))));
+ if (shine_check_config(Int_val(samplerate), Int_val(bitrate)) < 0)
+ CAMLreturn(Val_false);
+
+ CAMLreturn(Val_true);
}
CAMLprim value ocaml_shine_init(value chans, value samplerate, value bitrate)
@@ -84,9 +82,9 @@ CAMLprim value ocaml_shine_init(value chans, value samplerate, value bitrate)
config.wave.samplerate = Int_val(samplerate);
config.mpeg.bitr = Int_val(bitrate);
if (config.wave.channels == 1)
- config.mpeg.mode = 3;
+ config.mpeg.mode = MONO;
else
- config.mpeg.mode = 1;
+ config.mpeg.mode = JOINT_STEREO;
enc = shine_initialise(&config);
if (enc == NULL)
@@ -118,17 +116,19 @@ CAMLprim value ocaml_shine_encode_float(value e, value data)
{
CAMLparam2(e,data);
CAMLlocal2(src,ret);
- int16_t pcm[2][samp_per_frame];
+ int16_t *pcm[2];
+ int16_t chan1[SHINE_MAX_SAMPLES], chan2[SHINE_MAX_SAMPLES];
int c,i;
long written;
unsigned char *outdata;
shine_t enc = Encoder_val(e);
+ pcm[0] = chan1, pcm[1] = chan2;
for (c = 0; c < Wosize_val(data); c++)
{
src = Field(data, c);
- for (i = 0; i < samp_per_frame; i++)
+ for (i = 0; i < shine_samples_per_pass(enc); i++)
{
pcm[c][i] = clip(Double_field(src, i));
}
@@ -150,7 +150,8 @@ CAMLprim value ocaml_shine_encode_s16le(value e, value data, value channels)
{
CAMLparam2(e,data);
CAMLlocal1(ret);
- int16_t pcm[2][samp_per_frame];
+ int16_t *pcm[2];
+ int16_t chan1[SHINE_MAX_SAMPLES], chan2[SHINE_MAX_SAMPLES];
int16_t *src = (int16_t *)String_val(data);
int c,i;
long written;
@@ -159,10 +160,11 @@ CAMLprim value ocaml_shine_encode_s16le(value e, value data, value channels)
unsigned char *outdata;
shine_t enc = Encoder_val(e);
+ pcm[0] = chan1; pcm[1] = chan2;
for (c = 0; c < chans; c++)
{
- for (i = 0; i < samp_per_frame; i++)
+ for (i = 0; i < shine_samples_per_pass(enc); i++)
{
pcm[c][i] = src[i*chans + c];
#ifdef BIGENDIAN

View File

@ -2,7 +2,7 @@
Name: ocaml-shine Name: ocaml-shine
Version: 0.1.1 Version: 0.1.1
Release: 1mamba Release: 2mamba
Summary: OCaml binding to the fixed-point mp3 encoding library shine Summary: OCaml binding to the fixed-point mp3 encoding library shine
Group: Development/Bindings Group: Development/Bindings
Vendor: openmamba Vendor: openmamba
@ -10,11 +10,14 @@ Distribution: openmamba
Packager: Davide Madrisan <davide.madrisan@gmail.com> Packager: Davide Madrisan <davide.madrisan@gmail.com>
URL: http://savonet.sourceforge.net/ URL: http://savonet.sourceforge.net/
Source: http://sourceforge.net/projects/savonet/files/ocaml-shine/%{version}/ocaml-shine-%{version}.tar.gz Source: http://sourceforge.net/projects/savonet/files/ocaml-shine/%{version}/ocaml-shine-%{version}.tar.gz
Patch0: ocaml-shine-0.1.1-libshine-3.0.0.patch
License: LGPL License: LGPL
## AUTOBUILDREQ-BEGIN ## AUTOBUILDREQ-BEGIN
BuildRequires: glibc-devel BuildRequires: glibc-devel
BuildRequires: libshine-devel BuildRequires: libshine-devel
## AUTOBUILDREQ-END ## AUTOBUILDREQ-END
BuildRequires: ocaml-ocamldoc
BuildRequires: libshine-devel >= 3.0.0-1mamba
BuildRoot: %{_tmppath}/%{name}-%{version}-root BuildRoot: %{_tmppath}/%{name}-%{version}-root
%description %description
@ -30,6 +33,7 @@ This package contains libraries and signature files for developing applications
%prep %prep
%setup -q %setup -q
%patch0 -p1
%build %build
./configure \ ./configure \
@ -73,5 +77,8 @@ make install
%doc examples/ %doc examples/
%changelog %changelog
* Thu May 14 2015 Silvan Calarco <silvan.calarco@mambasoft.it> 0.1.1-2mamba
- rebuilt by autoport with build requirements: libshine-devel>=3.0.0-1mamba
* Thu Jun 27 2013 openmamba WebBuild System <webbuild@openmamba.org> 0.1.1-1mamba * Thu Jun 27 2013 openmamba WebBuild System <webbuild@openmamba.org> 0.1.1-1mamba
- package created by davide using the webbuild interface - package created by davide using the webbuild interface