mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-02-05 04:06:37 -05:00
pw-cat: also look at simple formats for extension
The simple formats contain some common mappings for other extensions such as mp3. Makes pw-record test.mp3 actually write an mp3 instead of a wav file.
This commit is contained in:
parent
f82f4945b9
commit
f978b702b1
1 changed files with 19 additions and 0 deletions
|
|
@ -1700,6 +1700,25 @@ static void format_from_filename(SF_INFO *info, const char *filename)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (format == -1) {
|
||||||
|
if (sf_command(NULL, SFC_GET_SIMPLE_FORMAT_COUNT, &count, sizeof(int)) != 0)
|
||||||
|
count = 0;
|
||||||
|
|
||||||
|
for (i = 0; i < count; i++) {
|
||||||
|
SF_FORMAT_INFO fi;
|
||||||
|
|
||||||
|
spa_zero(fi);
|
||||||
|
fi.format = i;
|
||||||
|
if (sf_command(NULL, SFC_GET_SIMPLE_FORMAT, &fi, sizeof(fi)) != 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (spa_strendswith(filename, fi.extension)) {
|
||||||
|
format = fi.format;
|
||||||
|
info->format = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if (format == -1)
|
if (format == -1)
|
||||||
format = spa_streq(filename, "-") ? SF_FORMAT_AU : SF_FORMAT_WAV;
|
format = spa_streq(filename, "-") ? SF_FORMAT_AU : SF_FORMAT_WAV;
|
||||||
if (format == SF_FORMAT_WAV && info->channels > 2)
|
if (format == SF_FORMAT_WAV && info->channels > 2)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue