X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=afs.c;h=29bae161682bc00f6fd133e3c29ca7e5df06994d;hp=6dac43d79a61a8d3b7d041c406af2eed61b14028;hb=e19276003c9158fceccae4d7e626cabb2fb5b0dd;hpb=f7212adf2159341127331436d2ddc9e1f7a21563 diff --git a/afs.c b/afs.c index 6dac43d7..29bae161 100644 --- a/afs.c +++ b/afs.c @@ -22,10 +22,10 @@ * the current audio format, audio file selector and of the activated senders. */ +#include "server.h" #include /* gettimeofday */ #include "server.cmdline.h" #include "db.h" -#include "server.h" #include "afs.h" #include "send.h" #include "error.h" @@ -38,7 +38,7 @@ static struct timeval data_send_barrier; static struct timeval eof_barrier; extern struct misc_meta_data *mmd; -extern struct audio_file_selector dblist[]; +extern struct audio_file_selector selectors[]; extern struct sender senders[]; extern struct gengetopt_args_info conf; @@ -51,6 +51,9 @@ static FILE *audio_file = NULL; #ifdef HAVE_OGGVORBIS void ogg_init(void *); #endif +#ifdef HAVE_FAAD + void aac_afh_init(void *); +#endif /** * the list of supported audio formats @@ -67,6 +70,12 @@ struct audio_format afl[] = { .name = "ogg", .init = ogg_init, }, +#endif +#ifdef HAVE_FAAD + { + .name = "aac", + .init = aac_afh_init, + }, #endif { .name = NULL, @@ -150,7 +159,7 @@ void afs_init(void) afl[i].init(&afl[i]); } ms2tv(conf.announce_time_arg, &announce_tv); - PARA_INFO_LOG("announce timeval: %lu:%lu\n", announce_tv.tv_sec, announce_tv.tv_usec); + PARA_INFO_LOG("announce timeval: %lums\n", tv2ms(&announce_tv)); for (i = 0; senders[i].name; i++) { PARA_NOTICE_LOG("initializing %s sender\n", senders[i].name); senders[i].init(&senders[i]); @@ -233,7 +242,7 @@ static int update_mmd(void) static void get_song(void) { - char **sl = dblist[mmd->selector_num].get_audio_file_list(10); + char **sl = selectors[mmd->selector_num].get_audio_file_list(10); int i; if (!sl) @@ -253,8 +262,8 @@ static void get_song(void) continue; } mmd->num_played++; - if (dblist[mmd->selector_num].update_audio_file) - dblist[mmd->selector_num].update_audio_file(sl[i]); + if (selectors[mmd->selector_num].update_audio_file) + selectors[mmd->selector_num].update_audio_file(sl[i]); PARA_DEBUG_LOG("%s", "success\n"); mmd->new_afs_status_flags &= (~AFS_NEXT); gettimeofday(&now, NULL); @@ -452,6 +461,11 @@ void afs_send_chunk(void) afs_next_chunk_time(&due); if (tv_diff(&due, &now, NULL) > 0) return; + if (chk_barrier("eof", &now, &eof_barrier, &due, 1) < 0) + return; + if (chk_barrier("data send", &now, &data_send_barrier, + &due, 1) < 0) + return; buf = af->read_chunk(mmd->current_chunk, &ret); mmd->new_afs_status_flags &= ~AFS_REPOS; if (!buf) {