-/**
- * Get the data of the given chunk.
- *
- * \param chunk_num The number of the desired chunk.
- * \param buf Chunk data.
- * \param len Chunk length in bytes.
- *
- * \return Standard.
- */
-int vss_get_chunk(long unsigned chunk_num, char **buf, size_t *len)
-{
- if (!map || !vss_playing())
- return -E_CHUNK;
- if (chunk_num >= mmd->afd.afhi.chunks_total)
- return -E_CHUNK;
- afh_get_chunk(chunk_num, &mmd->afd.afhi, map, buf, len);
- return 1;
-}
-
-/**
- * Initialize the virtual streaming system.
- *
- * This also initializes all supported senders and starts streaming
- * if the --autoplay command line flag was given.
- */
-void vss_init(void)
-{
- int i;
- char *hn = para_hostname(), *home = para_homedir();
- long unsigned announce_time = conf.announce_time_arg > 0?
- conf.announce_time_arg : 300,
- autoplay_delay = conf.autoplay_delay_arg > 0?
- conf.autoplay_delay_arg : 0;
- ms2tv(announce_time, &announce_tv);
- 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]);
- }
- free(hn);
- free(home);
- if (conf.autoplay_given) {
- struct timeval now, tmp;
- mmd->vss_status_flags |= VSS_PLAYING;
- mmd->new_vss_status_flags |= VSS_PLAYING;
- gettimeofday(&now, NULL);
- ms2tv(autoplay_delay, &tmp);
- tv_add(&now, &tmp, &autoplay_barrier);
- }
-}
-
-static int chk_barrier(const char *bname, const struct timeval *now,
- const struct timeval *barrier, struct timeval *diff,
- int print_log)