aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2004-10-11 23:53:53 +0000
committerMichael Niedermayer <michaelni@gmx.at>2004-10-11 23:53:53 +0000
commit7b3c1382bf46615e3faea72b62b6dab83e4142a7 (patch)
tree0a31847fbc7101c59d4cf309abed68b3fda59d2b /libavformat
parentb1d041c15c6b45cde682f4dfd12d15a0709da399 (diff)
downloadffmpeg-7b3c1382bf46615e3faea72b62b6dab83e4142a7.tar.gz
100l (forgoten seeking functions)
Originally committed as revision 3585 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/avformat.h2
-rw-r--r--libavformat/avidec.c2
-rw-r--r--libavformat/ffm.c4
-rw-r--r--libavformat/mov.c2
-rw-r--r--libavformat/raw.c9
-rw-r--r--libavformat/rtsp.c2
-rw-r--r--libavformat/wav.c4
7 files changed, 14 insertions, 11 deletions
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 997756b539..239acf6e81 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -441,7 +441,7 @@ int ff_wav_init(void);
/* raw.c */
int pcm_read_seek(AVFormatContext *s,
- int stream_index, int64_t timestamp);
+ int stream_index, int64_t timestamp, int flags);
int raw_init(void);
/* mp3.c */
diff --git a/libavformat/avidec.c b/libavformat/avidec.c
index 156b255ec1..774d55f089 100644
--- a/libavformat/avidec.c
+++ b/libavformat/avidec.c
@@ -649,7 +649,7 @@ static int locate_frame_in_index(AVIIndexEntry *entries,
return m;
}
-static int avi_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp)
+static int avi_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags)
{
AVIContext *avi = s->priv_data;
AVStream *st;
diff --git a/libavformat/ffm.c b/libavformat/ffm.c
index ce18d5fe9a..2867d11e0f 100644
--- a/libavformat/ffm.c
+++ b/libavformat/ffm.c
@@ -627,7 +627,7 @@ static int64_t get_pts(AVFormatContext *s, offset_t pos)
/* seek to a given time in the file. The file read pointer is
positionned at or before pts. XXX: the following code is quite
approximative */
-static int ffm_seek(AVFormatContext *s, int64_t wanted_pts)
+static int ffm_seek(AVFormatContext *s, int stream_index, int64_t wanted_pts, int flags)
{
FFMContext *ffm = s->priv_data;
offset_t pos_min, pos_max, pos;
@@ -662,7 +662,7 @@ static int ffm_seek(AVFormatContext *s, int64_t wanted_pts)
pos_min = pos + FFM_PACKET_SIZE;
}
}
- pos = pos_min;
+ pos = (flags & AVSEEK_FLAG_BACKWARD) ? pos_min : pos_max;
if (pos > 0)
pos -= FFM_PACKET_SIZE;
found:
diff --git a/libavformat/mov.c b/libavformat/mov.c
index e82e2f109c..b0f4b8bf6b 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -1846,7 +1846,7 @@ readchunk:
/**
* Seek method based on the one described in the Appendix C of QTFileFormat.pdf
*/
-static int mov_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp)
+static int mov_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags)
{
MOVContext* mov = (MOVContext *) s->priv_data;
MOVStreamContext* sc;
diff --git a/libavformat/raw.c b/libavformat/raw.c
index dadc495766..23ba5006be 100644
--- a/libavformat/raw.c
+++ b/libavformat/raw.c
@@ -126,7 +126,7 @@ static int raw_read_close(AVFormatContext *s)
}
int pcm_read_seek(AVFormatContext *s,
- int stream_index, int64_t timestamp)
+ int stream_index, int64_t timestamp, int flags)
{
AVStream *st;
int block_align, byte_rate;
@@ -158,8 +158,11 @@ int pcm_read_seek(AVFormatContext *s,
return -1;
/* compute the position by aligning it to block_align */
- pos = av_rescale(timestamp * byte_rate, st->time_base.num, st->time_base.den);
- pos = (pos / block_align) * block_align;
+ pos = av_rescale_rnd(timestamp * byte_rate,
+ st->time_base.num,
+ st->time_base.den * (int64_t)block_align,
+ (flags & AVSEEK_FLAG_BACKWARD) ? AV_ROUND_DOWN : AV_ROUND_UP);
+ pos *= block_align;
/* recompute exact position */
st->cur_dts = av_rescale(pos, st->time_base.den, byte_rate * (int64_t)st->time_base.num);
diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index 6037f9035e..af898ba217 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -1111,7 +1111,7 @@ static int rtsp_read_pause(AVFormatContext *s)
}
static int rtsp_read_seek(AVFormatContext *s, int stream_index,
- int64_t timestamp)
+ int64_t timestamp, int flags)
{
RTSPState *rt = s->priv_data;
diff --git a/libavformat/wav.c b/libavformat/wav.c
index 841e153ceb..0bc3c3408b 100644
--- a/libavformat/wav.c
+++ b/libavformat/wav.c
@@ -344,7 +344,7 @@ static int wav_read_close(AVFormatContext *s)
}
static int wav_read_seek(AVFormatContext *s,
- int stream_index, int64_t timestamp)
+ int stream_index, int64_t timestamp, int flags)
{
AVStream *st;
@@ -359,7 +359,7 @@ static int wav_read_seek(AVFormatContext *s,
default:
break;
}
- return pcm_read_seek(s, stream_index, timestamp);
+ return pcm_read_seek(s, stream_index, timestamp, flags);
}