~ubuntu-dev/mplayer/ubuntu-feisty

« back to all changes in this revision

Viewing changes to libavformat/file.c

  • Committer: William Grant
  • Date: 2007-02-03 03:16:07 UTC
  • mto: This revision was merged to the branch mainline in revision 16.
  • Revision ID: william.grant@ubuntu.org.au-20070203031607-08gc2ompbz6spt9i
Update to 1.0rc1.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 * Buffered file io for ffmpeg system
3
3
 * Copyright (c) 2001 Fabrice Bellard
4
4
 *
5
 
 * This library is free software; you can redistribute it and/or
 
5
 * This file is part of FFmpeg.
 
6
 *
 
7
 * FFmpeg is free software; you can redistribute it and/or
6
8
 * modify it under the terms of the GNU Lesser General Public
7
9
 * License as published by the Free Software Foundation; either
8
 
 * version 2 of the License, or (at your option) any later version.
 
10
 * version 2.1 of the License, or (at your option) any later version.
9
11
 *
10
 
 * This library is distributed in the hope that it will be useful,
 
12
 * FFmpeg is distributed in the hope that it will be useful,
11
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13
15
 * Lesser General Public License for more details.
14
16
 *
15
17
 * You should have received a copy of the GNU Lesser General Public
16
 
 * License along with this library; if not, write to the Free Software
 
18
 * License along with FFmpeg; if not, write to the Free Software
17
19
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
20
 */
19
21
#include "avformat.h"
20
22
#include <fcntl.h>
21
 
#ifndef CONFIG_WIN32
 
23
#ifndef __MINGW32__
22
24
#include <unistd.h>
23
25
#include <sys/ioctl.h>
24
26
#include <sys/time.h>
25
27
#else
26
28
#include <io.h>
27
29
#define open(fname,oflag,pmode) _open(fname,oflag,pmode)
28
 
#endif /* CONFIG_WIN32 */
 
30
#endif /* __MINGW32__ */
29
31
 
30
32
 
31
33
/* standard file protocol */
44
46
    } else {
45
47
        access = O_RDONLY;
46
48
    }
47
 
#if defined(CONFIG_WIN32) || defined(CONFIG_OS2) || defined(__CYGWIN__)
 
49
#if defined(__MINGW32__) || defined(CONFIG_OS2) || defined(__CYGWIN__)
48
50
    access |= O_BINARY;
49
51
#endif
50
52
    fd = open(filename, access, 0666);
70
72
static offset_t file_seek(URLContext *h, offset_t pos, int whence)
71
73
{
72
74
    int fd = (size_t)h->priv_data;
73
 
#if defined(CONFIG_WIN32) && !defined(__CYGWIN__)
 
75
#if defined(__MINGW32__)
74
76
    return _lseeki64(fd, pos, whence);
75
77
#else
76
78
    return lseek(fd, pos, whence);
103
105
    } else {
104
106
        fd = 0;
105
107
    }
106
 
#if defined(CONFIG_WIN32) || defined(CONFIG_OS2) || defined(__CYGWIN__)
 
108
#if defined(__MINGW32__) || defined(CONFIG_OS2) || defined(__CYGWIN__)
107
109
    setmode(fd, O_BINARY);
108
110
#endif
109
111
    h->priv_data = (void *)(size_t)fd;