1
/*****************************************************************************
2
* vlc_epg.h: Electronic Program Guide
3
*****************************************************************************
4
* Copyright (C) 2007 the VideoLAN team
5
* $Id: f1ffabe7b4a0306385b25cdd5281cf3ac95ea415 $
7
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
9
* This program is free software; you can redistribute it and/or modify
10
* it under the terms of the GNU General Public License as published by
11
* the Free Software Foundation; either version 2 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 General Public License for more details.
19
* You should have received a copy of the GNU General Public License
20
* along with this program; if not, write to the Free Software
21
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22
*****************************************************************************/
29
* This file defines functions and structures for storing dvb epg information
34
int64_t i_start; /* Interpreted as a value return by time() */
35
int i_duration; /* Duration of the event in second */
38
char *psz_short_description;
39
char *psz_description;
46
vlc_epg_event_t *p_current; /* Can be null or should be the same than one of pp_event entry */
49
vlc_epg_event_t **pp_event;
52
static inline void vlc_epg_Init( vlc_epg_t *p_epg, const char *psz_name )
54
p_epg->psz_name = psz_name ? strdup( psz_name ) : NULL;
55
p_epg->p_current = NULL;
56
TAB_INIT( p_epg->i_event, p_epg->pp_event );
59
static inline void vlc_epg_Clean( vlc_epg_t *p_epg )
62
for( i = 0; i < p_epg->i_event; i++ )
64
vlc_epg_event_t *p_evt = p_epg->pp_event[i];
65
free( p_evt->psz_name );
66
free( p_evt->psz_short_description );
67
free( p_evt->psz_description );
70
TAB_CLEAN( p_epg->i_event, p_epg->pp_event );
71
free( p_epg->psz_name );
74
static inline void vlc_epg_AddEvent( vlc_epg_t *p_epg, int64_t i_start, int i_duration,
75
const char *psz_name, const char *psz_short_description, const char *psz_description )
77
vlc_epg_event_t *p_evt = (vlc_epg_event_t*)malloc( sizeof(vlc_epg_event_t) );
80
p_evt->i_start = i_start;
81
p_evt->i_duration = i_duration;
82
p_evt->psz_name = psz_name ? strdup( psz_name ) : NULL;
83
p_evt->psz_short_description = psz_short_description ? strdup( psz_short_description ) : NULL;
84
p_evt->psz_description = psz_description ? strdup( psz_description ) : NULL;
85
TAB_APPEND_CPP( vlc_epg_event_t, p_epg->i_event, p_epg->pp_event, p_evt );
88
static inline vlc_epg_t *vlc_epg_New( const char *psz_name )
90
vlc_epg_t *p_epg = (vlc_epg_t*)malloc( sizeof(vlc_epg_t) );
92
vlc_epg_Init( p_epg, psz_name );
96
static inline void vlc_epg_Delete( vlc_epg_t *p_epg )
98
vlc_epg_Clean( p_epg );
102
static inline void vlc_epg_SetCurrent( vlc_epg_t *p_epg, int64_t i_start )
105
p_epg->p_current = NULL;
109
for( i = 0; i < p_epg->i_event; i++ )
111
if( p_epg->pp_event[i]->i_start == i_start )
113
p_epg->p_current = p_epg->pp_event[i];