liveMedia/include/MPEG1or2AudioStreamFramer.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 (1,2) audio elementary stream into frames
00019 // C++ header
00020 
00021 #ifndef _MPEG_1OR2_AUDIO_STREAM_FRAMER_HH
00022 #define _MPEG_1OR2_AUDIO_STREAM_FRAMER_HH
00023 
00024 #ifndef _FRAMED_FILTER_HH
00025 #include "FramedFilter.hh"
00026 #endif
00027 
00028 class MPEG1or2AudioStreamFramer: public FramedFilter {
00029 public:
00030   static MPEG1or2AudioStreamFramer*
00031   createNew(UsageEnvironment& env, FramedSource* inputSource,
00032             Boolean syncWithInputSource = False);
00033   // If "syncWithInputSource" is True, the stream's presentation time
00034   // will be reset to that of the input source, whenever new data
00035   // is read from it.
00036 
00037   void flushInput(); // called if there is a discontinuity (seeking) in the input
00038 
00039 private:
00040   MPEG1or2AudioStreamFramer(UsageEnvironment& env, FramedSource* inputSource,
00041                             Boolean syncWithInputSource);
00042       // called only by createNew()
00043   virtual ~MPEG1or2AudioStreamFramer();
00044 
00045   static void continueReadProcessing(void* clientData,
00046                                      unsigned char* ptr, unsigned size,
00047                                      struct timeval presentationTime);
00048   void continueReadProcessing();
00049 
00050   void resetPresentationTime(struct timeval newPresentationTime);
00051       // useful if we're being synced with a separate (e.g., video) stream
00052 
00053 private:
00054   // redefined virtual functions:
00055   virtual void doGetNextFrame();
00056 
00057 private:
00058   void reset();
00059   struct timeval currentFramePlayTime() const;
00060 
00061 private:
00062   Boolean fSyncWithInputSource;
00063   struct timeval fNextFramePresentationTime;
00064 
00065 private: // parsing state
00066   class MPEG1or2AudioStreamParser* fParser;
00067   friend class MPEG1or2AudioStreamParser; // hack
00068 };
00069 
00070 #endif

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