2002-08-04 19:23:44 +02:00
|
|
|
/*****************************************************************************
|
|
|
|
* file.c: file input (file: access plug-in)
|
|
|
|
*****************************************************************************
|
2006-04-29 15:55:07 +02:00
|
|
|
* Copyright (C) 2001-2006 the VideoLAN team
|
2007-11-26 21:27:15 +01:00
|
|
|
* Copyright © 2006-2007 Rémi Denis-Courmont
|
2004-03-10 18:10:40 +01:00
|
|
|
* $Id$
|
2002-08-04 19:23:44 +02:00
|
|
|
*
|
|
|
|
* Authors: Christophe Massiot <massiot@via.ecp.fr>
|
2006-04-29 15:55:07 +02:00
|
|
|
* Rémi Denis-Courmont <rem # videolan # org>
|
2002-08-04 19:23:44 +02:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
2004-06-03 02:08:54 +02:00
|
|
|
*
|
2002-08-04 19:23:44 +02:00
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
2006-01-13 00:10:04 +01:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
|
2002-08-04 19:23:44 +02:00
|
|
|
*****************************************************************************/
|
|
|
|
|
2008-01-23 22:50:58 +01:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "config.h"
|
|
|
|
#endif
|
|
|
|
|
2008-05-31 20:49:57 +02:00
|
|
|
#include <vlc_common.h>
|
2010-01-16 11:56:44 +01:00
|
|
|
#include "fs.h"
|
2006-11-26 15:20:34 +01:00
|
|
|
#include <vlc_input.h>
|
|
|
|
#include <vlc_access.h>
|
2009-03-05 20:09:21 +01:00
|
|
|
#include <vlc_dialog.h>
|
2002-08-04 19:23:44 +02:00
|
|
|
|
2007-11-26 21:27:15 +01:00
|
|
|
#include <assert.h>
|
2004-10-04 16:09:33 +02:00
|
|
|
#include <errno.h>
|
2010-01-16 13:13:50 +01:00
|
|
|
#include <sys/types.h>
|
2002-11-20 14:37:36 +01:00
|
|
|
#ifdef HAVE_SYS_STAT_H
|
|
|
|
# include <sys/stat.h>
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_FCNTL_H
|
|
|
|
# include <fcntl.h>
|
|
|
|
#endif
|
2010-06-20 18:56:44 +02:00
|
|
|
#ifdef HAVE_FSTATVFS
|
|
|
|
# include <sys/statvfs.h>
|
|
|
|
# if defined (HAVE_SYS_MOUNT_H)
|
|
|
|
# include <sys/param.h>
|
|
|
|
# include <sys/mount.h>
|
|
|
|
# endif
|
|
|
|
#endif
|
2009-08-31 16:01:47 +02:00
|
|
|
#ifdef HAVE_LINUX_MAGIC_H
|
2010-06-20 18:56:44 +02:00
|
|
|
# include <sys/vfs.h>
|
2009-06-25 19:30:57 +02:00
|
|
|
# include <linux/magic.h>
|
2009-08-31 16:01:47 +02:00
|
|
|
#endif
|
2002-11-20 14:37:36 +01:00
|
|
|
|
2008-10-06 12:40:19 +02:00
|
|
|
#if defined( WIN32 )
|
2006-04-29 16:23:00 +02:00
|
|
|
# include <io.h>
|
2008-03-19 17:46:53 +01:00
|
|
|
# include <ctype.h>
|
2009-07-23 17:08:44 +02:00
|
|
|
# include <shlwapi.h>
|
2006-04-29 16:23:00 +02:00
|
|
|
#else
|
2002-08-04 19:23:44 +02:00
|
|
|
# include <unistd.h>
|
|
|
|
#endif
|
2010-04-10 17:19:20 +02:00
|
|
|
#include <dirent.h>
|
2002-08-04 19:23:44 +02:00
|
|
|
|
2003-05-08 17:58:56 +02:00
|
|
|
#if defined( WIN32 ) && !defined( UNDER_CE )
|
2004-10-05 17:31:22 +02:00
|
|
|
# ifdef lseek
|
|
|
|
# undef lseek
|
|
|
|
# endif
|
|
|
|
# define lseek _lseeki64
|
|
|
|
#elif defined( UNDER_CE )
|
2008-10-06 12:40:19 +02:00
|
|
|
/* FIXME the commandline on wince is a mess */
|
2009-07-27 17:36:09 +02:00
|
|
|
# define PathIsNetworkPathW(wpath) (! wcsncmp(wpath, L"\\\\", 2))
|
2004-03-10 18:10:40 +01:00
|
|
|
#endif
|
|
|
|
|
2010-02-07 14:18:02 +01:00
|
|
|
#include <vlc_fs.h>
|
2010-01-16 17:34:31 +01:00
|
|
|
#include <vlc_url.h>
|
2005-08-03 21:01:44 +02:00
|
|
|
|
2004-06-03 02:08:54 +02:00
|
|
|
struct access_sys_t
|
2003-01-03 14:07:17 +01:00
|
|
|
{
|
2004-06-03 02:08:54 +02:00
|
|
|
unsigned int i_nb_reads;
|
2004-03-10 18:10:40 +01:00
|
|
|
|
2006-11-01 21:50:18 +01:00
|
|
|
int fd;
|
2004-03-10 18:10:40 +01:00
|
|
|
|
2004-06-03 02:08:54 +02:00
|
|
|
/* */
|
2009-07-20 18:37:17 +02:00
|
|
|
unsigned caching;
|
2008-04-14 00:08:29 +02:00
|
|
|
bool b_pace_control;
|
2004-06-03 02:08:54 +02:00
|
|
|
};
|
2003-01-03 14:07:17 +01:00
|
|
|
|
2009-09-02 10:58:03 +02:00
|
|
|
#ifndef WIN32
|
2009-06-25 19:30:57 +02:00
|
|
|
static bool IsRemote (int fd)
|
|
|
|
{
|
2010-06-20 18:56:44 +02:00
|
|
|
#if defined (HAVE_FSTATVFS) && defined (MNT_LOCAL)
|
|
|
|
struct statvfs stf;
|
|
|
|
|
|
|
|
if (fstatvfs (fd, &stf))
|
|
|
|
return false;
|
|
|
|
/* fstatvfs() is in POSIX, but MNT_LOCAL is not */
|
|
|
|
return !(s.f_flag & MNT_LOCAL);
|
|
|
|
|
|
|
|
#elif defined (HAVE_LINUX_MAGIC_H)
|
2009-06-25 19:30:57 +02:00
|
|
|
struct statfs stf;
|
|
|
|
|
|
|
|
if (fstatfs (fd, &stf))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
switch (stf.f_type)
|
|
|
|
{
|
|
|
|
case AFS_SUPER_MAGIC:
|
|
|
|
case CODA_SUPER_MAGIC:
|
|
|
|
case NCP_SUPER_MAGIC:
|
|
|
|
case NFS_SUPER_MAGIC:
|
|
|
|
case SMB_SUPER_MAGIC:
|
|
|
|
case 0xFF534D42 /*CIFS_MAGIC_NUMBER*/:
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
2010-06-20 18:56:44 +02:00
|
|
|
|
|
|
|
#else
|
2009-07-23 17:05:08 +02:00
|
|
|
(void)fd;
|
2009-06-25 19:30:57 +02:00
|
|
|
return false;
|
|
|
|
|
|
|
|
#endif
|
|
|
|
}
|
2009-09-02 10:58:03 +02:00
|
|
|
#endif
|
2009-06-25 19:30:57 +02:00
|
|
|
|
2009-07-23 22:20:12 +02:00
|
|
|
#ifndef HAVE_POSIX_FADVISE
|
2009-08-20 11:03:36 +02:00
|
|
|
# define posix_fadvise(fd, off, len, adv)
|
2009-07-23 22:20:12 +02:00
|
|
|
#endif
|
2009-06-25 19:30:57 +02:00
|
|
|
|
2002-08-04 19:23:44 +02:00
|
|
|
/*****************************************************************************
|
|
|
|
* Open: open the file
|
|
|
|
*****************************************************************************/
|
2010-01-16 11:56:44 +01:00
|
|
|
int Open( vlc_object_t *p_this )
|
2002-08-04 19:23:44 +02:00
|
|
|
{
|
2004-06-03 02:08:54 +02:00
|
|
|
access_t *p_access = (access_t*)p_this;
|
2010-05-10 22:15:55 +02:00
|
|
|
const char *path = p_access->psz_filepath;
|
2009-07-23 17:08:44 +02:00
|
|
|
#ifdef WIN32
|
|
|
|
bool is_remote = false;
|
|
|
|
#endif
|
2004-06-03 02:08:54 +02:00
|
|
|
|
2006-11-01 21:50:18 +01:00
|
|
|
/* Open file */
|
2009-02-05 16:52:52 +01:00
|
|
|
int fd = -1;
|
2009-02-21 10:55:14 +01:00
|
|
|
|
|
|
|
if (!strcasecmp (p_access->psz_access, "fd"))
|
2010-01-16 17:34:31 +01:00
|
|
|
{
|
|
|
|
char *end;
|
|
|
|
int oldfd = strtol (path, &end, 10);
|
|
|
|
|
|
|
|
if (*end == '\0')
|
2010-02-07 14:54:39 +01:00
|
|
|
fd = vlc_dup (oldfd);
|
2010-01-16 17:34:31 +01:00
|
|
|
else if (*end == '/' && end > path)
|
|
|
|
{
|
|
|
|
char *name = decode_URI_duplicate (end - 1);
|
2010-02-14 12:33:35 +01:00
|
|
|
if (name != NULL)
|
2010-01-16 17:34:31 +01:00
|
|
|
{
|
|
|
|
name[0] = '.';
|
2010-02-14 12:33:35 +01:00
|
|
|
fd = vlc_openat (oldfd, name, O_RDONLY | O_NONBLOCK);
|
2010-01-16 17:34:31 +01:00
|
|
|
free (name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2006-11-01 21:50:18 +01:00
|
|
|
else
|
2009-02-21 10:55:14 +01:00
|
|
|
{
|
2010-01-16 10:43:35 +01:00
|
|
|
msg_Dbg (p_access, "opening file `%s'", path);
|
2010-02-07 14:25:29 +01:00
|
|
|
fd = vlc_open (path, O_RDONLY | O_NONBLOCK);
|
2010-01-16 10:43:35 +01:00
|
|
|
if (fd == -1)
|
|
|
|
{
|
|
|
|
msg_Err (p_access, "cannot open file %s (%m)", path);
|
|
|
|
dialog_Fatal (p_access, _("File reading failed"),
|
|
|
|
_("VLC could not open the file \"%s\"."), path);
|
|
|
|
}
|
|
|
|
|
2009-07-23 17:08:44 +02:00
|
|
|
#ifdef WIN32
|
2010-01-16 10:43:35 +01:00
|
|
|
wchar_t wpath[MAX_PATH+1];
|
|
|
|
if (MultiByteToWideChar (CP_UTF8, 0, path, -1,
|
2009-07-23 17:08:44 +02:00
|
|
|
wpath, MAX_PATH)
|
|
|
|
&& PathIsNetworkPathW (wpath))
|
|
|
|
is_remote = true;
|
|
|
|
# define IsRemote( fd ) ((void)fd, is_remote)
|
|
|
|
#endif
|
2009-02-21 10:55:14 +01:00
|
|
|
}
|
2009-02-05 16:52:52 +01:00
|
|
|
if (fd == -1)
|
2010-01-16 12:13:46 +01:00
|
|
|
return VLC_EGENERIC;
|
2002-12-31 02:54:36 +01:00
|
|
|
|
2006-11-12 13:02:55 +01:00
|
|
|
struct stat st;
|
2009-02-05 16:52:52 +01:00
|
|
|
if (fstat (fd, &st))
|
2004-03-10 18:10:40 +01:00
|
|
|
{
|
2009-02-05 16:52:52 +01:00
|
|
|
msg_Err (p_access, "failed to read (%m)");
|
|
|
|
goto error;
|
2006-11-01 21:50:18 +01:00
|
|
|
}
|
2009-02-05 16:52:52 +01:00
|
|
|
/* Directories can be opened and read from, but only readdir() knows
|
|
|
|
* how to parse the data. The directory plugin will do it. */
|
|
|
|
if (S_ISDIR (st.st_mode))
|
2006-11-01 21:50:18 +01:00
|
|
|
{
|
2010-01-16 12:25:23 +01:00
|
|
|
#ifdef HAVE_FDOPENDIR
|
|
|
|
DIR *handle = fdopendir (fd);
|
|
|
|
if (handle == NULL)
|
|
|
|
goto error; /* Uh? */
|
|
|
|
return DirInit (p_access, handle);
|
|
|
|
#else
|
2009-02-05 16:52:52 +01:00
|
|
|
msg_Dbg (p_access, "ignoring directory");
|
|
|
|
goto error;
|
2010-01-16 12:25:23 +01:00
|
|
|
#endif
|
2006-11-01 21:50:18 +01:00
|
|
|
}
|
2010-01-16 12:13:46 +01:00
|
|
|
|
|
|
|
access_sys_t *p_sys = malloc (sizeof (*p_sys));
|
|
|
|
if (unlikely(p_sys == NULL))
|
|
|
|
goto error;
|
|
|
|
access_InitFields (p_access);
|
|
|
|
p_access->pf_read = FileRead;
|
|
|
|
p_access->pf_block = NULL;
|
|
|
|
p_access->pf_control = FileControl;
|
|
|
|
p_access->pf_seek = FileSeek;
|
|
|
|
p_access->p_sys = p_sys;
|
|
|
|
p_sys->i_nb_reads = 0;
|
|
|
|
p_sys->fd = fd;
|
|
|
|
p_sys->caching = var_CreateGetInteger (p_access, "file-caching");
|
|
|
|
if (IsRemote(fd))
|
|
|
|
p_sys->caching += var_CreateGetInteger (p_access, "network-caching");
|
|
|
|
p_sys->b_pace_control = true;
|
|
|
|
|
2009-02-05 17:34:43 +01:00
|
|
|
if (S_ISREG (st.st_mode))
|
|
|
|
p_access->info.i_size = st.st_size;
|
|
|
|
else if (!S_ISBLK (st.st_mode))
|
2009-04-08 17:49:08 +02:00
|
|
|
{
|
2009-02-05 21:27:10 +01:00
|
|
|
p_access->pf_seek = NoSeek;
|
2009-04-08 17:49:08 +02:00
|
|
|
p_sys->b_pace_control = strcasecmp (p_access->psz_access, "stream");
|
|
|
|
}
|
2009-07-23 22:20:12 +02:00
|
|
|
|
|
|
|
if (p_access->pf_seek != NoSeek)
|
|
|
|
{
|
|
|
|
/* Demuxers will need the beginning of the file for probing. */
|
|
|
|
posix_fadvise (fd, 0, 4096, POSIX_FADV_WILLNEED);
|
|
|
|
/* In most cases, we only read the file once. */
|
|
|
|
posix_fadvise (fd, 0, 0, POSIX_FADV_NOREUSE);
|
2010-01-16 10:38:17 +01:00
|
|
|
#if defined(HAVE_FCNTL)
|
|
|
|
/* We'd rather use any available memory for reading ahead
|
|
|
|
* than for caching what we've already seen/heard */
|
|
|
|
# if defined(F_RDAHEAD)
|
|
|
|
fcntl (fd, F_RDAHEAD, 1);
|
|
|
|
# endif
|
|
|
|
# if defined(F_NOCACHE)
|
|
|
|
fcntl (fd, F_NOCACHE, 1);
|
|
|
|
# endif
|
|
|
|
#endif
|
2009-07-23 22:20:12 +02:00
|
|
|
}
|
2002-11-12 14:57:13 +01:00
|
|
|
return VLC_SUCCESS;
|
2009-02-05 16:52:52 +01:00
|
|
|
|
|
|
|
error:
|
2010-01-16 12:13:46 +01:00
|
|
|
close (fd);
|
2009-02-05 16:52:52 +01:00
|
|
|
return VLC_EGENERIC;
|
2002-08-04 19:23:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************
|
2002-11-12 14:57:13 +01:00
|
|
|
* Close: close the target
|
2002-08-04 19:23:44 +02:00
|
|
|
*****************************************************************************/
|
2010-01-16 11:56:44 +01:00
|
|
|
void Close (vlc_object_t * p_this)
|
2002-11-12 14:57:13 +01:00
|
|
|
{
|
2004-06-03 02:08:54 +02:00
|
|
|
access_t *p_access = (access_t*)p_this;
|
2010-01-16 12:25:23 +01:00
|
|
|
|
|
|
|
if (p_access->pf_read == NULL)
|
|
|
|
{
|
|
|
|
DirClose (p_this);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2004-06-03 02:08:54 +02:00
|
|
|
access_sys_t *p_sys = p_access->p_sys;
|
2002-11-12 14:57:13 +01:00
|
|
|
|
2006-11-01 21:50:18 +01:00
|
|
|
close (p_sys->fd);
|
2006-10-31 18:41:04 +01:00
|
|
|
free (p_sys);
|
2002-11-12 14:57:13 +01:00
|
|
|
}
|
|
|
|
|
2008-09-30 17:39:26 +02:00
|
|
|
|
|
|
|
#include <vlc_network.h>
|
|
|
|
|
2002-11-12 14:57:13 +01:00
|
|
|
/*****************************************************************************
|
|
|
|
* Read: standard read on a file descriptor.
|
|
|
|
*****************************************************************************/
|
2010-01-16 11:56:44 +01:00
|
|
|
ssize_t FileRead( access_t *p_access, uint8_t *p_buffer, size_t i_len )
|
2002-11-12 14:57:13 +01:00
|
|
|
{
|
2004-06-03 02:08:54 +02:00
|
|
|
access_sys_t *p_sys = p_access->p_sys;
|
2006-11-01 21:50:18 +01:00
|
|
|
int fd = p_sys->fd;
|
2008-09-30 17:39:26 +02:00
|
|
|
ssize_t i_ret;
|
2004-06-03 02:08:54 +02:00
|
|
|
|
2008-09-30 17:39:26 +02:00
|
|
|
#ifndef WIN32
|
2009-02-05 21:27:10 +01:00
|
|
|
if (p_access->pf_seek == NoSeek)
|
2009-02-05 17:18:19 +01:00
|
|
|
i_ret = net_Read (p_access, fd, NULL, p_buffer, i_len, false);
|
|
|
|
else
|
2008-09-30 17:39:26 +02:00
|
|
|
#endif
|
2009-02-05 17:18:19 +01:00
|
|
|
i_ret = read (fd, p_buffer, i_len);
|
2008-10-06 12:40:19 +02:00
|
|
|
|
2002-11-12 14:57:13 +01:00
|
|
|
if( i_ret < 0 )
|
|
|
|
{
|
2006-10-31 18:41:04 +01:00
|
|
|
switch (errno)
|
2006-08-23 01:22:14 +02:00
|
|
|
{
|
2006-10-31 18:41:04 +01:00
|
|
|
case EINTR:
|
|
|
|
case EAGAIN:
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2009-02-05 16:52:52 +01:00
|
|
|
msg_Err (p_access, "failed to read (%m)");
|
2009-03-24 22:43:39 +01:00
|
|
|
dialog_Fatal (p_access, _("File reading failed"), "%s",
|
2009-03-05 20:09:21 +01:00
|
|
|
_("VLC could not read the file."));
|
2009-01-18 19:16:03 +01:00
|
|
|
p_access->info.b_eof = true;
|
2008-09-28 17:45:59 +02:00
|
|
|
return 0;
|
2006-08-23 01:22:14 +02:00
|
|
|
}
|
2002-11-12 14:57:13 +01:00
|
|
|
}
|
2008-06-20 23:27:44 +02:00
|
|
|
else if( i_ret > 0 )
|
|
|
|
p_access->info.i_pos += i_ret;
|
2009-01-14 11:13:47 +01:00
|
|
|
else
|
2008-06-20 23:27:44 +02:00
|
|
|
p_access->info.b_eof = true;
|
2004-06-03 02:08:54 +02:00
|
|
|
|
|
|
|
p_sys->i_nb_reads++;
|
2006-10-31 18:41:04 +01:00
|
|
|
|
2009-04-08 17:49:51 +02:00
|
|
|
if ((p_access->info.i_size && !(p_sys->i_nb_reads % INPUT_FSTAT_NB_READS))
|
|
|
|
|| (p_access->info.i_pos > p_access->info.i_size))
|
2003-01-03 14:07:17 +01:00
|
|
|
{
|
2009-07-23 22:20:12 +02:00
|
|
|
#ifdef HAVE_SYS_STAT_H
|
2006-11-12 13:02:55 +01:00
|
|
|
struct stat st;
|
2004-03-10 18:10:40 +01:00
|
|
|
|
2006-10-31 18:41:04 +01:00
|
|
|
if ((fstat (fd, &st) == 0)
|
2010-01-23 10:23:03 +01:00
|
|
|
&& (p_access->info.i_size != (uint64_t)st.st_size))
|
2003-01-03 14:07:17 +01:00
|
|
|
{
|
2006-11-01 21:50:18 +01:00
|
|
|
p_access->info.i_size = st.st_size;
|
2004-06-03 02:08:54 +02:00
|
|
|
p_access->info.i_update |= INPUT_UPDATE_SIZE;
|
2003-01-03 14:07:17 +01:00
|
|
|
}
|
|
|
|
#endif
|
2009-07-23 22:20:12 +02:00
|
|
|
}
|
2002-11-12 14:57:13 +01:00
|
|
|
return i_ret;
|
|
|
|
}
|
|
|
|
|
2007-11-26 21:27:15 +01:00
|
|
|
|
2002-11-12 14:57:13 +01:00
|
|
|
/*****************************************************************************
|
|
|
|
* Seek: seek to a specific location in a file
|
|
|
|
*****************************************************************************/
|
2010-01-21 21:36:07 +01:00
|
|
|
int FileSeek (access_t *p_access, uint64_t i_pos)
|
2002-11-12 14:57:13 +01:00
|
|
|
{
|
2006-10-31 18:41:04 +01:00
|
|
|
p_access->info.i_pos = i_pos;
|
2008-04-14 00:08:29 +02:00
|
|
|
p_access->info.b_eof = false;
|
2006-10-31 18:41:04 +01:00
|
|
|
|
2008-02-20 22:24:37 +01:00
|
|
|
lseek (p_access->p_sys->fd, i_pos, SEEK_SET);
|
2004-06-03 02:08:54 +02:00
|
|
|
return VLC_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2010-01-21 21:36:07 +01:00
|
|
|
int NoSeek (access_t *p_access, uint64_t i_pos)
|
2009-02-05 21:27:10 +01:00
|
|
|
{
|
|
|
|
/* assert(0); ?? */
|
|
|
|
(void) p_access; (void) i_pos;
|
|
|
|
return VLC_EGENERIC;
|
|
|
|
}
|
|
|
|
|
2004-06-03 02:08:54 +02:00
|
|
|
/*****************************************************************************
|
|
|
|
* Control:
|
|
|
|
*****************************************************************************/
|
2010-01-16 11:56:44 +01:00
|
|
|
int FileControl( access_t *p_access, int i_query, va_list args )
|
2004-06-03 02:08:54 +02:00
|
|
|
{
|
|
|
|
access_sys_t *p_sys = p_access->p_sys;
|
2009-01-20 22:28:47 +01:00
|
|
|
bool *pb_bool;
|
|
|
|
int64_t *pi_64;
|
2004-06-03 02:08:54 +02:00
|
|
|
|
|
|
|
switch( i_query )
|
2002-11-12 14:57:13 +01:00
|
|
|
{
|
2004-06-03 02:08:54 +02:00
|
|
|
/* */
|
|
|
|
case ACCESS_CAN_SEEK:
|
|
|
|
case ACCESS_CAN_FASTSEEK:
|
2008-04-14 00:08:29 +02:00
|
|
|
pb_bool = (bool*)va_arg( args, bool* );
|
2009-02-05 21:27:10 +01:00
|
|
|
*pb_bool = (p_access->pf_seek != NoSeek);
|
2004-06-03 02:08:54 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ACCESS_CAN_PAUSE:
|
|
|
|
case ACCESS_CAN_CONTROL_PACE:
|
2008-04-14 00:08:29 +02:00
|
|
|
pb_bool = (bool*)va_arg( args, bool* );
|
2004-06-03 02:08:54 +02:00
|
|
|
*pb_bool = p_sys->b_pace_control;
|
|
|
|
break;
|
|
|
|
|
|
|
|
/* */
|
|
|
|
case ACCESS_GET_PTS_DELAY:
|
|
|
|
pi_64 = (int64_t*)va_arg( args, int64_t * );
|
2009-07-20 18:37:17 +02:00
|
|
|
*pi_64 = p_sys->caching * INT64_C(1000);
|
2004-06-03 02:08:54 +02:00
|
|
|
break;
|
2004-10-05 17:31:22 +02:00
|
|
|
|
2004-06-03 02:08:54 +02:00
|
|
|
/* */
|
|
|
|
case ACCESS_SET_PAUSE_STATE:
|
|
|
|
/* Nothing to do */
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ACCESS_GET_TITLE_INFO:
|
|
|
|
case ACCESS_SET_TITLE:
|
|
|
|
case ACCESS_SET_SEEKPOINT:
|
2004-06-05 21:36:51 +02:00
|
|
|
case ACCESS_SET_PRIVATE_ID_STATE:
|
2005-03-11 23:36:40 +01:00
|
|
|
case ACCESS_GET_META:
|
2008-01-25 16:15:56 +01:00
|
|
|
case ACCESS_GET_PRIVATE_ID_STATE:
|
2007-10-02 17:54:16 +02:00
|
|
|
case ACCESS_GET_CONTENT_TYPE:
|
2004-06-03 02:08:54 +02:00
|
|
|
return VLC_EGENERIC;
|
|
|
|
|
|
|
|
default:
|
2008-01-25 16:15:56 +01:00
|
|
|
msg_Warn( p_access, "unimplemented query %d in control", i_query );
|
2004-06-03 02:08:54 +02:00
|
|
|
return VLC_EGENERIC;
|
|
|
|
|
2002-11-12 14:57:13 +01:00
|
|
|
}
|
2004-06-03 02:08:54 +02:00
|
|
|
return VLC_SUCCESS;
|
2002-11-12 14:57:13 +01:00
|
|
|
}
|