Diffstat (limited to 'core/multimedia/opieplayer/libmad/decoder.c') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/multimedia/opieplayer/libmad/decoder.c | 60 |
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 @@ | |||
1 | /* | 1 | /* |
2 | * mad - MPEG audio decoder | 2 | * libmad - MPEG audio decoder library |
3 | * Copyright (C) 2000-2001 Robert Leslie | 3 | * Copyright (C) 2000-2001 Robert Leslie |
@@ -22,10 +22,3 @@ | |||
22 | # ifdef HAVE_CONFIG_H | 22 | # ifdef HAVE_CONFIG_H |
23 | # include "libmad_config.h" | 23 | # include "libmad_config.h" |
24 | # else | ||
25 | # ifndef WEXITSTATUS | ||
26 | # define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8) | ||
27 | # endif | ||
28 | # ifndef WIFEXITED | ||
29 | # define WIFEXITED(stat_val) (((stat_val) & 255) == 0) | ||
30 | # endif | ||
31 | # endif | 24 | # endif |
@@ -34,3 +27,5 @@ | |||
34 | 27 | ||
35 | # include <sys/types.h> | 28 | # ifdef HAVE_SYS_TYPES_H |
29 | # include <sys/types.h> | ||
30 | # endif | ||
36 | 31 | ||
@@ -44,5 +39,11 @@ | |||
44 | 39 | ||
45 | # include <fcntl.h> | 40 | # ifdef HAVE_FCNTL_H |
41 | # include <fcntl.h> | ||
42 | # endif | ||
43 | |||
46 | # include <stdlib.h> | 44 | # include <stdlib.h> |
47 | # include <errno.h> | 45 | |
46 | # ifdef HAVE_ERRNO_H | ||
47 | # include <errno.h> | ||
48 | # endif | ||
48 | 49 | ||
@@ -54,6 +55,9 @@ | |||
54 | void mad_decoder_init(struct mad_decoder *decoder, void *data, | 55 | void mad_decoder_init(struct mad_decoder *decoder, void *data, |
55 | enum mad_flow (*input_func)(void *, struct mad_stream *), | 56 | enum mad_flow (*input_func)(void *, |
57 | struct mad_stream *), | ||
56 | enum mad_flow (*header_func)(void *, | 58 | enum mad_flow (*header_func)(void *, |
57 | struct mad_header const *), | 59 | struct mad_header const *), |
58 | enum mad_flow (*filter_func)(void *, struct mad_frame *), | 60 | enum mad_flow (*filter_func)(void *, |
61 | struct mad_stream const *, | ||
62 | struct mad_frame *), | ||
59 | enum mad_flow (*output_func)(void *, | 63 | enum mad_flow (*output_func)(void *, |
@@ -61,3 +65,4 @@ void mad_decoder_init(struct mad_decoder *decoder, void *data, | |||
61 | struct mad_pcm *), | 65 | struct mad_pcm *), |
62 | enum mad_flow (*error_func)(void *, struct mad_stream *, | 66 | enum mad_flow (*error_func)(void *, |
67 | struct mad_stream *, | ||
63 | struct mad_frame *), | 68 | struct mad_frame *), |
@@ -88,2 +93,3 @@ int mad_decoder_finish(struct mad_decoder *decoder) | |||
88 | { | 93 | { |
94 | # if defined(USE_ASYNC) | ||
89 | if (decoder->mode == MAD_DECODER_MODE_ASYNC && decoder->async.pid) { | 95 | if (decoder->mode == MAD_DECODER_MODE_ASYNC && decoder->async.pid) { |
@@ -94,5 +100,4 @@ int mad_decoder_finish(struct mad_decoder *decoder) | |||
94 | 100 | ||
95 | do { | 101 | do |
96 | pid = waitpid(decoder->async.pid, &status, 0); | 102 | pid = waitpid(decoder->async.pid, &status, 0); |
97 | } | ||
98 | while (pid == -1 && errno == EINTR); | 103 | while (pid == -1 && errno == EINTR); |
@@ -112,2 +117,3 @@ int mad_decoder_finish(struct mad_decoder *decoder) | |||
112 | } | 117 | } |
118 | # endif | ||
113 | 119 | ||
@@ -116,2 +122,3 @@ int mad_decoder_finish(struct mad_decoder *decoder) | |||
116 | 122 | ||
123 | # if defined(USE_ASYNC) | ||
117 | static | 124 | static |
@@ -123,5 +130,4 @@ enum mad_flow send_io(int fd, void const *data, size_t len) | |||
123 | while (len) { | 130 | while (len) { |
124 | do { | 131 | do |
125 | count = write(fd, ptr, len); | 132 | count = write(fd, ptr, len); |
126 | } | ||
127 | while (count == -1 && errno == EINTR); | 133 | while (count == -1 && errno == EINTR); |
@@ -145,5 +151,4 @@ enum mad_flow receive_io(int fd, void *buffer, size_t len) | |||
145 | while (len) { | 151 | while (len) { |
146 | do { | 152 | do |
147 | count = read(fd, ptr, len); | 153 | count = read(fd, ptr, len); |
148 | } | ||
149 | while (count == -1 && errno == EINTR); | 154 | while (count == -1 && errno == EINTR); |
@@ -283,2 +288,3 @@ enum mad_flow check_message(struct mad_decoder *decoder) | |||
283 | } | 288 | } |
289 | # endif | ||
284 | 290 | ||
@@ -350,2 +356,3 @@ int run_sync(struct mad_decoder *decoder) | |||
350 | while (1) { | 356 | while (1) { |
357 | # if defined(USE_ASYNC) | ||
351 | if (decoder->mode == MAD_DECODER_MODE_ASYNC) { | 358 | if (decoder->mode == MAD_DECODER_MODE_ASYNC) { |
@@ -361,2 +368,3 @@ int run_sync(struct mad_decoder *decoder) | |||
361 | } | 368 | } |
369 | # endif | ||
362 | 370 | ||
@@ -411,3 +419,3 @@ int run_sync(struct mad_decoder *decoder) | |||
411 | if (decoder->filter_func) { | 419 | if (decoder->filter_func) { |
412 | switch (decoder->filter_func(decoder->cb_data, frame)) { | 420 | switch (decoder->filter_func(decoder->cb_data, stream, frame)) { |
413 | case MAD_FLOW_STOP: | 421 | case MAD_FLOW_STOP: |
@@ -452,2 +460,3 @@ int run_sync(struct mad_decoder *decoder) | |||
452 | 460 | ||
461 | # if defined(USE_ASYNC) | ||
453 | static | 462 | static |
@@ -513,2 +522,3 @@ int run_async(struct mad_decoder *decoder) | |||
513 | } | 522 | } |
523 | # endif | ||
514 | 524 | ||
@@ -525,3 +535,5 @@ int mad_decoder_run(struct mad_decoder *decoder, enum mad_decoder_mode mode) | |||
525 | case MAD_DECODER_MODE_ASYNC: | 535 | case MAD_DECODER_MODE_ASYNC: |
536 | # if defined(USE_ASYNC) | ||
526 | run = run_async; | 537 | run = run_async; |
538 | # endif | ||
527 | break; | 539 | break; |
@@ -547,2 +559,3 @@ int mad_decoder_message(struct mad_decoder *decoder, | |||
547 | { | 559 | { |
560 | # if defined(USE_ASYNC) | ||
548 | if (decoder->mode != MAD_DECODER_MODE_ASYNC || | 561 | if (decoder->mode != MAD_DECODER_MODE_ASYNC || |
@@ -553,2 +566,5 @@ int mad_decoder_message(struct mad_decoder *decoder, | |||
553 | return 0; | 566 | return 0; |
567 | # else | ||
568 | return -1; | ||
569 | # endif | ||
554 | } | 570 | } |