lib: media: fix libvlc_media_duplicate() behavior
[vlc.git] / include / vlc_epg.h
blob9d632f2b192bde950ae94edcb5013c72836e9861
1 /*****************************************************************************
2 * vlc_epg.h: Electronic Program Guide
3 *****************************************************************************
4 * Copyright (C) 2007 VLC authors and VideoLAN
6 * Authors: Laurent Aimar <fenrir@via.ecp.fr>
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU Lesser General Public License as published by
10 * the Free Software Foundation; either version 2.1 of the License, or
11 * (at your option) any later version.
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 Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public License
19 * along with this program; if not, write to the Free Software Foundation,
20 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
21 *****************************************************************************/
23 #ifndef VLC_EPG_H
24 #define VLC_EPG_H 1
26 /**
27 * \file
28 * This file defines functions and structures for storing dvb epg information
31 typedef struct
33 int64_t i_start; /* Interpreted as a value return by time() */
34 uint32_t i_duration; /* Duration of the event in second */
35 uint16_t i_id; /* Unique event id withing the event set */
37 char *psz_name;
38 char *psz_short_description;
39 char *psz_description;
40 struct /* Description items in tranmission order */
42 char *psz_key;
43 char *psz_value;
44 } * description_items;
45 int i_description_items;
47 uint8_t i_rating; /* Parental control, set to 0 when undefined */
48 } vlc_epg_event_t;
50 typedef struct
52 char *psz_name;
53 uint32_t i_id; /* Unique identifier for this table / events (partial sets) */
54 uint16_t i_source_id;/* Channel / Program reference id this epg relates to */
55 size_t i_event;
56 vlc_epg_event_t **pp_event;
57 bool b_present; /* Contains present/following or similar, and sets below */
58 const vlc_epg_event_t *p_current; /* NULL, or equal to one of the entries in pp_event */
59 } vlc_epg_t;
61 /**
62 * Creates a new vlc_epg_event_t*
64 * You must call vlc_epg_event_Delete to release the associated resources.
66 * \p i_id is the event unique id
67 * \p i_start start in epoch time
68 * \p i_duration event duration in seconds
70 VLC_API vlc_epg_event_t * vlc_epg_event_New(uint16_t i_id,
71 int64_t i_start, uint32_t i_duration);
73 /**
74 * Releases a vlc_epg_event_t*.
76 VLC_API void vlc_epg_event_Delete(vlc_epg_event_t *p_event);
78 /**
79 * Returns a vlc_epg_event_t * duplicated from \p p_src.
82 VLC_API vlc_epg_event_t * vlc_epg_event_Duplicate(const vlc_epg_event_t *p_src);
84 /**
85 * It creates a new vlc_epg_t*
87 * You must call vlc_epg_Delete to release the associated resource.
89 * \p i_id is computed unique id depending on standard (table id, eit number)
90 * \p i_source_id is the associated program number
92 VLC_API vlc_epg_t * vlc_epg_New(uint32_t i_id, uint16_t i_source_id);
94 /**
95 * It releases a vlc_epg_t*.
97 VLC_API void vlc_epg_Delete(vlc_epg_t *p_epg);
99 /**
100 * It appends a new vlc_epg_event_t to a vlc_epg_t.
101 * Takes ownership of \p p_evt or returns false
103 * \p p_evt a vlc_epg_event_t * created with vlc_epg_event_New.
105 VLC_API bool vlc_epg_AddEvent(vlc_epg_t *p_epg, vlc_epg_event_t *p_evt);
108 * It set the current event of a vlc_epg_t given a start time
110 VLC_API void vlc_epg_SetCurrent(vlc_epg_t *p_epg, int64_t i_start);
113 * Returns a duplicated \p p_src and its associated events.
116 VLC_API vlc_epg_t * vlc_epg_Duplicate(const vlc_epg_t *p_src);
118 #endif