[PD-dev] [ pure-data-Patches-1312885 ] 2GB limit for soundfiles

SourceForge.net noreply at sourceforge.net
Tue Oct 4 18:48:18 CEST 2005


Patches item #1312885, was opened at 2005-10-04 15:30
Message generated for change (Comment added) made by zmoelnig
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=478072&aid=1312885&group_id=55736

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: puredata
Group: bugfix
Status: Open
Resolution: None
Priority: 8
Submitted By: IOhannes m zmölnig (zmoelnig)
Assigned to: Miller Puckette (millerpuckette)
Summary: 2GB limit for soundfiles

Initial Comment:
using [readsf~] and [writesf~] you cannot read/write
files that are larger than 2GB;
while this limit seems big for soundfiles, it is easily
reached when doing multi-channel recordings (24
channels @ 44.1kHz take ~15 minutes to reach this limit)

to enable support for large files (>2GB), one has to
use 64bit variants of open and friends (open64(),...)

attached is a patch that enables the use of these
variants in d_soundfile.c when "_LARGEFILE64_SOURCE" is
defined.
the patch also changes the configure.in in order to
check whether defining "_LARGEFILE64_SOURCE" is a good
idea;
you can turn off largefile support via the
"--disable-largefile" option.

(btw, max/msp cannot write soundfiles > 2GB too)

----------------------------------------------------------------------

>Comment By: IOhannes m zmölnig (zmoelnig)
Date: 2005-10-04 18:48

Message:
Logged In: YES 
user_id=564396

probably a bit more explanation:
"_LARGEFILE64_SOURCE" is a special define that enables large
files support when including fcntl.h, unistd.h,...

the conditional defines found in d_soundfiler.h are just
there to use the new functions (like "open64") instead of
the normal ones (like "open")

independently from my solution i found the following in
http://www.cwp.mines.edu/pipermail/seisunix/2005/001082.html

<snip>
#ifdef _LARGEFILE64_SOURCE /* if the largefile source flag
is set */
# define open  open64
# define creat creat64
# define lseek lseek64
# undef off_t
# ifndef _GNU_SOURCE
#  define off_t long long
# else
#  define off_t off64_t
# endif
# define fstat fstat64
# define stat  stat64
# undef fseeko
# define fseeko fseeko64
# undef ftello
# define ftello ftello64
# define fopen  fopen64
# define freopen freopen64
#endif
</snip>

another possibility would be to use the "__REDIRECT" define,
so fcntl.h would do the defines itself, but i am a bit
afraid of this.


and another question is, whether it would be a good idea, to
have these defines in "m_pd.h", so all files using that
would automatically have large-file support....

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=478072&aid=1312885&group_id=55736




More information about the Pd-dev mailing list