live
MPEG1or2VideoStreamDiscreteFramer.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 simplified version of "MPEG1or2VideoStreamFramer" that takes only
19 // complete, discrete frames (rather than an arbitrary byte stream) as input.
20 // This avoids the parsing and data copying overhead of the full
21 // "MPEG1or2VideoStreamFramer".
22 // C++ header
23 
24 #ifndef _MPEG1or2_VIDEO_STREAM_DISCRETE_FRAMER_HH
25 #define _MPEG1or2_VIDEO_STREAM_DISCRETE_FRAMER_HH
26 
27 #ifndef _MPEG1or2_VIDEO_STREAM_FRAMER_HH
29 #endif
30 
31 #define VSH_MAX_SIZE 1000
32 
34 public:
37  Boolean iFramesOnly = False, // see MPEG1or2VideoStreamFramer.hh
38  double vshPeriod = 5.0, // see MPEG1or2VideoStreamFramer.hh
39  Boolean leavePresentationTimesUnmodified = False);
40 
41 protected:
44  Boolean iFramesOnly, double vshPeriod, Boolean leavePresentationTimesUnmodified);
45  // called only by createNew()
47 
48 protected:
49  // redefined virtual functions:
50  virtual void doGetNextFrame();
51 
52 protected:
53  static void afterGettingFrame(void* clientData, unsigned frameSize,
54  unsigned numTruncatedBytes,
55  struct timeval presentationTime,
56  unsigned durationInMicroseconds);
57  void afterGettingFrame1(unsigned frameSize,
58  unsigned numTruncatedBytes,
59  struct timeval presentationTime,
60  unsigned durationInMicroseconds);
61 
62 protected:
64  struct timeval fLastNonBFramePresentationTime;
66 
67  // A saved copy of the most recently seen 'video_sequence_header',
68  // in case we need to insert it into the stream periodically:
69  unsigned char fSavedVSHBuffer[VSH_MAX_SIZE];
70  unsigned fSavedVSHSize;
73  double fVSHPeriod;
74 };
75 
76 #endif
const Boolean False
Definition: Boolean.hh:28
unsigned char Boolean
Definition: Boolean.hh:25
FramedSource * inputSource() const
Definition: FramedFilter.hh:30
void afterGettingFrame1(unsigned frameSize, unsigned numTruncatedBytes, struct timeval presentationTime, unsigned durationInMicroseconds)
static void afterGettingFrame(void *clientData, unsigned frameSize, unsigned numTruncatedBytes, struct timeval presentationTime, unsigned durationInMicroseconds)
MPEG1or2VideoStreamDiscreteFramer(UsageEnvironment &env, FramedSource *inputSource, Boolean iFramesOnly, double vshPeriod, Boolean leavePresentationTimesUnmodified)
static MPEG1or2VideoStreamDiscreteFramer * createNew(UsageEnvironment &env, FramedSource *inputSource, Boolean iFramesOnly=False, double vshPeriod=5.0, Boolean leavePresentationTimesUnmodified=False)