[vlc-devel] commit: access_http: do not close the stream when seeking out of range ( Bill C Riemers )

git version control git at videolan.org
Tue Jun 17 19:00:27 CEST 2008


vlc | branch: master | Bill C Riemers <docbill at hartnell.local> | Mon Jun 16 11:46:47 2008 -0400| [ef17f9a4277e587c586307550029e3a912fdcf95]

access_http: do not close the stream when seeking out of range

+ minor simplifications

Signed-off-by: Rémi Denis-Courmont <rdenis at simphalempin.com>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ef17f9a4277e587c586307550029e3a912fdcf95
---

 modules/access/http.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/modules/access/http.c b/modules/access/http.c
index 2b7768a..f7a2995 100644
--- a/modules/access/http.c
+++ b/modules/access/http.c
@@ -881,6 +881,17 @@ static int Seek( access_t *p_access, int64_t i_pos )
 
     Disconnect( p_access );
 
+    if( p_access->info.i_size
+     && (uint64_t)i_pos >= (uint64_t)p_access->info.i_size ) {
+        msg_Err( p_access, "seek to far" );
+        int retval = Seek( p_access, p_access->info.i_size - 1 );
+        if( retval == VLC_SUCCESS ) {
+            uint8_t p_buffer[2];
+            Read( p_access, p_buffer, 1);
+            p_access->info.b_eof  = false;
+        }
+        return retval;
+    }
     if( Connect( p_access, i_pos ) )
     {
         msg_Err( p_access, "seek failed" );




More information about the vlc-devel mailing list