gavl
chapterlist.h
1/*****************************************************************
2 * gavl - a general purpose audio/video processing library
3 *
4 * Copyright (c) 2001 - 2012 Members of the Gmerlin project
5 * gmerlin-general@lists.sourceforge.net
6 * http://gmerlin.sourceforge.net
7 *
8 * This program is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation, either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 * *****************************************************************/
21
22#ifndef GAVL_CHAPTERLIST_H_INCLUDED
23#define GAVL_CHAPTERLIST_H_INCLUDED
24
25#ifdef __cplusplus
26extern "C" {
27#endif
28
29#include <gavl/gavldefs.h>
30#include <gavl/value.h>
31
47#if 0
48typedef struct
49 {
50 uint32_t num_chapters;
51 uint32_t timescale;
52 struct
53 {
54 int64_t time;
55 char * name;
56 } * chapters;
57 } gavl_chapter_list_t;
58#else
59
60#define GAVL_CHAPTERLIST_CHAPTERLIST "chapterlist"
61#define GAVL_CHAPTERLIST_CHAPTERS "chap"
62#define GAVL_CHAPTERLIST_TIME "time"
63#define GAVL_CHAPTERLIST_TIMESCALE "timescale"
64
65typedef gavl_dictionary_t gavl_chapter_list_t;
66
67
68#endif
69
70
78GAVL_PUBLIC
79gavl_dictionary_t * gavl_chapter_list_insert(gavl_chapter_list_t * list, int index,
80 int64_t time, const char * name);
81
87GAVL_PUBLIC
88void gavl_chapter_list_delete(gavl_chapter_list_t * list, int index);
89
99GAVL_PUBLIC
100int gavl_chapter_list_get_current(const gavl_chapter_list_t * list,
101 gavl_time_t time);
102
103/* Check if the list is valid at all */
104
105GAVL_PUBLIC
106int gavl_chapter_list_is_valid(const gavl_chapter_list_t * list);
107
108GAVL_PUBLIC
109void gavl_chapter_list_set_timescale(gavl_chapter_list_t * list, int timescale);
110
111GAVL_PUBLIC
112int gavl_chapter_list_get_timescale(const gavl_chapter_list_t * list);
113
114GAVL_PUBLIC
115int gavl_chapter_list_get_num(const gavl_chapter_list_t * list);
116
117GAVL_PUBLIC
118gavl_dictionary_t * gavl_chapter_list_get_nc(gavl_chapter_list_t * list, int idx);
119
120GAVL_PUBLIC
121const gavl_dictionary_t * gavl_chapter_list_get(const gavl_chapter_list_t * list, int idx);
122
123GAVL_PUBLIC
124int64_t gavl_chapter_list_get_time(const gavl_chapter_list_t * list, int idx);
125
126GAVL_PUBLIC
127const char * gavl_chapter_list_get_label(const gavl_chapter_list_t * list, int idx);
128
129GAVL_PUBLIC
130gavl_dictionary_t *
131gavl_dictionary_add_chapter_list(gavl_dictionary_t * m, int timescale);
132
133GAVL_PUBLIC
134gavl_dictionary_t *
135gavl_dictionary_get_chapter_list_nc(gavl_dictionary_t * m);
136
137GAVL_PUBLIC
138const gavl_dictionary_t *
139gavl_dictionary_get_chapter_list(const gavl_dictionary_t * m);
140
141
146#ifdef __cplusplus
147}
148#endif
149
150#endif // GAVL_CHAPTERLIST_H_INCLUDED
GAVL_PUBLIC int gavl_chapter_list_get_current(const gavl_chapter_list_t *list, gavl_time_t time)
Get current chapter.
GAVL_PUBLIC gavl_dictionary_t * gavl_chapter_list_insert(gavl_chapter_list_t *list, int index, int64_t time, const char *name)
Insert a chapter into a chapter list.
GAVL_PUBLIC void gavl_chapter_list_delete(gavl_chapter_list_t *list, int index)
Delete a chapter from a chapter list.
int64_t gavl_time_t
Times in gavl are 64 bit signed integers.
Definition: gavltime.h:53