live
DVVideoStreamFramer.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 parses a DV input stream into DV frames to deliver to the downstream object
19 // C++ header
20 
21 #ifndef _DV_VIDEO_STREAM_FRAMER_HH
22 #define _DV_VIDEO_STREAM_FRAMER_HH
23 
24 #ifndef _FRAMED_FILTER_HH
25 #include "FramedFilter.hh"
26 #endif
27 
28 #define DV_DIF_BLOCK_SIZE 80
29 #define DV_NUM_BLOCKS_PER_SEQUENCE 150
30 #define DV_SAVED_INITIAL_BLOCKS_SIZE ((DV_NUM_BLOCKS_PER_SEQUENCE+6-1)*DV_DIF_BLOCK_SIZE)
31  /* enough data to ensure that it contains an intact 6-block header (which occurs at the start of a 150-block sequence) */
32 
34 public:
35  static DVVideoStreamFramer*
37  Boolean sourceIsSeekable = False, Boolean leavePresentationTimesUnmodified = False);
38  // Set "sourceIsSeekable" to True if the input source is a seekable object (e.g. a file), and the server that uses us
39  // does a seek-to-zero on the source before reading from it. (Our RTSP server implementation does this.)
40  char const* profileName();
41  Boolean getFrameParameters(unsigned& frameSize/*bytes*/, double& frameDuration/*microseconds*/);
42 
43 protected:
45  Boolean sourceIsSeekable, Boolean leavePresentationTimesUnmodified);
46  // called only by createNew(), or by subclass constructors
48 
49 protected:
50  // redefined virtual functions:
51  virtual Boolean isDVVideoStreamFramer() const;
52  virtual void doGetNextFrame();
53 
54 protected:
55  void getAndDeliverData(); // used to implement "doGetNextFrame()"
56  static void afterGettingFrame(void* clientData, unsigned frameSize,
57  unsigned numTruncatedBytes,
58  struct timeval presentationTime,
59  unsigned durationInMicroseconds);
60  void afterGettingFrame(unsigned frameSize, unsigned numTruncatedBytes, struct timeval presentationTime);
61  void getProfile();
62 
63 protected:
65  void const* fOurProfile;
66  struct timeval fNextFramePresentationTime;
70 };
71 
72 #endif
const Boolean False
Definition: Boolean.hh:28
unsigned char Boolean
Definition: Boolean.hh:25
#define DV_SAVED_INITIAL_BLOCKS_SIZE
virtual void doGetNextFrame()
Boolean fLeavePresentationTimesUnmodified
char const * profileName()
static void afterGettingFrame(void *clientData, unsigned frameSize, unsigned numTruncatedBytes, struct timeval presentationTime, unsigned durationInMicroseconds)
static DVVideoStreamFramer * createNew(UsageEnvironment &env, FramedSource *inputSource, Boolean sourceIsSeekable=False, Boolean leavePresentationTimesUnmodified=False)
struct timeval fNextFramePresentationTime
unsigned char fSavedInitialBlocks[DV_SAVED_INITIAL_BLOCKS_SIZE]
Boolean getFrameParameters(unsigned &frameSize, double &frameDuration)
virtual Boolean isDVVideoStreamFramer() const
virtual ~DVVideoStreamFramer()
void afterGettingFrame(unsigned frameSize, unsigned numTruncatedBytes, struct timeval presentationTime)
DVVideoStreamFramer(UsageEnvironment &env, FramedSource *inputSource, Boolean sourceIsSeekable, Boolean leavePresentationTimesUnmodified)
FramedSource * inputSource() const
Definition: FramedFilter.hh:30