From ec606b36b419dffbe059ac90a2fe96b5381c8331 Mon Sep 17 00:00:00 2001
From: Luca Barbato <lu_zero@gentoo.org>
Date: Wed, 10 Jun 2009 15:08:02 +0000
Subject: [PATCH] Support seeking as defined by the rfc

a PLAY with Range alone while in PLAY status should be interpreted
as an enqueue
a PAUSE followed by a PLAY with Range is the proper way to ask to
seek to a point.

See rfc2326

Originally committed as revision 19143 to svn://svn.ffmpeg.org/ffmpeg/trunk
---
 libavformat/rtsp.c | 3 +++
 libavformat/rtsp.h | 1 +
 2 files changed, 4 insertions(+)

diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index 1e9f2877dff..4cbfd7e49a3 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -1599,6 +1599,9 @@ static int rtsp_read_seek(AVFormatContext *s, int stream_index,
     case RTSP_STATE_IDLE:
         break;
     case RTSP_STATE_PLAYING:
+        if (rtsp_read_pause(s) != 0)
+            return -1;
+        rt->state = RTSP_STATE_SEEKING;
         if (rtsp_read_play(s) != 0)
             return -1;
         break;
diff --git a/libavformat/rtsp.h b/libavformat/rtsp.h
index 900eae525bb..8824ede26c3 100644
--- a/libavformat/rtsp.h
+++ b/libavformat/rtsp.h
@@ -151,6 +151,7 @@ enum RTSPClientState {
     RTSP_STATE_IDLE,    /**< not initialized */
     RTSP_STATE_PLAYING, /**< initialized and receiving data */
     RTSP_STATE_PAUSED,  /**< initialized, but not receiving data */
+    RTSP_STATE_SEEKING, /**< initialized, requesting a seek */
 };
 
 /**
-- 
GitLab