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 filter for converting a stream of MPEG PES packets to a MPEG-2 Transport Stream
19// C++ header
20
21#ifndef _MPEG2_TRANSPORT_STREAM_FROM_PES_SOURCE_HH
22#define _MPEG2_TRANSPORT_STREAM_FROM_PES_SOURCE_HH
23
24#ifndef _MPEG2_TRANSPORT_STREAM_MULTIPLEXOR_HH
25#include "MPEG2TransportStreamMultiplexor.hh"
26#endif
27#ifndef _MPEG_1OR2_DEMUXED_ELEMENTARY_STREAM_HH
28#include "MPEG1or2DemuxedElementaryStream.hh"
29#endif
30
31class MPEG2TransportStreamFromPESSource: public MPEG2TransportStreamMultiplexor {
32public:
33 static MPEG2TransportStreamFromPESSource*
34 createNew(UsageEnvironment& env, MPEG1or2DemuxedElementaryStream* inputSource);
35
36protected:
37 MPEG2TransportStreamFromPESSource(UsageEnvironment& env,
38 MPEG1or2DemuxedElementaryStream* inputSource);
39 // called only by createNew()
40 virtual ~MPEG2TransportStreamFromPESSource();
41
42private:
43 // Redefined virtual functions:
44 virtual void doStopGettingFrames();
45 virtual void awaitNewBuffer(unsigned char* oldBuffer);
46
47private:
48 static void afterGettingFrame(void* clientData, unsigned frameSize,
49 unsigned numTruncatedBytes,
50 struct timeval presentationTime,
51 unsigned durationInMicroseconds);
52 void afterGettingFrame1(unsigned frameSize,
53 unsigned numTruncatedBytes,
54 struct timeval presentationTime,
55 unsigned durationInMicroseconds);
56
57private:
58 MPEG1or2DemuxedElementaryStream* fInputSource;
59 unsigned char* fInputBuffer;
60};
61
62#endif
63