return (char *)inbuf;
}
+static const char* aac_suffixes[] = {"m4a", NULL};
/** the init function of the aac audio format handler */
void aac_afh_init(void *p)
{
af->chunk_tv.tv_sec = 0;
af->chunk_tv.tv_usec = 23120;
tv_scale(3, &af->chunk_tv, &af->eof_tv);
+ af->suffixes = aac_suffixes;
}
char * (*read_chunk)(long unsigned chunk_num, ssize_t *len);
};
+extern struct audio_format_handler afl[];
+#define FOR_EACH_AUDIO_FORMAT(i) for (i = 0; afl[i].name; i++)
+
void afs_init(void);
void afs_send_chunk(void);
struct timeval *afs_preselect(void);
extern struct misc_meta_data *mmd;
extern struct gengetopt_args_info conf;
extern struct audio_file_selector selectors[];
-extern struct audio_format_handler afl[];
extern struct sender senders[];
extern char *user_list;
struct sockaddr_in *in_addr;
*/
static int match_audio_file_name(char *name)
{
- int i, len = strlen(name);
- const char *pattern[] = {SUPPORTED_AUDIO_FORMATS_ARRAY};
+ int i,j, len = strlen(name);
- for (i = 0; pattern[i]; i++) {
- const char *p = pattern[i];
- int plen = strlen(p);
- if (len < plen + 1)
- continue;
- if (name[len - plen - 1] != '.')
- continue;
- if (strcasecmp(name + len - plen, p))
- continue;
- return 1;
+ FOR_EACH_AUDIO_FORMAT(i) {
+ for (j = 0; afl[i].suffixes[j]; j++) {
+ const char *p = afl[i].suffixes[j];
+ int plen = strlen(p);
+ if (len < plen + 1)
+ continue;
+ if (name[len - plen - 1] != '.')
+ continue;
+ if (strcasecmp(name + len - plen, p))
+ continue;
+ return 1;
+ }
}
return 0;
}
mp3.file = NULL;
}
+static const char* mp3_suffixes[] = {"mp3", NULL};
void mp3_init(void *p)
{
af = p;
/* eof_tv gets overwritten in mp3_get_file_info() */
af->eof_tv.tv_sec = 0;
af->eof_tv.tv_usec = 100 * 1000;
+ af->suffixes = mp3_suffixes;
}
return header;
}
+static const char* ogg_suffixes[] = {"ogg", NULL};
void ogg_init(void *p)
{
af = p;
af->chunk_tv.tv_sec = 0;
af->chunk_tv.tv_usec = 250 * 1000;
tv_scale(3, &af->chunk_tv, &af->eof_tv);
+ af->suffixes = ogg_suffixes;
}
extern void dccp_send_init(struct sender *);
extern void http_send_init(struct sender *);
extern void ortp_send_init(struct sender *);
-extern struct audio_format_handler afl[];
/* TODO: This is better handled by autoconf */
/** the list of supported audio file selectors */