Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 9a0ef7d76e | |||
| 2606634c11 |
@@ -10,6 +10,8 @@ all:
|
|||||||
|
|
||||||
install: all
|
install: all
|
||||||
mkdir -p lib/$(SUBDIR)
|
mkdir -p lib/$(SUBDIR)
|
||||||
|
@echo "copying from src/$(SUBDIR) to lib/$(SUBDIR)"
|
||||||
|
(cd src/$(SUBDIR);tar cf - . ) | (cd lib/$(SUBDIR); tar xvf - )
|
||||||
FILES=`ls build/*.so build-ffmpeg/*.so` 2>/dev/null; if [ "$$FILES" != "" ]; then cp $$FILES lib/$(SUBDIR); fi
|
FILES=`ls build/*.so build-ffmpeg/*.so` 2>/dev/null; if [ "$$FILES" != "" ]; then cp $$FILES lib/$(SUBDIR); fi
|
||||||
FILES=`ls build/*.dll build-ffmpeg/*.dll` 2>/dev/null; if [ "$$FILES" != "" ]; then cp $$FILES lib/$(SUBDIR); fi
|
FILES=`ls build/*.dll build-ffmpeg/*.dll` 2>/dev/null; if [ "$$FILES" != "" ]; then cp $$FILES lib/$(SUBDIR); fi
|
||||||
|
|
||||||
|
|||||||
@@ -579,44 +579,6 @@ void ao_stop_async(void *ao_handle)
|
|||||||
fprintf(stderr, "async handle freed\n");
|
fprintf(stderr, "async handle freed\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
(define (abs x) (if (>= x 0) x (* x -1)))
|
|
||||||
|
|
||||||
(define (make-sample-bytes sample bytes-per-sample endianess)
|
|
||||||
(letrec ((mk (lambda (i d)
|
|
||||||
(if (< i bytes-per-sample)
|
|
||||||
(cons (bitwise-and d 255)
|
|
||||||
(mk (+ i 1) (arithmetic-shift d -8)))
|
|
||||||
'()))))
|
|
||||||
(let ((bytes (mk 0 sample)))
|
|
||||||
(if (eq? endianess 'big-endian)
|
|
||||||
(reverse bytes)
|
|
||||||
bytes))))
|
|
||||||
|
|
||||||
;(get-sample (lambda (k channel)
|
|
||||||
; (let ((chan-buf (list-ref buffer channel)))
|
|
||||||
; (vector-ref chan-buf k))))
|
|
||||||
)
|
|
||||||
;(letrec ((i 0)
|
|
||||||
; (fill (lambda (k channel)
|
|
||||||
; (if (< k buf-len)
|
|
||||||
; (if (< channel channels)
|
|
||||||
; (let* ((sample (get-sample k channel))
|
|
||||||
; (bytes (make-sample-bytes sample bytes-per-sample endianess))
|
|
||||||
; )
|
|
||||||
; (for-each (lambda (byte)
|
|
||||||
; (ptr-set! audio _byte i byte)
|
|
||||||
; (set! i (+ i 1)))
|
|
||||||
; bytes)
|
|
||||||
; ;; process sample
|
|
||||||
; (fill k (+ channel 1)))
|
|
||||||
; (fill (+ k 1) 0))
|
|
||||||
; 'filled))
|
|
||||||
; ))
|
|
||||||
; (fill 0 0)
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define AO_FMT_LITTLE 1
|
#define AO_FMT_LITTLE 1
|
||||||
#define AO_FMT_BIG 2
|
#define AO_FMT_BIG 2
|
||||||
#define AO_FMT_NATIVE 4
|
#define AO_FMT_NATIVE 4
|
||||||
@@ -640,87 +602,18 @@ static inline void make_sample_bytes(int32_t sample, int bytes_per_sample, int b
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void *convertFlac(void *mem, int buf_len, BufferInfo_t *info, int *audio_size)
|
|
||||||
{
|
|
||||||
// buf_size equals number of samples of 32bit for all channels. So buf_size for flac = 4 * buf_len * channels
|
|
||||||
|
|
||||||
int bytes = info->sample_bits / 8;
|
|
||||||
int endianess = info->endiannes;
|
|
||||||
|
|
||||||
int little_endian = (endianess == AO_FMT_LITTLE);
|
|
||||||
if (!little_endian && endianess == AO_FMT_NATIVE) little_endian = littleEndian();
|
|
||||||
int big_endian = !little_endian;
|
|
||||||
|
|
||||||
int store_size = info->channels * bytes * buf_len;
|
|
||||||
unsigned char *new_mem = (unsigned char *) malloc(store_size);
|
|
||||||
*audio_size = store_size;
|
|
||||||
int32_t **buffer = (int32_t **) mem;
|
|
||||||
int i, k, channel;
|
|
||||||
|
|
||||||
i = 0;
|
|
||||||
for(k = 0; k < buf_len; k++) {
|
|
||||||
for(channel = 0; channel < info->channels; channel++) {
|
|
||||||
int32_t *chan = buffer[channel];
|
|
||||||
int32_t sample = chan[k];
|
|
||||||
unsigned char b[4];
|
|
||||||
make_sample_bytes(sample, bytes, big_endian, b);
|
|
||||||
for(int j = 0; j < bytes; j++) {
|
|
||||||
new_mem[i++] = b[j];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return (void *) new_mem;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ao_play_async(void *ao_handle, int music_id, double at_second, double music_duration, int buf_size, void *mem, BufferInfo_t info)
|
void ao_play_async(void *ao_handle, int music_id, double at_second, double music_duration, int buf_size, void *mem, BufferInfo_t info)
|
||||||
{
|
{
|
||||||
AO_Handle *h = (AO_Handle *) ao_handle;
|
AO_Handle *h = (AO_Handle *) ao_handle;
|
||||||
|
|
||||||
Queue_t *q = NULL;
|
Queue_t *q = NULL;
|
||||||
|
|
||||||
switch(info.type) {
|
int ao_size = 0;
|
||||||
case flac: {
|
void *ao_mem = convert_req_to_real(ao_handle, mem, buf_size, &info, &ao_size);
|
||||||
int store_size = 0;
|
|
||||||
void *store_mem = convertFlac(mem, buf_size, &info, &store_size);
|
|
||||||
|
|
||||||
int ao_size = 0;
|
q = new_elem(PLAY, music_id, at_second, music_duration, ao_size, ao_mem);
|
||||||
void *ao_mem = convert_req_to_real(ao_handle, store_mem, store_size, &info, &ao_size);
|
|
||||||
|
|
||||||
q = new_elem(PLAY, music_id, at_second, music_duration, ao_size, ao_mem);
|
free(ao_mem);
|
||||||
|
|
||||||
free(store_mem);
|
|
||||||
free(ao_mem);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case ao: {
|
|
||||||
int ao_size = 0;
|
|
||||||
void *ao_mem = convert_req_to_real(ao_handle, mem, buf_size, &info, &ao_size);
|
|
||||||
|
|
||||||
q = new_elem(PLAY, music_id, at_second, music_duration, ao_size, ao_mem);
|
|
||||||
|
|
||||||
free(ao_mem);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case mpg123: {
|
|
||||||
static int warned = 0;
|
|
||||||
if (!warned) {
|
|
||||||
warned = 1;
|
|
||||||
fprintf(stderr, "format mpg123 not supported yet\n");
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case ao_ogg: {
|
|
||||||
static int warned = 0;
|
|
||||||
if (!warned) {
|
|
||||||
warned = 1;
|
|
||||||
fprintf(stderr, "format ao_ogg not supported yet\n");
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
add(h, q);
|
add(h, q);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
#define AOPLAYASYNC_EXPORT extern
|
#define AOPLAYASYNC_EXPORT extern
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define VERSION 2
|
#define VERSION 3
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
ao = 1,
|
ao = 1,
|
||||||
|
|||||||
Binary file not shown.
Symlink
+1
@@ -0,0 +1 @@
|
|||||||
|
libtag.so.2
|
||||||
Symlink
+1
@@ -0,0 +1 @@
|
|||||||
|
libtag.so.2.2.1
|
||||||
Binary file not shown.
Symlink
+1
@@ -0,0 +1 @@
|
|||||||
|
libtag_c.so.2
|
||||||
Symlink
+1
@@ -0,0 +1 @@
|
|||||||
|
libtag_c.so.2.2.1
|
||||||
Binary file not shown.
Reference in New Issue
Block a user