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// 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
31class MPEG1or2FileServerDemux: public Medium {
32public:
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
46private:
47 MPEG1or2FileServerDemux(UsageEnvironment& env, char const* fileName,
48 Boolean reuseFirstSource);
49 // called only by createNew();
50 virtual ~MPEG1or2FileServerDemux();
51
52private:
53 friend class MPEG1or2DemuxedServerMediaSubsession;
54 MPEG1or2DemuxedElementaryStream* newElementaryStream(unsigned clientSessionId,
55 u_int8_t streamIdTag);
56
57private:
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