liveMedia/include/MPEG1or2VideoStreamDiscreteFramer.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 "MPEG1or2VideoStreamFramer" that takes only
00019 // complete, discrete frames (rather than an arbitrary byte stream) as input.
00020 // This avoids the parsing and data copying overhead of the full
00021 // "MPEG1or2VideoStreamFramer".
00022 // C++ header
00023 
00024 #ifndef _MPEG1or2_VIDEO_STREAM_DISCRETE_FRAMER_HH
00025 #define _MPEG1or2_VIDEO_STREAM_DISCRETE_FRAMER_HH
00026 
00027 #ifndef _MPEG1or2_VIDEO_STREAM_FRAMER_HH
00028 #include "MPEG1or2VideoStreamFramer.hh"
00029 #endif
00030 
00031 #define VSH_MAX_SIZE 1000
00032 
00033 class MPEG1or2VideoStreamDiscreteFramer: public MPEG1or2VideoStreamFramer {
00034 public:
00035   static MPEG1or2VideoStreamDiscreteFramer*
00036   createNew(UsageEnvironment& env, FramedSource* inputSource,
00037             Boolean iFramesOnly = False,
00038             double vshPeriod = 5.0); // see MPEG1or2VideoStreamFramer.hh
00039 
00040 private:
00041   MPEG1or2VideoStreamDiscreteFramer(UsageEnvironment& env,
00042                                     FramedSource* inputSource,
00043                                     Boolean iFramesOnly, double vshPeriod);
00044   // called only by createNew()
00045   virtual ~MPEG1or2VideoStreamDiscreteFramer();
00046 
00047 private:
00048   // redefined virtual functions:
00049   virtual void doGetNextFrame();
00050 
00051 private:
00052   static void afterGettingFrame(void* clientData, unsigned frameSize,
00053                                 unsigned numTruncatedBytes,
00054                                 struct timeval presentationTime,
00055                                 unsigned durationInMicroseconds);
00056   void afterGettingFrame1(unsigned frameSize,
00057                           unsigned numTruncatedBytes,
00058                           struct timeval presentationTime,
00059                           unsigned durationInMicroseconds);
00060 
00061 private:
00062   struct timeval fLastNonBFramePresentationTime;
00063   unsigned fLastNonBFrameTemporal_reference;
00064 
00065   // A saved copy of the most recently seen 'video_sequence_header',
00066   // in case we need to insert it into the stream periodically:
00067   unsigned char fSavedVSHBuffer[VSH_MAX_SIZE];
00068   unsigned fSavedVSHSize;
00069   double fSavedVSHTimestamp;
00070   Boolean fIFramesOnly;
00071   double fVSHPeriod;
00072 };
00073 
00074 #endif

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