Attempt to suppress file not found error

This commit is contained in:
2018-02-11 19:45:40 +01:00
parent aa0ca9db87
commit 6a4b0fd126

View File

@@ -8,7 +8,7 @@
#include "sound.h"
#include "config.h"
#define BITS 8
#include <stdio.h>
void playSound(const char *path) {
pthread_t pth; //thread identifier
@@ -20,7 +20,7 @@ void playSound(const char *path) {
void *playThreadFunc(void *arg) {
const char *path = (const char *) arg;
if (strlen(path) == 0) return 0; //No input file. Exit.
mpg123_handle *mh;
unsigned char *buffer;
size_t buffer_size;
@@ -43,7 +43,7 @@ void *playThreadFunc(void *arg) {
buffer = (unsigned char*) malloc(buffer_size * sizeof(unsigned char));
/* open the file and get the decoding format */
mpg123_open(mh, path);
if (mpg123_open(mh, path) != MPG123_OK) return 0; //File does not exist. exit the function
mpg123_getformat(mh, &rate, &channels, &encoding);
/* set the output format and open the output device */