Annotation of margi2/dmxdev.h, revision 1.1
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:
! 53: #define DMXDEV_TYPE_SEC 1
! 54: #define DMXDEV_TYPE_PES 2
! 55:
! 56: #define DMXDEV_STATE_FREE 0
! 57: #define DMXDEV_STATE_ALLOCATED 1
! 58: #define DMXDEV_STATE_SET 2
! 59: #define DMXDEV_STATE_READY 3
! 60: #define DMXDEV_STATE_GO 4
! 61:
! 62: typedef struct dmxdev_buffer_s {
! 63: uint8_t *data;
! 64: uint32_t size;
! 65: int32_t pread;
! 66: int32_t pwrite;
! 67: WAIT_QUEUE queue;
! 68: int error;
! 69: } dmxdev_buffer_t;
! 70:
! 71:
! 72: typedef struct dmxdev_filter_s {
! 73: union {
! 74: dmx_pes_filter_t *pes;
! 75: dmx_section_filter_t *sec;
! 76: } filter;
! 77:
! 78: union {
! 79: dmx_ts_feed_t *ts;
! 80: dmx_section_feed_t *sec;
! 81: } feed;
! 82:
! 83: union {
! 84: struct dmxSctFilterParams sec;
! 85: struct dmxPesFilterParams pes;
! 86: } params;
! 87:
! 88: int type;
! 89: int state;
! 90: struct dmxdev_s *dev;
! 91: dmxdev_buffer_t buffer;
! 92:
! 93: // only for sections
! 94: struct timer_list timer;
! 95: int todo;
! 96: uint8_t secheader[3];
! 97:
! 98: u16 pid;
! 99: } dmxdev_filter_t;
! 100:
! 101:
! 102: typedef struct dmxdev_s {
! 103: dmxdev_filter_t *filter;
! 104: dmx_demux_t *demux;
! 105:
! 106: int filternum;
! 107: int capabilities;
! 108: #define DMXDEV_CAP_DUPLEX 1
! 109: dmx_frontend_t *dvr_orig_fe;
! 110:
! 111: // if we support duplex mode (we don't :-), we need these
! 112: dmx_demux_t *sw_demux;
! 113: struct file *read_file;
! 114: struct file *write_file;
! 115:
! 116: //DVR
! 117: dmxdev_buffer_t dvr_buffer;
! 118: #define DVR_BUFFER_SIZE (256*1024)
! 119: struct semaphore mutex;
! 120: spinlock_t lock;
! 121: } dmxdev_t;
! 122:
! 123:
! 124: int DmxDevInit(dmxdev_t *dmxdev);
! 125: void DmxDevRelease(dmxdev_t *dmxdev);
! 126:
! 127: int DmxDevFilterAlloc(dmxdev_t *dmxdev, struct file *file);
! 128: int DmxDevFilterFree(dmxdev_t *dmxdev, struct file *file);
! 129: int DmxDevIoctl(dmxdev_t *dmxdev, struct file *file,
! 130: unsigned int cmd, unsigned long arg);
! 131: unsigned int DmxDevPoll(dmxdev_t *dmxdev, struct file *file, poll_table * wait);
! 132: ssize_t DmxDevRead(dmxdev_t *dmxdev, struct file *file,
! 133: char *buf, size_t count, loff_t *ppos);
! 134:
! 135: int DmxDevDVROpen(dmxdev_t *dmxdev, struct file *file);
! 136: int DmxDevDVRClose(dmxdev_t *dmxdev, struct file *file);
! 137: ssize_t DmxDevDVRWrite(dmxdev_t *dmxdev, struct file *file,
! 138: const char *buf, size_t count, loff_t *ppos);
! 139: ssize_t DmxDevDVRRead(dmxdev_t *dmxdev, struct file *file,
! 140: char *buf, size_t count, loff_t *ppos);
! 141:
! 142:
! 143: #endif /* _DMXDEV_H_ */
LinuxTV legacy CVS <linuxtv.org/cvs>