client_common ggo udp_recv color fec prebuffer_filter sha1 audiod_command_list
bitstream mdct wma_common wmadec_filter"
audiod_ldflags=""
-audiod_audio_formats=""
+audiod_audio_formats="wma"
afh_cmdline_objs="add_cmdline(afh)"
afh_errlist_objs="afh string fd mp3_afh afh_common time wma_afh wma_common"
audiod_errlist_objs="$audiod_errlist_objs oggdec_filter"
afh_errlist_objs="$afh_errlist_objs ogg_afh"
- audiod_audio_formats="ogg"
+ audiod_audio_formats="$audiod_audio_formats ogg"
server_audio_formats="$server_audio_formats ogg"
AC_SUBST(oggvorbis_cppflags)
AC_SUBST(oggvorbis_libs)
#define AFS_COMMAND_LIST_ERRORS
#define AUDIOD_COMMAND_LIST_ERRORS
#define WMA_AFH_ERRORS
-#define WMA_COMMON_ERRORS
extern const char **para_errlist[];
+#define WMA_COMMON_ERRORS \
+ PARA_ERROR(WMA_NO_GUID, "audio stream guid not found"), \
+ PARA_ERROR(WMA_BAD_ASF_HEADER, "invalid asf header"), \
+
+
#define WMADEC_FILTER_ERRORS \
PARA_ERROR(WMA_BAD_PARAMS, "invalid WMA parameters"), \
PARA_ERROR(WMA_OUTPUT_SPACE, "insufficient output space"), \
const uint8_t *f, *start = (uint8_t *)buf;
int i, j, frames_per_chunk, chunk_time;
size_t ct_size = 250;
+ int count = 0, num_frames;
+
afhi->chunk_table = para_malloc(ct_size * sizeof(uint32_t));
afhi->chunk_table[0] = 0;
afhi->chunk_table[1] = afhi->header_len;
-
- int count = 0, num_frames;
-
num_frames = count_frames(buf, buf_size, block_align,
&afhi->chunks_total);
- PARA_ERROR_LOG("%d frames\n", num_frames);
+ PARA_INFO_LOG("%d frames\n", num_frames);
afhi->seconds_total = num_frames * 2048 /* FIXME */
/ afhi->frequency;
frames_per_chunk = num_frames / afhi->chunks_total;
j = 1;
FOR_EACH_FRAME(f, start, buf_size, block_align) {
count += f[WMA_FRAME_SKIP] & 0x0f;
- while (count > j * frames_per_chunk) {
+ while (count > j * frames_per_chunk && f > start) {
j++;
if (j >= ct_size) {
ct_size *= 2;
afhi->chunks_total = j;
chunk_time = num_frames * 1000 / afhi->frequency * 2048
/ afhi->chunks_total;
- PARA_ERROR_LOG("ct: %d\n", chunk_time);
+ PARA_INFO_LOG("ct: %d\n", chunk_time);
afhi->chunk_tv.tv_sec = chunk_time / 1000;
afhi->chunk_tv.tv_usec = (chunk_time % 1000) * 1000;
//set_chunk_tv(num_frames, j, afhi->frequency, &afhi->chunk_tv);
const char pattern[] = {0x40, 0x9e, 0x69, 0xf8};
const char *p = search_pattern(pattern, sizeof(pattern), buf, len);
- if (!p) {
- PARA_NOTICE_LOG("audio stream guid not found");
- return -1;
- }
+ if (!p)
+ return -E_WMA_NO_GUID;
PARA_DEBUG_LOG("found audio stream guid@%0zx\n", p - buf);
return p - buf;
}
{
uint16_t header_len;
- if (len < 18)
- return -1;
header_len = read_u16(buf + 16) + 46;
if (header_len > len)
- return -2;
+ return -E_WMA_BAD_ASF_HEADER;
PARA_DEBUG_LOG("header_len: %d\n", header_len);
return header_len;
}