gavl

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