00001 // cmpgstrm.h : interface of MPEG-2 and MPEG-1 system layer
00002 //
00003 // CMpegStream provides several MPEG operation functions on system layer,
00004 // such as parsing system header, managing multiple channels. Currently
00005 // this class only provides several simple facilities and is still under
00006 // developing, but already stand alone.
00007 //
00008 //*****************************************************************************
00009 //
00010 // MPEG Developing Classes
00011 //
00012 // Copyright (C) 1998, Vision and Neural Networks Laboratory, Computer Science
00013 // Department, Wayne State University, All Rights Reserved;
00014 //
00015 // Disclaimer of Warranty
00016 //
00017 // MPEG Developing Classes, both binary and source (hereafter, Software)
00018 // is copyrighted by Vision and Neural Networks Laboratory, Computer Science
00019 // Department, Wayne State University (WSU), and ownership remains with WSU.
00020 //
00021 // Permission is hereby granted, free of charge, to any person obtaining
00022 // a copy of this software and associated documentation files to use, copy,
00023 // and distribute the software, provided that no charge is associated with
00024 // such copies and that the copyright notice and this statement appears on
00025 // all copies.
00026 //
00027 // THE SOFTWARE IS AVAILABLE TO THE USER ON AN "AS IS" BASIS, WITHOUT WARRANTY
00028 // OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, WITHOUT LIMITATION, THE
00029 // IMPLIED WARRANTIES OR MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
00030 // IN NO EVENT SHALL THE COPYRIGHT-HOLDER BE LIABLE FOR ANY CLAIMS, DAMAGES, OR
00031 // OTHER LIABILITIES OF ANY KIND WHATSOEVER ARISING FROM, OUT OF OR IN CONNECTION
00032 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. THIS
00033 // DISCLAIMAER OF WARRANTY EXTENDS TO THE USER OF THIS SOFTWARE. ALSO THE WSU
00034 // DOES NOT REPRESENT OR WARRANT THAT THE SOFTWARE FURNISHED HEREUNDER ARE FREE OF
00035 // INFRINGMENT OF ANY THIRD-PARTY PATENTS.
00036 //
00037 // Many patents of MPEG-1 and MPEG-2 are general enough such that commercial
00038 // implementations, including shareware, are unavoidable subject to royalty fees to
00039 // patent holders, regardless of implementation design.
00040 //
00041 //
00042 // Vision and Neural Networks Laboratory,
00043 // Computer Science Department,
00044 // Wayne State University,
00045 // Detroit, MI 48202.
00046 // Dongge Li(dil@cs.wayne.edu) and Ishwar K. Sethi(sethi@cs.wayne.edu).
00047 //
00049
00050 #if !defined CMPEGSTREAM_H
00051 #define CMPEGSTREAM_H
00052
00053 #include "mpegdata.h"
00054 #include "datatype.h"
00055 #include "cmpvdeco.h"
00056 #include "cobfbuf.h"
00057
00058 const long STREAM_BUF_SIZE=4096;
00059
00060 typedef struct mpegvideo_ch_status_tag
00061 {
00062 CMpvDecoder *pMpvDecoder;
00063 int iStatus;
00064 } MVIDEOCHSTATUS;
00065
00066 typedef struct stream_status_tag
00067 {
00068 int iStatus;
00069 bool bSystemStream[MAX_LAYER_NUM]; // Flag to mark if it is a system stream;
00070 bool bTwoStream; // has second stream for Data Partitioning (DP) or SNR Scalability enhancment
00071 } STREAMSTATUS;
00072
00073 class CMpegStream
00074 {
00075 // constructor and destructor
00076 public:
00077 CMpegStream();
00078 ~CMpegStream();
00079
00080 // attributes
00081 protected:
00082 FILE *pfBaseFile;
00083 FILE *pfEnhanFile;
00084 char *psBaseFileName, *psEnhanFileName;
00085 COBitFileBuf BitBuf[MAX_LAYER_NUM];
00086 SYSTEMHEADER SystemHeader[MAX_LAYER_NUM];
00087 STREAMSTATUS StreamStatus;
00088 MVIDEOCHSTATUS VideoChStatus[MAX_VIDEOCH_NUM];
00089 // MAUDIOCHSTATUS AudioChStatus[MAX_AUDIOCH_NUM];
00090 // PRIVATECHSTATUS PrivateChStatus[MAX_PRIVATECH_NUM];
00091
00092 // operation
00093 public:
00094 int Initialize(const char *psBaseLayerName, const char *psEnhanLayerName=NULL);
00095 void Reset(void);
00096 int TurnOnChannel(VIDEOCHNUM ChannelNum, VIDEOCHNUM EnhanChannelNum=VIDEOCH0);
00097 void TurnOffChannel(VIDEOCHNUM ChannelNum);
00098 CMpvDecoder *GetChannel(VIDEOCHNUM ChannelNum) {return VideoChStatus[ChannelNum].pMpvDecoder;};
00099 SYSTEMHEADER GetSystemHeader(LAYERTYPE LayerType=BASELAYER) { return SystemHeader[LayerType]; };
00100 bool IsSystemStream(LAYERTYPE LayerType=BASELAYER) { return StreamStatus.bSystemStream[LayerType]; };
00101 int GetStatus(void) { return StreamStatus.iStatus; };
00102
00103 protected:
00104 void NextStartCode(COBitFileBuf *pBitFileBuf);
00105 int ReadSystemHeader(LAYERTYPE LayerType);
00106 inline void MarkerBit(LAYERTYPE LayerType);
00107 };
00108
00109
00110 inline void CMpegStream::MarkerBit(LAYERTYPE LayerType)
00111 {
00112 #ifdef ERR_INFO
00113 if (!BitBuf[LayerType].GetByteBits(1)) // must be 1;
00114 StreamStatus.iStatus=STREAM_ERROR;
00115 #else
00116 BitBuf[LayerType].GetByteBits(1); //'1'
00117 #endif
00118 }
00119
00120 #endif //CMPEGSTREAM_H
1.2.12 written by Dimitri van Heesch,
© 1997-2001