demux: avi: remove xmalloc
[vlc.git] / include / vlc_epg.h
blobe95d111ad5aa9db0cd2b56a34157cfdb3583dc32
1 /*****************************************************************************
2 * vlc_epg.h: Electronic Program Guide
3 *****************************************************************************
4 * Copyright (C) 2007 VLC authors and VideoLAN
5 * $Id$
7 * Authors: Laurent Aimar <fenrir@via.ecp.fr>
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU Lesser General Public License as published by
11 * the Free Software Foundation; either version 2.1 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public License
20 * along with this program; if not, write to the Free Software Foundation,
21 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22 *****************************************************************************/
24 #ifndef VLC_EPG_H
25 #define VLC_EPG_H 1
27 /**
28 * \file
29 * This file defines functions and structures for storing dvb epg information
32 typedef struct
34 int64_t i_start; /* Interpreted as a value return by time() */
35 uint32_t i_duration; /* Duration of the event in second */
36 uint16_t i_id; /* Unique event id withing the event set */
38 char *psz_name;
39 char *psz_short_description;
40 char *psz_description;
41 struct /* Description items in tranmission order */
43 char *psz_key;
44 char *psz_value;
45 } * description_items;
46 int i_description_items;
48 uint8_t i_rating; /* Parental control, set to 0 when undefined */
49 } vlc_epg_event_t;
51 typedef struct
53 char *psz_name;
54 uint32_t i_id; /* Unique identifier for this table / events (partial sets) */
55 uint16_t i_source_id;/* Channel / Program reference id this epg relates to */
56 size_t i_event;
57 vlc_epg_event_t **pp_event;
58 bool b_present; /* Contains present/following or similar, and sets below */
59 const vlc_epg_event_t *p_current; /* NULL, or equal to one of the entries in pp_event */
60 } vlc_epg_t;
62 /**
63 * Creates a new vlc_epg_event_t*
65 * You must call vlc_epg_event_Delete to release the associated resources.
67 * \p i_id is the event unique id
68 * \p i_start start in epoch time
69 * \p i_duration event duration in seconds
71 VLC_API vlc_epg_event_t * vlc_epg_event_New(uint16_t i_id,
72 int64_t i_start, uint32_t i_duration);
74 /**
75 * Releases a vlc_epg_event_t*.
77 VLC_API void vlc_epg_event_Delete(vlc_epg_event_t *p_event);
79 /**
80 * Returns a vlc_epg_event_t * duplicated from \p p_src.
83 VLC_API vlc_epg_event_t * vlc_epg_event_Duplicate(const vlc_epg_event_t *p_src);
85 /**
86 * It creates a new vlc_epg_t*
88 * You must call vlc_epg_Delete to release the associated resource.
90 * \p i_id is computed unique id depending on standard (table id, eit number)
91 * \p i_source_id is the associated program number
93 VLC_API vlc_epg_t * vlc_epg_New(uint32_t i_id, uint16_t i_source_id);
95 /**
96 * It releases a vlc_epg_t*.
98 VLC_API void vlc_epg_Delete(vlc_epg_t *p_epg);
101 * It appends a new vlc_epg_event_t to a vlc_epg_t.
102 * Takes ownership of \p p_evt or returns false
104 * \p p_evt a vlc_epg_event_t * created with vlc_epg_event_New.
106 VLC_API bool vlc_epg_AddEvent(vlc_epg_t *p_epg, vlc_epg_event_t *p_evt);
109 * It set the current event of a vlc_epg_t given a start time
111 VLC_API void vlc_epg_SetCurrent(vlc_epg_t *p_epg, int64_t i_start);
114 * It merges all the event of \p p_src and \p p_dst into \p p_dst.
117 VLC_API void vlc_epg_Merge(vlc_epg_t *p_dst, const vlc_epg_t *p_src);
120 * Returns a duplicated \p p_src and its associated events.
123 VLC_API vlc_epg_t * vlc_epg_Duplicate(const vlc_epg_t *p_src);
125 #endif