Commit Graph

65 Commits

Author SHA1 Message Date
ejurgensen
54c2667aea [misc] Use fcntl+O_NONBLOCK when binding instead of socket+SOCK_NONBLOCK
socket() with SOCK_NONBLOCK (O_NONBLOCK) seems not to be possible on MacOS, it
yields 'Protocol wrong type for socket'. Switch to using fcntl() and O_NONBLOCK
instead, hopefully works better cross-platform.

Closes #1644
2023-09-01 17:13:33 +02:00
ejurgensen
4d0c297901 [evhtr] Consolidate pool threading in evthr.c
Also reinstate check for server already running
2023-03-07 21:01:10 +01:00
ejurgensen
74f1b93b42 [httpd] Make http modules agnostic to evhttp 2023-03-07 21:01:10 +01:00
ejurgensen
2e31a3d4f3 [misc] 'unsigned short' instead of 'short unsigned' as arg to net_evhttp_bind() 2023-03-07 21:01:10 +01:00
ejurgensen
3754871c73 [misc] Add utility function to get interface name from IP address 2022-07-14 21:12:58 +02:00
ejurgensen
d2f4efa1bf [misc] Centralize thread naming plus name websocket thread 2021-07-05 21:40:31 +02:00
ejurgensen
c1db4d914f [http] Also allow remote playlists to have https streams (fixes #1251)
Fix it by adding net_is_http_or_https() utility function in misc.h and make
sure it used whenever a http protocol check is made.
2021-05-19 22:53:25 +02:00
ejurgensen
790c9dcca9 [misc] Define SOCK_NONBLOCK and SOCK_CLOEXEC if platform doesn't 2021-04-01 01:45:09 +02:00
ejurgensen
11151affbd [misc] Add net_evhttp_bind() for centralizing libevent based binding 2021-03-31 23:55:25 +02:00
ejurgensen
dfc1580f13 [misc] Add logging of net_connect() service 2021-03-31 23:55:25 +02:00
ejurgensen
7871d71a9c [misc] Add utility network functions, incl configurable addr binding
Also make misc.c/h a bit less messy.
2021-03-31 23:55:25 +02:00
ejurgensen
ef0f41dc46 [airplay] Separate naming of AirPlay 1 and 2, incl log domains 2021-01-10 15:05:21 +01:00
ejurgensen
cd9fa019dd [misc] Add NTOSTR() macro
Get the string value of a number definition
2020-11-18 23:13:00 +01:00
ejurgensen
d86ca1176d [misc] Add an in-place string replacement function 2020-02-23 20:30:35 +01:00
whatdoineed2do/Ray
554799ebc3 [streaming/xcode] configurable MP3 streaming bitrate 2019-09-22 22:58:32 +02:00
ejurgensen
1752901529 [misc] Change b64_* to wrap ffmpeg's base64 encoder/decoder
Using ffmpeg's is probably better than having our own, plus it provides us with
decoded length, which we will need to support artwork via pipe.
2019-09-20 21:47:17 +02:00
ejurgensen
b3bfb0a5f6 [db] Move calculation of artist/album id's from sqlite to code
The purpose of this is to support library backends making their own
calculation of these id's, which is relevant if they have more information
available than just album_artist and album.

This also removes a bunch of sqlite extension code plus some triggers, which
in itself is probably an improvement.
2019-05-17 23:03:05 +02:00
ejurgensen
02cd65a992 [alsa] New resample-based sync correction 2019-04-08 00:50:20 +02:00
ejurgensen
53780a7ef3 [xcode] Make sample rate + channels variable
This change is preparation to use ffmpeg's resampling capabilities to keep local
audio in sync (by up/downsampling slightly). This requires that sample rates are
not fixed for a transcode profile.

Added benefit of this is that we don't need quite as many xcode profiles.
2019-04-02 22:47:11 +02:00
ejurgensen
19694ee1dd [misc] Add ringbuffer utility to misc.c/misc.h 2019-03-18 23:06:08 +01:00
ejurgensen
87ca6363ae [player/input] Refactor - WIP
* Open input sources earlier
* Gapless playback
* Remove fixed 44100/16 from player
* Complete restructure player internals
2019-03-18 23:06:08 +01:00
ejurgensen
cee740ae51 [misc] Move MIN() macro from raop.c to misc.c 2019-03-18 23:06:08 +01:00
ejurgensen
462d787fab [misc] Add media_quality struct for storing sample rate, bps and channels 2019-03-18 23:06:08 +01:00
chme
b000803fe3 [misc] Add compiler hint to check format parameters 2019-01-26 10:08:11 +01:00
ejurgensen
fc5a66f86d [misc] New utility functions: trim, atrim and safe_snprintf_cat 2018-12-31 15:55:49 +01:00
ejurgensen
16e375e637 [db/misc] Cast ARRAY_SIZE to unsigned (avoids compiler warnings) 2018-09-04 20:07:05 +02:00
chme
66bdb7c0a9 [db] Add function to get a human readable string for data and media kind 2018-03-14 19:21:57 +01:00
ejurgensen
a6fab4ac0d [httpd/mpd] Adjustments to commit #69ff42f 2017-11-15 23:13:20 +01:00
chme
5d5ed42749 [main/misc] Add misc-function to retrieve enabled buildoptions 2017-09-15 07:01:53 +02:00
chme
14877a49e0 [misc] Replace m_realpath with realpath from stdlib.h 2017-08-12 13:35:22 +02:00
ejurgensen
283df8aa72 [misc] Consolidate control file reader (e.g. for pairing credentials) into misc.c
- also remove requirement to enter device name in .remote file
2017-06-14 23:49:18 +02:00
ejurgensen
1aa8072e68 [misc] Change name of string_printf to safe_asprintf 2017-05-05 20:00:51 +02:00
ejurgensen
dcf75f59eb Merge branch 'string_printf' of git://github.com/chme/forked-daapd into chme-string_printf 2017-05-05 19:43:17 +02:00
ejurgensen
497ffc2f43 [misc] Add __attribute__((__noreturn__)) to our abort functions so
scan-build doesn't complain about logic errors after abort
2017-05-05 19:41:17 +02:00
chme
4e6b78ca29 [misc] Add string_printf function 2017-05-01 10:21:57 +02:00
ejurgensen
40d50d693b [misc] Add small function to swap pointers 2017-01-27 22:36:00 +01:00
ejurgensen
6db4e40119 [misc] Add function to add a relative time to current clock 2017-01-27 22:34:15 +01:00
ejurgensen
c50b038397 [misc] Move STOB and BTOS macros to misc.h 2017-01-27 22:01:24 +01:00
Scott Shambarger
6f7355dfce Merge branch 'fixthreads' into fixosx 2017-01-21 10:38:47 -05:00
sshambar
b128271656 Merge branch 'master' into fixthreads 2017-01-21 10:27:26 -05:00
Scott Shambarger
8e3797ec43 [threads] Update mutex/cond functions to use new CHECK_ERR macros
Added various macros to check return values and log any errors and abort
if the call fails.
Updated logging to handle early errors before logging initialized.
2017-01-21 07:11:20 -08:00
Scott Shambarger
bb68d59a6e [osx] Added missing timer/clock functions, support Bonjour mDNS on OSX
Added configure checks needed to detect missing functions on OSX
Added compat clock functions using clock_get_time on OSX
Added compat timer functions using clock_gettime and setitimer on OSX
Added byteswap functions on OSX
2017-01-14 00:56:43 -05:00
Scott Shambarger
b54d94fda6 [threads] Added missing initializers, check errors on mutex/cond calls 2017-01-13 17:32:59 -05:00
chme
263edaa8b3 [misc] Helper function safe_strdup (NULL safe strdup) 2017-01-13 18:56:37 +01:00
Scott Shambarger
ce4ef0aa23 [config] Many updates to configuration and feature checks
- Added custom checks for libraries and pkgconfig modules that test library
 presence with additional checks for use of headers and functions with
 given options.  Also support correct additional feature library checks
 using provided flags.
- Added custom enable/disable feature macros to simplify their use.
- Use custom CFLAGS and LIBS variables for Makefiles to simplify maintenance.
- Update many feature checks from platform to function.
- Streamline many function checks.
- Correctly check gnutls, gcrypt and gpg-error libraries.
- Fix chromecast and spotify config and compile on FreeBSD
- Added inotify, signalfd and kqueue, and byte swap checks.
- Many clarifications of error messages.
- Correct json-c checks to properly use supplied CFLAGS.
- Correct many quoting inconsistencies
- Use __DATE__ in place of BUILDDATE
- Use full path for gperf and antlr3
- Remove unnecessary CFLAGS
- Added tests for pthread_setname_np parameters
- Added tests for clock_gettime and timer_settime
- Added tests for time.h
- Test if pthread, dl and rt libs are required/available.
- Updated checks for libunistring
2017-01-06 00:44:18 -08:00
ejurgensen
561228d9f7 [misc] Add missing const qualifier 2016-07-31 23:27:57 +02:00
ejurgensen
4c887ba7bb [chromecast] First building blocks for supporting ChromeCast 2016-02-11 20:04:29 +01:00
stephan-01010011
32727bd296 Fixed bug that caused icy header metadata to be not correctly
encoded/converted. Characters above x7F were replaced by '?' character
although the rfc defines a ISO−8859−1 encoding for descriptive
field-content.

According to rfc2616 the field-content is defined as follows:
<the OCTETs making up the field-value and consisting of either *TEXT or
combinations of token, separators, and quoted-string>
The TEXT rule is only used for descriptive field contents and values
that are not intended to be interpreted by the message parser. Words of
*TEXT MAY contain characters from character sets other than ISO- 8859-1
only when encoded according to the rules of RFC 2047.

In the previous implementation the icy metadata was converted based on
fromcode "ascii".

Following incoming icy header field-values should be encoded as
"ISO−8859−1" before adding them to the metadata structure.

- misc.c unicode_fixup_string enhanced by an additional parameter to
define the fromcode
- misc.h unicode_fixup_string prototype updated
- filescanner.c function fixup_tags updated to stay compatible to the
previous implementation using fromcode "ascii"
- db.c function unicode_fixup_mfi updated to stay compatible to the
previous implementation using fromcode "ascii"
- http.c function metadata_header_get enhanced to encode the header
field-content as "ISO−8859−1" to comply with rfc2616
2015-05-31 14:05:31 +01:00
ejurgensen
65110a9f39 Fix FreeBSD sound timing problems 2014-09-27 22:59:19 +02:00
ejurgensen
21cf3ab7d3 Add trimwhitespace(), keyval sorting and alloc to misc functions
- features required by the LastFM module
2014-08-15 22:56:39 +02:00