liveMedia/include/MPEG4VideoStreamDiscreteFramer.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 simplified version of "MPEG4VideoStreamFramer" that takes only complete,
00019 // discrete frames (rather than an arbitrary byte stream) as input.
00020 // This avoids the parsing and data copying overhead of the full
00021 // "MPEG4VideoStreamFramer".
00022 // C++ header
00023 
00024 #ifndef _MPEG4_VIDEO_STREAM_DISCRETE_FRAMER_HH
00025 #define _MPEG4_VIDEO_STREAM_DISCRETE_FRAMER_HH
00026 
00027 #ifndef _MPEG4_VIDEO_STREAM_FRAMER_HH
00028 #include "MPEG4VideoStreamFramer.hh"
00029 #endif
00030 
00031 class MPEG4VideoStreamDiscreteFramer: public MPEG4VideoStreamFramer {
00032 public:
00033   static MPEG4VideoStreamDiscreteFramer*
00034   createNew(UsageEnvironment& env, FramedSource* inputSource);
00035 
00036 protected:
00037   MPEG4VideoStreamDiscreteFramer(UsageEnvironment& env,
00038                                  FramedSource* inputSource);
00039       // called only by createNew()
00040   virtual ~MPEG4VideoStreamDiscreteFramer();
00041 
00042 protected:
00043   // redefined virtual functions:
00044   virtual void doGetNextFrame();
00045 
00046 protected:
00047   static void afterGettingFrame(void* clientData, unsigned frameSize,
00048                                 unsigned numTruncatedBytes,
00049                                 struct timeval presentationTime,
00050                                 unsigned durationInMicroseconds);
00051   void afterGettingFrame1(unsigned frameSize,
00052                           unsigned numTruncatedBytes,
00053                           struct timeval presentationTime,
00054                           unsigned durationInMicroseconds);
00055 
00056   Boolean getNextFrameBit(u_int8_t& result);
00057   Boolean getNextFrameBits(unsigned numBits, u_int32_t& result);
00058     // Which are used by:
00059   void analyzeVOLHeader();
00060 
00061 protected:
00062   u_int32_t vop_time_increment_resolution;
00063   unsigned fNumVTIRBits;
00064   // # of bits needed to count to "vop_time_increment_resolution"
00065   struct timeval fLastNonBFramePresentationTime;
00066   unsigned fLastNonBFrameVop_time_increment;
00067 
00068 private:
00069   unsigned fNumBitsSeenSoFar; // used by the getNextFrameBit*() routines
00070 };
00071 
00072 #endif

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