00001 /********** 00002 This library is free software; you can redistribute it and/or modify it under 00003 the terms of the GNU Lesser General Public License as published by the 00004 Free Software Foundation; either version 2.1 of the License, or (at your 00005 option) any later version. (See <http://www.gnu.org/copyleft/lesser.html>.) 00006 00007 This library is distributed in the hope that it will be useful, but WITHOUT 00008 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00009 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 00010 more details. 00011 00012 You should have received a copy of the GNU Lesser General Public License 00013 along with this library; if not, write to the Free Software Foundation, Inc., 00014 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00015 **********/ 00016 // "liveMedia" 00017 // Copyright (c) 1996-2013 Live Networks, Inc. All rights reserved. 00018 // A filter for converting a stream of MPEG PES packets to a MPEG-2 Transport Stream 00019 // C++ header 00020 00021 #ifndef _MPEG2_TRANSPORT_STREAM_FROM_PES_SOURCE_HH 00022 #define _MPEG2_TRANSPORT_STREAM_FROM_PES_SOURCE_HH 00023 00024 #ifndef _MPEG2_TRANSPORT_STREAM_MULTIPLEXOR_HH 00025 #include "MPEG2TransportStreamMultiplexor.hh" 00026 #endif 00027 #ifndef _MPEG_1OR2_DEMUXED_ELEMENTARY_STREAM_HH 00028 #include "MPEG1or2DemuxedElementaryStream.hh" 00029 #endif 00030 00031 class MPEG2TransportStreamFromPESSource: public MPEG2TransportStreamMultiplexor { 00032 public: 00033 static MPEG2TransportStreamFromPESSource* 00034 createNew(UsageEnvironment& env, MPEG1or2DemuxedElementaryStream* inputSource); 00035 00036 protected: 00037 MPEG2TransportStreamFromPESSource(UsageEnvironment& env, 00038 MPEG1or2DemuxedElementaryStream* inputSource); 00039 // called only by createNew() 00040 virtual ~MPEG2TransportStreamFromPESSource(); 00041 00042 private: 00043 // Redefined virtual functions: 00044 virtual void doStopGettingFrames(); 00045 virtual void awaitNewBuffer(unsigned char* oldBuffer); 00046 00047 private: 00048 static void afterGettingFrame(void* clientData, unsigned frameSize, 00049 unsigned numTruncatedBytes, 00050 struct timeval presentationTime, 00051 unsigned durationInMicroseconds); 00052 void afterGettingFrame1(unsigned frameSize, 00053 unsigned numTruncatedBytes, 00054 struct timeval presentationTime, 00055 unsigned durationInMicroseconds); 00056 00057 private: 00058 MPEG1or2DemuxedElementaryStream* fInputSource; 00059 unsigned char* fInputBuffer; 00060 }; 00061 00062 #endif
1.5.2