Attempt to suppress file not found error
This commit is contained in:
6
sound.c
6
sound.c
@@ -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 */
|
||||
|
Reference in New Issue
Block a user