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 MPEG 1 or 2 Elementary Stream, demultiplexed from a Program Stream
19// C++ header
20
21#ifndef _MPEG_1OR2_DEMUXED_ELEMENTARY_STREAM_HH
22#define _MPEG_1OR2_DEMUXED_ELEMENTARY_STREAM_HH
23
24#ifndef _MPEG_1OR2_DEMUX_HH
25#include "MPEG1or2Demux.hh"
26#endif
27
28class MPEG1or2DemuxedElementaryStream: public FramedSource {
29public:
30 MPEG1or2Demux::SCR lastSeenSCR() const { return fLastSeenSCR; }
31
32 unsigned char mpegVersion() const { return fMPEGversion; }
33
34 MPEG1or2Demux& sourceDemux() const { return fOurSourceDemux; }
35
36private: // We are created only by a MPEG1or2Demux (a friend)
37 MPEG1or2DemuxedElementaryStream(UsageEnvironment& env,
38 u_int8_t streamIdTag,
39 MPEG1or2Demux& sourceDemux);
40 virtual ~MPEG1or2DemuxedElementaryStream();
41
42private:
43 // redefined virtual functions:
44 virtual void doGetNextFrame();
45 virtual void doStopGettingFrames();
46 virtual char const* MIMEtype() const;
47 virtual unsigned maxFrameSize() const;
48
49private:
50 static void afterGettingFrame(void* clientData,
51 unsigned frameSize, unsigned numTruncatedBytes,
52 struct timeval presentationTime,
53 unsigned durationInMicroseconds);
54
55 void afterGettingFrame1(unsigned frameSize, unsigned numTruncatedBytes,
56 struct timeval presentationTime,
57 unsigned durationInMicroseconds);
58
59private:
60 u_int8_t fOurStreamIdTag;
61 MPEG1or2Demux& fOurSourceDemux;
62 char const* fMIMEtype;
63 MPEG1or2Demux::SCR fLastSeenSCR;
64 unsigned char fMPEGversion;
65
66 friend class MPEG1or2Demux;
67};
68
69#endif
70