After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 547277 - filesrc detect if a file is seekable using SEEK_SET and not SEEK_END
filesrc detect if a file is seekable using SEEK_SET and not SEEK_END
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
git master
Other Linux
: Normal normal
: 0.10.21
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2008-08-11 11:59 UTC by Alessandro Decina
Modified: 2008-08-19 17:25 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Change lseek to work under windows (722 bytes, patch)
2008-08-11 11:59 UTC, Alessandro Decina
none Details | Review
Add large file support (1.04 KB, patch)
2008-08-11 17:18 UTC, Alessandro Decina
reviewed Details | Review

Description Alessandro Decina 2008-08-11 11:59:00 UTC
Under windows playing a matroska file of 4695522630 bytes fails as filesrc thinks that the file is not seekable.
Filesrc uses this code to determine if a file is seekable:

    off_t res = lseek (src->fd, 0, SEEK_END);

    if (res < 0) {
      GST_LOG_OBJECT (src, "disabling seeking, not in mmap mode and lseek "
          "failed: %s", g_strerror (errno));
      src->seekable = FALSE;
    } else {
      src->seekable = TRUE;
    }

In windows with such matroska file lseek fails with Invalid argument.
Changing the lseek call to lseek (src->fd, stat_results.st_size, SEEK_SET)
works.
Comment 1 Alessandro Decina 2008-08-11 11:59:30 UTC
Created attachment 116337 [details] [review]
Change lseek to work under windows
Comment 2 Alessandro Decina 2008-08-11 17:18:13 UTC
Created attachment 116368 [details] [review]
Add large file support
Comment 3 Alessandro Decina 2008-08-11 17:21:37 UTC
Ok it seems it was a more general issue. Under linux, glibc uses lseek64 lstat64 etc automatically if the kernel supports large files. In windows the 64 bit variants have to be used explicitly.
With the patch applied, I can play and seek in a matroska file big 4695522630 bytes. With only the first (broken) patch I couldn't seek as lseek was failing.
Comment 4 Michael Smith 2008-08-11 17:50:54 UTC
Code looks fine.

Before committing, please add a comment explaining that this is because these functions default to 32-bit-only on windows, and perhaps something explaining what #undef _INC_STAT_INL
is all about - I have no idea what that's for.

Comment 5 Alessandro Decina 2008-08-19 17:08:05 UTC
the #undef _INC_STAT_INL is so that stat.h doesn't alias stat*() to _stat*()
and so I don't have to #undef stat*() one by one.

Comment 6 Michael Smith 2008-08-19 17:25:18 UTC
2008-08-19  Michael Smith <msmith@songbirdnest.com>

    Patch by: Alessandro Decina <alessandro@nnva.org>
    * plugins/elements/gstfilesrc.c:
      Use 64 bit variants of stat functions on win32, to enable support
      of large files there.
      Fixes #547277.