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 // MP3 File Sources 00019 // C++ header 00020 00021 #ifndef _MP3_FILE_SOURCE_HH 00022 #define _MP3_FILE_SOURCE_HH 00023 00024 #ifndef _FRAMED_FILE_SOURCE_HH 00025 #include "FramedFileSource.hh" 00026 #endif 00027 00028 class MP3StreamState; // forward 00029 00030 class MP3FileSource: public FramedFileSource { 00031 public: 00032 static MP3FileSource* createNew(UsageEnvironment& env, char const* fileName); 00033 00034 float filePlayTime() const; 00035 unsigned fileSize() const; 00036 void setPresentationTimeScale(unsigned scale); 00037 void seekWithinFile(double seekNPT, double streamDuration); 00038 // if "streamDuration" is >0.0, then we limit the stream to that duration, before treating it as EOF 00039 00040 protected: 00041 MP3FileSource(UsageEnvironment& env, FILE* fid); 00042 // called only by createNew() 00043 00044 virtual ~MP3FileSource(); 00045 00046 protected: 00047 void assignStream(FILE* fid, unsigned filesize); 00048 Boolean initializeStream(); 00049 00050 MP3StreamState* streamState() {return fStreamState;} 00051 00052 private: 00053 // redefined virtual functions: 00054 virtual void doGetNextFrame(); 00055 virtual char const* MIMEtype() const; 00056 virtual void getAttributes() const; 00057 00058 private: 00059 virtual Boolean doGetNextFrame1(); 00060 00061 private: 00062 MP3StreamState* fStreamState; 00063 Boolean fHaveJustInitialized; 00064 struct timeval fFirstFramePresentationTime; // set on stream init 00065 Boolean fLimitNumBytesToStream; 00066 unsigned fNumBytesToStream; // used iff "fLimitNumBytesToStream" is True 00067 }; 00068 00069 #endif
1.5.2