Fix for long ogg audio with lowbitrate and for mov seeking

git-svn-id: svn+ssh://74.125.59.83/svnsource/ffmpeg/trunk@80 c0683bf1-fb26-4375-bba1-98ccd3d3b0d1
diff --git a/libavformat/mov.c b/libavformat/mov.c
index a2fdc2c..4b2da2f 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -2440,9 +2440,10 @@
     sc->index_chunk=0;
     sc->index_chunk_sample=0;
 #ifdef DEBUG8622
-    av_log(NULL, AV_LOG_ERROR, "finding chunk for sample %d\n",sample);
+    av_log(NULL, AV_LOG_ERROR, "finding chunk for sample %d (%d %d %d)\n",sample, sc->current_sample,
+        sc->index_stsc_index, sc->stsc_data[sc->index_stsc_index].count);
 #endif
-    while(sc->current_sample >= sc->stsc_data[sc->index_stsc_index].count)
+    while(sc->current_sample && sc->current_sample >= sc->stsc_data[sc->index_stsc_index].count)
     {
         sc->index_chunk+=1;
         sc->current_sample-=sc->stsc_data[sc->index_stsc_index].count;
diff --git a/libavformat/oggdec.c b/libavformat/oggdec.c
index a418bd2..9565bf9 100755
--- a/libavformat/oggdec.c
+++ b/libavformat/oggdec.c
@@ -276,6 +276,8 @@
         }
     }else{
         os->psize = 0;
+        os->pstart = 0;
+        os->bufpos = 0;
     }
 
     if (os->bufsize - os->bufpos < size){