oma: refactor seek function
Properly propagate seek errors from avio and the generic pcm seek.
(cherry picked from commit 4f03a77e52
)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
Conflicts:
libavformat/omadec.c
This commit is contained in:
@@ -422,22 +422,26 @@ static int oma_read_seek(struct AVFormatContext *s, int stream_index, int64_t ti
|
|||||||
{
|
{
|
||||||
OMAContext *oc = s->priv_data;
|
OMAContext *oc = s->priv_data;
|
||||||
|
|
||||||
pcm_read_seek(s, stream_index, timestamp, flags);
|
int err = pcm_read_seek(s, stream_index, timestamp, flags);
|
||||||
|
|
||||||
|
if (!oc->encrypted)
|
||||||
|
return err;
|
||||||
|
|
||||||
if (oc->encrypted) {
|
|
||||||
/* readjust IV for CBC */
|
/* readjust IV for CBC */
|
||||||
int64_t pos = avio_tell(s->pb);
|
if (err || avio_tell(s->pb) < oc->content_start)
|
||||||
if (pos < oc->content_start)
|
goto wipe;
|
||||||
memset(oc->iv, 0, 8);
|
if ((err = avio_seek(s->pb, -8, SEEK_CUR)) < 0)
|
||||||
else {
|
goto wipe;
|
||||||
if (avio_seek(s->pb, -8, SEEK_CUR) < 0 || avio_read(s->pb, oc->iv, 8) < 8) {
|
if ((err = avio_read(s->pb, oc->iv, 8)) < 8) {
|
||||||
memset(oc->iv, 0, 8);
|
if (err >= 0)
|
||||||
return -1;
|
err = AVERROR_EOF;
|
||||||
}
|
goto wipe;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
wipe:
|
||||||
|
memset(oc->iv, 0, 8);
|
||||||
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
AVInputFormat ff_oma_demuxer = {
|
AVInputFormat ff_oma_demuxer = {
|
||||||
|
Reference in New Issue
Block a user