summaryrefslogtreecommitdiff
path: root/core/multimedia/opieplayer/libmad/decoder.c
Side-by-side diff
Diffstat (limited to 'core/multimedia/opieplayer/libmad/decoder.c') (more/less context) (ignore whitespace changes)
-rw-r--r--core/multimedia/opieplayer/libmad/decoder.c60
1 files changed, 38 insertions, 22 deletions
diff --git a/core/multimedia/opieplayer/libmad/decoder.c b/core/multimedia/opieplayer/libmad/decoder.c
index dcf7cf3..b2b6cbb 100644
--- a/core/multimedia/opieplayer/libmad/decoder.c
+++ b/core/multimedia/opieplayer/libmad/decoder.c
@@ -1,3 +1,3 @@
/*
- * mad - MPEG audio decoder
+ * libmad - MPEG audio decoder library
* Copyright (C) 2000-2001 Robert Leslie
@@ -22,10 +22,3 @@
# ifdef HAVE_CONFIG_H
-# include "libmad_config.h"
-# else
-# ifndef WEXITSTATUS
-# define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
-# endif
-# ifndef WIFEXITED
-# define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
-# endif
+# include "libmad_config.h"
# endif
@@ -34,3 +27,5 @@
-# include <sys/types.h>
+# ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+# endif
@@ -44,5 +39,11 @@
-# include <fcntl.h>
+# ifdef HAVE_FCNTL_H
+# include <fcntl.h>
+# endif
+
# include <stdlib.h>
-# include <errno.h>
+
+# ifdef HAVE_ERRNO_H
+# include <errno.h>
+# endif
@@ -54,6 +55,9 @@
void mad_decoder_init(struct mad_decoder *decoder, void *data,
- enum mad_flow (*input_func)(void *, struct mad_stream *),
+ enum mad_flow (*input_func)(void *,
+ struct mad_stream *),
enum mad_flow (*header_func)(void *,
struct mad_header const *),
- enum mad_flow (*filter_func)(void *, struct mad_frame *),
+ enum mad_flow (*filter_func)(void *,
+ struct mad_stream const *,
+ struct mad_frame *),
enum mad_flow (*output_func)(void *,
@@ -61,3 +65,4 @@ void mad_decoder_init(struct mad_decoder *decoder, void *data,
struct mad_pcm *),
- enum mad_flow (*error_func)(void *, struct mad_stream *,
+ enum mad_flow (*error_func)(void *,
+ struct mad_stream *,
struct mad_frame *),
@@ -88,2 +93,3 @@ int mad_decoder_finish(struct mad_decoder *decoder)
{
+# if defined(USE_ASYNC)
if (decoder->mode == MAD_DECODER_MODE_ASYNC && decoder->async.pid) {
@@ -94,5 +100,4 @@ int mad_decoder_finish(struct mad_decoder *decoder)
- do {
+ do
pid = waitpid(decoder->async.pid, &status, 0);
- }
while (pid == -1 && errno == EINTR);
@@ -112,2 +117,3 @@ int mad_decoder_finish(struct mad_decoder *decoder)
}
+# endif
@@ -116,2 +122,3 @@ int mad_decoder_finish(struct mad_decoder *decoder)
+# if defined(USE_ASYNC)
static
@@ -123,5 +130,4 @@ enum mad_flow send_io(int fd, void const *data, size_t len)
while (len) {
- do {
+ do
count = write(fd, ptr, len);
- }
while (count == -1 && errno == EINTR);
@@ -145,5 +151,4 @@ enum mad_flow receive_io(int fd, void *buffer, size_t len)
while (len) {
- do {
+ do
count = read(fd, ptr, len);
- }
while (count == -1 && errno == EINTR);
@@ -283,2 +288,3 @@ enum mad_flow check_message(struct mad_decoder *decoder)
}
+# endif
@@ -350,2 +356,3 @@ int run_sync(struct mad_decoder *decoder)
while (1) {
+# if defined(USE_ASYNC)
if (decoder->mode == MAD_DECODER_MODE_ASYNC) {
@@ -361,2 +368,3 @@ int run_sync(struct mad_decoder *decoder)
}
+# endif
@@ -411,3 +419,3 @@ int run_sync(struct mad_decoder *decoder)
if (decoder->filter_func) {
- switch (decoder->filter_func(decoder->cb_data, frame)) {
+ switch (decoder->filter_func(decoder->cb_data, stream, frame)) {
case MAD_FLOW_STOP:
@@ -452,2 +460,3 @@ int run_sync(struct mad_decoder *decoder)
+# if defined(USE_ASYNC)
static
@@ -513,2 +522,3 @@ int run_async(struct mad_decoder *decoder)
}
+# endif
@@ -525,3 +535,5 @@ int mad_decoder_run(struct mad_decoder *decoder, enum mad_decoder_mode mode)
case MAD_DECODER_MODE_ASYNC:
+# if defined(USE_ASYNC)
run = run_async;
+# endif
break;
@@ -547,2 +559,3 @@ int mad_decoder_message(struct mad_decoder *decoder,
{
+# if defined(USE_ASYNC)
if (decoder->mode != MAD_DECODER_MODE_ASYNC ||
@@ -553,2 +566,5 @@ int mad_decoder_message(struct mad_decoder *decoder,
return 0;
+# else
+ return -1;
+# endif
}