AFS_SOCKET_AFD_PENDING
};
-static char *map;
struct vss_task {
struct timeval announce_tv;
struct timeval eof_barrier;
struct timeval autoplay_barrier;
enum afs_socket_status afsss;
+ char *map;
};
static struct vss_task vss_task_struct, *vsst = &vss_task_struct;
*/
int vss_get_chunk(long unsigned chunk_num, char **buf, size_t *len)
{
- if (!map || !vss_playing())
+ if (!vsst->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);
+ afh_get_chunk(chunk_num, &mmd->afd.afhi, vsst->map, buf, len);
return 1;
}
static struct timeval the_timeout;
struct timeval now, next_chunk;
- if (vss_next() && map) {
+ if (vss_next() && vsst->map) {
/* only sleep a bit, nec*/
the_timeout.tv_sec = 0;
the_timeout.tv_usec = 100;
if (chk_barrier("data send", &now, &vsst->data_send_barrier,
&the_timeout, 1) < 0)
return &the_timeout;
- if (!vss_playing() || !map)
+ if (!vss_playing() || !vsst->map)
return NULL;
compute_chunk_time(mmd->chunks_sent, &mmd->afd.afhi.chunk_tv,
&mmd->stream_start, &next_chunk);
struct timeval now;
char *tmp;
- if (!map)
+ if (!vsst->map)
return;
if (mmd->new_vss_status_flags & VSS_NOMORE)
mmd->new_vss_status_flags = VSS_NEXT;
gettimeofday(&now, NULL);
tv_add(&mmd->afd.afhi.eof_tv, &now, &vsst->eof_barrier);
- para_munmap(map, mmd->size);
- map = NULL;
+ para_munmap(vsst->map, mmd->size);
+ vsst->map = NULL;
mmd->chunks_sent = 0;
mmd->offset = 0;
mmd->afd.afhi.seconds_total = 0;
*/
void vss_get_header(char **buf, size_t *len)
{
- afh_get_header(&mmd->afd.afhi, map, buf, len);
+ afh_get_header(&mmd->afd.afhi, vsst->map, buf, len);
}
/**
*/
struct timeval *vss_chunk_time(void)
{
- if (!map)
+ if (!vsst->map)
return NULL;
return &mmd->afd.afhi.chunk_tv;
}
static int need_to_request_new_audio_file(void)
{
- if (map) /* have audio file */
+ if (vsst->map) /* have audio file */
return 0;
if (!vss_playing()) /* don't need one */
return 0;
int i;
struct timeval now;
- if (!map || vss_next() || vss_paused() || vss_repos())
+ if (!vsst->map || vss_next() || vss_paused() || vss_repos())
for (i = 0; senders[i].name; i++)
senders[i].shutdown_clients();
if (vss_next())
}
mmd->size = statbuf.st_size;
mmd->mtime = statbuf.st_mtime;
- map = para_mmap(mmd->size, PROT_READ, MAP_PRIVATE,
+ vsst->map = para_mmap(mmd->size, PROT_READ, MAP_PRIVATE,
passed_fd, 0);
close(passed_fd);
mmd->chunks_sent = 0;
char *buf;
size_t len;
- if (!map || !vss_playing())
+ if (!vsst->map || !vss_playing())
return;
gettimeofday(&now, NULL);
compute_chunk_time(mmd->chunks_sent, &mmd->afd.afhi.chunk_tv,
mmd->offset = tv2ms(&tmp);
mmd->events++;
}
- afh_get_chunk(mmd->current_chunk, &mmd->afd.afhi, map, &buf, &len);
+ afh_get_chunk(mmd->current_chunk, &mmd->afd.afhi, vsst->map, &buf, &len);
for (i = 0; senders[i].name; i++)
senders[i].send(mmd->current_chunk, mmd->chunks_sent, buf, len);
mmd->new_vss_status_flags |= VSS_PLAYING;