* Preamble
*****************************************************************************/
#include <vlc/vlc.h>
-#include <vlc/input.h>
-#include <vlc_interaction.h>
+#include <vlc_input.h>
+#include <vlc_access.h>
+#include <vlc_interface.h>
-#include <stdlib.h>
-#include <string.h>
#include <errno.h>
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#if defined( WIN32 ) && !defined( UNDER_CE )
-/* fstat() support for large files on win32 */
-# define fstat(a,b) _fstati64(a,b)
# ifdef lseek
# undef lseek
# endif
# define lseek fseek
#endif
-#include "charset.h"
+#include <vlc_charset.h>
/*****************************************************************************
* Module descriptor
set_category( CAT_INPUT );
set_subcategory( SUBCAT_INPUT_ACCESS );
add_integer( "file-caching", DEFAULT_PTS_DELAY / 1000, NULL, CACHING_TEXT, CACHING_LONGTEXT, VLC_TRUE );
- add_deprecated( "file-cat", VLC_TRUE );
+ add_obsolete_string( "file-cat" );
set_capability( "access2", 50 );
add_shortcut( "file" );
add_shortcut( "stream" );
while (fd != -1)
{
if (fstat (fd, &st))
- msg_Err (p_access, "fstat(%d): %s", fd, strerror (errno));
+ msg_Err (p_access, "fstat(%d): %m", fd);
else
if (S_ISDIR (st.st_mode))
/* The directory plugin takes care of that */
p_sys->b_seekable = VLC_FALSE;
#else
p_sys->b_seekable = !b_stdin;
+# warning File size not known!
#endif
if (p_sys->b_seekable && (p_access->info.i_size == 0))
break;
default:
- msg_Err (p_access, "read failed (%s)", strerror (errno));
+ msg_Err (p_access, "read failed (%m)");
intf_UserFatal (p_access, VLC_FALSE, _("File reading failed"),
- _("VLC could not read file \"%s\"."),
- strerror (errno));
+ _("VLC could not read file."));
}
/* Delay a bit to avoid consuming all the CPU. This is particularly
*****************************************************************************/
static int Seek (access_t *p_access, int64_t i_pos)
{
- access_sys_t *p_sys = p_access->p_sys;
-
if (i_pos > p_access->info.i_size)
{
msg_Err (p_access, "seeking too far");
- i_pos = p_access->info.i_size;
+ i_pos = p_access->info.i_size;
}
else if (i_pos < 0)
{
msg_Err (p_access, "seeking too early");
- i_pos = 0;
+ i_pos = 0;
}
p_access->info.i_pos = i_pos;
p_access->info.b_eof = VLC_FALSE;
/* Determine which file we need to access */
- lseek (p_sys->fd, i_pos, SEEK_SET);
+ lseek (p_access->p_sys->fd, i_pos, SEEK_SET);
return VLC_SUCCESS;
}
case ACCESS_SET_SEEKPOINT:
case ACCESS_SET_PRIVATE_ID_STATE:
case ACCESS_GET_META:
+ case ACCESS_GET_CONTENT_TYPE:
return VLC_EGENERIC;
default:
if ( !p_sys->fd )
{
msg_Err( p_access, "cannot open file %s", psz_name );
- intf_UserFatal( p_access, VLC_FALSE, _("File reading failed"),
+ intf_UserFatal( p_access, VLC_FALSE, _("File reading failed"),
_("VLC could not open file \"%s\"."), psz_name );
free (path);
return VLC_EGENERIC;
fseek( p_sys->fd, 0, SEEK_SET );
#else
int fd = utf8_open (path, O_RDONLY | O_NONBLOCK /* O_LARGEFILE*/, 0666);
+ free (path);
if (fd == -1)
{
- msg_Err (p_access, "cannot open file %s (%s)", psz_name,
- strerror (errno));
- intf_UserFatal (p_access, VLC_FALSE, _("File reading failed"),
- _("VLC could not open file \"%s\" (%s)."),
- psz_name, strerror (errno));
+ msg_Err (p_access, "cannot open file %s (%m)", psz_name);
+ intf_UserFatal (p_access, VLC_FALSE, _("File reading failed"),
+ _("VLC could not open file \"%s\"."), psz_name);
return -1;
}