audiofile: use GLib instead of log.h
This commit is contained in:
parent
7a2fe930b8
commit
4a3a621caf
@ -19,10 +19,13 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "../decoder_api.h"
|
#include "../decoder_api.h"
|
||||||
#include "../log.h"
|
|
||||||
|
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <audiofile.h>
|
#include <audiofile.h>
|
||||||
|
#include <glib.h>
|
||||||
|
|
||||||
|
#undef G_LOG_DOMAIN
|
||||||
|
#define G_LOG_DOMAIN "audiofile"
|
||||||
|
|
||||||
/* pick 1020 since its devisible for 8,16,24, and 32-bit audio */
|
/* pick 1020 since its devisible for 8,16,24, and 32-bit audio */
|
||||||
#define CHUNK_SIZE 1020
|
#define CHUNK_SIZE 1020
|
||||||
@ -55,13 +58,13 @@ audiofile_decode(struct decoder *decoder, const char *path)
|
|||||||
char chunk[CHUNK_SIZE];
|
char chunk[CHUNK_SIZE];
|
||||||
|
|
||||||
if (stat(path, &st) < 0) {
|
if (stat(path, &st) < 0) {
|
||||||
ERROR("failed to stat: %s\n", path);
|
g_warning("failed to stat: %s\n", path);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
af_fp = afOpenFile(path, "r", NULL);
|
af_fp = afOpenFile(path, "r", NULL);
|
||||||
if (af_fp == AF_NULL_FILEHANDLE) {
|
if (af_fp == AF_NULL_FILEHANDLE) {
|
||||||
ERROR("failed to open: %s\n", path);
|
g_warning("failed to open: %s\n", path);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -81,8 +84,8 @@ audiofile_decode(struct decoder *decoder, const char *path)
|
|||||||
bitRate = (uint16_t)(st.st_size * 8.0 / total_time / 1000.0 + 0.5);
|
bitRate = (uint16_t)(st.st_size * 8.0 / total_time / 1000.0 + 0.5);
|
||||||
|
|
||||||
if (audio_format.bits != 8 && audio_format.bits != 16) {
|
if (audio_format.bits != 8 && audio_format.bits != 16) {
|
||||||
ERROR("Only 8 and 16-bit files are supported. %s is %i-bit\n",
|
g_warning("Only 8 and 16-bit files are supported. %s is %i-bit\n",
|
||||||
path, audio_format.bits);
|
path, audio_format.bits);
|
||||||
afCloseFile(af_fp);
|
afCloseFile(af_fp);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -123,9 +126,8 @@ static struct tag *audiofileTagDup(const char *file)
|
|||||||
ret = tag_new();
|
ret = tag_new();
|
||||||
ret->time = total_time;
|
ret->time = total_time;
|
||||||
} else {
|
} else {
|
||||||
DEBUG
|
g_debug("Failed to get total song time from: %s\n",
|
||||||
("audiofileTagDup: Failed to get total song time from: %s\n",
|
file);
|
||||||
file);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
Loading…
Reference in New Issue
Block a user