liveMedia/include/AC3AudioStreamFramer.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 filter that breaks up an AC3 audio elementary stream into frames
00019 // C++ header
00020 
00021 #ifndef _AC3_AUDIO_STREAM_FRAMER_HH
00022 #define _AC3_AUDIO_STREAM_FRAMER_HH
00023 
00024 #ifndef _FRAMED_FILTER_HH
00025 #include "FramedFilter.hh"
00026 #endif
00027 
00028 class AC3AudioStreamFramer: public FramedFilter {
00029 public:
00030   static AC3AudioStreamFramer*
00031   createNew(UsageEnvironment& env, FramedSource* inputSource,
00032             unsigned char streamCode = 0);
00033   // If "streamCode" != 0, then we assume that there's a 1-byte code at the beginning of each chunk of data that we read from
00034   // our source.  If that code is not the value we want, we discard the chunk of data.
00035   // However, if "streamCode" == 0 (the default), then we don't expect this 1-byte code.
00036 
00037   unsigned samplingRate();
00038 
00039   void flushInput(); // called if there is a discontinuity (seeking) in the input
00040 
00041 private:
00042   AC3AudioStreamFramer(UsageEnvironment& env, FramedSource* inputSource,
00043                        unsigned char streamCode);
00044       // called only by createNew()
00045   virtual ~AC3AudioStreamFramer();
00046 
00047   static void handleNewData(void* clientData,
00048                             unsigned char* ptr, unsigned size,
00049                             struct timeval presentationTime);
00050   void handleNewData(unsigned char* ptr, unsigned size);
00051 
00052   void parseNextFrame();
00053 
00054 private:
00055   // redefined virtual functions:
00056   virtual void doGetNextFrame();
00057 
00058 private:
00059   struct timeval currentFramePlayTime() const;
00060 
00061 private:
00062   struct timeval fNextFramePresentationTime;
00063 
00064 private: // parsing state
00065   class AC3AudioStreamParser* fParser;
00066   unsigned char fOurStreamCode;
00067   friend class AC3AudioStreamParser; // hack
00068 };
00069 
00070 #endif

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