liveMedia/include/MPEGVideoStreamFramer.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 breaks up an MPEG video elementary stream into
00019 //   headers and frames
00020 // C++ header
00021 
00022 #ifndef _MPEG_VIDEO_STREAM_FRAMER_HH
00023 #define _MPEG_VIDEO_STREAM_FRAMER_HH
00024 
00025 #ifndef _FRAMED_FILTER_HH
00026 #include "FramedFilter.hh"
00027 #endif
00028 
00029 class TimeCode {
00030 public:
00031   TimeCode();
00032   virtual ~TimeCode();
00033 
00034   int operator==(TimeCode const& arg2);
00035   unsigned days, hours, minutes, seconds, pictures;
00036 };
00037 
00038 class MPEGVideoStreamFramer: public FramedFilter {
00039 public:
00040   Boolean& pictureEndMarker() { return fPictureEndMarker; }
00041       // a hack for implementing the RTP 'M' bit
00042 
00043   void flushInput(); // called if there is a discontinuity (seeking) in the input
00044 
00045 protected:
00046   MPEGVideoStreamFramer(UsageEnvironment& env, FramedSource* inputSource);
00047       // we're an abstract base class
00048   virtual ~MPEGVideoStreamFramer();
00049 
00050   void computePresentationTime(unsigned numAdditionalPictures);
00051       // sets "fPresentationTime"
00052   void setTimeCode(unsigned hours, unsigned minutes, unsigned seconds,
00053                    unsigned pictures, unsigned picturesSinceLastGOP);
00054 
00055 private: // redefined virtual functions
00056   virtual void doGetNextFrame();
00057 
00058 private:
00059   void reset();
00060 
00061   static void continueReadProcessing(void* clientData,
00062                                      unsigned char* ptr, unsigned size,
00063                                      struct timeval presentationTime);
00064   void continueReadProcessing();
00065 
00066 protected:
00067   double fFrameRate; // Note: For MPEG-4, this is really a 'tick rate'
00068   unsigned fPictureCount; // hack used to implement doGetNextFrame()
00069   Boolean fPictureEndMarker;
00070   struct timeval fPresentationTimeBase;
00071 
00072   // parsing state
00073   class MPEGVideoStreamParser* fParser;
00074   friend class MPEGVideoStreamParser; // hack
00075 
00076 private:
00077   TimeCode fCurGOPTimeCode, fPrevGOPTimeCode;
00078   unsigned fPicturesAdjustment;
00079   double fPictureTimeBase;
00080   unsigned fTcSecsBase;
00081   Boolean fHaveSeenFirstTimeCode;
00082 };
00083 
00084 #endif

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