📄 iso1394dataflowsource.h
字号:
/* * MPEG2-TS over IEEE 1394 decoder - receive and decode MPEG-2 transport * streams according to IEC 61883-4 * * Copyright (C) 2000-2007, Manfred Weihs <mweihs@users.sourceforge.net> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (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 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */#ifndef ISO1394DATAFLOWSOURCE_INLINE_H#define ISO1394DATAFLOWSOURCE_INLINE_H#define TS_BUFFER_ELEMENTS 500 /* number of transport stream packets in buffer */#define MPEG2_TS_PACKET_SIZE 188unsigned char buffer[TS_BUFFER_ELEMENTS][MPEG2_TS_PACKET_SIZE+4]; /* buffer for TS packets */int current; /* last is in iso1394dataflowsource.c (not externally available) */int bytecount; /* position in current TS packet */int iso_init(int channel);void iso_done();/** returns the next byte of the data flow and consumes it. */static inline unsigned int getbits8() { return buffer[current][bytecount++ +4];}static inline unsigned int getbits16(){ return ((getbits8() << 8) | getbits8());}/** returns the next three bytes of the data flow and consumes them. */static inline unsigned int getbits24(){ return ((getbits8() << 16) | (getbits8() << 8) | getbits8());}/** returns the next quadlet of the dataflow and consumes it. */static inline unsigned int getbits32(){ return ((getbits8() << 24) | (getbits8() << 16) | (getbits8() << 8) | getbits8());}/** returns the next quadlet of the data flow without consuming it. */static inline unsigned int nextbits32(){ return (buffer[current][bytecount+4] << 24) | (buffer[current][bytecount+5] << 16) | (buffer[current][bytecount+6] << 8) | buffer[current][bytecount+7];}/** returns the next three bytes of the data flow without consuming them. */static inline unsigned int nextbits24(){ return (buffer[current][bytecount+4] << 16) | (buffer[current][bytecount+5] << 8) | buffer[current][bytecount+6];}/** returns the next word of the data flow without consuming it. */static inline unsigned int nextbits16(){ return (buffer[current][bytecount+4] << 8) | buffer[current][bytecount+5];}/** returns the next byte of the data flow without consuming it. */static inline unsigned int nextbits8(){ return buffer[current][bytecount+4];}/** returns the number of remaining bytes in the current TS packet. */static inline int rest_of_ts_packet() { return MPEG2_TS_PACKET_SIZE-bytecount;}/** copies length bytes of databytes to output (consuming them). */int copybytes(unsigned char *output, int length);/** advances to next TS packet. */int nextpacket();/** skips length bytes. */int skipbytes(int length);#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -