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
9f3ac317
Commit
9f3ac317
authored
Sep 23, 2004
by
Josh Coalson
Browse files
patch from Brian Willoughby: fix handling of "offset" field in SSND chunk
parent
94b54997
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/flac/encode.c
View file @
9f3ac317
...
...
@@ -299,10 +299,6 @@ flac__encode_aif(FILE *infile, long infilesize, const char *infilename, const ch
/* SSND chunk size */
if
(
!
read_big_endian_uint32
(
infile
,
&
xx
,
false
,
encoder_session
.
inbasefilename
))
return
EncoderSession_finish_error
(
&
encoder_session
);
else
if
(
xx
!=
(
sample_frames
*
bytes_per_frame
+
8U
))
{
flac__utils_printf
(
stderr
,
1
,
"%s: ERROR: SSND chunk size inconsistent with sample frame count
\n
"
,
encoder_session
.
inbasefilename
);
return
EncoderSession_finish_error
(
&
encoder_session
);
}
data_bytes
=
xx
;
pad
=
(
data_bytes
&
1U
)
?
true
:
false
;
data_bytes
-=
8U
;
/* discount the offset and block size fields */
...
...
@@ -310,11 +306,8 @@ flac__encode_aif(FILE *infile, long infilesize, const char *infilename, const ch
/* offset */
if
(
!
read_big_endian_uint32
(
infile
,
&
xx
,
false
,
encoder_session
.
inbasefilename
))
return
EncoderSession_finish_error
(
&
encoder_session
);
else
if
(
xx
!=
0U
)
{
flac__utils_printf
(
stderr
,
1
,
"%s: ERROR: offset is %u; must be 0
\n
"
,
encoder_session
.
inbasefilename
,
(
unsigned
int
)
xx
);
return
EncoderSession_finish_error
(
&
encoder_session
);
}
offset
=
xx
;
data_bytes
-=
offset
;
/* block size */
if
(
!
read_big_endian_uint32
(
infile
,
&
xx
,
false
,
encoder_session
.
inbasefilename
))
...
...
@@ -325,6 +318,15 @@ flac__encode_aif(FILE *infile, long infilesize, const char *infilename, const ch
}
block_size
=
xx
;
if
(
fseek
(
infile
,
offset
,
SEEK_CUR
))
{
flac__utils_printf
(
stderr
,
1
,
"%s: ERROR: skipping offset in SSND chunk
\n
"
,
encoder_session
.
inbasefilename
);
return
EncoderSession_finish_error
(
&
encoder_session
);
}
if
(
data_bytes
!=
(
sample_frames
*
bytes_per_frame
))
{
flac__utils_printf
(
stderr
,
1
,
"%s: ERROR: SSND chunk size inconsistent with sample frame count
\n
"
,
encoder_session
.
inbasefilename
);
return
EncoderSession_finish_error
(
&
encoder_session
);
}
/* *options.common.align_reservoir_samples will be 0 unless --sector-align is used */
FLAC__ASSERT
(
options
.
common
.
sector_align
||
*
options
.
common
.
align_reservoir_samples
==
0
);
total_samples_in_input
=
data_bytes
/
bytes_per_frame
+
*
options
.
common
.
align_reservoir_samples
;
...
...
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