tool to test speaker and microphone (for end users!) More...
#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet_speaker_lib.h"
#include "gnunet_microphone_lib.h"
Go to the source code of this file.
Data Structures | |
struct | Recording |
A recording we made. More... | |
Macros | |
#define | TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5) |
How long do we record before we replay? More... | |
Functions | |
static void | do_shutdown (void *cls) |
Terminate test. More... | |
static void | switch_to_speaker (void *cls) |
Terminate recording process and switch to playback. More... | |
static void | record (void *cls, size_t data_size, const void *data) |
Process recorded audio data. More... | |
static void | run (void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg) |
Main function that will be run by the scheduler. More... | |
int | main (int argc, char *const *argv) |
The main function of our code to test microphone and speaker. More... | |
Variables | |
static int | ret |
Final status code. More... | |
static struct GNUNET_MICROPHONE_Handle * | microphone |
Handle to the microphone. More... | |
static struct GNUNET_SPEAKER_Handle * | speaker |
Handle to the speaker. More... | |
static struct GNUNET_SCHEDULER_Task * | switch_task |
Task scheduled to switch from recording to playback. More... | |
static struct GNUNET_SCHEDULER_Task * | st |
The shutdown task. More... | |
static struct Recording * | rec_head |
Head of DLL with recorded frames. More... | |
static struct Recording * | rec_tail |
Tail of DLL with recorded frames. More... | |
tool to test speaker and microphone (for end users!)
Definition in file gnunet-conversation-test.c.
#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5) |
How long do we record before we replay?
Definition at line 34 of file gnunet-conversation-test.c.
|
static |
Terminate test.
cls | NULL |
Definition at line 101 of file gnunet-conversation-test.c.
References _, GNUNET_CONTAINER_DLL_remove, GNUNET_free, GNUNET_MICROPHONE_destroy(), GNUNET_SCHEDULER_cancel(), GNUNET_SPEAKER_destroy(), microphone, rec_head, rec_tail, speaker, and switch_task.
Referenced by run(), and switch_to_speaker().
|
static |
Terminate recording process and switch to playback.
cls | NULL |
Definition at line 130 of file gnunet-conversation-test.c.
References _, GNUNET_MICROPHONE_Handle::cls, GNUNET_SPEAKER_Handle::cls, GNUNET_MICROPHONE_Handle::disable_microphone, do_shutdown(), GNUNET_SPEAKER_Handle::enable_speaker, GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_OK, GNUNET_SCHEDULER_add_delayed(), GNUNET_SCHEDULER_cancel(), GNUNET_SCHEDULER_shutdown(), microphone, Recording::next, GNUNET_SPEAKER_Handle::play, rec_head, ret, speaker, st, switch_task, and TIMEOUT.
Referenced by run().
|
static |
Process recorded audio data.
cls | clsoure |
data_size | number of bytes in data |
data | audio data to play |
Definition at line 171 of file gnunet-conversation-test.c.
References data, data_size, GNUNET_CONTAINER_DLL_insert_tail, GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_malloc, GNUNET_memcpy, rec_head, rec_tail, and Recording::size.
Referenced by add_record(), backtalker_monotime_cb(), cache_answers(), check_for_burst_address(), check_for_global_natted(), check_store(), display_record(), forward_reply(), GNUNET_GNSRECORD_JSON_from_gnsrecord(), got_hello(), handle_hello_for_client(), handle_hello_for_incoming(), handle_iterate_result(), handle_result(), handshake_ack_monotime_cb(), handshake_monotime_cb(), hello_add_iter(), hello_iter(), hello_iter_cb(), iterate_proc(), messenger_string_to_value(), messenger_value_to_string(), modify_record(), monitor_iterate_cb(), neighbour_dv_monotime_cb(), parse_recordline(), peer_respect_cb(), peerinfo_cb(), PEERSTORE_destroy_record(), PEERSTORE_parse_record_message(), process_command_stdin(), process_notify(), process_peer(), process_peerinfo_peers(), rekey_monotime_cb(), remove_client_query_record(), run(), send_reply(), try_cache(), and watch_notifier().
|
static |
Main function that will be run by the scheduler.
cls | closure |
args | remaining command-line arguments |
cfgfile | name of the configuration file used (for saving, can be NULL!) |
cfg | configuration |
Definition at line 199 of file gnunet-conversation-test.c.
References _, consensus-simulation::args, cfg, GNUNET_MICROPHONE_Handle::cls, do_shutdown(), GNUNET_MICROPHONE_Handle::enable_microphone, GNUNET_assert, GNUNET_MICROPHONE_create_from_hardware(), GNUNET_OK, GNUNET_SCHEDULER_add_delayed(), GNUNET_SCHEDULER_add_shutdown(), GNUNET_SCHEDULER_shutdown(), GNUNET_SPEAKER_create_from_hardware(), GNUNET_STRINGS_relative_time_to_string(), GNUNET_YES, microphone, record(), ret, speaker, st, switch_task, switch_to_speaker(), and TIMEOUT.
Referenced by main().
int main | ( | int | argc, |
char *const * | argv | ||
) |
The main function of our code to test microphone and speaker.
argc | number of arguments from the command line |
argv | command line arguments |
Definition at line 241 of file gnunet-conversation-test.c.
References gettext_noop, GNUNET_free_nz, GNUNET_GETOPT_OPTION_END, GNUNET_OK, GNUNET_PROGRAM_run(), GNUNET_STRINGS_get_utf8_args(), options, ret, and run().
|
static |
Final status code.
Definition at line 62 of file gnunet-conversation-test.c.
Referenced by main(), run(), and switch_to_speaker().
|
static |
Handle to the microphone.
Definition at line 67 of file gnunet-conversation-test.c.
Referenced by do_shutdown(), GNUNET_MICROPHONE_create_from_hardware(), GNUNET_MICROPHONE_destroy(), run(), and switch_to_speaker().
|
static |
Handle to the speaker.
Definition at line 72 of file gnunet-conversation-test.c.
Referenced by do_shutdown(), GNUNET_CONVERSATION_call_resume(), GNUNET_CONVERSATION_call_start(), GNUNET_CONVERSATION_caller_pick_up(), GNUNET_CONVERSATION_caller_resume(), GNUNET_SPEAKER_create_from_hardware(), GNUNET_SPEAKER_destroy(), run(), and switch_to_speaker().
|
static |
Task scheduled to switch from recording to playback.
Definition at line 77 of file gnunet-conversation-test.c.
Referenced by do_shutdown(), run(), and switch_to_speaker().
|
static |
The shutdown task.
Definition at line 82 of file gnunet-conversation-test.c.
Referenced by check_timeouts(), GNUNET_CRYPTO_hkdf_extract(), GNUNET_CRYPTO_hkdf_gnunet_v(), GNUNET_HOSTLIST_client_start(), GNUNET_HOSTLIST_server_start(), GNUNET_NAT_stun_handle_packet_(), GNUNET_STRINGS_check_filename(), handle_flow_control(), hkdf_expand(), run(), run_process_and_wait(), stun_get_mapped(), switch_to_speaker(), and zone_iteration_error().
|
static |
Head of DLL with recorded frames.
Definition at line 87 of file gnunet-conversation-test.c.
Referenced by do_shutdown(), record(), and switch_to_speaker().
|
static |
Tail of DLL with recorded frames.
Definition at line 92 of file gnunet-conversation-test.c.
Referenced by do_shutdown(), and record().