live
MPEG2TransportStreamFramer.hh
Go to the documentation of this file.
1 /**********
2 This library is free software; you can redistribute it and/or modify it under
3 the terms of the GNU Lesser General Public License as published by the
4 Free Software Foundation; either version 3 of the License, or (at your
5 option) any later version. (See <http://www.gnu.org/copyleft/lesser.html>.)
6 
7 This library is distributed in the hope that it will be useful, but WITHOUT
8 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
9 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
10 more details.
11 
12 You should have received a copy of the GNU Lesser General Public License
13 along with this library; if not, write to the Free Software Foundation, Inc.,
14 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
15 **********/
16 // "liveMedia"
17 // Copyright (c) 1996-2021 Live Networks, Inc. All rights reserved.
18 // A filter that passes through (unchanged) chunks that contain an integral number
19 // of MPEG-2 Transport Stream packets, but returning (in "fDurationInMicroseconds")
20 // an updated estimate of the time gap between chunks.
21 // C++ header
22 
23 #ifndef _MPEG2_TRANSPORT_STREAM_FRAMER_HH
24 #define _MPEG2_TRANSPORT_STREAM_FRAMER_HH
25 
26 #ifndef _FRAMED_FILTER_HH
27 #include "FramedFilter.hh"
28 #endif
29 
30 #ifndef _HASH_TABLE_HH
31 #include "HashTable.hh"
32 #endif
33 
35 public:
38 
39  u_int64_t tsPacketCount() const { return fTSPacketCount; }
40 
41  void changeInputSource(FramedSource* newInputSource) { fInputSource = newInputSource; }
42 
44  void setNumTSPacketsToStream(unsigned long numTSRecordsToStream);
45  void setPCRLimit(float pcrLimit);
46 
47 protected:
49  // called only by createNew()
51 
52 private:
53  // Redefined virtual functions:
54  virtual void doGetNextFrame();
55  virtual void doStopGettingFrames();
56 
57 private:
58  static void afterGettingFrame(void* clientData, unsigned frameSize,
59  unsigned numTruncatedBytes,
60  struct timeval presentationTime,
61  unsigned durationInMicroseconds);
62  void afterGettingFrame1(unsigned frameSize,
63  struct timeval presentationTime);
64 
65  Boolean updateTSPacketDurationEstimate(unsigned char* pkt, double timeNow);
66 
67 private:
68  u_int64_t fTSPacketCount;
71  u_int64_t fTSPCRCount;
73  unsigned long fNumTSPacketsToStream; // used iff "fLimitNumTSPacketsToStream" is True
75  float fPCRLimit; // used iff "fLimitTSPacketsToStreamByPCR" is True
76 };
77 
78 #endif
unsigned char Boolean
Definition: Boolean.hh:25
FramedSource * fInputSource
Definition: FramedFilter.hh:49
FramedSource * inputSource() const
Definition: FramedFilter.hh:30
static void afterGettingFrame(void *clientData, unsigned frameSize, unsigned numTruncatedBytes, struct timeval presentationTime, unsigned durationInMicroseconds)
void changeInputSource(FramedSource *newInputSource)
void afterGettingFrame1(unsigned frameSize, struct timeval presentationTime)
static MPEG2TransportStreamFramer * createNew(UsageEnvironment &env, FramedSource *inputSource)
virtual void doGetNextFrame()
void setNumTSPacketsToStream(unsigned long numTSRecordsToStream)
void setPCRLimit(float pcrLimit)
Boolean updateTSPacketDurationEstimate(unsigned char *pkt, double timeNow)
virtual ~MPEG2TransportStreamFramer()
MPEG2TransportStreamFramer(UsageEnvironment &env, FramedSource *inputSource)
virtual void doStopGettingFrames()