live
MP3FileSource.hh
Go to the documentation of this file.
1/**********
2This library is free software; you can redistribute it and/or modify it under
3the terms of the GNU Lesser General Public License as published by the
4Free Software Foundation; either version 3 of the License, or (at your
5option) any later version. (See <http://www.gnu.org/copyleft/lesser.html>.)
6
7This library is distributed in the hope that it will be useful, but WITHOUT
8ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
9FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
10more details.
11
12You should have received a copy of the GNU Lesser General Public License
13along with this library; if not, write to the Free Software Foundation, Inc.,
1451 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
15**********/
16// "liveMedia"
17// Copyright (c) 1996-2024 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
28class MP3StreamState; // forward
29
31public:
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
40protected:
42 // called only by createNew()
43
44 virtual ~MP3FileSource();
45
46protected:
47 void assignStream(FILE* fid, unsigned filesize);
49
51
52private:
53 // redefined virtual functions:
54 virtual void doGetNextFrame();
55 virtual char const* MIMEtype() const;
56 virtual void getAttributes() const;
57
58private:
59 static void fileReadableHandler(MP3FileSource* source, int mask);
60
61private:
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
MP3StreamState * streamState()
unsigned fHaveBeenInitialized
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
static MP3FileSource * createNew(UsageEnvironment &env, char const *fileName)
Boolean fFidIsSeekable
struct timeval fFirstFramePresentationTime
Boolean initializeStream()
MP3StreamState * fStreamState