Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Stefan Strogin
flac
Commits
0833f345
Commit
0833f345
authored
Jul 15, 2002
by
Josh Coalson
Browse files
use FLAC__format_seektable_is_legal()
parent
f31f5547
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/libFLAC/metadata_object.c
View file @
0833f345
...
@@ -575,27 +575,10 @@ FLAC__bool FLAC__metadata_object_seektable_delete_point(FLAC__StreamMetadata *ob
...
@@ -575,27 +575,10 @@ FLAC__bool FLAC__metadata_object_seektable_delete_point(FLAC__StreamMetadata *ob
FLAC__bool
FLAC__metadata_object_seektable_is_legal
(
const
FLAC__StreamMetadata
*
object
)
FLAC__bool
FLAC__metadata_object_seektable_is_legal
(
const
FLAC__StreamMetadata
*
object
)
{
{
unsigned
i
;
FLAC__uint64
prev_sample_number
=
0
;
FLAC__bool
got_prev
=
false
;
FLAC__ASSERT
(
0
!=
object
);
FLAC__ASSERT
(
0
!=
object
);
FLAC__ASSERT
(
object
->
type
==
FLAC__METADATA_TYPE_SEEKTABLE
);
FLAC__ASSERT
(
object
->
type
==
FLAC__METADATA_TYPE_SEEKTABLE
);
{
return
FLAC__format_seektable_is_legal
(
&
object
->
data
.
seek_table
);
const
FLAC__StreamMetadata_SeekTable
*
seek_table
=
&
object
->
data
.
seek_table
;
for
(
i
=
0
;
i
<
seek_table
->
num_points
;
i
++
)
{
if
(
got_prev
)
{
if
(
seek_table
->
points
[
i
].
sample_number
<=
prev_sample_number
)
return
false
;
}
prev_sample_number
=
seek_table
->
points
[
i
].
sample_number
;
got_prev
=
true
;
}
}
return
true
;
}
}
FLAC__bool
FLAC__metadata_object_vorbiscomment_set_vendor_string
(
FLAC__StreamMetadata
*
object
,
FLAC__StreamMetadata_VorbisComment_Entry
entry
,
FLAC__bool
copy
)
FLAC__bool
FLAC__metadata_object_vorbiscomment_set_vendor_string
(
FLAC__StreamMetadata
*
object
,
FLAC__StreamMetadata_VorbisComment_Entry
entry
,
FLAC__bool
copy
)
...
...
src/libFLAC/stream_encoder.c
View file @
0833f345
...
@@ -21,7 +21,6 @@
...
@@ -21,7 +21,6 @@
#include <stdlib.h>
/* for malloc() */
#include <stdlib.h>
/* for malloc() */
#include <string.h>
/* for memcpy() */
#include <string.h>
/* for memcpy() */
#include "FLAC/assert.h"
#include "FLAC/assert.h"
#include "FLAC/metadata.h"
/* for FLAC__metadata_object_seektable_is_legal() */
#include "protected/stream_encoder.h"
#include "protected/stream_encoder.h"
#include "private/bitbuffer.h"
#include "private/bitbuffer.h"
#include "private/bitmath.h"
#include "private/bitmath.h"
...
@@ -279,7 +278,7 @@ FLAC__StreamEncoderState FLAC__stream_encoder_init(FLAC__StreamEncoder *encoder)
...
@@ -279,7 +278,7 @@ FLAC__StreamEncoderState FLAC__stream_encoder_init(FLAC__StreamEncoder *encoder)
if
(
encoder
->
protected_
->
bits_per_sample
<
FLAC__MIN_BITS_PER_SAMPLE
||
encoder
->
protected_
->
bits_per_sample
>
FLAC__REFERENCE_CODEC_MAX_BITS_PER_SAMPLE
)
if
(
encoder
->
protected_
->
bits_per_sample
<
FLAC__MIN_BITS_PER_SAMPLE
||
encoder
->
protected_
->
bits_per_sample
>
FLAC__REFERENCE_CODEC_MAX_BITS_PER_SAMPLE
)
return
encoder
->
protected_
->
state
=
FLAC__STREAM_ENCODER_INVALID_BITS_PER_SAMPLE
;
return
encoder
->
protected_
->
state
=
FLAC__STREAM_ENCODER_INVALID_BITS_PER_SAMPLE
;
if
(
!
FLAC__format_
is_valid_
sample_rate
(
encoder
->
protected_
->
sample_rate
))
if
(
!
FLAC__format_sample_rate
_is_valid
(
encoder
->
protected_
->
sample_rate
))
return
encoder
->
protected_
->
state
=
FLAC__STREAM_ENCODER_INVALID_SAMPLE_RATE
;
return
encoder
->
protected_
->
state
=
FLAC__STREAM_ENCODER_INVALID_SAMPLE_RATE
;
if
(
encoder
->
protected_
->
blocksize
<
FLAC__MIN_BLOCK_SIZE
||
encoder
->
protected_
->
blocksize
>
FLAC__MAX_BLOCK_SIZE
)
if
(
encoder
->
protected_
->
blocksize
<
FLAC__MIN_BLOCK_SIZE
||
encoder
->
protected_
->
blocksize
>
FLAC__MAX_BLOCK_SIZE
)
...
@@ -337,7 +336,7 @@ FLAC__StreamEncoderState FLAC__stream_encoder_init(FLAC__StreamEncoder *encoder)
...
@@ -337,7 +336,7 @@ FLAC__StreamEncoderState FLAC__stream_encoder_init(FLAC__StreamEncoder *encoder)
if
(
encoder
->
protected_
->
metadata
[
i
]
->
type
==
FLAC__METADATA_TYPE_STREAMINFO
)
if
(
encoder
->
protected_
->
metadata
[
i
]
->
type
==
FLAC__METADATA_TYPE_STREAMINFO
)
return
encoder
->
protected_
->
state
=
FLAC__STREAM_ENCODER_INVALID_METADATA
;
return
encoder
->
protected_
->
state
=
FLAC__STREAM_ENCODER_INVALID_METADATA
;
else
if
(
encoder
->
protected_
->
metadata
[
i
]
->
type
==
FLAC__METADATA_TYPE_SEEKTABLE
)
{
else
if
(
encoder
->
protected_
->
metadata
[
i
]
->
type
==
FLAC__METADATA_TYPE_SEEKTABLE
)
{
if
(
!
FLAC__
metadata_objec
t_seektable_is_legal
(
encoder
->
protected_
->
metadata
[
i
]))
if
(
!
FLAC__
forma
t_seektable_is_legal
(
&
encoder
->
protected_
->
metadata
[
i
]
->
data
.
seek_table
))
return
encoder
->
protected_
->
state
=
FLAC__STREAM_ENCODER_INVALID_METADATA
;
return
encoder
->
protected_
->
state
=
FLAC__STREAM_ENCODER_INVALID_METADATA
;
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment