mirror of
https://gitlab.freedesktop.org/pipewire/pipewire
synced 2024-10-02 22:25:17 +00:00
Rename "compressed-offload to "Compress-Offload" in the code
This commit is contained in:
parent
55a79fd16a
commit
e9a2c6aa34
|
@ -270,10 +270,10 @@ need_avcodec = get_option('ffmpeg').enabled() or get_option('pw-cat').enabled()
|
|||
avcodec_dep = dependency('libavcodec', required: need_avcodec)
|
||||
avformat_dep = dependency('libavformat', required: get_option('pw-cat'))
|
||||
summary({'Libav for pw-cat': avcodec_dep.found() and avformat_dep.found()}, bool_yn: true, section: 'Support for ALSA Compress-Offload API')
|
||||
tinycompress_dep = cc.find_library('tinycompress', has_headers: ['tinycompress/tinycompress.h' ], required: get_option('compressed-offload'))
|
||||
summary({'Compressed offload sink': tinycompress_dep.found()}, bool_yn: true, section: 'Support for ALSA Compress-Offload API')
|
||||
compressed_offload_enabled = avcodec_dep.found() and avformat_dep.found() and tinycompress_dep.found()
|
||||
cdata.set('HAVE_COMPRESSED_OFFLOAD', compressed_offload_enabled)
|
||||
tinycompress_dep = cc.find_library('tinycompress', has_headers: ['tinycompress/tinycompress.h' ], required: get_option('compress-offload'))
|
||||
summary({'Compress-Offload sink': tinycompress_dep.found()}, bool_yn: true, section: 'Support for ALSA Compress-Offload API')
|
||||
compress_offload_enabled = avcodec_dep.found() and avformat_dep.found() and tinycompress_dep.found()
|
||||
cdata.set('HAVE_ALSA_COMPRESS_OFFLOAD', compress_offload_enabled)
|
||||
|
||||
summary({'readline (for pw-cli)': readline_dep.found()}, bool_yn: true, section: 'Misc dependencies')
|
||||
cdata.set('HAVE_READLINE', readline_dep.found())
|
||||
|
|
|
@ -273,7 +273,7 @@ option('gsettings',
|
|||
description: 'Enable code that depends on gsettings',
|
||||
type: 'feature',
|
||||
value: 'auto')
|
||||
option('compressed-offload',
|
||||
description: 'Enable compressed offload support',
|
||||
option('compress-offload',
|
||||
description: 'Enable ALSA Compress-Offload support',
|
||||
type: 'feature',
|
||||
value: 'auto')
|
||||
|
|
|
@ -110,6 +110,8 @@ extern "C" {
|
|||
#define SPA_NAME_API_ALSA_SEQ_BRIDGE "api.alsa.seq.bridge" /**< an alsa Node interface for
|
||||
* bridging midi ports */
|
||||
#define SPA_NAME_API_ALSA_ACP_DEVICE "api.alsa.acp.device" /**< an alsa ACP Device interface */
|
||||
#define SPA_NAME_API_ALSA_COMPRESS_OFFLOAD_SINK "api.alsa.compress.offload.sink" /**< an alsa Node interface for
|
||||
* compressed audio */
|
||||
|
||||
/** keys for bluez5 factory names */
|
||||
#define SPA_NAME_API_BLUEZ5_ENUM_DBUS "api.bluez5.enum.dbus" /**< a dbus Device interface */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Spa
|
||||
/* Spa ALSA Compress-Offload sink
|
||||
*
|
||||
* Copyright © 2022 Wim Taymans
|
||||
* © 2022 Asymptotic Inc.
|
||||
|
@ -38,6 +38,7 @@
|
|||
#include <spa/utils/list.h>
|
||||
#include <spa/utils/keys.h>
|
||||
#include <spa/utils/json.h>
|
||||
#include <spa/utils/names.h>
|
||||
#include <spa/utils/string.h>
|
||||
#include <spa/utils/result.h>
|
||||
#include <spa/node/node.h>
|
||||
|
@ -52,16 +53,16 @@
|
|||
#include <spa/pod/filter.h>
|
||||
#include <spa/control/control.h>
|
||||
|
||||
//#include <libavcodec/codec_id.h>
|
||||
#include <sound/compress_params.h>
|
||||
#include <tinycompress/tinycompress.h>
|
||||
|
||||
/*
|
||||
* This creates a Pipewire sink node which uses the tinycompress user space
|
||||
* library to use the ALSA compressed APIs for writing compressed data like
|
||||
* MP3, FLAC etc. to an ALSA compressed device.
|
||||
* library to use the ALSA Compress-Offload API for writing compressed data
|
||||
* like MP3, FLAC etc. to an DSP that can handle such data directly.
|
||||
*
|
||||
* These show up differently under /dev/snd like comprCxDx.
|
||||
* These show up under /dev/snd like comprCxDx, as opposed to regular
|
||||
* ALSA PCM devices.
|
||||
*
|
||||
* root@dragonboard-845c:~# ls /dev/snd
|
||||
* by-path comprC0D3 controlC0 pcmC0D0c pcmC0D0p pcmC0D1c pcmC0D1p pcmC0D2c pcmC0D2p timer
|
||||
|
@ -71,8 +72,8 @@
|
|||
* context.objects = [
|
||||
* { factory = spa-node-factory
|
||||
* args = {
|
||||
* factory.name = api.alsa.compressed.sink
|
||||
* node.name = Compressed-Sink
|
||||
* factory.name = api.alsa.compress.offload.sink
|
||||
* node.name = Compress-Offload-Sink
|
||||
* media.class = "Audio/Sink"
|
||||
* api.alsa.path = "hw:0,3"
|
||||
* }
|
||||
|
@ -88,7 +89,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#define NAME "compressed-audio-sink"
|
||||
#define NAME "compress-offload-audio-sink"
|
||||
#define DEFAULT_CHANNELS 2
|
||||
#define DEFAULT_RATE 44100
|
||||
#define MAX_BUFFERS 4
|
||||
|
@ -675,7 +676,7 @@ compress_setup(struct impl *this, struct spa_audio_info *info, uint32_t *out_rat
|
|||
case SPA_MEDIA_SUBTYPE_wma:
|
||||
codec->id = SND_AUDIOCODEC_WMA;
|
||||
/*
|
||||
* WMA does not work with compressed offload if codec profile
|
||||
* WMA does not work with Compress-Offload if codec profile
|
||||
* is not set.
|
||||
*/
|
||||
switch (info->info.wma.profile) {
|
||||
|
@ -1070,7 +1071,7 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
if ((str[0] == 'h') || (str[1] == 'w') || (str[2] == ':')) {
|
||||
snprintf(this->props.device, sizeof(this->props.device), "%s", str);
|
||||
} else {
|
||||
spa_log_error(this->log, NAME " %p: Invalid compressed hw %s", this, str);
|
||||
spa_log_error(this->log, NAME " %p: Invalid Compress-Offload hw %s", this, str);
|
||||
return -EINVAL;
|
||||
}
|
||||
} else {
|
||||
|
@ -1093,7 +1094,7 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
this->codecs_supported[i] = codec_info[i].codec_id;
|
||||
}
|
||||
|
||||
spa_log_info(this->log, NAME " %p: Initialized compressed sink %s",
|
||||
spa_log_info(this->log, NAME " %p: Initialized Compress-Offload sink %s",
|
||||
this, this->props.device);
|
||||
|
||||
return 0;
|
||||
|
@ -1126,15 +1127,15 @@ impl_enum_interface_info(const struct spa_handle_factory *factory,
|
|||
|
||||
static const struct spa_dict_item info_items[] = {
|
||||
{ SPA_KEY_FACTORY_AUTHOR, "Sanchayan Maity <sanchayan@asymptotic.io>" },
|
||||
{ SPA_KEY_FACTORY_DESCRIPTION, "Consume compressed audio" },
|
||||
{ SPA_KEY_FACTORY_DESCRIPTION, "Play compressed audio (like MP3 or AAC) with the ALSA Compress-Offload API" },
|
||||
{ SPA_KEY_FACTORY_USAGE, "["SPA_KEY_API_ALSA_PATH"=<path>]" },
|
||||
};
|
||||
|
||||
static const struct spa_dict info = SPA_DICT_INIT_ARRAY(info_items);
|
||||
|
||||
const struct spa_handle_factory spa_alsa_compressed_sink_factory = {
|
||||
const struct spa_handle_factory spa_alsa_compress_offload_sink_factory = {
|
||||
SPA_VERSION_HANDLE_FACTORY,
|
||||
"api.alsa.compressed.sink",
|
||||
SPA_NAME_API_ALSA_COMPRESS_OFFLOAD_SINK,
|
||||
&info,
|
||||
impl_get_size,
|
||||
impl_init,
|
|
@ -35,8 +35,8 @@ extern const struct spa_handle_factory spa_alsa_udev_factory;
|
|||
extern const struct spa_handle_factory spa_alsa_device_factory;
|
||||
extern const struct spa_handle_factory spa_alsa_seq_bridge_factory;
|
||||
extern const struct spa_handle_factory spa_alsa_acp_device_factory;
|
||||
#ifdef HAVE_COMPRESSED_OFFLOAD
|
||||
extern const struct spa_handle_factory spa_alsa_compressed_sink_factory;
|
||||
#ifdef HAVE_ALSA_COMPRESS_OFFLOAD
|
||||
extern const struct spa_handle_factory spa_alsa_compress_offload_sink_factory;
|
||||
#endif
|
||||
|
||||
struct spa_log_topic log_topic = SPA_LOG_TOPIC(0, "spa.alsa");
|
||||
|
@ -67,9 +67,9 @@ int spa_handle_factory_enum(const struct spa_handle_factory **factory, uint32_t
|
|||
case 5:
|
||||
*factory = &spa_alsa_acp_device_factory;
|
||||
break;
|
||||
#ifdef HAVE_COMPRESSED_OFFLOAD
|
||||
#ifdef HAVE_ALSA_COMPRESS_OFFLOAD
|
||||
case 6:
|
||||
*factory = &spa_alsa_compressed_sink_factory;
|
||||
*factory = &spa_alsa_compress_offload_sink_factory;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
|
|
|
@ -15,7 +15,7 @@ spa_alsa_sources = ['alsa.c',
|
|||
'alsa-seq.c']
|
||||
|
||||
if tinycompress_dep.found()
|
||||
spa_alsa_sources += [ 'alsa-compressed-sink.c' ]
|
||||
spa_alsa_sources += [ 'alsa-compress-offload-sink.c' ]
|
||||
spa_alsa_dependencies += tinycompress_dep
|
||||
endif
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#ifdef HAVE_COMPRESSED_OFFLOAD
|
||||
#ifdef HAVE_ALSA_COMPRESS_OFFLOAD
|
||||
#include <libavformat/avformat.h>
|
||||
#include <libavcodec/avcodec.h>
|
||||
#endif
|
||||
|
@ -115,7 +115,7 @@ struct data {
|
|||
#define TYPE_PCM 0
|
||||
#define TYPE_MIDI 1
|
||||
#define TYPE_DSD 2
|
||||
#ifdef HAVE_COMPRESSED_OFFLOAD
|
||||
#ifdef HAVE_ALSA_COMPRESS_OFFLOAD
|
||||
#define TYPE_ENCODED 3
|
||||
#endif
|
||||
int data_type;
|
||||
|
@ -162,7 +162,7 @@ struct data {
|
|||
struct dsf_layout layout;
|
||||
} dsf;
|
||||
|
||||
#ifdef HAVE_COMPRESSED_OFFLOAD
|
||||
#ifdef HAVE_ALSA_COMPRESS_OFFLOAD
|
||||
FILE *encoded_file;
|
||||
AVFormatContext *fmt_context;
|
||||
AVStream *astream;
|
||||
|
@ -251,7 +251,7 @@ static int sf_playback_fill_f64(struct data *d, void *dest, unsigned int n_frame
|
|||
return (int)rn;
|
||||
}
|
||||
|
||||
#ifdef HAVE_COMPRESSED_OFFLOAD
|
||||
#ifdef HAVE_ALSA_COMPRESS_OFFLOAD
|
||||
static int encoded_playback_fill(struct data *d, void *dest, unsigned int n_frames)
|
||||
{
|
||||
int ret, size = 0;
|
||||
|
@ -394,7 +394,7 @@ playback_fill_fn(uint32_t fmt)
|
|||
if (sizeof(double) != 8)
|
||||
return NULL;
|
||||
return sf_playback_fill_f64;
|
||||
#ifdef HAVE_COMPRESSED_OFFLOAD
|
||||
#ifdef HAVE_ALSA_COMPRESS_OFFLOAD
|
||||
case SPA_AUDIO_FORMAT_ENCODED:
|
||||
return encoded_playback_fill;
|
||||
#endif
|
||||
|
@ -786,7 +786,7 @@ static void on_process(void *userdata)
|
|||
n_frames = d->maxsize / data->stride;
|
||||
n_frames = SPA_MIN(n_frames, (int)b->requested);
|
||||
|
||||
#ifdef HAVE_COMPRESSED_OFFLOAD
|
||||
#ifdef HAVE_ALSA_COMPRESS_OFFLOAD
|
||||
n_fill_frames = data->fill(data, p, n_frames);
|
||||
|
||||
if (n_fill_frames > 0 || n_frames == 0) {
|
||||
|
@ -983,7 +983,7 @@ static void show_usage(const char *name, bool is_error)
|
|||
" -r, --record Recording mode\n"
|
||||
" -m, --midi Midi mode\n"
|
||||
" -d, --dsd DSD mode\n"
|
||||
#ifdef HAVE_COMPRESSED_OFFLOAD
|
||||
#ifdef HAVE_ALSA_COMPRESS_OFFLOAD
|
||||
" -o, --encoded Encoded mode\n"
|
||||
#endif
|
||||
"\n"), fp);
|
||||
|
@ -1273,7 +1273,7 @@ static void format_from_filename(SF_INFO *info, const char *filename)
|
|||
info->format = (info->format & ~SF_FORMAT_SUBMASK) | SF_FORMAT_VORBIS;
|
||||
}
|
||||
|
||||
#ifdef HAVE_COMPRESSED_OFFLOAD
|
||||
#ifdef HAVE_ALSA_COMPRESS_OFFLOAD
|
||||
static int setup_encodedfile(struct data *data)
|
||||
{
|
||||
int ret;
|
||||
|
@ -1575,7 +1575,7 @@ int main(int argc, char *argv[])
|
|||
goto error_no_props;
|
||||
}
|
||||
|
||||
#ifdef HAVE_COMPRESSED_OFFLOAD
|
||||
#ifdef HAVE_ALSA_COMPRESS_OFFLOAD
|
||||
while ((c = getopt_long(argc, argv, "hvprmdoR:q:P:", long_options, NULL)) != -1) {
|
||||
#else
|
||||
while ((c = getopt_long(argc, argv, "hvprmdR:q:P:", long_options, NULL)) != -1) {
|
||||
|
@ -1616,7 +1616,7 @@ int main(int argc, char *argv[])
|
|||
data.data_type = TYPE_DSD;
|
||||
break;
|
||||
|
||||
#ifdef HAVE_COMPRESSED_OFFLOAD
|
||||
#ifdef HAVE_ALSA_COMPRESS_OFFLOAD
|
||||
case 'o':
|
||||
data.data_type = TYPE_ENCODED;
|
||||
break;
|
||||
|
@ -1793,7 +1793,7 @@ int main(int argc, char *argv[])
|
|||
case TYPE_DSD:
|
||||
ret = setup_dsffile(&data);
|
||||
break;
|
||||
#ifdef HAVE_COMPRESSED_OFFLOAD
|
||||
#ifdef HAVE_ALSA_COMPRESS_OFFLOAD
|
||||
case TYPE_ENCODED:
|
||||
ret = setup_encodedfile(&data);
|
||||
break;
|
||||
|
@ -1816,7 +1816,7 @@ int main(int argc, char *argv[])
|
|||
ret = setup_properties(&data);
|
||||
|
||||
switch (data.data_type) {
|
||||
#ifdef HAVE_COMPRESSED_OFFLOAD
|
||||
#ifdef HAVE_ALSA_COMPRESS_OFFLOAD
|
||||
case TYPE_ENCODED:
|
||||
{
|
||||
struct spa_audio_info info;
|
||||
|
@ -1924,7 +1924,7 @@ int main(int argc, char *argv[])
|
|||
/* and wait while we let things run */
|
||||
pw_main_loop_run(data.loop);
|
||||
|
||||
#ifdef HAVE_COMPRESSED_OFFLOAD
|
||||
#ifdef HAVE_ALSA_COMPRESS_OFFLOAD
|
||||
if (data.encoded_file)
|
||||
fclose(data.encoded_file);
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue