/*****************************************************************************
- * directory.c: expands a directory (directory: access plug-in)
+ * directory.c: expands a directory (directory: access_browser plug-in)
*****************************************************************************
- * Copyright (C) 2002-2008 the VideoLAN team
+ * Copyright (C) 2002-2008 VLC authors and VideoLAN
* $Id$
*
* Authors: Derk-Jan Hartman <hartman at videolan dot org>
* RĂ©mi Denis-Courmont
+ * Julien 'Lta' BALLET <contact # lta.io>
*
- * 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
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* 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.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser 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
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
/*****************************************************************************
#endif
#include <vlc_common.h>
-#include <vlc_plugin.h>
+#include "fs.h"
#include <vlc_access.h>
+#include <vlc_input_item.h>
-#ifdef HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-#ifdef HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#ifdef HAVE_UNISTD_H
-# include <unistd.h>
-#elif defined( WIN32 ) && !defined( UNDER_CE )
-# include <io.h>
-#endif
-
-#ifdef HAVE_DIRENT_H
-# include <dirent.h>
-#endif
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <errno.h>
+#include <unistd.h>
+#include <fcntl.h>
-#include <vlc_charset.h>
+#include <vlc_fs.h>
#include <vlc_url.h>
+#include <vlc_strings.h>
+#include <vlc_charset.h>
-/*****************************************************************************
- * Module descriptor
- *****************************************************************************/
-static int Open ( vlc_object_t * );
-static void Close( vlc_object_t * );
-
-#define RECURSIVE_TEXT N_("Subdirectory behavior")
-#define RECURSIVE_LONGTEXT N_( \
- "Select whether subdirectories must be expanded.\n" \
- "none: subdirectories do not appear in the playlist.\n" \
- "collapse: subdirectories appear but are expanded on first play.\n" \
- "expand: all subdirectories are expanded.\n" )
-
-static const char *const psz_recursive_list[] = { "none", "collapse", "expand" };
-static const char *const psz_recursive_list_text[] = {
- N_("none"), N_("collapse"), N_("expand") };
-
-#define IGNORE_TEXT N_("Ignored extensions")
-#define IGNORE_LONGTEXT N_( \
- "Files with these extensions will not be added to playlist when " \
- "opening a directory.\n" \
- "This is useful if you add directories that contain playlist files " \
- "for instance. Use a comma-separated list of extensions." )
-
-vlc_module_begin ()
- set_category( CAT_INPUT )
- set_shortname( N_("Directory" ) )
- set_subcategory( SUBCAT_INPUT_ACCESS )
- set_description( N_("Standard filesystem directory input") )
- set_capability( "access", 55 )
- add_shortcut( "directory" )
- add_shortcut( "dir" )
- add_shortcut( "file" )
- add_string( "recursive", "expand" , NULL, RECURSIVE_TEXT,
- RECURSIVE_LONGTEXT, false );
- change_string_list( psz_recursive_list, psz_recursive_list_text, 0 );
- add_string( "ignore-filetypes", "m3u,db,nfo,jpg,jpeg,ljpg,gif,png,pgm,pgmyuv,pbm,pam,tga,bmp,pnm,xpm,xcf,pcx,tif,tiff,lbm,sfv,txt,sub,idx,srt,cue,ssa",
- NULL, IGNORE_TEXT, IGNORE_LONGTEXT, false );
- set_callbacks( Open, Close )
-vlc_module_end ()
-
-
-/*****************************************************************************
- * Local prototypes, constants, structures
- *****************************************************************************/
+enum
+{
+ ENTRY_DIR = 0,
+ ENTRY_ENOTDIR = -1,
+ ENTRY_EACCESS = -2,
+};
enum
{
- MODE_EXPAND,
+ MODE_NONE,
MODE_COLLAPSE,
- MODE_NONE
+ MODE_EXPAND,
};
-typedef struct directory_t directory_t;
-struct directory_t
+typedef struct directory directory;
+struct directory
{
- directory_t *parent;
+ directory *parent;
DIR *handle;
char *uri;
-#ifndef WIN32
- struct stat st;
+ char **filev;
+ int filec, i;
+#ifdef HAVE_OPENAT
+ dev_t device;
+ ino_t inode;
+#else
+ char *path;
#endif
- char path[1];
};
struct access_sys_t
{
- directory_t *current;
- DIR *handle;
- char *ignored_exts;
- int mode;
- int i_item_count;
- char *psz_xspf_extension;
+ directory *current;
+ char *ignored_exts;
+ char mode;
+ int (*compar) (const char **a, const char **b);
};
-static block_t *Block( access_t * );
-static int Control( access_t *, int, va_list );
+/* Select non-hidden files only */
+static int visible (const char *name)
+{
+ return name[0] != '.';
+}
+
+static int collate (const char **a, const char **b)
+{
+#ifdef HAVE_STRCOLL
+ return strcoll (*a, *b);
+#else
+ return strcmp (*a, *b);
+#endif
+}
+
+static int version (const char **a, const char **b)
+{
+ return strverscmp (*a, *b);
+}
+
+/**
+ * Does the provided URI/path/stuff has one of the extension provided ?
+ *
+ * \param psz_exts A comma separated list of extension without dot, or only
+ * one ext (ex: "avi,mkv,webm")
+ * \param psz_uri The uri/path to check (ex: "file:///home/foo/bar.avi"). If
+ * providing an URI, it must not contain a query string.
+ *
+ * \return true if the uri/path has one of the provided extension
+ * false otherwise.
+ */
+static bool has_ext (const char *psz_exts, const char *psz_uri)
+{
+ if (psz_exts == NULL)
+ return false;
+
+ const char *ext = strrchr (psz_uri, '.');
+ if (ext == NULL)
+ return false;
+
+ size_t extlen = strlen (++ext);
+
+ for (const char *type = psz_exts, *end; type[0]; type = end + 1)
+ {
+ end = strchr (type, ',');
+ if (end == NULL)
+ end = type + strlen (type);
+
+ if (type + extlen == end && !strncasecmp (ext, type, extlen))
+ return true;
+
+ if (*end == '\0')
+ break;
+ }
+
+ return false;
+}
+
+
+#ifdef HAVE_OPENAT
+/* Detect directories that recurse into themselves. */
+static bool has_inode_loop (const directory *dir, dev_t dev, ino_t inode)
+{
+ while (dir != NULL)
+ {
+ if ((dir->device == dev) && (dir->inode == inode))
+ return true;
+ dir = dir->parent;
+ }
+ return false;
+}
+#endif
+
+/* success -> returns ENTRY_DIR and the handle parameter is set to the handle,
+ * error -> return ENTRY_ENOTDIR or ENTRY_EACCESS */
+static int directory_open (directory *p_dir, char *psz_entry, DIR **handle)
+{
+ *handle = NULL;
+
+#ifdef HAVE_OPENAT
+ int fd = vlc_openat (dirfd (p_dir->handle), psz_entry,
+ O_RDONLY | O_DIRECTORY);
+
+ if (fd == -1)
+ {
+ if (errno == ENOTDIR)
+ return ENTRY_ENOTDIR;
+ else
+ return ENTRY_EACCESS;
+ }
+
+ struct stat st;
+ if (fstat (fd, &st)
+ || has_inode_loop (p_dir, st.st_dev, st.st_ino)
+ || (*handle = fdopendir (fd)) == NULL)
+ {
+ close (fd);
+ return ENTRY_EACCESS;
+ }
+#else
+ char *path;
+ if (asprintf (&path, "%s/%s", p_dir->path, psz_entry) == -1)
+ return ENTRY_EACCESS;
+
+ *handle = vlc_opendir (path);
+
+ free(path);
+
+ if (*handle == NULL) {
+ return ENTRY_ENOTDIR;
+ }
+#endif
+
+ return ENTRY_DIR;
+}
+
+static bool directory_push (access_sys_t *p_sys, DIR *handle, char *psz_uri)
+{
+ directory *p_dir = malloc (sizeof (*p_dir));
+
+ psz_uri = strdup (psz_uri);
+ if (unlikely (p_dir == NULL || psz_uri == NULL))
+ goto error;
+
+ p_dir->parent = p_sys->current;
+ p_dir->handle = handle;
+ p_dir->uri = psz_uri;
+ p_dir->filec = vlc_loaddir (handle, &p_dir->filev, visible, p_sys->compar);
+ if (p_dir->filec < 0)
+ p_dir->filev = NULL;
+ p_dir->i = 0;
+
+#ifdef HAVE_OPENAT
+ struct stat st;
+ if (fstat (dirfd (handle), &st))
+ goto error_filev;
+ p_dir->device = st.st_dev;
+ p_dir->inode = st.st_ino;
+#else
+ p_dir->path = make_path (psz_uri);
+ if (p_dir->path == NULL)
+ goto error_filev;
+#endif
+
+ p_sys->current = p_dir;
+ return true;
+
+error_filev:
+ for (int i = 0; i < p_dir->filec; i++)
+ free (p_dir->filev[i]);
+ free (p_dir->filev);
+
+error:
+ closedir (handle);
+ free (p_dir);
+ free (psz_uri);
+ return false;
+}
+
+static bool directory_pop (access_sys_t *p_sys)
+{
+ directory *p_old = p_sys->current;
+
+ if (p_old == NULL)
+ return false;
+
+ p_sys->current = p_old->parent;
+ closedir (p_old->handle);
+ free (p_old->uri);
+ for (int i = 0; i < p_old->filec; i++)
+ free (p_old->filev[i]);
+ free (p_old->filev);
+#ifndef HAVE_OPENAT
+ free (p_old->path);
+#endif
+ free (p_old);
+
+ return p_sys->current != NULL;
+}
+
/*****************************************************************************
* Open: open the directory
*****************************************************************************/
-static int Open( vlc_object_t *p_this )
+int DirOpen (vlc_object_t *p_this)
{
access_t *p_access = (access_t*)p_this;
- access_sys_t *p_sys;
- if( !p_access->psz_path )
+ if (!p_access->psz_filepath)
+ return VLC_EGENERIC;
+
+ DIR *handle = vlc_opendir (p_access->psz_filepath);
+ if (handle == NULL)
return VLC_EGENERIC;
- DIR *handle;
- if (strcmp (p_access->psz_path, "-"))
- handle = utf8_opendir (p_access->psz_path);
+ return DirInit (p_access, handle);
+}
+
+int DirInit (access_t *p_access, DIR *handle)
+{
+ access_sys_t *p_sys = malloc (sizeof (*p_sys));
+ if (unlikely (p_sys == NULL))
+ goto error;
+
+ char *psz_sort = var_InheritString (p_access, "directory-sort");
+ if (!psz_sort)
+ p_sys->compar = collate;
+ else if (!strcasecmp ( psz_sort, "version"))
+ p_sys->compar = version;
+ else if (!strcasecmp (psz_sort, "none"))
+ p_sys->compar = NULL;
else
+ p_sys->compar = collate;
+ free(psz_sort);
+
+ char *uri;
+ if (!strcmp (p_access->psz_access, "fd"))
{
-#if 0 /* This won't work yet, it generates paths like "-/music.ogg".
- * We'd need to use openat() here and in the file access... */
- int fd = dup (0);
- handle = fdopendir (fd);
- if (handle == NULL)
- close (fd);
-#else
- return VLC_EGENERIC;
-#endif
+ if (asprintf (&uri, "fd://%s", p_access->psz_location) == -1)
+ uri = NULL;
+ }
+ else
+ uri = vlc_path2uri (p_access->psz_filepath, "file");
+ if (unlikely (uri == NULL))
+ {
+ closedir (handle);
+ goto error;
}
- if (handle == NULL)
- return VLC_EGENERIC;
-
- p_sys = malloc (sizeof (*p_sys));
- if (!p_sys)
+ /* "Open" the base directory */
+ p_sys->current = NULL;
+ if (!directory_push (p_sys, handle, uri))
{
- closedir( handle );
- return VLC_ENOMEM;
+ free (uri);
+ goto error;
}
+ free (uri);
p_access->p_sys = p_sys;
- p_sys->current = NULL;
- p_sys->handle = handle;
- p_sys->ignored_exts = var_CreateGetString (p_access, "ignore-filetypes");
- p_sys->i_item_count = 0;
- p_sys->psz_xspf_extension = strdup( "" );
-
- /* Handle mode */
- char *psz = var_CreateGetString( p_access, "recursive" );
- if( *psz == '\0' || !strcasecmp( psz, "none" ) )
- p_sys->mode = MODE_NONE;
- else if( !strcasecmp( psz, "collapse" ) )
- p_sys->mode = MODE_COLLAPSE;
- else
- p_sys->mode = MODE_EXPAND;
- free( psz );
+ p_sys->ignored_exts = var_InheritString (p_access, "ignore-filetypes");
- p_access->pf_read = NULL;
- p_access->pf_block = Block;
- p_access->pf_seek = NULL;
- p_access->pf_control= Control;
- free (p_access->psz_demux);
- p_access->psz_demux = strdup ("xspf-open");
+ p_access->pf_readdir = DirRead;
+ p_access->pf_control = DirControl;
return VLC_SUCCESS;
+
+error:
+ free (p_sys);
+ return VLC_EGENERIC;
}
/*****************************************************************************
* Close: close the target
*****************************************************************************/
-static void Close( vlc_object_t * p_this )
+void DirClose( vlc_object_t * p_this )
{
access_t *p_access = (access_t*)p_this;
access_sys_t *p_sys = p_access->p_sys;
- while (p_sys->current)
- {
- directory_t *current = p_sys->current;
+ while (directory_pop (p_sys))
+ ;
- p_sys->current = current->parent;
- closedir (current->handle);
- free (current->uri);
- free (current);
- }
- if (p_sys->handle != NULL)
- closedir (p_sys->handle); /* corner case,:Block() not called ever */
- free (p_sys->psz_xspf_extension);
free (p_sys->ignored_exts);
free (p_sys);
}
-/**
- * URI-encodes a file path. The only reserved characters is slash.
- */
-static char *encode_path (const char *path)
+/* This function is a little bit too complex for what it seems to do, but the
+ * point is to de-recursify directory recusion to avoid overruning the stack
+ * in case there's a high directory depth */
+int DirRead (access_t *p_access, input_item_node_t *p_current_node)
{
- static const char sep[]= "%2F";
- char *enc = encode_URI_component (path), *ptr = enc;
-
- if (enc == NULL)
- return NULL;
+ access_sys_t *p_sys = p_access->p_sys;
- /* Replace '%2F' with '/'. TODO: extend encode_URI*() */
- /* (On Windows, both ':' and '\\' will be encoded) */
- while ((ptr = strstr (ptr, sep)) != NULL)
+ while (p_sys->current != NULL
+ && p_sys->current->i <= p_sys->current->filec)
{
- *ptr++ = '/';
- memmove (ptr, ptr + 2, strlen (ptr) - 1);
- }
- return enc;
-}
-
-/* Detect directories that recurse into themselves. */
-static bool has_inode_loop (const directory_t *dir)
-{
-#ifndef WIN32
- dev_t dev = dir->st.st_dev;
- ino_t inode = dir->st.st_ino;
-
- while ((dir = dir->parent) != NULL)
- if ((dir->st.st_dev == dev) && (dir->st.st_ino == inode))
- return true;
-#else
-# define fstat( fd, st ) (0)
-#endif
- return false;
-}
+ directory *p_current = p_sys->current;
-static block_t *Block (access_t *p_access)
-{
- access_sys_t *p_sys = p_access->p_sys;
- directory_t *current = p_sys->current;
-
- if (p_access->info.b_eof)
- return NULL;
-
- if (current == NULL)
- { /* Startup: send the XSPF header */
- static const char header[] =
- "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
- "<playlist version=\"1\" xmlns=\"http://xspf.org/ns/0/\" xmlns:vlc=\"http://www.videolan.org/vlc/playlist/ns/0/\">\n"
- " <trackList>\n";
- block_t *block = block_Alloc (sizeof (header) - 1);
- if (!block)
- goto fatal;
- memcpy (block->p_buffer, header, sizeof (header) - 1);
-
- /* "Open" the base directory */
- current = malloc (sizeof (*current) + strlen (p_access->psz_path));
- if (current == NULL)
- {
- block_Release (block);
- goto fatal;
- }
- current->parent = NULL;
- current->handle = p_sys->handle;
- strcpy (current->path, p_access->psz_path);
- current->uri = encode_path (current->path);
- if ((current->uri == NULL)
- || fstat (dirfd (current->handle), ¤t->st))
+ /* End of the current folder, let's pop directory and node */
+ if (p_current->i == p_current->filec)
{
- free (current->uri);
- free (current);
- block_Release (block);
- goto fatal;
+ directory_pop (p_sys);
+ p_current_node = p_current_node->p_parent;
+ continue;
}
- p_sys->handle = NULL;
- p_sys->current = current;
- return block;
- }
+ char *psz_entry = p_current->filev[p_current->i++];
+ char *psz_full_uri, *psz_uri;
+ DIR *handle;
+ input_item_t *p_new = NULL;
+ int i_res;
- char *entry = utf8_readdir (current->handle);
- if (entry == NULL)
- { /* End of directory, go back to parent */
- closedir (current->handle);
- p_sys->current = current->parent;
- free (current);
-
- if (p_sys->current == NULL)
- { /* End of XSPF playlist */
- char *footer;
- int len = asprintf( &footer, " </trackList>\n" \
- " <extension application=\"http://www.videolan.org/vlc/playlist/0\">\n" \
- "%s" \
- " </extension>\n" \
- "</playlist>\n", p_sys->psz_xspf_extension );
- if( len < 0 )
- goto fatal;
-
- block_t *block = block_Alloc ( len );
- if (!block)
- goto fatal;
- memcpy (block->p_buffer, footer, len);
- free( footer );
- p_access->info.b_eof = true;
- return block;
- }
- else
- {
- /* This was the end of a "subnode" */
- /* Write the ID to the extension */
- char *old_xspf_extension = p_sys->psz_xspf_extension;
- if (old_xspf_extension == NULL)
- goto fatal;
-
- int len2 = asprintf( &p_sys->psz_xspf_extension, "%s </vlc:node>\n", old_xspf_extension );
- if (len2 == -1)
- goto fatal;
- free( old_xspf_extension );
- }
- return NULL;
- }
+ /* Check if it is a directory or even readable */
+ i_res = directory_open (p_current, psz_entry, &handle);
- /* Skip current, parent and hidden directories */
- if (entry[0] == '.')
- return NULL;
- /* Handle recursion */
- if (p_sys->mode != MODE_COLLAPSE)
- {
- directory_t *sub = malloc (sizeof (*sub) + strlen (current->path) + 1
- + strlen (entry));
- if (sub == NULL)
- return NULL;
- sprintf (sub->path, "%s/%s", current->path, entry);
-
- DIR *handle = utf8_opendir (sub->path);
- if (handle != NULL)
+ if (i_res == ENTRY_EACCESS
+ || (i_res == ENTRY_ENOTDIR && has_ext (p_sys->ignored_exts, psz_entry)))
+ continue;
+
+
+ /* Create an input item for the current entry */
+ psz_uri = encode_URI_component (psz_entry);
+ if (psz_uri == NULL
+ || asprintf (&psz_full_uri, "%s/%s", p_current->uri, psz_uri) == -1)
+ psz_full_uri = NULL;
+
+ free (psz_uri);
+ if (psz_full_uri == NULL)
{
- sub->parent = current;
- sub->handle = handle;
-
- char *encoded = encode_URI_component (entry);
- if ((encoded == NULL)
- || (asprintf (&sub->uri, "%s/%s", current->uri, encoded) == -1))
- sub->uri = NULL;
- free (encoded);
-
- if ((p_sys->mode == MODE_NONE)
- || fstat (dirfd (handle), &sub->st)
- || has_inode_loop (sub)
- || (sub->uri == NULL))
- {
- closedir (handle);
- free (sub);
- return NULL;
- }
- p_sys->current = sub;
-
- /* Add node to xspf extension */
- char *old_xspf_extension = p_sys->psz_xspf_extension;
- if (old_xspf_extension == NULL)
- goto fatal;
-
- int len2 = asprintf( &p_sys->psz_xspf_extension, "%s <vlc:node title=\"%s\">\n", old_xspf_extension, entry );
- if (len2 == -1)
- goto fatal;
- free( old_xspf_extension );
-
- return NULL;
+ closedir (handle);
+ continue;
}
- else
- free (sub);
- }
- /* Skip files with ignored extensions */
- if (p_sys->ignored_exts != NULL)
- {
- const char *ext = strrchr (entry, '.');
- if (ext != NULL)
+ int i_type = i_res == ENTRY_DIR ? ITEM_TYPE_DIRECTORY : ITEM_TYPE_FILE;
+ p_new = input_item_NewWithType (psz_full_uri, psz_entry,
+ 0, NULL, 0, 0, i_type);
+ if (p_new == NULL)
{
- size_t extlen = strlen (++ext);
- for (const char *type = p_sys->ignored_exts, *end;
- type[0]; type = end + 1)
- {
- end = strchr (type, ',');
- if (end == NULL)
- end = type + strlen (type);
-
- if (type + extlen == end
- && !strncasecmp (ext, type, extlen))
- return NULL;
-
- if (*end == '\0')
- break;
- }
+ free (psz_full_uri);
+ closedir (handle);
+ continue;
}
- }
- char *encoded = encode_URI_component (entry);
- free (entry);
- if (encoded == NULL)
- goto fatal;
- int len = asprintf (&entry,
- " <track><location>file://%s/%s</location>\n" \
- " <extension application=\"http://www.videolan.org/vlc/playlist/0\">\n" \
- " <vlc:id>%d</vlc:id>\n" \
- " </extension>\n" \
- " </track>\n",
- current->uri, encoded, p_sys->i_item_count++);
- free (encoded);
- if (len == -1)
- goto fatal;
-
- /* Write the ID to the extension */
- char *old_xspf_extension = p_sys->psz_xspf_extension;
- if (old_xspf_extension == NULL)
- goto fatal;
-
- int len2 = asprintf( &p_sys->psz_xspf_extension, "%s <vlc:item tid=\"%i\" />\n",
- old_xspf_extension, p_sys->i_item_count-1 );
- if (len2 == -1)
- goto fatal;
- free( old_xspf_extension );
-
- /* TODO: new block allocator for malloc()ated data */
- block_t *block = block_Alloc (len);
- if (!block)
- {
- free (entry);
- goto fatal;
+ input_item_CopyOptions (p_current_node->p_item, p_new);
+ input_item_node_AppendItem (p_current_node, p_new);
+
+ free (psz_full_uri);
+ input_item_Release (p_new);
}
- memcpy (block->p_buffer, entry, len);
- free (entry);
- return block;
-fatal:
- p_access->info.b_eof = true;
- return NULL;
+ return VLC_SUCCESS;
}
/*****************************************************************************
* Control:
*****************************************************************************/
-static int Control( access_t *p_access, int i_query, va_list args )
+int DirControl (access_t *p_access, int i_query, va_list args)
{
- bool *pb_bool;
- int *pi_int;
- int64_t *pi_64;
+ VLC_UNUSED (p_access);
- switch( i_query )
+ switch (i_query)
{
- /* */
case ACCESS_CAN_SEEK:
case ACCESS_CAN_FASTSEEK:
- pb_bool = (bool*)va_arg( args, bool* );
- *pb_bool = false;
+ *va_arg (args, bool*) = false;
break;
case ACCESS_CAN_PAUSE:
case ACCESS_CAN_CONTROL_PACE:
- pb_bool = (bool*)va_arg( args, bool* );
- *pb_bool = true;
- break;
-
- /* */
- case ACCESS_GET_MTU:
- pi_int = (int*)va_arg( args, int * );
- *pi_int = 0;
+ *va_arg (args, bool*) = true;
break;
case ACCESS_GET_PTS_DELAY:
- pi_64 = (int64_t*)va_arg( args, int64_t * );
- *pi_64 = DEFAULT_PTS_DELAY * 1000;
+ *va_arg (args, int64_t *) = DEFAULT_PTS_DELAY * 1000;
break;
- /* */
- case ACCESS_SET_PAUSE_STATE:
- case ACCESS_GET_TITLE_INFO:
- case ACCESS_SET_TITLE:
- case ACCESS_SET_SEEKPOINT:
- case ACCESS_SET_PRIVATE_ID_STATE:
- case ACCESS_GET_CONTENT_TYPE:
- case ACCESS_GET_META:
- return VLC_EGENERIC;
-
default:
- msg_Warn( p_access, "unimplemented query in control" );
return VLC_EGENERIC;
- }
- return VLC_SUCCESS;
-}
+ }
+ return VLC_SUCCESS;
+ }