LMMS
Loading...
Searching...
No Matches
ad_plugin.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <math.h>
#include "ad_plugin.h"

Classes

struct  adecoder

Macros

#define UNUSED(x)

Functions

int ad_eval_null (const char *f)
voidad_open_null (const char *f, struct adinfo *n)
int ad_close_null (void *x)
int ad_info_null (void *x, struct adinfo *n)
int64_t ad_seek_null (void *x, int64_t p)
ssize_t ad_read_null (void *x, float *d, size_t s)
int ad_bitrate_null (void *x)
static ad_plugin constchoose_backend (const char *fn)
voidad_open (const char *fn, struct adinfo *nfo)
int ad_info (void *sf, struct adinfo *nfo)
int ad_close (void *sf)
int64_t ad_seek (void *sf, int64_t pos)
ssize_t ad_read (void *sf, float *out, size_t len)
int ad_get_bitrate (void *sf)
ssize_t ad_read_mono_dbl (void *sf, struct adinfo *nfo, double *d, size_t len)
int ad_finfo (const char *fn, struct adinfo *nfo)
void ad_clear_nfo (struct adinfo *nfo)
void ad_free_nfo (struct adinfo *nfo)
void ad_dump_nfo (int dbglvl, struct adinfo *nfo)
void ad_debug_printf (const char *func, int level, const char *format,...)
void ad_set_debuglevel (int lvl)

Variables

int ad_debug_level = 0

Macro Definition Documentation

◆ UNUSED

#define UNUSED ( x)
Value:
(void)(x)
unsigned x[BMAX+1]
Definition inflate.c:1586
#define void
Definition unzip.h:396

Function Documentation

◆ ad_bitrate_null()

int ad_bitrate_null ( void * x)

◆ ad_clear_nfo()

void ad_clear_nfo ( struct adinfo * nfo)

zero initialize the information struct. * (does not free nfo->meta_data)

Parameters
nfopointer to a adinfo struct

◆ ad_close()

int ad_close ( void * sf)

close an audio file and release decoder structures

Parameters
sfdecoder handle
Returns
0 on succees, -1 if sf was invalid or not open (return value can usually be ignored)

◆ ad_close_null()

int ad_close_null ( void * x)

◆ ad_debug_printf()

void ad_debug_printf ( const char * func,
int level,
const char * format,
... )

◆ ad_dump_nfo()

void ad_dump_nfo ( int dbglvl,
struct adinfo * nfo )

calls dbg() to print file info to stderr.

Parameters
dbglvl
nfo

◆ ad_eval_null()

int ad_eval_null ( const char * f)

◆ ad_finfo()

int ad_finfo ( const char * fn,
struct adinfo * nfo )

read file info combines ad_open() and ad_close()

◆ ad_free_nfo()

void ad_free_nfo ( struct adinfo * nfo)

free possibly allocated meta-data text

Parameters
nfopointer to a adinfo struct

◆ ad_get_bitrate()

int ad_get_bitrate ( void * sf)

get the current playing bit_rate

Parameters
sfdecoder handle
Returns
the bitrate in kbps or -1 on error.

◆ ad_info()

int ad_info ( void * sf,
struct adinfo * nfo )

re-read the file information and meta-data.

this is not neccesary in general ad_open includes an inplicit call but meta-data may change in live-stream in which case en explicit call to ad_into is needed to update the inforation

Parameters
fnfile-name
nfopointer to a adinfo struct which will hold information about the file.
Returns
0 on succees, -1 if sf was invalid or not open

◆ ad_info_null()

int ad_info_null ( void * x,
struct adinfo * n )

◆ ad_open()

void * ad_open ( const char * fn,
struct adinfo * nfo )

open an audio file

Parameters
fnfile-name
nfopointer to a adinfo struct which will hold information about the file.
Returns
NULL on error, a pointer to an opaque soundfile-decoder object on success.

◆ ad_open_null()

void * ad_open_null ( const char * f,
struct adinfo * n )

◆ ad_read()

ssize_t ad_read ( void * sf,
float * out,
size_t len )

decode audio data chunk to raw interleaved channel floating point data

Parameters
sfdecoder handle
outplace to store data – must be large enough to hold (sizeof(float) * len) bytes.
lennumber of samples (!) to read (should be a multiple of nfo->channels).
Returns
the number of read samples.

◆ ad_read_mono_dbl()

ssize_t ad_read_mono_dbl ( void * sf,
struct adinfo * nfo,
double * d,
size_t len )

wrapper around ad_read, downmixes all channels to mono

◆ ad_read_null()

ssize_t ad_read_null ( void * x,
float * d,
size_t s )

◆ ad_seek()

int64_t ad_seek ( void * sf,
int64_t pos )

seel to a given position in the file

Parameters
sfdecoder handle
posframe position to seek to in frames (1 frame = number-of-channel samples) from the start of the file.
Returns
the current position in frames (multi-channel samples) from the start of the file. On error this function returns -1.

◆ ad_seek_null()

int64_t ad_seek_null ( void * x,
int64_t p )

◆ ad_set_debuglevel()

void ad_set_debuglevel ( int lvl)

set audio-decoder debug level – all info is printed to stderr.

Parameters
lvldebug-level threshold -1: absolutley silent 0: errors only 1: errors + info 2: + debug 3: + low-level-debug info

◆ choose_backend()

ad_plugin const * choose_backend ( const char * fn)
static

Variable Documentation

◆ ad_debug_level

int ad_debug_level = 0

Copyright (C) 2011-2013 Robin Gareus robin.nosp@m.@gar.nosp@m.eus.o.nosp@m.rg Copyright (C) 2014-2023 Filipe Coelho falkt.nosp@m.x@fa.nosp@m.lktx..nosp@m.com

This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser Public License as published by the Free Software Foundation; either version 2.1, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA