live
MPEG2TransportStreamTrickModeFilter.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.// A filter that converts a MPEG Transport Stream file - with corresponding index file
18// - to a corresponding Video Elementary Stream. It also uses a "scale" parameter
19// to implement 'trick mode' (fast forward or reverse play, using I-frames) on
20// the video stream.
21// C++ header
22
23#ifndef _MPEG2_TRANSPORT_STREAM_TRICK_MODE_FILTER_HH
24#define _MPEG2_TRANSPORT_STREAM_TRICK_MODE_FILTER_HH
25
26#ifndef _FRAMED_FILTER_HH
27#include "FramedFilter.hh"
28#endif
29
30#ifndef _MPEG2_TRANSPORT_STREAM_INDEX_FILE_HH
32#endif
33
34#ifndef TRANSPORT_PACKET_SIZE
35#define TRANSPORT_PACKET_SIZE 188
36#endif
37
39public:
42 MPEG2TransportStreamIndexFile* indexFile, int scale);
43
44 Boolean seekTo(unsigned long tsPacketNumber, unsigned long indexRecordNumber);
45
46 unsigned long nextIndexRecordNum() const { return fNextIndexRecordNum; }
47
49 // this lets us delete this without also deleting the input Transport Stream
50
51protected:
53 MPEG2TransportStreamIndexFile* indexFile, int scale);
54 // called only by createNew()
56
57private:
58 // Redefined virtual functions:
59 virtual void doGetNextFrame();
60 virtual void doStopGettingFrames();
61
62private:
64 void seekToTransportPacket(unsigned long tsPacketNum);
65 void readTransportPacket(unsigned long tsPacketNum); // asynchronously
66
67 static void afterGettingFrame(void* clientData, unsigned frameSize,
68 unsigned numTruncatedBytes,
69 struct timeval presentationTime,
70 unsigned durationInMicroseconds);
71 void afterGettingFrame1(unsigned frameSize);
72
73 static void onSourceClosure(void* clientData);
75
76private:
79 int fScale; // absolute value
80 int fDirection; // 1 => forward; -1 => reverse
81 enum {
86 unsigned fFrameCount;
87 unsigned long fNextIndexRecordNum; // next to be read from the index file
88 unsigned long fNextTSPacketNum; // next to be read from the transport stream file
90 unsigned long fCurrentTSPacketNum; // corresponding to data currently in the buffer
91 unsigned long fDesiredTSPacketNum;
97};
98
99#endif
unsigned char Boolean
Definition: Boolean.hh:25
#define NULL
FramedSource * fInputSource
Definition: FramedFilter.hh:49
FramedSource * inputSource() const
Definition: FramedFilter.hh:30
static void afterGettingFrame(void *clientData, unsigned frameSize, unsigned numTruncatedBytes, struct timeval presentationTime, unsigned durationInMicroseconds)
unsigned char fInputBuffer[TRANSPORT_PACKET_SIZE]
static void onSourceClosure(void *clientData)
void seekToTransportPacket(unsigned long tsPacketNum)
void afterGettingFrame1(unsigned frameSize)
MPEG2TransportStreamTrickModeFilter(UsageEnvironment &env, FramedSource *inputSource, MPEG2TransportStreamIndexFile *indexFile, int scale)
enum MPEG2TransportStreamTrickModeFilter::@3 fState
void readTransportPacket(unsigned long tsPacketNum)
static MPEG2TransportStreamTrickModeFilter * createNew(UsageEnvironment &env, FramedSource *inputSource, MPEG2TransportStreamIndexFile *indexFile, int scale)
Boolean seekTo(unsigned long tsPacketNumber, unsigned long indexRecordNumber)