Hi!
James Cameron wrote:
> An export to a full filesystem appears to succeed, but the resulting
> files are empty.
>
> This is caused by no return status checking on the mpegmuxer::flush
> calls to write(), at lines 300 and 365.
Yep, that's a bug. Please try the attached patch.
--
Michael "Tired" Riepe <[EMAIL PROTECTED]>
X-Tired: Each morning I get up I die a little
Index: src/mpegmuxer.h
===================================================================
--- src/mpegmuxer.h (revision 131)
+++ src/mpegmuxer.h (working copy)
@@ -196,6 +196,8 @@
{
return maxscr<p.maxscr;
}
+
+ bool write(int fd);
};
class stream
Index: src/mpegmuxer.cpp
===================================================================
--- src/mpegmuxer.cpp (revision 131)
+++ src/mpegmuxer.cpp (working copy)
@@ -297,7 +297,7 @@
pack p(packsize,0,muxrate,0);
scr+=13500000;
p.setscr(scr);
- ::write(fd,p.getdata(),p.getsize());
+ if (!p.write(fd)) return false;
}
scr=minscr;
@@ -362,7 +362,7 @@
ptsstring(scr2pts(p->getmaxscr())).c_str(),
ptsstring(p->getdts()).c_str(),
s->getbuffree() );
- ::write(fd,p->getdata(),p->getsize());
+ if (!p->write(fd)) return false;
if (p->getaupayloadlen()>0) {
s->fill(p->getaupayloadlen());
}
@@ -737,3 +737,25 @@
d[4]=((scrb32<<3)&0xf8)|0x04|((scrx>>7)&0x03);
d[5]=scrx<<1|0x01;
}
+
+bool
+mpegmuxer::pack::write(int fd) {
+ uint8_t *d = (uint8_t*)data;
+ size_t len = size;
+ ssize_t n = 0;
+
+ while (len > 0 && (n = ::write(fd, d, len)) > 0) {
+ len -= n;
+ d += n;
+ }
+ if (len == 0) {
+ return true;
+ }
+ if (n == 0) {
+ fprintf(stderr, "zero-length write - disk full?\n");
+ }
+ else {
+ perror("write");
+ }
+ return false;
+}
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
DVBCUT-devel mailing list
DVBCUT-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dvbcut-devel