~ubuntu-branches/ubuntu/saucy/flac/saucy

« back to all changes in this revision

Viewing changes to src/metaflac/operations_shorthand_seektable.c

  • Committer: Package Import Robot
  • Author(s): Fabian Greffrath
  • Date: 2013-06-07 10:24:30 UTC
  • mfrom: (8.1.7 sid)
  • Revision ID: package-import@ubuntu.com-20130607102430-8xn8qdlir5gmdo4m
Tags: 1.3.0-1
* Imported Upstream version 1.3.0 (Closes: #527542, #705601).
* Update debian/watch file, thanks Ulrich Klauer (Closes: #710062).
* Revert "Remove manpages from master branch."
* Imported Upstream version 1.3.0
* Convert package to "3.0 (quilt)" source format.
* Remove all patches, they have either been merged upstream or do not
  apply anymore (tested).
* Explicitly enable static libraries.
* Simplify debian/libflac-doc.install.
* Bump shlibs for added symbols.
* Remove needless Build-Depends: libid3-3.8.3-dev.
* Update Homepage field.
* Repair upstream manpage regeneration rule.
* Bump Build-Depends: debhelper (>= 9).
* Fix vcs-field-not-canonical.
* Import two patches from upstream GIT:
  + Add missing config.h includes.
  + Fix local_strcat() to terminate string correctly.
* Disable 3DNow! optimizations, enable SSE only on amd64, enable Altivec
  only on ppc64, disable ASM optimizations elsewhere.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* metaflac - Command-line FLAC metadata editor
2
 
 * Copyright (C) 2001,2002,2003,2004,2005,2006,2007  Josh Coalson
 
2
 * Copyright (C) 2001-2009  Josh Coalson
 
3
 * Copyright (C) 2011-2013  Xiph.Org Foundation
3
4
 *
4
5
 * This program is free software; you can redistribute it and/or
5
6
 * modify it under the terms of the GNU General Public License
11
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
13
 * GNU General Public License for more details.
13
14
 *
14
 
 * You should have received a copy of the GNU General Public License
15
 
 * along with this program; if not, write to the Free Software
16
 
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
15
 * You should have received a copy of the GNU General Public License along
 
16
 * with this program; if not, write to the Free Software Foundation, Inc.,
 
17
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17
18
 */
18
19
 
19
20
#if HAVE_CONFIG_H
53
54
        } while(!found_seektable_block && FLAC__metadata_iterator_next(iterator));
54
55
 
55
56
        if(total_samples == 0) {
56
 
                fprintf(stderr, "%s: ERROR: cannot add seekpoints because STREAMINFO block does not specify total_samples\n", filename);
 
57
                flac_fprintf(stderr, "%s: ERROR: cannot add seekpoints because STREAMINFO block does not specify total_samples\n", filename);
57
58
                return false;
58
59
        }
59
60
 
79
80
        FLAC__ASSERT(block->type == FLAC__METADATA_TYPE_SEEKTABLE);
80
81
 
81
82
        if(!grabbag__seektable_convert_specification_to_template(specification, /*only_explicit_placeholders=*/false, total_samples, sample_rate, block, /*spec_has_real_points=*/0)) {
82
 
                fprintf(stderr, "%s: ERROR (internal) preparing seektable with seekpoints\n", filename);
 
83
                flac_fprintf(stderr, "%s: ERROR (internal) preparing seektable with seekpoints\n", filename);
83
84
                return false;
84
85
        }
85
86
 
178
179
        decoder = FLAC__stream_decoder_new();
179
180
 
180
181
        if(0 == decoder) {
181
 
                fprintf(stderr, "%s: ERROR (--add-seekpoint) creating the decoder instance\n", filename);
 
182
                flac_fprintf(stderr, "%s: ERROR (--add-seekpoint) creating the decoder instance\n", filename);
182
183
                return false;
183
184
        }
184
185
 
186
187
        FLAC__stream_decoder_set_metadata_ignore_all(decoder);
187
188
 
188
189
        if(FLAC__stream_decoder_init_file(decoder, filename, write_callback_, /*metadata_callback=*/0, error_callback_, &client_data) != FLAC__STREAM_DECODER_INIT_STATUS_OK) {
189
 
                fprintf(stderr, "%s: ERROR (--add-seekpoint) initializing the decoder instance (%s)\n", filename, FLAC__stream_decoder_get_resolved_state_string(decoder));
 
190
                flac_fprintf(stderr, "%s: ERROR (--add-seekpoint) initializing the decoder instance (%s)\n", filename, FLAC__stream_decoder_get_resolved_state_string(decoder));
190
191
                ok = false;
191
192
        }
192
193
 
193
194
        if(ok && !FLAC__stream_decoder_process_until_end_of_metadata(decoder)) {
194
 
                fprintf(stderr, "%s: ERROR (--add-seekpoint) decoding file (%s)\n", filename, FLAC__stream_decoder_get_resolved_state_string(decoder));
 
195
                flac_fprintf(stderr, "%s: ERROR (--add-seekpoint) decoding file (%s)\n", filename, FLAC__stream_decoder_get_resolved_state_string(decoder));
195
196
                ok = false;
196
197
        }
197
198
 
198
199
        if(ok && !FLAC__stream_decoder_get_decode_position(decoder, &client_data.audio_offset)) {
199
 
                fprintf(stderr, "%s: ERROR (--add-seekpoint) decoding file\n", filename);
 
200
                flac_fprintf(stderr, "%s: ERROR (--add-seekpoint) decoding file\n", filename);
200
201
                ok = false;
201
202
        }
202
203
        client_data.last_offset = client_data.audio_offset;
203
204
 
204
205
        if(ok && !FLAC__stream_decoder_process_until_end_of_stream(decoder)) {
205
 
                fprintf(stderr, "%s: ERROR (--add-seekpoint) decoding file (%s)\n", filename, FLAC__stream_decoder_get_resolved_state_string(decoder));
 
206
                flac_fprintf(stderr, "%s: ERROR (--add-seekpoint) decoding file (%s)\n", filename, FLAC__stream_decoder_get_resolved_state_string(decoder));
206
207
                ok = false;
207
208
        }
208
209
 
209
210
        if(ok && client_data.error_occurred) {
210
 
                fprintf(stderr, "%s: ERROR (--add-seekpoint) decoding file (%u:%s)\n", filename, (unsigned)client_data.error_status, FLAC__StreamDecoderErrorStatusString[client_data.error_status]);
 
211
                flac_fprintf(stderr, "%s: ERROR (--add-seekpoint) decoding file (%u:%s)\n", filename, (unsigned)client_data.error_status, FLAC__StreamDecoderErrorStatusString[client_data.error_status]);
211
212
                ok = false;
212
213
        }
213
214