]> git.pld-linux.org Git - packages/moc.git/blob - moc-flac.patch
This commit was manufactured by cvs2git to create branch 'AC-branch'.
[packages/moc.git] / moc-flac.patch
1 --- moc-2.4.1/decoder_plugins/flac/flac.c.orig  2007-01-01 22:55:40.000000000 +0000
2 +++ moc-2.4.1/decoder_plugins/flac/flac.c       2007-01-01 23:26:56.000000000 +0000
3 @@ -19,6 +19,7 @@
4  
5  #include <string.h>
6  #include <FLAC/all.h>
7 +#include <FLAC/stream_decoder.h>
8  #include <stdlib.h>
9  #include <strings.h>
10  #include "audio.h"
11 @@ -35,7 +36,7 @@
12  
13  struct flac_data
14  {
15 -       FLAC__SeekableStreamDecoder *decoder;
16 +       FLAC__StreamDecoder *decoder;
17         struct io_stream *stream;
18         int bitrate;
19         int abort; /* abort playing (due to an error) */
20 @@ -109,7 +110,7 @@
21  }
22  
23  static FLAC__StreamDecoderWriteStatus write_callback (
24 -               const FLAC__SeekableStreamDecoder *decoder ATTR_UNUSED,
25 +               const FLAC__StreamDecoder *decoder ATTR_UNUSED,
26                 const FLAC__Frame *frame,
27                 const FLAC__int32 * const buffer[], void *client_data)
28  {
29 @@ -127,7 +128,7 @@
30  }
31  
32  static void metadata_callback (
33 -               const FLAC__SeekableStreamDecoder *decoder ATTR_UNUSED,
34 +               const FLAC__StreamDecoder *decoder ATTR_UNUSED,
35                 const FLAC__StreamMetadata *metadata, void *client_data)
36  {
37         struct flac_data *data = (struct flac_data *)client_data;
38 @@ -147,7 +148,7 @@
39  }
40  
41  static void error_callback (
42 -               const FLAC__SeekableStreamDecoder *decoder ATTR_UNUSED,
43 +               const FLAC__StreamDecoder *decoder ATTR_UNUSED,
44                 FLAC__StreamDecoderErrorStatus status, void *client_data)
45  {
46         struct flac_data *data = (struct flac_data *)client_data;
47 @@ -160,8 +161,8 @@
48                 decoder_error (&data->error, ERROR_FATAL, 0, "FLAC: lost sync");
49  }
50  
51 -static FLAC__SeekableStreamDecoderReadStatus read_callback (
52 -               const FLAC__SeekableStreamDecoder *decoder ATTR_UNUSED,
53 +static FLAC__StreamDecoderReadStatus read_callback (
54 +               const FLAC__StreamDecoder *decoder ATTR_UNUSED,
55                 FLAC__byte buffer[], unsigned *bytes, void *client_data)
56  {
57         struct flac_data *data = (struct flac_data *)client_data;
58 @@ -184,39 +185,39 @@
59         return FLAC__STREAM_DECODER_READ_STATUS_ABORT;
60  }
61  
62 -static FLAC__SeekableStreamDecoderSeekStatus seek_callback (
63 -               const FLAC__SeekableStreamDecoder *decoder ATTR_UNUSED,
64 +static FLAC__StreamDecoderSeekStatus seek_callback (
65 +               const FLAC__StreamDecoder *decoder ATTR_UNUSED,
66                 FLAC__uint64 absolute_byte_offset, void *client_data)
67  {
68         struct flac_data *data = (struct flac_data *)client_data;
69         
70         return io_seek(data->stream, absolute_byte_offset, SEEK_SET) >= 0
71 -               ? FLAC__SEEKABLE_STREAM_DECODER_SEEK_STATUS_OK
72 -               : FLAC__SEEKABLE_STREAM_DECODER_SEEK_STATUS_ERROR;
73 +               ? FLAC__STREAM_DECODER_SEEK_STATUS_OK
74 +               : FLAC__STREAM_DECODER_SEEK_STATUS_ERROR;
75  }
76  
77 -static FLAC__SeekableStreamDecoderTellStatus tell_callback (
78 -               const FLAC__SeekableStreamDecoder *decoder ATTR_UNUSED,
79 +static FLAC__StreamDecoderTellStatus tell_callback (
80 +               const FLAC__StreamDecoder *decoder ATTR_UNUSED,
81                 FLAC__uint64 *absolute_byte_offset, void *client_data)
82  {
83         struct flac_data *data = (struct flac_data *)client_data;
84  
85         *absolute_byte_offset = io_tell (data->stream);
86 -       return FLAC__SEEKABLE_STREAM_DECODER_TELL_STATUS_OK;
87 +       return FLAC__STREAM_DECODER_TELL_STATUS_OK;
88  }
89  
90 -static FLAC__SeekableStreamDecoderLengthStatus length_callback (
91 -               const FLAC__SeekableStreamDecoder *decoder ATTR_UNUSED,
92 +static FLAC__StreamDecoderLengthStatus length_callback (
93 +               const FLAC__StreamDecoder *decoder ATTR_UNUSED,
94                 FLAC__uint64 *stream_length, void *client_data)
95  {
96         struct flac_data *data = (struct flac_data *)client_data;
97  
98         *stream_length = io_file_size (data->stream);
99 -       return FLAC__SEEKABLE_STREAM_DECODER_LENGTH_STATUS_OK;
100 +       return FLAC__STREAM_DECODER_LENGTH_STATUS_OK;
101  }
102  
103  static FLAC__bool eof_callback (
104 -               const FLAC__SeekableStreamDecoder *decoder ATTR_UNUSED,
105 +               const FLAC__StreamDecoder *decoder ATTR_UNUSED,
106                 void *client_data)
107  {
108         struct flac_data *data = (struct flac_data *)client_data;
109 @@ -248,48 +249,41 @@
110  
111         data->ok = 1;
112  
113 -       if (!(data->decoder = FLAC__seekable_stream_decoder_new())) {
114 +       if (!(data->decoder = FLAC__stream_decoder_new())) {
115                 decoder_error (&data->error, ERROR_FATAL, 0,
116 -                               "FLAC__seekable_stream_decoder_new() failed");
117 +                               "FLAC__stream_decoder_new() failed");
118                 data->ok = 0;
119                 return data;
120         }
121  
122 -       FLAC__seekable_stream_decoder_set_md5_checking (data->decoder, false);
123 +       FLAC__stream_decoder_set_md5_checking (data->decoder, false);
124         
125 -       FLAC__seekable_stream_decoder_set_metadata_ignore_all (data->decoder);
126 -       FLAC__seekable_stream_decoder_set_metadata_respond (data->decoder,
127 +       FLAC__stream_decoder_set_metadata_ignore_all (data->decoder);
128 +       FLAC__stream_decoder_set_metadata_respond (data->decoder,
129                         FLAC__METADATA_TYPE_STREAMINFO);
130 -       FLAC__seekable_stream_decoder_set_client_data (data->decoder, data);
131 -       FLAC__seekable_stream_decoder_set_metadata_callback (data->decoder,
132 -                       metadata_callback);
133 -       FLAC__seekable_stream_decoder_set_write_callback (data->decoder,
134 -                       write_callback);
135 -       FLAC__seekable_stream_decoder_set_error_callback (data->decoder,
136 -                       error_callback);
137 -       FLAC__seekable_stream_decoder_set_read_callback (data->decoder,
138 -                       read_callback);
139 -       FLAC__seekable_stream_decoder_set_seek_callback (data->decoder,
140 -                       seek_callback);
141 -       FLAC__seekable_stream_decoder_set_tell_callback (data->decoder,
142 -                       tell_callback);
143 -       FLAC__seekable_stream_decoder_set_length_callback (data->decoder,
144 -                       length_callback);
145 -       FLAC__seekable_stream_decoder_set_eof_callback (data->decoder,
146 -                       eof_callback);
147  
148 -       if (FLAC__seekable_stream_decoder_init(data->decoder)
149 -                       != FLAC__FILE_DECODER_OK) {
150 +       if (FLAC__stream_decoder_init_stream(
151 +                               data->decoder,
152 +                               read_callback,
153 +                               seek_callback,
154 +                               tell_callback,
155 +                               length_callback,
156 +                               eof_callback,
157 +                               write_callback,
158 +                               metadata_callback,
159 +                               error_callback,
160 +                               data)
161 +                       != FLAC__STREAM_DECODER_INIT_STATUS_OK) {
162                 decoder_error (&data->error, ERROR_FATAL, 0,
163 -                               "FLAC__seekable_stream_decoder_init() failed");
164 +                               "FLAC__stream_decoder_init() failed");
165                 data->ok = 0;
166                 return data;
167         }
168  
169 -       if (!FLAC__seekable_stream_decoder_process_until_end_of_metadata(
170 +       if (!FLAC__stream_decoder_process_until_end_of_metadata(
171                                 data->decoder)) {
172                 decoder_error (&data->error, ERROR_FATAL, 0,
173 -                               "FLAC__seekable_stream_decoder_process_until_end_of_metadata()"
174 +                               "FLAC__stream_decoder_process_until_end_of_metadata()"
175                                 " failed.");
176                 data->ok = 0;
177                 return data;
178 @@ -309,8 +303,8 @@
179  
180         if (data->ok) {
181                 if (data->decoder) {
182 -                       FLAC__seekable_stream_decoder_finish (data->decoder);
183 -                       FLAC__seekable_stream_decoder_delete (data->decoder);
184 +                       FLAC__stream_decoder_finish (data->decoder);
185 +                       FLAC__stream_decoder_delete (data->decoder);
186                 }
187                 io_close (data->stream);
188         }
189 @@ -430,11 +424,11 @@
190         target_sample = (FLAC__uint64)((sec/(double)data->length) *
191                         (double)data->total_samples);
192         
193 -       if (FLAC__seekable_stream_decoder_seek_absolute(data->decoder,
194 +       if (FLAC__stream_decoder_seek_absolute(data->decoder,
195                                 target_sample))
196                 return sec;
197         else {
198 -               logit ("FLAC__seekable_stream_decoder_seek_absolute() failed.");
199 +               logit ("FLAC__stream_decoder_seek_absolute() failed.");
200                 return -1;
201         }
202  }
203 @@ -469,13 +463,13 @@
204         if (!data->sample_buffer_fill) {
205                 debug ("decoding...");
206                 
207 -               if (FLAC__seekable_stream_decoder_get_state(data->decoder)
208 -                               == FLAC__FILE_DECODER_END_OF_FILE) {
209 +               if (FLAC__stream_decoder_get_state(data->decoder)
210 +                               == FLAC__STREAM_DECODER_END_OF_STREAM) {
211                         logit ("EOF");
212                         return 0;
213                 }
214  
215 -               if (!FLAC__seekable_stream_decoder_process_single(
216 +               if (!FLAC__stream_decoder_process_single(
217                                         data->decoder)) {
218                         decoder_error (&data->error, ERROR_FATAL, 0,
219                                         "Read error processing frame.");
220 @@ -483,7 +477,7 @@
221                 }
222  
223                 /* Count the bitrate */
224 -               if(!FLAC__seekable_stream_decoder_get_decode_position(
225 +               if(!FLAC__stream_decoder_get_decode_position(
226                                         data->decoder, &decode_position))
227                         decode_position = 0;
228                 if (decode_position > data->last_decode_position) {
This page took 0.085912 seconds and 3 git commands to generate.