Annotation of margi2/dmxdev.h, revision 1.5

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
1.2       mocm       61: #define DMXDEV_STATE_DONE      5
                     62: #define DMXDEV_STATE_TIMEDOUT  6
1.1       mocm       63: 
                     64: typedef struct dmxdev_buffer_s {
                     65:         uint8_t *data;
                     66:         uint32_t size;
                     67:         int32_t  pread;
                     68:         int32_t  pwrite;
                     69:        WAIT_QUEUE queue;
                     70:         int error;
                     71: } dmxdev_buffer_t;
                     72: 
                     73: 
                     74: typedef struct dmxdev_filter_s {
                     75:         union {
                     76:                dmx_pes_filter_t *pes;
                     77:                dmx_section_filter_t *sec;
                     78:        } filter;
                     79: 
                     80:         union {
                     81:                 dmx_ts_feed_t *ts;
                     82:                 dmx_section_feed_t *sec;
                     83:        } feed;
                     84: 
                     85:         union {
                     86:                struct dmxSctFilterParams sec;
                     87:                struct dmxPesFilterParams pes;
                     88:        } params;
                     89: 
                     90:         int type;
                     91:         int state;
                     92:         struct dmxdev_s *dev;
                     93:         dmxdev_buffer_t buffer;
                     94: 
                     95:         // only for sections
                     96:         struct timer_list timer;
                     97:         int todo;
                     98:         uint8_t secheader[3];
                     99: 
                    100:         u16 pid;
                    101: } dmxdev_filter_t;
                    102: 
                    103: 
1.3       mocm      104: typedef struct dmxdev_dvr_s {
                    105:         int state;
                    106:         struct dmxdev_s *dev;
                    107:         dmxdev_buffer_t buffer;
                    108: } dmxdev_dvr_t;
                    109: 
                    110: 
1.1       mocm      111: typedef struct dmxdev_s {
                    112:         dmxdev_filter_t *filter;
1.3       mocm      113:         dmxdev_dvr_t *dvr;
1.1       mocm      114:         dmx_demux_t *demux;
                    115: 
                    116:         int filternum;
                    117:         int capabilities;
                    118: #define DMXDEV_CAP_DUPLEX 1
                    119:         dmx_frontend_t *dvr_orig_fe;
                    120: 
                    121:         dmxdev_buffer_t dvr_buffer;
1.5     ! mocm      122: #define DVR_BUFFER_SIZE (512*1024)
        !           123: 
1.1       mocm      124:        struct semaphore mutex;
                    125:        spinlock_t lock;
                    126: } dmxdev_t;
                    127: 
                    128: 
                    129: int DmxDevInit(dmxdev_t *dmxdev);
                    130: void DmxDevRelease(dmxdev_t *dmxdev);
                    131: 
                    132: int DmxDevFilterAlloc(dmxdev_t *dmxdev, struct file *file);
                    133: int DmxDevFilterFree(dmxdev_t *dmxdev, struct file *file);
                    134: int DmxDevIoctl(dmxdev_t *dmxdev, struct file *file, 
                    135:                unsigned int cmd, unsigned long arg);
                    136: unsigned int DmxDevPoll(dmxdev_t *dmxdev, struct file *file, poll_table * wait);
                    137: ssize_t DmxDevRead(dmxdev_t *dmxdev, struct file *file, 
                    138:                   char *buf, size_t count, loff_t *ppos);
                    139: 
                    140: int DmxDevDVROpen(dmxdev_t *dmxdev, struct file *file);
                    141: int DmxDevDVRClose(dmxdev_t *dmxdev, struct file *file);
                    142: ssize_t DmxDevDVRWrite(dmxdev_t *dmxdev, struct file *file, 
                    143:                       const char *buf, size_t count, loff_t *ppos);
                    144: ssize_t DmxDevDVRRead(dmxdev_t *dmxdev, struct file *file, 
                    145:                      char *buf, size_t count, loff_t *ppos);
1.4       mocm      146: unsigned int DmxDevDVRPoll(dmxdev_t *dmxdev, struct file *file, poll_table * wait);
1.1       mocm      147: 
                    148: #endif /* _DMXDEV_H_ */

LinuxTV legacy CVS <linuxtv.org/cvs>