vlc_epg.h 3.8 KB
Newer Older
1 2 3
/*****************************************************************************
 * vlc_epg.h: Electronic Program Guide
 *****************************************************************************
Jean-Baptiste Kempf's avatar
LGPL  
Jean-Baptiste Kempf committed
4
 * Copyright (C) 2007 VLC authors and VideoLAN
5 6 7
 *
 * Authors: Laurent Aimar <fenrir@via.ecp.fr>
 *
Jean-Baptiste Kempf's avatar
LGPL  
Jean-Baptiste Kempf committed
8 9 10
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation; either version 2.1 of the License, or
11 12 13 14
 * (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
Jean-Baptiste Kempf's avatar
LGPL  
Jean-Baptiste Kempf committed
15 16
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Lesser General Public License for more details.
17
 *
Jean-Baptiste Kempf's avatar
LGPL  
Jean-Baptiste Kempf committed
18 19 20
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
21 22
 *****************************************************************************/

23 24
#ifndef VLC_EPG_H
#define VLC_EPG_H 1
25

26 27 28 29 30
/**
 * \file
 * This file defines functions and structures for storing dvb epg information
 */

31 32
typedef struct
{
François Cartegnie's avatar
François Cartegnie committed
33 34 35
    int64_t  i_start;    /* Interpreted as a value return by time() */
    uint32_t i_duration; /* Duration of the event in second */
    uint16_t i_id;       /* Unique event id withing the event set */
36

37 38 39
    char    *psz_name;
    char    *psz_short_description;
    char    *psz_description;
40 41 42 43 44 45
    struct               /* Description items in tranmission order */
    {
        char *psz_key;
        char *psz_value;
    } * description_items;
    int i_description_items;
46

47
    uint8_t i_rating;   /* Parental control, set to 0 when undefined */
48 49 50 51 52
} vlc_epg_event_t;

typedef struct
{
    char            *psz_name;
François Cartegnie's avatar
François Cartegnie committed
53 54 55
    uint32_t         i_id;       /* Unique identifier for this table / events (partial sets) */
    uint16_t         i_source_id;/* Channel / Program reference id this epg relates to */
    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 60
} vlc_epg_t;

61
/**
François Cartegnie's avatar
François Cartegnie committed
62
 * Creates a new vlc_epg_event_t*
63
 *
François Cartegnie's avatar
François Cartegnie committed
64 65 66 67 68
 * You must call vlc_epg_event_Delete to release the associated resources.
 *
 * \p i_id is the event unique id
 * \p i_start start in epoch time
 * \p i_duration event duration in seconds
69
 */
François Cartegnie's avatar
François Cartegnie committed
70 71
VLC_API vlc_epg_event_t * vlc_epg_event_New(uint16_t i_id,
                                            int64_t i_start, uint32_t i_duration);
72

73
/**
François Cartegnie's avatar
François Cartegnie committed
74
 * Releases a vlc_epg_event_t*.
75
 */
François Cartegnie's avatar
François Cartegnie committed
76
VLC_API void vlc_epg_event_Delete(vlc_epg_event_t *p_event);
77

78
/**
François Cartegnie's avatar
François Cartegnie committed
79
 * Returns a vlc_epg_event_t * duplicated from \p p_src.
80 81
 *
 */
François Cartegnie's avatar
François Cartegnie committed
82
VLC_API vlc_epg_event_t * vlc_epg_event_Duplicate(const vlc_epg_event_t *p_src);
83

84 85 86 87
/**
 * It creates a new vlc_epg_t*
 *
 * You must call vlc_epg_Delete to release the associated resource.
François Cartegnie's avatar
François Cartegnie committed
88 89 90
 *
 * \p i_id is computed unique id depending on standard (table id, eit number)
 * \p i_source_id is the associated program number
91
 */
François Cartegnie's avatar
François Cartegnie committed
92
VLC_API vlc_epg_t * vlc_epg_New(uint32_t i_id, uint16_t i_source_id);
93 94 95 96

/**
 * It releases a vlc_epg_t*.
 */
97
VLC_API void vlc_epg_Delete(vlc_epg_t *p_epg);
98

François Cartegnie's avatar
François Cartegnie committed
99 100 101 102 103 104 105 106
/**
 * It appends a new vlc_epg_event_t to a vlc_epg_t.
 * Takes ownership of \p p_evt or returns false
 *
 * \p p_evt a vlc_epg_event_t * created with vlc_epg_event_New.
 */
VLC_API bool vlc_epg_AddEvent(vlc_epg_t *p_epg, vlc_epg_event_t *p_evt);

107 108 109
/**
 * 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);
111

François Cartegnie's avatar
François Cartegnie committed
112 113 114 115 116 117
/**
 * Returns a duplicated \p p_src and its associated events.
 *
 */
VLC_API vlc_epg_t * vlc_epg_Duplicate(const vlc_epg_t *p_src);

118 119
#endif