Commit graph

106 commits

Author SHA1 Message Date
Wim Taymans
d5d8ebeaac pw-cat: only override properties when not already set
This makes it possible to override any of the properties with -P such as
the graph rate.
2023-06-30 16:24:13 +02:00
Carlos Rafael Giani
f03c606ad9 pw-cat: Keep track of excess playtime when playing encoded audio 2023-02-24 14:15:13 +01:00
Carlos Rafael Giani
dc161fc6af pw-cat: Rework encoded audio support to use libavformat to parse frames 2023-02-24 14:15:13 +01:00
Carlos Rafael Giani
580a3d9872 pw-cat: Enable libavutil logs
This is useful for debugging pw-cat encoded audio playback errors.
2023-02-24 14:15:13 +01:00
Barnabás Pőcze
934ab3036e treewide: use SPDX tags to specify copyright information
SPDX tags make the licensing information easy to understand and clear,
and they are machine parseable.

See https://spdx.dev for more information.
2023-02-16 10:54:48 +00:00
Wim Taymans
dd0d3ac264 pw-cat: remove useless code
The data stride for encoded formats should be 1 and also placed in the
stride in the buffer (not 0). So there is really no difference with the
regular codepath.
2023-02-14 16:44:52 +01:00
Wim Taymans
b9ddd54a98 pw-cat: don't read more than the requested frames 2023-02-14 16:44:52 +01:00
Carlos Rafael Giani
59ad6c26aa pw-cat: Add fallback for the older libavcodec channel layout API
Signed-off-by: Carlos Rafael Giani <crg7475@mailbox.org>
2023-01-24 08:44:14 +00:00
Carlos Rafael Giani
e261f2ac1c pw-cat: Check for pw_cat_ffmpeg flag instead of HAVE_ALSA_COMPRESS_OFFLOAD
FFmpeg integration in pw-cat does not strictly require Compress-Offload;
for example, there could be other nodes in the graph that can handle
compressed audio.

Signed-off-by: Carlos Rafael Giani <crg7475@mailbox.org>
2023-01-24 08:44:14 +00:00
Carlos Rafael Giani
e9a2c6aa34 Rename "compressed-offload to "Compress-Offload" in the code 2023-01-24 08:44:14 +00:00
Sanchayan Maity
55a79fd16a pw-cat: Add support for compressed formats 2023-01-24 08:44:14 +00:00
Wim Taymans
f472fd736d fix includes
Only include debug we need. We usually only need the debug types.
2023-01-18 13:12:16 +01:00
Wim Taymans
1beddd78d2 tools: clarify the target param
The target param is an object.serial or node.name.
Use TARGET_OBJECT instead of NODE_TARGET.
2023-01-10 16:45:50 +01:00
Wim Taymans
9b6e504c19 clean up some more array iterations 2022-10-03 09:20:42 +02:00
Thomas Weißschuh
bbb3cdc185 pw-cat: clean up resource correctly on EIO
The core has already been connected and the loop is running so we also
have to clean those up.

Fixes #2651
2022-08-19 07:34:02 +00:00
Wim Taymans
d030983212 pw-cat: don't print useless error
getopt has already printed a much better error for us.

See #2558
2022-07-17 16:47:24 +02:00
Wim Taymans
d1ee783322 pw-cat: read and write raw formats correctly
We need to transform the number of bytes into frames.
2022-06-29 17:29:16 +02:00
Wim Taymans
b9fa0e6f28 pw-cat: also set rate/latency for pipe
Move the latency and rate properties to a separate function so that
we can call it in all cases and not just for sndfile io.
Simplify format handling.
2022-06-15 12:35:56 +02:00
Wim Taymans
81eee88dd8 pw-cat: support stdin/stdout for input/output
A - filename will read or write from the stdin/out.

Fixes #2387
2022-05-20 08:03:03 +02:00
Wim Taymans
6ed91ae0d8 pw-cat: add -P option
Add -P option to pass custom properties to the stream.
2022-05-18 17:31:18 +02:00
Wim Taymans
c48a4bc166 pw-cat: fix DSF playback again
Make the DSD buffers a little bigger because we scale down the rate.
Read an interleaved number of samples to fill one quantum.
2022-04-28 12:32:08 +02:00
Wim Taymans
d9871f36c1 pw-cat: support saving to other file formats
Use the extension to find the file format and save to it instead of
forcing wav.

See #2328
2022-04-25 20:43:18 +02:00
Wim Taymans
32b2377de3 pw-cat: don't start drain on 0 request size
When the stream requests a 0 size buffer, don't start the drain but
simply queue a 0 size buffer.

