Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Audio initialization/deinitialization moved directly before/after the pl... #297

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions common.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
shairport_cfg config;

int debuglev = 0;
char ** newArgv;
int newArgc;

void die(char *format, ...) {
fprintf(stderr, "FATAL: ");
Expand Down
3 changes: 3 additions & 0 deletions common.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ void command_stop(void);

extern shairport_cfg config;

extern int newArgc;
extern char ** newArgv;

void shairport_shutdown(int retval);
void shairport_startup_complete(void);

Expand Down
9 changes: 8 additions & 1 deletion player.c
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,9 @@ void player_flush(void) {
}

int player_play(stream_cfg *stream) {

config.output->init(newArgc, newArgv);

if (config.buffer_start_fill > BUFFER_FRAMES)
die("specified buffer starting fill %d > buffer size %d",
config.buffer_start_fill, BUFFER_FRAMES);
Expand Down Expand Up @@ -530,7 +533,11 @@ void player_stop(void) {
command_stop();
free_buffer();
free_decoder();
#ifdef FANCY_RESAMPLING

config.output->deinit();


#ifdef FANCY_RESAMPLING
free_src();
#endif
}
11 changes: 9 additions & 2 deletions shairport.c
Original file line number Diff line number Diff line change
Expand Up @@ -302,8 +302,15 @@ int main(int argc, char **argv) {
if (!config.output) {
audio_ls_outputs();
die("Invalid audio output specified!");
}
config.output->init(argc-audio_arg, argv+audio_arg);
}

//temporary initialization to check the settings..
newArgc=argc-audio_arg;
newArgv=argv+audio_arg;
config.output->init(newArgc, newArgv);
printf("Checking audio output...\n");
config.output->deinit();
printf("Audio output checked succesfully\n");

uint8_t ap_md5[16];
MD5_CTX ctx;
Expand Down