mem->mh = mpg123_new(NULL, &err);
buffer_size = mpg123_outblock(mem->mh)*2;
mem->buffer = (unsigned char*) malloc(buffer_size * sizeof(unsigned char));
- if (mpg123_open(mem->mh, settings->file) != MPG123_OK) return NULL;
- if (mpg123_getformat(mem->mh, &rate, &channels, &encoding) != MPG123_OK) return NULL;
+ pthread_cleanup_push(cleanupThread, (void*) mem);
+ if (mpg123_open(mem->mh, settings->file) != MPG123_OK) pthread_exit((void*) pthread_self());;
+ if (mpg123_getformat(mem->mh, &rate, &channels, &encoding) != MPG123_OK) pthread_exit((void*) pthread_self());;
format.bits = mpg123_encsize(encoding) * BITS;
format.rate = rate;
format.matrix = 0;
ao_option options = {"debug","",NULL};
mem->aodev = ao_open_live(driver, &format, &options);
- pthread_cleanup_push(cleanupThread, (void*) mem);
+
do {
while (running)
{
pthread_exit((void*) pthread_self());
}
-//int main(int argc, char** argv)
-//{
-// pthread_t th = startPlayThread("platt01.mp3", true);
-// //sleep(3);
-// //pthread_cancel(th);
-// pthread_join(th, NULL);
-//}
+int main(int argc, char** argv)
+{
+ pthread_t th = startPlayThread("platt01.mp3", true);
+ //sleep(3);
+ //pthread_cancel(th);
+ pthread_join(th, NULL);
+}