Sometimes, switching quantums and drivers might request a 0 buffer
async and this should not cause a drain operation.
2022-04-19 18:29:47 +02:00
Wim Taymans
ecff225b11 pw-cat: remove code to list targets
Introspection of default devices should be done elsewhere.
2022-04-13 16:02:46 +02:00
Wim Taymans
5d31ec74ac stream: report queued and dequeued buffers in pw_time 2022-03-31 10:19:05 +02:00
Wim Taymans
0503ced8ab pw-cat: set buffer size field in frames
So that we get a meaningful value for the pw_time.queued field.
2022-03-31 10:16:15 +02:00
Wim Taymans
5ec7a9f40c pw-cat: start timer when playing 2022-03-31 10:15:57 +02:00
Wim Taymans
5a9d2679ca stream: add pw_stream_get_time_n()
Deprecate pw_stream_get_time() in favour of _get_time_n() that contains
the size of the pw_time structure. Make the old one fill in the fields
up to the buffered field. Make the new one use the size to decide how
much info to fill in.

Add a new buffered field in pw_time that contains the buffered data
inside the converter/resampler. This leaves the queued field with
purely the user provided size in the buffers.

Use get_time_n() in places.
2022-03-29 17:30:38 +02:00
Wim Taymans
46d1328e1c pw-cat: improve output 2022-03-29 12:47:16 +02:00
Wim Taymans
7e42c905a8 remove the rate_match io
Now that the stream provides us with a requested size, we don't need to
use the rate_match anymore.
2022-03-29 09:57:49 +02:00
Pauli Virtanen
c66bb65c7a pipewire: don't setlocale from pw_init, let parent app set it
Library code generally shouldn't modify global state, so pw_init()
should not result to changing the C locale.

Instead, set the C locale in main() for tools and daemons.

We'll still setlocale for LC_MESSAGES, to get translated UI elements in
wireplumber. This workaround should be removed eventually...
2022-03-22 21:32:35 +02:00
Wim Taymans
a6304b47f6 pw-cat: improve DSD file reading
Support reading non-multiples of the blocksize.
Stop reading at the end of the file.
2022-03-03 16:05:03 +01:00
Wim Taymans
ce2f1b3737 dsffile: fix negative interleave 2022-03-03 14:01:32 +01:00
Wim Taymans
3db14600b2 remove some listeners 2022-02-09 12:33:52 +01:00
Wim Taymans
afc88a12e5 tools: cleanup up printf
Make all tools output to stdout (pw-mon mostly) so that we can pipe the
output around.
Send errors to stderr.
fprintf(stdout, ...)  -> printf(...)
setlinebuf for stdout so that pipe works better.

See #2110
2022-02-07 17:03:46 +01:00
Wim Taymans
8415fa525f pw-cat: print "monitor" when recording from a sink 2022-01-17 14:47:27 +01:00
Wim Taymans
c46113faa3 json: spa_json_get_string() writes up to len chars or fail 2022-01-04 10:42:32 +01:00
Wim Taymans
2f4c589d5b pw-cat: also list additional targets in record mode
Also list the sink and output stream nodes because we can also record
from them.

Fixes #1952
2022-01-03 16:59:21 +01:00
Wim Taymans
45d9c2c9df pw-cat: use default metadata for default source/sink 2021-10-20 11:40:33 +02:00
Wim Taymans
d8aec1c7b4 pw-play: move dsdplay into pw-cat 2021-09-21 12:29:41 +02:00
Julian Bouzas
34b1ecc244 pw-cat: calculate number of samples properly with io_rate_match
Fixes wrong buffer sizes when adapter is configured in passthrough mode.
2021-08-25 19:23:23 +00:00
Wim Taymans
0bad741d45 pw-cat: suggest samplerate as graph rate 2021-08-18 09:44:53 +02:00
Wim Taymans
49c1c0386f pw-cat: fix raw read
raw read needs bytes, so use the stride to calculate it from frames.
Move ulaw/alaw to packed formats.
2021-08-17 17:56:31 +02:00
Wim Taymans
f7c91491cb pw-cat: support ulaw/alaw formats 2021-08-17 17:35:31 +02:00
Barnabás Pőcze
f5d51162c4 treewide: mark things static and const
Mark some structures, arrays static/const at various places.
In some cases this prevents unnecessary initialization
when a function is entered.

All in all, the text segments across all shared
libraries are reduced by about 2 KiB. However,
the total size increases by about 2 KiB as well.
2021-06-30 14:44:08 +02:00
Wim Taymans
5497d2d907 pw-cat: fix format string 2021-06-28 17:21:28 +02:00
George Kiagiadakis
59407d2f08 includes: update all references to extensions to point to pipewire/extensions
This also brings the advantage that all tools, examples, modules, components
can also be compiled standalone out-of-tree using libpipewire from the system
2021-06-18 17:54:18 +03:00
Wim Taymans
6971d11901 pw-cat: support u8 format as well 2021-06-03 10:10:18 +02:00
Peter Hutterer
e0471c6757 pipewire: allow NULL pointers in pw_properties_free()
Just like the real free() we should just ignore a NULL pointer, makes the
caller code easier for those instances where properties are optional.

Patch generated with concinelle with a few manual fixes.
2021-06-02 10:56:46 +00:00
Wim Taymans
f383ac21dd pw-cat: remove debug 2021-05-27 15:26:09 +02:00