aboutsummaryrefslogtreecommitdiffstats
path: root/ffplay.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2007-01-23 14:22:25 +0000
committerMichael Niedermayer <michaelni@gmx.at>2007-01-23 14:22:25 +0000
commit8e606cc88caee3398c20a65a7b613d8618758e6d (patch)
tree4c9243abad6e6f3ea55c467c495c9beb561cd184 /ffplay.c
parenta8062103ddcba7d865e7f572d561fc9ffb2dd113 (diff)
downloadffmpeg-8e606cc88caee3398c20a65a7b613d8618758e6d.tar.gz
seek based on currently active stream fixes seeking in ffwma2_broken.wma which had some "empty" streams
Originally committed as revision 7666 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'ffplay.c')
-rw-r--r--ffplay.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/ffplay.c b/ffplay.c
index af1de41336..02f81320a8 100644
--- a/ffplay.c
+++ b/ffplay.c
@@ -1959,7 +1959,18 @@ static int decode_thread(void *arg)
}
#endif
if (is->seek_req) {
- ret = av_seek_frame(is->ic, -1, is->seek_pos, is->seek_flags);
+ int stream_index= -1;
+ int64_t seek_target= is->seek_pos;
+
+ if (is-> video_stream >= 0) stream_index= is-> video_stream;
+ else if(is-> audio_stream >= 0) stream_index= is-> audio_stream;
+ else if(is->subtitle_stream >= 0) stream_index= is->subtitle_stream;
+
+ if(stream_index>=0){
+ seek_target= av_rescale_q(seek_target, AV_TIME_BASE_Q, ic->streams[stream_index]->time_base);
+ }
+
+ ret = av_seek_frame(is->ic, stream_index, seek_target, is->seek_flags);
if (ret < 0) {
fprintf(stderr, "%s: error while seeking\n", is->ic->filename);
}else{