From 4843c0947b8bd261fa40bfc96397bc61810719a9 Mon Sep 17 00:00:00 2001 From: LRN Date: Fri, 20 Mar 2009 14:17:19 +0100 Subject: [PATCH] win32: fix seeking in large files Fix Seeking in large files by using the 64-bit seek functions. Fixes #576019 --- gst/playback/gstqueue2.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/gst/playback/gstqueue2.c b/gst/playback/gstqueue2.c index d9550d0082..6c9c90067e 100644 --- a/gst/playback/gstqueue2.c +++ b/gst/playback/gstqueue2.c @@ -57,6 +57,14 @@ #include #include +#ifdef G_OS_WIN32 +#include /* lseek, open, close, read */ +#undef lseek +#define lseek _lseeki64 +#undef off_t +#define off_t guint64 +#endif + static const GstElementDetails gst_queue_details = GST_ELEMENT_DETAILS ("Queue", "Generic", "Simple data queue", @@ -827,7 +835,13 @@ gst_queue_write_buffer_to_file (GstQueue * queue, GstBuffer * buffer) guint8 *data; int ret; +#ifdef HAVE_FSEEKO + fseeko (queue->temp_file, (off_t) queue->writing_pos, SEEK_SET); +#elif defined (G_OS_UNIX) || defined (G_OS_WIN32) + lseek (fileno (queue->temp_file), (off_t) queue->writing_pos, SEEK_SET); +#else fseek (queue->temp_file, queue->writing_pos, SEEK_SET); +#endif data = GST_BUFFER_DATA (buffer); size = GST_BUFFER_SIZE (buffer); @@ -872,7 +886,7 @@ gst_queue_create_read (GstQueue * queue, guint64 offset, guint length, #ifdef HAVE_FSEEKO if (fseeko (queue->temp_file, (off_t) offset, SEEK_SET) != 0) goto seek_failed; -#elif defined (G_OS_UNIX) +#elif defined (G_OS_UNIX) || defined (G_OS_WIN32) if (lseek (fileno (queue->temp_file), (off_t) offset, SEEK_SET) == (off_t) - 1) goto seek_failed;