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-2020 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
30class MP3FileSource: public FramedFileSource {
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:
41 MP3FileSource(UsageEnvironment& env, FILE* fid);
42 // called only by createNew()
43
44 virtual ~MP3FileSource();
45
46protected:
47 void assignStream(FILE* fid, unsigned filesize);
48 Boolean initializeStream();
49
50 MP3StreamState* streamState() {return fStreamState;}
51
52private:
53 // redefined virtual functions:
54 virtual void doGetNextFrame();
55 virtual char const* MIMEtype() const;
56 virtual void getAttributes() const;
57
58private:
59 virtual Boolean doGetNextFrame1();
60
61private:
62 MP3StreamState* fStreamState;
63 Boolean fHaveJustInitialized;
64 struct timeval fFirstFramePresentationTime; // set on stream init
65 Boolean fLimitNumBytesToStream;
66 unsigned fNumBytesToStream; // used iff "fLimitNumBytesToStream" is True
67};
68
69#endif
70