bool running = true;
playermem* mem = (playermem*) malloc(sizeof(playermem));
playersettings* settings = (playersettings*) arg;
- //mpg123_handle* mh;
- //unsigned char* buffer;
int err;
int driver;
- //ao_device* aodev;
ao_sample_format format;
int channels;
int encoding;
format.channels = channels;
format.byte_format = AO_FMT_NATIVE;
format.matrix = 0;
- ao_option options = {"debug","",NULL};
- mem->aodev = ao_open_live(driver, &format, &options);
+ //ao_option options = {"debug","",NULL};
+ mem->aodev = ao_open_live(driver, &format, NULL);//&options);
mem->queue = create_fifo(5);
decodeData dd;
dd.file = settings->file;
dd.mh = mem->mh;
pthread_create(&mem->decode_thread, NULL, decodeFunc, &dd);
pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
-// do {
- while (running)
+
+ while (running)
{
-
-// int mpg123ret = mpg123_read(mem->mh, mem->buffer, buffer_size, &done);
-// if ( mpg123ret == MPG123_DONE && settings->loop) {
-// mpg123_open(mem->mh, settings->file);
-// continue;
-// //mpg123_read(mem->mh, mem->buffer, buffer_size, &done);
-// } else if (mpg123ret != MPG123_OK) {
-// break;
-// }
-// ao_play(mem->aodev, fifo_pop(f), done);
unsigned char* buffer;
size_t done;
fifo_pop(mem->queue, &buffer, &done);
free(buffer);
pthread_testcancel();
}
-// } while (settings->loop);
-
pthread_cleanup_pop(1);
pthread_exit((void*) pthread_self());
}