int index;
} media_list_will_delete_item;
- /* media list view */
- struct
- {
- libvlc_media_t * item;
- int index;
- } media_list_view_item_added;
- struct
- {
- libvlc_media_t * item;
- int index;
- } media_list_view_will_add_item;
- struct
- {
- libvlc_media_t * item;
- int index;
- } media_list_view_item_deleted;
- struct
- {
- libvlc_media_t * item;
- int index;
- } media_list_view_will_delete_item;
-
/* media list player */
struct
{
+++ /dev/null
-/*****************************************************************************
- * libvlc_media_list.h: libvlc_media_list API
- *****************************************************************************
- * Copyright (C) 1998-2008 the VideoLAN team
- * $Id$
- *
- * Authors: Pierre d'Herbemont
- *
- * 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.
- *
- * 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
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-
-#ifndef LIBVLC_MEDIA_LIST_VIEW_H
-#define LIBVLC_MEDIA_LIST_VIEW_H 1
-
-/**
- * \file
- * This file defines libvlc_media_list API
- */
-
-# ifdef __cplusplus
-extern "C" {
-# endif
-
-/*****************************************************************************
- * Media List View
- *****************************************************************************/
-/** \defgroup libvlc_media_list_view libvlc_media_list_view
- * \ingroup libvlc
- * LibVLC Media List View: represents a media_list using a different layout.
- * The layout can be a flat one without hierarchy, a hierarchical one.
- *
- * Other type of layout, such as orderer media_list layout could be implemented
- * with this class.
- * @{ */
-
-/**
- * Retain reference to a media list view
- *
- * \param p_mlv a media list view created with libvlc_media_list_view_new()
- */
-VLC_PUBLIC_API void
- libvlc_media_list_view_retain( libvlc_media_list_view_t * p_mlv );
-
-/**
- * Release reference to a media list view. If the refcount reaches 0, then
- * the object will be released.
- *
- * \param p_mlv a media list view created with libvlc_media_list_view_new()
- */
-VLC_PUBLIC_API void
- libvlc_media_list_view_release( libvlc_media_list_view_t * p_mlv );
-
-/**
- * Get libvlc_event_manager from this media list view instance.
- * The p_event_manager is immutable, so you don't have to hold the lock
- *
- * \param p_mlv a media list view instance
- * \return libvlc_event_manager
- */
-VLC_PUBLIC_API libvlc_event_manager_t *
- libvlc_media_list_view_event_manager( libvlc_media_list_view_t * p_mlv );
-
-/**
- * Get count on media list view items
- *
- * \param p_mlv a media list view instance
- * \param p_e initialized exception object
- * \return number of items in media list view
- */
-VLC_PUBLIC_API int
- libvlc_media_list_view_count( libvlc_media_list_view_t * p_mlv,
- libvlc_exception_t * p_e );
-
-/**
- * List media instance in media list view at an index position
- *
- * \param p_mlv a media list view instance
- * \param i_index index position in array where to insert
- * \param p_e initialized exception object
- * \return media instance at position i_pos and libvlc_media_retain() has been called to increase the refcount on this object.
- */
-VLC_PUBLIC_API libvlc_media_t *
- libvlc_media_list_view_item_at_index( libvlc_media_list_view_t * p_mlv,
- int i_index,
- libvlc_exception_t * p_e );
-
-VLC_PUBLIC_API libvlc_media_list_view_t *
- libvlc_media_list_view_children_at_index( libvlc_media_list_view_t * p_mlv,
- int index,
- libvlc_exception_t * p_e );
-
-VLC_PUBLIC_API libvlc_media_list_view_t *
- libvlc_media_list_view_children_for_item( libvlc_media_list_view_t * p_mlv,
- libvlc_media_t * p_md,
- libvlc_exception_t * p_e );
-
-VLC_PUBLIC_API libvlc_media_list_t *
- libvlc_media_list_view_parent_media_list( libvlc_media_list_view_t * p_mlv,
- libvlc_exception_t * p_e );
-
-/** @} media_list_view */
-
-# ifdef __cplusplus
-}
-# endif
-
-#endif /* LIBVLC_MEDIA_LIST_VIEW_H */
#include <vlc/libvlc_media.h>
#include <vlc/libvlc_media_player.h>
#include <vlc/libvlc_media_list.h>
-#include <vlc/libvlc_media_list_view.h>
#include <vlc/libvlc_media_list_player.h>
#include <vlc/libvlc_media_library.h>
#include <vlc/libvlc_media_discoverer.h>
src/control/audio.c
src/control/core.c
src/control/event.c
-src/control/flat_media_list_view.c
-src/control/hierarchical_media_list_view.c
-src/control/hierarchical_node_media_list_view.c
src/control/libvlc_internal.h
src/control/log.c
src/control/media.c
src/control/media_list.c
src/control/media_list_path.h
src/control/media_list_player.c
-src/control/media_list_view.c
src/control/media_player.c
src/control/playlist.c
src/control/video.c
../include/vlc/libvlc_media_library.h \
../include/vlc/libvlc_media_list.h \
../include/vlc/libvlc_media_list_player.h \
- ../include/vlc/libvlc_media_list_view.h \
../include/vlc/libvlc_media_player.h \
../include/vlc/libvlc_structures.h \
../include/vlc/libvlc_vlm.h \
control/event_internal.h \
control/media_internal.h \
control/media_list_internal.h \
- control/media_list_view_internal.h \
control/media_player_internal.h \
control/core.c \
control/error.c \
control/audio.c \
control/event.c \
control/event_async.c \
- control/flat_media_list_view.c \
- control/hierarchical_media_list_view.c \
- control/hierarchical_node_media_list_view.c \
control/media.c \
control/media_player.c \
control/media_list.c \
control/media_list_path.h \
control/media_list_player.c \
- control/media_list_view.c \
control/media_library.c \
control/mediacontrol_internal.h \
control/mediacontrol_core.c \
+++ /dev/null
-/*****************************************************************************
- * flat_media_list_view.c: libvlc flat media list view functions.
- *****************************************************************************
- * Copyright (C) 2007 the VideoLAN team
- * $Id$
- *
- * Authors: Pierre d'Herbemont <pdherbemont # videolan.org>
- *
- * 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.
- *
- * 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
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include <assert.h>
-
-#include <vlc/libvlc.h>
-#include <vlc/libvlc_media.h>
-#include <vlc/libvlc_media_list.h>
-#include <vlc/libvlc_media_list_view.h>
-
-#include "media_list_view_internal.h"
-
-
-//#define DEBUG_FLAT_VIEW
-
-#ifdef DEBUG_FLAT_VIEW
-# define trace( fmt, ... ) printf( "%s(): " fmt, __FUNCTION__, ##__VA_ARGS__ )
-#else
-# define trace( ... )
-#endif
-
-struct libvlc_media_list_view_private_t
-{
- vlc_array_t array;
-};
-
-/*
- * Private functions
- */
-
-/**************************************************************************
- * ml_item_added (private) (Callback from media_list_view item_added)
- **************************************************************************/
-static void
-ml_item_added( const libvlc_event_t * p_event, libvlc_media_list_view_t * p_mlv )
-{
- int index = vlc_array_count( &p_mlv->p_this_view_data->array );
- libvlc_media_t * p_md = p_event->u.media_list_item_added.item;
- libvlc_media_retain( p_md );
- trace("appending item at index %d\n", index);
-
- libvlc_media_list_view_will_add_item( p_mlv, p_md, index );
- vlc_array_append( &p_mlv->p_this_view_data->array, p_md );
- libvlc_media_list_view_item_added( p_mlv, p_md, index );
-}
-
-/**************************************************************************
- * ml_item_removed (private) (Callback from media_list_view)
- **************************************************************************/
-static void
-ml_item_removed( const libvlc_event_t * p_event, libvlc_media_list_view_t * p_mlv )
-{
- libvlc_media_t * p_md = p_event->u.media_list_item_deleted.item;
- int i = vlc_array_index_of_item( &p_mlv->p_this_view_data->array, p_md );
- if( i >= 0 )
- {
- libvlc_media_list_view_will_delete_item( p_mlv, p_md, i );
- vlc_array_remove( &p_mlv->p_this_view_data->array, i );
- libvlc_media_list_view_item_deleted( p_mlv, p_md, i );
- libvlc_media_release( p_md );
- }
-}
-
-/**************************************************************************
- * flat_media_list_view_count (private)
- * (called by media_list_view_count)
- **************************************************************************/
-static int
-flat_media_list_view_count( libvlc_media_list_view_t * p_mlv,
- libvlc_exception_t * p_e )
-{
- (void)p_e;
- return vlc_array_count( &p_mlv->p_this_view_data->array );
-}
-
-/**************************************************************************
- * flat_media_list_view_item_at_index (private)
- * (called by flat_media_list_view_item_at_index)
- **************************************************************************/
-static libvlc_media_t *
-flat_media_list_view_item_at_index( libvlc_media_list_view_t * p_mlv,
- int index,
- libvlc_exception_t * p_e )
-{
- libvlc_media_t * p_md;
- (void)p_e;
- p_md = vlc_array_item_at_index( &p_mlv->p_this_view_data->array, index );
- libvlc_media_retain( p_md );
- return p_md;
-}
-
-/**************************************************************************
- * flat_media_list_view_item_at_index (private)
- * (called by flat_media_list_view_item_at_index)
- **************************************************************************/
-static libvlc_media_list_view_t *
-flat_media_list_view_children_at_index( libvlc_media_list_view_t * p_mlv,
- int index,
- libvlc_exception_t * p_e )
-{
- (void)p_mlv; (void)index; (void)p_e;
- return NULL;
-}
-
-/**************************************************************************
- * flat_media_list_view_release (private)
- * (called by media_list_view_release)
- **************************************************************************/
-static void
-flat_media_list_view_release( libvlc_media_list_view_t * p_mlv )
-{
- vlc_array_clear( &p_mlv->p_this_view_data->array );
- free( p_mlv->p_this_view_data );
-}
-
-/*
- * Public libvlc functions
- */
-
-/* Little helper */
-static void
-import_mlist_rec( libvlc_media_list_view_t * p_mlv,
- libvlc_media_list_t * p_mlist,
- libvlc_exception_t * p_e )
-{
- int i, count;
- count = libvlc_media_list_count( p_mlist );
- for( i = 0; i < count; i++ )
- {
- libvlc_media_t * p_md;
- libvlc_media_list_t * p_submlist;
- p_md = libvlc_media_list_item_at_index( p_mlist, i, p_e );
- vlc_array_append( &p_mlv->p_this_view_data->array, p_md );
- p_submlist = libvlc_media_subitems( p_md );
- if( p_submlist )
- {
- libvlc_media_list_lock( p_submlist );
- import_mlist_rec( p_mlv, p_submlist, p_e );
- libvlc_media_list_unlock( p_submlist );
- libvlc_media_list_release( p_submlist );
- }
- /* No need to release the md, as we want to retain it, as it is
- * stored in our array */
- }
-}
-
-/**************************************************************************
- * libvlc_media_list_flat_view (Public)
- **************************************************************************/
-libvlc_media_list_view_t *
-libvlc_media_list_flat_view( libvlc_media_list_t * p_mlist,
- libvlc_exception_t * p_e )
-{
- trace("\n");
- libvlc_media_list_view_t * p_mlv;
- struct libvlc_media_list_view_private_t * p_this_view_data;
- p_this_view_data = malloc(sizeof(struct libvlc_media_list_view_private_t));
- vlc_array_init( &p_this_view_data->array );
- p_mlv = libvlc_media_list_view_new( p_mlist,
- flat_media_list_view_count,
- flat_media_list_view_item_at_index,
- flat_media_list_view_children_at_index,
- libvlc_media_list_flat_view,
- flat_media_list_view_release,
- p_this_view_data );
- libvlc_media_list_lock( p_mlist );
- import_mlist_rec( p_mlv, p_mlist, p_e );
- libvlc_media_list_view_set_ml_notification_callback( p_mlv,
- ml_item_added,
- ml_item_removed );
- libvlc_media_list_unlock( p_mlist );
-
- return p_mlv;
-}
+++ /dev/null
-/*****************************************************************************
- * hierarchical_media_list_view.c: libvlc hierarchical media list view functs.
- *****************************************************************************
- * Copyright (C) 2007 the VideoLAN team
- * $Id$
- *
- * Authors: Pierre d'Herbemont <pdherbemont # videolan.org>
- *
- * 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.
- *
- * 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
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include <vlc/libvlc.h>
-#include <vlc/libvlc_media.h>
-#include <vlc/libvlc_media_list.h>
-#include <vlc/libvlc_media_list_view.h>
-
-#include "media_list_internal.h"
-#include "media_list_view_internal.h"
-
-//#define DEBUG_HIERARCHICAL_VIEW
-
-#ifdef DEBUG_HIERARCHICAL_VIEW
-# define trace( fmt, ... ) printf( "%s(): " fmt, __FUNCTION__, ##__VA_ARGS__ )
-#else
-# define trace( ... )
-#endif
-
-/*
- * Private functions
- */
-
-/**************************************************************************
- * flat_media_list_view_count (private)
- * (called by media_list_view_count)
- **************************************************************************/
-static int
-hierarch_media_list_view_count( libvlc_media_list_view_t * p_mlv,
- libvlc_exception_t * p_e )
-{
- VLC_UNUSED(p_e);
- return libvlc_media_list_count( p_mlv->p_mlist );
-}
-
-/**************************************************************************
- * flat_media_list_view_item_at_index (private)
- * (called by flat_media_list_view_item_at_index)
- **************************************************************************/
-static libvlc_media_t *
-hierarch_media_list_view_item_at_index( libvlc_media_list_view_t * p_mlv,
- int index,
- libvlc_exception_t * p_e )
-{
- return libvlc_media_list_item_at_index( p_mlv->p_mlist, index, p_e );
-}
-
-/**************************************************************************
- * flat_media_list_view_item_at_index (private)
- * (called by flat_media_list_view_item_at_index)
- **************************************************************************/
-static libvlc_media_list_view_t *
-hierarch_media_list_view_children_at_index( libvlc_media_list_view_t * p_mlv,
- int index,
- libvlc_exception_t * p_e )
-{
- libvlc_media_t * p_md;
- libvlc_media_list_t * p_submlist;
- libvlc_media_list_view_t * p_ret;
- p_md = libvlc_media_list_item_at_index( p_mlv->p_mlist, index, p_e );
- if( !p_md ) return NULL;
- p_submlist = libvlc_media_subitems( p_md );
- libvlc_media_release( p_md );
- if( !p_submlist ) return NULL;
- p_ret = libvlc_media_list_hierarchical_view( p_submlist );
- libvlc_media_list_release( p_submlist );
-
- return p_ret;
-}
-
-/**************************************************************************
- * media_list_(item|will)_* (private) (Event callback)
- **************************************************************************/
-static void
-media_list_item_added( const libvlc_event_t * p_event, void * user_data )
-{
- libvlc_media_t * p_md;
- libvlc_media_list_view_t * p_mlv = user_data;
- int index = p_event->u.media_list_item_added.index;
- p_md = p_event->u.media_list_item_added.item;
- libvlc_media_list_view_item_added( p_mlv, p_md, index );
-}
-static void
-media_list_will_add_item( const libvlc_event_t * p_event, void * user_data )
-{
- libvlc_media_t * p_md;
- libvlc_media_list_view_t * p_mlv = user_data;
- int index = p_event->u.media_list_will_add_item.index;
- p_md = p_event->u.media_list_will_add_item.item;
- libvlc_media_list_view_will_add_item( p_mlv, p_md, index );
-}
-static void
-media_list_item_deleted( const libvlc_event_t * p_event, void * user_data )
-{
- libvlc_media_t * p_md;
- libvlc_media_list_view_t * p_mlv = user_data;
- int index = p_event->u.media_list_item_deleted.index;
- p_md = p_event->u.media_list_item_deleted.item;
- libvlc_media_list_view_item_deleted( p_mlv, p_md, index );
-}
-static void
-media_list_will_delete_item( const libvlc_event_t * p_event, void * user_data )
-{
- libvlc_media_t * p_md;
- libvlc_media_list_view_t * p_mlv = user_data;
- int index = p_event->u.media_list_will_delete_item.index;
- p_md = p_event->u.media_list_will_delete_item.item;
- libvlc_media_list_view_will_delete_item( p_mlv, p_md, index );
-}
-
-/*
- * Public libvlc functions
- */
-
-
-/**************************************************************************
- * flat_media_list_view_release (private)
- * (called by media_list_view_release)
- **************************************************************************/
-static void
-hierarch_media_list_view_release( libvlc_media_list_view_t * p_mlv )
-{
- libvlc_event_detach( p_mlv->p_mlist->p_event_manager,
- libvlc_MediaListItemAdded,
- media_list_item_added, p_mlv );
- libvlc_event_detach( p_mlv->p_mlist->p_event_manager,
- libvlc_MediaListWillAddItem,
- media_list_will_add_item, p_mlv );
- libvlc_event_detach( p_mlv->p_mlist->p_event_manager,
- libvlc_MediaListItemDeleted,
- media_list_item_deleted, p_mlv );
- libvlc_event_detach( p_mlv->p_mlist->p_event_manager,
- libvlc_MediaListWillDeleteItem,
- media_list_will_delete_item, p_mlv );
-}
-
-/**************************************************************************
- * libvlc_media_list_flat_view (Public)
- **************************************************************************/
-libvlc_media_list_view_t *
-libvlc_media_list_hierarchical_view( libvlc_media_list_t * p_mlist )
-{
- trace("\n");
- libvlc_media_list_view_t * p_mlv;
- p_mlv = libvlc_media_list_view_new( p_mlist,
- hierarch_media_list_view_count,
- hierarch_media_list_view_item_at_index,
- hierarch_media_list_view_children_at_index,
- libvlc_media_list_hierarchical_view,
- hierarch_media_list_view_release,
- NULL );
- libvlc_media_list_lock( p_mlist );
- libvlc_event_attach( p_mlv->p_mlist->p_event_manager,
- libvlc_MediaListItemAdded,
- media_list_item_added, p_mlv );
- libvlc_event_attach( p_mlv->p_mlist->p_event_manager,
- libvlc_MediaListWillAddItem,
- media_list_will_add_item, p_mlv );
- libvlc_event_attach( p_mlv->p_mlist->p_event_manager,
- libvlc_MediaListItemDeleted,
- media_list_item_deleted, p_mlv );
- libvlc_event_attach( p_mlv->p_mlist->p_event_manager,
- libvlc_MediaListWillDeleteItem,
- media_list_will_delete_item, p_mlv );
- libvlc_media_list_unlock( p_mlist );
- return p_mlv;
-}
+++ /dev/null
-/*****************************************************************************
- * hierarchical_node_media_list_view.c: libvlc hierarchical nodes media list
- * view functs.
- *****************************************************************************
- * Copyright (C) 2007 the VideoLAN team
- * $Id$
- *
- * Authors: Pierre d'Herbemont <pdherbemont # videolan.org>
- *
- * 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.
- *
- * 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
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include <vlc/libvlc.h>
-#include <vlc/libvlc_media.h>
-#include <vlc/libvlc_media_list.h>
-#include <vlc/libvlc_media_list_view.h>
-
-#include "media_internal.h" // Abuse, could ans should be removed
-#include "media_list_internal.h" // Abuse, could ans should be removed
-#include "media_list_view_internal.h"
-
-/* FIXME: This version is probably a bit overheaded, and we may want to store
- * the items in a vlc_array_t to speed everything up */
-
-//#define DEBUG_HIERARCHICAL_VIEW
-
-#ifdef DEBUG_HIERARCHICAL_VIEW
-# define trace( fmt, ... ) printf( "[HIERARCHICAL_NODE] %s(): " fmt, __FUNCTION__, ##__VA_ARGS__ )
-#else
-# define trace( ... ) {}
-#endif
-
-/*
- * Private functions
- */
-
-/**************************************************************************
- * flat_media_list_view_count (private)
- * (called by media_list_view_count)
- **************************************************************************/
-static int
-hierarch_node_media_list_view_count( libvlc_media_list_view_t * p_mlv,
- libvlc_exception_t * p_e )
-{
- /* FIXME: we may want to cache that */
- int i, ret, count = libvlc_media_list_count( p_mlv->p_mlist );
- libvlc_media_t * p_md;
- libvlc_media_list_t * p_submlist;
- ret = 0;
- trace("\n");
- for( i = 0; i < count; i++ )
- {
- p_md = libvlc_media_list_item_at_index( p_mlv->p_mlist, i, p_e );
- if( !p_md ) continue;
- p_submlist = libvlc_media_subitems( p_md );
- if( !p_submlist ) continue;
- libvlc_media_release( p_md );
- libvlc_media_list_release( p_submlist );
- ret++;
- }
- return ret;
-}
-
-/**************************************************************************
- * flat_media_list_view_item_at_index (private)
- * (called by flat_media_list_view_item_at_index)
- **************************************************************************/
-static libvlc_media_t *
-hierarch_node_media_list_view_item_at_index( libvlc_media_list_view_t * p_mlv,
- int index,
- libvlc_exception_t * p_e )
-{
- /* FIXME: we may want to cache that */
- libvlc_media_t * p_md;
- libvlc_media_list_t * p_submlist;
- trace("%d\n", index);
- int i, current_index, count = libvlc_media_list_count( p_mlv->p_mlist );
- current_index = -1;
- for( i = 0; i < count; i++ )
- {
- p_md = libvlc_media_list_item_at_index( p_mlv->p_mlist, i, p_e );
- if( !p_md ) continue;
- p_submlist = libvlc_media_subitems( p_md );
- if( !p_submlist ) continue;
- libvlc_media_list_release( p_submlist );
- current_index++;
- if( current_index == index )
- return p_md;
- libvlc_media_release( p_md );
- }
-
- libvlc_exception_raise( p_e );
- libvlc_printerr( "Index out of bound in Media List View" );
- return NULL;
-}
-
-/**************************************************************************
- * flat_media_list_view_item_at_index (private)
- * (called by flat_media_list_view_item_at_index)
- **************************************************************************/
-static libvlc_media_list_view_t *
-hierarch_node_media_list_view_children_at_index( libvlc_media_list_view_t * p_mlv,
- int index,
- libvlc_exception_t * p_e )
-{
- libvlc_media_t * p_md;
- libvlc_media_list_t * p_submlist;
- libvlc_media_list_view_t * p_ret;
- p_md = hierarch_node_media_list_view_item_at_index( p_mlv, index, p_e );
- if( !p_md ) return NULL;
- p_submlist = libvlc_media_subitems( p_md );
- libvlc_media_release( p_md );
- if( !p_submlist ) return NULL;
- p_ret = libvlc_media_list_hierarchical_node_view( p_submlist );
- libvlc_media_list_release( p_submlist );
-
- return p_ret;
-}
-
-/* Helper */
-static int
-index_of_item( libvlc_media_list_view_t * p_mlv, libvlc_media_t * p_md )
-{
- libvlc_media_t * p_iter_md;
- libvlc_media_list_t * p_submlist;
-
- int i, current_index, count = libvlc_media_list_count( p_mlv->p_mlist );
- current_index = -1;
- for( i = 0; i < count; i++ )
- {
- p_iter_md = libvlc_media_list_item_at_index( p_mlv->p_mlist, i, NULL );
- if( !p_iter_md ) continue;
- p_submlist = libvlc_media_subitems( p_iter_md );
- if( !p_submlist ) continue;
- libvlc_media_list_release( p_submlist );
- libvlc_media_release( p_iter_md );
- current_index++;
- if( p_md == p_iter_md )
- return current_index;
- }
- return -1;
-}
-
-static bool
-item_is_already_added( libvlc_media_t * p_md )
-{
- libvlc_media_list_t * p_submlist;
-
- p_submlist = libvlc_media_subitems( p_md );
- if( !p_submlist ) return false;
- int count = libvlc_media_list_count( p_submlist );
- libvlc_media_list_release( p_submlist );
- return count > 1;
-}
-
-
-/**************************************************************************
- * media_list_(item|will)_* (private) (Event callback)
- **************************************************************************/
-static void
-items_subitems_added( const libvlc_event_t * p_event, void * user_data )
-{
- libvlc_media_t * p_md;
- libvlc_media_list_view_t * p_mlv = user_data;
- int index;
- p_md = p_event->p_obj;
- if( !item_is_already_added( p_md ) )
- {
- index = index_of_item( p_mlv, p_md );
- trace("%d\n", index);
- if( index >= 0 )
- {
- libvlc_media_list_view_will_add_item( p_mlv, p_md, index );
- libvlc_media_list_view_item_added( p_mlv, p_md, index );
- }
- }
- else
- {
- trace("item already added\n");
- }
-}
-
-static void
-media_list_item_added( const libvlc_event_t * p_event, void * user_data )
-{
- libvlc_media_t * p_md;
- libvlc_media_list_view_t * p_mlv = user_data;
- int index;
- p_md = p_event->u.media_list_item_added.item;
- index = index_of_item( p_mlv, p_md );
- trace("%d\n", index);
- if( index >= 0)
- libvlc_media_list_view_item_added( p_mlv, p_md, index );
- libvlc_event_attach( p_md->p_event_manager, libvlc_MediaSubItemAdded,
- items_subitems_added, p_mlv );
-
-}
-static void
-media_list_will_add_item( const libvlc_event_t * p_event, void * user_data )
-{
- libvlc_media_t * p_md;
- libvlc_media_list_view_t * p_mlv = user_data;
- int index;
- p_md = p_event->u.media_list_will_add_item.item;
- index = index_of_item( p_mlv, p_md );
- trace("%d\n", index);
- if( index >= 0)
- libvlc_media_list_view_will_add_item( p_mlv, p_md, index );
-}
-static void
-media_list_item_deleted( const libvlc_event_t * p_event, void * user_data )
-{
- libvlc_media_t * p_md;
- libvlc_media_list_view_t * p_mlv = user_data;
- int index;
- p_md = p_event->u.media_list_item_deleted.item;
- index = index_of_item( p_mlv, p_md );
- trace("%d\n", index);
- if( index >= 0)
- libvlc_media_list_view_item_deleted( p_mlv, p_md, index );
- libvlc_event_detach( p_md->p_event_manager, libvlc_MediaSubItemAdded,
- items_subitems_added, p_mlv );
-}
-static void
-media_list_will_delete_item( const libvlc_event_t * p_event, void * user_data )
-{
- libvlc_media_t * p_md;
- libvlc_media_list_view_t * p_mlv = user_data;
- int index;
- p_md = p_event->u.media_list_will_delete_item.item;
- index = index_of_item( p_mlv, p_md );
- trace("%d\n", index);
- if( index >= 0)
- libvlc_media_list_view_will_delete_item( p_mlv, p_md, index );
-}
-
-
-/*
- * Public libvlc functions
- */
-
-
-/**************************************************************************
- * flat_media_list_view_release (private)
- * (called by media_list_view_release)
- **************************************************************************/
-static void
-hierarch_node_media_list_view_release( libvlc_media_list_view_t * p_mlv )
-{
- trace("\n");
- libvlc_event_detach( p_mlv->p_mlist->p_event_manager,
- libvlc_MediaListItemAdded,
- media_list_item_added, p_mlv );
- libvlc_event_detach( p_mlv->p_mlist->p_event_manager,
- libvlc_MediaListWillAddItem,
- media_list_will_add_item, p_mlv );
- libvlc_event_detach( p_mlv->p_mlist->p_event_manager,
- libvlc_MediaListItemDeleted,
- media_list_item_deleted, p_mlv );
- libvlc_event_detach( p_mlv->p_mlist->p_event_manager,
- libvlc_MediaListWillDeleteItem,
- media_list_will_delete_item, p_mlv );
-}
-
-/**************************************************************************
- * libvlc_media_list_flat_view (Public)
- **************************************************************************/
-libvlc_media_list_view_t *
-libvlc_media_list_hierarchical_node_view( libvlc_media_list_t * p_mlist )
-{
- trace("\n");
- libvlc_media_list_view_t * p_mlv;
- p_mlv = libvlc_media_list_view_new( p_mlist,
- hierarch_node_media_list_view_count,
- hierarch_node_media_list_view_item_at_index,
- hierarch_node_media_list_view_children_at_index,
- libvlc_media_list_hierarchical_node_view,
- hierarch_node_media_list_view_release,
- NULL );
- libvlc_media_list_lock( p_mlist );
- libvlc_event_attach( p_mlv->p_mlist->p_event_manager,
- libvlc_MediaListItemAdded,
- media_list_item_added, p_mlv );
- libvlc_event_attach( p_mlv->p_mlist->p_event_manager,
- libvlc_MediaListWillAddItem,
- media_list_will_add_item, p_mlv );
- libvlc_event_attach( p_mlv->p_mlist->p_event_manager,
- libvlc_MediaListItemDeleted,
- media_list_item_deleted, p_mlv );
- libvlc_event_attach( p_mlv->p_mlist->p_event_manager,
- libvlc_MediaListWillDeleteItem,
- media_list_will_delete_item, p_mlv );
- libvlc_media_list_unlock( p_mlist );
- return p_mlv;
-}
+++ /dev/null
-/*****************************************************************************
- * flat_media_list.c: libvlc flat media list functions. (extension to
- * media_list.c).
- *****************************************************************************
- * Copyright (C) 2007 the VideoLAN team
- * $Id$
- *
- * Authors: Pierre d'Herbemont <pdherbemont # videolan.org>
- *
- * 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.
- *
- * 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
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include <vlc/libvlc.h>
-#include <vlc/libvlc_media.h>
-#include <vlc/libvlc_media_list.h>
-#include <vlc/libvlc_media_list_view.h>
-#include <vlc/libvlc_events.h>
-
-#include "libvlc_internal.h" // Abuse, could and should be removed
-
-#include "media_internal.h" // Abuse, could and should be removed
-#include "media_list_internal.h" // Abuse, could and should be removed
-#include "media_list_view_internal.h"
-
-//#define DEBUG_FLAT_LIST
-
-#ifdef DEBUG_FLAT_LIST
-# define trace( fmt, ... ) printf( "%s(): " fmt, __FUNCTION__, ##__VA_ARGS__ )
-#else
-# define trace( ... )
-#endif
-
-/*
- * Private functions
- */
-static void
-media_list_item_added( const libvlc_event_t * p_event, void * p_user_data );
-static void
-media_list_item_removed( const libvlc_event_t * p_event, void * p_user_data );
-static void
-media_list_subitem_added( const libvlc_event_t * p_event, void * p_user_data );
-
-static void
-install_md_listener( libvlc_media_list_view_t * p_mlv,
- libvlc_media_t * p_md)
-{
- libvlc_media_list_t * p_mlist;
- if((p_mlist = libvlc_media_subitems( p_md )))
- {
- libvlc_media_list_lock( p_mlist );
- int i, count = libvlc_media_list_count( p_mlist );
- for( i = 0; i < count; i++)
- {
- libvlc_event_t added_event;
- libvlc_media_t * p_submd;
- p_submd = libvlc_media_list_item_at_index( p_mlist, i, NULL );
-
- /* Install our listeners */
- install_md_listener( p_mlv, p_submd );
-
- /* For each item, send a notification to the mlv subclasses */
- added_event.u.media_list_item_added.item = p_submd;
- added_event.u.media_list_item_added.index = 0;
- if( p_mlv->pf_ml_item_added ) p_mlv->pf_ml_item_added( &added_event, p_mlv );
- libvlc_media_release( p_submd );
- }
- libvlc_event_attach( p_mlist->p_event_manager,
- libvlc_MediaListItemAdded,
- media_list_item_added, p_mlv );
- libvlc_event_attach( p_mlist->p_event_manager,
- libvlc_MediaListItemDeleted,
- media_list_item_removed, p_mlv );
- libvlc_media_list_unlock( p_mlist );
- libvlc_media_list_release( p_mlist );
- }
- else
- {
- /* No mlist, wait for a subitem added event */
- libvlc_event_attach( p_md->p_event_manager,
- libvlc_MediaSubItemAdded,
- media_list_subitem_added, p_mlv );
- }
-}
-
-static void
-uninstall_md_listener( libvlc_media_list_view_t * p_mlv,
- libvlc_media_t * p_md)
-{
- libvlc_media_list_t * p_mlist;
- libvlc_event_detach( p_md->p_event_manager,
- libvlc_MediaSubItemAdded,
- media_list_subitem_added, p_mlv );
- if((p_mlist = libvlc_media_subitems( p_md )))
- {
- libvlc_media_list_lock( p_mlist );
- libvlc_event_detach( p_mlist->p_event_manager,
- libvlc_MediaListItemAdded,
- media_list_item_added, p_mlv );
- libvlc_event_detach( p_mlist->p_event_manager,
- libvlc_MediaListItemDeleted,
- media_list_item_removed, p_mlv );
-
- int i, count = libvlc_media_list_count( p_mlist );
- for( i = 0; i < count; i++)
- {
- libvlc_media_t * p_submd;
- p_submd = libvlc_media_list_item_at_index( p_mlist,i, NULL );
- uninstall_md_listener( p_mlv, p_submd );
- libvlc_media_release( p_submd );
- }
- libvlc_media_list_unlock( p_mlist );
- libvlc_media_list_release( p_mlist );
- }
-}
-
-static void
-media_list_item_added( const libvlc_event_t * p_event, void * p_user_data )
-{
- libvlc_media_list_view_t * p_mlv = p_user_data;
- libvlc_media_t * p_md = p_event->u.media_list_item_added.item;
- install_md_listener( p_mlv, p_md );
- if( p_mlv->pf_ml_item_added ) p_mlv->pf_ml_item_added( p_event, p_mlv );
-}
-
-static void
-media_list_item_removed( const libvlc_event_t * p_event, void * p_user_data )
-{
- libvlc_media_list_view_t * p_mlv = p_user_data;
- libvlc_media_t * p_md = p_event->u.media_list_item_added.item;
- uninstall_md_listener( p_mlv, p_md );
- if( p_mlv->pf_ml_item_removed ) p_mlv->pf_ml_item_removed( p_event, p_mlv );
-}
-
-static void
-media_list_subitem_added( const libvlc_event_t * p_event, void * p_user_data )
-{
- libvlc_media_list_t * p_mlist;
- libvlc_event_t added_event;
- libvlc_media_list_view_t * p_mlv = p_user_data;
- libvlc_media_t * p_submd = p_event->u.media_subitem_added.new_child;
- libvlc_media_t * p_md = p_event->p_obj;
-
- if((p_mlist = libvlc_media_subitems( p_md )))
- {
- /* We have a mlist to which we're going to listen to events
- * thus, no need to wait for SubItemAdded events */
- libvlc_event_detach( p_md->p_event_manager,
- libvlc_MediaSubItemAdded,
- media_list_subitem_added, p_mlv );
- libvlc_media_list_lock( p_mlist );
-
- libvlc_event_attach( p_mlist->p_event_manager,
- libvlc_MediaListItemAdded,
- media_list_item_added, p_mlv );
- libvlc_event_attach( p_mlist->p_event_manager,
- libvlc_MediaListItemDeleted,
- media_list_item_removed, p_mlv );
- libvlc_media_list_unlock( p_mlist );
- libvlc_media_list_release( p_mlist );
- }
-
- install_md_listener( p_mlv, p_submd );
-
- added_event.u.media_list_item_added.item = p_submd;
- added_event.u.media_list_item_added.index = 0;
- if( p_mlv->pf_ml_item_added ) p_mlv->pf_ml_item_added( &added_event, p_mlv );
-}
-
-/*
- * LibVLC Internal functions
- */
-/**************************************************************************
- * libvlc_media_list_view_set_ml_notification_callback (Internal)
- * The mlist lock should be held when entered
- **************************************************************************/
-void
-libvlc_media_list_view_set_ml_notification_callback(
- libvlc_media_list_view_t * p_mlv,
- void (*item_added)(const libvlc_event_t *, libvlc_media_list_view_t *),
- void (*item_removed)(const libvlc_event_t *, libvlc_media_list_view_t *) )
-{
- p_mlv->pf_ml_item_added = item_added;
- p_mlv->pf_ml_item_removed = item_removed;
- libvlc_event_attach( p_mlv->p_mlist->p_event_manager,
- libvlc_MediaListItemAdded,
- media_list_item_added, p_mlv );
- libvlc_event_attach( p_mlv->p_mlist->p_event_manager,
- libvlc_MediaListItemDeleted,
- media_list_item_removed, p_mlv );
- int i, count = libvlc_media_list_count( p_mlv->p_mlist );
- for( i = 0; i < count; i++)
- {
- libvlc_media_t * p_md;
- p_md = libvlc_media_list_item_at_index( p_mlv->p_mlist, i, NULL );
- install_md_listener( p_mlv, p_md );
- libvlc_media_release( p_md );
- }
-}
-
-/**************************************************************************
- * libvlc_media_list_view_notify_deletion (Internal)
- **************************************************************************/
-void
-libvlc_media_list_view_will_delete_item(
- libvlc_media_list_view_t * p_mlv,
- libvlc_media_t * p_item,
- int index )
-{
- libvlc_event_t event;
-
- /* Construct the event */
- event.type = libvlc_MediaListViewWillDeleteItem;
- event.u.media_list_view_will_delete_item.item = p_item;
- event.u.media_list_view_will_delete_item.index = index;
-
- /* Send the event */
- libvlc_event_send( p_mlv->p_event_manager, &event );
-}
-
-/**************************************************************************
- * libvlc_media_list_view_item_deleted (Internal)
- **************************************************************************/
-void
-libvlc_media_list_view_item_deleted(
- libvlc_media_list_view_t * p_mlv,
- libvlc_media_t * p_item,
- int index )
-{
- libvlc_event_t event;
-
- /* Construct the event */
- event.type = libvlc_MediaListViewItemDeleted;
- event.u.media_list_view_item_deleted.item = p_item;
- event.u.media_list_view_item_deleted.index = index;
-
- /* Send the event */
- libvlc_event_send( p_mlv->p_event_manager, &event );
-}
-
-/**************************************************************************
- * libvlc_media_list_view_will_add_item (Internal)
- **************************************************************************/
-void
-libvlc_media_list_view_will_add_item(
- libvlc_media_list_view_t * p_mlv,
- libvlc_media_t * p_item,
- int index )
-{
- libvlc_event_t event;
-
- /* Construct the event */
- event.type = libvlc_MediaListViewWillAddItem;
- event.u.media_list_view_will_add_item.item = p_item;
- event.u.media_list_view_will_add_item.index = index;
-
- /* Send the event */
- libvlc_event_send( p_mlv->p_event_manager, &event );
-}
-
-/**************************************************************************
- * libvlc_media_list_view_item_added (Internal)
- **************************************************************************/
-void
-libvlc_media_list_view_item_added(
- libvlc_media_list_view_t * p_mlv,
- libvlc_media_t * p_item,
- int index )
-{
- libvlc_event_t event;
-
- /* Construct the event */
- event.type = libvlc_MediaListViewItemAdded;
- event.u.media_list_view_item_added.item = p_item;
- event.u.media_list_view_item_added.index = index;
-
- /* Send the event */
- libvlc_event_send( p_mlv->p_event_manager, &event );
-}
-
-/**************************************************************************
- * libvlc_media_list_view_new (Internal)
- **************************************************************************/
-libvlc_media_list_view_t *
-libvlc_media_list_view_new( libvlc_media_list_t * p_mlist,
- libvlc_media_list_view_count_func_t pf_count,
- libvlc_media_list_view_item_at_index_func_t pf_item_at_index,
- libvlc_media_list_view_children_at_index_func_t pf_children_at_index,
- libvlc_media_list_view_constructor_func_t pf_constructor,
- libvlc_media_list_view_release_func_t pf_release,
- void * this_view_data )
-{
- libvlc_media_list_view_t * p_mlv;
- p_mlv = calloc( 1, sizeof(libvlc_media_list_view_t) );
- if( unlikely(p_mlv == NULL) )
- {
- libvlc_printerr( "Not enough memory" );
- return NULL;
- }
-
- p_mlv->p_libvlc_instance = p_mlist->p_libvlc_instance;
- p_mlv->p_event_manager = libvlc_event_manager_new( p_mlist,
- p_mlv->p_libvlc_instance );
- if( unlikely(p_mlv->p_event_manager == NULL) )
- {
- free(p_mlv);
- return NULL;
- }
-
- libvlc_event_manager_register_event_type( p_mlv->p_event_manager,
- libvlc_MediaListViewItemAdded );
- libvlc_event_manager_register_event_type( p_mlv->p_event_manager,
- libvlc_MediaListViewWillAddItem );
- libvlc_event_manager_register_event_type( p_mlv->p_event_manager,
- libvlc_MediaListViewItemDeleted );
- libvlc_event_manager_register_event_type( p_mlv->p_event_manager,
- libvlc_MediaListViewWillDeleteItem );
-
- libvlc_media_list_retain( p_mlist );
- p_mlv->p_mlist = p_mlist;
-
- p_mlv->pf_count = pf_count;
- p_mlv->pf_item_at_index = pf_item_at_index;
- p_mlv->pf_children_at_index = pf_children_at_index;
- p_mlv->pf_constructor = pf_constructor;
- p_mlv->pf_release = pf_release;
-
- p_mlv->p_this_view_data = this_view_data;
-
- vlc_mutex_init( &p_mlv->object_lock );
- p_mlv->i_refcount = 1;
-
- return p_mlv;
-}
-
-
-/*
- * Public libvlc functions
- */
-
-/**************************************************************************
- * libvlc_media_list_view_retain (Public)
- **************************************************************************/
-void
-libvlc_media_list_view_retain( libvlc_media_list_view_t * p_mlv )
-{
- vlc_mutex_lock( &p_mlv->object_lock );
- p_mlv->i_refcount++;
- vlc_mutex_unlock( &p_mlv->object_lock );
-}
-
-/**************************************************************************
- * libvlc_media_list_view_release (Public)
- **************************************************************************/
-void
-libvlc_media_list_view_release( libvlc_media_list_view_t * p_mlv )
-{
- vlc_mutex_lock( &p_mlv->object_lock );
- p_mlv->i_refcount--;
- if( p_mlv->i_refcount > 0 )
- {
- vlc_mutex_unlock( &p_mlv->object_lock );
- return;
- }
- vlc_mutex_unlock( &p_mlv->object_lock );
-
- /* Refcount null, time to free */
- libvlc_media_list_lock( p_mlv->p_mlist );
-
- if( p_mlv->pf_ml_item_added )
- {
- libvlc_event_detach( p_mlv->p_mlist->p_event_manager,
- libvlc_MediaListItemAdded,
- media_list_item_added, p_mlv );
- }
- if( p_mlv->pf_ml_item_removed )
- {
- libvlc_event_detach( p_mlv->p_mlist->p_event_manager,
- libvlc_MediaListItemDeleted,
- media_list_item_removed, p_mlv );
- }
- int i, count = libvlc_media_list_count( p_mlv->p_mlist );
- for( i = 0; i < count; i++)
- {
- libvlc_media_t * p_md;
- p_md = libvlc_media_list_item_at_index( p_mlv->p_mlist, i, NULL );
- uninstall_md_listener( p_mlv, p_md );
- libvlc_media_release( p_md );
- }
- libvlc_media_list_unlock( p_mlv->p_mlist );
-
- libvlc_event_manager_release( p_mlv->p_event_manager );
-
- if( p_mlv->pf_release ) p_mlv->pf_release( p_mlv );
- libvlc_media_list_release( p_mlv->p_mlist );
- vlc_mutex_destroy( &p_mlv->object_lock );
-}
-
-/**************************************************************************
- * libvlc_media_list_view_event_manager (Public)
- **************************************************************************/
-libvlc_event_manager_t *
-libvlc_media_list_view_event_manager( libvlc_media_list_view_t * p_mlv )
-{
- libvlc_event_manager_t * p_em;
- vlc_mutex_lock( &p_mlv->object_lock );
- p_em = p_mlv->p_event_manager;
- vlc_mutex_unlock( &p_mlv->object_lock );
- return p_em;
-}
-
-/**************************************************************************
- * libvlc_media_list_view_parent_media_list (Public)
- **************************************************************************/
-libvlc_media_list_t *
-libvlc_media_list_view_parent_media_list( libvlc_media_list_view_t * p_mlv,
- libvlc_exception_t * p_e)
-{
- (void)p_e;
- libvlc_media_list_t * p_mlist;
- vlc_mutex_lock( &p_mlv->object_lock );
- p_mlist = p_mlv->p_mlist;
- libvlc_media_list_retain( p_mlv->p_mlist );
- vlc_mutex_unlock( &p_mlv->object_lock );
- return p_mlist;
-}
-
-/**************************************************************************
- * libvlc_media_list_view_children_for_item (Public)
- **************************************************************************/
-libvlc_media_list_view_t *
-libvlc_media_list_view_children_for_item( libvlc_media_list_view_t * p_mlv,
- libvlc_media_t * p_md,
- libvlc_exception_t * p_e)
-{
- (void)p_e;
- libvlc_media_list_t * p_mlist;
- libvlc_media_list_view_t * ret;
-
- p_mlist = libvlc_media_subitems(p_md);
- if(!p_mlist) return NULL;
-
- ret = p_mlv->pf_constructor( p_mlist, p_e );
- libvlc_media_list_release( p_mlist );
-
- return ret;
-}
-
-/* Limited to four args, because it should be enough */
-
-#define AN_SELECT( collapser, dec1, dec2, dec3, dec4, p, ...) p
-#define ARGS(...) AN_SELECT( collapser, ##__VA_ARGS__, \
- (p_mlv, arg1, arg2, arg3, arg4, p_e), \
- (p_mlv, arg1, arg2, arg3, p_e), \
- (p_mlv, arg1, arg2, p_e), \
- (p_mlv, arg1, p_e), (p_mlv, p_e) )
-
-#define MEDIA_LIST_VIEW_FUNCTION( name, ret_type, default_ret_value, /* Params */ ... ) \
- ret_type \
- libvlc_media_list_view_##name( libvlc_media_list_view_t * p_mlv, \
- ##__VA_ARGS__, \
- libvlc_exception_t * p_e ) \
- { \
- if( p_mlv->pf_##name ) \
- return p_mlv->pf_##name ARGS(__VA_ARGS__) ; \
- libvlc_exception_raise( p_e ); \
- libvlc_printerr( "No '" #name "' method in this media_list_view" ); \
- return default_ret_value;\
- }
-
-#define MEDIA_LIST_VIEW_FUNCTION_VOID_RET( name, /* Params */ ... ) \
- void \
- libvlc_media_list_view_##name( libvlc_media_list_view_t * p_mlv, \
- ##__VA_ARGS__, \
- libvlc_exception_t * p_e ) \
- { \
- if( p_mlv->pf_##name ) \
- { \
- p_mlv->pf_##name ARGS(__VA_ARGS__) ; \
- return; \
- } \
- libvlc_exception_raise( p_e ); \
- libvlc_printerr( "No '" #name "' method in this media_list_view" ); \
- }
-
-
-MEDIA_LIST_VIEW_FUNCTION( count, int, 0 )
-MEDIA_LIST_VIEW_FUNCTION( item_at_index, libvlc_media_t *, NULL, int arg1 )
-MEDIA_LIST_VIEW_FUNCTION( children_at_index, libvlc_media_list_view_t *, NULL, int arg1 )
-
+++ /dev/null
-/*****************************************************************************
- * libvlc_internal.h : Definition of opaque structures for libvlc exported API
- * Also contains some internal utility functions
- *****************************************************************************
- * Copyright (C) 2005-2009 the VideoLAN team
- * $Id$
- *
- * Authors: Clément Stenac <zorglub@videolan.org>
- *
- * 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.
- *
- * 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
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-
-#ifndef LIBVLC_MEDIA_LIST_VIEW_INTERNAL_H
-#define LIBVLC_MEDIA_LIST_VIEW_INTERNAL_H 1
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include <vlc/vlc.h>
-#include <vlc/libvlc_structures.h>
-#include <vlc/libvlc_media_list.h>
-
-#include <vlc_common.h>
-
-typedef libvlc_media_list_view_t * (*libvlc_media_list_view_constructor_func_t)( libvlc_media_list_t * p_mlist, libvlc_exception_t * p_e ) ;
-typedef void (*libvlc_media_list_view_release_func_t)( libvlc_media_list_view_t * p_mlv ) ;
-
-typedef int (*libvlc_media_list_view_count_func_t)( libvlc_media_list_view_t * p_mlv,
- libvlc_exception_t * ) ;
-
-typedef libvlc_media_t *
- (*libvlc_media_list_view_item_at_index_func_t)(
- libvlc_media_list_view_t * p_mlv,
- int index,
- libvlc_exception_t * ) ;
-
-typedef libvlc_media_list_view_t *
- (*libvlc_media_list_view_children_at_index_func_t)(
- libvlc_media_list_view_t * p_mlv,
- int index,
- libvlc_exception_t * ) ;
-
-/* A way to see a media list */
-struct libvlc_media_list_view_t
-{
- libvlc_event_manager_t * p_event_manager;
- libvlc_instance_t * p_libvlc_instance;
- int i_refcount;
- vlc_mutex_t object_lock;
-
- libvlc_media_list_t * p_mlist;
-
- struct libvlc_media_list_view_private_t * p_this_view_data;
-
- /* Accessors */
- libvlc_media_list_view_count_func_t pf_count;
- libvlc_media_list_view_item_at_index_func_t pf_item_at_index;
- libvlc_media_list_view_children_at_index_func_t pf_children_at_index;
-
- libvlc_media_list_view_constructor_func_t pf_constructor;
- libvlc_media_list_view_release_func_t pf_release;
-
- /* Notification callback */
- void (*pf_ml_item_added)(const libvlc_event_t *, libvlc_media_list_view_t *);
- void (*pf_ml_item_removed)(const libvlc_event_t *, libvlc_media_list_view_t *);
-};
-
-/* Media List View */
-libvlc_media_list_view_t * libvlc_media_list_view_new(
- libvlc_media_list_t * p_mlist,
- libvlc_media_list_view_count_func_t pf_count,
- libvlc_media_list_view_item_at_index_func_t pf_item_at_index,
- libvlc_media_list_view_children_at_index_func_t pf_children_at_index,
- libvlc_media_list_view_constructor_func_t pf_constructor,
- libvlc_media_list_view_release_func_t pf_release,
- void * this_view_data );
-
-void libvlc_media_list_view_set_ml_notification_callback(
- libvlc_media_list_view_t * p_mlv,
- void (*item_added)(const libvlc_event_t *, libvlc_media_list_view_t *),
- void (*item_removed)(const libvlc_event_t *, libvlc_media_list_view_t *) );
-
-void libvlc_media_list_view_will_delete_item(
- libvlc_media_list_view_t * p_mlv,
- libvlc_media_t * p_item, int index );
-
-void libvlc_media_list_view_item_deleted(
- libvlc_media_list_view_t * p_mlv,
- libvlc_media_t * p_item, int index );
-
-void libvlc_media_list_view_will_add_item (
- libvlc_media_list_view_t * p_mlv,
- libvlc_media_t * p_item, int index );
-
-void libvlc_media_list_view_item_added(
- libvlc_media_list_view_t * p_mlv,
- libvlc_media_t * p_item, int index );
-
-#endif
libvlc_media_list_add_media
libvlc_media_list_count
libvlc_media_list_event_manager
-libvlc_media_list_flat_view
-libvlc_media_list_hierarchical_node_view
-libvlc_media_list_hierarchical_view
libvlc_media_list_index_of_item
libvlc_media_list_insert_media
libvlc_media_list_is_readonly
libvlc_media_list_retain
libvlc_media_list_set_media
libvlc_media_list_unlock
-libvlc_media_list_view_children_at_index
-libvlc_media_list_view_children_for_item
-libvlc_media_list_view_count
-libvlc_media_list_view_event_manager
-libvlc_media_list_view_item_added
-libvlc_media_list_view_item_at_index
-libvlc_media_list_view_item_deleted
-libvlc_media_list_view_new
-libvlc_media_list_view_parent_media_list
-libvlc_media_list_view_release
-libvlc_media_list_view_retain
-libvlc_media_list_view_set_ml_notification_callback
-libvlc_media_list_view_will_add_item
-libvlc_media_list_view_will_delete_item
libvlc_media_new
libvlc_media_new_as_node
libvlc_media_new_from_input_item
#include <vlc/libvlc_media_library.h>
#include <vlc/libvlc_media_list.h>
#include <vlc/libvlc_media_list_player.h>
-#include <vlc/libvlc_media_list_view.h>
#include <vlc/libvlc_media_player.h>
#include <vlc/libvlc_vlm.h>
#include <vlc/mediacontrol.h>