00001 /********** 00002 This library is free software; you can redistribute it and/or modify it under 00003 the terms of the GNU Lesser General Public License as published by the 00004 Free Software Foundation; either version 2.1 of the License, or (at your 00005 option) any later version. (See <http://www.gnu.org/copyleft/lesser.html>.) 00006 00007 This library is distributed in the hope that it will be useful, but WITHOUT 00008 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00009 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 00010 more details. 00011 00012 You should have received a copy of the GNU Lesser General Public License 00013 along with this library; if not, write to the Free Software Foundation, Inc., 00014 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00015 **********/ 00016 // "liveMedia" 00017 // Copyright (c) 1996-2012 Live Networks, Inc. All rights reserved. 00018 // A filter that passes through (unchanged) chunks that contain an integral number 00019 // of MPEG-2 Transport Stream packets, but returning (in "fDurationInMicroseconds") 00020 // an updated estimate of the time gap between chunks. 00021 // C++ header 00022 00023 #ifndef _MPEG2_TRANSPORT_STREAM_FRAMER_HH 00024 #define _MPEG2_TRANSPORT_STREAM_FRAMER_HH 00025 00026 #ifndef _FRAMED_FILTER_HH 00027 #include "FramedFilter.hh" 00028 #endif 00029 00030 #ifndef _HASH_TABLE_HH 00031 #include "HashTable.hh" 00032 #endif 00033 00034 class MPEG2TransportStreamFramer: public FramedFilter { 00035 public: 00036 static MPEG2TransportStreamFramer* 00037 createNew(UsageEnvironment& env, FramedSource* inputSource); 00038 00039 u_int64_t tsPacketCount() const { return fTSPacketCount; } 00040 00041 void changeInputSource(FramedSource* newInputSource) { fInputSource = newInputSource; } 00042 00043 void clearPIDStatusTable(); 00044 void setNumTSPacketsToStream(unsigned long numTSRecordsToStream); 00045 00046 protected: 00047 MPEG2TransportStreamFramer(UsageEnvironment& env, FramedSource* inputSource); 00048 // called only by createNew() 00049 virtual ~MPEG2TransportStreamFramer(); 00050 00051 private: 00052 // Redefined virtual functions: 00053 virtual void doGetNextFrame(); 00054 virtual void doStopGettingFrames(); 00055 00056 private: 00057 static void afterGettingFrame(void* clientData, unsigned frameSize, 00058 unsigned numTruncatedBytes, 00059 struct timeval presentationTime, 00060 unsigned durationInMicroseconds); 00061 void afterGettingFrame1(unsigned frameSize, 00062 struct timeval presentationTime); 00063 00064 void updateTSPacketDurationEstimate(unsigned char* pkt, double timeNow); 00065 00066 private: 00067 u_int64_t fTSPacketCount; 00068 double fTSPacketDurationEstimate; 00069 HashTable* fPIDStatusTable; 00070 u_int64_t fTSPCRCount; 00071 Boolean fLimitNumTSPacketsToStream; 00072 unsigned long fNumTSPacketsToStream; // used iff "fLimitNumTSPacketsToStream" is True 00073 }; 00074 00075 #endif
1.5.2