]> git.sesse.net Git - vlc/blob - src/control/media_list_view_internal.h
Kill one exception
[vlc] / src / control / media_list_view_internal.h
1 /*****************************************************************************
2  * libvlc_internal.h : Definition of opaque structures for libvlc exported API
3  * Also contains some internal utility functions
4  *****************************************************************************
5  * Copyright (C) 2005-2009 the VideoLAN team
6  * $Id$
7  *
8  * Authors: ClĂ©ment Stenac <zorglub@videolan.org>
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23  *****************************************************************************/
24
25 #ifndef LIBVLC_MEDIA_LIST_VIEW_INTERNAL_H
26 #define LIBVLC_MEDIA_LIST_VIEW_INTERNAL_H 1
27
28 #ifdef HAVE_CONFIG_H
29 # include "config.h"
30 #endif
31
32 #include <vlc/vlc.h>
33 #include <vlc/libvlc_structures.h>
34 #include <vlc/libvlc_media_list.h>
35
36 #include <vlc_common.h>
37
38 typedef libvlc_media_list_view_t * (*libvlc_media_list_view_constructor_func_t)( libvlc_media_list_t * p_mlist, libvlc_exception_t * p_e ) ;
39 typedef void (*libvlc_media_list_view_release_func_t)( libvlc_media_list_view_t * p_mlv ) ;
40
41 typedef int (*libvlc_media_list_view_count_func_t)( libvlc_media_list_view_t * p_mlv,
42         libvlc_exception_t * ) ;
43
44 typedef libvlc_media_t *
45         (*libvlc_media_list_view_item_at_index_func_t)(
46                 libvlc_media_list_view_t * p_mlv,
47                 int index,
48                 libvlc_exception_t * ) ;
49
50 typedef libvlc_media_list_view_t *
51         (*libvlc_media_list_view_children_at_index_func_t)(
52                 libvlc_media_list_view_t * p_mlv,
53                 int index,
54                 libvlc_exception_t * ) ;
55
56 /* A way to see a media list */
57 struct libvlc_media_list_view_t
58 {
59     libvlc_event_manager_t *    p_event_manager;
60     libvlc_instance_t *         p_libvlc_instance;
61     int                         i_refcount;
62     vlc_mutex_t                 object_lock;
63
64     libvlc_media_list_t *       p_mlist;
65
66     struct libvlc_media_list_view_private_t * p_this_view_data;
67
68     /* Accessors */
69     libvlc_media_list_view_count_func_t              pf_count;
70     libvlc_media_list_view_item_at_index_func_t      pf_item_at_index;
71     libvlc_media_list_view_children_at_index_func_t  pf_children_at_index;
72
73     libvlc_media_list_view_constructor_func_t        pf_constructor;
74     libvlc_media_list_view_release_func_t            pf_release;
75
76     /* Notification callback */
77     void (*pf_ml_item_added)(const libvlc_event_t *, libvlc_media_list_view_t *);
78     void (*pf_ml_item_removed)(const libvlc_event_t *, libvlc_media_list_view_t *);
79 };
80
81 /* Media List View */
82 libvlc_media_list_view_t * libvlc_media_list_view_new(
83         libvlc_media_list_t * p_mlist,
84         libvlc_media_list_view_count_func_t pf_count,
85         libvlc_media_list_view_item_at_index_func_t pf_item_at_index,
86         libvlc_media_list_view_children_at_index_func_t pf_children_at_index,
87         libvlc_media_list_view_constructor_func_t pf_constructor,
88         libvlc_media_list_view_release_func_t pf_release,
89         void * this_view_data );
90
91 void libvlc_media_list_view_set_ml_notification_callback(
92         libvlc_media_list_view_t * p_mlv,
93         void (*item_added)(const libvlc_event_t *, libvlc_media_list_view_t *),
94         void (*item_removed)(const libvlc_event_t *, libvlc_media_list_view_t *) );
95
96 void libvlc_media_list_view_will_delete_item(
97         libvlc_media_list_view_t * p_mlv,
98         libvlc_media_t * p_item, int index );
99
100 void libvlc_media_list_view_item_deleted(
101         libvlc_media_list_view_t * p_mlv,
102         libvlc_media_t * p_item, int index );
103
104 void libvlc_media_list_view_will_add_item (
105         libvlc_media_list_view_t * p_mlv,
106         libvlc_media_t * p_item, int index );
107
108 void libvlc_media_list_view_item_added(
109         libvlc_media_list_view_t * p_mlv,
110         libvlc_media_t * p_item, int index );
111
112 #endif