The current audio format is also stored in mmd->afd.afsi.audio_format_id,
so use the value stored there. However, most users of mmd->audio_format
used this value only to detect whether an audio file is open ATM. In
vss.c, use the map pointer instead to find out whether an audio file is
open.
struct timeval now;
struct tm mtime_tm;
struct timeval now;
struct tm mtime_tm;
- if (nmmd->audio_format >= 0) {
- localtime_r(&nmmd->mtime, &mtime_tm);
- strftime(mtime, 29, "%a %b %d %Y", &mtime_tm);
- }
+ localtime_r(&nmmd->mtime, &mtime_tm);
+ strftime(mtime, 29, "%a %b %d %Y", &mtime_tm);
/* report real status */
status = vss_status_tohuman(nmmd->vss_status_flags);
flags = vss_get_status_flags(nmmd->vss_status_flags);
/* report real status */
status = vss_status_tohuman(nmmd->vss_status_flags);
flags = vss_get_status_flags(nmmd->vss_status_flags);
status_item_list[SI_SELECTOR], "FIXME",
status_item_list[SI_OFFSET], offset,
status_item_list[SI_SELECTOR], "FIXME",
status_item_list[SI_OFFSET], offset,
- status_item_list[SI_FORMAT], audio_format_name(nmmd->audio_format),
+ status_item_list[SI_FORMAT], audio_format_name(nmmd->afd.afsi.audio_format_id),
status_item_list[SI_AFS_MODE], mmd->afs_mode_string,
nmmd->afd.afhi.info_string,
status_item_list[SI_AFS_MODE], mmd->afs_mode_string,
nmmd->afd.afhi.info_string,
mmd->num_connects = 0;
mmd->active_connections = 0;
strcpy(mmd->filename, "(none)");
mmd->num_connects = 0;
mmd->active_connections = 0;
strcpy(mmd->filename, "(none)");
- mmd->audio_format = -1;
mmd->vss_status_flags = VSS_NEXT;
mmd->new_vss_status_flags = VSS_NEXT;
mmd->sender_cmd_data.cmd_num = -1;
mmd->vss_status_flags = VSS_NEXT;
mmd->new_vss_status_flags = VSS_NEXT;
mmd->sender_cmd_data.cmd_num = -1;
prev_events = mmd->events;
mmd->vss_status_flags = mmd->new_vss_status_flags;
if (ret) {
prev_events = mmd->events;
mmd->vss_status_flags = mmd->new_vss_status_flags;
if (ret) {
- PARA_DEBUG_LOG("%d events, forcing status update, af = %d\n",
- mmd->events, mmd->audio_format);
+ PARA_DEBUG_LOG("%d events, forcing status update\n",
+ mmd->events);
size_t size;
/** the full path of the current audio file */
char filename[_POSIX_PATH_MAX];
size_t size;
/** the full path of the current audio file */
char filename[_POSIX_PATH_MAX];
- /** the last modification file of the current audio file */
+ /** the last modification time of the current audio file */
- /** the number of the current audio format */
- int audio_format;
/** the "old" status flags -- commands may only read them */
unsigned int vss_status_flags;
/** The new status flags -- commands may set them. */
/** the "old" status flags -- commands may only read them */
unsigned int vss_status_flags;
/** The new status flags -- commands may set them. */
static struct timeval the_timeout;
struct timeval now, next_chunk;
static struct timeval the_timeout;
struct timeval now, next_chunk;
- if (vss_next() && mmd->audio_format >= 0) {
+ if (vss_next() && map) {
/* only sleep a bit, nec*/
the_timeout.tv_sec = 0;
the_timeout.tv_usec = 100;
/* only sleep a bit, nec*/
the_timeout.tv_sec = 0;
the_timeout.tv_usec = 100;
if (chk_barrier("data send", &now, &data_send_barrier,
&the_timeout, 1) < 0)
return &the_timeout;
if (chk_barrier("data send", &now, &data_send_barrier,
&the_timeout, 1) < 0)
return &the_timeout;
- if (mmd->audio_format < 0 || !vss_playing() || !map)
+ if (!vss_playing() || !map)
return NULL;
vss_next_chunk_time(&next_chunk);
return NULL;
vss_next_chunk_time(&next_chunk);
- if (chk_barrier(audio_format_name(mmd->audio_format), &now, &next_chunk,
- &the_timeout, 0) < 0)
+ if (chk_barrier(audio_format_name(mmd->afd.afsi.audio_format_id),
+ &now, &next_chunk, &the_timeout, 0) < 0)
return &the_timeout;
/* chunk is due or bof */
the_timeout.tv_sec = 0;
return &the_timeout;
/* chunk is due or bof */
the_timeout.tv_sec = 0;
tv_add(&mmd->afd.afhi.eof_tv, &now, &eof_barrier);
munmap(map, mmd->size);
map = NULL;
tv_add(&mmd->afd.afhi.eof_tv, &now, &eof_barrier);
munmap(map, mmd->size);
map = NULL;
- mmd->audio_format = -1;
mmd->chunks_sent = 0;
mmd->offset = 0;
mmd->afd.afhi.seconds_total = 0;
mmd->chunks_sent = 0;
mmd->offset = 0;
mmd->afd.afhi.seconds_total = 0;
*/
char *vss_get_header(size_t *header_len)
{
*/
char *vss_get_header(size_t *header_len)
{
- if (mmd->audio_format < 0 || !map || !mmd->afd.afhi.header_len)
+ if (!map || !mmd->afd.afhi.header_len)
return NULL;
*header_len = mmd->afd.afhi.header_len;
return map + mmd->afd.afhi.header_offset;
return NULL;
*header_len = mmd->afd.afhi.header_len;
return map + mmd->afd.afhi.header_offset;
*/
struct timeval *vss_chunk_time(void)
{
*/
struct timeval *vss_chunk_time(void)
{
- if (mmd->audio_format < 0)
return NULL;
return &mmd->afd.afhi.chunk_tv;
}
return NULL;
return &mmd->afd.afhi.chunk_tv;
}
close(passed_fd);
strcpy(mmd->filename, mmd->afd.path); /* FIXME: check length */
mmd->afd.afhi.header_len = 0; /* default: no header */
close(passed_fd);
strcpy(mmd->filename, mmd->afd.path); /* FIXME: check length */
mmd->afd.afhi.header_len = 0; /* default: no header */
- mmd->audio_format = mmd->afd.afsi.audio_format_id;
mmd->chunks_sent = 0;
mmd->current_chunk = 0;
mmd->offset = 0;
mmd->chunks_sent = 0;
mmd->current_chunk = 0;
mmd->offset = 0;
*/
int vss_get_chunk(long unsigned chunk_num, char **buf, size_t *len)
{
*/
int vss_get_chunk(long unsigned chunk_num, char **buf, size_t *len)
{
- if (mmd->audio_format < 0 || !map || !vss_playing())
+ if (!map || !vss_playing())
return -E_CHUNK;
if (chunk_num >= mmd->afd.afhi.chunks_total)
return -E_CHUNK;
return -E_CHUNK;
if (chunk_num >= mmd->afd.afhi.chunks_total)
return -E_CHUNK;
- if (mmd->audio_format < 0 || !map || !vss_playing())
+ if (!map || !vss_playing())
return;
gettimeofday(&now, NULL);
vss_next_chunk_time(&due);
return;
gettimeofday(&now, NULL);
vss_next_chunk_time(&due);