[FFmpeg-cvslog] oma: refactor seek function
Luca Barbato
git at videolan.org
Tue Aug 27 18:38:50 CEST 2013
ffmpeg | branch: release/1.1 | Luca Barbato <lu_zero at gentoo.org> | Sat May 4 07:40:09 2013 +0200| [0b6adcf76bda8994902f5b6d8e694b0b916ea210] | committer: Luca Barbato
oma: refactor seek function
Properly propagate seek errors from avio and the generic pcm seek.
(cherry picked from commit 4f03a77e52596cbe9ec179666ddb3e0345a8133a)
Signed-off-by: Luca Barbato <lu_zero at gentoo.org>
Conflicts:
libavformat/omadec.c
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0b6adcf76bda8994902f5b6d8e694b0b916ea210
---
libavformat/omadec.c | 31 +++++++++++++++++--------------
1 file changed, 17 insertions(+), 14 deletions(-)
diff --git a/libavformat/omadec.c b/libavformat/omadec.c
index cd255c1..db599f5 100644
--- a/libavformat/omadec.c
+++ b/libavformat/omadec.c
@@ -427,23 +427,26 @@ static int oma_read_probe(AVProbeData *p)
static int oma_read_seek(struct AVFormatContext *s, int stream_index, int64_t timestamp, int flags)
{
OMAContext *oc = s->priv_data;
-
- ff_pcm_read_seek(s, stream_index, timestamp, flags);
-
- if (oc->encrypted) {
- /* readjust IV for CBC */
- int64_t pos = avio_tell(s->pb);
- if (pos < oc->content_start)
- memset(oc->iv, 0, 8);
- else {
- if (avio_seek(s->pb, -8, SEEK_CUR) < 0 || avio_read(s->pb, oc->iv, 8) < 8) {
- memset(oc->iv, 0, 8);
- return -1;
- }
- }
+ int err = ff_pcm_read_seek(s, stream_index, timestamp, flags);
+
+ if (!oc->encrypted)
+ return err;
+
+ /* readjust IV for CBC */
+ if (err || avio_tell(s->pb) < oc->content_start)
+ goto wipe;
+ if ((err = avio_seek(s->pb, -8, SEEK_CUR)) < 0)
+ goto wipe;
+ if ((err = avio_read(s->pb, oc->iv, 8)) < 8) {
+ if (err >= 0)
+ err = AVERROR_EOF;
+ goto wipe;
}
return 0;
+wipe:
+ memset(oc->iv, 0, 8);
+ return err;
}
AVInputFormat ff_oma_demuxer = {
More information about the ffmpeg-cvslog
mailing list