in mpgfile.cpp
I've discovered that AV_NOPTS_VALUE can occur at least once without causing any
harm,
and will do routinely in files created by dvbcut using DVD (DVBCUT multiplexer)
I've added a 'safety counter' so that abort from the loop happens only when a
limit number of AV_NOPTS_VALUE occurs. (I've set the limit at 100 but it might
be ok at 1)
This appears to restore the function of '|<-' and '->|' while preventing the
loop near EOF.
Since I don't understand the details, this is definitely a kludge rather than a
fix: but it does offer some protection.
Use at your own risk!
Patch follows
Brian
-------------------------------
RCS file: RCS/mpgfile.cpp,v
retrieving revision 1.2
retrieving revision 1.5
diff -u -r1.2 -r1.5
--- mpgfile.cpp 2006/07/21 07:17:44 1.2
+++ mpgfile.cpp 2006/07/21 11:02:31 1.5
@@ -271,6 +271,8 @@
sd->pop();
}
+ const int nopts_limit= 100; // probably excessive. Might be ok =1
+ int nopts_counter= 0 ;
for(;;) {
if (sh.fileposition<stopreadpos && streamreader(sh)<=0)
return; // data does not reach the point in time from which we like to
start playing
@@ -287,7 +289,26 @@
break;
}
if (pts==(pts_t)AV_NOPTS_VALUE)
- continue;
+ {
+ // fix to avoid endless loop when trying to play a segment
+ // close to the end of the file.
+ // TODO: play whatever small section might exist
+ // instead of aborting completely?
+
+ nopts_counter++;
+ //
+ // A small number of occurrences (possibly only 1? ) of
AV_NOPTS_VALUE
+ // is permitted. Any more than this limit => there is no audio/we
cant play it.
+ //
+ if (nopts_counter < nopts_limit) continue;
+
+ fprintf(stderr, "cant play this segment (AV_NOPTS_VALUE)\n");
+ return;
+ }
+ else
+ {
+ nopts_counter= 0; // reset the NO_OPTS_VALUE counter
+ }
if (pts<=startpts)
sd->pop(pop);
if (pts>=startpts)
--
_______________________________________________
Surf the Web in a faster, safer and easier way:
Download Opera 9 at http://www.opera.com
Powered by Outblaze
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
DVBCUT-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dvbcut-user