live
MP3FileSource.hh
Go to the documentation of this file.
1 /**********
2 This library is free software; you can redistribute it and/or modify it under
3 the terms of the GNU Lesser General Public License as published by the
4 Free Software Foundation; either version 3 of the License, or (at your
5 option) any later version. (See <http://www.gnu.org/copyleft/lesser.html>.)
6 
7 This library is distributed in the hope that it will be useful, but WITHOUT
8 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
9 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
10 more details.
11 
12 You should have received a copy of the GNU Lesser General Public License
13 along with this library; if not, write to the Free Software Foundation, Inc.,
14 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
15 **********/
16 // "liveMedia"
17 // Copyright (c) 1996-2021 Live Networks, Inc. All rights reserved.
18 // MP3 File Sources
19 // C++ header
20 
21 #ifndef _MP3_FILE_SOURCE_HH
22 #define _MP3_FILE_SOURCE_HH
23 
24 #ifndef _FRAMED_FILE_SOURCE_HH
25 #include "FramedFileSource.hh"
26 #endif
27 
28 class MP3StreamState; // forward
29 
31 public:
32  static MP3FileSource* createNew(UsageEnvironment& env, char const* fileName);
33 
34  float filePlayTime() const;
35  unsigned fileSize() const;
36  void setPresentationTimeScale(unsigned scale);
37  void seekWithinFile(double seekNPT, double streamDuration);
38  // if "streamDuration" is >0.0, then we limit the stream to that duration, before treating it as EOF
39 
40 protected:
41  MP3FileSource(UsageEnvironment& env, FILE* fid);
42  // called only by createNew()
43 
44  virtual ~MP3FileSource();
45 
46 protected:
47  void assignStream(FILE* fid, unsigned filesize);
49 
51 
52 private:
53  // redefined virtual functions:
54  virtual void doGetNextFrame();
55  virtual char const* MIMEtype() const;
56  virtual void getAttributes() const;
57 
58 private:
59  static void fileReadableHandler(MP3FileSource* source, int mask);
60 
61 private:
66  struct timeval fFirstFramePresentationTime; // set on stream init
68  unsigned fNumBytesToStream; // used iff "fLimitNumBytesToStream" is True
69 };
70 
71 #endif
unsigned char Boolean
Definition: Boolean.hh:25
unsigned fHaveBeenInitialized
MP3StreamState * streamState()
virtual void doGetNextFrame()
virtual void getAttributes() const
Boolean fHaveStartedReading
void seekWithinFile(double seekNPT, double streamDuration)
virtual char const * MIMEtype() const
static void fileReadableHandler(MP3FileSource *source, int mask)
virtual ~MP3FileSource()
unsigned fNumBytesToStream
unsigned fileSize() const
float filePlayTime() const
MP3FileSource(UsageEnvironment &env, FILE *fid)
void assignStream(FILE *fid, unsigned filesize)
void setPresentationTimeScale(unsigned scale)
Boolean fLimitNumBytesToStream
Boolean fFidIsSeekable
struct timeval fFirstFramePresentationTime
static MP3FileSource * createNew(UsageEnvironment &env, char const *fileName)
Boolean initializeStream()
MP3StreamState * fStreamState