live
MPEG2IndexFromTransportStream.hh
Go to the documentation of this file.
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-2024 Live Networks, Inc. All rights reserved.
18// A filter that produces a sequence of I-frame indices from a MPEG-2 Transport Stream
19// C++ header
20
21#ifndef _MPEG2_IFRAME_INDEX_FROM_TRANSPORT_STREAM_HH
22#define _MPEG2_IFRAME_INDEX_FROM_TRANSPORT_STREAM_HH
23
24#ifndef _FRAMED_FILTER_HH
25#include "FramedFilter.hh"
26#endif
27
28#ifndef TRANSPORT_PACKET_SIZE
29#define TRANSPORT_PACKET_SIZE 188
30#endif
31
32#ifndef MAX_PES_PACKET_SIZE
33#define MAX_PES_PACKET_SIZE 65536
34#endif
35
36class IndexRecord; // forward
37
39public:
42
43protected:
46 // called only by createNew()
48
49private:
50 // Redefined virtual functions:
51 virtual void doGetNextFrame();
52
53private:
54 static void afterGettingFrame(void* clientData, unsigned frameSize,
55 unsigned numTruncatedBytes,
56 struct timeval presentationTime,
57 unsigned durationInMicroseconds);
58 void afterGettingFrame1(unsigned frameSize,
59 unsigned numTruncatedBytes,
60 struct timeval presentationTime,
61 unsigned durationInMicroseconds);
62
63 static void handleInputClosure(void* clientData);
65
66 void analyzePAT(unsigned char* pkt, unsigned size);
67 void analyzePMT(unsigned char* pkt, unsigned size);
68
71 Boolean parseToNextCode(unsigned char& nextCode);
73 void addToTail(IndexRecord* newIndexRecord);
74
75private:
76 Boolean fIsH264; // True iff the video is H.264 (encapsulated in a Transport Stream)
77 Boolean fIsH265; // True iff the video is H.265 (encapsulated in a Transport Stream)
83 u_int16_t fPMT_PID, fVideo_PID;
84 // Note: We assume: 1 program per Transport Stream; 1 video stream per program
86 unsigned char* fParseBuffer;
91 IndexRecord* fHeadIndexRecord;
92 IndexRecord* fTailIndexRecord;
93};
94
95#endif
unsigned char Boolean
Definition: Boolean.hh:25
#define TRANSPORT_PACKET_SIZE
FramedSource * inputSource() const
Definition: FramedFilter.hh:30
Boolean parseToNextCode(unsigned char &nextCode)
MPEG2IFrameIndexFromTransportStream(UsageEnvironment &env, FramedSource *inputSource)
static void afterGettingFrame(void *clientData, unsigned frameSize, unsigned numTruncatedBytes, struct timeval presentationTime, unsigned durationInMicroseconds)
void analyzePAT(unsigned char *pkt, unsigned size)
void analyzePMT(unsigned char *pkt, unsigned size)
static MPEG2IFrameIndexFromTransportStream * createNew(UsageEnvironment &env, FramedSource *inputSource)
unsigned char fInputBuffer[TRANSPORT_PACKET_SIZE]
void afterGettingFrame1(unsigned frameSize, unsigned numTruncatedBytes, struct timeval presentationTime, unsigned durationInMicroseconds)
void addToTail(IndexRecord *newIndexRecord)
static void handleInputClosure(void *clientData)