liveMedia/include/MPEG2TransportStreamFramer.hh

Go to the documentation of this file.
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-2013 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   void setPCRLimit(float pcrLimit);
00046 
00047 protected:
00048   MPEG2TransportStreamFramer(UsageEnvironment& env, FramedSource* inputSource);
00049       // called only by createNew()
00050   virtual ~MPEG2TransportStreamFramer();
00051 
00052 private:
00053   // Redefined virtual functions:
00054   virtual void doGetNextFrame();
00055   virtual void doStopGettingFrames();
00056 
00057 private:
00058   static void afterGettingFrame(void* clientData, unsigned frameSize,
00059                                 unsigned numTruncatedBytes,
00060                                 struct timeval presentationTime,
00061                                 unsigned durationInMicroseconds);
00062   void afterGettingFrame1(unsigned frameSize,
00063                           struct timeval presentationTime);
00064 
00065   Boolean updateTSPacketDurationEstimate(unsigned char* pkt, double timeNow);
00066 
00067 private:
00068   u_int64_t fTSPacketCount;
00069   double fTSPacketDurationEstimate;
00070   HashTable* fPIDStatusTable;
00071   u_int64_t fTSPCRCount;
00072   Boolean fLimitNumTSPacketsToStream;
00073   unsigned long fNumTSPacketsToStream; // used iff "fLimitNumTSPacketsToStream" is True
00074   Boolean fLimitTSPacketsToStreamByPCR;
00075   float fPCRLimit; // used iff "fLimitTSPacketsToStreamByPCR" is True
00076 };
00077 
00078 #endif

Generated on Mon Apr 29 13:28:01 2013 for live by  doxygen 1.5.2