chapterlist.h
/*****************************************************************
* gavl - a general purpose audio/video processing library
*
* Copyright (c) 2001 - 2024 Members of the Gmerlin project
* http://github.com/bplaum
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* *****************************************************************/
#ifndef GAVL_CHAPTERLIST_H_INCLUDED
#define GAVL_CHAPTERLIST_H_INCLUDED
#ifdef __cplusplus
extern "C" {
#endif
#include <gavl/gavldefs.h>
#include <gavl/value.h>
#if 0
typedef struct
{
uint32_t num_chapters;
uint32_t timescale;
struct
{
int64_t time;
char * name;
} * chapters;
} gavl_chapter_list_t;
#else
#define GAVL_CHAPTERLIST_CHAPTERLIST "chapterlist"
#define GAVL_CHAPTERLIST_CHAPTERS "chap"
#define GAVL_CHAPTERLIST_TIME "time"
#define GAVL_CHAPTERLIST_TIMESCALE "timescale"
typedef gavl_dictionary_t gavl_chapter_list_t;
#endif
GAVL_PUBLIC
gavl_dictionary_t * gavl_chapter_list_insert(gavl_chapter_list_t * list, int index,
int64_t time, const char * name);
GAVL_PUBLIC
void gavl_chapter_list_delete(gavl_chapter_list_t * list, int index);
GAVL_PUBLIC
int gavl_chapter_list_get_current(const gavl_chapter_list_t * list,
gavl_time_t time);
/* Check if the list is valid at all */
GAVL_PUBLIC
int gavl_chapter_list_is_valid(const gavl_chapter_list_t * list);
GAVL_PUBLIC
void gavl_chapter_list_set_timescale(gavl_chapter_list_t * list, int timescale);
GAVL_PUBLIC
int gavl_chapter_list_get_timescale(const gavl_chapter_list_t * list);
GAVL_PUBLIC
int gavl_chapter_list_get_num(const gavl_chapter_list_t * list);
GAVL_PUBLIC
gavl_dictionary_t * gavl_chapter_list_get_nc(gavl_chapter_list_t * list, int idx);
GAVL_PUBLIC
const gavl_dictionary_t * gavl_chapter_list_get(const gavl_chapter_list_t * list, int idx);
GAVL_PUBLIC
int64_t gavl_chapter_list_get_time(const gavl_chapter_list_t * list, int idx);
GAVL_PUBLIC
const char * gavl_chapter_list_get_label(const gavl_chapter_list_t * list, int idx);
GAVL_PUBLIC
gavl_dictionary_t *
gavl_dictionary_add_chapter_list(gavl_dictionary_t * m, int timescale);
GAVL_PUBLIC
gavl_dictionary_t *
gavl_dictionary_get_chapter_list_nc(gavl_dictionary_t * m);
GAVL_PUBLIC
const gavl_dictionary_t *
gavl_dictionary_get_chapter_list(const gavl_dictionary_t * m);
#ifdef __cplusplus
}
#endif
#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