mirror of
https://github.com/owntone/owntone-server.git
synced 2024-12-27 15:45:56 -05:00
[misc] Add media_quality struct for storing sample rate, bps and channels
This commit is contained in:
parent
ad77a42dbb
commit
462d787fab
@ -1039,6 +1039,11 @@ murmur_hash64(const void *key, int len, uint32_t seed)
|
|||||||
# error Platform not supported
|
# error Platform not supported
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
bool
|
||||||
|
quality_is_equal(struct media_quality *a, struct media_quality *b)
|
||||||
|
{
|
||||||
|
return (a->sample_rate == b->sample_rate && a->bits_per_sample == b->bits_per_sample && a->channels == b->channels);
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
peer_address_is_trusted(const char *addr)
|
peer_address_is_trusted(const char *addr)
|
||||||
|
14
src/misc.h
14
src/misc.h
@ -12,11 +12,18 @@
|
|||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
|
||||||
/* Samples to bytes, bytes to samples */
|
/* Samples to bytes, bytes to samples */
|
||||||
#define STOB(s) ((s) * 4)
|
#define STOB(s, bits, c) ((s) * (c) * (bits) / 8)
|
||||||
#define BTOS(b) ((b) / 4)
|
#define BTOS(b, bits, c) ((b) / ((c) * (bits) / 8))
|
||||||
|
|
||||||
#define ARRAY_SIZE(x) ((unsigned int)(sizeof(x) / sizeof((x)[0])))
|
#define ARRAY_SIZE(x) ((unsigned int)(sizeof(x) / sizeof((x)[0])))
|
||||||
|
|
||||||
|
// Remember to adjust quality_is_equal() if adding elements
|
||||||
|
struct media_quality {
|
||||||
|
int sample_rate;
|
||||||
|
int bits_per_sample;
|
||||||
|
int channels;
|
||||||
|
};
|
||||||
|
|
||||||
struct onekeyval {
|
struct onekeyval {
|
||||||
char *name;
|
char *name;
|
||||||
char *value;
|
char *value;
|
||||||
@ -114,6 +121,9 @@ b64_encode(const uint8_t *in, size_t len);
|
|||||||
uint64_t
|
uint64_t
|
||||||
murmur_hash64(const void *key, int len, uint32_t seed);
|
murmur_hash64(const void *key, int len, uint32_t seed);
|
||||||
|
|
||||||
|
bool
|
||||||
|
quality_is_equal(struct media_quality *a, struct media_quality *b);
|
||||||
|
|
||||||
// Checks if the address is in a network that is configured as trusted
|
// Checks if the address is in a network that is configured as trusted
|
||||||
bool
|
bool
|
||||||
peer_address_is_trusted(const char *addr);
|
peer_address_is_trusted(const char *addr);
|
||||||
|
Loading…
Reference in New Issue
Block a user