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
Xiph.Org
flac
Commits
da68d764
Commit
da68d764
authored
Jan 05, 2001
by
Josh Coalson
Browse files
fix to chop off bytes after end of data chunk
parent
841e27e1
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/flac/encode.c
View file @
da68d764
...
...
@@ -239,18 +239,22 @@ int encode_wav(const char *infile, const char *outfile, bool verbose, uint64 ski
else
if
(
feof
(
fin
))
break
;
}
else
if
(
bytes_read
%
bytes_per_wide_sample
!=
0
)
{
fprintf
(
stderr
,
"ERROR, got partial sample from input file %s
\n
"
,
infile
);
goto
wav_abort_
;
}
else
{
unsigned
wide_samples
=
bytes_read
/
bytes_per_wide_sample
;
format_input
(
wide_samples
,
false
,
is_unsigned_samples
,
channels
,
bps
,
&
encoder_wrapper
);
if
(
!
FLAC__encoder_process
(
encoder_wrapper
.
encoder
,
input
,
wide_sample
s
)
)
{
fprintf
(
stderr
,
"ERROR
during encoding, state = %d:%s
\n
"
,
encoder_wrapper
.
encoder
->
state
,
FLAC__EncoderStateString
[
encoder_wrapper
.
encoder
->
state
]
);
if
(
bytes_read
>
data_bytes
)
bytes_read
=
data_bytes
;
/* chop off anything after the end of the data chunk */
if
(
bytes_read
%
bytes_per_
wide_sample
!=
0
)
{
fprintf
(
stderr
,
"ERROR
, got partial sample from input file %s
\n
"
,
infile
);
goto
wav_abort_
;
}
data_bytes
-=
bytes_read
;
else
{
unsigned
wide_samples
=
bytes_read
/
bytes_per_wide_sample
;
format_input
(
wide_samples
,
false
,
is_unsigned_samples
,
channels
,
bps
,
&
encoder_wrapper
);
if
(
!
FLAC__encoder_process
(
encoder_wrapper
.
encoder
,
input
,
wide_samples
))
{
fprintf
(
stderr
,
"ERROR during encoding, state = %d:%s
\n
"
,
encoder_wrapper
.
encoder
->
state
,
FLAC__EncoderStateString
[
encoder_wrapper
.
encoder
->
state
]);
goto
wav_abort_
;
}
data_bytes
-=
bytes_read
;
}
}
}
...
...
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