comparison src/alac/plugin.c @ 67:41e2dc106f4e trunk

[svn] - remove spurious debugging notices
author nenolod
date Sat, 30 Sep 2006 22:57:56 -0700
parents f04b33512c3d
children d435a3abc035
comparison
equal deleted inserted replaced
66:f04b33512c3d 67:41e2dc106f4e
65 65
66 set_endian(); 66 set_endian();
67 67
68 if (!input_stream) 68 if (!input_stream)
69 { 69 {
70 fprintf(stderr, "failed to create input stream from file\n");
71 vfs_fclose(input_file); 70 vfs_fclose(input_file);
72 return FALSE; 71 return FALSE;
73 } 72 }
74 73
75 /* if qtmovie_read returns successfully, the stream is up to 74 /* if qtmovie_read returns successfully, the stream is up to
76 * the movie data, which can be used directly by the decoder */ 75 * the movie data, which can be used directly by the decoder */
77 if (!qtmovie_read(input_stream, &demux_res)) 76 if (!qtmovie_read(input_stream, &demux_res))
78 { 77 {
79 fprintf(stderr, "failed to load the QuickTime movie headers\n");
80 stream_destroy(input_stream); 78 stream_destroy(input_stream);
81 vfs_fclose(input_file); 79 vfs_fclose(input_file);
82 return FALSE; 80 return FALSE;
83 } 81 }
84 82
145 { 143 {
146 unsigned int duration_index_accum = 0; 144 unsigned int duration_index_accum = 0;
147 unsigned int duration_cur_index = 0; 145 unsigned int duration_cur_index = 0;
148 146
149 if (samplenum >= demux_res->num_sample_byte_sizes) 147 if (samplenum >= demux_res->num_sample_byte_sizes)
150 { 148 return 0;
151 fprintf(stderr, "sample %i does not exist\n", samplenum);
152 return 0;
153 }
154 149
155 if (!demux_res->num_time_to_samples) 150 if (!demux_res->num_time_to_samples)
156 { 151 return 0;
157 fprintf(stderr, "no time to samples\n"); 152
158 return 0;
159 }
160 while ((demux_res->time_to_sample[duration_cur_index].sample_count + duration_index_accum) 153 while ((demux_res->time_to_sample[duration_cur_index].sample_count + duration_index_accum)
161 <= samplenum) 154 <= samplenum)
162 { 155 {
163 duration_index_accum += demux_res->time_to_sample[duration_cur_index].sample_count; 156 duration_index_accum += demux_res->time_to_sample[duration_cur_index].sample_count;
164 duration_cur_index++; 157 duration_cur_index++;
158
165 if (duration_cur_index >= demux_res->num_time_to_samples) 159 if (duration_cur_index >= demux_res->num_time_to_samples)
166 {
167 fprintf(stderr, "sample %i does not have a duration\n", samplenum);
168 return 0; 160 return 0;
169 }
170 } 161 }
171 162
172 *sample_duration = demux_res->time_to_sample[duration_cur_index].sample_duration; 163 *sample_duration = demux_res->time_to_sample[duration_cur_index].sample_duration;
173 *sample_byte_size = demux_res->sample_byte_size[samplenum]; 164 *sample_byte_size = demux_res->sample_byte_size[samplenum];
174 165
196 int outputBytes; 187 int outputBytes;
197 188
198 /* just get one sample for now */ 189 /* just get one sample for now */
199 if (!get_sample_info(demux_res, i, 190 if (!get_sample_info(demux_res, i,
200 &sample_duration, &sample_byte_size)) 191 &sample_duration, &sample_byte_size))
201 {
202 fprintf(stderr, "sample failed\n");
203 return; 192 return;
204 }
205 193
206 if (buffer_size < sample_byte_size) 194 if (buffer_size < sample_byte_size)
207 {
208 fprintf(stderr, "sorry buffer too small! (is %i want %i)\n",
209 buffer_size,
210 sample_byte_size);
211 return; 195 return;
212 }
213 196
214 stream_read(input_stream, sample_byte_size, 197 stream_read(input_stream, sample_byte_size,
215 buffer); 198 buffer);
216 199
217 /* now fetch */ 200 /* now fetch */
241 224
242 input_file = vfs_fopen((char *) args, "rb"); 225 input_file = vfs_fopen((char *) args, "rb");
243 input_stream = stream_create_file(input_file, 1); 226 input_stream = stream_create_file(input_file, 1);
244 227
245 if (!input_stream) 228 if (!input_stream)
246 { 229 return 0;
247 fprintf(stderr, "failed to create input stream from file\n");
248 return 0;
249 }
250 230
251 /* if qtmovie_read returns successfully, the stream is up to 231 /* if qtmovie_read returns successfully, the stream is up to
252 * the movie data, which can be used directly by the decoder */ 232 * the movie data, which can be used directly by the decoder */
253 if (!qtmovie_read(input_stream, &demux_res)) 233 if (!qtmovie_read(input_stream, &demux_res))
254 { 234 return 0;
255 fprintf(stderr, "failed to load the QuickTime movie headers\n");
256 return 0;
257 }
258 235
259 /* initialise the sound converter */ 236 /* initialise the sound converter */
260 init_sound_converter(&demux_res); 237 init_sound_converter(&demux_res);
261 238
262 alac_ip.output->open_audio(FMT_S16_LE, demux_res.sample_rate, demux_res.num_channels); 239 alac_ip.output->open_audio(FMT_S16_LE, demux_res.sample_rate, demux_res.num_channels);