Annotation of margi2/dmxdev.h, revision 1.7
1.1 mocm 1: /*
2: * dmxdev.h
3: *
4: * Copyright (C) 2000 Ralph Metzler <ralph@convergence.de>
5: * & Marcus Metzler <marcus@convergence.de>
6: for convergence integrated media GmbH
7: *
8: * This program is free software; you can redistribute it and/or
9: * modify it under the terms of the GNU Lesser General Public License
10: * as published by the Free Software Foundation; either version 2.1
11: * of the License, or (at your option) any later version.
12: *
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 General Public License for more details.
17: *
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
20: * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21: *
22: */
23:
24: #ifndef _DMXDEV_H_
25: #define _DMXDEV_H_
26:
27: #ifndef __KERNEL__
28: #define __KERNEL__
29: #endif
30:
31: #ifdef __DVB_PACK__
32: #include <ost/demux.h>
33: #include <ost/dmx.h>
34: #else
35: #include <linux/ost/demux.h>
36: #include <linux/ost/dmx.h>
37: #endif
38: #include <linux/version.h>
39: #include <linux/wait.h>
40: #include <linux/types.h>
41: #include <linux/fs.h>
42:
43: #if LINUX_VERSION_CODE < 0x020300
44: #define WAIT_QUEUE struct wait_queue*
45: #define init_waitqueue_head(wq) *(wq) = NULL;
46: #define DECLARE_WAITQUEUE(wait, current) struct wait_queue wait = { current, NULL }
47: #define list_for_each(pos, head) \
48: for (pos = (head)->next; pos != (head); pos = pos->next)
49: #else
50: #define WAIT_QUEUE wait_queue_head_t
51: #endif
52:
1.7 ! mocm 53: typedef enum {
! 54: DMXDEV_TYPE_NONE,
! 55: DMXDEV_TYPE_SEC,
! 56: DMXDEV_TYPE_PES,
! 57: } dmxdev_type_t;
! 58:
! 59: typedef enum {
! 60: DMXDEV_STATE_FREE,
! 61: DMXDEV_STATE_ALLOCATED,
! 62: DMXDEV_STATE_SET,
! 63: DMXDEV_STATE_GO,
! 64: DMXDEV_STATE_DONE,
! 65: DMXDEV_STATE_TIMEDOUT
! 66: } dmxdev_state_t;
1.1 mocm 67:
68: typedef struct dmxdev_buffer_s {
69: uint8_t *data;
70: uint32_t size;
71: int32_t pread;
72: int32_t pwrite;
73: WAIT_QUEUE queue;
74: int error;
75: } dmxdev_buffer_t;
76:
77:
78: typedef struct dmxdev_filter_s {
79: union {
80: dmx_pes_filter_t *pes;
81: dmx_section_filter_t *sec;
82: } filter;
83:
84: union {
85: dmx_ts_feed_t *ts;
86: dmx_section_feed_t *sec;
87: } feed;
88:
89: union {
90: struct dmxSctFilterParams sec;
91: struct dmxPesFilterParams pes;
92: } params;
93:
94: int type;
1.7 ! mocm 95: dmxdev_state_t state;
1.1 mocm 96: struct dmxdev_s *dev;
97: dmxdev_buffer_t buffer;
98:
99: // only for sections
100: struct timer_list timer;
101: int todo;
102: uint8_t secheader[3];
103:
104: u16 pid;
105: } dmxdev_filter_t;
106:
107:
1.3 mocm 108: typedef struct dmxdev_dvr_s {
109: int state;
110: struct dmxdev_s *dev;
111: dmxdev_buffer_t buffer;
112: } dmxdev_dvr_t;
113:
114:
1.1 mocm 115: typedef struct dmxdev_s {
116: dmxdev_filter_t *filter;
1.3 mocm 117: dmxdev_dvr_t *dvr;
1.1 mocm 118: dmx_demux_t *demux;
119:
120: int filternum;
121: int capabilities;
122: #define DMXDEV_CAP_DUPLEX 1
123: dmx_frontend_t *dvr_orig_fe;
124:
125: dmxdev_buffer_t dvr_buffer;
1.5 mocm 126: #define DVR_BUFFER_SIZE (512*1024)
127:
1.1 mocm 128: struct semaphore mutex;
129: spinlock_t lock;
130: } dmxdev_t;
131:
132:
133: int DmxDevInit(dmxdev_t *dmxdev);
134: void DmxDevRelease(dmxdev_t *dmxdev);
135:
136: int DmxDevFilterAlloc(dmxdev_t *dmxdev, struct file *file);
137: int DmxDevFilterFree(dmxdev_t *dmxdev, struct file *file);
138: int DmxDevIoctl(dmxdev_t *dmxdev, struct file *file,
139: unsigned int cmd, unsigned long arg);
140: unsigned int DmxDevPoll(dmxdev_t *dmxdev, struct file *file, poll_table * wait);
141: ssize_t DmxDevRead(dmxdev_t *dmxdev, struct file *file,
142: char *buf, size_t count, loff_t *ppos);
143:
144: int DmxDevDVROpen(dmxdev_t *dmxdev, struct file *file);
145: int DmxDevDVRClose(dmxdev_t *dmxdev, struct file *file);
146: ssize_t DmxDevDVRWrite(dmxdev_t *dmxdev, struct file *file,
147: const char *buf, size_t count, loff_t *ppos);
148: ssize_t DmxDevDVRRead(dmxdev_t *dmxdev, struct file *file,
149: char *buf, size_t count, loff_t *ppos);
1.6 mocm 150: int DmxDevDVRIoctl(dmxdev_t *dmxdev, struct file *file,
151: unsigned int cmd, unsigned long arg);
1.4 mocm 152: unsigned int DmxDevDVRPoll(dmxdev_t *dmxdev, struct file *file, poll_table * wait);
1.1 mocm 153:
154: #endif /* _DMXDEV_H_ */
LinuxTV legacy CVS <linuxtv.org/cvs>