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
26 extern "C" {
27 #endif
28 
29 #include <gavl/gavldefs.h>
30 #include <gavl/value.h>
31 
47 #if 0
48 typedef 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 
65 typedef gavl_dictionary_t gavl_chapter_list_t;
66 
67 
68 #endif
69 
70 
78 GAVL_PUBLIC
79 gavl_dictionary_t * gavl_chapter_list_insert(gavl_chapter_list_t * list, int index,
80  int64_t time, const char * name);
81 
87 GAVL_PUBLIC
88 void gavl_chapter_list_delete(gavl_chapter_list_t * list, int index);
89 
99 GAVL_PUBLIC
100 int 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 
105 GAVL_PUBLIC
106 int gavl_chapter_list_is_valid(const gavl_chapter_list_t * list);
107 
108 GAVL_PUBLIC
109 void gavl_chapter_list_set_timescale(gavl_chapter_list_t * list, int timescale);
110 
111 GAVL_PUBLIC
112 int gavl_chapter_list_get_timescale(const gavl_chapter_list_t * list);
113 
114 GAVL_PUBLIC
115 int gavl_chapter_list_get_num(const gavl_chapter_list_t * list);
116 
117 GAVL_PUBLIC
118 gavl_dictionary_t * gavl_chapter_list_get_nc(gavl_chapter_list_t * list, int idx);
119 
120 GAVL_PUBLIC
121 const gavl_dictionary_t * gavl_chapter_list_get(const gavl_chapter_list_t * list, int idx);
122 
123 GAVL_PUBLIC
124 int64_t gavl_chapter_list_get_time(const gavl_chapter_list_t * list, int idx);
125 
126 GAVL_PUBLIC
127 const char * gavl_chapter_list_get_label(const gavl_chapter_list_t * list, int idx);
128 
129 GAVL_PUBLIC
130 gavl_dictionary_t *
131 gavl_dictionary_add_chapter_list(gavl_dictionary_t * m, int timescale);
132 
133 GAVL_PUBLIC
134 gavl_dictionary_t *
135 gavl_dictionary_get_chapter_list_nc(gavl_dictionary_t * m);
136 
137 GAVL_PUBLIC
138 const gavl_dictionary_t *
139 gavl_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