2001-04-13 18:53:17 +00:00
|
|
|
/* libFLAC - Free Lossless Audio Codec library
|
2002-01-26 18:05:12 +00:00
|
|
|
* Copyright (C) 2001,2002 Josh Coalson
|
2001-04-13 18:53:17 +00:00
|
|
|
*
|
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
|
* Library General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "FLAC/seek_table.h"
|
|
|
|
|
|
2001-06-23 03:03:24 +00:00
|
|
|
FLAC__bool FLAC__seek_table_is_valid(const FLAC__StreamMetaData_SeekTable *seek_table)
|
2001-04-13 18:53:17 +00:00
|
|
|
{
|
2001-04-13 19:01:56 +00:00
|
|
|
unsigned i;
|
2001-06-23 03:03:24 +00:00
|
|
|
FLAC__uint64 last_sample_number = 0;
|
|
|
|
|
FLAC__bool got_last = false;
|
2001-04-13 19:01:56 +00:00
|
|
|
|
|
|
|
|
for(i = 0; i < seek_table->num_points; i++) {
|
|
|
|
|
if(seek_table->points[i].sample_number != FLAC__STREAM_METADATA_SEEKPOINT_PLACEHOLDER) {
|
|
|
|
|
if(got_last) {
|
|
|
|
|
if(seek_table->points[i].sample_number <= last_sample_number)
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
last_sample_number = seek_table->points[i].sample_number;
|
|
|
|
|
got_last = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2001-04-13 18:53:17 +00:00
|
|
|
return true;
|
|
|
|
|
}
|