Re: mjpegtools 1.9rc1
Mark Nauwelaerts <[email protected]>
| Newsgroups | gmane.comp.video.mjpeg.devel |
|---|---|
| Message-ID | <[email protected]> |
Steven M. Schultz wrote: > On Sat, 17 Feb 2007, Mark Nauwelaerts wrote: > >> * there is also a problem building against this release as a library; >> as it does not install 2 header files (mpeg2enc/mpeg2syntaxcodes.h and > > Guess not too many folks have had a need to do this. I know Andrew > put a lot of work into the the librarification of mpeg2enc but then > over the years only a couple people have done anything with it. > Also in this (library) context, I spent some time investigating some segfaults I got when working on (GStreamer) mplex plugin. I eventually found the cause by realizing that the ABI used for mplex is a bit fuzzy; that is, Multiplexor has an off_t field, the size of which depends on whether or not (or how) _FILE_OFFSET_BITS is defined. There is no (direct) way to know which setting was in use for the library that is being linked to, other than (indirectly) assuming that it was the result obtained by AC_SYS_LARGEFILE macro. So, as a possible remedy, I am including a patch to replace (the not so many) uses of off_t in mplex by uint64_t, for reasons: - ABI stability; there can be no confusion between library and those using it, and does not depend on some "(external) setting/define" to get them aligned - off_t variable(s) are actually only used for max_segment_size (user setting), which is basically being handed around a few places. In particular, it never gets into contact with any seek'ish system call, where off_t is at home (there is no seek in either mplex lib part or the mplex main.cpp wrapper) - presently, PS_Stream::SegmentLimReached() contains off_t written = output_strm.SegmentSize(); but the latter returns uint64_t, so it seems already silently/implictly assumed/hoped that off_t can handle uint64_t Mark ------------------------------------------------------------------------- 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 _______________________________________________ Mjpeg-developer mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mjpeg-developer
mplex-type.patch
(text/x-patch, 3 KB)
Index: mplex/multiplexor.cpp
===================================================================
RCS file: /cvsroot/mjpeg/mjpeg_play/mplex/multiplexor.cpp,v
retrieving revision 1.39
diff -u -r1.39 multiplexor.cpp
--- mplex/multiplexor.cpp 20 Feb 2007 02:14:58 -0000 1.39
+++ mplex/multiplexor.cpp 26 Feb 2007 15:39:18 -0000
@@ -82,8 +82,8 @@
split_at_seq_end = !job.multifile_segment;
workarounds = job.workarounds;
run_in_frames = job.run_in_frames;
- max_segment_size = static_cast<off_t>(job.max_segment_size)
- * static_cast<off_t>(1024 * 1024);
+ max_segment_size = static_cast<uint64_t>(job.max_segment_size)
+ * static_cast<uint64_t>(1024 * 1024);
max_PTS = static_cast<clockticks>(job.max_PTS) * CLOCKS;
video_delay = static_cast<clockticks>(job.video_offset);
audio_delay = static_cast<clockticks>(job.audio_offset);
Index: mplex/multiplexor.hpp
===================================================================
RCS file: /cvsroot/mjpeg/mjpeg_play/mplex/multiplexor.hpp,v
retrieving revision 1.8
diff -u -r1.8 multiplexor.hpp
--- mplex/multiplexor.hpp 15 Jan 2006 14:19:24 -0000 1.8
+++ mplex/multiplexor.hpp 26 Feb 2007 15:39:18 -0000
@@ -66,7 +66,7 @@
int data_rate;
unsigned int run_in_frames;
int mux_format;
- off_t max_segment_size;
+ uint64_t max_segment_size;
Workarounds workarounds;
Index: mplex/systems.cpp
===================================================================
RCS file: /cvsroot/mjpeg/mjpeg_play/mplex/systems.cpp,v
retrieving revision 1.12
diff -u -r1.12 systems.cpp
--- mplex/systems.cpp 20 Feb 2007 02:14:58 -0000 1.12
+++ mplex/systems.cpp 26 Feb 2007 15:39:18 -0000
@@ -33,7 +33,7 @@
PS_Stream:: PS_Stream( unsigned _mpeg,
unsigned int _sector_size,
OutputStream &_output_strm,
- off_t max_seg_size )
+ uint64_t max_seg_size )
: output_strm(_output_strm ),
mpeg_version( _mpeg),
sector_size( _sector_size ),
@@ -52,7 +52,7 @@
bool
PS_Stream::SegmentLimReached()
{
- off_t written = output_strm.SegmentSize();
+ uint64_t written = output_strm.SegmentSize();
return max_segment_size != 0 && written > max_segment_size;
}
Index: mplex/systems.hpp
===================================================================
RCS file: /cvsroot/mjpeg/mjpeg_play/mplex/systems.hpp,v
retrieving revision 1.9
diff -u -r1.9 systems.hpp
--- mplex/systems.hpp 7 Nov 2005 01:17:40 -0000 1.9
+++ mplex/systems.hpp 26 Feb 2007 15:39:18 -0000
@@ -62,7 +62,7 @@
PS_Stream( unsigned _mpeg,
unsigned int _sector_size,
OutputStream &_output_strm,
- off_t max_segment_size // 0 = No Limit
+ uint64_t max_segment_size // 0 = No Limit
);
virtual ~PS_Stream();
@@ -143,7 +143,7 @@
OutputStream &output_strm;
unsigned int mpeg_version;
unsigned int sector_size;
- off_t max_segment_size;
+ uint64_t max_segment_size;
uint8_t *sector_buf;
bitcount_t last_pack_start;
};