Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Stefan Strogin
flac
Commits
982ea3a2
Commit
982ea3a2
authored
Sep 16, 2006
by
Josh Coalson
Browse files
fix recovery logic when seek fails
parent
9acc35fe
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
24 deletions
+4
-24
src/test_seeking/main.c
src/test_seeking/main.c
+4
-24
No files found.
src/test_seeking/main.c
View file @
982ea3a2
...
...
@@ -266,18 +266,8 @@ static FLAC__bool seek_barrage_native_flac(const char *filename, off_t filesize,
printf
(
"seek failed, assuming it was past EOF... "
);
else
printf
(
"seek past end failed as expected... "
);
/* hack to work around a deficiency in the seek API's behavior */
/* seeking past EOF sets the file decoder state to non-OK and there's no ..._flush() or ..._reset() call to reset it */
/* @@@@@@ probably no longer true and we can remove this hack */
if
(
!
FLAC__stream_decoder_finish
(
decoder
))
return
die_s_
(
"FLAC__stream_decoder_finish() FAILED"
,
decoder
);
if
(
FLAC__stream_decoder_init_file
(
decoder
,
filename
,
write_callback_
,
metadata_callback_
,
error_callback_
,
&
decoder_client_data
)
!=
FLAC__STREAM_DECODER_INIT_STATUS_OK
)
return
die_s_
(
"FLAC__stream_decoder_init_file() FAILED"
,
decoder
);
if
(
!
FLAC__stream_decoder_process_until_end_of_metadata
(
decoder
))
return
die_s_
(
"FLAC__stream_decoder_process_until_end_of_metadata() FAILED"
,
decoder
);
if
(
!
FLAC__stream_decoder_flush
(
decoder
))
return
die_s_
(
"FLAC__stream_decoder_flush() FAILED"
,
decoder
);
}
else
{
printf
(
"decode_frame... "
);
...
...
@@ -399,18 +389,8 @@ static FLAC__bool seek_barrage_ogg_flac(const char *filename, off_t filesize, un
printf
(
"seek failed, assuming it was past EOF... "
);
else
printf
(
"seek past end failed as expected... "
);
/* hack to work around a deficiency in the seek API's behavior */
/* seeking past EOF sets the file decoder state to non-OK and there's no ..._flush() or ..._reset() call to reset it */
/* @@@@@@ probably no longer true and we can remove this hack */
if
(
!
OggFLAC__stream_decoder_finish
(
decoder
))
return
die_os_
(
"OggFLAC__stream_decoder_finish() FAILED"
,
decoder
);
if
(
OggFLAC__stream_decoder_init_file
(
decoder
,
filename
,
write_callback_
,
metadata_callback_
,
error_callback_
,
&
decoder_client_data
)
!=
FLAC__STREAM_DECODER_INIT_STATUS_OK
)
return
die_os_
(
"OggFLAC__stream_decoder_init_file() FAILED"
,
decoder
);
if
(
!
OggFLAC__stream_decoder_process_until_end_of_metadata
(
decoder
))
return
die_os_
(
"OggFLAC__stream_decoder_process_until_end_of_metadata() FAILED"
,
decoder
);
if
(
!
OggFLAC__stream_decoder_flush
(
decoder
))
return
die_os_
(
"OggFLAC__stream_decoder_flush() FAILED"
,
decoder
);
}
else
{
printf
(
"decode_frame... "
);
...
...
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