| 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 | // A server demultiplexer for a MPEG 1 or 2 Program Stream |
| 19 | // C++ header |
| 20 | |
| 21 | #ifndef _MPEG_1OR2_FILE_SERVER_DEMUX_HH |
| 22 | #define _MPEG_1OR2_FILE_SERVER_DEMUX_HH |
| 23 | |
| 24 | #ifndef _SERVER_MEDIA_SESSION_HH |
| 25 | #include "ServerMediaSession.hh" |
| 26 | #endif |
| 27 | #ifndef _MPEG_1OR2_DEMUXED_ELEMENTARY_STREAM_HH |
| 28 | #include "MPEG1or2DemuxedElementaryStream.hh" |
| 29 | #endif |
| 30 | |
| 31 | class MPEG1or2FileServerDemux: public Medium { |
| 32 | public: |
| 33 | static MPEG1or2FileServerDemux* |
| 34 | createNew(UsageEnvironment& env, char const* fileName, Boolean reuseFirstSource); |
| 35 | |
| 36 | ServerMediaSubsession* newAudioServerMediaSubsession(); // MPEG-1 or 2 audio |
| 37 | ServerMediaSubsession* newVideoServerMediaSubsession(Boolean iFramesOnly = False, |
| 38 | double vshPeriod = 5.0 |
| 39 | /* how often (in seconds) to inject a Video_Sequence_Header, |
| 40 | if one doesn't already appear in the stream */); |
| 41 | ServerMediaSubsession* newAC3AudioServerMediaSubsession(); // AC-3 audio (from VOB) |
| 42 | |
| 43 | unsigned fileSize() const { return fFileSize; } |
| 44 | float fileDuration() const { return fFileDuration; } |
| 45 | |
| 46 | private: |
| 47 | MPEG1or2FileServerDemux(UsageEnvironment& env, char const* fileName, |
| 48 | Boolean reuseFirstSource); |
| 49 | // called only by createNew(); |
| 50 | virtual ~MPEG1or2FileServerDemux(); |
| 51 | |
| 52 | private: |
| 53 | friend class MPEG1or2DemuxedServerMediaSubsession; |
| 54 | MPEG1or2DemuxedElementaryStream* newElementaryStream(unsigned clientSessionId, |
| 55 | u_int8_t streamIdTag); |
| 56 | |
| 57 | private: |
| 58 | char const* fFileName; |
| 59 | unsigned fFileSize; |
| 60 | float fFileDuration; |
| 61 | Boolean fReuseFirstSource; |
| 62 | MPEG1or2Demux* fSession0Demux; |
| 63 | MPEG1or2Demux* fLastCreatedDemux; |
| 64 | unsigned fLastClientSessionId; |
| 65 | }; |
| 66 | |
| 67 | #endif |
| 68 | |