From 559fd1e79524ca47efde195e28feb4499dd48761 Mon Sep 17 00:00:00 2001
From: Clemens Ladisch <cladisch@fastmail.net>
Date: Sun, 18 Mar 2007 23:59:56 +0000
Subject: [PATCH] fix end-of-file detection At the end of a nut file, the check
 for url_feof() fails because the eof flag was cleared by the url_fseek() call
 that was used to skip over the index packet.    This patch fixes this patch
 by: Clemens Ladisch % cladisch A fastmail P net % Original thread: Date: Feb
 27, 2007 6:13 PM Subject: [Ffmpeg-devel] [PATCH] nutdec: fix end-of-file
 detection

Originally committed as revision 8447 to svn://svn.ffmpeg.org/ffmpeg/trunk
---
 libavformat/nutdec.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c
index ec1c04e0f92..c0f331c27c5 100644
--- a/libavformat/nutdec.c
+++ b/libavformat/nutdec.c
@@ -737,13 +737,12 @@ static int nut_read_packet(AVFormatContext *s, AVPacket *pkt)
         uint64_t tmp= nut->next_startcode;
         nut->next_startcode=0;
 
-        if (url_feof(bc))
-            return -1;
-
         if(tmp){
             pos-=8;
         }else{
             frame_code = get_byte(bc);
+            if(url_feof(bc))
+                return -1;
             if(frame_code == 'N'){
                 tmp= frame_code;
                 for(i=1; i<8; i++)
-- 
GitLab