liveMedia/include/DVVideoStreamFramer.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-2012 Live Networks, Inc.  All rights reserved.
00018 // A filter that parses a DV input stream into DV frames to deliver to the downstream object
00019 // C++ header
00020 
00021 #ifndef _DV_VIDEO_STREAM_FRAMER_HH
00022 #define _DV_VIDEO_STREAM_FRAMER_HH
00023 
00024 #ifndef _FRAMED_FILTER_HH
00025 #include "FramedFilter.hh"
00026 #endif
00027 
00028 #define DV_DIF_BLOCK_SIZE 80
00029 #define DV_NUM_BLOCKS_PER_SEQUENCE 150
00030 #define DV_SAVED_INITIAL_BLOCKS_SIZE ((DV_NUM_BLOCKS_PER_SEQUENCE+6-1)*DV_DIF_BLOCK_SIZE)
00031     /* enough data to ensure that it contains an intact 6-block header (which occurs at the start of a 150-block sequence) */
00032 
00033 class DVVideoStreamFramer: public FramedFilter {
00034 public:
00035   static DVVideoStreamFramer*
00036   createNew(UsageEnvironment& env, FramedSource* inputSource, Boolean sourceIsSeekable = False);
00037       // Set "sourceIsSeekable" to True if the input source is a seekable object (e.g. a file), and the server that uses us
00038       // does a seek-to-zero on the source before reading from it.  (Our RTSP server implementation does this.)
00039   char const* profileName();
00040   Boolean getFrameParameters(unsigned& frameSize/*bytes*/, double& frameDuration/*microseconds*/);
00041 
00042 protected:
00043   DVVideoStreamFramer(UsageEnvironment& env, FramedSource* inputSource, Boolean sourceIsSeekable);
00044       // called only by createNew(), or by subclass constructors
00045   virtual ~DVVideoStreamFramer();
00046 
00047 private:
00048   // redefined virtual functions:
00049   virtual Boolean isDVVideoStreamFramer() const;
00050   virtual void doGetNextFrame();
00051 
00052 private:
00053   void getAndDeliverData(); // used to implement "doGetNextFrame()"
00054   static void afterGettingFrame(void* clientData, unsigned frameSize,
00055                                 unsigned numTruncatedBytes,
00056                                 struct timeval presentationTime,
00057                                 unsigned durationInMicroseconds);
00058   void afterGettingFrame1(unsigned frameSize, unsigned numTruncatedBytes);
00059   void getProfile();
00060 
00061 private:
00062   void const* fOurProfile;
00063   struct timeval fNextFramePresentationTime;
00064   unsigned char fSavedInitialBlocks[DV_SAVED_INITIAL_BLOCKS_SIZE];
00065   char fInitialBlocksPresent;
00066   Boolean fSourceIsSeekable;
00067 };
00068 
00069 #endif

Generated on Thu May 17 07:11:45 2012 for live by  doxygen 1.5.2