projects
/
aubio.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
05a8c18
)
src/io/source_avcodec.c: avoid seeking in closed file
author
Paul Brossier
<piem@piem.org>
Sun, 26 Feb 2017 22:37:01 +0000
(23:37 +0100)
committer
Paul Brossier
<piem@piem.org>
Sun, 26 Feb 2017 22:37:01 +0000
(23:37 +0100)
src/io/source_avcodec.c
patch
|
blob
|
history
diff --git
a/src/io/source_avcodec.c
b/src/io/source_avcodec.c
index
eae1cfc
..
4f9e25c
100644
(file)
--- a/
src/io/source_avcodec.c
+++ b/
src/io/source_avcodec.c
@@
-477,10
+477,17
@@
uint_t aubio_source_avcodec_seek (aubio_source_avcodec_t * s, uint_t pos) {
int64_t min_ts = MAX(resampled_pos - 2000, 0);
int64_t max_ts = MIN(resampled_pos + 2000, INT64_MAX);
int seek_flags = AVSEEK_FLAG_FRAME | AVSEEK_FLAG_ANY;
int64_t min_ts = MAX(resampled_pos - 2000, 0);
int64_t max_ts = MIN(resampled_pos + 2000, INT64_MAX);
int seek_flags = AVSEEK_FLAG_FRAME | AVSEEK_FLAG_ANY;
- int ret = avformat_seek_file(s->avFormatCtx, s->selected_stream,
+ int ret = AUBIO_FAIL;
+ if (s->avFormatCtx != NULL && s->avr != NULL) {
+ ret = AUBIO_OK;
+ } else {
+ AUBIO_ERR("source_avcodec: failed seeking in %s (file not opened?)", s->path);
+ return ret;
+ }
+ ret = avformat_seek_file(s->avFormatCtx, s->selected_stream,
min_ts, resampled_pos, max_ts, seek_flags);
if (ret < 0) {
min_ts, resampled_pos, max_ts, seek_flags);
if (ret < 0) {
- AUBIO_ERR("
F
ailed seeking to %d in file %s", pos, s->path);
+ AUBIO_ERR("
source_avcodec: f
ailed seeking to %d in file %s", pos, s->path);
}
// reset read status
s->eof = 0;
}
// reset read status
s->eof = 0;