liveMedia/include/MP3ADU.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 // 'ADU' MP3 streams (for improved loss-tolerance)
00019 // C++ header
00020 
00021 #ifndef _MP3_ADU_HH
00022 #define _MP3_ADU_HH
00023 
00024 #ifndef _FRAMED_FILTER_HH
00025 #include "FramedFilter.hh"
00026 #endif
00027 
00028 class ADUFromMP3Source: public FramedFilter {
00029 public:
00030   static ADUFromMP3Source* createNew(UsageEnvironment& env,
00031                                      FramedSource* inputSource,
00032                                      Boolean includeADUdescriptors = True);
00033 
00034   void resetInput();
00035       // This is called whenever there's a discontinuity in the input MP3 source
00036       // (e.g., due to seeking within the source).  It causes any still-unprocessed
00037       // MP3 frame data within our queue to be discarded, so that it does not
00038       // erroneously get used by backpointers from the new MP3 frames.
00039 
00040   Boolean setScaleFactor(int scale);
00041 
00042 protected:
00043   ADUFromMP3Source(UsageEnvironment& env,
00044                    FramedSource* inputSource,
00045                    Boolean includeADUdescriptors);
00046       // called only by createNew()
00047   virtual ~ADUFromMP3Source();
00048 
00049 private:
00050   // Redefined virtual functions:
00051   virtual void doGetNextFrame();
00052   virtual char const* MIMEtype() const;
00053 
00054 private:
00055   Boolean doGetNextFrame1();
00056 
00057 private:
00058   Boolean fAreEnqueueingMP3Frame;
00059   class SegmentQueue* fSegments;
00060   Boolean fIncludeADUdescriptors;
00061   unsigned fTotalDataSizeBeforePreviousRead;
00062   int fScale;
00063   unsigned fFrameCounter;
00064 };
00065 
00066 class MP3FromADUSource: public FramedFilter {
00067 public:
00068   static MP3FromADUSource* createNew(UsageEnvironment& env,
00069                                      FramedSource* inputSource,
00070                                      Boolean includeADUdescriptors = True);
00071 
00072 protected:
00073   MP3FromADUSource(UsageEnvironment& env,
00074                    FramedSource* inputSource,
00075                    Boolean includeADUdescriptors);
00076       // called only by createNew()
00077   virtual ~MP3FromADUSource();
00078 
00079 private:
00080   // Redefined virtual functions:
00081   virtual void doGetNextFrame();
00082   virtual char const* MIMEtype() const;
00083 
00084 private:
00085   Boolean needToGetAnADU();
00086   void insertDummyADUsIfNecessary();
00087   Boolean generateFrameFromHeadADU();
00088 
00089 private:
00090   Boolean fAreEnqueueingADU;
00091   class SegmentQueue* fSegments;
00092   Boolean fIncludeADUdescriptors;
00093 };
00094 
00095 // Definitions of external C functions that implement various MP3 operations:
00096 extern "C" int mp3ZeroOutSideInfo(unsigned char*, unsigned, unsigned);
00097 
00098 #endif

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