]> git.sesse.net Git - vlc/blob - modules/access/dvb/dvb.h
* modules/access/dvb:
[vlc] / modules / access / dvb / dvb.h
1 /*****************************************************************************
2  * dvb.h : functions to control a DVB card under Linux with v4l2
3  *****************************************************************************
4  * Copyright (C) 1998-2004 VideoLAN
5  *
6  * Authors: Johan Bilien <jobi@via.ecp.fr>
7  *          Jean-Paul Saman <jpsaman@saman>
8  *          Christopher Ross <chris@tebibyte.org>
9  *          Christophe Massiot <massiot@via.ecp.fr>
10  *
11  * This program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 2 of the License, or
14  * (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.    See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software
23  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA    02111, USA.
24  *****************************************************************************/
25
26
27 /*****************************************************************************
28  * Devices location
29  *****************************************************************************/
30 #define DMX      "/dev/dvb/adapter%d/demux%d"
31 #define FRONTEND "/dev/dvb/adapter%d/frontend%d"
32 #define DVR      "/dev/dvb/adapter%d/dvr%d"
33 #define CA       "/dev/dvb/adapter%d/ca%d"
34
35 /*****************************************************************************
36  * Local structures
37  *****************************************************************************/
38 typedef struct
39 {
40     int i_pid;
41     int i_handle;
42     int i_type;
43 } demux_handle_t;
44
45 typedef struct frontend_t frontend_t;
46
47 typedef struct
48 {
49     int i_slot;
50     int i_resource_id;
51     void (* pf_handle)( access_t *, int, uint8_t *, int );
52     void (* pf_close)( access_t *, int );
53     void (* pf_manage)( access_t *, int );
54     void *p_sys;
55 } en50221_session_t;
56
57 #define MAX_DEMUX 256
58 #define MAX_CI_SLOTS 16
59 #define MAX_SESSIONS 32
60 #define MAX_PROGRAMS 24
61
62 struct access_sys_t
63 {
64     int i_handle, i_frontend_handle;
65     demux_handle_t p_demux_handles[MAX_DEMUX];
66     frontend_t *p_frontend;
67     vlc_bool_t b_budget_mode;
68
69     /* CA management */
70     int i_ca_handle;
71     int i_nb_slots;
72     vlc_bool_t pb_active_slot[MAX_CI_SLOTS];
73     vlc_bool_t pb_tc_has_data[MAX_CI_SLOTS];
74     en50221_session_t p_sessions[MAX_SESSIONS];
75     mtime_t i_ca_timeout, i_ca_next_event;
76     dvbpsi_pmt_t *pp_selected_programs[MAX_PROGRAMS];
77 };
78
79 #define VIDEO0_TYPE     1
80 #define AUDIO0_TYPE     2
81 #define TELETEXT0_TYPE  3
82 #define SUBTITLE0_TYPE  4
83 #define PCR0_TYPE       5
84 #define TYPE_INTERVAL   5
85 #define OTHER_TYPE     21
86
87 /*****************************************************************************
88  * Prototypes
89  *****************************************************************************/
90 int  E_(FrontendOpen)( access_t * );
91 void E_(FrontendPoll)( access_t *p_access );
92 int  E_(FrontendSet)( access_t * );
93 void E_(FrontendClose)( access_t * );
94
95 int E_(DMXSetFilter)( access_t *, int i_pid, int * pi_fd, int i_type );
96 int E_(DMXUnsetFilter)( access_t *, int i_fd );
97
98 int  E_(DVROpen)( access_t * );
99 void E_(DVRClose)( access_t * );
100
101 int  E_(CAMOpen)( access_t * );
102 int  E_(CAMPoll)( access_t * );
103 int  E_(CAMSet)( access_t *, dvbpsi_pmt_t * );
104 void E_(CAMClose)( access_t * );
105
106 int E_(en50221_Poll)( access_t * );
107 int E_(en50221_SetCAPMT)( access_t *, dvbpsi_pmt_t * );
108 void E_(en50221_End)( access_t * );
109