transpiled by C2Rust 0.14
This commit is contained in:
parent
33155c6ce2
commit
9896c4cd01
27
Cargo.toml
27
Cargo.toml
@ -3,7 +3,7 @@ members = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
[package]
|
[package]
|
||||||
name = "squeezers"
|
name = "sqeezers"
|
||||||
authors = ["C2Rust"]
|
authors = ["C2Rust"]
|
||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
publish = false
|
publish = false
|
||||||
@ -11,19 +11,34 @@ edition = "2018"
|
|||||||
autobins = false
|
autobins = false
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
name = "squeezers"
|
name = "sqeezers"
|
||||||
path = "lib.rs"
|
path = "lib.rs"
|
||||||
crate-type = ["staticlib", "rlib"]
|
crate-type = ["staticlib", "rlib"]
|
||||||
|
|
||||||
|
|
||||||
[[bin]]
|
|
||||||
path = "src/main.rs"
|
|
||||||
name = "main"
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
c2rust-bitfields = "0.3"
|
c2rust-bitfields = "0.3"
|
||||||
c2rust-asm-casts = "0.1"
|
c2rust-asm-casts = "0.1"
|
||||||
libc = "0.2"
|
libc = "0.2"
|
||||||
|
|
||||||
|
|
||||||
|
[dependencies.c2rust-xcheck-plugin]
|
||||||
|
path = "../c2rust/cross-checks/rust-checks/rustc-plugin"
|
||||||
|
version = "*"
|
||||||
|
|
||||||
|
[dependencies.c2rust-xcheck-derive]
|
||||||
|
path = "../c2rust/cross-checks/rust-checks/derive-macros"
|
||||||
|
version = "*"
|
||||||
|
|
||||||
|
[dependencies.c2rust-xcheck-runtime]
|
||||||
|
path = "../c2rust/cross-checks/rust-checks/runtime"
|
||||||
|
version = "*"
|
||||||
|
features = ["libc-hash", "fixed-length-array-hash"]
|
||||||
|
|
||||||
|
[dependencies.c2rust-xcheck-backend-zstd-logging]
|
||||||
|
path = "../c2rust/cross-checks/rust-checks/backends/zstd-logging"
|
||||||
|
version = "*"
|
||||||
|
|
||||||
|
[dependencies.c2rust-ast-printer]
|
||||||
|
path = "../c2rust/cross-checks/rust-checks/"
|
||||||
|
version = "*"
|
||||||
|
60
lib.rs
60
lib.rs
@ -5,47 +5,49 @@
|
|||||||
#![allow(non_upper_case_globals)]
|
#![allow(non_upper_case_globals)]
|
||||||
#![allow(unused_assignments)]
|
#![allow(unused_assignments)]
|
||||||
#![allow(unused_mut)]
|
#![allow(unused_mut)]
|
||||||
|
#![cross_check(yes)]
|
||||||
#![feature(asm)]
|
#![feature(asm)]
|
||||||
#![feature(c_variadic)]
|
#![feature(c_variadic)]
|
||||||
#![feature(const_raw_ptr_to_usize_cast)]
|
#![feature(const_raw_ptr_to_usize_cast)]
|
||||||
#![feature(extern_types)]
|
#![feature(extern_types)]
|
||||||
#![feature(main)]
|
#![feature(main)]
|
||||||
|
#![feature(plugin)]
|
||||||
#![feature(ptr_wrapping_offset_from)]
|
#![feature(ptr_wrapping_offset_from)]
|
||||||
#![feature(register_tool)]
|
#![feature(register_tool)]
|
||||||
#![register_tool(c2rust)]
|
#![register_tool(c2rust)]
|
||||||
|
|
||||||
#[path = "src/internal.rs"]
|
|
||||||
pub mod internal;
|
|
||||||
#[path = "src/squeezelite_h.rs"]
|
|
||||||
pub mod squeezelite_h;
|
|
||||||
#[path = "src/stdarg_h.rs"]
|
|
||||||
pub mod stdarg_h;
|
|
||||||
#[path = "src/stddef_h.rs"]
|
|
||||||
pub mod stddef_h;
|
|
||||||
#[path = "src/stdlib.rs"]
|
|
||||||
pub mod stdlib;
|
|
||||||
#[macro_use]
|
|
||||||
extern crate c2rust_bitfields;
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
|
extern crate c2rust_bitfields;#[macro_use]
|
||||||
extern crate c2rust_asm_casts;
|
extern crate c2rust_asm_casts;
|
||||||
extern crate libc;
|
extern crate libc;
|
||||||
|
|
||||||
|
#![plugin(c2rust_xcheck_plugin())]
|
||||||
|
#[macro_use] extern crate c2rust_xcheck_derive;
|
||||||
|
#[macro_use] extern crate c2rust_xcheck_runtime;
|
||||||
|
extern crate c2rust_xcheck_backend_zstd_logging;
|
||||||
|
|
||||||
|
#[global_allocator]
|
||||||
|
static C2RUST_ALLOC: ::std::alloc::System = ::std::alloc::System;
|
||||||
|
|
||||||
pub mod src {
|
pub mod src {
|
||||||
pub mod buffer;
|
pub mod buffer;
|
||||||
pub mod decode;
|
pub mod decode;
|
||||||
pub mod faad;
|
pub mod faad;
|
||||||
pub mod flac;
|
pub mod flac;
|
||||||
pub mod mad;
|
pub mod mad;
|
||||||
pub mod mpg;
|
pub mod main;
|
||||||
pub mod output;
|
pub mod mpg;
|
||||||
pub mod output_alsa;
|
pub mod output;
|
||||||
pub mod output_pa;
|
pub mod output_alsa;
|
||||||
pub mod output_pack;
|
pub mod output_pa;
|
||||||
pub mod output_pulse;
|
pub mod output_pack;
|
||||||
pub mod output_stdout;
|
pub mod output_pulse;
|
||||||
pub mod pcm;
|
pub mod output_stdout;
|
||||||
pub mod slimproto;
|
pub mod pcm;
|
||||||
pub mod stream;
|
pub mod slimproto;
|
||||||
pub mod utils;
|
pub mod stream;
|
||||||
pub mod vorbis;
|
pub mod utils;
|
||||||
|
pub mod vorbis;
|
||||||
} // mod src
|
} // mod src
|
||||||
|
|
||||||
|
246
src/buffer.rs
246
src/buffer.rs
@ -1,29 +1,80 @@
|
|||||||
use ::libc;
|
use ::libc;
|
||||||
|
extern "C" {
|
||||||
pub use crate::stddef_h::size_t;
|
#[no_mangle]
|
||||||
pub use crate::stdlib::__uint8_t;
|
fn malloc(_: libc::c_ulong) -> *mut libc::c_void;
|
||||||
pub use crate::stdlib::u_int8_t;
|
#[no_mangle]
|
||||||
|
fn free(__ptr: *mut libc::c_void);
|
||||||
pub use crate::squeezelite_h::buffer;
|
#[no_mangle]
|
||||||
pub use crate::squeezelite_h::u8_t;
|
fn pthread_mutex_init(__mutex: *mut pthread_mutex_t,
|
||||||
pub use crate::stdlib::__pthread_internal_list;
|
__mutexattr: *const pthread_mutexattr_t)
|
||||||
pub use crate::stdlib::__pthread_list_t;
|
-> libc::c_int;
|
||||||
pub use crate::stdlib::__pthread_mutex_s;
|
#[no_mangle]
|
||||||
use crate::stdlib::free;
|
fn pthread_mutex_destroy(__mutex: *mut pthread_mutex_t) -> libc::c_int;
|
||||||
use crate::stdlib::malloc;
|
#[no_mangle]
|
||||||
pub use crate::stdlib::pthread_mutex_destroy;
|
fn pthread_mutex_lock(__mutex: *mut pthread_mutex_t) -> libc::c_int;
|
||||||
pub use crate::stdlib::pthread_mutex_init;
|
#[no_mangle]
|
||||||
pub use crate::stdlib::pthread_mutex_lock;
|
fn pthread_mutex_unlock(__mutex: *mut pthread_mutex_t) -> libc::c_int;
|
||||||
pub use crate::stdlib::pthread_mutex_t;
|
#[no_mangle]
|
||||||
pub use crate::stdlib::pthread_mutex_unlock;
|
fn pthread_mutexattr_init(__attr: *mut pthread_mutexattr_t)
|
||||||
pub use crate::stdlib::pthread_mutexattr_destroy;
|
-> libc::c_int;
|
||||||
pub use crate::stdlib::pthread_mutexattr_init;
|
#[no_mangle]
|
||||||
pub use crate::stdlib::pthread_mutexattr_setprotocol;
|
fn pthread_mutexattr_destroy(__attr: *mut pthread_mutexattr_t)
|
||||||
pub use crate::stdlib::pthread_mutexattr_t;
|
-> libc::c_int;
|
||||||
pub use crate::stdlib::C2RustUnnamed_0;
|
#[no_mangle]
|
||||||
pub use crate::stdlib::PTHREAD_PRIO_INHERIT;
|
fn pthread_mutexattr_setprotocol(__attr: *mut pthread_mutexattr_t,
|
||||||
pub use crate::stdlib::PTHREAD_PRIO_NONE;
|
__protocol: libc::c_int) -> libc::c_int;
|
||||||
pub use crate::stdlib::PTHREAD_PRIO_PROTECT;
|
}
|
||||||
|
pub type size_t = libc::c_ulong;
|
||||||
|
pub type __uint8_t = libc::c_uchar;
|
||||||
|
pub type u_int8_t = __uint8_t;
|
||||||
|
#[derive(Copy, Clone)]
|
||||||
|
#[repr(C)]
|
||||||
|
pub struct __pthread_internal_list {
|
||||||
|
pub __prev: *mut __pthread_internal_list,
|
||||||
|
pub __next: *mut __pthread_internal_list,
|
||||||
|
}
|
||||||
|
pub type __pthread_list_t = __pthread_internal_list;
|
||||||
|
#[derive(Copy, Clone)]
|
||||||
|
#[repr(C)]
|
||||||
|
pub struct __pthread_mutex_s {
|
||||||
|
pub __lock: libc::c_int,
|
||||||
|
pub __count: libc::c_uint,
|
||||||
|
pub __owner: libc::c_int,
|
||||||
|
pub __nusers: libc::c_uint,
|
||||||
|
pub __kind: libc::c_int,
|
||||||
|
pub __spins: libc::c_short,
|
||||||
|
pub __elision: libc::c_short,
|
||||||
|
pub __list: __pthread_list_t,
|
||||||
|
}
|
||||||
|
#[derive(Copy, Clone)]
|
||||||
|
#[repr(C)]
|
||||||
|
pub union pthread_mutexattr_t {
|
||||||
|
pub __size: [libc::c_char; 4],
|
||||||
|
pub __align: libc::c_int,
|
||||||
|
}
|
||||||
|
#[derive(Copy, Clone)]
|
||||||
|
#[repr(C)]
|
||||||
|
pub union pthread_mutex_t {
|
||||||
|
pub __data: __pthread_mutex_s,
|
||||||
|
pub __size: [libc::c_char; 40],
|
||||||
|
pub __align: libc::c_long,
|
||||||
|
}
|
||||||
|
pub type C2RustUnnamed = libc::c_uint;
|
||||||
|
pub const PTHREAD_PRIO_PROTECT: C2RustUnnamed = 2;
|
||||||
|
pub const PTHREAD_PRIO_INHERIT: C2RustUnnamed = 1;
|
||||||
|
pub const PTHREAD_PRIO_NONE: C2RustUnnamed = 0;
|
||||||
|
pub type u8_t = u_int8_t;
|
||||||
|
#[derive(Copy, Clone)]
|
||||||
|
#[repr(C)]
|
||||||
|
pub struct buffer {
|
||||||
|
pub buf: *mut u8_t,
|
||||||
|
pub readp: *mut u8_t,
|
||||||
|
pub writep: *mut u8_t,
|
||||||
|
pub wrap: *mut u8_t,
|
||||||
|
pub size: size_t,
|
||||||
|
pub base_size: size_t,
|
||||||
|
pub mutex: pthread_mutex_t,
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
* Squeezelite - lightweight headless squeezebox emulator
|
* Squeezelite - lightweight headless squeezebox emulator
|
||||||
*
|
*
|
||||||
@ -47,109 +98,91 @@ pub use crate::stdlib::PTHREAD_PRIO_PROTECT;
|
|||||||
// fifo bufffers
|
// fifo bufffers
|
||||||
// _* called with muxtex locked
|
// _* called with muxtex locked
|
||||||
#[inline]
|
#[inline]
|
||||||
|
unsafe extern "C" fn _buf_used(mut buf: *mut buffer) -> libc::c_uint {
|
||||||
unsafe extern "C" fn _buf_used(mut buf: *mut crate::squeezelite_h::buffer) -> libc::c_uint {
|
|
||||||
return if (*buf).writep >= (*buf).readp {
|
return if (*buf).writep >= (*buf).readp {
|
||||||
(*buf).writep.wrapping_offset_from((*buf).readp) as libc::c_long as libc::c_ulong
|
(*buf).writep.wrapping_offset_from((*buf).readp) as
|
||||||
} else {
|
libc::c_long as libc::c_ulong
|
||||||
(*buf).size.wrapping_sub(
|
} else {
|
||||||
(*buf).readp.wrapping_offset_from((*buf).writep) as libc::c_long as libc::c_ulong,
|
(*buf).size.wrapping_sub((*buf).readp.wrapping_offset_from((*buf).writep)
|
||||||
)
|
as libc::c_long as libc::c_ulong)
|
||||||
} as libc::c_uint;
|
} as libc::c_uint;
|
||||||
}
|
}
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
|
pub unsafe extern "C" fn _buf_space(mut buf: *mut buffer) -> libc::c_uint {
|
||||||
pub unsafe extern "C" fn _buf_space(mut buf: *mut crate::squeezelite_h::buffer) -> libc::c_uint {
|
return (*buf).size.wrapping_sub(_buf_used(buf) as
|
||||||
return (*buf)
|
libc::c_ulong).wrapping_sub(1 as
|
||||||
.size
|
libc::c_int
|
||||||
.wrapping_sub(_buf_used(buf) as libc::c_ulong)
|
as
|
||||||
.wrapping_sub(1 as libc::c_int as libc::c_ulong) as libc::c_uint;
|
libc::c_ulong)
|
||||||
|
as libc::c_uint;
|
||||||
// reduce by one as full same as empty otherwise
|
// reduce by one as full same as empty otherwise
|
||||||
}
|
}
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
|
pub unsafe extern "C" fn _buf_cont_read(mut buf: *mut buffer)
|
||||||
pub unsafe extern "C" fn _buf_cont_read(
|
-> libc::c_uint {
|
||||||
mut buf: *mut crate::squeezelite_h::buffer,
|
|
||||||
) -> libc::c_uint {
|
|
||||||
return if (*buf).writep >= (*buf).readp {
|
return if (*buf).writep >= (*buf).readp {
|
||||||
(*buf).writep.wrapping_offset_from((*buf).readp) as libc::c_long
|
(*buf).writep.wrapping_offset_from((*buf).readp) as
|
||||||
} else {
|
libc::c_long
|
||||||
(*buf).wrap.wrapping_offset_from((*buf).readp) as libc::c_long
|
} else {
|
||||||
} as libc::c_uint;
|
(*buf).wrap.wrapping_offset_from((*buf).readp) as libc::c_long
|
||||||
|
} as libc::c_uint;
|
||||||
}
|
}
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
|
pub unsafe extern "C" fn _buf_cont_write(mut buf: *mut buffer)
|
||||||
pub unsafe extern "C" fn _buf_cont_write(
|
-> libc::c_uint {
|
||||||
mut buf: *mut crate::squeezelite_h::buffer,
|
|
||||||
) -> libc::c_uint {
|
|
||||||
return if (*buf).writep >= (*buf).readp {
|
return if (*buf).writep >= (*buf).readp {
|
||||||
(*buf).wrap.wrapping_offset_from((*buf).writep) as libc::c_long
|
(*buf).wrap.wrapping_offset_from((*buf).writep) as libc::c_long
|
||||||
} else {
|
} else {
|
||||||
(*buf).readp.wrapping_offset_from((*buf).writep) as libc::c_long
|
(*buf).readp.wrapping_offset_from((*buf).writep) as
|
||||||
} as libc::c_uint;
|
libc::c_long
|
||||||
|
} as libc::c_uint;
|
||||||
}
|
}
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
|
pub unsafe extern "C" fn _buf_inc_readp(mut buf: *mut buffer,
|
||||||
pub unsafe extern "C" fn _buf_inc_readp(
|
mut by: libc::c_uint) {
|
||||||
mut buf: *mut crate::squeezelite_h::buffer,
|
|
||||||
mut by: libc::c_uint,
|
|
||||||
) {
|
|
||||||
(*buf).readp = (*buf).readp.offset(by as isize);
|
(*buf).readp = (*buf).readp.offset(by as isize);
|
||||||
if (*buf).readp >= (*buf).wrap {
|
if (*buf).readp >= (*buf).wrap {
|
||||||
(*buf).readp = (*buf).readp.offset(-((*buf).size as isize))
|
(*buf).readp = (*buf).readp.offset(-((*buf).size as isize))
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
|
pub unsafe extern "C" fn _buf_inc_writep(mut buf: *mut buffer,
|
||||||
pub unsafe extern "C" fn _buf_inc_writep(
|
mut by: libc::c_uint) {
|
||||||
mut buf: *mut crate::squeezelite_h::buffer,
|
|
||||||
mut by: libc::c_uint,
|
|
||||||
) {
|
|
||||||
(*buf).writep = (*buf).writep.offset(by as isize);
|
(*buf).writep = (*buf).writep.offset(by as isize);
|
||||||
if (*buf).writep >= (*buf).wrap {
|
if (*buf).writep >= (*buf).wrap {
|
||||||
(*buf).writep = (*buf).writep.offset(-((*buf).size as isize))
|
(*buf).writep = (*buf).writep.offset(-((*buf).size as isize))
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
|
pub unsafe extern "C" fn buf_flush(mut buf: *mut buffer) {
|
||||||
pub unsafe extern "C" fn buf_flush(mut buf: *mut crate::squeezelite_h::buffer) {
|
pthread_mutex_lock(&mut (*buf).mutex);
|
||||||
crate::stdlib::pthread_mutex_lock(&mut (*buf).mutex);
|
|
||||||
(*buf).readp = (*buf).buf;
|
(*buf).readp = (*buf).buf;
|
||||||
(*buf).writep = (*buf).buf;
|
(*buf).writep = (*buf).buf;
|
||||||
crate::stdlib::pthread_mutex_unlock(&mut (*buf).mutex);
|
pthread_mutex_unlock(&mut (*buf).mutex);
|
||||||
}
|
}
|
||||||
// adjust buffer to multiple of mod bytes so reading in multiple always wraps on frame boundary
|
// adjust buffer to multiple of mod bytes so reading in multiple always wraps on frame boundary
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
|
pub unsafe extern "C" fn buf_adjust(mut buf: *mut buffer, mut mod_0: size_t) {
|
||||||
pub unsafe extern "C" fn buf_adjust(
|
let mut size: size_t = 0;
|
||||||
mut buf: *mut crate::squeezelite_h::buffer,
|
pthread_mutex_lock(&mut (*buf).mutex);
|
||||||
mut mod_0: crate::stddef_h::size_t,
|
|
||||||
) {
|
|
||||||
let mut size: crate::stddef_h::size_t = 0;
|
|
||||||
crate::stdlib::pthread_mutex_lock(&mut (*buf).mutex);
|
|
||||||
size =
|
size =
|
||||||
((*buf).base_size.wrapping_div(mod_0) as libc::c_uint as libc::c_ulong).wrapping_mul(mod_0);
|
((*buf).base_size.wrapping_div(mod_0) as libc::c_uint as
|
||||||
|
libc::c_ulong).wrapping_mul(mod_0);
|
||||||
(*buf).readp = (*buf).buf;
|
(*buf).readp = (*buf).buf;
|
||||||
(*buf).writep = (*buf).buf;
|
(*buf).writep = (*buf).buf;
|
||||||
(*buf).wrap = (*buf).buf.offset(size as isize);
|
(*buf).wrap = (*buf).buf.offset(size as isize);
|
||||||
(*buf).size = size;
|
(*buf).size = size;
|
||||||
crate::stdlib::pthread_mutex_unlock(&mut (*buf).mutex);
|
pthread_mutex_unlock(&mut (*buf).mutex);
|
||||||
}
|
}
|
||||||
// called with mutex locked to resize, does not retain contents, reverts to original size if fails
|
// called with mutex locked to resize, does not retain contents, reverts to original size if fails
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
|
pub unsafe extern "C" fn _buf_resize(mut buf: *mut buffer, mut size: size_t) {
|
||||||
pub unsafe extern "C" fn _buf_resize(
|
free((*buf).buf as *mut libc::c_void);
|
||||||
mut buf: *mut crate::squeezelite_h::buffer,
|
(*buf).buf = malloc(size) as *mut u8_t;
|
||||||
mut size: crate::stddef_h::size_t,
|
|
||||||
) {
|
|
||||||
crate::stdlib::free((*buf).buf as *mut libc::c_void);
|
|
||||||
(*buf).buf = crate::stdlib::malloc(size) as *mut crate::squeezelite_h::u8_t;
|
|
||||||
if (*buf).buf.is_null() {
|
if (*buf).buf.is_null() {
|
||||||
size = (*buf).size;
|
size = (*buf).size;
|
||||||
(*buf).buf = crate::stdlib::malloc(size) as *mut crate::squeezelite_h::u8_t;
|
(*buf).buf = malloc(size) as *mut u8_t;
|
||||||
if (*buf).buf.is_null() {
|
if (*buf).buf.is_null() { size = 0 as libc::c_int as size_t }
|
||||||
size = 0 as libc::c_int as crate::stddef_h::size_t
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
(*buf).readp = (*buf).buf;
|
(*buf).readp = (*buf).buf;
|
||||||
(*buf).writep = (*buf).buf;
|
(*buf).writep = (*buf).buf;
|
||||||
@ -158,25 +191,19 @@ pub unsafe extern "C" fn _buf_resize(
|
|||||||
(*buf).base_size = size;
|
(*buf).base_size = size;
|
||||||
}
|
}
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
|
pub unsafe extern "C" fn buf_init(mut buf: *mut buffer, mut size: size_t) {
|
||||||
pub unsafe extern "C" fn buf_init(
|
(*buf).buf = malloc(size) as *mut u8_t;
|
||||||
mut buf: *mut crate::squeezelite_h::buffer,
|
|
||||||
mut size: crate::stddef_h::size_t,
|
|
||||||
) {
|
|
||||||
(*buf).buf = crate::stdlib::malloc(size) as *mut crate::squeezelite_h::u8_t;
|
|
||||||
(*buf).readp = (*buf).buf;
|
(*buf).readp = (*buf).buf;
|
||||||
(*buf).writep = (*buf).buf;
|
(*buf).writep = (*buf).buf;
|
||||||
(*buf).wrap = (*buf).buf.offset(size as isize);
|
(*buf).wrap = (*buf).buf.offset(size as isize);
|
||||||
(*buf).size = size;
|
(*buf).size = size;
|
||||||
(*buf).base_size = size;
|
(*buf).base_size = size;
|
||||||
let mut attr = crate::stdlib::pthread_mutexattr_t { __size: [0; 4] };
|
let mut attr: pthread_mutexattr_t = pthread_mutexattr_t{__size: [0; 4],};
|
||||||
crate::stdlib::pthread_mutexattr_init(&mut attr);
|
pthread_mutexattr_init(&mut attr);
|
||||||
crate::stdlib::pthread_mutexattr_setprotocol(
|
pthread_mutexattr_setprotocol(&mut attr,
|
||||||
&mut attr,
|
PTHREAD_PRIO_INHERIT as libc::c_int);
|
||||||
crate::stdlib::PTHREAD_PRIO_INHERIT as libc::c_int,
|
pthread_mutex_init(&mut (*buf).mutex, &mut attr);
|
||||||
);
|
pthread_mutexattr_destroy(&mut attr);
|
||||||
crate::stdlib::pthread_mutex_init(&mut (*buf).mutex, &mut attr);
|
|
||||||
crate::stdlib::pthread_mutexattr_destroy(&mut attr);
|
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* Squeezelite - lightweight headless squeezebox emulator
|
* Squeezelite - lightweight headless squeezebox emulator
|
||||||
@ -215,13 +242,12 @@ pub unsafe extern "C" fn buf_init(
|
|||||||
// buffer.c
|
// buffer.c
|
||||||
// _* called with mutex locked
|
// _* called with mutex locked
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
|
pub unsafe extern "C" fn buf_destroy(mut buf: *mut buffer) {
|
||||||
pub unsafe extern "C" fn buf_destroy(mut buf: *mut crate::squeezelite_h::buffer) {
|
|
||||||
if !(*buf).buf.is_null() {
|
if !(*buf).buf.is_null() {
|
||||||
crate::stdlib::free((*buf).buf as *mut libc::c_void);
|
free((*buf).buf as *mut libc::c_void);
|
||||||
(*buf).buf = 0 as *mut crate::squeezelite_h::u8_t;
|
(*buf).buf = 0 as *mut u8_t;
|
||||||
(*buf).size = 0 as libc::c_int as crate::stddef_h::size_t;
|
(*buf).size = 0 as libc::c_int as size_t;
|
||||||
(*buf).base_size = 0 as libc::c_int as crate::stddef_h::size_t;
|
(*buf).base_size = 0 as libc::c_int as size_t;
|
||||||
crate::stdlib::pthread_mutex_destroy(&mut (*buf).mutex);
|
pthread_mutex_destroy(&mut (*buf).mutex);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
1086
src/decode.rs
1086
src/decode.rs
File diff suppressed because it is too large
Load Diff
2306
src/faad.rs
2306
src/faad.rs
File diff suppressed because it is too large
Load Diff
1892
src/flac.rs
1892
src/flac.rs
File diff suppressed because it is too large
Load Diff
@ -1,9 +0,0 @@
|
|||||||
pub type __builtin_va_list = [crate::internal::__va_list_tag; 1];
|
|
||||||
#[repr(C)]
|
|
||||||
#[derive(Copy, Clone)]
|
|
||||||
pub struct __va_list_tag {
|
|
||||||
pub gp_offset: libc::c_uint,
|
|
||||||
pub fp_offset: libc::c_uint,
|
|
||||||
pub overflow_arg_area: *mut libc::c_void,
|
|
||||||
pub reg_save_area: *mut libc::c_void,
|
|
||||||
}
|
|
1682
src/mad.rs
1682
src/mad.rs
File diff suppressed because it is too large
Load Diff
1273
src/main.rs
1273
src/main.rs
File diff suppressed because it is too large
Load Diff
1297
src/mpg.rs
1297
src/mpg.rs
File diff suppressed because it is too large
Load Diff
1720
src/output.rs
1720
src/output.rs
File diff suppressed because it is too large
Load Diff
3791
src/output_alsa.rs
3791
src/output_alsa.rs
File diff suppressed because it is too large
Load Diff
@ -1,324 +1,350 @@
|
|||||||
use ::libc;
|
use ::libc;
|
||||||
|
extern "C" {
|
||||||
pub use crate::squeezelite_h::frames_t;
|
#[no_mangle]
|
||||||
pub use crate::squeezelite_h::output_format;
|
fn memcpy(_: *mut libc::c_void, _: *const libc::c_void, _: libc::c_ulong)
|
||||||
pub use crate::squeezelite_h::s32_t;
|
-> *mut libc::c_void;
|
||||||
pub use crate::squeezelite_h::s64_t;
|
}
|
||||||
pub use crate::squeezelite_h::u32_t;
|
pub type __uint8_t = libc::c_uchar;
|
||||||
pub use crate::squeezelite_h::u8_t;
|
pub type __int32_t = libc::c_int;
|
||||||
pub use crate::squeezelite_h::S16_LE;
|
pub type __uint32_t = libc::c_uint;
|
||||||
pub use crate::squeezelite_h::S24_3LE;
|
pub type __int64_t = libc::c_long;
|
||||||
pub use crate::squeezelite_h::S24_LE;
|
pub type int32_t = __int32_t;
|
||||||
pub use crate::squeezelite_h::S32_LE;
|
pub type int64_t = __int64_t;
|
||||||
pub use crate::stdlib::__int32_t;
|
pub type u_int8_t = __uint8_t;
|
||||||
pub use crate::stdlib::__int64_t;
|
pub type u_int32_t = __uint32_t;
|
||||||
pub use crate::stdlib::__uint32_t;
|
pub type u8_t = u_int8_t;
|
||||||
pub use crate::stdlib::__uint8_t;
|
pub type u32_t = u_int32_t;
|
||||||
pub use crate::stdlib::int32_t;
|
pub type s32_t = int32_t;
|
||||||
pub use crate::stdlib::int64_t;
|
pub type s64_t = int64_t;
|
||||||
use crate::stdlib::memcpy;
|
pub type frames_t = u32_t;
|
||||||
pub use crate::stdlib::u_int32_t;
|
pub type uintptr_t = libc::c_ulong;
|
||||||
pub use crate::stdlib::u_int8_t;
|
pub type output_format = libc::c_uint;
|
||||||
pub use crate::stdlib::uintptr_t;
|
pub const S16_LE: output_format = 3;
|
||||||
|
pub const S24_3LE: output_format = 2;
|
||||||
|
pub const S24_LE: output_format = 1;
|
||||||
|
pub const S32_LE: output_format = 0;
|
||||||
// inlining these on windows prevents them being linkable...
|
// inlining these on windows prevents them being linkable...
|
||||||
#[inline]
|
#[inline]
|
||||||
|
unsafe extern "C" fn gain(mut gain_0: s32_t, mut sample: s32_t) -> s32_t {
|
||||||
unsafe extern "C" fn gain(
|
let mut res: s64_t = gain_0 as s64_t * sample as s64_t;
|
||||||
mut gain_0: crate::squeezelite_h::s32_t,
|
|
||||||
mut sample: crate::squeezelite_h::s32_t,
|
|
||||||
) -> crate::squeezelite_h::s32_t {
|
|
||||||
let mut res = gain_0 as crate::squeezelite_h::s64_t * sample as crate::squeezelite_h::s64_t;
|
|
||||||
if res as libc::c_longlong > 0x7fffffffffff as libc::c_longlong {
|
if res as libc::c_longlong > 0x7fffffffffff as libc::c_longlong {
|
||||||
res = 0x7fffffffffff as libc::c_longlong as crate::squeezelite_h::s64_t
|
res = 0x7fffffffffff as libc::c_longlong as s64_t
|
||||||
}
|
}
|
||||||
if (res as libc::c_longlong) < -(0x7fffffffffff as libc::c_longlong) {
|
if (res as libc::c_longlong) < -(0x7fffffffffff as libc::c_longlong) {
|
||||||
res = -(0x7fffffffffff as libc::c_longlong) as crate::squeezelite_h::s64_t
|
res = -(0x7fffffffffff as libc::c_longlong) as s64_t
|
||||||
}
|
}
|
||||||
return (res >> 16 as libc::c_int) as crate::squeezelite_h::s32_t;
|
return (res >> 16 as libc::c_int) as s32_t;
|
||||||
}
|
}
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
|
pub unsafe extern "C" fn _scale_and_pack_frames(mut outputptr:
|
||||||
pub unsafe extern "C" fn _scale_and_pack_frames(
|
*mut libc::c_void,
|
||||||
mut outputptr: *mut libc::c_void,
|
mut inputptr: *mut s32_t,
|
||||||
mut inputptr: *mut crate::squeezelite_h::s32_t,
|
mut cnt: frames_t,
|
||||||
mut cnt: crate::squeezelite_h::frames_t,
|
mut gainL: s32_t,
|
||||||
mut gainL: crate::squeezelite_h::s32_t,
|
mut gainR: s32_t,
|
||||||
mut gainR: crate::squeezelite_h::s32_t,
|
mut format: output_format) {
|
||||||
mut format: crate::squeezelite_h::output_format,
|
|
||||||
) {
|
|
||||||
match format as libc::c_uint {
|
match format as libc::c_uint {
|
||||||
3 => {
|
3 => {
|
||||||
let mut optr = outputptr as *mut crate::squeezelite_h::u32_t;
|
let mut optr: *mut u32_t = outputptr as *mut u32_t;
|
||||||
if gainL == 0x10000 as libc::c_int && gainR == 0x10000 as libc::c_int {
|
if gainL == 0x10000 as libc::c_int &&
|
||||||
loop {
|
gainR == 0x10000 as libc::c_int {
|
||||||
|
loop {
|
||||||
let fresh0 = cnt;
|
let fresh0 = cnt;
|
||||||
cnt = cnt.wrapping_sub(1);
|
cnt = cnt.wrapping_sub(1);
|
||||||
if !(fresh0 != 0) {
|
if !(fresh0 != 0) { break ; }
|
||||||
break;
|
|
||||||
}
|
|
||||||
let fresh1 = optr;
|
let fresh1 = optr;
|
||||||
optr = optr.offset(1);
|
optr = optr.offset(1);
|
||||||
*fresh1 = (*inputptr >> 16 as libc::c_int & 0xffff as libc::c_int)
|
*fresh1 =
|
||||||
as libc::c_uint
|
(*inputptr >> 16 as libc::c_int &
|
||||||
| *inputptr.offset(1 as libc::c_int as isize) as libc::c_uint
|
0xffff as libc::c_int) as libc::c_uint |
|
||||||
& 0xffff0000 as libc::c_uint;
|
*inputptr.offset(1 as libc::c_int as isize) as
|
||||||
|
libc::c_uint & 0xffff0000 as libc::c_uint;
|
||||||
inputptr = inputptr.offset(2 as libc::c_int as isize)
|
inputptr = inputptr.offset(2 as libc::c_int as isize)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
loop {
|
loop {
|
||||||
let fresh2 = cnt;
|
let fresh2 = cnt;
|
||||||
cnt = cnt.wrapping_sub(1);
|
cnt = cnt.wrapping_sub(1);
|
||||||
if !(fresh2 != 0) {
|
if !(fresh2 != 0) { break ; }
|
||||||
break;
|
|
||||||
}
|
|
||||||
let fresh3 = optr;
|
let fresh3 = optr;
|
||||||
optr = optr.offset(1);
|
optr = optr.offset(1);
|
||||||
*fresh3 = (gain(gainL, *inputptr) >> 16 as libc::c_int & 0xffff as libc::c_int)
|
*fresh3 =
|
||||||
as libc::c_uint
|
(gain(gainL, *inputptr) >> 16 as libc::c_int &
|
||||||
| gain(gainR, *inputptr.offset(1 as libc::c_int as isize)) as libc::c_uint
|
0xffff as libc::c_int) as libc::c_uint |
|
||||||
& 0xffff0000 as libc::c_uint;
|
gain(gainR,
|
||||||
|
*inputptr.offset(1 as libc::c_int as isize))
|
||||||
|
as libc::c_uint & 0xffff0000 as libc::c_uint;
|
||||||
inputptr = inputptr.offset(2 as libc::c_int as isize)
|
inputptr = inputptr.offset(2 as libc::c_int as isize)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
1 => {
|
1 => {
|
||||||
let mut optr_0 = outputptr as *mut crate::squeezelite_h::u32_t;
|
let mut optr_0: *mut u32_t = outputptr as *mut u32_t;
|
||||||
if gainL == 0x10000 as libc::c_int && gainR == 0x10000 as libc::c_int {
|
if gainL == 0x10000 as libc::c_int &&
|
||||||
loop {
|
gainR == 0x10000 as libc::c_int {
|
||||||
|
loop {
|
||||||
let fresh4 = cnt;
|
let fresh4 = cnt;
|
||||||
cnt = cnt.wrapping_sub(1);
|
cnt = cnt.wrapping_sub(1);
|
||||||
if !(fresh4 != 0) {
|
if !(fresh4 != 0) { break ; }
|
||||||
break;
|
|
||||||
}
|
|
||||||
let fresh5 = inputptr;
|
let fresh5 = inputptr;
|
||||||
inputptr = inputptr.offset(1);
|
inputptr = inputptr.offset(1);
|
||||||
let fresh6 = optr_0;
|
let fresh6 = optr_0;
|
||||||
optr_0 = optr_0.offset(1);
|
optr_0 = optr_0.offset(1);
|
||||||
*fresh6 = (*fresh5 >> 8 as libc::c_int) as crate::squeezelite_h::u32_t;
|
*fresh6 = (*fresh5 >> 8 as libc::c_int) as u32_t;
|
||||||
let fresh7 = inputptr;
|
let fresh7 = inputptr;
|
||||||
inputptr = inputptr.offset(1);
|
inputptr = inputptr.offset(1);
|
||||||
let fresh8 = optr_0;
|
let fresh8 = optr_0;
|
||||||
optr_0 = optr_0.offset(1);
|
optr_0 = optr_0.offset(1);
|
||||||
*fresh8 = (*fresh7 >> 8 as libc::c_int) as crate::squeezelite_h::u32_t
|
*fresh8 = (*fresh7 >> 8 as libc::c_int) as u32_t
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
loop {
|
loop {
|
||||||
let fresh9 = cnt;
|
let fresh9 = cnt;
|
||||||
cnt = cnt.wrapping_sub(1);
|
cnt = cnt.wrapping_sub(1);
|
||||||
if !(fresh9 != 0) {
|
if !(fresh9 != 0) { break ; }
|
||||||
break;
|
|
||||||
}
|
|
||||||
let fresh10 = inputptr;
|
let fresh10 = inputptr;
|
||||||
inputptr = inputptr.offset(1);
|
inputptr = inputptr.offset(1);
|
||||||
let fresh11 = optr_0;
|
let fresh11 = optr_0;
|
||||||
optr_0 = optr_0.offset(1);
|
optr_0 = optr_0.offset(1);
|
||||||
*fresh11 =
|
*fresh11 =
|
||||||
(gain(gainL, *fresh10) >> 8 as libc::c_int) as crate::squeezelite_h::u32_t;
|
(gain(gainL, *fresh10) >> 8 as libc::c_int) as u32_t;
|
||||||
let fresh12 = inputptr;
|
let fresh12 = inputptr;
|
||||||
inputptr = inputptr.offset(1);
|
inputptr = inputptr.offset(1);
|
||||||
let fresh13 = optr_0;
|
let fresh13 = optr_0;
|
||||||
optr_0 = optr_0.offset(1);
|
optr_0 = optr_0.offset(1);
|
||||||
*fresh13 =
|
*fresh13 =
|
||||||
(gain(gainR, *fresh12) >> 8 as libc::c_int) as crate::squeezelite_h::u32_t
|
(gain(gainR, *fresh12) >> 8 as libc::c_int) as u32_t
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
2 => {
|
2 => {
|
||||||
let mut optr_1 = outputptr as *mut crate::squeezelite_h::u8_t;
|
let mut optr_1: *mut u8_t = outputptr as *mut u8_t;
|
||||||
if gainL == 0x10000 as libc::c_int && gainR == 0x10000 as libc::c_int {
|
if gainL == 0x10000 as libc::c_int &&
|
||||||
|
gainR == 0x10000 as libc::c_int {
|
||||||
while cnt != 0 {
|
while cnt != 0 {
|
||||||
// attempt to do 32 bit memory accesses - move 2 frames at once: 16 bytes -> 12 bytes
|
// attempt to do 32 bit memory accesses - move 2 frames at once: 16 bytes -> 12 bytes
|
||||||
// falls through to exception case when not aligned or if less than 2 frames to move
|
// falls through to exception case when not aligned or if less than 2 frames to move
|
||||||
if optr_1 as crate::stdlib::uintptr_t & 0x3 as libc::c_int as libc::c_ulong
|
if optr_1 as uintptr_t &
|
||||||
== 0 as libc::c_int as libc::c_ulong
|
0x3 as libc::c_int as libc::c_ulong ==
|
||||||
&& cnt >= 2 as libc::c_int as libc::c_uint
|
0 as libc::c_int as libc::c_ulong &&
|
||||||
{
|
cnt >= 2 as libc::c_int as libc::c_uint {
|
||||||
let mut o_ptr =
|
let mut o_ptr: *mut u32_t =
|
||||||
optr_1 as *mut libc::c_void as *mut crate::squeezelite_h::u32_t;
|
optr_1 as *mut libc::c_void as *mut u32_t;
|
||||||
while cnt >= 2 as libc::c_int as libc::c_uint {
|
while cnt >= 2 as libc::c_int as libc::c_uint {
|
||||||
let fresh14 = inputptr;
|
let fresh14 = inputptr;
|
||||||
inputptr = inputptr.offset(1);
|
inputptr = inputptr.offset(1);
|
||||||
let mut l1 = *fresh14;
|
let mut l1: s32_t = *fresh14;
|
||||||
let fresh15 = inputptr;
|
let fresh15 = inputptr;
|
||||||
inputptr = inputptr.offset(1);
|
inputptr = inputptr.offset(1);
|
||||||
let mut r1 = *fresh15;
|
let mut r1: s32_t = *fresh15;
|
||||||
let fresh16 = inputptr;
|
let fresh16 = inputptr;
|
||||||
inputptr = inputptr.offset(1);
|
inputptr = inputptr.offset(1);
|
||||||
let mut l2 = *fresh16;
|
let mut l2: s32_t = *fresh16;
|
||||||
let fresh17 = inputptr;
|
let fresh17 = inputptr;
|
||||||
inputptr = inputptr.offset(1);
|
inputptr = inputptr.offset(1);
|
||||||
let mut r2 = *fresh17;
|
let mut r2: s32_t = *fresh17;
|
||||||
let fresh18 = o_ptr;
|
let fresh18 = o_ptr;
|
||||||
o_ptr = o_ptr.offset(1);
|
o_ptr = o_ptr.offset(1);
|
||||||
*fresh18 = (l1 as libc::c_uint & 0xffffff00 as libc::c_uint)
|
*fresh18 =
|
||||||
>> 8 as libc::c_int
|
(l1 as libc::c_uint &
|
||||||
| ((r1 & 0xff00 as libc::c_int) << 16 as libc::c_int)
|
0xffffff00 as libc::c_uint) >>
|
||||||
as libc::c_uint;
|
8 as libc::c_int |
|
||||||
|
((r1 & 0xff00 as libc::c_int) <<
|
||||||
|
16 as libc::c_int) as libc::c_uint;
|
||||||
let fresh19 = o_ptr;
|
let fresh19 = o_ptr;
|
||||||
o_ptr = o_ptr.offset(1);
|
o_ptr = o_ptr.offset(1);
|
||||||
*fresh19 = (r1 as libc::c_uint & 0xffff0000 as libc::c_uint)
|
*fresh19 =
|
||||||
>> 16 as libc::c_int
|
(r1 as libc::c_uint &
|
||||||
| ((l2 & 0xffff00 as libc::c_int) << 8 as libc::c_int)
|
0xffff0000 as libc::c_uint) >>
|
||||||
as libc::c_uint;
|
16 as libc::c_int |
|
||||||
|
((l2 & 0xffff00 as libc::c_int) <<
|
||||||
|
8 as libc::c_int) as libc::c_uint;
|
||||||
let fresh20 = o_ptr;
|
let fresh20 = o_ptr;
|
||||||
o_ptr = o_ptr.offset(1);
|
o_ptr = o_ptr.offset(1);
|
||||||
*fresh20 = (l2 as libc::c_uint & 0xff000000 as libc::c_uint)
|
*fresh20 =
|
||||||
>> 24 as libc::c_int
|
(l2 as libc::c_uint &
|
||||||
| r2 as libc::c_uint & 0xffffff00 as libc::c_uint;
|
0xff000000 as libc::c_uint) >>
|
||||||
optr_1 = optr_1.offset(12 as libc::c_int as isize);
|
24 as libc::c_int |
|
||||||
cnt = (cnt as libc::c_uint)
|
r2 as libc::c_uint &
|
||||||
.wrapping_sub(2 as libc::c_int as libc::c_uint)
|
0xffffff00 as libc::c_uint;
|
||||||
as crate::squeezelite_h::frames_t
|
optr_1 =
|
||||||
as crate::squeezelite_h::frames_t
|
optr_1.offset(12 as libc::c_int as isize);
|
||||||
|
cnt =
|
||||||
|
(cnt as
|
||||||
|
libc::c_uint).wrapping_sub(2 as
|
||||||
|
libc::c_int
|
||||||
|
as
|
||||||
|
libc::c_uint)
|
||||||
|
as frames_t as frames_t
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
let fresh21 = inputptr;
|
let fresh21 = inputptr;
|
||||||
inputptr = inputptr.offset(1);
|
inputptr = inputptr.offset(1);
|
||||||
let mut lsample = *fresh21;
|
let mut lsample: s32_t = *fresh21;
|
||||||
let fresh22 = inputptr;
|
let fresh22 = inputptr;
|
||||||
inputptr = inputptr.offset(1);
|
inputptr = inputptr.offset(1);
|
||||||
let mut rsample = *fresh22;
|
let mut rsample: s32_t = *fresh22;
|
||||||
let fresh23 = optr_1;
|
let fresh23 = optr_1;
|
||||||
optr_1 = optr_1.offset(1);
|
optr_1 = optr_1.offset(1);
|
||||||
*fresh23 = ((lsample & 0xff00 as libc::c_int) >> 8 as libc::c_int)
|
*fresh23 =
|
||||||
as crate::squeezelite_h::u8_t;
|
((lsample & 0xff00 as libc::c_int) >>
|
||||||
|
8 as libc::c_int) as u8_t;
|
||||||
let fresh24 = optr_1;
|
let fresh24 = optr_1;
|
||||||
optr_1 = optr_1.offset(1);
|
optr_1 = optr_1.offset(1);
|
||||||
*fresh24 = ((lsample & 0xff0000 as libc::c_int) >> 16 as libc::c_int)
|
*fresh24 =
|
||||||
as crate::squeezelite_h::u8_t;
|
((lsample & 0xff0000 as libc::c_int) >>
|
||||||
|
16 as libc::c_int) as u8_t;
|
||||||
let fresh25 = optr_1;
|
let fresh25 = optr_1;
|
||||||
optr_1 = optr_1.offset(1);
|
optr_1 = optr_1.offset(1);
|
||||||
*fresh25 = ((lsample as libc::c_uint & 0xff000000 as libc::c_uint)
|
*fresh25 =
|
||||||
>> 24 as libc::c_int)
|
((lsample as libc::c_uint &
|
||||||
as crate::squeezelite_h::u8_t;
|
0xff000000 as libc::c_uint) >>
|
||||||
|
24 as libc::c_int) as u8_t;
|
||||||
let fresh26 = optr_1;
|
let fresh26 = optr_1;
|
||||||
optr_1 = optr_1.offset(1);
|
optr_1 = optr_1.offset(1);
|
||||||
*fresh26 = ((rsample & 0xff00 as libc::c_int) >> 8 as libc::c_int)
|
*fresh26 =
|
||||||
as crate::squeezelite_h::u8_t;
|
((rsample & 0xff00 as libc::c_int) >>
|
||||||
|
8 as libc::c_int) as u8_t;
|
||||||
let fresh27 = optr_1;
|
let fresh27 = optr_1;
|
||||||
optr_1 = optr_1.offset(1);
|
optr_1 = optr_1.offset(1);
|
||||||
*fresh27 = ((rsample & 0xff0000 as libc::c_int) >> 16 as libc::c_int)
|
*fresh27 =
|
||||||
as crate::squeezelite_h::u8_t;
|
((rsample & 0xff0000 as libc::c_int) >>
|
||||||
|
16 as libc::c_int) as u8_t;
|
||||||
let fresh28 = optr_1;
|
let fresh28 = optr_1;
|
||||||
optr_1 = optr_1.offset(1);
|
optr_1 = optr_1.offset(1);
|
||||||
*fresh28 = ((rsample as libc::c_uint & 0xff000000 as libc::c_uint)
|
*fresh28 =
|
||||||
>> 24 as libc::c_int)
|
((rsample as libc::c_uint &
|
||||||
as crate::squeezelite_h::u8_t;
|
0xff000000 as libc::c_uint) >>
|
||||||
|
24 as libc::c_int) as u8_t;
|
||||||
cnt = cnt.wrapping_sub(1)
|
cnt = cnt.wrapping_sub(1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
while cnt != 0 {
|
while cnt != 0 {
|
||||||
// attempt to do 32 bit memory accesses - move 2 frames at once: 16 bytes -> 12 bytes
|
// attempt to do 32 bit memory accesses - move 2 frames at once: 16 bytes -> 12 bytes
|
||||||
// falls through to exception case when not aligned or if less than 2 frames to move
|
// falls through to exception case when not aligned or if less than 2 frames to move
|
||||||
if optr_1 as crate::stdlib::uintptr_t & 0x3 as libc::c_int as libc::c_ulong
|
if optr_1 as uintptr_t &
|
||||||
== 0 as libc::c_int as libc::c_ulong
|
0x3 as libc::c_int as libc::c_ulong ==
|
||||||
&& cnt >= 2 as libc::c_int as libc::c_uint
|
0 as libc::c_int as libc::c_ulong &&
|
||||||
{
|
cnt >= 2 as libc::c_int as libc::c_uint {
|
||||||
let mut o_ptr_0 =
|
let mut o_ptr_0: *mut u32_t =
|
||||||
optr_1 as *mut libc::c_void as *mut crate::squeezelite_h::u32_t;
|
optr_1 as *mut libc::c_void as *mut u32_t;
|
||||||
while cnt >= 2 as libc::c_int as libc::c_uint {
|
while cnt >= 2 as libc::c_int as libc::c_uint {
|
||||||
let fresh29 = inputptr;
|
let fresh29 = inputptr;
|
||||||
inputptr = inputptr.offset(1);
|
inputptr = inputptr.offset(1);
|
||||||
let mut l1_0 = gain(gainL, *fresh29);
|
let mut l1_0: s32_t = gain(gainL, *fresh29);
|
||||||
let fresh30 = inputptr;
|
let fresh30 = inputptr;
|
||||||
inputptr = inputptr.offset(1);
|
inputptr = inputptr.offset(1);
|
||||||
let mut r1_0 = gain(gainR, *fresh30);
|
let mut r1_0: s32_t = gain(gainR, *fresh30);
|
||||||
let fresh31 = inputptr;
|
let fresh31 = inputptr;
|
||||||
inputptr = inputptr.offset(1);
|
inputptr = inputptr.offset(1);
|
||||||
let mut l2_0 = gain(gainL, *fresh31);
|
let mut l2_0: s32_t = gain(gainL, *fresh31);
|
||||||
let fresh32 = inputptr;
|
let fresh32 = inputptr;
|
||||||
inputptr = inputptr.offset(1);
|
inputptr = inputptr.offset(1);
|
||||||
let mut r2_0 = gain(gainR, *fresh32);
|
let mut r2_0: s32_t = gain(gainR, *fresh32);
|
||||||
let fresh33 = o_ptr_0;
|
let fresh33 = o_ptr_0;
|
||||||
o_ptr_0 = o_ptr_0.offset(1);
|
o_ptr_0 = o_ptr_0.offset(1);
|
||||||
*fresh33 = (l1_0 as libc::c_uint & 0xffffff00 as libc::c_uint)
|
*fresh33 =
|
||||||
>> 8 as libc::c_int
|
(l1_0 as libc::c_uint &
|
||||||
| ((r1_0 & 0xff00 as libc::c_int) << 16 as libc::c_int)
|
0xffffff00 as libc::c_uint) >>
|
||||||
as libc::c_uint;
|
8 as libc::c_int |
|
||||||
|
((r1_0 & 0xff00 as libc::c_int) <<
|
||||||
|
16 as libc::c_int) as libc::c_uint;
|
||||||
let fresh34 = o_ptr_0;
|
let fresh34 = o_ptr_0;
|
||||||
o_ptr_0 = o_ptr_0.offset(1);
|
o_ptr_0 = o_ptr_0.offset(1);
|
||||||
*fresh34 = (r1_0 as libc::c_uint & 0xffff0000 as libc::c_uint)
|
*fresh34 =
|
||||||
>> 16 as libc::c_int
|
(r1_0 as libc::c_uint &
|
||||||
| ((l2_0 & 0xffff00 as libc::c_int) << 8 as libc::c_int)
|
0xffff0000 as libc::c_uint) >>
|
||||||
as libc::c_uint;
|
16 as libc::c_int |
|
||||||
|
((l2_0 & 0xffff00 as libc::c_int) <<
|
||||||
|
8 as libc::c_int) as libc::c_uint;
|
||||||
let fresh35 = o_ptr_0;
|
let fresh35 = o_ptr_0;
|
||||||
o_ptr_0 = o_ptr_0.offset(1);
|
o_ptr_0 = o_ptr_0.offset(1);
|
||||||
*fresh35 = (l2_0 as libc::c_uint & 0xff000000 as libc::c_uint)
|
*fresh35 =
|
||||||
>> 24 as libc::c_int
|
(l2_0 as libc::c_uint &
|
||||||
| r2_0 as libc::c_uint & 0xffffff00 as libc::c_uint;
|
0xff000000 as libc::c_uint) >>
|
||||||
optr_1 = optr_1.offset(12 as libc::c_int as isize);
|
24 as libc::c_int |
|
||||||
cnt = (cnt as libc::c_uint)
|
r2_0 as libc::c_uint &
|
||||||
.wrapping_sub(2 as libc::c_int as libc::c_uint)
|
0xffffff00 as libc::c_uint;
|
||||||
as crate::squeezelite_h::frames_t
|
optr_1 =
|
||||||
as crate::squeezelite_h::frames_t
|
optr_1.offset(12 as libc::c_int as isize);
|
||||||
|
cnt =
|
||||||
|
(cnt as
|
||||||
|
libc::c_uint).wrapping_sub(2 as
|
||||||
|
libc::c_int
|
||||||
|
as
|
||||||
|
libc::c_uint)
|
||||||
|
as frames_t as frames_t
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
let fresh36 = inputptr;
|
let fresh36 = inputptr;
|
||||||
inputptr = inputptr.offset(1);
|
inputptr = inputptr.offset(1);
|
||||||
let mut lsample_0 = gain(gainL, *fresh36);
|
let mut lsample_0: s32_t = gain(gainL, *fresh36);
|
||||||
let fresh37 = inputptr;
|
let fresh37 = inputptr;
|
||||||
inputptr = inputptr.offset(1);
|
inputptr = inputptr.offset(1);
|
||||||
let mut rsample_0 = gain(gainR, *fresh37);
|
let mut rsample_0: s32_t = gain(gainR, *fresh37);
|
||||||
let fresh38 = optr_1;
|
let fresh38 = optr_1;
|
||||||
optr_1 = optr_1.offset(1);
|
optr_1 = optr_1.offset(1);
|
||||||
*fresh38 = ((lsample_0 & 0xff00 as libc::c_int) >> 8 as libc::c_int)
|
*fresh38 =
|
||||||
as crate::squeezelite_h::u8_t;
|
((lsample_0 & 0xff00 as libc::c_int) >>
|
||||||
|
8 as libc::c_int) as u8_t;
|
||||||
let fresh39 = optr_1;
|
let fresh39 = optr_1;
|
||||||
optr_1 = optr_1.offset(1);
|
optr_1 = optr_1.offset(1);
|
||||||
*fresh39 = ((lsample_0 & 0xff0000 as libc::c_int) >> 16 as libc::c_int)
|
*fresh39 =
|
||||||
as crate::squeezelite_h::u8_t;
|
((lsample_0 & 0xff0000 as libc::c_int) >>
|
||||||
|
16 as libc::c_int) as u8_t;
|
||||||
let fresh40 = optr_1;
|
let fresh40 = optr_1;
|
||||||
optr_1 = optr_1.offset(1);
|
optr_1 = optr_1.offset(1);
|
||||||
*fresh40 = ((lsample_0 as libc::c_uint & 0xff000000 as libc::c_uint)
|
*fresh40 =
|
||||||
>> 24 as libc::c_int)
|
((lsample_0 as libc::c_uint &
|
||||||
as crate::squeezelite_h::u8_t;
|
0xff000000 as libc::c_uint) >>
|
||||||
|
24 as libc::c_int) as u8_t;
|
||||||
let fresh41 = optr_1;
|
let fresh41 = optr_1;
|
||||||
optr_1 = optr_1.offset(1);
|
optr_1 = optr_1.offset(1);
|
||||||
*fresh41 = ((rsample_0 & 0xff00 as libc::c_int) >> 8 as libc::c_int)
|
*fresh41 =
|
||||||
as crate::squeezelite_h::u8_t;
|
((rsample_0 & 0xff00 as libc::c_int) >>
|
||||||
|
8 as libc::c_int) as u8_t;
|
||||||
let fresh42 = optr_1;
|
let fresh42 = optr_1;
|
||||||
optr_1 = optr_1.offset(1);
|
optr_1 = optr_1.offset(1);
|
||||||
*fresh42 = ((rsample_0 & 0xff0000 as libc::c_int) >> 16 as libc::c_int)
|
*fresh42 =
|
||||||
as crate::squeezelite_h::u8_t;
|
((rsample_0 & 0xff0000 as libc::c_int) >>
|
||||||
|
16 as libc::c_int) as u8_t;
|
||||||
let fresh43 = optr_1;
|
let fresh43 = optr_1;
|
||||||
optr_1 = optr_1.offset(1);
|
optr_1 = optr_1.offset(1);
|
||||||
*fresh43 = ((rsample_0 as libc::c_uint & 0xff000000 as libc::c_uint)
|
*fresh43 =
|
||||||
>> 24 as libc::c_int)
|
((rsample_0 as libc::c_uint &
|
||||||
as crate::squeezelite_h::u8_t;
|
0xff000000 as libc::c_uint) >>
|
||||||
|
24 as libc::c_int) as u8_t;
|
||||||
cnt = cnt.wrapping_sub(1)
|
cnt = cnt.wrapping_sub(1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
0 => {
|
0 => {
|
||||||
let mut optr_2 = outputptr as *mut crate::squeezelite_h::u32_t;
|
let mut optr_2: *mut u32_t = outputptr as *mut u32_t;
|
||||||
if gainL == 0x10000 as libc::c_int && gainR == 0x10000 as libc::c_int {
|
if gainL == 0x10000 as libc::c_int &&
|
||||||
crate::stdlib::memcpy(
|
gainR == 0x10000 as libc::c_int {
|
||||||
outputptr,
|
memcpy(outputptr, inputptr as *const libc::c_void,
|
||||||
inputptr as *const libc::c_void,
|
cnt.wrapping_mul(8 as libc::c_int as libc::c_uint) as
|
||||||
cnt.wrapping_mul(8 as libc::c_int as libc::c_uint) as libc::c_ulong,
|
libc::c_ulong);
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
loop {
|
loop {
|
||||||
let fresh44 = cnt;
|
let fresh44 = cnt;
|
||||||
cnt = cnt.wrapping_sub(1);
|
cnt = cnt.wrapping_sub(1);
|
||||||
if !(fresh44 != 0) {
|
if !(fresh44 != 0) { break ; }
|
||||||
break;
|
|
||||||
}
|
|
||||||
let fresh45 = inputptr;
|
let fresh45 = inputptr;
|
||||||
inputptr = inputptr.offset(1);
|
inputptr = inputptr.offset(1);
|
||||||
let fresh46 = optr_2;
|
let fresh46 = optr_2;
|
||||||
optr_2 = optr_2.offset(1);
|
optr_2 = optr_2.offset(1);
|
||||||
*fresh46 = gain(gainL, *fresh45) as crate::squeezelite_h::u32_t;
|
*fresh46 = gain(gainL, *fresh45) as u32_t;
|
||||||
let fresh47 = inputptr;
|
let fresh47 = inputptr;
|
||||||
inputptr = inputptr.offset(1);
|
inputptr = inputptr.offset(1);
|
||||||
let fresh48 = optr_2;
|
let fresh48 = optr_2;
|
||||||
optr_2 = optr_2.offset(1);
|
optr_2 = optr_2.offset(1);
|
||||||
*fresh48 = gain(gainR, *fresh47) as crate::squeezelite_h::u32_t
|
*fresh48 = gain(gainR, *fresh47) as u32_t
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => {}
|
_ => { }
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -1,274 +1,384 @@
|
|||||||
use ::libc;
|
use ::libc;
|
||||||
|
|
||||||
pub use crate::stddef_h::size_t;
|
|
||||||
|
|
||||||
pub use crate::stdlib::_IO_codecvt;
|
|
||||||
pub use crate::stdlib::_IO_lock_t;
|
|
||||||
pub use crate::stdlib::_IO_marker;
|
|
||||||
pub use crate::stdlib::_IO_wide_data;
|
|
||||||
pub use crate::stdlib::__int32_t;
|
|
||||||
pub use crate::stdlib::__off64_t;
|
|
||||||
pub use crate::stdlib::__off_t;
|
|
||||||
pub use crate::stdlib::__uint32_t;
|
|
||||||
pub use crate::stdlib::__uint8_t;
|
|
||||||
pub use crate::stdlib::int32_t;
|
|
||||||
pub use crate::stdlib::FILE;
|
|
||||||
pub use crate::stdlib::_IO_FILE;
|
|
||||||
|
|
||||||
pub use crate::squeezelite_h::_apply_cross;
|
|
||||||
pub use crate::squeezelite_h::buffer;
|
|
||||||
pub use crate::squeezelite_h::fade_dir;
|
|
||||||
pub use crate::squeezelite_h::fade_mode;
|
|
||||||
pub use crate::squeezelite_h::fade_state;
|
|
||||||
pub use crate::squeezelite_h::frames_t;
|
|
||||||
pub use crate::squeezelite_h::lDEBUG;
|
|
||||||
pub use crate::squeezelite_h::lERROR;
|
|
||||||
pub use crate::squeezelite_h::lINFO;
|
|
||||||
pub use crate::squeezelite_h::lSDEBUG;
|
|
||||||
pub use crate::squeezelite_h::lWARN;
|
|
||||||
pub use crate::squeezelite_h::log_level;
|
|
||||||
pub use crate::squeezelite_h::output_format;
|
|
||||||
pub use crate::squeezelite_h::output_state;
|
|
||||||
pub use crate::squeezelite_h::outputstate;
|
|
||||||
pub use crate::squeezelite_h::s32_t;
|
|
||||||
pub use crate::squeezelite_h::u32_t;
|
|
||||||
pub use crate::squeezelite_h::u8_t;
|
|
||||||
pub use crate::squeezelite_h::C2RustUnnamed_1;
|
|
||||||
pub use crate::squeezelite_h::FADE_ACTIVE;
|
|
||||||
pub use crate::squeezelite_h::FADE_CROSS;
|
|
||||||
pub use crate::squeezelite_h::FADE_CROSSFADE;
|
|
||||||
pub use crate::squeezelite_h::FADE_DOWN;
|
|
||||||
pub use crate::squeezelite_h::FADE_DUE;
|
|
||||||
pub use crate::squeezelite_h::FADE_IN;
|
|
||||||
pub use crate::squeezelite_h::FADE_INACTIVE;
|
|
||||||
pub use crate::squeezelite_h::FADE_INOUT;
|
|
||||||
pub use crate::squeezelite_h::FADE_NONE;
|
|
||||||
pub use crate::squeezelite_h::FADE_OUT;
|
|
||||||
pub use crate::squeezelite_h::FADE_UP;
|
|
||||||
pub use crate::squeezelite_h::OUTPUT_BUFFER;
|
|
||||||
pub use crate::squeezelite_h::OUTPUT_OFF;
|
|
||||||
pub use crate::squeezelite_h::OUTPUT_PAUSE_FRAMES;
|
|
||||||
pub use crate::squeezelite_h::OUTPUT_RUNNING;
|
|
||||||
pub use crate::squeezelite_h::OUTPUT_SKIP_FRAMES;
|
|
||||||
pub use crate::squeezelite_h::OUTPUT_START_AT;
|
|
||||||
pub use crate::squeezelite_h::OUTPUT_STOPPED;
|
|
||||||
pub use crate::squeezelite_h::S16_LE;
|
|
||||||
pub use crate::squeezelite_h::S24_3LE;
|
|
||||||
pub use crate::squeezelite_h::S24_LE;
|
|
||||||
pub use crate::squeezelite_h::S32_LE;
|
|
||||||
pub use crate::src::output::_output_frames;
|
|
||||||
pub use crate::src::output::output_close_common;
|
|
||||||
pub use crate::src::output::output_init_common;
|
|
||||||
pub use crate::src::output_pack::_scale_and_pack_frames;
|
|
||||||
pub use crate::src::utils::gettime_ms;
|
|
||||||
pub use crate::src::utils::logprint;
|
|
||||||
pub use crate::src::utils::logtime;
|
|
||||||
pub use crate::stdlib::__pthread_internal_list;
|
|
||||||
pub use crate::stdlib::__pthread_list_t;
|
|
||||||
pub use crate::stdlib::__pthread_mutex_s;
|
|
||||||
use crate::stdlib::free;
|
|
||||||
use crate::stdlib::fwrite;
|
|
||||||
use crate::stdlib::malloc;
|
|
||||||
use crate::stdlib::memset;
|
|
||||||
use crate::stdlib::pthread_attr_destroy;
|
|
||||||
use crate::stdlib::pthread_attr_init;
|
|
||||||
use crate::stdlib::pthread_attr_setstacksize;
|
|
||||||
pub use crate::stdlib::pthread_attr_t;
|
|
||||||
use crate::stdlib::pthread_create;
|
|
||||||
use crate::stdlib::pthread_mutex_lock;
|
|
||||||
pub use crate::stdlib::pthread_mutex_t;
|
|
||||||
use crate::stdlib::pthread_mutex_unlock;
|
|
||||||
pub use crate::stdlib::pthread_t;
|
|
||||||
use crate::stdlib::stdout;
|
|
||||||
use crate::stdlib::strcmp;
|
|
||||||
pub use crate::stdlib::u_int32_t;
|
|
||||||
pub use crate::stdlib::u_int8_t;
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
pub type _IO_wide_data;
|
||||||
|
pub type _IO_codecvt;
|
||||||
|
pub type _IO_marker;
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub static mut output: crate::squeezelite_h::outputstate;
|
static mut stdout: *mut FILE;
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub static mut outputbuf: *mut crate::squeezelite_h::buffer;
|
fn fwrite(_: *const libc::c_void, _: libc::c_ulong, _: libc::c_ulong,
|
||||||
|
_: *mut FILE) -> libc::c_ulong;
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub static mut silencebuf: *mut crate::squeezelite_h::u8_t;
|
fn malloc(_: libc::c_ulong) -> *mut libc::c_void;
|
||||||
|
#[no_mangle]
|
||||||
|
fn free(__ptr: *mut libc::c_void);
|
||||||
|
#[no_mangle]
|
||||||
|
fn memset(_: *mut libc::c_void, _: libc::c_int, _: libc::c_ulong)
|
||||||
|
-> *mut libc::c_void;
|
||||||
|
#[no_mangle]
|
||||||
|
fn strcmp(_: *const libc::c_char, _: *const libc::c_char) -> libc::c_int;
|
||||||
|
#[no_mangle]
|
||||||
|
fn _apply_cross(outputbuf_0: *mut buffer, out_frames: frames_t,
|
||||||
|
cross_gain_in: s32_t, cross_gain_out: s32_t,
|
||||||
|
cross_ptr: *mut *mut s32_t);
|
||||||
|
#[no_mangle]
|
||||||
|
fn _scale_and_pack_frames(outputptr: *mut libc::c_void,
|
||||||
|
inputptr: *mut s32_t, cnt: frames_t,
|
||||||
|
gainL: s32_t, gainR: s32_t,
|
||||||
|
format: output_format);
|
||||||
|
#[no_mangle]
|
||||||
|
fn _output_frames(avail: frames_t) -> frames_t;
|
||||||
|
#[no_mangle]
|
||||||
|
fn output_close_common();
|
||||||
|
#[no_mangle]
|
||||||
|
fn output_init_common(level: log_level, device: *const libc::c_char,
|
||||||
|
output_buf_size: libc::c_uint,
|
||||||
|
rates: *mut libc::c_uint, idle: libc::c_uint);
|
||||||
|
#[no_mangle]
|
||||||
|
fn pthread_create(__newthread: *mut pthread_t,
|
||||||
|
__attr: *const pthread_attr_t,
|
||||||
|
__start_routine:
|
||||||
|
Option<unsafe extern "C" fn(_: *mut libc::c_void)
|
||||||
|
-> *mut libc::c_void>,
|
||||||
|
__arg: *mut libc::c_void) -> libc::c_int;
|
||||||
|
#[no_mangle]
|
||||||
|
fn pthread_attr_init(__attr: *mut pthread_attr_t) -> libc::c_int;
|
||||||
|
#[no_mangle]
|
||||||
|
fn pthread_attr_destroy(__attr: *mut pthread_attr_t) -> libc::c_int;
|
||||||
|
#[no_mangle]
|
||||||
|
fn pthread_attr_setstacksize(__attr: *mut pthread_attr_t,
|
||||||
|
__stacksize: size_t) -> libc::c_int;
|
||||||
|
#[no_mangle]
|
||||||
|
fn pthread_mutex_lock(__mutex: *mut pthread_mutex_t) -> libc::c_int;
|
||||||
|
#[no_mangle]
|
||||||
|
fn pthread_mutex_unlock(__mutex: *mut pthread_mutex_t) -> libc::c_int;
|
||||||
|
#[no_mangle]
|
||||||
|
fn logtime() -> *const libc::c_char;
|
||||||
|
#[no_mangle]
|
||||||
|
fn logprint(fmt: *const libc::c_char, _: ...);
|
||||||
|
#[no_mangle]
|
||||||
|
fn gettime_ms() -> u32_t;
|
||||||
|
#[no_mangle]
|
||||||
|
static mut output: outputstate;
|
||||||
|
#[no_mangle]
|
||||||
|
static mut outputbuf: *mut buffer;
|
||||||
|
#[no_mangle]
|
||||||
|
static mut silencebuf: *mut u8_t;
|
||||||
}
|
}
|
||||||
|
pub type size_t = libc::c_ulong;
|
||||||
static mut loglevel: crate::squeezelite_h::log_level = crate::squeezelite_h::lERROR;
|
pub type __uint8_t = libc::c_uchar;
|
||||||
|
pub type __int32_t = libc::c_int;
|
||||||
|
pub type __uint32_t = libc::c_uint;
|
||||||
|
pub type __off_t = libc::c_long;
|
||||||
|
pub type __off64_t = libc::c_long;
|
||||||
|
#[derive(Copy, Clone)]
|
||||||
|
#[repr(C)]
|
||||||
|
pub struct _IO_FILE {
|
||||||
|
pub _flags: libc::c_int,
|
||||||
|
pub _IO_read_ptr: *mut libc::c_char,
|
||||||
|
pub _IO_read_end: *mut libc::c_char,
|
||||||
|
pub _IO_read_base: *mut libc::c_char,
|
||||||
|
pub _IO_write_base: *mut libc::c_char,
|
||||||
|
pub _IO_write_ptr: *mut libc::c_char,
|
||||||
|
pub _IO_write_end: *mut libc::c_char,
|
||||||
|
pub _IO_buf_base: *mut libc::c_char,
|
||||||
|
pub _IO_buf_end: *mut libc::c_char,
|
||||||
|
pub _IO_save_base: *mut libc::c_char,
|
||||||
|
pub _IO_backup_base: *mut libc::c_char,
|
||||||
|
pub _IO_save_end: *mut libc::c_char,
|
||||||
|
pub _markers: *mut _IO_marker,
|
||||||
|
pub _chain: *mut _IO_FILE,
|
||||||
|
pub _fileno: libc::c_int,
|
||||||
|
pub _flags2: libc::c_int,
|
||||||
|
pub _old_offset: __off_t,
|
||||||
|
pub _cur_column: libc::c_ushort,
|
||||||
|
pub _vtable_offset: libc::c_schar,
|
||||||
|
pub _shortbuf: [libc::c_char; 1],
|
||||||
|
pub _lock: *mut libc::c_void,
|
||||||
|
pub _offset: __off64_t,
|
||||||
|
pub _codecvt: *mut _IO_codecvt,
|
||||||
|
pub _wide_data: *mut _IO_wide_data,
|
||||||
|
pub _freeres_list: *mut _IO_FILE,
|
||||||
|
pub _freeres_buf: *mut libc::c_void,
|
||||||
|
pub __pad5: size_t,
|
||||||
|
pub _mode: libc::c_int,
|
||||||
|
pub _unused2: [libc::c_char; 20],
|
||||||
|
}
|
||||||
|
pub type _IO_lock_t = ();
|
||||||
|
pub type FILE = _IO_FILE;
|
||||||
|
pub type int32_t = __int32_t;
|
||||||
|
pub type u_int8_t = __uint8_t;
|
||||||
|
pub type u_int32_t = __uint32_t;
|
||||||
|
#[derive(Copy, Clone)]
|
||||||
|
#[repr(C)]
|
||||||
|
pub struct __pthread_internal_list {
|
||||||
|
pub __prev: *mut __pthread_internal_list,
|
||||||
|
pub __next: *mut __pthread_internal_list,
|
||||||
|
}
|
||||||
|
pub type __pthread_list_t = __pthread_internal_list;
|
||||||
|
#[derive(Copy, Clone)]
|
||||||
|
#[repr(C)]
|
||||||
|
pub struct __pthread_mutex_s {
|
||||||
|
pub __lock: libc::c_int,
|
||||||
|
pub __count: libc::c_uint,
|
||||||
|
pub __owner: libc::c_int,
|
||||||
|
pub __nusers: libc::c_uint,
|
||||||
|
pub __kind: libc::c_int,
|
||||||
|
pub __spins: libc::c_short,
|
||||||
|
pub __elision: libc::c_short,
|
||||||
|
pub __list: __pthread_list_t,
|
||||||
|
}
|
||||||
|
pub type pthread_t = libc::c_ulong;
|
||||||
|
#[derive(Copy, Clone)]
|
||||||
|
#[repr(C)]
|
||||||
|
pub union pthread_attr_t {
|
||||||
|
pub __size: [libc::c_char; 56],
|
||||||
|
pub __align: libc::c_long,
|
||||||
|
}
|
||||||
|
#[derive(Copy, Clone)]
|
||||||
|
#[repr(C)]
|
||||||
|
pub union pthread_mutex_t {
|
||||||
|
pub __data: __pthread_mutex_s,
|
||||||
|
pub __size: [libc::c_char; 40],
|
||||||
|
pub __align: libc::c_long,
|
||||||
|
}
|
||||||
|
pub type u8_t = u_int8_t;
|
||||||
|
pub type u32_t = u_int32_t;
|
||||||
|
pub type s32_t = int32_t;
|
||||||
|
pub type frames_t = u32_t;
|
||||||
|
pub type log_level = libc::c_uint;
|
||||||
|
pub const lSDEBUG: log_level = 4;
|
||||||
|
pub const lDEBUG: log_level = 3;
|
||||||
|
pub const lINFO: log_level = 2;
|
||||||
|
pub const lWARN: log_level = 1;
|
||||||
|
pub const lERROR: log_level = 0;
|
||||||
|
#[derive(Copy, Clone)]
|
||||||
|
#[repr(C)]
|
||||||
|
pub struct buffer {
|
||||||
|
pub buf: *mut u8_t,
|
||||||
|
pub readp: *mut u8_t,
|
||||||
|
pub writep: *mut u8_t,
|
||||||
|
pub wrap: *mut u8_t,
|
||||||
|
pub size: size_t,
|
||||||
|
pub base_size: size_t,
|
||||||
|
pub mutex: pthread_mutex_t,
|
||||||
|
}
|
||||||
|
pub type output_state = libc::c_int;
|
||||||
|
pub const OUTPUT_START_AT: output_state = 5;
|
||||||
|
pub const OUTPUT_SKIP_FRAMES: output_state = 4;
|
||||||
|
pub const OUTPUT_PAUSE_FRAMES: output_state = 3;
|
||||||
|
pub const OUTPUT_RUNNING: output_state = 2;
|
||||||
|
pub const OUTPUT_BUFFER: output_state = 1;
|
||||||
|
pub const OUTPUT_STOPPED: output_state = 0;
|
||||||
|
pub const OUTPUT_OFF: output_state = -1;
|
||||||
|
pub type output_format = libc::c_uint;
|
||||||
|
pub const S16_LE: output_format = 3;
|
||||||
|
pub const S24_3LE: output_format = 2;
|
||||||
|
pub const S24_LE: output_format = 1;
|
||||||
|
pub const S32_LE: output_format = 0;
|
||||||
|
pub type fade_state = libc::c_uint;
|
||||||
|
pub const FADE_ACTIVE: fade_state = 2;
|
||||||
|
pub const FADE_DUE: fade_state = 1;
|
||||||
|
pub const FADE_INACTIVE: fade_state = 0;
|
||||||
|
pub type fade_dir = libc::c_uint;
|
||||||
|
pub const FADE_CROSS: fade_dir = 3;
|
||||||
|
pub const FADE_DOWN: fade_dir = 2;
|
||||||
|
pub const FADE_UP: fade_dir = 1;
|
||||||
|
pub type fade_mode = libc::c_uint;
|
||||||
|
pub const FADE_INOUT: fade_mode = 4;
|
||||||
|
pub const FADE_OUT: fade_mode = 3;
|
||||||
|
pub const FADE_IN: fade_mode = 2;
|
||||||
|
pub const FADE_CROSSFADE: fade_mode = 1;
|
||||||
|
pub const FADE_NONE: fade_mode = 0;
|
||||||
|
#[derive(Copy, Clone)]
|
||||||
|
#[repr(C)]
|
||||||
|
pub struct outputstate {
|
||||||
|
pub state: output_state,
|
||||||
|
pub format: output_format,
|
||||||
|
pub device: *const libc::c_char,
|
||||||
|
pub buffer: libc::c_uint,
|
||||||
|
pub period: libc::c_uint,
|
||||||
|
pub track_started: bool,
|
||||||
|
pub write_cb: Option<unsafe extern "C" fn(_: frames_t, _: bool, _: s32_t,
|
||||||
|
_: s32_t, _: s32_t, _: s32_t,
|
||||||
|
_: *mut *mut s32_t)
|
||||||
|
-> libc::c_int>,
|
||||||
|
pub start_frames: libc::c_uint,
|
||||||
|
pub frames_played: libc::c_uint,
|
||||||
|
pub frames_played_dmp: libc::c_uint,
|
||||||
|
pub current_sample_rate: libc::c_uint,
|
||||||
|
pub supported_rates: [libc::c_uint; 18],
|
||||||
|
pub default_sample_rate: libc::c_uint,
|
||||||
|
pub error_opening: bool,
|
||||||
|
pub device_frames: libc::c_uint,
|
||||||
|
pub updated: u32_t,
|
||||||
|
pub track_start_time: u32_t,
|
||||||
|
pub current_replay_gain: u32_t,
|
||||||
|
pub c2rust_unnamed: C2RustUnnamed,
|
||||||
|
pub next_sample_rate: libc::c_uint,
|
||||||
|
pub track_start: *mut u8_t,
|
||||||
|
pub gainL: u32_t,
|
||||||
|
pub gainR: u32_t,
|
||||||
|
pub invert: bool,
|
||||||
|
pub next_replay_gain: u32_t,
|
||||||
|
pub threshold: libc::c_uint,
|
||||||
|
pub fade: fade_state,
|
||||||
|
pub fade_start: *mut u8_t,
|
||||||
|
pub fade_end: *mut u8_t,
|
||||||
|
pub fade_dir: fade_dir,
|
||||||
|
pub fade_mode: fade_mode,
|
||||||
|
pub fade_secs: libc::c_uint,
|
||||||
|
pub rate_delay: libc::c_uint,
|
||||||
|
pub delay_active: bool,
|
||||||
|
pub stop_time: u32_t,
|
||||||
|
pub idle_to: u32_t,
|
||||||
|
}
|
||||||
|
#[derive(Copy, Clone)]
|
||||||
|
#[repr(C)]
|
||||||
|
pub union C2RustUnnamed {
|
||||||
|
pub pause_frames: u32_t,
|
||||||
|
pub skip_frames: u32_t,
|
||||||
|
pub start_at: u32_t,
|
||||||
|
}
|
||||||
|
static mut loglevel: log_level = lERROR;
|
||||||
static mut running: bool = 1 as libc::c_int != 0;
|
static mut running: bool = 1 as libc::c_int != 0;
|
||||||
// buffer to hold output data so we can block on writing outside of output lock, allocated on init
|
// buffer to hold output data so we can block on writing outside of output lock, allocated on init
|
||||||
|
static mut buf: *mut u8_t = 0 as *const u8_t as *mut u8_t;
|
||||||
static mut buf: *mut crate::squeezelite_h::u8_t =
|
|
||||||
0 as *const crate::squeezelite_h::u8_t as *mut crate::squeezelite_h::u8_t;
|
|
||||||
|
|
||||||
static mut buffill: libc::c_uint = 0;
|
static mut buffill: libc::c_uint = 0;
|
||||||
|
|
||||||
static mut bytes_per_frame: libc::c_int = 0;
|
static mut bytes_per_frame: libc::c_int = 0;
|
||||||
|
unsafe extern "C" fn _stdout_write_frames(mut out_frames: frames_t,
|
||||||
unsafe extern "C" fn _stdout_write_frames(
|
mut silence: bool, mut gainL: s32_t,
|
||||||
mut out_frames: crate::squeezelite_h::frames_t,
|
mut gainR: s32_t,
|
||||||
mut silence: bool,
|
mut cross_gain_in: s32_t,
|
||||||
mut gainL: crate::squeezelite_h::s32_t,
|
mut cross_gain_out: s32_t,
|
||||||
mut gainR: crate::squeezelite_h::s32_t,
|
mut cross_ptr: *mut *mut s32_t)
|
||||||
mut cross_gain_in: crate::squeezelite_h::s32_t,
|
-> libc::c_int {
|
||||||
mut cross_gain_out: crate::squeezelite_h::s32_t,
|
let mut obuf: *mut u8_t = 0 as *mut u8_t;
|
||||||
mut cross_ptr: *mut *mut crate::squeezelite_h::s32_t,
|
|
||||||
) -> libc::c_int {
|
|
||||||
let mut obuf = 0 as *mut crate::squeezelite_h::u8_t;
|
|
||||||
if !silence {
|
if !silence {
|
||||||
if output.fade as libc::c_uint
|
if output.fade as libc::c_uint ==
|
||||||
== crate::squeezelite_h::FADE_ACTIVE as libc::c_int as libc::c_uint
|
FADE_ACTIVE as libc::c_int as libc::c_uint &&
|
||||||
&& output.fade_dir as libc::c_uint
|
output.fade_dir as libc::c_uint ==
|
||||||
== crate::squeezelite_h::FADE_CROSS as libc::c_int as libc::c_uint
|
FADE_CROSS as libc::c_int as libc::c_uint &&
|
||||||
&& !(*cross_ptr).is_null()
|
!(*cross_ptr).is_null() {
|
||||||
{
|
_apply_cross(outputbuf, out_frames, cross_gain_in, cross_gain_out,
|
||||||
crate::squeezelite_h::_apply_cross(
|
cross_ptr);
|
||||||
outputbuf,
|
|
||||||
out_frames,
|
|
||||||
cross_gain_in,
|
|
||||||
cross_gain_out,
|
|
||||||
cross_ptr,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
obuf = (*outputbuf).readp
|
obuf = (*outputbuf).readp
|
||||||
} else {
|
} else { obuf = silencebuf }
|
||||||
obuf = silencebuf
|
_scale_and_pack_frames(buf.offset(buffill.wrapping_mul(bytes_per_frame as
|
||||||
}
|
libc::c_uint)
|
||||||
crate::src::output_pack::_scale_and_pack_frames(
|
as isize) as *mut libc::c_void,
|
||||||
buf.offset(buffill.wrapping_mul(bytes_per_frame as libc::c_uint) as isize)
|
obuf as *mut libc::c_void as *mut s32_t,
|
||||||
as *mut libc::c_void,
|
out_frames, gainL, gainR, output.format);
|
||||||
obuf as *mut libc::c_void as *mut crate::squeezelite_h::s32_t,
|
|
||||||
out_frames,
|
|
||||||
gainL,
|
|
||||||
gainR,
|
|
||||||
output.format,
|
|
||||||
);
|
|
||||||
buffill = buffill.wrapping_add(out_frames);
|
buffill = buffill.wrapping_add(out_frames);
|
||||||
return out_frames as libc::c_int;
|
return out_frames as libc::c_int;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe extern "C" fn output_thread() -> *mut libc::c_void {
|
unsafe extern "C" fn output_thread() -> *mut libc::c_void {
|
||||||
crate::stdlib::pthread_mutex_lock(&mut (*outputbuf).mutex);
|
pthread_mutex_lock(&mut (*outputbuf).mutex);
|
||||||
match output.format as libc::c_uint {
|
match output.format as libc::c_uint {
|
||||||
0 => bytes_per_frame = 4 as libc::c_int * 2 as libc::c_int,
|
0 => { bytes_per_frame = 4 as libc::c_int * 2 as libc::c_int }
|
||||||
2 => bytes_per_frame = 3 as libc::c_int * 2 as libc::c_int,
|
2 => { bytes_per_frame = 3 as libc::c_int * 2 as libc::c_int }
|
||||||
3 => bytes_per_frame = 2 as libc::c_int * 2 as libc::c_int,
|
3 => { bytes_per_frame = 2 as libc::c_int * 2 as libc::c_int }
|
||||||
_ => bytes_per_frame = 4 as libc::c_int * 2 as libc::c_int,
|
_ => { bytes_per_frame = 4 as libc::c_int * 2 as libc::c_int }
|
||||||
}
|
}
|
||||||
crate::stdlib::pthread_mutex_unlock(&mut (*outputbuf).mutex);
|
pthread_mutex_unlock(&mut (*outputbuf).mutex);
|
||||||
while running {
|
while running {
|
||||||
crate::stdlib::pthread_mutex_lock(&mut (*outputbuf).mutex);
|
pthread_mutex_lock(&mut (*outputbuf).mutex);
|
||||||
output.device_frames = 0 as libc::c_int as libc::c_uint;
|
output.device_frames = 0 as libc::c_int as libc::c_uint;
|
||||||
output.updated = crate::src::utils::gettime_ms();
|
output.updated = gettime_ms();
|
||||||
output.frames_played_dmp = output.frames_played;
|
output.frames_played_dmp = output.frames_played;
|
||||||
crate::src::output::_output_frames(2048 as libc::c_int as crate::squeezelite_h::frames_t);
|
_output_frames(2048 as libc::c_int as frames_t);
|
||||||
crate::stdlib::pthread_mutex_unlock(&mut (*outputbuf).mutex);
|
pthread_mutex_unlock(&mut (*outputbuf).mutex);
|
||||||
if buffill != 0 {
|
if buffill != 0 {
|
||||||
crate::stdlib::fwrite(
|
fwrite(buf as *const libc::c_void,
|
||||||
buf as *const libc::c_void,
|
bytes_per_frame as libc::c_ulong, buffill as libc::c_ulong,
|
||||||
bytes_per_frame as libc::c_ulong,
|
stdout);
|
||||||
buffill as libc::c_ulong,
|
|
||||||
crate::stdlib::stdout,
|
|
||||||
);
|
|
||||||
buffill = 0 as libc::c_int as libc::c_uint
|
buffill = 0 as libc::c_int as libc::c_uint
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0 as *mut libc::c_void;
|
return 0 as *mut libc::c_void;
|
||||||
}
|
}
|
||||||
|
static mut thread: pthread_t = 0;
|
||||||
static mut thread: crate::stdlib::pthread_t = 0;
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
|
pub unsafe extern "C" fn output_init_stdout(mut level: log_level,
|
||||||
pub unsafe extern "C" fn output_init_stdout(
|
mut output_buf_size: libc::c_uint,
|
||||||
mut level: crate::squeezelite_h::log_level,
|
mut params: *mut libc::c_char,
|
||||||
mut output_buf_size: libc::c_uint,
|
mut rates: *mut libc::c_uint,
|
||||||
mut params: *mut libc::c_char,
|
mut rate_delay: libc::c_uint) {
|
||||||
mut rates: *mut libc::c_uint,
|
|
||||||
mut rate_delay: libc::c_uint,
|
|
||||||
) {
|
|
||||||
loglevel = level;
|
loglevel = level;
|
||||||
if loglevel as libc::c_uint >= crate::squeezelite_h::lINFO as libc::c_int as libc::c_uint {
|
if loglevel as libc::c_uint >= lINFO as libc::c_int as libc::c_uint {
|
||||||
crate::src::utils::logprint(
|
logprint(b"%s %s:%d init output stdout\n\x00" as *const u8 as
|
||||||
b"%s %s:%d init output stdout\n\x00" as *const u8 as *const libc::c_char,
|
*const libc::c_char, logtime(),
|
||||||
crate::src::utils::logtime(),
|
(*::std::mem::transmute::<&[u8; 19],
|
||||||
(*::std::mem::transmute::<&[u8; 19], &[libc::c_char; 19]>(b"output_init_stdout\x00"))
|
&[libc::c_char; 19]>(b"output_init_stdout\x00")).as_ptr(),
|
||||||
.as_ptr(),
|
130 as libc::c_int);
|
||||||
130 as libc::c_int,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
buf = crate::stdlib::malloc((2048 as libc::c_int * 8 as libc::c_int) as libc::c_ulong)
|
buf =
|
||||||
as *mut crate::squeezelite_h::u8_t;
|
malloc((2048 as libc::c_int * 8 as libc::c_int) as libc::c_ulong) as
|
||||||
|
*mut u8_t;
|
||||||
if buf.is_null() {
|
if buf.is_null() {
|
||||||
crate::src::utils::logprint(
|
logprint(b"%s %s:%d unable to malloc buf\n\x00" as *const u8 as
|
||||||
b"%s %s:%d unable to malloc buf\n\x00" as *const u8 as *const libc::c_char,
|
*const libc::c_char, logtime(),
|
||||||
crate::src::utils::logtime(),
|
(*::std::mem::transmute::<&[u8; 19],
|
||||||
(*::std::mem::transmute::<&[u8; 19], &[libc::c_char; 19]>(b"output_init_stdout\x00"))
|
&[libc::c_char; 19]>(b"output_init_stdout\x00")).as_ptr(),
|
||||||
.as_ptr(),
|
134 as libc::c_int);
|
||||||
134 as libc::c_int,
|
return
|
||||||
);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
buffill = 0 as libc::c_int as libc::c_uint;
|
buffill = 0 as libc::c_int as libc::c_uint;
|
||||||
crate::stdlib::memset(
|
memset(&mut output as *mut outputstate as *mut libc::c_void,
|
||||||
&mut output as *mut crate::squeezelite_h::outputstate as *mut libc::c_void,
|
0 as libc::c_int,
|
||||||
0 as libc::c_int,
|
::std::mem::size_of::<outputstate>() as libc::c_ulong);
|
||||||
::std::mem::size_of::<crate::squeezelite_h::outputstate>() as libc::c_ulong,
|
output.format = S32_LE;
|
||||||
);
|
output.start_frames =
|
||||||
output.format = crate::squeezelite_h::S32_LE;
|
(2048 as libc::c_int * 2 as libc::c_int) as libc::c_uint;
|
||||||
output.start_frames = (2048 as libc::c_int * 2 as libc::c_int) as libc::c_uint;
|
output.write_cb =
|
||||||
output.write_cb = Some(
|
Some(_stdout_write_frames as
|
||||||
_stdout_write_frames
|
unsafe extern "C" fn(_: frames_t, _: bool, _: s32_t,
|
||||||
as unsafe extern "C" fn(
|
_: s32_t, _: s32_t, _: s32_t,
|
||||||
_: crate::squeezelite_h::frames_t,
|
_: *mut *mut s32_t) -> libc::c_int);
|
||||||
_: bool,
|
|
||||||
_: crate::squeezelite_h::s32_t,
|
|
||||||
_: crate::squeezelite_h::s32_t,
|
|
||||||
_: crate::squeezelite_h::s32_t,
|
|
||||||
_: crate::squeezelite_h::s32_t,
|
|
||||||
_: *mut *mut crate::squeezelite_h::s32_t,
|
|
||||||
) -> libc::c_int,
|
|
||||||
);
|
|
||||||
output.rate_delay = rate_delay;
|
output.rate_delay = rate_delay;
|
||||||
if !params.is_null() {
|
if !params.is_null() {
|
||||||
if crate::stdlib::strcmp(params, b"32\x00" as *const u8 as *const libc::c_char) == 0 {
|
if strcmp(params, b"32\x00" as *const u8 as *const libc::c_char) == 0
|
||||||
output.format = crate::squeezelite_h::S32_LE
|
{
|
||||||
|
output.format = S32_LE
|
||||||
}
|
}
|
||||||
if crate::stdlib::strcmp(params, b"24\x00" as *const u8 as *const libc::c_char) == 0 {
|
if strcmp(params, b"24\x00" as *const u8 as *const libc::c_char) == 0
|
||||||
output.format = crate::squeezelite_h::S24_3LE
|
{
|
||||||
|
output.format = S24_3LE
|
||||||
}
|
}
|
||||||
if crate::stdlib::strcmp(params, b"16\x00" as *const u8 as *const libc::c_char) == 0 {
|
if strcmp(params, b"16\x00" as *const u8 as *const libc::c_char) == 0
|
||||||
output.format = crate::squeezelite_h::S16_LE
|
{
|
||||||
|
output.format = S16_LE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ensure output rate is specified to avoid test open
|
// ensure output rate is specified to avoid test open
|
||||||
if *rates.offset(0 as libc::c_int as isize) == 0 {
|
if *rates.offset(0 as libc::c_int as isize) == 0 {
|
||||||
*rates.offset(0 as libc::c_int as isize) = 44100 as libc::c_int as libc::c_uint
|
*rates.offset(0 as libc::c_int as isize) =
|
||||||
|
44100 as libc::c_int as libc::c_uint
|
||||||
}
|
}
|
||||||
crate::src::output::output_init_common(
|
output_init_common(level, b"-\x00" as *const u8 as *const libc::c_char,
|
||||||
level,
|
output_buf_size, rates,
|
||||||
b"-\x00" as *const u8 as *const libc::c_char,
|
0 as libc::c_int as libc::c_uint);
|
||||||
output_buf_size,
|
let mut attr: pthread_attr_t = pthread_attr_t{__size: [0; 56],};
|
||||||
rates,
|
pthread_attr_init(&mut attr);
|
||||||
0 as libc::c_int as libc::c_uint,
|
pthread_attr_setstacksize(&mut attr,
|
||||||
);
|
(16384 as libc::c_int +
|
||||||
let mut attr = crate::stdlib::pthread_attr_t { __size: [0; 56] };
|
64 as libc::c_int * 1024 as libc::c_int) as
|
||||||
crate::stdlib::pthread_attr_init(&mut attr);
|
size_t);
|
||||||
crate::stdlib::pthread_attr_setstacksize(
|
pthread_create(&mut thread, &mut attr,
|
||||||
&mut attr,
|
::std::mem::transmute::<Option<unsafe extern "C" fn()
|
||||||
(16384 as libc::c_int + 64 as libc::c_int * 1024 as libc::c_int) as crate::stddef_h::size_t,
|
-> *mut libc::c_void>,
|
||||||
);
|
Option<unsafe extern "C" fn(_:
|
||||||
crate::stdlib::pthread_create(
|
*mut libc::c_void)
|
||||||
&mut thread,
|
->
|
||||||
&mut attr,
|
*mut libc::c_void>>(Some(::std::mem::transmute::<unsafe extern "C" fn()
|
||||||
::std::mem::transmute::<
|
->
|
||||||
Option<unsafe extern "C" fn() -> *mut libc::c_void>,
|
*mut libc::c_void,
|
||||||
Option<unsafe extern "C" fn(_: *mut libc::c_void) -> *mut libc::c_void>,
|
unsafe extern "C" fn()
|
||||||
>(Some(::std::mem::transmute::<
|
->
|
||||||
unsafe extern "C" fn() -> *mut libc::c_void,
|
*mut libc::c_void>(output_thread))),
|
||||||
unsafe extern "C" fn() -> *mut libc::c_void,
|
0 as *mut libc::c_void);
|
||||||
>(output_thread))),
|
pthread_attr_destroy(&mut attr);
|
||||||
0 as *mut libc::c_void,
|
|
||||||
);
|
|
||||||
crate::stdlib::pthread_attr_destroy(&mut attr);
|
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* Squeezelite - lightweight headless squeezebox emulator
|
* Squeezelite - lightweight headless squeezebox emulator
|
||||||
@ -327,20 +437,17 @@ pub unsafe extern "C" fn output_init_stdout(
|
|||||||
// output_pulse.c
|
// output_pulse.c
|
||||||
// output_stdout.c
|
// output_stdout.c
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
|
|
||||||
pub unsafe extern "C" fn output_close_stdout() {
|
pub unsafe extern "C" fn output_close_stdout() {
|
||||||
if loglevel as libc::c_uint >= crate::squeezelite_h::lINFO as libc::c_int as libc::c_uint {
|
if loglevel as libc::c_uint >= lINFO as libc::c_int as libc::c_uint {
|
||||||
crate::src::utils::logprint(
|
logprint(b"%s %s:%d close output\n\x00" as *const u8 as
|
||||||
b"%s %s:%d close output\n\x00" as *const u8 as *const libc::c_char,
|
*const libc::c_char, logtime(),
|
||||||
crate::src::utils::logtime(),
|
(*::std::mem::transmute::<&[u8; 20],
|
||||||
(*::std::mem::transmute::<&[u8; 20], &[libc::c_char; 20]>(b"output_close_stdout\x00"))
|
&[libc::c_char; 20]>(b"output_close_stdout\x00")).as_ptr(),
|
||||||
.as_ptr(),
|
174 as libc::c_int);
|
||||||
174 as libc::c_int,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
crate::stdlib::pthread_mutex_lock(&mut (*outputbuf).mutex);
|
pthread_mutex_lock(&mut (*outputbuf).mutex);
|
||||||
running = 0 as libc::c_int != 0;
|
running = 0 as libc::c_int != 0;
|
||||||
crate::stdlib::pthread_mutex_unlock(&mut (*outputbuf).mutex);
|
pthread_mutex_unlock(&mut (*outputbuf).mutex);
|
||||||
crate::stdlib::free(buf as *mut libc::c_void);
|
free(buf as *mut libc::c_void);
|
||||||
crate::src::output::output_close_common();
|
output_close_common();
|
||||||
}
|
}
|
||||||
|
1590
src/pcm.rs
1590
src/pcm.rs
File diff suppressed because it is too large
Load Diff
3767
src/slimproto.rs
3767
src/slimproto.rs
File diff suppressed because it is too large
Load Diff
@ -1,207 +0,0 @@
|
|||||||
extern "C" {
|
|
||||||
#[no_mangle]
|
|
||||||
pub fn _buf_used(buf: *mut crate::squeezelite_h::buffer) -> libc::c_uint;
|
|
||||||
|
|
||||||
#[no_mangle]
|
|
||||||
pub fn to_gain(f: libc::c_float) -> crate::squeezelite_h::s32_t;
|
|
||||||
|
|
||||||
#[no_mangle]
|
|
||||||
pub fn gain(
|
|
||||||
gain_0: crate::squeezelite_h::s32_t,
|
|
||||||
sample: crate::squeezelite_h::s32_t,
|
|
||||||
) -> crate::squeezelite_h::s32_t;
|
|
||||||
|
|
||||||
#[no_mangle]
|
|
||||||
pub fn _apply_cross(
|
|
||||||
outputbuf_0: *mut crate::squeezelite_h::buffer,
|
|
||||||
out_frames: crate::squeezelite_h::frames_t,
|
|
||||||
cross_gain_in: crate::squeezelite_h::s32_t,
|
|
||||||
cross_gain_out: crate::squeezelite_h::s32_t,
|
|
||||||
cross_ptr: *mut *mut crate::squeezelite_h::s32_t,
|
|
||||||
);
|
|
||||||
|
|
||||||
#[no_mangle]
|
|
||||||
pub fn _apply_gain(
|
|
||||||
outputbuf_0: *mut crate::squeezelite_h::buffer,
|
|
||||||
count: crate::squeezelite_h::frames_t,
|
|
||||||
gainL: crate::squeezelite_h::s32_t,
|
|
||||||
gainR: crate::squeezelite_h::s32_t,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
// =============== BEGIN squeezelite_h ================
|
|
||||||
pub type s16_t = crate::stdlib::int16_t;
|
|
||||||
#[repr(C)]
|
|
||||||
#[derive(Copy, Clone)]
|
|
||||||
pub union C2RustUnnamed_1 {
|
|
||||||
pub pause_frames: crate::squeezelite_h::u32_t,
|
|
||||||
pub skip_frames: crate::squeezelite_h::u32_t,
|
|
||||||
pub start_at: crate::squeezelite_h::u32_t,
|
|
||||||
}
|
|
||||||
pub type u32_t = crate::stdlib::u_int32_t;
|
|
||||||
pub type u64_t = crate::stdlib::u_int64_t;
|
|
||||||
pub type s32_t = crate::stdlib::int32_t;
|
|
||||||
pub type frames_t = crate::squeezelite_h::u32_t;
|
|
||||||
pub type log_level = libc::c_uint;
|
|
||||||
pub type stream_state = libc::c_uint;
|
|
||||||
pub type disconnect_code = libc::c_uint;
|
|
||||||
#[repr(C)]
|
|
||||||
#[derive(Copy, Clone)]
|
|
||||||
pub struct streamstate {
|
|
||||||
pub state: crate::squeezelite_h::stream_state,
|
|
||||||
pub disconnect: crate::squeezelite_h::disconnect_code,
|
|
||||||
pub header: *mut libc::c_char,
|
|
||||||
pub header_len: crate::stddef_h::size_t,
|
|
||||||
pub sent_headers: bool,
|
|
||||||
pub cont_wait: bool,
|
|
||||||
pub bytes: crate::squeezelite_h::u64_t,
|
|
||||||
pub threshold: libc::c_uint,
|
|
||||||
pub meta_interval: crate::squeezelite_h::u32_t,
|
|
||||||
pub meta_next: crate::squeezelite_h::u32_t,
|
|
||||||
pub meta_left: crate::squeezelite_h::u32_t,
|
|
||||||
pub meta_send: bool,
|
|
||||||
}
|
|
||||||
pub type decode_state = libc::c_uint;
|
|
||||||
#[repr(C)]
|
|
||||||
#[derive(Copy, Clone)]
|
|
||||||
pub struct decodestate {
|
|
||||||
pub state: crate::squeezelite_h::decode_state,
|
|
||||||
pub new_stream: bool,
|
|
||||||
pub mutex: crate::stdlib::pthread_mutex_t,
|
|
||||||
}
|
|
||||||
#[repr(C)]
|
|
||||||
#[derive(Copy, Clone)]
|
|
||||||
pub struct codec {
|
|
||||||
pub id: libc::c_char,
|
|
||||||
pub types: *mut libc::c_char,
|
|
||||||
pub min_read_bytes: libc::c_uint,
|
|
||||||
pub min_space: libc::c_uint,
|
|
||||||
pub open: Option<
|
|
||||||
unsafe extern "C" fn(
|
|
||||||
_: crate::squeezelite_h::u8_t,
|
|
||||||
_: crate::squeezelite_h::u8_t,
|
|
||||||
_: crate::squeezelite_h::u8_t,
|
|
||||||
_: crate::squeezelite_h::u8_t,
|
|
||||||
) -> (),
|
|
||||||
>,
|
|
||||||
pub close: Option<unsafe extern "C" fn() -> ()>,
|
|
||||||
pub decode: Option<unsafe extern "C" fn() -> crate::squeezelite_h::decode_state>,
|
|
||||||
}
|
|
||||||
pub type fade_mode = libc::c_uint;
|
|
||||||
#[repr(C)]
|
|
||||||
#[derive(Copy, Clone)]
|
|
||||||
pub struct outputstate {
|
|
||||||
pub state: crate::squeezelite_h::output_state,
|
|
||||||
pub format: crate::squeezelite_h::output_format,
|
|
||||||
pub device: *const libc::c_char,
|
|
||||||
pub buffer: libc::c_uint,
|
|
||||||
pub period: libc::c_uint,
|
|
||||||
pub track_started: bool,
|
|
||||||
pub write_cb: Option<
|
|
||||||
unsafe extern "C" fn(
|
|
||||||
_: crate::squeezelite_h::frames_t,
|
|
||||||
_: bool,
|
|
||||||
_: crate::squeezelite_h::s32_t,
|
|
||||||
_: crate::squeezelite_h::s32_t,
|
|
||||||
_: crate::squeezelite_h::s32_t,
|
|
||||||
_: crate::squeezelite_h::s32_t,
|
|
||||||
_: *mut *mut crate::squeezelite_h::s32_t,
|
|
||||||
) -> libc::c_int,
|
|
||||||
>,
|
|
||||||
pub start_frames: libc::c_uint,
|
|
||||||
pub frames_played: libc::c_uint,
|
|
||||||
pub frames_played_dmp: libc::c_uint,
|
|
||||||
pub current_sample_rate: libc::c_uint,
|
|
||||||
pub supported_rates: [libc::c_uint; 18],
|
|
||||||
pub default_sample_rate: libc::c_uint,
|
|
||||||
pub error_opening: bool,
|
|
||||||
pub device_frames: libc::c_uint,
|
|
||||||
pub updated: crate::squeezelite_h::u32_t,
|
|
||||||
pub track_start_time: crate::squeezelite_h::u32_t,
|
|
||||||
pub current_replay_gain: crate::squeezelite_h::u32_t,
|
|
||||||
pub c2rust_unnamed: crate::squeezelite_h::C2RustUnnamed_1,
|
|
||||||
pub next_sample_rate: libc::c_uint,
|
|
||||||
pub track_start: *mut crate::squeezelite_h::u8_t,
|
|
||||||
pub gainL: crate::squeezelite_h::u32_t,
|
|
||||||
pub gainR: crate::squeezelite_h::u32_t,
|
|
||||||
pub invert: bool,
|
|
||||||
pub next_replay_gain: crate::squeezelite_h::u32_t,
|
|
||||||
pub threshold: libc::c_uint,
|
|
||||||
pub fade: crate::squeezelite_h::fade_state,
|
|
||||||
pub fade_start: *mut crate::squeezelite_h::u8_t,
|
|
||||||
pub fade_end: *mut crate::squeezelite_h::u8_t,
|
|
||||||
pub fade_dir: crate::squeezelite_h::fade_dir,
|
|
||||||
pub fade_mode: crate::squeezelite_h::fade_mode,
|
|
||||||
pub fade_secs: libc::c_uint,
|
|
||||||
pub rate_delay: libc::c_uint,
|
|
||||||
pub delay_active: bool,
|
|
||||||
pub stop_time: crate::squeezelite_h::u32_t,
|
|
||||||
pub idle_to: crate::squeezelite_h::u32_t,
|
|
||||||
}
|
|
||||||
pub type fade_dir = libc::c_uint;
|
|
||||||
pub type fade_state = libc::c_uint;
|
|
||||||
pub type output_format = libc::c_uint;
|
|
||||||
pub type output_state = libc::c_int;
|
|
||||||
pub type s64_t = crate::stdlib::int64_t;
|
|
||||||
pub const lSDEBUG: crate::squeezelite_h::log_level = 4;
|
|
||||||
pub const lDEBUG: crate::squeezelite_h::log_level = 3;
|
|
||||||
pub const lINFO: crate::squeezelite_h::log_level = 2;
|
|
||||||
pub const lWARN: crate::squeezelite_h::log_level = 1;
|
|
||||||
pub const lERROR: crate::squeezelite_h::log_level = 0;
|
|
||||||
pub const RECV_HEADERS: crate::squeezelite_h::stream_state = 7;
|
|
||||||
pub const SEND_HEADERS: crate::squeezelite_h::stream_state = 6;
|
|
||||||
pub const STREAMING_HTTP: crate::squeezelite_h::stream_state = 5;
|
|
||||||
pub const STREAMING_FILE: crate::squeezelite_h::stream_state = 4;
|
|
||||||
pub const STREAMING_BUFFERING: crate::squeezelite_h::stream_state = 3;
|
|
||||||
pub const STREAMING_WAIT: crate::squeezelite_h::stream_state = 2;
|
|
||||||
pub const DISCONNECT: crate::squeezelite_h::stream_state = 1;
|
|
||||||
pub const STOPPED: crate::squeezelite_h::stream_state = 0;
|
|
||||||
pub const TIMEOUT: crate::squeezelite_h::disconnect_code = 4;
|
|
||||||
pub const UNREACHABLE: crate::squeezelite_h::disconnect_code = 3;
|
|
||||||
pub const REMOTE_DISCONNECT: crate::squeezelite_h::disconnect_code = 2;
|
|
||||||
pub const LOCAL_DISCONNECT: crate::squeezelite_h::disconnect_code = 1;
|
|
||||||
pub const DISCONNECT_OK: crate::squeezelite_h::disconnect_code = 0;
|
|
||||||
pub const DECODE_ERROR: crate::squeezelite_h::decode_state = 4;
|
|
||||||
pub const DECODE_COMPLETE: crate::squeezelite_h::decode_state = 3;
|
|
||||||
pub const DECODE_RUNNING: crate::squeezelite_h::decode_state = 2;
|
|
||||||
pub const DECODE_READY: crate::squeezelite_h::decode_state = 1;
|
|
||||||
pub const DECODE_STOPPED: crate::squeezelite_h::decode_state = 0;
|
|
||||||
pub const FADE_INOUT: crate::squeezelite_h::fade_mode = 4;
|
|
||||||
pub const FADE_OUT: crate::squeezelite_h::fade_mode = 3;
|
|
||||||
pub const FADE_IN: crate::squeezelite_h::fade_mode = 2;
|
|
||||||
pub const FADE_CROSSFADE: crate::squeezelite_h::fade_mode = 1;
|
|
||||||
pub const FADE_NONE: crate::squeezelite_h::fade_mode = 0;
|
|
||||||
pub const FADE_CROSS: crate::squeezelite_h::fade_dir = 3;
|
|
||||||
pub const FADE_DOWN: crate::squeezelite_h::fade_dir = 2;
|
|
||||||
pub const FADE_UP: crate::squeezelite_h::fade_dir = 1;
|
|
||||||
pub const FADE_ACTIVE: crate::squeezelite_h::fade_state = 2;
|
|
||||||
pub const FADE_DUE: crate::squeezelite_h::fade_state = 1;
|
|
||||||
pub const FADE_INACTIVE: crate::squeezelite_h::fade_state = 0;
|
|
||||||
pub const S16_LE: crate::squeezelite_h::output_format = 3;
|
|
||||||
pub const S24_3LE: crate::squeezelite_h::output_format = 2;
|
|
||||||
pub const S24_LE: crate::squeezelite_h::output_format = 1;
|
|
||||||
pub const S32_LE: crate::squeezelite_h::output_format = 0;
|
|
||||||
pub const OUTPUT_START_AT: crate::squeezelite_h::output_state = 5;
|
|
||||||
pub const OUTPUT_SKIP_FRAMES: crate::squeezelite_h::output_state = 4;
|
|
||||||
pub const OUTPUT_PAUSE_FRAMES: crate::squeezelite_h::output_state = 3;
|
|
||||||
pub const OUTPUT_RUNNING: crate::squeezelite_h::output_state = 2;
|
|
||||||
pub const OUTPUT_BUFFER: crate::squeezelite_h::output_state = 1;
|
|
||||||
pub const OUTPUT_STOPPED: crate::squeezelite_h::output_state = 0;
|
|
||||||
pub const OUTPUT_OFF: crate::squeezelite_h::output_state = -1;
|
|
||||||
pub type u16_t = crate::stdlib::u_int16_t;
|
|
||||||
pub type sockfd = libc::c_int;
|
|
||||||
pub type event_type = libc::c_uint;
|
|
||||||
pub const EVENT_WAKE: crate::squeezelite_h::event_type = 2;
|
|
||||||
pub const EVENT_READ: crate::squeezelite_h::event_type = 1;
|
|
||||||
pub const EVENT_TIMEOUT: crate::squeezelite_h::event_type = 0;
|
|
||||||
pub type u8_t = crate::stdlib::u_int8_t;
|
|
||||||
#[repr(C)]
|
|
||||||
#[derive(Copy, Clone)]
|
|
||||||
pub struct buffer {
|
|
||||||
pub buf: *mut crate::squeezelite_h::u8_t,
|
|
||||||
pub readp: *mut crate::squeezelite_h::u8_t,
|
|
||||||
pub writep: *mut crate::squeezelite_h::u8_t,
|
|
||||||
pub wrap: *mut crate::squeezelite_h::u8_t,
|
|
||||||
pub size: crate::stddef_h::size_t,
|
|
||||||
pub base_size: crate::stddef_h::size_t,
|
|
||||||
pub mutex: crate::stdlib::pthread_mutex_t,
|
|
||||||
}
|
|
@ -1 +0,0 @@
|
|||||||
pub type va_list = crate::internal::__builtin_va_list;
|
|
@ -1 +0,0 @@
|
|||||||
pub type size_t = libc::c_ulong;
|
|
2259
src/stdlib.rs
2259
src/stdlib.rs
File diff suppressed because it is too large
Load Diff
1753
src/stream.rs
1753
src/stream.rs
File diff suppressed because it is too large
Load Diff
1430
src/utils.rs
1430
src/utils.rs
File diff suppressed because it is too large
Load Diff
1380
src/vorbis.rs
1380
src/vorbis.rs
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user