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-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 | |
28 | class MP3StreamState; // forward |
29 | |
30 | class MP3FileSource: public FramedFileSource { |
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); |
48 | Boolean initializeStream(); |
49 | |
50 | MP3StreamState* streamState() {return fStreamState;} |
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 | virtual Boolean doGetNextFrame1(); |
60 | |
61 | private: |
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 | |