6e88360e880f42af43c2874e6bbc0b00b99bc334
[mafwsubrenderer] / mafw-gst-subtitles-renderer / libmafw-gst-renderer / mafw-playlist-iterator.h
1 /*
2  * This file is a part of MAFW
3  *
4  * Copyright (C) 2007, 2008, 2009 Nokia Corporation, all rights reserved.
5  *
6  * Contact: Visa Smolander <visa.smolander@nokia.com>
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public License
10  * as published by the Free Software Foundation; version 2.1 of
11  * the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful, but
14  * WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
21  * 02110-1301 USA
22  *
23  */
24
25 #ifndef MAFW_PLAYLIST_ITERATOR_H
26 #define MAFW_PLAYLIST_ITERATOR_H
27
28 #include <glib-object.h>
29 #include <libmafw/mafw.h>
30
31 G_BEGIN_DECLS
32
33 typedef struct _MafwPlaylistIteratorPrivate MafwPlaylistIteratorPrivate;
34
35 typedef struct {
36         GObject g_object;
37
38         MafwPlaylistIteratorPrivate *priv;
39 } MafwPlaylistIterator;
40
41 typedef struct {
42         GObjectClass g_object_class;
43
44         /* Signals */
45         void (*playlist_changed)(MafwPlaylistIterator *iterator,
46                                  gboolean current_item_changed,
47                                  GQuark domain, gint code, const gchar *message);
48 } MafwPlaylistIteratorClass;
49
50 typedef enum {
51         MAFW_PLAYLIST_ITERATOR_MOVE_RESULT_OK,
52         MAFW_PLAYLIST_ITERATOR_MOVE_RESULT_LIMIT,
53         MAFW_PLAYLIST_ITERATOR_MOVE_RESULT_INVALID,
54         MAFW_PLAYLIST_ITERATOR_MOVE_RESULT_ERROR,
55 } MafwPlaylistIteratorMovementResult;
56
57 #define MAFW_TYPE_PLAYLIST_ITERATOR \
58         (mafw_playlist_iterator_get_type())
59 #define MAFW_PLAYLIST_ITERATOR(obj) \
60         (G_TYPE_CHECK_INSTANCE_CAST((obj), MAFW_TYPE_PLAYLIST_ITERATOR, MafwPlaylistIterator))
61 #define MAFW_IS_PLAYLIST_ITERATOR(obj) \
62         (G_TYPE_CHECK_INSTANCE_TYPE((obj), MAFW_TYPE_PLAYLIST_ITERATOR))
63 #define MAFW_PLAYLIST_ITERATOR_CLASS(klass) \
64         (G_TYPE_CHECK_CLASS_CAST((klass), MAFW_TYPE_PLAYLIST_ITERATOR, MafwPlaylistIterator))
65 #define MAFW_PLAYLIST_ITERATOR_GET_CLASS(obj) \
66         (G_TYPE_INSTANCE_GET_CLASS((obj), MAFW_TYPE_PLAYLIST_ITERATOR, \
67                                    MafwPlaylistIteratorClass))
68 #define MAFW_IS_PLAYLIST_ITERATOR_CLASS(klass) \
69         (G_TYPE_CHECK_CLASS_TYPE((klass), MAFW_TYPE_PLAYLIST_ITERATOR))
70
71 G_END_DECLS
72
73 GType mafw_playlist_iterator_get_type(void);
74 MafwPlaylistIterator *mafw_playlist_iterator_new(void);
75 void mafw_playlist_iterator_initialize(MafwPlaylistIterator *iterator,
76                                         MafwPlaylist *playlist,
77                                         GError **error);
78 void mafw_playlist_iterator_invalidate(MafwPlaylistIterator *iterator);
79 gboolean mafw_playlist_iterator_is_valid(MafwPlaylistIterator *iterator);
80 void mafw_playlist_iterator_reset(MafwPlaylistIterator *iterator, GError **error);
81 void mafw_playlist_iterator_move_to_last(MafwPlaylistIterator *iterator, GError **error);
82 MafwPlaylistIteratorMovementResult mafw_playlist_iterator_move_to_next(MafwPlaylistIterator *iterator,
83                                                                          GError **error);
84 MafwPlaylistIteratorMovementResult mafw_playlist_iterator_move_to_prev(MafwPlaylistIterator *iterator,
85                                                                          GError **error);
86 MafwPlaylistIteratorMovementResult mafw_playlist_iterator_move_to_index(MafwPlaylistIterator *iterator,
87                                                                           gint index,
88                                                                           GError **error);
89 void mafw_playlist_iterator_update(MafwPlaylistIterator *iterator, GError **error);
90 const gchar *mafw_playlist_iterator_get_current_objectid(MafwPlaylistIterator *iterator);
91 gint mafw_playlist_iterator_get_current_index(MafwPlaylistIterator *iterator);
92 gint mafw_playlist_iterator_get_size(MafwPlaylistIterator *iterator,
93                                       GError **error);
94
95 #endif