mirror of
https://github.com/outbackdingo/UltraGrid.git
synced 2026-03-21 06:40:15 +00:00
Capabilities: Print supported audio compressions
This commit is contained in:
committed by
Martin Piatka
parent
16f1de3119
commit
c96a20dec8
@@ -90,24 +90,37 @@ struct audio_codec_state {
|
||||
int bitrate;
|
||||
};
|
||||
|
||||
std::vector<std::pair<std::string, bool>> get_audio_codec_list(void){
|
||||
std::vector<std::pair<std::string, bool>> ret;
|
||||
|
||||
for (auto const &it : audio_codec_info) {
|
||||
if(it.first != AC_NONE) {
|
||||
struct audio_codec_state *st = (struct audio_codec_state *)
|
||||
audio_codec_init_real(get_name_to_audio_codec(it.first),
|
||||
AUDIO_CODER, true);
|
||||
bool available = false;
|
||||
if(st){
|
||||
available = true;
|
||||
audio_codec_done(st);
|
||||
}
|
||||
ret.emplace_back(it.second.name, available);
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void list_audio_codecs(void) {
|
||||
printf("Syntax:\n");
|
||||
printf("\t--audio-codec <audio_codec>[:sample_rate=<sampling_rate>][:bitrate=<bitrate>]\n");
|
||||
printf("\n");
|
||||
printf("Supported audio codecs:\n");
|
||||
for (auto const &it : audio_codec_info) {
|
||||
if(it.first != AC_NONE) {
|
||||
printf("\t%s", it.second.name);
|
||||
struct audio_codec_state *st = (struct audio_codec_state *)
|
||||
audio_codec_init_real(get_name_to_audio_codec(it.first),
|
||||
AUDIO_CODER, true);
|
||||
if(!st) {
|
||||
printf(" - unavailable");
|
||||
} else {
|
||||
audio_codec_done(st);
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
for (auto const &it : get_audio_codec_list()) {
|
||||
printf("\t%s", it.first.c_str());
|
||||
if(!it.second) {
|
||||
printf(" - unavailable");
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -87,6 +87,7 @@ audio_frame2 audio_codec_decompress(struct audio_codec_state *, audio_frame2 *);
|
||||
const int *audio_codec_get_supported_samplerates(struct audio_codec_state *);
|
||||
void audio_codec_done(struct audio_codec_state *);
|
||||
|
||||
std::vector<std::pair<std::string, bool>> get_audio_codec_list(void);
|
||||
void list_audio_codecs(void);
|
||||
|
||||
audio_codec_t get_audio_codec(const char *audio_codec_cfg);
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
|
||||
#include "audio/audio_capture.h"
|
||||
#include "audio/audio_playback.h"
|
||||
#include "audio/codec.h"
|
||||
#include "debug.h"
|
||||
#include "lib_common.h"
|
||||
#include "messaging.h"
|
||||
@@ -293,6 +294,12 @@ void print_capabilities(struct module *root, bool use_vidcap)
|
||||
}
|
||||
free(devices);
|
||||
}
|
||||
|
||||
// audio compressions
|
||||
auto codecs = get_audio_codec_list();
|
||||
for(const auto& codec : codecs){
|
||||
cout << "[cap][audio_compress] " << codec.first << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
void print_version()
|
||||
|
||||
Reference in New Issue
Block a user