summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLRN <lrn1986 at gmail dot com>2009-03-20 14:20:16 +0100
committerWim Taymans <wim.taymans@collabora.co.uk>2009-03-23 17:07:16 +0100
commitdf124a0b28c5c76731cd6ed47b5a284a41366d9d (patch)
tree18d15c9f2bab48608e168654c80301439417fae0
parent13bc8b8c03d3a8291ef75c0c89b16079e084c174 (diff)
downloadgstreamer-plugins-bad-df124a0b28c5c76731cd6ed47b5a284a41366d9d.tar.gz
win32: fix seeking in large files
Use _lseeki64() on Windows to seek in large files. Fixes #576021.
-rw-r--r--gst/qtmux/gstqtmux.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/gst/qtmux/gstqtmux.c b/gst/qtmux/gstqtmux.c
index c3ac67fbf..430e979fa 100644
--- a/gst/qtmux/gstqtmux.c
+++ b/gst/qtmux/gstqtmux.c
@@ -75,6 +75,14 @@
#include <gst/gst.h>
#include <gst/base/gstcollectpads.h>
+#ifdef G_OS_WIN32
+#include <io.h> /* lseek, open, close, read */
+#undef lseek
+#define lseek _lseeki64
+#undef off_t
+#define off_t guint64
+#endif
+
#include "gstqtmux.h"
GST_DEBUG_CATEGORY_STATIC (gst_qt_mux_debug);
@@ -603,8 +611,17 @@ gst_qt_mux_send_buffered_data (GstQTMux * qtmux, guint64 * offset)
if (fflush (qtmux->fast_start_file))
goto flush_failed;
- if (fseek (qtmux->fast_start_file, 0, SEEK_SET))
+#ifdef HAVE_FSEEKO
+ if (fseeko (qtmux->fast_start_file, (off_t) 0, SEEK_SET) != 0)
+ goto seek_failed;
+#elif defined (G_OS_UNIX) || defined (G_OS_WIN32)
+ if (lseek (fileno (qtmux->fast_start_file), (off_t) 0,
+ SEEK_SET) == (off_t) - 1)
goto seek_failed;
+#else
+ if (fseek (qtmux->fast_start_file, (long) 0, SEEK_SET) != 0)
+ goto seek_failed;
+#endif
/* hm, this could all take a really really long time,
* but there may not be another way to get moov atom first