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-2013 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, // see MPEG1or2VideoStreamFramer.hh
00038             double vshPeriod = 5.0, // see MPEG1or2VideoStreamFramer.hh
00039             Boolean leavePresentationTimesUnmodified = False);
00040 
00041 protected:
00042   MPEG1or2VideoStreamDiscreteFramer(UsageEnvironment& env,
00043                                     FramedSource* inputSource,
00044                                     Boolean iFramesOnly, double vshPeriod, Boolean leavePresentationTimesUnmodified);
00045   // called only by createNew()
00046   virtual ~MPEG1or2VideoStreamDiscreteFramer();
00047 
00048 protected:
00049   // redefined virtual functions:
00050   virtual void doGetNextFrame();
00051 
00052 protected:
00053   static void afterGettingFrame(void* clientData, unsigned frameSize,
00054                                 unsigned numTruncatedBytes,
00055                                 struct timeval presentationTime,
00056                                 unsigned durationInMicroseconds);
00057   void afterGettingFrame1(unsigned frameSize,
00058                           unsigned numTruncatedBytes,
00059                           struct timeval presentationTime,
00060                           unsigned durationInMicroseconds);
00061 
00062 protected:
00063   Boolean fLeavePresentationTimesUnmodified;
00064   struct timeval fLastNonBFramePresentationTime;
00065   unsigned fLastNonBFrameTemporal_reference;
00066 
00067   // A saved copy of the most recently seen 'video_sequence_header',
00068   // in case we need to insert it into the stream periodically:
00069   unsigned char fSavedVSHBuffer[VSH_MAX_SIZE];
00070   unsigned fSavedVSHSize;
00071   double fSavedVSHTimestamp;
00072   Boolean fIFramesOnly;
00073   double fVSHPeriod;
00074 };
00075 
00076 #endif

Generated on Mon Apr 29 13:28:01 2013 for live by  doxygen 1.5.2