Okay...

I opened the can of worms and identified four bugs in three different
files (did I mention that OOP sucks?) that caused the video decoding
procedure to abort prematurely: An off-by-one error (as suspected) in
the calculation of the number of pictures, a bad loop termination
condition (also off by one) in the decoder, a "brown paper bag" bug that
caused the input buffer to return totally wrong data near the end of the
file, and a call to ffmpeg's avcodec_decode_video() that ignores the
required (and bloody stupid) calling conventions of that function: It
wants an oversized input buffer.

All except the last bug are fixed by patch #7 below (also available on
http://www.mr511.de/dvbcut). That is, the final picture will still be
missing. Since it's not possible yet to move the slider past the final
picture, you'll lose it anyway.

-- 
Michael "Tired" Riepe <[EMAIL PROTECTED]>
X-Tired: Each morning I get up I die a little
Index: dvbcut/src/buffer.cpp
===================================================================
RCS file: /var/cvs/sys/qt3/dvbcut/src/buffer.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- dvbcut/src/buffer.cpp       23 Jun 2006 12:13:30 -0000      1.4
+++ dvbcut/src/buffer.cpp       24 Aug 2006 23:46:48 -0000      1.5
@@ -299,6 +299,7 @@
         pos+=pagesize;
         if (pos<0)
           pos=0;
+        readpos=position-pos;
         }
       writepos=filesize-pos;
 
Index: dvbcut/src/index.cpp
===================================================================
RCS file: /var/cvs/sys/qt3/dvbcut/src/index.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- dvbcut/src/index.cpp        29 Jul 2006 17:52:27 -0000      1.2
+++ dvbcut/src/index.cpp        24 Aug 2006 23:57:04 -0000      1.3
@@ -429,7 +429,7 @@
         ++skipfirst;
     }
 
-  realpictures=pictures-skipfirst-1;
+  realpictures=pictures-skipfirst;
   if (realpictures<1)
     return 0;
 
Index: dvbcut/src/mpgfile.cpp
===================================================================
RCS file: /var/cvs/sys/qt3/dvbcut/src/mpgfile.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- dvbcut/src/mpgfile.cpp      6 Aug 2006 00:09:20 -0000       1.5
+++ dvbcut/src/mpgfile.cpp      24 Aug 2006 23:57:20 -0000      1.6
@@ -123,9 +123,11 @@
   int last_cpn=-1;
   bool firstframe=true, firstsequence=true;
 
-  while (pic<stop && (streampic+1)<idx.getrealpictures()) {
-    filepos_t tp=idx[streampic+1].getpos();
-    while (sd->itemlist().empty() || sd->itemlist().back().fileposition<tp)
+  while (pic<stop && streampic<idx.getpictures()) {
+    filepos_t tp(getfilesize(),0);
+    if ((streampic+1)<idx.getpictures())
+      tp=idx[streampic+1].getpos();
+    while (sd->itemlist().empty() || s.fileposition<tp.fileposition())
       if (streamreader(s)<=0)
         break;
 
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
DVBCUT-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dvbcut-user

Reply via email to