Browse Source

add link map and shared lib

master v0.3.1
Alexandros Theodotou 2 years ago
parent
commit
bf744ee903
Signed by: alex
GPG Key ID: 022EAE42313D70F3
  1. 6
      inc/ad_plugin.h
  2. 6
      link.map.in
  3. 15
      meson.build
  4. 2
      src/ad_ffmpeg.c
  5. 8
      src/ad_plugin.c
  6. 66
      tests/log.c
  7. 13
      tests/meson.build
  8. 24
      tests/test.c

6
inc/ad_plugin.h

@ -42,7 +42,7 @@ @@ -42,7 +42,7 @@
/** Prints a debug message. */
#define dbg(_level, _fmt, ...) \
audec_log (__func__, _level, _fmt, ##__VA_ARGS__)
ad_log (__func__, _level, _fmt, ##__VA_ARGS__)
#define MIN(A,B) ((A) < (B) ? (A) : (B))
#define MAX(A,B) ((A) > (B) ? (A) : (B))
@ -62,10 +62,10 @@ @@ -62,10 +62,10 @@
# define PRIi64 __PRI64_PREFIX "i"
#endif
extern int audec_log_level;
extern int ad_log_level;
void
audec_log (
ad_log (
const char * func,
AudecLogLevel level,
const char * format,

6
link.map.in

@ -0,0 +1,6 @@ @@ -0,0 +1,6 @@
V@VERSION@ {
global:
audec_*;
local:
*;
};

15
meson.build

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
# Copyright (C) 2019 Alexandros Theodotou <alex at zrythm dot org>
# Copyright (C) 2019-2021 Alexandros Theodotou <alex at zrythm dot org>
#
# This file is part of libaudec
#
@ -17,7 +17,7 @@ @@ -17,7 +17,7 @@
project (
'libaudec', ['c'],
version: '0.2.4',
version: '0.3.1',
license: 'AGPLv3+',
meson_version: '>= 0.55.0',
default_options: [
@ -186,13 +186,22 @@ config_h_dep = declare_dependency ( @@ -186,13 +186,22 @@ config_h_dep = declare_dependency (
)
audec_deps += config_h_dep
audec = static_library (
mapfile = configure_file(
input: 'link.map.in',
output: 'link.map',
configuration: { 'VERSION': meson.project_version () },
)
vflag = '-Wl,--version-script,@0@'.format (mapfile)
audec = both_libraries (
'audec',
sources: srcs,
dependencies: [
audec_deps,
],
include_directories: inc,
link_args: vflag,
link_depends: mapfile,
install: not meson.is_subproject(),
)

2
src/ad_ffmpeg.c

@ -377,7 +377,7 @@ const ad_plugin * adp_get_ffmpeg() { @@ -377,7 +377,7 @@ const ad_plugin * adp_get_ffmpeg() {
#endif
av_register_all();
avcodec_register_all();
if(audec_log_level <= 1)
if(ad_log_level <= 1)
av_log_set_level(AV_LOG_QUIET);
else
av_log_set_level(AV_LOG_VERBOSE);

8
src/ad_plugin.c

@ -49,7 +49,7 @@ @@ -49,7 +49,7 @@
#include "ad_plugin.h"
AudecLogLevel audec_log_level =
AudecLogLevel ad_log_level =
AUDEC_LOG_LEVEL_ERROR;
audec_log_fn_t log_fn = NULL;
@ -480,7 +480,7 @@ audec_dump_info ( @@ -480,7 +480,7 @@ audec_dump_info (
}
void
audec_log (
ad_log (
const char * func,
AudecLogLevel level,
const char * format,
@ -493,7 +493,7 @@ audec_log ( @@ -493,7 +493,7 @@ audec_log (
{
log_fn (level, format, args);
}
else if (level <= audec_log_level)
else if (level <= ad_log_level)
{
fprintf (stderr, "%s(): ", func);
vfprintf (stderr, format, args);
@ -513,5 +513,5 @@ void @@ -513,5 +513,5 @@ void
audec_set_log_level (
AudecLogLevel lvl)
{
audec_log_level = lvl;
ad_log_level = lvl;
}

66
tests/log.c

@ -0,0 +1,66 @@ @@ -0,0 +1,66 @@
/*
* Copyright (C) 2019 Alexandros Theodotou <alex at zrythm dot org>
*
* This file is part of libaudec
*
* libaudec is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* libaudec 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with libaudec. If not, see <https://www.gnu.org/licenses/>.
*/
#include "helper.h"
#include <audec/audec.h>
void
ad_log (
const char * func,
AudecLogLevel level,
const char * format,
...);
static void
log_fn (
AudecLogLevel level,
const char * fmt,
va_list args)
{
fprintf (stderr, "using log fn\n");
vfprintf (stderr, fmt, args);
}
int main (
int argc, const char* argv[])
{
ad_assert (argc > 2);
const char * filename = argv[1];
audec_init ();
/* read info */
AudecInfo nfo;
memset (&nfo, 0, sizeof (AudecInfo));
AudecHandle * handle =
audec_open (filename, &nfo);
/* test log function */
audec_set_log_func (log_fn);
ad_log (
__func__, AUDEC_LOG_LEVEL_DEBUG,
"abc %s %s\n", "abc2", "abc3");
audec_close (handle);
return 0;
}

13
tests/meson.build

@ -36,4 +36,17 @@ if get_option ('tests') @@ -36,4 +36,17 @@ if get_option ('tests')
meson.current_source_dir(), 'test.mp3'),
'48000',
])
log_test = executable (
'log_test_exe', 'log.c',
include_directories: inc,
link_with: audec.get_static_lib (),
c_args: audec_cflags,
)
test (
'log_test', log_test,
args: [
join_paths (
meson.current_source_dir(), 'test.wav'),
'44000',
])
endif

24
tests/test.c

@ -21,23 +21,6 @@ @@ -21,23 +21,6 @@
#include <audec/audec.h>
void
audec_log (
const char * func,
AudecLogLevel level,
const char * format,
...);
static void
log_fn (
AudecLogLevel level,
const char * fmt,
va_list args)
{
fprintf (stderr, "using log fn\n");
vfprintf (stderr, fmt, args);
}
int main (
int argc, const char* argv[])
{
@ -102,13 +85,6 @@ int main ( @@ -102,13 +85,6 @@ int main (
out_frames[(size_t) samples_read * nfo.channels - 1];
(void) frame;
/* test log function */
audec_set_log_func (log_fn);
audec_log (
__func__, AUDEC_LOG_LEVEL_DEBUG,
"abc %s %s\n", "abc2", "abc3");
audec_close (handle);
free (out_frames);

Loading…
Cancel
Save