├── Android.mk ├── LICENSE ├── README.md ├── RTSPLib ├── Android.mk ├── BasicUsageEnvironment │ ├── BasicHashTable.cpp │ ├── BasicTaskScheduler.cpp │ ├── BasicTaskScheduler0.cpp │ ├── BasicUsageEnvironment.cpp │ ├── BasicUsageEnvironment0.cpp │ ├── DelayQueue.cpp │ └── include │ │ ├── BasicHashTable.hh │ │ ├── BasicUsageEnvironment.hh │ │ ├── BasicUsageEnvironment0.hh │ │ ├── BasicUsageEnvironment_version.hh │ │ ├── DelayQueue.hh │ │ └── HandlerSet.hh ├── UsageEnvironment │ ├── HashTable.cpp │ ├── UsageEnvironment.cpp │ ├── include │ │ ├── Boolean.hh │ │ ├── HashTable.hh │ │ ├── UsageEnvironment.hh │ │ ├── UsageEnvironment_version.hh │ │ └── strDup.hh │ └── strDup.cpp ├── groupsock │ ├── GroupEId.cpp │ ├── Groupsock.cpp │ ├── GroupsockHelper.cpp │ ├── IOHandlers.cpp │ ├── NetAddress.cpp │ ├── NetInterface.cpp │ ├── include │ │ ├── GroupEId.hh │ │ ├── Groupsock.hh │ │ ├── GroupsockHelper.hh │ │ ├── IOHandlers.hh │ │ ├── NetAddress.hh │ │ ├── NetCommon.h │ │ ├── NetInterface.hh │ │ ├── TunnelEncaps.hh │ │ └── groupsock_version.hh │ └── inet.c ├── lib │ ├── libgnustl_shared.so │ ├── libgnustl_static.a │ └── libsupc++.a └── liveMedia │ ├── AACAudioMatroskaFileServerMediaSubsession.cpp │ ├── AACAudioMatroskaFileServerMediaSubsession.hh │ ├── AC3AudioFileServerMediaSubsession.cpp │ ├── AC3AudioMatroskaFileServerMediaSubsession.cpp │ ├── AC3AudioMatroskaFileServerMediaSubsession.hh │ ├── AC3AudioRTPSink.cpp │ ├── AC3AudioRTPSource.cpp │ ├── AC3AudioStreamFramer.cpp │ ├── ADTSAudioFileServerMediaSubsession.cpp │ ├── ADTSAudioFileSource.cpp │ ├── AMRAudioFileServerMediaSubsession.cpp │ ├── AMRAudioFileSink.cpp │ ├── AMRAudioFileSource.cpp │ ├── AMRAudioRTPSink.cpp │ ├── AMRAudioRTPSource.cpp │ ├── AMRAudioSource.cpp │ ├── AVIFileSink.cpp │ ├── AudioInputDevice.cpp │ ├── AudioRTPSink.cpp │ ├── Base64.cpp │ ├── BasicUDPSink.cpp │ ├── BasicUDPSource.cpp │ ├── BitVector.cpp │ ├── ByteStreamFileSource.cpp │ ├── ByteStreamMemoryBufferSource.cpp │ ├── ByteStreamMultiFileSource.cpp │ ├── DVVideoFileServerMediaSubsession.cpp │ ├── DVVideoRTPSink.cpp │ ├── DVVideoRTPSource.cpp │ ├── DVVideoStreamFramer.cpp │ ├── DarwinInjector.cpp │ ├── DeviceSource.cpp │ ├── DigestAuthentication.cpp │ ├── EBMLNumber.cpp │ ├── EBMLNumber.hh │ ├── FileServerMediaSubsession.cpp │ ├── FileSink.cpp │ ├── FramedFileSource.cpp │ ├── FramedFilter.cpp │ ├── FramedSource.cpp │ ├── GSMAudioRTPSink.cpp │ ├── H261VideoRTPSource.cpp │ ├── H263plusVideoFileServerMediaSubsession.cpp │ ├── H263plusVideoRTPSink.cpp │ ├── H263plusVideoRTPSource.cpp │ ├── H263plusVideoStreamFramer.cpp │ ├── H263plusVideoStreamParser.cpp │ ├── H263plusVideoStreamParser.hh │ ├── H264VideoFileServerMediaSubsession.cpp │ ├── H264VideoFileSink.cpp │ ├── H264VideoMatroskaFileServerMediaSubsession.cpp │ ├── H264VideoMatroskaFileServerMediaSubsession.hh │ ├── H264VideoRTPSink.cpp │ ├── H264VideoRTPSource.cpp │ ├── H264VideoStreamDiscreteFramer.cpp │ ├── H264VideoStreamFramer.cpp │ ├── InputFile.cpp │ ├── JPEGVideoRTPSink.cpp │ ├── JPEGVideoRTPSource.cpp │ ├── JPEGVideoSource.cpp │ ├── Locale.cpp │ ├── MP3ADU.cpp │ ├── MP3ADURTPSink.cpp │ ├── MP3ADURTPSource.cpp │ ├── MP3ADUTranscoder.cpp │ ├── MP3ADUdescriptor.cpp │ ├── MP3ADUdescriptor.hh │ ├── MP3ADUinterleaving.cpp │ ├── MP3AudioFileServerMediaSubsession.cpp │ ├── MP3AudioMatroskaFileServerMediaSubsession.cpp │ ├── MP3AudioMatroskaFileServerMediaSubsession.hh │ ├── MP3FileSource.cpp │ ├── MP3Internals.cpp │ ├── MP3Internals.hh │ ├── MP3InternalsHuffman.cpp │ ├── MP3InternalsHuffman.hh │ ├── MP3InternalsHuffmanTable.cpp │ ├── MP3StreamState.cpp │ ├── MP3StreamState.hh │ ├── MP3Transcoder.cpp │ ├── MPEG1or2AudioRTPSink.cpp │ ├── MPEG1or2AudioRTPSource.cpp │ ├── MPEG1or2AudioStreamFramer.cpp │ ├── MPEG1or2Demux.cpp │ ├── MPEG1or2DemuxedElementaryStream.cpp │ ├── MPEG1or2DemuxedServerMediaSubsession.cpp │ ├── MPEG1or2FileServerDemux.cpp │ ├── MPEG1or2VideoFileServerMediaSubsession.cpp │ ├── MPEG1or2VideoRTPSink.cpp │ ├── MPEG1or2VideoRTPSource.cpp │ ├── MPEG1or2VideoStreamDiscreteFramer.cpp │ ├── MPEG1or2VideoStreamFramer.cpp │ ├── MPEG2IndexFromTransportStream.cpp │ ├── MPEG2TransportFileServerMediaSubsession.cpp │ ├── MPEG2TransportStreamFramer.cpp │ ├── MPEG2TransportStreamFromESSource.cpp │ ├── MPEG2TransportStreamFromPESSource.cpp │ ├── MPEG2TransportStreamIndexFile.cpp │ ├── MPEG2TransportStreamMultiplexor.cpp │ ├── MPEG2TransportStreamTrickModeFilter.cpp │ ├── MPEG2TransportUDPServerMediaSubsession.cpp │ ├── MPEG4ESVideoRTPSink.cpp │ ├── MPEG4ESVideoRTPSource.cpp │ ├── MPEG4GenericRTPSink.cpp │ ├── MPEG4GenericRTPSource.cpp │ ├── MPEG4LATMAudioRTPSink.cpp │ ├── MPEG4LATMAudioRTPSource.cpp │ ├── MPEG4VideoFileServerMediaSubsession.cpp │ ├── MPEG4VideoStreamDiscreteFramer.cpp │ ├── MPEG4VideoStreamFramer.cpp │ ├── MPEGVideoStreamFramer.cpp │ ├── MPEGVideoStreamParser.cpp │ ├── MPEGVideoStreamParser.hh │ ├── MatroskaDemuxedTrack.cpp │ ├── MatroskaDemuxedTrack.hh │ ├── MatroskaFile.cpp │ ├── MatroskaFileParser.cpp │ ├── MatroskaFileParser.hh │ ├── MatroskaFileServerDemux.cpp │ ├── Media.cpp │ ├── MediaSession.cpp │ ├── MediaSink.cpp │ ├── MediaSource.cpp │ ├── MultiFramedRTPSink.cpp │ ├── MultiFramedRTPSource.cpp │ ├── OnDemandServerMediaSubsession.cpp │ ├── OutputFile.cpp │ ├── PassiveServerMediaSubsession.cpp │ ├── ProxyServerMediaSession.cpp │ ├── QCELPAudioRTPSource.cpp │ ├── QuickTimeFileSink.cpp │ ├── QuickTimeGenericRTPSource.cpp │ ├── RTCP.cpp │ ├── RTPInterface.cpp │ ├── RTPSink.cpp │ ├── RTPSource.cpp │ ├── RTSPClient.cpp │ ├── RTSPCommon.cpp │ ├── RTSPServer.cpp │ ├── RTSPServerSupportingHTTPStreaming.cpp │ ├── SIPClient.cpp │ ├── ServerMediaSession.cpp │ ├── SimpleRTPSink.cpp │ ├── SimpleRTPSource.cpp │ ├── StreamParser.cpp │ ├── StreamParser.hh │ ├── StreamReplicator.cpp │ ├── T140TextMatroskaFileServerMediaSubsession.cpp │ ├── T140TextMatroskaFileServerMediaSubsession.hh │ ├── T140TextRTPSink.cpp │ ├── TCPStreamSink.cpp │ ├── TextRTPSink.cpp │ ├── VP8VideoMatroskaFileServerMediaSubsession.cpp │ ├── VP8VideoMatroskaFileServerMediaSubsession.hh │ ├── VP8VideoRTPSink.cpp │ ├── VP8VideoRTPSource.cpp │ ├── VideoRTPSink.cpp │ ├── VorbisAudioMatroskaFileServerMediaSubsession.cpp │ ├── VorbisAudioMatroskaFileServerMediaSubsession.hh │ ├── VorbisAudioRTPSink.cpp │ ├── VorbisAudioRTPSource.cpp │ ├── WAVAudioFileServerMediaSubsession.cpp │ ├── WAVAudioFileSource.cpp │ ├── include │ ├── AC3AudioFileServerMediaSubsession.hh │ ├── AC3AudioRTPSink.hh │ ├── AC3AudioRTPSource.hh │ ├── AC3AudioStreamFramer.hh │ ├── ADTSAudioFileServerMediaSubsession.hh │ ├── ADTSAudioFileSource.hh │ ├── AMRAudioFileServerMediaSubsession.hh │ ├── AMRAudioFileSink.hh │ ├── AMRAudioFileSource.hh │ ├── AMRAudioRTPSink.hh │ ├── AMRAudioRTPSource.hh │ ├── AMRAudioSource.hh │ ├── AVIFileSink.hh │ ├── AudioInputDevice.hh │ ├── AudioRTPSink.hh │ ├── Base64.hh │ ├── BasicUDPSink.hh │ ├── BasicUDPSource.hh │ ├── BitVector.hh │ ├── ByteStreamFileSource.hh │ ├── ByteStreamMemoryBufferSource.hh │ ├── ByteStreamMultiFileSource.hh │ ├── DVVideoFileServerMediaSubsession.hh │ ├── DVVideoRTPSink.hh │ ├── DVVideoRTPSource.hh │ ├── DVVideoStreamFramer.hh │ ├── DarwinInjector.hh │ ├── DeviceSource.hh │ ├── DigestAuthentication.hh │ ├── FileServerMediaSubsession.hh │ ├── FileSink.hh │ ├── FramedFileSource.hh │ ├── FramedFilter.hh │ ├── FramedSource.hh │ ├── GSMAudioRTPSink.hh │ ├── H261VideoRTPSource.hh │ ├── H263plusVideoFileServerMediaSubsession.hh │ ├── H263plusVideoRTPSink.hh │ ├── H263plusVideoRTPSource.hh │ ├── H263plusVideoStreamFramer.hh │ ├── H264VideoFileServerMediaSubsession.hh │ ├── H264VideoFileSink.hh │ ├── H264VideoRTPSink.hh │ ├── H264VideoRTPSource.hh │ ├── H264VideoStreamDiscreteFramer.hh │ ├── H264VideoStreamFramer.hh │ ├── InputFile.hh │ ├── JPEGVideoRTPSink.hh │ ├── JPEGVideoRTPSource.hh │ ├── JPEGVideoSource.hh │ ├── Locale.hh │ ├── MP3ADU.hh │ ├── MP3ADURTPSink.hh │ ├── MP3ADURTPSource.hh │ ├── MP3ADUTranscoder.hh │ ├── MP3ADUinterleaving.hh │ ├── MP3AudioFileServerMediaSubsession.hh │ ├── MP3FileSource.hh │ ├── MP3Transcoder.hh │ ├── MPEG1or2AudioRTPSink.hh │ ├── MPEG1or2AudioRTPSource.hh │ ├── MPEG1or2AudioStreamFramer.hh │ ├── MPEG1or2Demux.hh │ ├── MPEG1or2DemuxedElementaryStream.hh │ ├── MPEG1or2DemuxedServerMediaSubsession.hh │ ├── MPEG1or2FileServerDemux.hh │ ├── MPEG1or2VideoFileServerMediaSubsession.hh │ ├── MPEG1or2VideoRTPSink.hh │ ├── MPEG1or2VideoRTPSource.hh │ ├── MPEG1or2VideoStreamDiscreteFramer.hh │ ├── MPEG1or2VideoStreamFramer.hh │ ├── MPEG2IndexFromTransportStream.hh │ ├── MPEG2TransportFileServerMediaSubsession.hh │ ├── MPEG2TransportStreamFramer.hh │ ├── MPEG2TransportStreamFromESSource.hh │ ├── MPEG2TransportStreamFromPESSource.hh │ ├── MPEG2TransportStreamIndexFile.hh │ ├── MPEG2TransportStreamMultiplexor.hh │ ├── MPEG2TransportStreamTrickModeFilter.hh │ ├── MPEG2TransportUDPServerMediaSubsession.hh │ ├── MPEG4ESVideoRTPSink.hh │ ├── MPEG4ESVideoRTPSource.hh │ ├── MPEG4GenericRTPSink.hh │ ├── MPEG4GenericRTPSource.hh │ ├── MPEG4LATMAudioRTPSink.hh │ ├── MPEG4LATMAudioRTPSource.hh │ ├── MPEG4VideoFileServerMediaSubsession.hh │ ├── MPEG4VideoStreamDiscreteFramer.hh │ ├── MPEG4VideoStreamFramer.hh │ ├── MPEGVideoStreamFramer.hh │ ├── MatroskaFile.hh │ ├── MatroskaFileServerDemux.hh │ ├── Media.hh │ ├── MediaSession.hh │ ├── MediaSink.hh │ ├── MediaSource.hh │ ├── MultiFramedRTPSink.hh │ ├── MultiFramedRTPSource.hh │ ├── OnDemandServerMediaSubsession.hh │ ├── OutputFile.hh │ ├── PassiveServerMediaSubsession.hh │ ├── ProxyServerMediaSession.hh │ ├── QCELPAudioRTPSource.hh │ ├── QuickTimeFileSink.hh │ ├── QuickTimeGenericRTPSource.hh │ ├── RTCP.hh │ ├── RTPInterface.hh │ ├── RTPSink.hh │ ├── RTPSource.hh │ ├── RTSPClient.hh │ ├── RTSPCommon.hh │ ├── RTSPServer.hh │ ├── RTSPServerSupportingHTTPStreaming.hh │ ├── SIPClient.hh │ ├── ServerMediaSession.hh │ ├── SimpleRTPSink.hh │ ├── SimpleRTPSource.hh │ ├── StreamReplicator.hh │ ├── T140TextRTPSink.hh │ ├── TCPStreamSink.hh │ ├── TextRTPSink.hh │ ├── VP8VideoRTPSink.hh │ ├── VP8VideoRTPSource.hh │ ├── VideoRTPSink.hh │ ├── VorbisAudioRTPSink.hh │ ├── VorbisAudioRTPSource.hh │ ├── WAVAudioFileServerMediaSubsession.hh │ ├── WAVAudioFileSource.hh │ ├── liveMedia.hh │ ├── liveMedia_version.hh │ └── uLawAudioFilter.hh │ ├── our_md5.c │ ├── our_md5.h │ ├── our_md5hl.c │ ├── rtcp_from_spec.c │ ├── rtcp_from_spec.h │ └── uLawAudioFilter.cpp ├── jrtplib-3.9.1 ├── Android.mk ├── errcodecommand ├── extratransmitters │ ├── rtpfaketransmitter.cpp │ └── rtpfaketransmitter.h ├── rtcpapppacket.cpp ├── rtcpapppacket.h ├── rtcpbyepacket.cpp ├── rtcpbyepacket.h ├── rtcpcompoundpacket.cpp ├── rtcpcompoundpacket.h ├── rtcpcompoundpacketbuilder.cpp ├── rtcpcompoundpacketbuilder.h ├── rtcppacket.cpp ├── rtcppacket.h ├── rtcppacketbuilder.cpp ├── rtcppacketbuilder.h ├── rtcprrpacket.cpp ├── rtcprrpacket.h ├── rtcpscheduler.cpp ├── rtcpscheduler.h ├── rtcpsdesinfo.cpp ├── rtcpsdesinfo.h ├── rtcpsdespacket.cpp ├── rtcpsdespacket.h ├── rtcpsrpacket.cpp ├── rtcpsrpacket.h ├── rtcpunknownpacket.h ├── rtpaddress.h ├── rtpbyteaddress.cpp ├── rtpbyteaddress.h ├── rtpcollisionlist.cpp ├── rtpcollisionlist.h ├── rtpconfig.h ├── rtpconfig.h.in ├── rtpdebug.cpp ├── rtpdebug.h ├── rtpdefines.h ├── rtperrors.cpp ├── rtperrors.h ├── rtpexternaltransmitter.cpp ├── rtpexternaltransmitter.h ├── rtphashtable.h ├── rtpinternalsourcedata.cpp ├── rtpinternalsourcedata.h ├── rtpipv4address.cpp ├── rtpipv4address.h ├── rtpipv4destination.h ├── rtpipv6address.cpp ├── rtpipv6address.h ├── rtpipv6destination.h ├── rtpkeyhashtable.h ├── rtplibraryversion.cpp ├── rtplibraryversion.h ├── rtpmemorymanager.h ├── rtpmemoryobject.h ├── rtppacket.cpp ├── rtppacket.h ├── rtppacketbuilder.cpp ├── rtppacketbuilder.h ├── rtppollthread.cpp ├── rtppollthread.h ├── rtprandom.cpp ├── rtprandom.h ├── rtprandomrand48.cpp ├── rtprandomrand48.h ├── rtprandomrands.cpp ├── rtprandomrands.h ├── rtprandomurandom.cpp ├── rtprandomurandom.h ├── rtprawpacket.h ├── rtpsession.cpp ├── rtpsession.h ├── rtpsessionparams.cpp ├── rtpsessionparams.h ├── rtpsessionsources.cpp ├── rtpsessionsources.h ├── rtpsourcedata.cpp ├── rtpsourcedata.h ├── rtpsources.cpp ├── rtpsources.h ├── rtpstructs.h ├── rtptimeutilities.cpp ├── rtptimeutilities.h ├── rtptransmitter.h ├── rtptypes.h ├── rtptypes.h.in ├── rtptypes_win.h ├── rtpudpv4transmitter.cpp ├── rtpudpv4transmitter.h ├── rtpudpv6transmitter.cpp └── rtpudpv6transmitter.h └── jthread-1.3.1 ├── Android.mk ├── jmutex.h ├── jmutexautolock.h ├── jthread.h ├── jthreadconfig.h ├── jthreadconfig.h.in ├── pthread ├── jmutex.cpp └── jthread.cpp └── win32 ├── jmutex.cpp └── jthread.cpp /Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | include $(call all-subdir-makefiles) 3 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2013 MegadLu 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Android-RTP-RTSP-Library-Porting 2 | ================================ 3 | 4 | Porting the JRTPLIB-3.9.1 and live555 media server library to Android JB. 5 | -------------------------------------------------------------------------------- /RTSPLib/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | include $(CLEAR_VARS) 4 | LOCAL_ARM_MODE := arm 5 | LOCAL_MODULE := libgnustl_static 6 | LOCAL_SRC_FILES := lib/libgnustl_static.a 7 | LOCAL_MODULE_CLASS := STATIC_LIBRARIES 8 | LOCAL_MODULE_TAGS := optional 9 | LOCAL_MODULE_SUFFIX := .a 10 | include $(BUILD_PREBUILT) 11 | ####################################################################### 12 | 13 | #LOCAL_PATH := $(call my-dir) 14 | 15 | include $(CLEAR_VARS) 16 | 17 | LOCAL_MODULE := librtsp 18 | 19 | LOCAL_ARM_MODE := arm 20 | 21 | LOCAL_PRELINK_MODULE := false 22 | 23 | LOCAL_CPPFLAGS := \ 24 | -DNULL=0 -DSOCKLEN_T=socklen_t -DNO_SSTREAM -DBSD=1 -DNO_SSTREAM -fexceptions -DANDROID -DXLOCALE_NOT_USED 25 | 26 | LOCAL_C_INCLUDES := \ 27 | $(LOCAL_PATH) \ 28 | $(LOCAL_PATH)/BasicUsageEnvironment/include \ 29 | $(LOCAL_PATH)/BasicUsageEnvironment \ 30 | $(LOCAL_PATH)/UsageEnvironment/include \ 31 | $(LOCAL_PATH)/UsageEnvironment \ 32 | $(LOCAL_PATH)/groupsock/include \ 33 | $(LOCAL_PATH)/groupsock \ 34 | $(LOCAL_PATH)/liveMedia/include \ 35 | $(LOCAL_PATH)/liveMedia \ 36 | 37 | LOCAL_STATIC_LIBRARIES := libgnustl_static 38 | 39 | LOCAL_MODULE_TAGS := optional 40 | 41 | LOCAL_SRC_FILES := \ 42 | $(subst $(LOCAL_PATH)/,,$(wildcard $(LOCAL_PATH)/BasicUsageEnvironment/*.c*)) \ 43 | $(subst $(LOCAL_PATH)/,,$(wildcard $(LOCAL_PATH)/UsageEnvironment/*.c*)) \ 44 | $(subst $(LOCAL_PATH)/,,$(wildcard $(LOCAL_PATH)/groupsock/*.c*)) \ 45 | $(subst $(LOCAL_PATH)/,,$(wildcard $(LOCAL_PATH)/liveMedia/*.c*)) 46 | 47 | include $(BUILD_STATIC_LIBRARY) 48 | -------------------------------------------------------------------------------- /RTSPLib/BasicUsageEnvironment/include/BasicUsageEnvironment_version.hh: -------------------------------------------------------------------------------- 1 | // Version information for the "BasicUsageEnvironment" library 2 | // Copyright (c) 1996-2013 Live Networks, Inc. All rights reserved. 3 | 4 | #ifndef _BASICUSAGEENVIRONMENT_VERSION_HH 5 | #define _BASICUSAGEENVIRONMENT_VERSION_HH 6 | 7 | #define BASICUSAGEENVIRONMENT_LIBRARY_VERSION_STRING "2013.09.11" 8 | #define BASICUSAGEENVIRONMENT_LIBRARY_VERSION_INT 1378857600 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /RTSPLib/BasicUsageEnvironment/include/HandlerSet.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 2.1 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // Copyright (c) 1996-2013 Live Networks, Inc. All rights reserved. 17 | // Basic Usage Environment: for a simple, non-scripted, console application 18 | // C++ header 19 | 20 | #ifndef _HANDLER_SET_HH 21 | #define _HANDLER_SET_HH 22 | 23 | #ifndef _BOOLEAN_HH 24 | #include "Boolean.hh" 25 | #endif 26 | 27 | ////////// HandlerSet (etc.) definition ////////// 28 | 29 | class HandlerDescriptor { 30 | HandlerDescriptor(HandlerDescriptor* nextHandler); 31 | virtual ~HandlerDescriptor(); 32 | 33 | public: 34 | int socketNum; 35 | int conditionSet; 36 | TaskScheduler::BackgroundHandlerProc* handlerProc; 37 | void* clientData; 38 | 39 | private: 40 | // Descriptors are linked together in a doubly-linked list: 41 | friend class HandlerSet; 42 | friend class HandlerIterator; 43 | HandlerDescriptor* fNextHandler; 44 | HandlerDescriptor* fPrevHandler; 45 | }; 46 | 47 | class HandlerSet { 48 | public: 49 | HandlerSet(); 50 | virtual ~HandlerSet(); 51 | 52 | void assignHandler(int socketNum, int conditionSet, TaskScheduler::BackgroundHandlerProc* handlerProc, void* clientData); 53 | void clearHandler(int socketNum); 54 | void moveHandler(int oldSocketNum, int newSocketNum); 55 | 56 | private: 57 | HandlerDescriptor* lookupHandler(int socketNum); 58 | 59 | private: 60 | friend class HandlerIterator; 61 | HandlerDescriptor fHandlers; 62 | }; 63 | 64 | class HandlerIterator { 65 | public: 66 | HandlerIterator(HandlerSet& handlerSet); 67 | virtual ~HandlerIterator(); 68 | 69 | HandlerDescriptor* next(); // returns NULL if none 70 | void reset(); 71 | 72 | private: 73 | HandlerSet& fOurSet; 74 | HandlerDescriptor* fNextPtr; 75 | }; 76 | 77 | #endif 78 | -------------------------------------------------------------------------------- /RTSPLib/UsageEnvironment/HashTable.cpp: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 2.1 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // Copyright (c) 1996-2013 Live Networks, Inc. All rights reserved. 17 | // Generic Hash Table 18 | // Implementation 19 | 20 | #include "HashTable.hh" 21 | 22 | HashTable::HashTable() { 23 | } 24 | 25 | HashTable::~HashTable() { 26 | } 27 | 28 | HashTable::Iterator::Iterator() { 29 | } 30 | 31 | HashTable::Iterator::~Iterator() {} 32 | 33 | void* HashTable::RemoveNext() { 34 | Iterator* iter = Iterator::create(*this); 35 | char const* key; 36 | void* removedValue = iter->next(key); 37 | if (removedValue != 0) Remove(key); 38 | 39 | delete iter; 40 | return removedValue; 41 | } 42 | 43 | void* HashTable::getFirst() { 44 | Iterator* iter = Iterator::create(*this); 45 | char const* key; 46 | void* firstValue = iter->next(key); 47 | 48 | delete iter; 49 | return firstValue; 50 | } 51 | -------------------------------------------------------------------------------- /RTSPLib/UsageEnvironment/UsageEnvironment.cpp: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 2.1 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // Copyright (c) 1996-2013 Live Networks, Inc. All rights reserved. 17 | // Usage Environment 18 | // Implementation 19 | 20 | #include "UsageEnvironment.hh" 21 | 22 | void UsageEnvironment::reclaim() { 23 | // We delete ourselves only if we have no remainining state: 24 | if (liveMediaPriv == NULL && groupsockPriv == NULL) delete this; 25 | } 26 | 27 | UsageEnvironment::UsageEnvironment(TaskScheduler& scheduler) 28 | : liveMediaPriv(NULL), groupsockPriv(NULL), fScheduler(scheduler) { 29 | } 30 | 31 | UsageEnvironment::~UsageEnvironment() { 32 | } 33 | 34 | // By default, we handle 'should not occur'-type library errors by calling abort(). Subclasses can redefine this, if desired. 35 | // (If your runtime library doesn't define the "abort()" function, then define your own (e.g., that does nothing).) 36 | void UsageEnvironment::internalError() { 37 | abort(); 38 | } 39 | 40 | 41 | TaskScheduler::TaskScheduler() { 42 | } 43 | 44 | TaskScheduler::~TaskScheduler() { 45 | } 46 | 47 | void TaskScheduler::rescheduleDelayedTask(TaskToken& task, 48 | int64_t microseconds, TaskFunc* proc, 49 | void* clientData) { 50 | unscheduleDelayedTask(task); 51 | task = scheduleDelayedTask(microseconds, proc, clientData); 52 | } 53 | 54 | // By default, we handle 'should not occur'-type library errors by calling abort(). Subclasses can redefine this, if desired. 55 | void TaskScheduler::internalError() { 56 | abort(); 57 | } 58 | -------------------------------------------------------------------------------- /RTSPLib/UsageEnvironment/include/Boolean.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 2.1 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | #ifndef _BOOLEAN_HH 17 | #define _BOOLEAN_HH 18 | 19 | #if defined(__BORLANDC__) || (!defined(USE_LIVE555_BOOLEAN) && defined(_MSC_VER) && _MSC_VER >= 1400) 20 | // Use the "bool" type defined by the Borland compiler, and MSVC++ 8.0, Visual Studio 2005 and higher 21 | typedef bool Boolean; 22 | #define False false 23 | #define True true 24 | #else 25 | typedef unsigned char Boolean; 26 | #ifndef __MSHTML_LIBRARY_DEFINED__ 27 | #ifndef False 28 | const Boolean False = 0; 29 | #endif 30 | #ifndef True 31 | const Boolean True = 1; 32 | #endif 33 | 34 | #endif 35 | #endif 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /RTSPLib/UsageEnvironment/include/UsageEnvironment_version.hh: -------------------------------------------------------------------------------- 1 | // Version information for the "UsageEnvironment" library 2 | // Copyright (c) 1996-2013 Live Networks, Inc. All rights reserved. 3 | 4 | #ifndef _USAGEENVIRONMENT_VERSION_HH 5 | #define _USAGEENVIRONMENT_VERSION_HH 6 | 7 | #define USAGEENVIRONMENT_LIBRARY_VERSION_STRING "2013.09.11" 8 | #define USAGEENVIRONMENT_LIBRARY_VERSION_INT 1378857600 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /RTSPLib/UsageEnvironment/include/strDup.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 2.1 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | 17 | #ifndef _STRDUP_HH 18 | #define _STRDUP_HH 19 | 20 | // Copyright (c) 1996-2013 Live Networks, Inc. All rights reserved. 21 | // A C++ equivalent to the standard C routine "strdup()". 22 | // This generates a char* that can be deleted using "delete[]" 23 | // Header 24 | 25 | char* strDup(char const* str); 26 | // Note: strDup(NULL) returns NULL 27 | 28 | char* strDupSize(char const* str); 29 | // Like "strDup()", except that it *doesn't* copy the original. 30 | // (Instead, it just allocates a string of the same size as the original.) 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /RTSPLib/UsageEnvironment/strDup.cpp: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 2.1 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // Copyright (c) 1996-2013 Live Networks, Inc. All rights reserved. 17 | // A C++ equivalent to the standard C routine "strdup()". 18 | // This generates a char* that can be deleted using "delete[]" 19 | // Implementation 20 | 21 | #include "strDup.hh" 22 | #include "string.h" 23 | 24 | char* strDup(char const* str) { 25 | if (str == NULL) return NULL; 26 | size_t len = strlen(str) + 1; 27 | char* copy = new char[len]; 28 | 29 | if (copy != NULL) { 30 | memcpy(copy, str, len); 31 | } 32 | return copy; 33 | } 34 | 35 | char* strDupSize(char const* str) { 36 | if (str == NULL) return NULL; 37 | size_t len = strlen(str) + 1; 38 | char* copy = new char[len]; 39 | 40 | return copy; 41 | } 42 | 43 | -------------------------------------------------------------------------------- /RTSPLib/groupsock/IOHandlers.cpp: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 2.1 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "mTunnel" multicast access service 17 | // Copyright (c) 1996-2013 Live Networks, Inc. All rights reserved. 18 | // IO event handlers 19 | // Implementation 20 | 21 | #include "IOHandlers.hh" 22 | #include "TunnelEncaps.hh" 23 | 24 | //##### TEMP: Use a single buffer, sized for UDP tunnels: 25 | //##### This assumes that the I/O handlers are non-reentrant 26 | static unsigned const maxPacketLength = 50*1024; // bytes 27 | // This is usually overkill, because UDP packets are usually no larger 28 | // than the typical Ethernet MTU (1500 bytes). However, I've seen 29 | // reports of Windows Media Servers sending UDP packets as large as 30 | // 27 kBytes. These will probably undego lots of IP-level 31 | // fragmentation, but that occurs below us. We just have to hope that 32 | // fragments don't get lost. 33 | static unsigned const ioBufferSize 34 | = maxPacketLength + TunnelEncapsulationTrailerMaxSize; 35 | static unsigned char ioBuffer[ioBufferSize]; 36 | 37 | 38 | void socketReadHandler(Socket* sock, int /*mask*/) { 39 | unsigned bytesRead; 40 | struct sockaddr_in fromAddress; 41 | UsageEnvironment& saveEnv = sock->env(); 42 | // because handleRead(), if it fails, may delete "sock" 43 | if (!sock->handleRead(ioBuffer, ioBufferSize, bytesRead, fromAddress)) { 44 | saveEnv.reportBackgroundError(); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /RTSPLib/groupsock/include/IOHandlers.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 2.1 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "mTunnel" multicast access service 17 | // Copyright (c) 1996-2013 Live Networks, Inc. All rights reserved. 18 | // IO event handlers 19 | // C++ header 20 | 21 | #ifndef _IO_HANDLERS_HH 22 | #define _IO_HANDLERS_HH 23 | 24 | #ifndef _NET_INTERFACE_HH 25 | #include "NetInterface.hh" 26 | #endif 27 | 28 | // Handles incoming data on sockets: 29 | void socketReadHandler(Socket* sock, int mask); 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /RTSPLib/groupsock/include/groupsock_version.hh: -------------------------------------------------------------------------------- 1 | // Version information for the "groupsock" library 2 | // Copyright (c) 1996-2013 Live Networks, Inc. All rights reserved. 3 | 4 | #ifndef _GROUPSOCK_VERSION_HH 5 | #define _GROUPSOCK_VERSION_HH 6 | 7 | #define GROUPSOCK_LIBRARY_VERSION_STRING "2013.09.11" 8 | #define GROUPSOCK_LIBRARY_VERSION_INT 1378857600 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /RTSPLib/lib/libgnustl_shared.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MegadLu/Android-RTP-RTSP-Library-Porting/32c25d3cd12d21b2cbf0a56552bff8c318ff0266/RTSPLib/lib/libgnustl_shared.so -------------------------------------------------------------------------------- /RTSPLib/lib/libgnustl_static.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MegadLu/Android-RTP-RTSP-Library-Porting/32c25d3cd12d21b2cbf0a56552bff8c318ff0266/RTSPLib/lib/libgnustl_static.a -------------------------------------------------------------------------------- /RTSPLib/lib/libsupc++.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MegadLu/Android-RTP-RTSP-Library-Porting/32c25d3cd12d21b2cbf0a56552bff8c318ff0266/RTSPLib/lib/libsupc++.a -------------------------------------------------------------------------------- /RTSPLib/liveMedia/AACAudioMatroskaFileServerMediaSubsession.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 2.1 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2013 Live Networks, Inc. All rights reserved. 18 | // A 'ServerMediaSubsession' object that creates new, unicast, "RTPSink"s 19 | // on demand, from an AAC audio track within a Matroska file. 20 | // C++ header 21 | 22 | #ifndef _AAC_AUDIO_MATROSKA_FILE_SERVER_MEDIA_SUBSESSION_HH 23 | #define _AAC_AUDIO_MATROSKA_FILE_SERVER_MEDIA_SUBSESSION_HH 24 | 25 | #ifndef _FILE_SERVER_MEDIA_SUBSESSION_HH 26 | #include "FileServerMediaSubsession.hh" 27 | #endif 28 | #ifndef _MATROSKA_FILE_SERVER_DEMUX_HH 29 | #include "MatroskaFileServerDemux.hh" 30 | #endif 31 | 32 | class AACAudioMatroskaFileServerMediaSubsession: public FileServerMediaSubsession { 33 | public: 34 | static AACAudioMatroskaFileServerMediaSubsession* 35 | createNew(MatroskaFileServerDemux& demux, unsigned trackNumber); 36 | 37 | private: 38 | AACAudioMatroskaFileServerMediaSubsession(MatroskaFileServerDemux& demux, unsigned trackNumber); 39 | // called only by createNew(); 40 | virtual ~AACAudioMatroskaFileServerMediaSubsession(); 41 | 42 | private: // redefined virtual functions 43 | virtual float duration() const; 44 | virtual void seekStreamSource(FramedSource* inputSource, double& seekNPT, double streamDuration, u_int64_t& numBytes); 45 | virtual FramedSource* createNewStreamSource(unsigned clientSessionId, 46 | unsigned& estBitrate); 47 | virtual RTPSink* createNewRTPSink(Groupsock* rtpGroupsock, unsigned char rtpPayloadTypeIfDynamic, FramedSource* inputSource); 48 | 49 | private: 50 | MatroskaFileServerDemux& fOurDemux; 51 | unsigned fTrackNumber; 52 | char* fConfigStr; 53 | }; 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /RTSPLib/liveMedia/AC3AudioMatroskaFileServerMediaSubsession.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 2.1 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2013 Live Networks, Inc. All rights reserved. 18 | // A 'ServerMediaSubsession' object that creates new, unicast, "RTPSink"s 19 | // on demand, from an AC3 audio track within a Matroska file. 20 | // C++ header 21 | 22 | #ifndef _AC3_AUDIO_MATROSKA_FILE_SERVER_MEDIA_SUBSESSION_HH 23 | #define _AC3_AUDIO_MATROSKA_FILE_SERVER_MEDIA_SUBSESSION_HH 24 | 25 | #ifndef _FILE_SERVER_MEDIA_SUBSESSION_HH 26 | #include "FileServerMediaSubsession.hh" 27 | #endif 28 | #ifndef _MATROSKA_FILE_SERVER_DEMUX_HH 29 | #include "MatroskaFileServerDemux.hh" 30 | #endif 31 | 32 | class AC3AudioMatroskaFileServerMediaSubsession: public FileServerMediaSubsession { 33 | public: 34 | static AC3AudioMatroskaFileServerMediaSubsession* 35 | createNew(MatroskaFileServerDemux& demux, unsigned trackNumber); 36 | 37 | private: 38 | AC3AudioMatroskaFileServerMediaSubsession(MatroskaFileServerDemux& demux, unsigned trackNumber); 39 | // called only by createNew(); 40 | virtual ~AC3AudioMatroskaFileServerMediaSubsession(); 41 | 42 | private: // redefined virtual functions 43 | virtual float duration() const; 44 | virtual void seekStreamSource(FramedSource* inputSource, double& seekNPT, double streamDuration, u_int64_t& numBytes); 45 | virtual FramedSource* createNewStreamSource(unsigned clientSessionId, 46 | unsigned& estBitrate); 47 | virtual RTPSink* createNewRTPSink(Groupsock* rtpGroupsock, unsigned char rtpPayloadTypeIfDynamic, FramedSource* inputSource); 48 | 49 | private: 50 | MatroskaFileServerDemux& fOurDemux; 51 | unsigned fTrackNumber; 52 | }; 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /RTSPLib/liveMedia/AC3AudioRTPSource.cpp: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 2.1 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2013 Live Networks, Inc. All rights reserved. 18 | // AC3 Audio RTP Sources 19 | // Implementation 20 | 21 | #include "AC3AudioRTPSource.hh" 22 | 23 | AC3AudioRTPSource* 24 | AC3AudioRTPSource::createNew(UsageEnvironment& env, 25 | Groupsock* RTPgs, 26 | unsigned char rtpPayloadFormat, 27 | unsigned rtpTimestampFrequency) { 28 | return new AC3AudioRTPSource(env, RTPgs, rtpPayloadFormat, 29 | rtpTimestampFrequency); 30 | } 31 | 32 | AC3AudioRTPSource::AC3AudioRTPSource(UsageEnvironment& env, 33 | Groupsock* rtpGS, 34 | unsigned char rtpPayloadFormat, 35 | unsigned rtpTimestampFrequency) 36 | : MultiFramedRTPSource(env, rtpGS, 37 | rtpPayloadFormat, rtpTimestampFrequency) { 38 | } 39 | 40 | AC3AudioRTPSource::~AC3AudioRTPSource() { 41 | } 42 | 43 | Boolean AC3AudioRTPSource 44 | ::processSpecialHeader(BufferedPacket* packet, 45 | unsigned& resultSpecialHeaderSize) { 46 | unsigned char* headerStart = packet->data(); 47 | unsigned packetSize = packet->dataSize(); 48 | 49 | // There's a 2-byte payload header at the beginning: 50 | if (packetSize < 2) return False; 51 | resultSpecialHeaderSize = 2; 52 | 53 | unsigned char FT = headerStart[0]&0x03; 54 | fCurrentPacketBeginsFrame = FT != 3; 55 | 56 | // The RTP "M" (marker) bit indicates the last fragment of a frame. 57 | // In case the sender did not set the "M" bit correctly, we also test for FT == 0: 58 | fCurrentPacketCompletesFrame = packet->rtpMarkerBit() || FT == 0; 59 | 60 | return True; 61 | } 62 | 63 | char const* AC3AudioRTPSource::MIMEtype() const { 64 | return "audio/AC3"; 65 | } 66 | 67 | -------------------------------------------------------------------------------- /RTSPLib/liveMedia/AMRAudioFileServerMediaSubsession.cpp: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 2.1 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2013 Live Networks, Inc. All rights reserved. 18 | // A 'ServerMediaSubsession' object that creates new, unicast, "RTPSink"s 19 | // on demand, from an AMR audio file. 20 | // Implementation 21 | 22 | #include "AMRAudioFileServerMediaSubsession.hh" 23 | #include "AMRAudioRTPSink.hh" 24 | #include "AMRAudioFileSource.hh" 25 | 26 | AMRAudioFileServerMediaSubsession* 27 | AMRAudioFileServerMediaSubsession::createNew(UsageEnvironment& env, 28 | char const* fileName, 29 | Boolean reuseFirstSource) { 30 | return new AMRAudioFileServerMediaSubsession(env, fileName, reuseFirstSource); 31 | } 32 | 33 | AMRAudioFileServerMediaSubsession 34 | ::AMRAudioFileServerMediaSubsession(UsageEnvironment& env, 35 | char const* fileName, Boolean reuseFirstSource) 36 | : FileServerMediaSubsession(env, fileName, reuseFirstSource) { 37 | } 38 | 39 | AMRAudioFileServerMediaSubsession 40 | ::~AMRAudioFileServerMediaSubsession() { 41 | } 42 | 43 | FramedSource* AMRAudioFileServerMediaSubsession 44 | ::createNewStreamSource(unsigned /*clientSessionId*/, unsigned& estBitrate) { 45 | estBitrate = 10; // kbps, estimate 46 | 47 | return AMRAudioFileSource::createNew(envir(), fFileName); 48 | } 49 | 50 | RTPSink* AMRAudioFileServerMediaSubsession 51 | ::createNewRTPSink(Groupsock* rtpGroupsock, 52 | unsigned char rtpPayloadTypeIfDynamic, 53 | FramedSource* inputSource) { 54 | AMRAudioFileSource* amrSource = (AMRAudioFileSource*)inputSource; 55 | return AMRAudioRTPSink::createNew(envir(), rtpGroupsock, 56 | rtpPayloadTypeIfDynamic, 57 | amrSource->isWideband(), 58 | amrSource->numChannels()); 59 | } 60 | -------------------------------------------------------------------------------- /RTSPLib/liveMedia/AMRAudioSource.cpp: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 2.1 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2013 Live Networks, Inc. All rights reserved. 18 | // A source object for AMR audio sources 19 | // Implementation 20 | 21 | #include "AMRAudioSource.hh" 22 | 23 | AMRAudioSource::AMRAudioSource(UsageEnvironment& env, 24 | Boolean isWideband, unsigned numChannels) 25 | : FramedSource(env), 26 | fIsWideband(isWideband), fNumChannels(numChannels), fLastFrameHeader(0) { 27 | } 28 | 29 | AMRAudioSource::~AMRAudioSource() { 30 | } 31 | 32 | char const* AMRAudioSource::MIMEtype() const { 33 | return "audio/AMR"; 34 | } 35 | 36 | Boolean AMRAudioSource::isAMRAudioSource() const { 37 | return True; 38 | } 39 | -------------------------------------------------------------------------------- /RTSPLib/liveMedia/AudioInputDevice.cpp: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 2.1 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // Copyright (c) 2001-2003 Live Networks, Inc. All rights reserved. 17 | // Generic audio input device (such as a microphone, or an input sound card) 18 | // Implementation 19 | 20 | #include 21 | 22 | AudioInputDevice 23 | ::AudioInputDevice(UsageEnvironment& env, unsigned char bitsPerSample, 24 | unsigned char numChannels, 25 | unsigned samplingFrequency, unsigned granularityInMS) 26 | : FramedSource(env), fBitsPerSample(bitsPerSample), 27 | fNumChannels(numChannels), fSamplingFrequency(samplingFrequency), 28 | fGranularityInMS(granularityInMS) { 29 | } 30 | 31 | AudioInputDevice::~AudioInputDevice() { 32 | } 33 | 34 | char** AudioInputDevice::allowedDeviceNames = NULL; 35 | 36 | ////////// AudioPortNames implementation ////////// 37 | 38 | AudioPortNames::AudioPortNames() 39 | : numPorts(0), portName(NULL) { 40 | } 41 | 42 | AudioPortNames::~AudioPortNames() { 43 | for (unsigned i = 0; i < numPorts; ++i) delete portName[i]; 44 | delete portName; 45 | } 46 | -------------------------------------------------------------------------------- /RTSPLib/liveMedia/AudioRTPSink.cpp: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 2.1 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2013 Live Networks, Inc. All rights reserved. 18 | // A generic RTP sink for audio codecs (abstract base class) 19 | // Implementation 20 | 21 | #include "AudioRTPSink.hh" 22 | 23 | AudioRTPSink::AudioRTPSink(UsageEnvironment& env, 24 | Groupsock* rtpgs, unsigned char rtpPayloadType, 25 | unsigned rtpTimestampFrequency, 26 | char const* rtpPayloadFormatName, 27 | unsigned numChannels) 28 | : MultiFramedRTPSink(env, rtpgs, rtpPayloadType, rtpTimestampFrequency, 29 | rtpPayloadFormatName, numChannels) { 30 | } 31 | 32 | AudioRTPSink::~AudioRTPSink() { 33 | } 34 | 35 | char const* AudioRTPSink::sdpMediaType() const { 36 | return "audio"; 37 | } 38 | -------------------------------------------------------------------------------- /RTSPLib/liveMedia/DVVideoRTPSource.cpp: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 2.1 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2013 Live Networks, Inc. All rights reserved. 18 | // DV Video RTP Sources 19 | // Implementation 20 | 21 | #include "DVVideoRTPSource.hh" 22 | 23 | DVVideoRTPSource* 24 | DVVideoRTPSource::createNew(UsageEnvironment& env, 25 | Groupsock* RTPgs, 26 | unsigned char rtpPayloadFormat, 27 | unsigned rtpTimestampFrequency) { 28 | return new DVVideoRTPSource(env, RTPgs, rtpPayloadFormat, rtpTimestampFrequency); 29 | } 30 | 31 | DVVideoRTPSource::DVVideoRTPSource(UsageEnvironment& env, 32 | Groupsock* rtpGS, 33 | unsigned char rtpPayloadFormat, 34 | unsigned rtpTimestampFrequency) 35 | : MultiFramedRTPSource(env, rtpGS, 36 | rtpPayloadFormat, rtpTimestampFrequency) { 37 | } 38 | 39 | DVVideoRTPSource::~DVVideoRTPSource() { 40 | } 41 | 42 | #define DV_DIF_BLOCK_SIZE 80 43 | #define DV_SECTION_HEADER 0x1F 44 | 45 | Boolean DVVideoRTPSource 46 | ::processSpecialHeader(BufferedPacket* packet, 47 | unsigned& resultSpecialHeaderSize) { 48 | unsigned const packetSize = packet->dataSize(); 49 | if (packetSize < DV_DIF_BLOCK_SIZE) return False; // TARFU! 50 | 51 | u_int8_t const* data = packet->data(); 52 | fCurrentPacketBeginsFrame = data[0] == DV_SECTION_HEADER && (data[1]&0xf8) == 0 && data[2] == 0; // thanks to Ben Hutchings 53 | 54 | // The RTP "M" (marker) bit indicates the last fragment of a frame: 55 | fCurrentPacketCompletesFrame = packet->rtpMarkerBit(); 56 | 57 | // There is no special header 58 | resultSpecialHeaderSize = 0; 59 | return True; 60 | } 61 | 62 | char const* DVVideoRTPSource::MIMEtype() const { 63 | return "video/DV"; 64 | } 65 | 66 | -------------------------------------------------------------------------------- /RTSPLib/liveMedia/FileServerMediaSubsession.cpp: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 2.1 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2013 Live Networks, Inc. All rights reserved. 18 | // A 'ServerMediaSubsession' object that creates new, unicast, "RTPSink"s 19 | // on demand, from a file. 20 | // Implementation 21 | 22 | #include "FileServerMediaSubsession.hh" 23 | 24 | FileServerMediaSubsession 25 | ::FileServerMediaSubsession(UsageEnvironment& env, char const* fileName, 26 | Boolean reuseFirstSource) 27 | : OnDemandServerMediaSubsession(env, reuseFirstSource), 28 | fFileSize(0) { 29 | fFileName = strDup(fileName); 30 | } 31 | 32 | FileServerMediaSubsession::~FileServerMediaSubsession() { 33 | delete[] (char*)fFileName; 34 | } 35 | -------------------------------------------------------------------------------- /RTSPLib/liveMedia/FramedFileSource.cpp: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 2.1 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2013 Live Networks, Inc. All rights reserved. 18 | // Framed File Sources 19 | // Implementation 20 | 21 | #include "FramedFileSource.hh" 22 | 23 | ////////// FramedFileSource ////////// 24 | 25 | FramedFileSource::FramedFileSource(UsageEnvironment& env, FILE* fid) 26 | : FramedSource(env), fFid(fid) { 27 | } 28 | 29 | FramedFileSource::~FramedFileSource() { 30 | } 31 | -------------------------------------------------------------------------------- /RTSPLib/liveMedia/FramedFilter.cpp: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 2.1 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2013 Live Networks, Inc. All rights reserved. 18 | // Framed Filters 19 | // Implementation 20 | 21 | #include "FramedFilter.hh" 22 | 23 | ////////// FramedFilter ////////// 24 | #include 25 | 26 | FramedFilter::FramedFilter(UsageEnvironment& env, 27 | FramedSource* inputSource) 28 | : FramedSource(env), 29 | fInputSource(inputSource) { 30 | } 31 | 32 | FramedFilter::~FramedFilter() { 33 | Medium::close(fInputSource); 34 | } 35 | 36 | // Default implementations of needed virtual functions. These merely 37 | // call the same function in the input source - i.e., act like a 'null filter 38 | 39 | char const* FramedFilter::MIMEtype() const { 40 | if (fInputSource == NULL) return ""; 41 | 42 | return fInputSource->MIMEtype(); 43 | } 44 | 45 | void FramedFilter::getAttributes() const { 46 | if (fInputSource != NULL) fInputSource->getAttributes(); 47 | } 48 | 49 | void FramedFilter::doStopGettingFrames() { 50 | FramedSource::doStopGettingFrames(); 51 | if (fInputSource != NULL) fInputSource->stopGettingFrames(); 52 | } 53 | -------------------------------------------------------------------------------- /RTSPLib/liveMedia/GSMAudioRTPSink.cpp: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 2.1 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2013 Live Networks, Inc. All rights reserved. 18 | // RTP sink for GSM audio 19 | // Implementation 20 | 21 | #include "GSMAudioRTPSink.hh" 22 | 23 | GSMAudioRTPSink::GSMAudioRTPSink(UsageEnvironment& env, Groupsock* RTPgs) 24 | : AudioRTPSink(env, RTPgs, 3, 8000, "GSM") { 25 | } 26 | 27 | GSMAudioRTPSink::~GSMAudioRTPSink() { 28 | } 29 | 30 | GSMAudioRTPSink* 31 | GSMAudioRTPSink::createNew(UsageEnvironment& env, Groupsock* RTPgs) { 32 | return new GSMAudioRTPSink(env, RTPgs); 33 | } 34 | 35 | Boolean GSMAudioRTPSink 36 | ::frameCanAppearAfterPacketStart(unsigned char const* /*frameStart*/, 37 | unsigned /*numBytesInFrame*/) const { 38 | // Allow at most 5 frames in a single packet: 39 | return numFramesUsedSoFar() < 5; 40 | } 41 | -------------------------------------------------------------------------------- /RTSPLib/liveMedia/JPEGVideoSource.cpp: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 2.1 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2013 Live Networks, Inc. All rights reserved. 18 | // JPEG video sources 19 | // Implementation 20 | 21 | #include "JPEGVideoSource.hh" 22 | 23 | JPEGVideoSource::JPEGVideoSource(UsageEnvironment& env) 24 | : FramedSource(env) { 25 | } 26 | 27 | JPEGVideoSource::~JPEGVideoSource() { 28 | } 29 | 30 | u_int8_t const* JPEGVideoSource::quantizationTables(u_int8_t& precision, 31 | u_int16_t& length) { 32 | // Default implementation 33 | precision = 0; 34 | length = 0; 35 | return NULL; 36 | } 37 | 38 | u_int16_t JPEGVideoSource::restartInterval() { 39 | // Default implementation 40 | return 0; 41 | } 42 | 43 | Boolean JPEGVideoSource::isJPEGVideoSource() const { 44 | return True; 45 | } 46 | -------------------------------------------------------------------------------- /RTSPLib/liveMedia/Locale.cpp: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 2.1 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2013 Live Networks, Inc. All rights reserved. 18 | // Support for temporarily setting the locale (e.g., to "C" or "POSIX") for (e.g.) parsing or printing 19 | // floating-point numbers in protocol headers, or calling toupper()/tolower() on human-input strings. 20 | // Implementation 21 | 22 | #include "Locale.hh" 23 | #include 24 | 25 | Locale::Locale(char const* newLocale, LocaleCategory category) { 26 | #ifndef LOCALE_NOT_USED 27 | #ifndef XLOCALE_NOT_USED 28 | int categoryMask; 29 | switch (category) { 30 | case All: { categoryMask = LC_ALL_MASK; break; } 31 | case Numeric: { categoryMask = LC_NUMERIC_MASK; break; } 32 | } 33 | fLocale = newlocale(categoryMask, newLocale, NULL); 34 | fPrevLocale = uselocale(fLocale); 35 | #else 36 | switch (category) { 37 | case All: { fCategoryNum = LC_ALL; break; } 38 | case Numeric: { fCategoryNum = LC_NUMERIC; break; } 39 | } 40 | fPrevLocale = strDup(setlocale(fCategoryNum, NULL)); 41 | setlocale(fCategoryNum, newLocale); 42 | #endif 43 | #endif 44 | } 45 | 46 | Locale::~Locale() { 47 | #ifndef LOCALE_NOT_USED 48 | #ifndef XLOCALE_NOT_USED 49 | if (fLocale != (locale_t)0) { 50 | uselocale(fPrevLocale); 51 | freelocale(fLocale); 52 | } 53 | #else 54 | if (fPrevLocale != NULL) { 55 | setlocale(fCategoryNum, fPrevLocale); 56 | delete[] fPrevLocale; 57 | } 58 | #endif 59 | #endif 60 | } 61 | -------------------------------------------------------------------------------- /RTSPLib/liveMedia/MP3ADUdescriptor.cpp: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 2.1 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2013 Live Networks, Inc. All rights reserved. 18 | // Descriptor preceding frames of 'ADU' MP3 streams (for improved loss-tolerance) 19 | // Implementation 20 | 21 | #include "MP3ADUdescriptor.hh" 22 | 23 | ////////// ADUdescriptor ////////// 24 | 25 | //##### NOTE: For now, ignore fragmentation. Fix this later! ##### 26 | 27 | #define TWO_BYTE_DESCR_FLAG 0x40 28 | 29 | unsigned ADUdescriptor::generateDescriptor(unsigned char*& toPtr, 30 | unsigned remainingFrameSize) { 31 | unsigned descriptorSize = ADUdescriptor::computeSize(remainingFrameSize); 32 | switch (descriptorSize) { 33 | case 1: { 34 | *toPtr++ = (unsigned char)remainingFrameSize; 35 | break; 36 | } 37 | case 2: { 38 | generateTwoByteDescriptor(toPtr, remainingFrameSize); 39 | break; 40 | } 41 | } 42 | 43 | return descriptorSize; 44 | } 45 | 46 | void ADUdescriptor::generateTwoByteDescriptor(unsigned char*& toPtr, 47 | unsigned remainingFrameSize) { 48 | *toPtr++ = (TWO_BYTE_DESCR_FLAG|(unsigned char)(remainingFrameSize>>8)); 49 | *toPtr++ = (unsigned char)(remainingFrameSize&0xFF); 50 | } 51 | 52 | unsigned ADUdescriptor::getRemainingFrameSize(unsigned char*& fromPtr) { 53 | unsigned char firstByte = *fromPtr++; 54 | 55 | if (firstByte&TWO_BYTE_DESCR_FLAG) { 56 | // This is a 2-byte descriptor 57 | unsigned char secondByte = *fromPtr++; 58 | 59 | return ((firstByte&0x3F)<<8) | secondByte; 60 | } else { 61 | // This is a 1-byte descriptor 62 | return (firstByte&0x3F); 63 | } 64 | } 65 | 66 | -------------------------------------------------------------------------------- /RTSPLib/liveMedia/MP3ADUdescriptor.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 2.1 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2013 Live Networks, Inc. All rights reserved. 18 | // Descriptor preceding frames of 'ADU' MP3 streams (for improved loss-tolerance) 19 | // C++ header 20 | 21 | #ifndef _MP3_ADU_DESCRIPTOR_HH 22 | #define _MP3_ADU_DESCRIPTOR_HH 23 | 24 | // A class for handling the descriptor that begins each ADU frame: 25 | // (Note: We don't yet implement fragmentation) 26 | class ADUdescriptor { 27 | public: 28 | // Operations for generating a new descriptor 29 | static unsigned computeSize(unsigned remainingFrameSize) { 30 | return remainingFrameSize >= 64 ? 2 : 1; 31 | } 32 | static unsigned generateDescriptor(unsigned char*& toPtr, unsigned remainingFrameSize); 33 | // returns descriptor size; increments "toPtr" afterwards 34 | static void generateTwoByteDescriptor(unsigned char*& toPtr, unsigned remainingFrameSize); 35 | // always generates a 2-byte descriptor, even if "remainingFrameSize" is 36 | // small enough for a 1-byte descriptor 37 | 38 | // Operations for reading a descriptor 39 | static unsigned getRemainingFrameSize(unsigned char*& fromPtr); 40 | // increments "fromPtr" afterwards 41 | }; 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /RTSPLib/liveMedia/MP3Transcoder.cpp: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 2.1 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2013 Live Networks, Inc. All rights reserved. 18 | // MP3 Transcoder 19 | // Implementation 20 | 21 | #include "MP3Transcoder.hh" 22 | 23 | MP3Transcoder::MP3Transcoder(UsageEnvironment& env, 24 | MP3ADUTranscoder* aduTranscoder) 25 | : MP3FromADUSource(env, aduTranscoder, False) { 26 | } 27 | 28 | MP3Transcoder::~MP3Transcoder() { 29 | } 30 | 31 | MP3Transcoder* MP3Transcoder::createNew(UsageEnvironment& env, 32 | unsigned outBitrate /* in kbps */, 33 | FramedSource* inputSource) { 34 | MP3Transcoder* newSource = NULL; 35 | 36 | do { 37 | // Create the intermediate filters that help implement the transcoder: 38 | ADUFromMP3Source* aduFromMP3 39 | = ADUFromMP3Source::createNew(env, inputSource, False); 40 | // Note: This also checks that "inputSource" is an MP3 source 41 | if (aduFromMP3 == NULL) break; 42 | 43 | MP3ADUTranscoder* aduTranscoder 44 | = MP3ADUTranscoder::createNew(env, outBitrate, aduFromMP3); 45 | if (aduTranscoder == NULL) break; 46 | 47 | // Then create the transcoder itself: 48 | newSource = new MP3Transcoder(env, aduTranscoder); 49 | } while (0); 50 | 51 | return newSource; 52 | } 53 | -------------------------------------------------------------------------------- /RTSPLib/liveMedia/MPEG1or2AudioRTPSource.cpp: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 2.1 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2013 Live Networks, Inc. All rights reserved. 18 | // MPEG-1 or MPEG-2 Audio RTP Sources 19 | // Implementation 20 | 21 | #include "MPEG1or2AudioRTPSource.hh" 22 | 23 | MPEG1or2AudioRTPSource* 24 | MPEG1or2AudioRTPSource::createNew(UsageEnvironment& env, 25 | Groupsock* RTPgs, 26 | unsigned char rtpPayloadFormat, 27 | unsigned rtpTimestampFrequency) { 28 | return new MPEG1or2AudioRTPSource(env, RTPgs, rtpPayloadFormat, 29 | rtpTimestampFrequency); 30 | } 31 | 32 | MPEG1or2AudioRTPSource::MPEG1or2AudioRTPSource(UsageEnvironment& env, 33 | Groupsock* rtpGS, 34 | unsigned char rtpPayloadFormat, 35 | unsigned rtpTimestampFrequency) 36 | : MultiFramedRTPSource(env, rtpGS, 37 | rtpPayloadFormat, rtpTimestampFrequency) { 38 | } 39 | 40 | MPEG1or2AudioRTPSource::~MPEG1or2AudioRTPSource() { 41 | } 42 | 43 | Boolean MPEG1or2AudioRTPSource 44 | ::processSpecialHeader(BufferedPacket* packet, 45 | unsigned& resultSpecialHeaderSize) { 46 | // There's a 4-byte header indicating fragmentation. 47 | if (packet->dataSize() < 4) return False; 48 | 49 | // Note: This fragmentation header is actually useless to us, because 50 | // it doesn't tell us whether or not this RTP packet *ends* a 51 | // fragmented frame. Thus, we can't use it to properly set 52 | // "fCurrentPacketCompletesFrame". Instead, we assume that even 53 | // a partial audio frame will be usable to clients. 54 | 55 | resultSpecialHeaderSize = 4; 56 | return True; 57 | } 58 | 59 | char const* MPEG1or2AudioRTPSource::MIMEtype() const { 60 | return "audio/MPEG"; 61 | } 62 | 63 | -------------------------------------------------------------------------------- /RTSPLib/liveMedia/MPEG4ESVideoRTPSource.cpp: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 2.1 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2013 Live Networks, Inc. All rights reserved. 18 | // MP4V-ES video RTP stream sources 19 | // Implementation 20 | 21 | #include "MPEG4ESVideoRTPSource.hh" 22 | 23 | ///////// MPEG4ESVideoRTPSource implementation //////// 24 | 25 | //##### NOTE: INCOMPLETE!!! ##### 26 | 27 | MPEG4ESVideoRTPSource* 28 | MPEG4ESVideoRTPSource::createNew(UsageEnvironment& env, Groupsock* RTPgs, 29 | unsigned char rtpPayloadFormat, 30 | unsigned rtpTimestampFrequency) { 31 | return new MPEG4ESVideoRTPSource(env, RTPgs, rtpPayloadFormat, 32 | rtpTimestampFrequency); 33 | } 34 | 35 | MPEG4ESVideoRTPSource 36 | ::MPEG4ESVideoRTPSource(UsageEnvironment& env, Groupsock* RTPgs, 37 | unsigned char rtpPayloadFormat, 38 | unsigned rtpTimestampFrequency) 39 | : MultiFramedRTPSource(env, RTPgs, 40 | rtpPayloadFormat, rtpTimestampFrequency) { 41 | } 42 | 43 | MPEG4ESVideoRTPSource::~MPEG4ESVideoRTPSource() { 44 | } 45 | 46 | Boolean MPEG4ESVideoRTPSource 47 | ::processSpecialHeader(BufferedPacket* packet, 48 | unsigned& resultSpecialHeaderSize) { 49 | // The packet begins a frame iff its data begins with a system code 50 | // (i.e., 0x000001??) 51 | fCurrentPacketBeginsFrame 52 | = packet->dataSize() >= 4 && (packet->data())[0] == 0 53 | && (packet->data())[1] == 0 && (packet->data())[2] == 1; 54 | 55 | // The RTP "M" (marker) bit indicates the last fragment of a frame: 56 | fCurrentPacketCompletesFrame = packet->rtpMarkerBit(); 57 | 58 | // There is no special header 59 | resultSpecialHeaderSize = 0; 60 | return True; 61 | } 62 | 63 | char const* MPEG4ESVideoRTPSource::MIMEtype() const { 64 | return "video/MP4V-ES"; 65 | } 66 | -------------------------------------------------------------------------------- /RTSPLib/liveMedia/MPEGVideoStreamParser.cpp: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 2.1 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2013 Live Networks, Inc. All rights reserved. 18 | // An abstract parser for MPEG video streams 19 | // Implementation 20 | 21 | #include "MPEGVideoStreamParser.hh" 22 | 23 | MPEGVideoStreamParser 24 | ::MPEGVideoStreamParser(MPEGVideoStreamFramer* usingSource, 25 | FramedSource* inputSource) 26 | : StreamParser(inputSource, FramedSource::handleClosure, usingSource, 27 | &MPEGVideoStreamFramer::continueReadProcessing, usingSource), 28 | fUsingSource(usingSource) { 29 | } 30 | 31 | MPEGVideoStreamParser::~MPEGVideoStreamParser() { 32 | } 33 | 34 | void MPEGVideoStreamParser::restoreSavedParserState() { 35 | StreamParser::restoreSavedParserState(); 36 | fTo = fSavedTo; 37 | fNumTruncatedBytes = fSavedNumTruncatedBytes; 38 | } 39 | 40 | void MPEGVideoStreamParser::registerReadInterest(unsigned char* to, 41 | unsigned maxSize) { 42 | fStartOfFrame = fTo = fSavedTo = to; 43 | fLimit = to + maxSize; 44 | fNumTruncatedBytes = fSavedNumTruncatedBytes = 0; 45 | } 46 | -------------------------------------------------------------------------------- /RTSPLib/liveMedia/MatroskaDemuxedTrack.cpp: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 2.1 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2013 Live Networks, Inc. All rights reserved. 18 | // A media track, demultiplexed from a Matroska file 19 | // Implementation 20 | 21 | #include "MatroskaDemuxedTrack.hh" 22 | #include "MatroskaFile.hh" 23 | 24 | void MatroskaDemuxedTrack::seekToTime(double& seekNPT) { 25 | fOurSourceDemux.seekToTime(seekNPT); 26 | } 27 | 28 | MatroskaDemuxedTrack::MatroskaDemuxedTrack(UsageEnvironment& env, unsigned trackNumber, MatroskaDemux& sourceDemux) 29 | : FramedSource(env), 30 | fOurTrackNumber(trackNumber), fOurSourceDemux(sourceDemux), fDurationImbalance(0) { 31 | fPrevPresentationTime.tv_sec = 0; fPrevPresentationTime.tv_usec = 0; 32 | } 33 | 34 | MatroskaDemuxedTrack::~MatroskaDemuxedTrack() { 35 | fOurSourceDemux.removeTrack(fOurTrackNumber); 36 | } 37 | 38 | void MatroskaDemuxedTrack::doGetNextFrame() { 39 | fOurSourceDemux.continueReading(); 40 | } 41 | 42 | char const* MatroskaDemuxedTrack::MIMEtype() const { 43 | MatroskaTrack* track = fOurSourceDemux.fOurFile.lookup(fOurTrackNumber); 44 | if (track == NULL) return NULL; // shouldn't happen 45 | return track->mimeType; 46 | } 47 | -------------------------------------------------------------------------------- /RTSPLib/liveMedia/MatroskaDemuxedTrack.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 2.1 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2013 Live Networks, Inc. All rights reserved. 18 | // A media track, demultiplexed from a Matroska file 19 | // C++ header 20 | 21 | #ifndef _MATROSKA_DEMUXED_TRACK_HH 22 | #define _MATROSKA_DEMUXED_TRACK_HH 23 | 24 | #ifndef _FRAMED_SOURCE_HH 25 | #include "FramedSource.hh" 26 | #endif 27 | 28 | class MatroskaDemux; // forward 29 | 30 | class MatroskaDemuxedTrack: public FramedSource { 31 | public: 32 | void seekToTime(double& seekNPT); 33 | 34 | private: // We are created only by a MatroskaDemux (a friend) 35 | friend class MatroskaDemux; 36 | MatroskaDemuxedTrack(UsageEnvironment& env, unsigned trackNumber, MatroskaDemux& sourceDemux); 37 | virtual ~MatroskaDemuxedTrack(); 38 | 39 | private: 40 | // redefined virtual functions: 41 | virtual void doGetNextFrame(); 42 | virtual char const* MIMEtype() const; 43 | 44 | private: // We are accessed only by MatroskaDemux and by MatroskaFileParser (a friend) 45 | friend class MatroskaFileParser; 46 | unsigned char* to() { return fTo; } 47 | unsigned maxSize() { return fMaxSize; } 48 | unsigned& frameSize() { return fFrameSize; } 49 | unsigned& numTruncatedBytes() { return fNumTruncatedBytes; } 50 | struct timeval& presentationTime() { return fPresentationTime; } 51 | unsigned& durationInMicroseconds() { return fDurationInMicroseconds; } 52 | 53 | struct timeval& prevPresentationTime() { return fPrevPresentationTime; } 54 | int& durationImbalance() { return fDurationImbalance; } 55 | 56 | private: 57 | unsigned fOurTrackNumber; 58 | MatroskaDemux& fOurSourceDemux; 59 | struct timeval fPrevPresentationTime; 60 | int fDurationImbalance; 61 | }; 62 | 63 | #endif 64 | -------------------------------------------------------------------------------- /RTSPLib/liveMedia/OutputFile.cpp: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 2.1 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2013 Live Networks, Inc. All rights reserved. 18 | // Common routines for opening/closing named output files 19 | // Implementation 20 | 21 | #if (defined(__WIN32__) || defined(_WIN32)) && !defined(_WIN32_WCE) 22 | #include 23 | #include 24 | #endif 25 | #ifndef _WIN32_WCE 26 | #include 27 | #endif 28 | #include 29 | 30 | #include "OutputFile.hh" 31 | 32 | FILE* OpenOutputFile(UsageEnvironment& env, char const* fileName) { 33 | FILE* fid; 34 | 35 | // Check for special case 'file names': "stdout" and "stderr" 36 | if (strcmp(fileName, "stdout") == 0) { 37 | fid = stdout; 38 | #if (defined(__WIN32__) || defined(_WIN32)) && !defined(_WIN32_WCE) 39 | _setmode(_fileno(stdout), _O_BINARY); // convert to binary mode 40 | #endif 41 | } else if (strcmp(fileName, "stderr") == 0) { 42 | fid = stderr; 43 | #if (defined(__WIN32__) || defined(_WIN32)) && !defined(_WIN32_WCE) 44 | _setmode(_fileno(stderr), _O_BINARY); // convert to binary mode 45 | #endif 46 | } else { 47 | fid = fopen(fileName, "wb"); 48 | } 49 | 50 | if (fid == NULL) { 51 | env.setResultMsg("unable to open file \"", fileName, "\""); 52 | } 53 | 54 | return fid; 55 | } 56 | 57 | void CloseOutputFile(FILE* fid) { 58 | // Don't close 'stdout' or 'stderr', in case we want to use it again later. 59 | if (fid != NULL && fid != stdout && fid != stderr) fclose(fid); 60 | } 61 | -------------------------------------------------------------------------------- /RTSPLib/liveMedia/T140TextMatroskaFileServerMediaSubsession.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 2.1 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2013 Live Networks, Inc. All rights reserved. 18 | // A 'ServerMediaSubsession' object that creates new, unicast, "RTPSink"s 19 | // on demand, from an text (subtitle) track within a Matroska file. 20 | // C++ header 21 | 22 | #ifndef _T140_TEXT_MATROSKA_FILE_SERVER_MEDIA_SUBSESSION_HH 23 | #define _T140_TEXT_MATROSKA_FILE_SERVER_MEDIA_SUBSESSION_HH 24 | 25 | #ifndef _FILE_SERVER_MEDIA_SUBSESSION_HH 26 | #include "FileServerMediaSubsession.hh" 27 | #endif 28 | #ifndef _MATROSKA_FILE_SERVER_DEMUX_HH 29 | #include "MatroskaFileServerDemux.hh" 30 | #endif 31 | 32 | class T140TextMatroskaFileServerMediaSubsession: public FileServerMediaSubsession { 33 | public: 34 | static T140TextMatroskaFileServerMediaSubsession* 35 | createNew(MatroskaFileServerDemux& demux, unsigned trackNumber); 36 | 37 | private: 38 | T140TextMatroskaFileServerMediaSubsession(MatroskaFileServerDemux& demux, unsigned trackNumber); 39 | // called only by createNew(); 40 | virtual ~T140TextMatroskaFileServerMediaSubsession(); 41 | 42 | private: // redefined virtual functions 43 | virtual float duration() const; 44 | virtual void seekStreamSource(FramedSource* inputSource, double& seekNPT, double streamDuration, u_int64_t& numBytes); 45 | virtual FramedSource* createNewStreamSource(unsigned clientSessionId, 46 | unsigned& estBitrate); 47 | virtual RTPSink* createNewRTPSink(Groupsock* rtpGroupsock, unsigned char rtpPayloadTypeIfDynamic, FramedSource* inputSource); 48 | 49 | private: 50 | MatroskaFileServerDemux& fOurDemux; 51 | unsigned fTrackNumber; 52 | }; 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /RTSPLib/liveMedia/TextRTPSink.cpp: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 2.1 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2013 Live Networks, Inc. All rights reserved. 18 | // A generic RTP sink for text codecs (abstract base class) 19 | // Implementation 20 | 21 | #include "TextRTPSink.hh" 22 | 23 | TextRTPSink::TextRTPSink(UsageEnvironment& env, 24 | Groupsock* rtpgs, unsigned char rtpPayloadType, 25 | unsigned rtpTimestampFrequency, 26 | char const* rtpPayloadFormatName) 27 | : MultiFramedRTPSink(env, rtpgs, rtpPayloadType, rtpTimestampFrequency, 28 | rtpPayloadFormatName) { 29 | } 30 | 31 | TextRTPSink::~TextRTPSink() { 32 | } 33 | 34 | char const* TextRTPSink::sdpMediaType() const { 35 | return "text"; 36 | } 37 | -------------------------------------------------------------------------------- /RTSPLib/liveMedia/VP8VideoMatroskaFileServerMediaSubsession.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 2.1 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2013 Live Networks, Inc. All rights reserved. 18 | // A 'ServerMediaSubsession' object that creates new, unicast, "RTPSink"s 19 | // on demand, from a VP8 Video track within a Matroska file. 20 | // C++ header 21 | 22 | #ifndef _VP8_VIDEO_MATROSKA_FILE_SERVER_MEDIA_SUBSESSION_HH 23 | #define _VP8_VIDEO_MATROSKA_FILE_SERVER_MEDIA_SUBSESSION_HH 24 | 25 | #ifndef _FILE_SERVER_MEDIA_SUBSESSION_HH 26 | #include "FileServerMediaSubsession.hh" 27 | #endif 28 | #ifndef _MATROSKA_FILE_SERVER_DEMUX_HH 29 | #include "MatroskaFileServerDemux.hh" 30 | #endif 31 | 32 | class VP8VideoMatroskaFileServerMediaSubsession: public FileServerMediaSubsession { 33 | public: 34 | static VP8VideoMatroskaFileServerMediaSubsession* 35 | createNew(MatroskaFileServerDemux& demux, unsigned trackNumber); 36 | 37 | private: 38 | VP8VideoMatroskaFileServerMediaSubsession(MatroskaFileServerDemux& demux, unsigned trackNumber); 39 | // called only by createNew(); 40 | virtual ~VP8VideoMatroskaFileServerMediaSubsession(); 41 | 42 | private: // redefined virtual functions 43 | virtual float duration() const; 44 | virtual void seekStreamSource(FramedSource* inputSource, double& seekNPT, double streamDuration, u_int64_t& numBytes); 45 | virtual FramedSource* createNewStreamSource(unsigned clientSessionId, 46 | unsigned& estBitrate); 47 | virtual RTPSink* createNewRTPSink(Groupsock* rtpGroupsock, unsigned char rtpPayloadTypeIfDynamic, FramedSource* inputSource); 48 | 49 | private: 50 | MatroskaFileServerDemux& fOurDemux; 51 | unsigned fTrackNumber; 52 | }; 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /RTSPLib/liveMedia/VideoRTPSink.cpp: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 2.1 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2013 Live Networks, Inc. All rights reserved. 18 | // A generic RTP sink for video codecs (abstract base class) 19 | // Implementation 20 | 21 | #include "VideoRTPSink.hh" 22 | 23 | VideoRTPSink::VideoRTPSink(UsageEnvironment& env, 24 | Groupsock* rtpgs, unsigned char rtpPayloadType, 25 | unsigned rtpTimestampFrequency, 26 | char const* rtpPayloadFormatName) 27 | : MultiFramedRTPSink(env, rtpgs, rtpPayloadType, rtpTimestampFrequency, 28 | rtpPayloadFormatName) { 29 | } 30 | 31 | VideoRTPSink::~VideoRTPSink() { 32 | } 33 | 34 | char const* VideoRTPSink::sdpMediaType() const { 35 | return "video"; 36 | } 37 | -------------------------------------------------------------------------------- /RTSPLib/liveMedia/include/AC3AudioFileServerMediaSubsession.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 2.1 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2013 Live Networks, Inc. All rights reserved. 18 | // A 'ServerMediaSubsession' object that creates new, unicast, "RTPSink"s 19 | // on demand, from an AC3 audio file. 20 | // C++ header 21 | 22 | #ifndef _AC3_AUDIO_FILE_SERVER_MEDIA_SUBSESSION_HH 23 | #define _AC3_AUDIO_FILE_SERVER_MEDIA_SUBSESSION_HH 24 | 25 | #ifndef _FILE_SERVER_MEDIA_SUBSESSION_HH 26 | #include "FileServerMediaSubsession.hh" 27 | #endif 28 | 29 | class AC3AudioFileServerMediaSubsession: public FileServerMediaSubsession{ 30 | public: 31 | static AC3AudioFileServerMediaSubsession* 32 | createNew(UsageEnvironment& env, char const* fileName, Boolean reuseFirstSource); 33 | 34 | private: 35 | AC3AudioFileServerMediaSubsession(UsageEnvironment& env, 36 | char const* fileName, Boolean reuseFirstSource); 37 | // called only by createNew(); 38 | virtual ~AC3AudioFileServerMediaSubsession(); 39 | 40 | private: // redefined virtual functions 41 | virtual FramedSource* createNewStreamSource(unsigned clientSessionId, 42 | unsigned& estBitrate); 43 | virtual RTPSink* createNewRTPSink(Groupsock* rtpGroupsock, 44 | unsigned char rtpPayloadTypeIfDynamic, 45 | FramedSource* inputSource); 46 | }; 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /RTSPLib/liveMedia/include/AC3AudioRTPSink.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 2.1 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2013 Live Networks, Inc. All rights reserved. 18 | // RTP sink for AC3 audio 19 | // C++ header 20 | 21 | #ifndef _AC3_AUDIO_RTP_SINK_HH 22 | #define _AC3_AUDIO_RTP_SINK_HH 23 | 24 | #ifndef _AUDIO_RTP_SINK_HH 25 | #include "AudioRTPSink.hh" 26 | #endif 27 | 28 | class AC3AudioRTPSink: public AudioRTPSink { 29 | public: 30 | static AC3AudioRTPSink* createNew(UsageEnvironment& env, 31 | Groupsock* RTPgs, 32 | u_int8_t rtpPayloadFormat, 33 | u_int32_t rtpTimestampFrequency); 34 | 35 | protected: 36 | AC3AudioRTPSink(UsageEnvironment& env, Groupsock* RTPgs, 37 | u_int8_t rtpPayloadFormat, 38 | u_int32_t rtpTimestampFrequency); 39 | // called only by createNew() 40 | 41 | virtual ~AC3AudioRTPSink(); 42 | 43 | private: // redefined virtual functions: 44 | virtual Boolean frameCanAppearAfterPacketStart(unsigned char const* frameStart, 45 | unsigned numBytesInFrame) const; 46 | virtual void doSpecialFrameHandling(unsigned fragmentationOffset, 47 | unsigned char* frameStart, 48 | unsigned numBytesInFrame, 49 | struct timeval framePresentationTime, 50 | unsigned numRemainingBytes); 51 | virtual unsigned specialHeaderSize() const; 52 | 53 | private: 54 | unsigned char fTotNumFragmentsUsed; // used only if a frame gets fragmented across multiple packets 55 | }; 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /RTSPLib/liveMedia/include/AC3AudioRTPSource.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 2.1 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2013 Live Networks, Inc. All rights reserved. 18 | // AC3 Audio RTP Sources 19 | // C++ header 20 | 21 | #ifndef _AC3_AUDIO_RTP_SOURCE_HH 22 | #define _AC3_AUDIO_RTP_SOURCE_HH 23 | 24 | #ifndef _MULTI_FRAMED_RTP_SOURCE_HH 25 | #include "MultiFramedRTPSource.hh" 26 | #endif 27 | 28 | class AC3AudioRTPSource: public MultiFramedRTPSource { 29 | public: 30 | static AC3AudioRTPSource* 31 | createNew(UsageEnvironment& env, Groupsock* RTPgs, 32 | unsigned char rtpPayloadFormat, 33 | unsigned rtpTimestampFrequency); 34 | 35 | protected: 36 | virtual ~AC3AudioRTPSource(); 37 | 38 | private: 39 | AC3AudioRTPSource(UsageEnvironment& env, Groupsock* RTPgs, 40 | unsigned char rtpPayloadFormat, 41 | unsigned rtpTimestampFrequency); 42 | // called only by createNew() 43 | 44 | private: 45 | // redefined virtual functions: 46 | virtual Boolean processSpecialHeader(BufferedPacket* packet, 47 | unsigned& resultSpecialHeaderSize); 48 | virtual char const* MIMEtype() const; 49 | }; 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /RTSPLib/liveMedia/include/ADTSAudioFileServerMediaSubsession.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 2.1 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2013 Live Networks, Inc. All rights reserved. 18 | // A 'ServerMediaSubsession' object that creates new, unicast, "RTPSink"s 19 | // on demand, from an AAC audio file in ADTS format 20 | // C++ header 21 | 22 | #ifndef _ADTS_AUDIO_FILE_SERVER_MEDIA_SUBSESSION_HH 23 | #define _ADTS_AUDIO_FILE_SERVER_MEDIA_SUBSESSION_HH 24 | 25 | #ifndef _FILE_SERVER_MEDIA_SUBSESSION_HH 26 | #include "FileServerMediaSubsession.hh" 27 | #endif 28 | 29 | class ADTSAudioFileServerMediaSubsession: public FileServerMediaSubsession{ 30 | public: 31 | static ADTSAudioFileServerMediaSubsession* 32 | createNew(UsageEnvironment& env, char const* fileName, Boolean reuseFirstSource); 33 | 34 | protected: 35 | ADTSAudioFileServerMediaSubsession(UsageEnvironment& env, 36 | char const* fileName, Boolean reuseFirstSource); 37 | // called only by createNew(); 38 | virtual ~ADTSAudioFileServerMediaSubsession(); 39 | 40 | protected: // redefined virtual functions 41 | virtual FramedSource* createNewStreamSource(unsigned clientSessionId, 42 | unsigned& estBitrate); 43 | virtual RTPSink* createNewRTPSink(Groupsock* rtpGroupsock, 44 | unsigned char rtpPayloadTypeIfDynamic, 45 | FramedSource* inputSource); 46 | }; 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /RTSPLib/liveMedia/include/ADTSAudioFileSource.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 2.1 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2013 Live Networks, Inc. All rights reserved. 18 | // A source object for AAC audio files in ADTS format 19 | // C++ header 20 | 21 | #ifndef _ADTS_AUDIO_FILE_SOURCE_HH 22 | #define _ADTS_AUDIO_FILE_SOURCE_HH 23 | 24 | #ifndef _FRAMED_FILE_SOURCE_HH 25 | #include "FramedFileSource.hh" 26 | #endif 27 | 28 | class ADTSAudioFileSource: public FramedFileSource { 29 | public: 30 | static ADTSAudioFileSource* createNew(UsageEnvironment& env, 31 | char const* fileName); 32 | 33 | unsigned samplingFrequency() const { return fSamplingFrequency; } 34 | unsigned numChannels() const { return fNumChannels; } 35 | char const* configStr() const { return fConfigStr; } 36 | // returns the 'AudioSpecificConfig' for this stream (in ASCII form) 37 | 38 | private: 39 | ADTSAudioFileSource(UsageEnvironment& env, FILE* fid, u_int8_t profile, 40 | u_int8_t samplingFrequencyIndex, u_int8_t channelConfiguration); 41 | // called only by createNew() 42 | 43 | virtual ~ADTSAudioFileSource(); 44 | 45 | private: 46 | // redefined virtual functions: 47 | virtual void doGetNextFrame(); 48 | 49 | private: 50 | unsigned fSamplingFrequency; 51 | unsigned fNumChannels; 52 | unsigned fuSecsPerFrame; 53 | char fConfigStr[5]; 54 | }; 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /RTSPLib/liveMedia/include/AMRAudioFileServerMediaSubsession.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 2.1 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2013 Live Networks, Inc. All rights reserved. 18 | // A 'ServerMediaSubsession' object that creates new, unicast, "RTPSink"s 19 | // on demand, from an AMR audio file. 20 | // C++ header 21 | 22 | #ifndef _AMR_AUDIO_FILE_SERVER_MEDIA_SUBSESSION_HH 23 | #define _AMR_AUDIO_FILE_SERVER_MEDIA_SUBSESSION_HH 24 | 25 | #ifndef _FILE_SERVER_MEDIA_SUBSESSION_HH 26 | #include "FileServerMediaSubsession.hh" 27 | #endif 28 | 29 | class AMRAudioFileServerMediaSubsession: public FileServerMediaSubsession{ 30 | public: 31 | static AMRAudioFileServerMediaSubsession* 32 | createNew(UsageEnvironment& env, char const* fileName, Boolean reuseFirstSource); 33 | 34 | private: 35 | AMRAudioFileServerMediaSubsession(UsageEnvironment& env, 36 | char const* fileName, Boolean reuseFirstSource); 37 | // called only by createNew(); 38 | virtual ~AMRAudioFileServerMediaSubsession(); 39 | 40 | private: // redefined virtual functions 41 | virtual FramedSource* createNewStreamSource(unsigned clientSessionId, 42 | unsigned& estBitrate); 43 | virtual RTPSink* createNewRTPSink(Groupsock* rtpGroupsock, 44 | unsigned char rtpPayloadTypeIfDynamic, 45 | FramedSource* inputSource); 46 | }; 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /RTSPLib/liveMedia/include/AMRAudioFileSink.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 2.1 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2013 Live Networks, Inc. All rights reserved. 18 | // AMR Audio File Sinks 19 | // C++ header 20 | 21 | #ifndef _AMR_AUDIO_FILE_SINK_HH 22 | #define _AMR_AUDIO_FILE_SINK_HH 23 | 24 | #ifndef _FILE_SINK_HH 25 | #include "FileSink.hh" 26 | #endif 27 | 28 | class AMRAudioFileSink: public FileSink { 29 | public: 30 | static AMRAudioFileSink* createNew(UsageEnvironment& env, char const* fileName, 31 | unsigned bufferSize = 10000, 32 | Boolean oneFilePerFrame = False); 33 | // (See "FileSink.hh" for a description of these parameters.) 34 | 35 | protected: 36 | AMRAudioFileSink(UsageEnvironment& env, FILE* fid, unsigned bufferSize, 37 | char const* perFrameFileNamePrefix); 38 | // called only by createNew() 39 | virtual ~AMRAudioFileSink(); 40 | 41 | protected: // redefined virtual functions: 42 | virtual Boolean sourceIsCompatibleWithUs(MediaSource& source); 43 | virtual void afterGettingFrame(unsigned frameSize, 44 | unsigned numTruncatedBytes, 45 | struct timeval presentationTime); 46 | 47 | protected: 48 | Boolean fHaveWrittenHeader; 49 | }; 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /RTSPLib/liveMedia/include/AMRAudioFileSource.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 2.1 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2013 Live Networks, Inc. All rights reserved. 18 | // A source object for AMR audio files (as defined in RFC 4867, section 5) 19 | // C++ header 20 | 21 | #ifndef _AMR_AUDIO_FILE_SOURCE_HH 22 | #define _AMR_AUDIO_FILE_SOURCE_HH 23 | 24 | #ifndef _AMR_AUDIO_SOURCE_HH 25 | #include "AMRAudioSource.hh" 26 | #endif 27 | 28 | class AMRAudioFileSource: public AMRAudioSource { 29 | public: 30 | static AMRAudioFileSource* createNew(UsageEnvironment& env, 31 | char const* fileName); 32 | 33 | private: 34 | AMRAudioFileSource(UsageEnvironment& env, FILE* fid, 35 | Boolean isWideband, unsigned numChannels); 36 | // called only by createNew() 37 | 38 | virtual ~AMRAudioFileSource(); 39 | 40 | private: 41 | // redefined virtual functions: 42 | virtual void doGetNextFrame(); 43 | 44 | private: 45 | FILE* fFid; 46 | }; 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /RTSPLib/liveMedia/include/AMRAudioRTPSource.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 2.1 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2013 Live Networks, Inc. All rights reserved. 18 | // AMR Audio RTP Sources (RFC 4867) 19 | // C++ header 20 | 21 | #ifndef _AMR_AUDIO_RTP_SOURCE_HH 22 | #define _AMR_AUDIO_RTP_SOURCE_HH 23 | 24 | #ifndef _RTP_SOURCE_HH 25 | #include "RTPSource.hh" 26 | #endif 27 | #ifndef _AMR_AUDIO_SOURCE_HH 28 | #include "AMRAudioSource.hh" 29 | #endif 30 | 31 | class AMRAudioRTPSource { 32 | public: 33 | static AMRAudioSource* createNew(UsageEnvironment& env, 34 | Groupsock* RTPgs, 35 | RTPSource*& resultRTPSource, 36 | unsigned char rtpPayloadFormat, 37 | Boolean isWideband = False, 38 | unsigned numChannels = 1, 39 | Boolean isOctetAligned = True, 40 | unsigned interleaving = 0, 41 | // relevant only if "isOctetAligned" 42 | // The maximum # of frame-blocks in a group 43 | // 0 means: no interleaving 44 | Boolean robustSortingOrder = False, 45 | // relevant only if "isOctetAligned" 46 | Boolean CRCsArePresent = False 47 | // relevant only if "isOctetAligned" 48 | ); 49 | // This returns a source to read from, but "resultRTPSource" will 50 | // point to RTP-related state. 51 | }; 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /RTSPLib/liveMedia/include/AMRAudioSource.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 2.1 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2013 Live Networks, Inc. All rights reserved. 18 | // A source object for AMR audio sources 19 | // C++ header 20 | 21 | #ifndef _AMR_AUDIO_SOURCE_HH 22 | #define _AMR_AUDIO_SOURCE_HH 23 | 24 | #ifndef _FRAMED_SOURCE_HH 25 | #include "FramedSource.hh" 26 | #endif 27 | 28 | class AMRAudioSource: public FramedSource { 29 | public: 30 | Boolean isWideband() const { return fIsWideband; } 31 | unsigned numChannels() const { return fNumChannels; } 32 | 33 | u_int8_t lastFrameHeader() const { return fLastFrameHeader; } 34 | // The frame header for the most recently read frame (RFC 4867, sec. 5.3) 35 | 36 | protected: 37 | AMRAudioSource(UsageEnvironment& env, Boolean isWideband, unsigned numChannels); 38 | // virtual base class 39 | virtual ~AMRAudioSource(); 40 | 41 | private: 42 | // redefined virtual functions: 43 | virtual char const* MIMEtype() const; 44 | virtual Boolean isAMRAudioSource() const; 45 | 46 | protected: 47 | Boolean fIsWideband; 48 | unsigned fNumChannels; 49 | u_int8_t fLastFrameHeader; 50 | }; 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /RTSPLib/liveMedia/include/AudioRTPSink.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 2.1 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2013 Live Networks, Inc. All rights reserved. 18 | // A generic RTP sink for audio codecs (abstract base class) 19 | // C++ header 20 | 21 | #ifndef _AUDIO_RTP_SINK_HH 22 | #define _AUDIO_RTP_SINK_HH 23 | 24 | #ifndef _MULTI_FRAMED_RTP_SINK_HH 25 | #include "MultiFramedRTPSink.hh" 26 | #endif 27 | 28 | class AudioRTPSink: public MultiFramedRTPSink { 29 | protected: 30 | AudioRTPSink(UsageEnvironment& env, 31 | Groupsock* rtpgs, unsigned char rtpPayloadType, 32 | unsigned rtpTimestampFrequency, 33 | char const* rtpPayloadFormatName, 34 | unsigned numChannels = 1); 35 | // (we're an abstract base class) 36 | virtual ~AudioRTPSink(); 37 | 38 | private: // redefined virtual functions: 39 | virtual char const* sdpMediaType() const; 40 | }; 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /RTSPLib/liveMedia/include/Base64.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 2.1 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2013 Live Networks, Inc. All rights reserved. 18 | // Base64 encoding and decoding 19 | // C++ header 20 | 21 | #ifndef _BASE64_HH 22 | #define _BASE64_HH 23 | 24 | #ifndef _BOOLEAN_HH 25 | #include "Boolean.hh" 26 | #endif 27 | 28 | unsigned char* base64Decode(char const* in, unsigned& resultSize, 29 | Boolean trimTrailingZeros = True); 30 | // returns a newly allocated array - of size "resultSize" - that 31 | // the caller is responsible for delete[]ing. 32 | 33 | unsigned char* base64Decode(char const* in, unsigned inSize, 34 | unsigned& resultSize, 35 | Boolean trimTrailingZeros = True); 36 | // As above, but includes the size of the input string (i.e., the number of bytes to decode) as a parameter. 37 | // This saves an extra call to "strlen()" if we already know the length of the input string. 38 | 39 | char* base64Encode(char const* orig, unsigned origLength); 40 | // returns a 0-terminated string that 41 | // the caller is responsible for delete[]ing. 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /RTSPLib/liveMedia/include/BasicUDPSink.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 2.1 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2013 Live Networks, Inc. All rights reserved. 18 | // A simple UDP sink (i.e., without RTP or other headers added); one frame per packet 19 | // C++ header 20 | 21 | #ifndef _BASIC_UDP_SINK_HH 22 | #define _BASIC_UDP_SINK_HH 23 | 24 | #ifndef _MEDIA_SINK_HH 25 | #include "MediaSink.hh" 26 | #endif 27 | #ifndef _GROUPSOCK_HH 28 | #include 29 | #endif 30 | 31 | class BasicUDPSink: public MediaSink { 32 | public: 33 | static BasicUDPSink* createNew(UsageEnvironment& env, Groupsock* gs, 34 | unsigned maxPayloadSize = 1450); 35 | protected: 36 | BasicUDPSink(UsageEnvironment& env, Groupsock* gs, unsigned maxPayloadSize); 37 | // called only by createNew() 38 | virtual ~BasicUDPSink(); 39 | 40 | private: // redefined virtual functions: 41 | virtual Boolean continuePlaying(); 42 | 43 | private: 44 | void continuePlaying1(); 45 | 46 | static void afterGettingFrame(void* clientData, unsigned frameSize, 47 | unsigned numTruncatedBytes, 48 | struct timeval presentationTime, 49 | unsigned durationInMicroseconds); 50 | void afterGettingFrame1(unsigned frameSize, unsigned numTruncatedBytes, 51 | unsigned durationInMicroseconds); 52 | 53 | static void sendNext(void* firstArg); 54 | 55 | private: 56 | Groupsock* fGS; 57 | unsigned fMaxPayloadSize; 58 | unsigned char* fOutputBuffer; 59 | struct timeval fNextSendTime; 60 | }; 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /RTSPLib/liveMedia/include/BasicUDPSource.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 2.1 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2013 Live Networks, Inc. All rights reserved. 18 | // A simple UDP source, where every UDP payload is a complete frame 19 | // C++ header 20 | 21 | #ifndef _BASIC_UDP_SOURCE_HH 22 | #define _BASIC_UDP_SOURCE_HH 23 | 24 | #ifndef _FRAMED_SOURCE_HH 25 | #include "FramedSource.hh" 26 | #endif 27 | #ifndef _GROUPSOCK_HH 28 | #include "Groupsock.hh" 29 | #endif 30 | 31 | class BasicUDPSource: public FramedSource { 32 | public: 33 | static BasicUDPSource* createNew(UsageEnvironment& env, Groupsock* inputGS); 34 | 35 | virtual ~BasicUDPSource(); 36 | 37 | Groupsock* gs() const { return fInputGS; } 38 | 39 | private: 40 | BasicUDPSource(UsageEnvironment& env, Groupsock* inputGS); 41 | // called only by createNew() 42 | 43 | static void incomingPacketHandler(BasicUDPSource* source, int mask); 44 | void incomingPacketHandler1(); 45 | 46 | private: // redefined virtual functions: 47 | virtual void doGetNextFrame(); 48 | virtual void doStopGettingFrames(); 49 | 50 | private: 51 | Groupsock* fInputGS; 52 | Boolean fHaveStartedReading; 53 | }; 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /RTSPLib/liveMedia/include/BitVector.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 2.1 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2013 Live Networks, Inc. All rights reserved. 18 | // Bit Vector data structure 19 | // C++ header 20 | 21 | #ifndef _BIT_VECTOR_HH 22 | #define _BIT_VECTOR_HH 23 | 24 | #ifndef _BOOLEAN_HH 25 | #include "Boolean.hh" 26 | #endif 27 | 28 | class BitVector { 29 | public: 30 | BitVector(unsigned char* baseBytePtr, 31 | unsigned baseBitOffset, 32 | unsigned totNumBits); 33 | 34 | void setup(unsigned char* baseBytePtr, 35 | unsigned baseBitOffset, 36 | unsigned totNumBits); 37 | 38 | void putBits(unsigned from, unsigned numBits); // "numBits" <= 32 39 | void put1Bit(unsigned bit); 40 | 41 | unsigned getBits(unsigned numBits); // "numBits" <= 32 42 | unsigned get1Bit(); 43 | Boolean get1BitBoolean() { return get1Bit() != 0; } 44 | 45 | void skipBits(unsigned numBits); 46 | 47 | unsigned curBitIndex() const { return fCurBitIndex; } 48 | unsigned totNumBits() const { return fTotNumBits; } 49 | unsigned numBitsRemaining() const { return fTotNumBits - fCurBitIndex; } 50 | 51 | unsigned get_expGolomb(); 52 | // Returns the value of the next bits, assuming that they were encoded using an exponential-Golomb code of order 0 53 | 54 | private: 55 | unsigned char* fBaseBytePtr; 56 | unsigned fBaseBitOffset; 57 | unsigned fTotNumBits; 58 | unsigned fCurBitIndex; 59 | }; 60 | 61 | // A general bit copy operation: 62 | void shiftBits(unsigned char* toBasePtr, unsigned toBitOffset, 63 | unsigned char const* fromBasePtr, unsigned fromBitOffset, 64 | unsigned numBits); 65 | 66 | #endif 67 | -------------------------------------------------------------------------------- /RTSPLib/liveMedia/include/DVVideoFileServerMediaSubsession.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 2.1 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2013 Live Networks, Inc. All rights reserved. 18 | // A 'ServerMediaSubsession' object that creates new, unicast, "RTPSink"s 19 | // on demand, from a DV video file. 20 | // C++ header 21 | 22 | #ifndef _DV_VIDEO_FILE_SERVER_MEDIA_SUBSESSION_HH 23 | #define _DV_VIDEO_FILE_SERVER_MEDIA_SUBSESSION_HH 24 | 25 | #ifndef _FILE_SERVER_MEDIA_SUBSESSION_HH 26 | #include "FileServerMediaSubsession.hh" 27 | #endif 28 | 29 | class DVVideoFileServerMediaSubsession: public FileServerMediaSubsession{ 30 | public: 31 | static DVVideoFileServerMediaSubsession* 32 | createNew(UsageEnvironment& env, char const* fileName, Boolean reuseFirstSource); 33 | 34 | private: 35 | DVVideoFileServerMediaSubsession(UsageEnvironment& env, char const* fileName, Boolean reuseFirstSource); 36 | // called only by createNew(); 37 | virtual ~DVVideoFileServerMediaSubsession(); 38 | 39 | private: // redefined virtual functions 40 | virtual char const* getAuxSDPLine(RTPSink* rtpSink, FramedSource* inputSource); 41 | virtual void seekStreamSource(FramedSource* inputSource, double& seekNPT, double streamDuration, u_int64_t& numBytes); 42 | virtual FramedSource* createNewStreamSource(unsigned clientSessionId, unsigned& estBitrate); 43 | virtual RTPSink* createNewRTPSink(Groupsock* rtpGroupsock, unsigned char rtpPayloadTypeIfDynamic, FramedSource* inputSource); 44 | virtual float duration() const; 45 | 46 | private: 47 | float fFileDuration; // in seconds 48 | }; 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /RTSPLib/liveMedia/include/DVVideoRTPSink.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 2.1 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2013 Live Networks, Inc. All rights reserved. 18 | // RTP sink for DV video (RFC 3189) 19 | // (Thanks to Ben Hutchings for prototyping this.) 20 | // C++ header 21 | 22 | #ifndef _DV_VIDEO_RTP_SINK_HH 23 | #define _DV_VIDEO_RTP_SINK_HH 24 | 25 | #ifndef _VIDEO_RTP_SINK_HH 26 | #include "VideoRTPSink.hh" 27 | #endif 28 | #ifndef _DV_VIDEO_STREAM_FRAMER_HH 29 | #include "DVVideoStreamFramer.hh" 30 | #endif 31 | 32 | class DVVideoRTPSink: public VideoRTPSink { 33 | public: 34 | static DVVideoRTPSink* createNew(UsageEnvironment& env, Groupsock* RTPgs, unsigned char rtpPayloadFormat); 35 | char const* auxSDPLineFromFramer(DVVideoStreamFramer* framerSource); 36 | 37 | protected: 38 | DVVideoRTPSink(UsageEnvironment& env, Groupsock* RTPgs, unsigned char rtpPayloadFormat); 39 | // called only by createNew() 40 | 41 | virtual ~DVVideoRTPSink(); 42 | 43 | private: // redefined virtual functions: 44 | virtual Boolean sourceIsCompatibleWithUs(MediaSource& source); 45 | virtual void doSpecialFrameHandling(unsigned fragmentationOffset, 46 | unsigned char* frameStart, 47 | unsigned numBytesInFrame, 48 | struct timeval framePresentationTime, 49 | unsigned numRemainingBytes); 50 | virtual unsigned computeOverflowForNewFrame(unsigned newFrameSize) const; 51 | virtual char const* auxSDPLine(); 52 | 53 | private: 54 | char* fFmtpSDPLine; 55 | }; 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /RTSPLib/liveMedia/include/DVVideoRTPSource.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 2.1 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2013 Live Networks, Inc. All rights reserved. 18 | // DV Video RTP Sources 19 | // C++ header 20 | 21 | #ifndef _DV_VIDEOO_RTP_SOURCE_HH 22 | #define _DV_VIDEO_RTP_SOURCE_HH 23 | 24 | #ifndef _MULTI_FRAMED_RTP_SOURCE_HH 25 | #include "MultiFramedRTPSource.hh" 26 | #endif 27 | 28 | class DVVideoRTPSource: public MultiFramedRTPSource { 29 | public: 30 | static DVVideoRTPSource* 31 | createNew(UsageEnvironment& env, Groupsock* RTPgs, 32 | unsigned char rtpPayloadFormat, 33 | unsigned rtpTimestampFrequency); 34 | 35 | protected: 36 | virtual ~DVVideoRTPSource(); 37 | 38 | private: 39 | DVVideoRTPSource(UsageEnvironment& env, Groupsock* RTPgs, 40 | unsigned char rtpPayloadFormat, 41 | unsigned rtpTimestampFrequency); 42 | // called only by createNew() 43 | 44 | private: 45 | // redefined virtual functions: 46 | virtual Boolean processSpecialHeader(BufferedPacket* packet, 47 | unsigned& resultSpecialHeaderSize); 48 | virtual char const* MIMEtype() const; 49 | }; 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /RTSPLib/liveMedia/include/FileServerMediaSubsession.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 2.1 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2013 Live Networks, Inc. All rights reserved. 18 | // A 'ServerMediaSubsession' object that creates new, unicast, "RTPSink"s 19 | // on demand, from a file. 20 | // C++ header 21 | 22 | #ifndef _FILE_SERVER_MEDIA_SUBSESSION_HH 23 | #define _FILE_SERVER_MEDIA_SUBSESSION_HH 24 | 25 | #ifndef _ON_DEMAND_SERVER_MEDIA_SUBSESSION_HH 26 | #include "OnDemandServerMediaSubsession.hh" 27 | #endif 28 | 29 | class FileServerMediaSubsession: public OnDemandServerMediaSubsession { 30 | protected: // we're a virtual base class 31 | FileServerMediaSubsession(UsageEnvironment& env, char const* fileName, 32 | Boolean reuseFirstSource); 33 | virtual ~FileServerMediaSubsession(); 34 | 35 | protected: 36 | char const* fFileName; 37 | u_int64_t fFileSize; // if known 38 | }; 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /RTSPLib/liveMedia/include/FramedFileSource.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 2.1 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2013 Live Networks, Inc. All rights reserved. 18 | // Framed File Sources 19 | // C++ header 20 | 21 | #ifndef _FRAMED_FILE_SOURCE_HH 22 | #define _FRAMED_FILE_SOURCE_HH 23 | 24 | #ifndef _FRAMED_SOURCE_HH 25 | #include "FramedSource.hh" 26 | #endif 27 | 28 | class FramedFileSource: public FramedSource { 29 | protected: 30 | FramedFileSource(UsageEnvironment& env, FILE* fid); // abstract base class 31 | virtual ~FramedFileSource(); 32 | 33 | protected: 34 | FILE* fFid; 35 | }; 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /RTSPLib/liveMedia/include/FramedFilter.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 2.1 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2013 Live Networks, Inc. All rights reserved. 18 | // Framed Filters 19 | // C++ header 20 | 21 | #ifndef _FRAMED_FILTER_HH 22 | #define _FRAMED_FILTER_HH 23 | 24 | #ifndef _FRAMED_SOURCE_HH 25 | #include "FramedSource.hh" 26 | #endif 27 | 28 | class FramedFilter: public FramedSource { 29 | public: 30 | FramedSource* inputSource() const { return fInputSource; } 31 | 32 | void reassignInputSource(FramedSource* newInputSource) { fInputSource = newInputSource; } 33 | 34 | // Call before destruction if you want to prevent the destructor from closing the input source 35 | void detachInputSource() { reassignInputSource(NULL); } 36 | 37 | protected: 38 | FramedFilter(UsageEnvironment& env, FramedSource* inputSource); 39 | // abstract base class 40 | virtual ~FramedFilter(); 41 | 42 | protected: 43 | // Redefined virtual functions (with default 'null' implementations): 44 | virtual char const* MIMEtype() const; 45 | virtual void getAttributes() const; 46 | virtual void doStopGettingFrames(); 47 | 48 | protected: 49 | FramedSource* fInputSource; 50 | }; 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /RTSPLib/liveMedia/include/GSMAudioRTPSink.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 2.1 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2013 Live Networks, Inc. All rights reserved. 18 | // RTP sink for GSM audio 19 | // C++ header 20 | 21 | #ifndef _GSM_AUDIO_RTP_SINK_HH 22 | #define _GSM_AUDIO_RTP_SINK_HH 23 | 24 | #ifndef _AUDIO_RTP_SINK_HH 25 | #include "AudioRTPSink.hh" 26 | #endif 27 | 28 | class GSMAudioRTPSink: public AudioRTPSink { 29 | public: 30 | static GSMAudioRTPSink* createNew(UsageEnvironment& env, Groupsock* RTPgs); 31 | 32 | protected: 33 | GSMAudioRTPSink(UsageEnvironment& env, Groupsock* RTPgs); 34 | // called only by createNew() 35 | 36 | virtual ~GSMAudioRTPSink(); 37 | 38 | private: // redefined virtual functions: 39 | virtual 40 | Boolean frameCanAppearAfterPacketStart(unsigned char const* frameStart, 41 | unsigned numBytesInFrame) const; 42 | }; 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /RTSPLib/liveMedia/include/H261VideoRTPSource.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 2.1 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2013 Live Networks, Inc. All rights reserved. 18 | // H.261 Video RTP Sources 19 | // C++ header 20 | 21 | #ifndef _H261_VIDEO_RTP_SOURCE_HH 22 | #define _H261_VIDEO_RTP_SOURCE_HH 23 | 24 | #ifndef _MULTI_FRAMED_RTP_SOURCE_HH 25 | #include "MultiFramedRTPSource.hh" 26 | #endif 27 | 28 | class H261VideoRTPSource: public MultiFramedRTPSource { 29 | public: 30 | static H261VideoRTPSource* 31 | createNew(UsageEnvironment& env, Groupsock* RTPgs, 32 | unsigned char rtpPayloadFormat = 31, 33 | unsigned rtpTimestampFrequency = 90000); 34 | 35 | u_int32_t lastSpecialHeader() const {return fLastSpecialHeader;} 36 | 37 | protected: 38 | virtual ~H261VideoRTPSource(); 39 | 40 | private: 41 | H261VideoRTPSource(UsageEnvironment& env, Groupsock* RTPgs, 42 | unsigned char rtpPayloadFormat, 43 | unsigned rtpTimestampFrequency); 44 | // called only by createNew() 45 | 46 | private: 47 | // redefined virtual functions: 48 | virtual Boolean processSpecialHeader(BufferedPacket* packet, 49 | unsigned& resultSpecialHeaderSize); 50 | virtual char const* MIMEtype() const; 51 | 52 | private: 53 | u_int32_t fLastSpecialHeader; 54 | }; 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /RTSPLib/liveMedia/include/H263plusVideoFileServerMediaSubsession.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 2.1 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2013 Live Networks, Inc. All rights reserved. 18 | // A 'ServerMediaSubsession' object that creates new, unicast, "RTPSink"s 19 | // on demand, from a H.263 video file. 20 | // C++ header 21 | 22 | #ifndef _H263PLUS_VIDEO_FILE_SERVER_MEDIA_SUBSESSION_HH 23 | #define _H263PLUS_VIDEO_FILE_SERVER_MEDIA_SUBSESSION_HH 24 | 25 | #ifndef _FILE_SERVER_MEDIA_SUBSESSION_HH 26 | #include "FileServerMediaSubsession.hh" 27 | #endif 28 | 29 | class H263plusVideoFileServerMediaSubsession: public FileServerMediaSubsession{ 30 | public: 31 | static H263plusVideoFileServerMediaSubsession* 32 | createNew(UsageEnvironment& env, char const* fileName, Boolean reuseFirstSource); 33 | 34 | private: 35 | H263plusVideoFileServerMediaSubsession(UsageEnvironment& env, 36 | char const* fileName, Boolean reuseFirstSource); 37 | // called only by createNew(); 38 | virtual ~H263plusVideoFileServerMediaSubsession(); 39 | 40 | private: // redefined virtual functions 41 | virtual FramedSource* createNewStreamSource(unsigned clientSessionId, 42 | unsigned& estBitrate); 43 | virtual RTPSink* createNewRTPSink(Groupsock* rtpGroupsock, 44 | unsigned char rtpPayloadTypeIfDynamic, 45 | FramedSource* inputSource); 46 | }; 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /RTSPLib/liveMedia/include/H263plusVideoRTPSink.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 2.1 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2013 Live Networks, Inc. All rights reserved. 18 | // RTP sink for H.263+ video (RFC 4629) 19 | // C++ header 20 | 21 | #ifndef _H263_PLUS_VIDEO_RTP_SINK_HH 22 | #define _H263_PLUS_VIDEO_RTP_SINK_HH 23 | 24 | #ifndef _VIDEO_RTP_SINK_HH 25 | #include "VideoRTPSink.hh" 26 | #endif 27 | 28 | class H263plusVideoRTPSink: public VideoRTPSink { 29 | public: 30 | static H263plusVideoRTPSink* createNew(UsageEnvironment& env, Groupsock* RTPgs, 31 | unsigned char rtpPayloadFormat, 32 | u_int32_t rtpTimestampFrequency = 90000); 33 | 34 | protected: 35 | H263plusVideoRTPSink(UsageEnvironment& env, Groupsock* RTPgs, 36 | unsigned char rtpPayloadFormat, 37 | u_int32_t rtpTimestampFrequency); 38 | // called only by createNew() 39 | 40 | virtual ~H263plusVideoRTPSink(); 41 | 42 | private: // redefined virtual functions: 43 | virtual void doSpecialFrameHandling(unsigned fragmentationOffset, 44 | unsigned char* frameStart, 45 | unsigned numBytesInFrame, 46 | struct timeval framePresentationTime, 47 | unsigned numRemainingBytes); 48 | virtual 49 | Boolean frameCanAppearAfterPacketStart(unsigned char const* frameStart, 50 | unsigned numBytesInFrame) const; 51 | virtual unsigned specialHeaderSize() const; 52 | }; 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /RTSPLib/liveMedia/include/H263plusVideoRTPSource.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 2.1 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2013 Live Networks, Inc. All rights reserved. 18 | // H.263+ Video RTP Sources 19 | // C++ header 20 | 21 | #ifndef _H263_PLUS_VIDEO_RTP_SOURCE_HH 22 | #define _H263_PLUS_VIDEO_RTP_SOURCE_HH 23 | 24 | #ifndef _MULTI_FRAMED_RTP_SOURCE_HH 25 | #include "MultiFramedRTPSource.hh" 26 | #endif 27 | 28 | #define SPECIAL_HEADER_BUFFER_SIZE 1000 29 | 30 | class H263plusVideoRTPSource: public MultiFramedRTPSource { 31 | public: 32 | static H263plusVideoRTPSource* 33 | createNew(UsageEnvironment& env, Groupsock* RTPgs, 34 | unsigned char rtpPayloadFormat, 35 | unsigned rtpTimestampFrequency = 90000); 36 | 37 | // A data structure that stores copies of the special header bytes 38 | // from the most recent frame's RTP packets: 39 | unsigned char fNumSpecialHeaders; 40 | unsigned fSpecialHeaderBytesLength; 41 | unsigned char fSpecialHeaderBytes[SPECIAL_HEADER_BUFFER_SIZE]; 42 | unsigned fPacketSizes[256]; 43 | 44 | protected: 45 | virtual ~H263plusVideoRTPSource(); 46 | 47 | private: 48 | H263plusVideoRTPSource(UsageEnvironment& env, Groupsock* RTPgs, 49 | unsigned char rtpPayloadFormat, 50 | unsigned rtpTimestampFrequency); 51 | // called only by createNew() 52 | 53 | private: 54 | // redefined virtual functions: 55 | virtual Boolean processSpecialHeader(BufferedPacket* packet, 56 | unsigned& resultSpecialHeaderSize); 57 | virtual char const* MIMEtype() const; 58 | }; 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /RTSPLib/liveMedia/include/H263plusVideoStreamFramer.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 2.1 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2013 Live Networks, Inc. All rights reserved. 18 | // A filter that breaks up an H263 video elementary stream into frames. 19 | // Author Benhard Feiten 20 | 21 | #ifndef _H263PLUS_VIDEO_STREAM_FRAMER_HH 22 | #define _H263PLUS_VIDEO_STREAM_FRAMER_HH 23 | 24 | #ifndef _FRAMED_FILTER_HH 25 | #include "FramedFilter.hh" 26 | #endif 27 | 28 | 29 | class H263plusVideoStreamFramer: public FramedFilter { 30 | public: 31 | 32 | static H263plusVideoStreamFramer* createNew(UsageEnvironment& env, FramedSource* inputSource); 33 | 34 | Boolean& pictureEndMarker() { return fPictureEndMarker; } // a hack for implementing the RTP 'M' bit 35 | 36 | protected: 37 | // Constructor called only by createNew(), or by subclass constructors 38 | H263plusVideoStreamFramer(UsageEnvironment& env, 39 | FramedSource* inputSource, 40 | Boolean createParser = True); 41 | virtual ~H263plusVideoStreamFramer(); 42 | 43 | 44 | public: 45 | static void continueReadProcessing(void* clientData, 46 | unsigned char* ptr, unsigned size, 47 | struct timeval presentationTime); 48 | void continueReadProcessing(); 49 | 50 | private: 51 | virtual void doGetNextFrame(); 52 | virtual Boolean isH263plusVideoStreamFramer() const; 53 | 54 | protected: 55 | double fFrameRate; 56 | unsigned fPictureCount; // hack used to implement doGetNextFrame() ?? 57 | Boolean fPictureEndMarker; 58 | 59 | private: 60 | class H263plusVideoStreamParser* fParser; 61 | struct timeval fPresentationTimeBase; 62 | }; 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /RTSPLib/liveMedia/include/H264VideoFileSink.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 2.1 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2013 Live Networks, Inc. All rights reserved. 18 | // H.264 Video File Sinks 19 | // C++ header 20 | 21 | #ifndef _H264_VIDEO_FILE_SINK_HH 22 | #define _H264_VIDEO_FILE_SINK_HH 23 | 24 | #ifndef _FILE_SINK_HH 25 | #include "FileSink.hh" 26 | #endif 27 | 28 | class H264VideoFileSink: public FileSink { 29 | public: 30 | static H264VideoFileSink* createNew(UsageEnvironment& env, char const* fileName, 31 | char const* sPropParameterSetsStr = NULL, 32 | // An optional 'SDP format' string (comma-separated Base64-encoded) representing SPS and/or PPS NAL-units to prepend to the output 33 | unsigned bufferSize = 100000, 34 | Boolean oneFilePerFrame = False); 35 | // See "FileSink.hh" for a description of these parameters. 36 | 37 | protected: 38 | H264VideoFileSink(UsageEnvironment& env, FILE* fid, 39 | char const* sPropParameterSetsStr, 40 | unsigned bufferSize, char const* perFrameFileNamePrefix); 41 | // called only by createNew() 42 | virtual ~H264VideoFileSink(); 43 | 44 | protected: // redefined virtual functions: 45 | virtual void afterGettingFrame(unsigned frameSize, unsigned numTruncatedBytes, struct timeval presentationTime); 46 | 47 | private: 48 | char const* fSPropParameterSetsStr; 49 | Boolean fHaveWrittenFirstFrame; 50 | }; 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /RTSPLib/liveMedia/include/H264VideoStreamDiscreteFramer.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 2.1 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2013 Live Networks, Inc. All rights reserved. 18 | // A simplified version of "H264VideoStreamFramer" that takes only complete, 19 | // discrete frames (rather than an arbitrary byte stream) as input. 20 | // This avoids the parsing and data copying overhead of the full 21 | // "H264VideoStreamFramer". 22 | // C++ header 23 | 24 | #ifndef _H264_VIDEO_STREAM_DISCRETE_FRAMER_HH 25 | #define _H264_VIDEO_STREAM_DISCRETE_FRAMER_HH 26 | 27 | #ifndef _H264_VIDEO_STREAM_FRAMER_HH 28 | #include "H264VideoStreamFramer.hh" 29 | #endif 30 | 31 | class H264VideoStreamDiscreteFramer: public H264VideoStreamFramer { 32 | public: 33 | static H264VideoStreamDiscreteFramer* 34 | createNew(UsageEnvironment& env, FramedSource* inputSource); 35 | 36 | protected: 37 | H264VideoStreamDiscreteFramer(UsageEnvironment& env, 38 | FramedSource* inputSource); 39 | // called only by createNew() 40 | virtual ~H264VideoStreamDiscreteFramer(); 41 | 42 | protected: 43 | // redefined virtual functions: 44 | virtual void doGetNextFrame(); 45 | 46 | protected: 47 | static void afterGettingFrame(void* clientData, unsigned frameSize, 48 | unsigned numTruncatedBytes, 49 | struct timeval presentationTime, 50 | unsigned durationInMicroseconds); 51 | void afterGettingFrame1(unsigned frameSize, 52 | unsigned numTruncatedBytes, 53 | struct timeval presentationTime, 54 | unsigned durationInMicroseconds); 55 | }; 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /RTSPLib/liveMedia/include/JPEGVideoRTPSink.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 2.1 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2013 Live Networks, Inc. All rights reserved. 18 | // RTP sink for JPEG video (RFC 2435) 19 | // C++ header 20 | 21 | #ifndef _JPEG_VIDEO_RTP_SINK_HH 22 | #define _JPEG_VIDEO_RTP_SINK_HH 23 | 24 | #ifndef _VIDEO_RTP_SINK_HH 25 | #include "VideoRTPSink.hh" 26 | #endif 27 | 28 | class JPEGVideoRTPSink: public VideoRTPSink { 29 | public: 30 | static JPEGVideoRTPSink* createNew(UsageEnvironment& env, Groupsock* RTPgs); 31 | 32 | protected: 33 | JPEGVideoRTPSink(UsageEnvironment& env, Groupsock* RTPgs); 34 | // called only by createNew() 35 | 36 | virtual ~JPEGVideoRTPSink(); 37 | 38 | private: // redefined virtual functions: 39 | virtual Boolean sourceIsCompatibleWithUs(MediaSource& source); 40 | 41 | virtual void doSpecialFrameHandling(unsigned fragmentationOffset, 42 | unsigned char* frameStart, 43 | unsigned numBytesInFrame, 44 | struct timeval framePresentationTime, 45 | unsigned numRemainingBytes); 46 | virtual 47 | Boolean frameCanAppearAfterPacketStart(unsigned char const* frameStart, 48 | unsigned numBytesInFrame) const; 49 | virtual unsigned specialHeaderSize() const; 50 | }; 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /RTSPLib/liveMedia/include/JPEGVideoRTPSource.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 2.1 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2013 Live Networks, Inc. All rights reserved. 18 | // JPEG Video (RFC 2435) RTP Sources 19 | // C++ header 20 | 21 | #ifndef _JPEG_VIDEO_RTP_SOURCE_HH 22 | #define _JPEG_VIDEO_RTP_SOURCE_HH 23 | 24 | #ifndef _MULTI_FRAMED_RTP_SOURCE_HH 25 | #include "MultiFramedRTPSource.hh" 26 | #endif 27 | 28 | #define MAX_JPEG_HEADER_SIZE 1024 29 | 30 | class JPEGVideoRTPSource: public MultiFramedRTPSource { 31 | public: 32 | static JPEGVideoRTPSource* 33 | createNew(UsageEnvironment& env, Groupsock* RTPgs, 34 | unsigned char rtpPayloadFormat = 26, 35 | unsigned rtpPayloadFrequency = 90000, 36 | unsigned defaultWidth = 0, unsigned defaultHeight = 0); 37 | 38 | protected: 39 | virtual ~JPEGVideoRTPSource(); 40 | 41 | private: 42 | JPEGVideoRTPSource(UsageEnvironment& env, Groupsock* RTPgs, 43 | unsigned char rtpPayloadFormat, 44 | unsigned rtpTimestampFrequency, 45 | unsigned defaultWidth, unsigned defaultHeight); 46 | // called only by createNew() 47 | 48 | // Image dimensions from the SDP description, if any 49 | unsigned fDefaultWidth, fDefaultHeight; 50 | 51 | private: 52 | // redefined virtual functions: 53 | virtual Boolean processSpecialHeader(BufferedPacket* packet, 54 | unsigned& resultSpecialHeaderSize); 55 | 56 | virtual char const* MIMEtype() const; 57 | }; 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /RTSPLib/liveMedia/include/JPEGVideoSource.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 2.1 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2013 Live Networks, Inc. All rights reserved. 18 | // JPEG video sources 19 | // C++ header 20 | 21 | #ifndef _JPEG_VIDEO_SOURCE_HH 22 | #define _JPEG_VIDEO_SOURCE_HH 23 | 24 | #ifndef _FRAMED_SOURCE_HH 25 | #include "FramedSource.hh" 26 | #endif 27 | 28 | class JPEGVideoSource: public FramedSource { 29 | public: 30 | virtual u_int8_t type() = 0; 31 | virtual u_int8_t qFactor() = 0; 32 | virtual u_int8_t width() = 0; // # pixels/8 (or 0 for 2048 pixels) 33 | virtual u_int8_t height() = 0; // # pixels/8 (or 0 for 2048 pixels) 34 | 35 | virtual u_int8_t const* quantizationTables(u_int8_t& precision, 36 | u_int16_t& length); 37 | // If "qFactor()" returns a value >= 128, then this function is called 38 | // to tell us the quantization tables that are being used. 39 | // (The default implementation of this function just returns NULL.) 40 | // "precision" and "length" are as defined in RFC 2435, section 3.1.8. 41 | 42 | virtual u_int16_t restartInterval(); 43 | // If restart intervals are being used (i.e., 64 <= type() <= 127), then this function must be 44 | // redefined - by a subclass - to return a non-zero value. 45 | 46 | protected: 47 | JPEGVideoSource(UsageEnvironment& env); // abstract base class 48 | virtual ~JPEGVideoSource(); 49 | 50 | private: 51 | // redefined virtual functions: 52 | virtual Boolean isJPEGVideoSource() const; 53 | }; 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /RTSPLib/liveMedia/include/MP3ADURTPSink.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 2.1 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2013 Live Networks, Inc. All rights reserved. 18 | // RTP sink for 'ADUized' MP3 frames ("mpa-robust") 19 | // C++ header 20 | 21 | #ifndef _MP3_ADU_RTP_SINK_HH 22 | #define _MP3_ADU_RTP_SINK_HH 23 | 24 | #ifndef _AUDIO_RTP_SINK_HH 25 | #include "AudioRTPSink.hh" 26 | #endif 27 | 28 | class MP3ADURTPSink: public AudioRTPSink { 29 | public: 30 | static MP3ADURTPSink* createNew(UsageEnvironment& env, Groupsock* RTPgs, 31 | unsigned char RTPPayloadType); 32 | 33 | protected: 34 | virtual ~MP3ADURTPSink(); 35 | 36 | private: 37 | MP3ADURTPSink(UsageEnvironment& env, Groupsock* RTPgs, 38 | unsigned char RTPPayloadType); 39 | // called only by createNew() 40 | 41 | 42 | private: 43 | // Redefined virtual functions: 44 | virtual void doSpecialFrameHandling(unsigned fragmentationOffset, 45 | unsigned char* frameStart, 46 | unsigned numBytesInFrame, 47 | struct timeval framePresentationTime, 48 | unsigned numRemainingBytes); 49 | virtual unsigned specialHeaderSize() const; 50 | 51 | private: 52 | unsigned fCurADUSize; // used when fragmenting over multiple RTP packets 53 | }; 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /RTSPLib/liveMedia/include/MP3ADURTPSource.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 2.1 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2013 Live Networks, Inc. All rights reserved. 18 | // RTP source for 'ADUized' MP3 frames ("mpa-robust") 19 | // C++ header 20 | 21 | #ifndef _MP3_ADU_SOURCE_HH 22 | #define _MP3_ADU_SOURCE_HH 23 | 24 | #ifndef _MULTI_FRAMED_RTP_SOURCE_HH 25 | #include "MultiFramedRTPSource.hh" 26 | #endif 27 | 28 | class MP3ADURTPSource: public MultiFramedRTPSource { 29 | public: 30 | static MP3ADURTPSource* 31 | createNew(UsageEnvironment& env, Groupsock* RTPgs, 32 | unsigned char rtpPayloadFormat, 33 | unsigned rtpTimestampFrequency = 90000); 34 | 35 | protected: 36 | virtual ~MP3ADURTPSource(); 37 | 38 | private: 39 | MP3ADURTPSource(UsageEnvironment& env, Groupsock* RTPgs, 40 | unsigned char rtpPayloadFormat, 41 | unsigned rtpTimestampFrequency); 42 | // called only by createNew() 43 | 44 | private: 45 | // redefined virtual functions: 46 | virtual char const* MIMEtype() const; 47 | }; 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /RTSPLib/liveMedia/include/MP3ADUTranscoder.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 2.1 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2013 Live Networks, Inc. All rights reserved. 18 | // Transcoder for ADUized MP3 frames 19 | // C++ header 20 | 21 | #ifndef _MP3_ADU_TRANSCODER_HH 22 | #define _MP3_ADU_TRANSCODER_HH 23 | 24 | #ifndef _FRAMED_FILTER_HH 25 | #include "FramedFilter.hh" 26 | #endif 27 | 28 | class MP3ADUTranscoder: public FramedFilter { 29 | public: 30 | static MP3ADUTranscoder* createNew(UsageEnvironment& env, 31 | unsigned outBitrate /* in kbps */, 32 | FramedSource* inputSource); 33 | 34 | unsigned outBitrate() const { return fOutBitrate; } 35 | protected: 36 | MP3ADUTranscoder(UsageEnvironment& env, 37 | unsigned outBitrate /* in kbps */, 38 | FramedSource* inputSource); 39 | // called only by createNew() 40 | virtual ~MP3ADUTranscoder(); 41 | 42 | private: 43 | // redefined virtual functions: 44 | virtual void doGetNextFrame(); 45 | virtual void getAttributes() const; 46 | 47 | private: 48 | static void afterGettingFrame(void* clientData, 49 | unsigned numBytesRead, unsigned numTruncatedBytes, 50 | struct timeval presentationTime, 51 | unsigned durationInMicroseconds); 52 | void afterGettingFrame1(unsigned numBytesRead, unsigned numTruncatedBytes, 53 | struct timeval presentationTime, 54 | unsigned durationInMicroseconds); 55 | 56 | private: 57 | unsigned fOutBitrate; // in kbps 58 | unsigned fAvailableBytesForBackpointer; 59 | 60 | unsigned char* fOrigADU; 61 | // used to store incoming ADU prior to transcoding 62 | }; 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /RTSPLib/liveMedia/include/MP3FileSource.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 2.1 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2013 Live Networks, Inc. All rights reserved. 18 | // MP3 File Sources 19 | // C++ header 20 | 21 | #ifndef _MP3_FILE_SOURCE_HH 22 | #define _MP3_FILE_SOURCE_HH 23 | 24 | #ifndef _FRAMED_FILE_SOURCE_HH 25 | #include "FramedFileSource.hh" 26 | #endif 27 | 28 | class MP3StreamState; // forward 29 | 30 | class MP3FileSource: public FramedFileSource { 31 | public: 32 | static MP3FileSource* createNew(UsageEnvironment& env, char const* fileName); 33 | 34 | float filePlayTime() const; 35 | unsigned fileSize() const; 36 | void setPresentationTimeScale(unsigned scale); 37 | void seekWithinFile(double seekNPT, double streamDuration); 38 | // if "streamDuration" is >0.0, then we limit the stream to that duration, before treating it as EOF 39 | 40 | protected: 41 | MP3FileSource(UsageEnvironment& env, FILE* fid); 42 | // called only by createNew() 43 | 44 | virtual ~MP3FileSource(); 45 | 46 | protected: 47 | void assignStream(FILE* fid, unsigned filesize); 48 | Boolean initializeStream(); 49 | 50 | MP3StreamState* streamState() {return fStreamState;} 51 | 52 | private: 53 | // redefined virtual functions: 54 | virtual void doGetNextFrame(); 55 | virtual char const* MIMEtype() const; 56 | virtual void getAttributes() const; 57 | 58 | private: 59 | virtual Boolean doGetNextFrame1(); 60 | 61 | private: 62 | MP3StreamState* fStreamState; 63 | Boolean fHaveJustInitialized; 64 | struct timeval fFirstFramePresentationTime; // set on stream init 65 | Boolean fLimitNumBytesToStream; 66 | unsigned fNumBytesToStream; // used iff "fLimitNumBytesToStream" is True 67 | }; 68 | 69 | #endif 70 | -------------------------------------------------------------------------------- /RTSPLib/liveMedia/include/MP3Transcoder.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 2.1 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2013 Live Networks, Inc. All rights reserved. 18 | // MP3 Transcoder 19 | // C++ header 20 | 21 | #ifndef _MP3_TRANSCODER_HH 22 | #define _MP3_TRANSCODER_HH 23 | 24 | #ifndef _MP3_ADU_HH 25 | #include "MP3ADU.hh" 26 | #endif 27 | #ifndef _MP3_ADU_TRANSCODER_HH 28 | #include "MP3ADUTranscoder.hh" 29 | #endif 30 | 31 | class MP3Transcoder: public MP3FromADUSource { 32 | public: 33 | static MP3Transcoder* createNew(UsageEnvironment& env, 34 | unsigned outBitrate /* in kbps */, 35 | FramedSource* inputSource); 36 | 37 | protected: 38 | MP3Transcoder(UsageEnvironment& env, 39 | MP3ADUTranscoder* aduTranscoder); 40 | // called only by createNew() 41 | virtual ~MP3Transcoder(); 42 | }; 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /RTSPLib/liveMedia/include/MPEG1or2AudioRTPSink.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 2.1 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2013 Live Networks, Inc. All rights reserved. 18 | // RTP sink for MPEG audio (RFC 2250) 19 | // C++ header 20 | 21 | #ifndef _MPEG_1OR2_AUDIO_RTP_SINK_HH 22 | #define _MPEG_1OR2_AUDIO_RTP_SINK_HH 23 | 24 | #ifndef _AUDIO_RTP_SINK_HH 25 | #include "AudioRTPSink.hh" 26 | #endif 27 | 28 | class MPEG1or2AudioRTPSink: public AudioRTPSink { 29 | public: 30 | static MPEG1or2AudioRTPSink* createNew(UsageEnvironment& env, 31 | Groupsock* RTPgs); 32 | 33 | protected: 34 | MPEG1or2AudioRTPSink(UsageEnvironment& env, Groupsock* RTPgs); 35 | // called only by createNew() 36 | 37 | virtual ~MPEG1or2AudioRTPSink(); 38 | 39 | private: // redefined virtual functions: 40 | virtual void doSpecialFrameHandling(unsigned fragmentationOffset, 41 | unsigned char* frameStart, 42 | unsigned numBytesInFrame, 43 | struct timeval framePresentationTime, 44 | unsigned numRemainingBytes); 45 | virtual unsigned specialHeaderSize() const; 46 | }; 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /RTSPLib/liveMedia/include/MPEG1or2AudioRTPSource.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 2.1 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2013 Live Networks, Inc. All rights reserved. 18 | // MPEG-1 or MPEG-2 Audio RTP Sources 19 | // C++ header 20 | 21 | #ifndef _MPEG_1OR2_AUDIO_RTP_SOURCE_HH 22 | #define _MPEG_1OR2_AUDIO_RTP_SOURCE_HH 23 | 24 | #ifndef _MULTI_FRAMED_RTP_SOURCE_HH 25 | #include "MultiFramedRTPSource.hh" 26 | #endif 27 | 28 | class MPEG1or2AudioRTPSource: public MultiFramedRTPSource { 29 | public: 30 | static MPEG1or2AudioRTPSource* 31 | createNew(UsageEnvironment& env, Groupsock* RTPgs, 32 | unsigned char rtpPayloadFormat = 14, 33 | unsigned rtpTimestampFrequency = 90000); 34 | 35 | protected: 36 | virtual ~MPEG1or2AudioRTPSource(); 37 | 38 | private: 39 | MPEG1or2AudioRTPSource(UsageEnvironment& env, Groupsock* RTPgs, 40 | unsigned char rtpPayloadFormat, 41 | unsigned rtpTimestampFrequency); 42 | // called only by createNew() 43 | 44 | private: 45 | // redefined virtual functions: 46 | virtual Boolean processSpecialHeader(BufferedPacket* packet, 47 | unsigned& resultSpecialHeaderSize); 48 | virtual char const* MIMEtype() const; 49 | }; 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /RTSPLib/liveMedia/include/MPEG1or2VideoFileServerMediaSubsession.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 2.1 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2013 Live Networks, Inc. All rights reserved. 18 | // A 'ServerMediaSubsession' object that creates new, unicast, "RTPSink"s 19 | // on demand, from a MPEG-1 or 2 Elementary Stream video file. 20 | // C++ header 21 | 22 | #ifndef _MPEG_1OR2_VIDEO_FILE_SERVER_MEDIA_SUBSESSION_HH 23 | #define _MPEG_1OR2_VIDEO_FILE_SERVER_MEDIA_SUBSESSION_HH 24 | 25 | #ifndef _FILE_SERVER_MEDIA_SUBSESSION_HH 26 | #include "FileServerMediaSubsession.hh" 27 | #endif 28 | 29 | class MPEG1or2VideoFileServerMediaSubsession: public FileServerMediaSubsession{ 30 | public: 31 | static MPEG1or2VideoFileServerMediaSubsession* 32 | createNew(UsageEnvironment& env, char const* fileName, Boolean reuseFirstSource, 33 | Boolean iFramesOnly = False, 34 | double vshPeriod = 5.0 35 | /* how often (in seconds) to inject a Video_Sequence_Header, 36 | if one doesn't already appear in the stream */); 37 | 38 | private: 39 | MPEG1or2VideoFileServerMediaSubsession(UsageEnvironment& env, 40 | char const* fileName, 41 | Boolean reuseFirstSource, 42 | Boolean iFramesOnly, 43 | double vshPeriod); 44 | // called only by createNew(); 45 | virtual ~MPEG1or2VideoFileServerMediaSubsession(); 46 | 47 | private: // redefined virtual functions 48 | virtual FramedSource* createNewStreamSource(unsigned clientSessionId, 49 | unsigned& estBitrate); 50 | virtual RTPSink* createNewRTPSink(Groupsock* rtpGroupsock, 51 | unsigned char rtpPayloadTypeIfDynamic, 52 | FramedSource* inputSource); 53 | 54 | private: 55 | Boolean fIFramesOnly; 56 | double fVSHPeriod; 57 | }; 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /RTSPLib/liveMedia/include/MPEG1or2VideoRTPSource.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 2.1 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2013 Live Networks, Inc. All rights reserved. 18 | // MPEG-1 or MPEG-2 Video RTP Sources 19 | // C++ header 20 | 21 | #ifndef _MPEG_1OR2_VIDEO_RTP_SOURCE_HH 22 | #define _MPEG_1OR2_VIDEO_RTP_SOURCE_HH 23 | 24 | #ifndef _MULTI_FRAMED_RTP_SOURCE_HH 25 | #include "MultiFramedRTPSource.hh" 26 | #endif 27 | 28 | class MPEG1or2VideoRTPSource: public MultiFramedRTPSource { 29 | public: 30 | static MPEG1or2VideoRTPSource* 31 | createNew(UsageEnvironment& env, Groupsock* RTPgs, 32 | unsigned char rtpPayloadFormat = 32, 33 | unsigned rtpPayloadFrequency = 90000); 34 | 35 | protected: 36 | virtual ~MPEG1or2VideoRTPSource(); 37 | 38 | private: 39 | MPEG1or2VideoRTPSource(UsageEnvironment& env, Groupsock* RTPgs, 40 | unsigned char rtpPayloadFormat, 41 | unsigned rtpTimestampFrequency); 42 | // called only by createNew() 43 | 44 | private: 45 | // redefined virtual functions: 46 | virtual Boolean processSpecialHeader(BufferedPacket* packet, 47 | unsigned& resultSpecialHeaderSize); 48 | virtual Boolean packetIsUsableInJitterCalculation(unsigned char* packet, 49 | unsigned packetSize); 50 | virtual char const* MIMEtype() const; 51 | }; 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /RTSPLib/liveMedia/include/MPEG1or2VideoStreamFramer.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 2.1 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2013 Live Networks, Inc. All rights reserved. 18 | // A filter that breaks up an MPEG 1 or 2 video elementary stream into 19 | // frames for: Video_Sequence_Header, GOP_Header, Picture_Header 20 | // C++ header 21 | 22 | #ifndef _MPEG_1OR2_VIDEO_STREAM_FRAMER_HH 23 | #define _MPEG_1OR2_VIDEO_STREAM_FRAMER_HH 24 | 25 | #ifndef _MPEG_VIDEO_STREAM_FRAMER_HH 26 | #include "MPEGVideoStreamFramer.hh" 27 | #endif 28 | 29 | class MPEG1or2VideoStreamFramer: public MPEGVideoStreamFramer { 30 | public: 31 | static MPEG1or2VideoStreamFramer* 32 | createNew(UsageEnvironment& env, FramedSource* inputSource, 33 | Boolean iFramesOnly = False, 34 | double vshPeriod = 5.0 35 | /* how often (in seconds) to inject a Video_Sequence_Header, 36 | if one doesn't already appear in the stream */); 37 | 38 | protected: 39 | MPEG1or2VideoStreamFramer(UsageEnvironment& env, 40 | FramedSource* inputSource, 41 | Boolean iFramesOnly, double vshPeriod, 42 | Boolean createParser = True); 43 | // called only by createNew(), or by subclass constructors 44 | virtual ~MPEG1or2VideoStreamFramer(); 45 | 46 | private: 47 | // redefined virtual functions: 48 | virtual Boolean isMPEG1or2VideoStreamFramer() const; 49 | 50 | private: 51 | double getCurrentPTS() const; 52 | 53 | friend class MPEG1or2VideoStreamParser; // hack 54 | }; 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /RTSPLib/liveMedia/include/MPEG2TransportStreamFromESSource.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 2.1 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2013 Live Networks, Inc. All rights reserved. 18 | // A filter for converting one or more MPEG Elementary Streams 19 | // to a MPEG-2 Transport Stream 20 | // C++ header 21 | 22 | #ifndef _MPEG2_TRANSPORT_STREAM_FROM_ES_SOURCE_HH 23 | #define _MPEG2_TRANSPORT_STREAM_FROM_ES_SOURCE_HH 24 | 25 | #ifndef _MPEG2_TRANSPORT_STREAM_MULTIPLEXOR_HH 26 | #include "MPEG2TransportStreamMultiplexor.hh" 27 | #endif 28 | 29 | class MPEG2TransportStreamFromESSource: public MPEG2TransportStreamMultiplexor { 30 | public: 31 | static MPEG2TransportStreamFromESSource* createNew(UsageEnvironment& env); 32 | 33 | void addNewVideoSource(FramedSource* inputSource, int mpegVersion); 34 | // Note: For MPEG-4 video, set "mpegVersion" to 4; for H.264 video, set "mpegVersion" to 5. 35 | void addNewAudioSource(FramedSource* inputSource, int mpegVersion); 36 | 37 | protected: 38 | MPEG2TransportStreamFromESSource(UsageEnvironment& env); 39 | // called only by createNew() 40 | virtual ~MPEG2TransportStreamFromESSource(); 41 | 42 | void addNewInputSource(FramedSource* inputSource, 43 | u_int8_t streamId, int mpegVersion); 44 | // used to implement addNew*Source() above 45 | 46 | private: 47 | // Redefined virtual functions: 48 | virtual void doStopGettingFrames(); 49 | virtual void awaitNewBuffer(unsigned char* oldBuffer); 50 | 51 | private: 52 | friend class InputESSourceRecord; 53 | class InputESSourceRecord* fInputSources; 54 | unsigned fVideoSourceCounter, fAudioSourceCounter; 55 | }; 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /RTSPLib/liveMedia/include/MPEG2TransportStreamFromPESSource.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 2.1 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2013 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 | 31 | class MPEG2TransportStreamFromPESSource: public MPEG2TransportStreamMultiplexor { 32 | public: 33 | static MPEG2TransportStreamFromPESSource* 34 | createNew(UsageEnvironment& env, MPEG1or2DemuxedElementaryStream* inputSource); 35 | 36 | protected: 37 | MPEG2TransportStreamFromPESSource(UsageEnvironment& env, 38 | MPEG1or2DemuxedElementaryStream* inputSource); 39 | // called only by createNew() 40 | virtual ~MPEG2TransportStreamFromPESSource(); 41 | 42 | private: 43 | // Redefined virtual functions: 44 | virtual void doStopGettingFrames(); 45 | virtual void awaitNewBuffer(unsigned char* oldBuffer); 46 | 47 | private: 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 | 57 | private: 58 | MPEG1or2DemuxedElementaryStream* fInputSource; 59 | unsigned char* fInputBuffer; 60 | }; 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /RTSPLib/liveMedia/include/MPEG2TransportUDPServerMediaSubsession.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 2.1 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2013 Live Networks, Inc. All rights reserved. 18 | // A 'ServerMediaSubsession' object that creates new, unicast, "RTPSink"s 19 | // on demand, from an incoming UDP (or RTP/UDP) MPEG-2 Transport Stream 20 | // C++ header 21 | 22 | #ifndef _MPEG2_TRANSPORT_UDP_SERVER_MEDIA_SUBSESSION_HH 23 | #define _MPEG2_TRANSPORT_UDP_SERVER_MEDIA_SUBSESSION_HH 24 | 25 | #ifndef _ON_DEMAND_SERVER_MEDIA_SUBSESSION_HH 26 | #include "OnDemandServerMediaSubsession.hh" 27 | #endif 28 | 29 | class MPEG2TransportUDPServerMediaSubsession: public OnDemandServerMediaSubsession { 30 | public: 31 | static MPEG2TransportUDPServerMediaSubsession* 32 | createNew(UsageEnvironment& env, 33 | char const* inputAddressStr, // An IP multicast address, or use "0.0.0.0" or NULL for unicast input 34 | Port const& inputPort, 35 | Boolean inputStreamIsRawUDP = False); // otherwise (default) the input stream is RTP/UDP 36 | protected: 37 | MPEG2TransportUDPServerMediaSubsession(UsageEnvironment& env, 38 | char const* inputAddressStr, Port const& inputPort, Boolean inputStreamIsRawUDP); 39 | // called only by createNew(); 40 | virtual ~MPEG2TransportUDPServerMediaSubsession(); 41 | 42 | protected: // redefined virtual functions 43 | virtual FramedSource* createNewStreamSource(unsigned clientSessionId, 44 | unsigned& estBitrate); 45 | virtual RTPSink* createNewRTPSink(Groupsock* rtpGroupsock, 46 | unsigned char rtpPayloadTypeIfDynamic, 47 | FramedSource* inputSource); 48 | protected: 49 | char const* fInputAddressStr; 50 | Port fInputPort; 51 | Groupsock* fInputGroupsock; 52 | Boolean fInputStreamIsRawUDP; 53 | }; 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /RTSPLib/liveMedia/include/MPEG4ESVideoRTPSource.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 2.1 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2013 Live Networks, Inc. All rights reserved. 18 | // MP4V-ES video RTP stream sources 19 | // C++ header 20 | 21 | #ifndef _MPEG4_ES_VIDEO_RTP_SOURCE_HH 22 | #define _MPEG4_ES_VIDEO_RTP_SOURCE_HH 23 | 24 | #ifndef _MULTI_FRAMED_RTP_SOURCE_HH 25 | #include "MultiFramedRTPSource.hh" 26 | #endif 27 | 28 | class MPEG4ESVideoRTPSource: public MultiFramedRTPSource { 29 | public: 30 | static MPEG4ESVideoRTPSource* 31 | createNew(UsageEnvironment& env, Groupsock* RTPgs, 32 | unsigned char rtpPayloadFormat, 33 | unsigned rtpTimestampFrequency); 34 | 35 | protected: 36 | virtual ~MPEG4ESVideoRTPSource(); 37 | 38 | private: 39 | MPEG4ESVideoRTPSource(UsageEnvironment& env, Groupsock* RTPgs, 40 | unsigned char rtpPayloadFormat, 41 | unsigned rtpTimestampFrequency); 42 | // called only by createNew() 43 | 44 | private: 45 | // redefined virtual functions: 46 | virtual Boolean processSpecialHeader(BufferedPacket* packet, 47 | unsigned& resultSpecialHeaderSize); 48 | virtual char const* MIMEtype() const; 49 | }; 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /RTSPLib/liveMedia/include/MediaSource.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 2.1 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2013 Live Networks, Inc. All rights reserved. 18 | // Media Sources 19 | // C++ header 20 | 21 | #ifndef _MEDIA_SOURCE_HH 22 | #define _MEDIA_SOURCE_HH 23 | 24 | #ifndef _MEDIA_HH 25 | #include "Media.hh" 26 | #endif 27 | 28 | class MediaSource: public Medium { 29 | public: 30 | static Boolean lookupByName(UsageEnvironment& env, char const* sourceName, 31 | MediaSource*& resultSource); 32 | virtual void getAttributes() const; 33 | // attributes are returned in "env's" 'result message' 34 | 35 | // The MIME type of this source: 36 | virtual char const* MIMEtype() const; 37 | 38 | // Test for specific types of source: 39 | virtual Boolean isFramedSource() const; 40 | virtual Boolean isRTPSource() const; 41 | virtual Boolean isMPEG1or2VideoStreamFramer() const; 42 | virtual Boolean isMPEG4VideoStreamFramer() const; 43 | virtual Boolean isH264VideoStreamFramer() const; 44 | virtual Boolean isDVVideoStreamFramer() const; 45 | virtual Boolean isJPEGVideoSource() const; 46 | virtual Boolean isAMRAudioSource() const; 47 | 48 | protected: 49 | MediaSource(UsageEnvironment& env); // abstract base class 50 | virtual ~MediaSource(); 51 | 52 | private: 53 | // redefined virtual functions: 54 | virtual Boolean isSource() const; 55 | }; 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /RTSPLib/liveMedia/include/OutputFile.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 2.1 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2013 Live Networks, Inc. All rights reserved. 18 | // Common routines for opening/closing named output files 19 | // C++ header 20 | 21 | #ifndef _OUTPUT_FILE_HH 22 | #define _OUTPUT_FILE_HH 23 | 24 | #include 25 | #include 26 | 27 | FILE* OpenOutputFile(UsageEnvironment& env, char const* fileName); 28 | 29 | void CloseOutputFile(FILE* fid); 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /RTSPLib/liveMedia/include/QCELPAudioRTPSource.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 2.1 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2013 Live Networks, Inc. All rights reserved. 18 | // Qualcomm "PureVoice" (aka. "QCELP") Audio RTP Sources 19 | // C++ header 20 | 21 | #ifndef _QCELP_AUDIO_RTP_SOURCE_HH 22 | #define _QCELP_AUDIO_RTP_SOURCE_HH 23 | 24 | #ifndef _RTP_SOURCE_HH 25 | #include "RTPSource.hh" 26 | #endif 27 | 28 | class QCELPAudioRTPSource { 29 | public: 30 | static FramedSource* createNew(UsageEnvironment& env, 31 | Groupsock* RTPgs, 32 | RTPSource*& resultRTPSource, 33 | unsigned char rtpPayloadFormat = 12, 34 | unsigned rtpTimestampFrequency = 8000); 35 | // This returns a source to read from, but "resultRTPSource" will 36 | // point to RTP-related state. 37 | }; 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /RTSPLib/liveMedia/include/TextRTPSink.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 2.1 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2013 Live Networks, Inc. All rights reserved. 18 | // A generic RTP sink for text codecs (abstract base class) 19 | // C++ header 20 | 21 | #ifndef _TEXT_RTP_SINK_HH 22 | #define _TEXT_RTP_SINK_HH 23 | 24 | #ifndef _MULTI_FRAMED_RTP_SINK_HH 25 | #include "MultiFramedRTPSink.hh" 26 | #endif 27 | 28 | class TextRTPSink: public MultiFramedRTPSink { 29 | protected: 30 | TextRTPSink(UsageEnvironment& env, 31 | Groupsock* rtpgs, unsigned char rtpPayloadType, 32 | unsigned rtpTimestampFrequency, 33 | char const* rtpPayloadFormatName); 34 | // (we're an abstract base class) 35 | virtual ~TextRTPSink(); 36 | 37 | private: // redefined virtual functions: 38 | virtual char const* sdpMediaType() const; 39 | }; 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /RTSPLib/liveMedia/include/VP8VideoRTPSink.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 2.1 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2013 Live Networks, Inc. All rights reserved. 18 | // RTP sink for VP8 video 19 | // C++ header 20 | 21 | #ifndef _VP8_VIDEO_RTP_SINK_HH 22 | #define _VP8_VIDEO_RTP_SINK_HH 23 | 24 | #ifndef _VIDEO_RTP_SINK_HH 25 | #include "VideoRTPSink.hh" 26 | #endif 27 | 28 | class VP8VideoRTPSink: public VideoRTPSink { 29 | public: 30 | static VP8VideoRTPSink* createNew(UsageEnvironment& env, Groupsock* RTPgs, unsigned char rtpPayloadFormat); 31 | 32 | protected: 33 | VP8VideoRTPSink(UsageEnvironment& env, Groupsock* RTPgs, unsigned char rtpPayloadFormat); 34 | // called only by createNew() 35 | 36 | virtual ~VP8VideoRTPSink(); 37 | 38 | private: // redefined virtual functions: 39 | virtual void doSpecialFrameHandling(unsigned fragmentationOffset, 40 | unsigned char* frameStart, 41 | unsigned numBytesInFrame, 42 | struct timeval framePresentationTime, 43 | unsigned numRemainingBytes); 44 | virtual 45 | Boolean frameCanAppearAfterPacketStart(unsigned char const* frameStart, 46 | unsigned numBytesInFrame) const; 47 | virtual unsigned specialHeaderSize() const; 48 | }; 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /RTSPLib/liveMedia/include/VP8VideoRTPSource.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 2.1 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2013 Live Networks, Inc. All rights reserved. 18 | // VP8 Video RTP Sources 19 | // C++ header 20 | 21 | #ifndef _VP8_VIDEO_RTP_SOURCE_HH 22 | #define _VP8_VIDEO_RTP_SOURCE_HH 23 | 24 | #ifndef _MULTI_FRAMED_RTP_SOURCE_HH 25 | #include "MultiFramedRTPSource.hh" 26 | #endif 27 | 28 | class VP8VideoRTPSource: public MultiFramedRTPSource { 29 | public: 30 | static VP8VideoRTPSource* 31 | createNew(UsageEnvironment& env, Groupsock* RTPgs, 32 | unsigned char rtpPayloadFormat, 33 | unsigned rtpTimestampFrequency = 90000); 34 | 35 | protected: 36 | VP8VideoRTPSource(UsageEnvironment& env, Groupsock* RTPgs, 37 | unsigned char rtpPayloadFormat, 38 | unsigned rtpTimestampFrequency); 39 | // called only by createNew() 40 | 41 | virtual ~VP8VideoRTPSource(); 42 | 43 | protected: 44 | // redefined virtual functions: 45 | virtual Boolean processSpecialHeader(BufferedPacket* packet, 46 | unsigned& resultSpecialHeaderSize); 47 | virtual char const* MIMEtype() const; 48 | }; 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /RTSPLib/liveMedia/include/VideoRTPSink.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 2.1 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2013 Live Networks, Inc. All rights reserved. 18 | // A generic RTP sink for video codecs (abstract base class) 19 | // C++ header 20 | 21 | #ifndef _VIDEO_RTP_SINK_HH 22 | #define _VIDEO_RTP_SINK_HH 23 | 24 | #ifndef _MULTI_FRAMED_RTP_SINK_HH 25 | #include "MultiFramedRTPSink.hh" 26 | #endif 27 | 28 | class VideoRTPSink: public MultiFramedRTPSink { 29 | protected: 30 | VideoRTPSink(UsageEnvironment& env, 31 | Groupsock* rtpgs, unsigned char rtpPayloadType, 32 | unsigned rtpTimestampFrequency, 33 | char const* rtpPayloadFormatName); 34 | // (we're an abstract base class) 35 | virtual ~VideoRTPSink(); 36 | 37 | private: // redefined virtual functions: 38 | virtual char const* sdpMediaType() const; 39 | }; 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /RTSPLib/liveMedia/include/VorbisAudioRTPSource.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 2.1 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2013 Live Networks, Inc. All rights reserved. 18 | // Vorbis Audio RTP Sources 19 | // C++ header 20 | 21 | #ifndef _VORBIS_AUDIO_RTP_SOURCE_HH 22 | #define _VORBIS_AUDIO_RTP_SOURCE_HH 23 | 24 | #ifndef _MULTI_FRAMED_RTP_SOURCE_HH 25 | #include "MultiFramedRTPSource.hh" 26 | #endif 27 | 28 | class VorbisAudioRTPSource: public MultiFramedRTPSource { 29 | public: 30 | static VorbisAudioRTPSource* 31 | createNew(UsageEnvironment& env, Groupsock* RTPgs, 32 | unsigned char rtpPayloadFormat, 33 | unsigned rtpTimestampFrequency); 34 | 35 | u_int32_t curPacketIdent() const { return fCurPacketIdent; } // The current "Ident" field; only the low-order 24 bits are used 36 | 37 | protected: 38 | VorbisAudioRTPSource(UsageEnvironment& env, Groupsock* RTPgs, 39 | unsigned char rtpPayloadFormat, 40 | unsigned rtpTimestampFrequency); 41 | // called only by createNew() 42 | 43 | virtual ~VorbisAudioRTPSource(); 44 | 45 | protected: 46 | // redefined virtual functions: 47 | virtual Boolean processSpecialHeader(BufferedPacket* packet, 48 | unsigned& resultSpecialHeaderSize); 49 | virtual char const* MIMEtype() const; 50 | 51 | private: 52 | u_int32_t fCurPacketIdent; // only the low-order 24 bits are used 53 | }; 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /RTSPLib/liveMedia/include/liveMedia_version.hh: -------------------------------------------------------------------------------- 1 | // Version information for the "liveMedia" library 2 | // Copyright (c) 1996-2013 Live Networks, Inc. All rights reserved. 3 | 4 | #ifndef _LIVEMEDIA_VERSION_HH 5 | #define _LIVEMEDIA_VERSION_HH 6 | 7 | #define LIVEMEDIA_LIBRARY_VERSION_STRING "2013.09.11" 8 | #define LIVEMEDIA_LIBRARY_VERSION_INT 1378857600 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /RTSPLib/liveMedia/our_md5.h: -------------------------------------------------------------------------------- 1 | /* Because MD5 may not be implemented (at least, with the same 2 | * interface) on all systems, we have our own copy here. 3 | */ 4 | 5 | /* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All 6 | rights reserved. 7 | 8 | License to copy and use this software is granted provided that it 9 | is identified as the "RSA Data Security, Inc. MD5 Message-Digest 10 | Algorithm" in all material mentioning or referencing this software 11 | or this function. 12 | 13 | License is also granted to make and use derivative works provided 14 | that such works are identified as "derived from the RSA Data 15 | Security, Inc. MD5 Message-Digest Algorithm" in all material 16 | mentioning or referencing the derived work. 17 | 18 | RSA Data Security, Inc. makes no representations concerning either 19 | the merchantability of this software or the suitability of this 20 | software for any particular purpose. It is provided "as is" 21 | without express or implied warranty of any kind. 22 | 23 | These notices must be retained in any copies of any part of this 24 | documentation and/or software. 25 | */ 26 | 27 | #ifndef _SYS_MD5_H_ 28 | #define _SYS_MD5_H_ 29 | 30 | typedef unsigned UNSIGNED32; 31 | 32 | /* Definitions of _ANSI_ARGS and EXTERN that will work in either 33 | C or C++ code: 34 | */ 35 | #undef _ANSI_ARGS_ 36 | #if ((defined(__STDC__) || defined(SABER)) && !defined(NO_PROTOTYPE)) || defined(__cplusplus) || defined(USE_PROTOTYPE) 37 | # define _ANSI_ARGS_(x) x 38 | #else 39 | # define _ANSI_ARGS_(x) () 40 | #endif 41 | #ifdef __cplusplus 42 | # define EXTERN extern "C" 43 | #else 44 | # define EXTERN extern 45 | #endif 46 | 47 | /* MD5 context. */ 48 | typedef struct MD5Context { 49 | UNSIGNED32 state[4]; /* state (ABCD) */ 50 | UNSIGNED32 count[2]; /* number of bits, modulo 2^64 (lsb first) */ 51 | unsigned char buffer[64]; /* input buffer */ 52 | } MD5_CTX; 53 | 54 | EXTERN void our_MD5Init (MD5_CTX *); 55 | EXTERN void ourMD5Update (MD5_CTX *, const unsigned char *, unsigned int); 56 | EXTERN void our_MD5Pad (MD5_CTX *); 57 | EXTERN void our_MD5Final (unsigned char [16], MD5_CTX *); 58 | EXTERN char * our_MD5End(MD5_CTX *, char *); 59 | EXTERN char * our_MD5File(const char *, char *); 60 | EXTERN char * our_MD5Data(const unsigned char *, unsigned int, char *); 61 | #endif /* _SYS_MD5_H_ */ 62 | -------------------------------------------------------------------------------- /RTSPLib/liveMedia/our_md5hl.c: -------------------------------------------------------------------------------- 1 | #define LENGTH 16 2 | /* md5hl.c 3 | * ---------------------------------------------------------------------------- 4 | * "THE BEER-WARE LICENSE" (Revision 42): 5 | * wrote this file. As long as you retain this notice you 6 | * can do whatever you want with this stuff. If we meet some day, and you think 7 | * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp 8 | * ---------------------------------------------------------------------------- 9 | */ 10 | 11 | #include 12 | #include 13 | #include "our_md5.h" 14 | #include "NetCommon.h" 15 | 16 | #ifndef BUFSIZ //pocket pc 17 | #define BUFSIZ 255 18 | #endif 19 | 20 | 21 | char * 22 | our_MD5End(MD5_CTX *ctx, char *buf) 23 | { 24 | int i; 25 | unsigned char digest[LENGTH]; 26 | static const char hex[]="0123456789abcdef"; 27 | 28 | if (!buf) 29 | buf = (char*)malloc(2*LENGTH + 1); 30 | if (!buf) 31 | return 0; 32 | our_MD5Final(digest, ctx); 33 | for (i = 0; i < LENGTH; i++) { 34 | buf[i+i] = hex[digest[i] >> 4]; 35 | buf[i+i+1] = hex[digest[i] & 0x0f]; 36 | } 37 | buf[i+i] = '\0'; 38 | return buf; 39 | } 40 | 41 | char * 42 | our_MD5File(const char *filename, char *buf) 43 | { 44 | unsigned char buffer[BUFSIZ]; 45 | MD5_CTX ctx; 46 | int i; 47 | FILE* f; 48 | 49 | our_MD5Init(&ctx); 50 | f = fopen(filename, "r"); 51 | if (f == NULL) return 0; 52 | while ((i = fread(buffer,1,sizeof buffer,f)) > 0) { 53 | ourMD5Update(&ctx,buffer,i); 54 | } 55 | fclose(f); 56 | if (i < 0) return 0; 57 | return our_MD5End(&ctx, buf); 58 | } 59 | 60 | char * 61 | our_MD5Data (const unsigned char *data, unsigned int len, char *buf) 62 | { 63 | MD5_CTX ctx; 64 | 65 | our_MD5Init(&ctx); 66 | ourMD5Update(&ctx,data,len); 67 | return our_MD5End(&ctx, buf); 68 | } 69 | -------------------------------------------------------------------------------- /jrtplib-3.9.1/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | include $(CLEAR_VARS) 4 | 5 | LOCAL_C_INCLUDES += external/stlport/stlport bionic 6 | 7 | LOCAL_MODULE_TAGS := optional 8 | 9 | LOCAL_SRC_FILES := \ 10 | $(subst $(LOCAL_PATH)/,,$(wildcard $(LOCAL_PATH)/*.c*)) \ 11 | $(subst $(LOCAL_PATH)/,,$(wildcard $(LOCAL_PATH)/extratransmitters/*.c*)) 12 | 13 | LOCAL_MODULE:= libjrtplib 14 | 15 | LOCAL_SHARED_LIBRARIES := libjthread libstlport 16 | 17 | LOCAL_PRELINK_MODULE:= false 18 | 19 | include $(BUILD_SHARED_LIBRARY) 20 | -------------------------------------------------------------------------------- /jrtplib-3.9.1/errcodecommand: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | for i in `cat rtperrors.h | cut -f 2 -d " " | cut -f 1 |grep -e "^ERR"`; do echo $i ; BLA=`grep $i *.cpp *.h|cut -f 1 -d ":"|sort|uniq`; if [ "BLA$BLA" != BLA ] ; then for j in $BLA ; do if [ $j != "rtperrors.h" ] ; then echo -e "\t$j" ; fi ; done ; fi ;done 3 | -------------------------------------------------------------------------------- /jrtplib-3.9.1/rtcppacket.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | This file is a part of JRTPLIB 4 | Copyright (c) 1999-2011 Jori Liesenborgs 5 | 6 | Contact: jori.liesenborgs@gmail.com 7 | 8 | This library was developed at the Expertise Centre for Digital Media 9 | (http://www.edm.uhasselt.be), a research center of the Hasselt University 10 | (http://www.uhasselt.be). The library is based upon work done for 11 | my thesis at the School for Knowledge Technology (Belgium/The Netherlands). 12 | 13 | Permission is hereby granted, free of charge, to any person obtaining a 14 | copy of this software and associated documentation files (the "Software"), 15 | to deal in the Software without restriction, including without limitation 16 | the rights to use, copy, modify, merge, publish, distribute, sublicense, 17 | and/or sell copies of the Software, and to permit persons to whom the 18 | Software is furnished to do so, subject to the following conditions: 19 | 20 | The above copyright notice and this permission notice shall be included 21 | in all copies or substantial portions of the Software. 22 | 23 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 24 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 25 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 26 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 27 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 28 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 29 | IN THE SOFTWARE. 30 | 31 | */ 32 | 33 | #include "rtcppacket.h" 34 | #ifdef RTPDEBUG 35 | #include 36 | #endif // RTPDEBUG 37 | 38 | #include "rtpdebug.h" 39 | 40 | #ifdef RTPDEBUG 41 | 42 | namespace jrtplib 43 | { 44 | 45 | void RTCPPacket::Dump() 46 | { 47 | switch(packettype) 48 | { 49 | case SR: 50 | std::cout << "RTCP Sender Report "; 51 | break; 52 | case RR: 53 | std::cout << "RTCP Receiver Report "; 54 | break; 55 | case SDES: 56 | std::cout << "RTCP Source Description "; 57 | break; 58 | case APP: 59 | std::cout << "RTCP APP Packet "; 60 | break; 61 | case BYE: 62 | std::cout << "RTCP Bye Packet "; 63 | break; 64 | case Unknown: 65 | std::cout << "Unknown RTCP Packet "; 66 | break; 67 | default: 68 | std::cout << "ERROR: Invalid packet type!" << std::endl; 69 | } 70 | std::cout << "Length: " << datalen; 71 | std::cout << std::endl; 72 | } 73 | 74 | } // end namespace 75 | 76 | #endif // RTPDEBUG 77 | -------------------------------------------------------------------------------- /jrtplib-3.9.1/rtpconfig.h.in: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | This file is a part of JRTPLIB 4 | Copyright (c) 1999-2011 Jori Liesenborgs 5 | 6 | Contact: jori.liesenborgs@gmail.com 7 | 8 | This library was developed at the Expertise Centre for Digital Media 9 | (http://www.edm.uhasselt.be), a research center of the Hasselt University 10 | (http://www.uhasselt.be). The library is based upon work done for 11 | my thesis at the School for Knowledge Technology (Belgium/The Netherlands). 12 | 13 | Permission is hereby granted, free of charge, to any person obtaining a 14 | copy of this software and associated documentation files (the "Software"), 15 | to deal in the Software without restriction, including without limitation 16 | the rights to use, copy, modify, merge, publish, distribute, sublicense, 17 | and/or sell copies of the Software, and to permit persons to whom the 18 | Software is furnished to do so, subject to the following conditions: 19 | 20 | The above copyright notice and this permission notice shall be included 21 | in all copies or substantial portions of the Software. 22 | 23 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 24 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 25 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 26 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 27 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 28 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 29 | IN THE SOFTWARE. 30 | 31 | */ 32 | 33 | #ifndef RTPCONFIG_UNIX_H 34 | 35 | #define RTPCONFIG_UNIX_H 36 | 37 | #define JRTPLIB_IMPORT ${JRTPLIB_IMPORT} 38 | #define JRTPLIB_EXPORT ${JRTPLIB_EXPORT} 39 | #ifdef JRTPLIB_COMPILING 40 | #define JRTPLIB_IMPORTEXPORT JRTPLIB_EXPORT 41 | #else 42 | #define JRTPLIB_IMPORTEXPORT JRTPLIB_IMPORT 43 | #endif // JRTPLIB_COMPILING 44 | 45 | ${RTP_HAVE_SYS_FILIO} 46 | 47 | ${RTP_HAVE_SYS_SOCKIO} 48 | 49 | ${RTP_ENDIAN} 50 | 51 | ${RTP_SOCKLENTYPE_UINT} 52 | 53 | ${RTP_HAVE_SOCKADDR_LEN} 54 | 55 | ${RTP_SUPPORT_IPV4MULTICAST} 56 | 57 | ${RTP_SUPPORT_THREAD} 58 | 59 | ${RTP_SUPPORT_SDESPRIV} 60 | 61 | ${RTP_SUPPORT_PROBATION} 62 | 63 | ${RTP_SUPPORT_GETLOGINR} 64 | 65 | ${RTP_SUPPORT_IPV6} 66 | 67 | ${RTP_SUPPORT_IPV6MULTICAST} 68 | 69 | ${RTP_SUPPORT_IFADDRS} 70 | 71 | ${RTP_SUPPORT_SENDAPP} 72 | 73 | ${RTP_SUPPORT_MEMORYMANAGEMENT} 74 | 75 | ${RTP_SUPPORT_RTCPUNKNOWN} 76 | 77 | #endif // RTPCONFIG_UNIX_H 78 | 79 | -------------------------------------------------------------------------------- /jrtplib-3.9.1/rtpdebug.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | This file is a part of JRTPLIB 4 | Copyright (c) 1999-2011 Jori Liesenborgs 5 | 6 | Contact: jori.liesenborgs@gmail.com 7 | 8 | This library was developed at the Expertise Centre for Digital Media 9 | (http://www.edm.uhasselt.be), a research center of the Hasselt University 10 | (http://www.uhasselt.be). The library is based upon work done for 11 | my thesis at the School for Knowledge Technology (Belgium/The Netherlands). 12 | 13 | Permission is hereby granted, free of charge, to any person obtaining a 14 | copy of this software and associated documentation files (the "Software"), 15 | to deal in the Software without restriction, including without limitation 16 | the rights to use, copy, modify, merge, publish, distribute, sublicense, 17 | and/or sell copies of the Software, and to permit persons to whom the 18 | Software is furnished to do so, subject to the following conditions: 19 | 20 | The above copyright notice and this permission notice shall be included 21 | in all copies or substantial portions of the Software. 22 | 23 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 24 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 25 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 26 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 27 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 28 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 29 | IN THE SOFTWARE. 30 | 31 | */ 32 | 33 | #ifndef RTPDEBUG_H 34 | 35 | #define RTPDEBUG_H 36 | 37 | #include "rtpconfig.h" 38 | 39 | #ifdef RTPDEBUG 40 | #include "rtptypes.h" 41 | 42 | void *operator new(size_t s,char filename[],int line); 43 | #if ! (defined(WIN32) || defined(_WIN32_WCE)) 44 | void *operator new[](size_t s,char filename[],int line); 45 | #define new new (__FILE__,__LINE__) 46 | #else 47 | #define new new (__FILE__,__LINE__) 48 | #endif // WIN32 49 | #endif // RTPDEBUG 50 | 51 | #endif // RTPDEBUG_H 52 | 53 | -------------------------------------------------------------------------------- /jrtplib-3.9.1/rtplibraryversion.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | This file is a part of JRTPLIB 4 | Copyright (c) 1999-2011 Jori Liesenborgs 5 | 6 | Contact: jori.liesenborgs@gmail.com 7 | 8 | This library was developed at the Expertise Centre for Digital Media 9 | (http://www.edm.uhasselt.be), a research center of the Hasselt University 10 | (http://www.uhasselt.be). The library is based upon work done for 11 | my thesis at the School for Knowledge Technology (Belgium/The Netherlands). 12 | 13 | Permission is hereby granted, free of charge, to any person obtaining a 14 | copy of this software and associated documentation files (the "Software"), 15 | to deal in the Software without restriction, including without limitation 16 | the rights to use, copy, modify, merge, publish, distribute, sublicense, 17 | and/or sell copies of the Software, and to permit persons to whom the 18 | Software is furnished to do so, subject to the following conditions: 19 | 20 | The above copyright notice and this permission notice shall be included 21 | in all copies or substantial portions of the Software. 22 | 23 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 24 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 25 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 26 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 27 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 28 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 29 | IN THE SOFTWARE. 30 | 31 | */ 32 | 33 | #include "rtplibraryversion.h" 34 | #include "rtpdefines.h" 35 | #include 36 | 37 | namespace jrtplib 38 | { 39 | 40 | RTPLibraryVersion RTPLibraryVersion::GetVersion() 41 | { 42 | return RTPLibraryVersion(3,9,1); 43 | } 44 | 45 | std::string RTPLibraryVersion::GetVersionString() const 46 | { 47 | char str[16]; 48 | 49 | RTP_SNPRINTF(str,16,"%d.%d.%d",majornr,minornr,debugnr); 50 | 51 | return std::string(str); 52 | } 53 | 54 | } // end namespace 55 | 56 | -------------------------------------------------------------------------------- /jrtplib-3.9.1/rtprandomrands.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | This file is a part of JRTPLIB 4 | Copyright (c) 1999-2011 Jori Liesenborgs 5 | 6 | Contact: jori.liesenborgs@gmail.com 7 | 8 | This library was developed at the Expertise Centre for Digital Media 9 | (http://www.edm.uhasselt.be), a research center of the Hasselt University 10 | (http://www.uhasselt.be). The library is based upon work done for 11 | my thesis at the School for Knowledge Technology (Belgium/The Netherlands). 12 | 13 | Permission is hereby granted, free of charge, to any person obtaining a 14 | copy of this software and associated documentation files (the "Software"), 15 | to deal in the Software without restriction, including without limitation 16 | the rights to use, copy, modify, merge, publish, distribute, sublicense, 17 | and/or sell copies of the Software, and to permit persons to whom the 18 | Software is furnished to do so, subject to the following conditions: 19 | 20 | The above copyright notice and this permission notice shall be included 21 | in all copies or substantial portions of the Software. 22 | 23 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 24 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 25 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 26 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 27 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 28 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 29 | IN THE SOFTWARE. 30 | 31 | */ 32 | 33 | /** 34 | * \file rtprandomrands.h 35 | */ 36 | 37 | #ifndef RTPRANDOMRANDS_H 38 | 39 | #define RTPRANDOMRANDS_H 40 | 41 | #include "rtpconfig.h" 42 | #include "rtprandom.h" 43 | 44 | namespace jrtplib 45 | { 46 | 47 | /** A random number generator which tries to use the \c rand_s function on the 48 | * Win32 platform. 49 | */ 50 | class JRTPLIB_IMPORTEXPORT RTPRandomRandS : public RTPRandom 51 | { 52 | public: 53 | RTPRandomRandS(); 54 | ~RTPRandomRandS(); 55 | 56 | /** Initialize the random number generator. */ 57 | int Init(); 58 | 59 | uint8_t GetRandom8(); 60 | uint16_t GetRandom16(); 61 | uint32_t GetRandom32(); 62 | double GetRandomDouble(); 63 | private: 64 | bool initialized; 65 | }; 66 | 67 | } // end namespace 68 | 69 | #endif // RTPRANDOMRANDS_H 70 | 71 | -------------------------------------------------------------------------------- /jrtplib-3.9.1/rtprandomurandom.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | This file is a part of JRTPLIB 4 | Copyright (c) 1999-2011 Jori Liesenborgs 5 | 6 | Contact: jori.liesenborgs@gmail.com 7 | 8 | This library was developed at the Expertise Centre for Digital Media 9 | (http://www.edm.uhasselt.be), a research center of the Hasselt University 10 | (http://www.uhasselt.be). The library is based upon work done for 11 | my thesis at the School for Knowledge Technology (Belgium/The Netherlands). 12 | 13 | Permission is hereby granted, free of charge, to any person obtaining a 14 | copy of this software and associated documentation files (the "Software"), 15 | to deal in the Software without restriction, including without limitation 16 | the rights to use, copy, modify, merge, publish, distribute, sublicense, 17 | and/or sell copies of the Software, and to permit persons to whom the 18 | Software is furnished to do so, subject to the following conditions: 19 | 20 | The above copyright notice and this permission notice shall be included 21 | in all copies or substantial portions of the Software. 22 | 23 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 24 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 25 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 26 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 27 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 28 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 29 | IN THE SOFTWARE. 30 | 31 | */ 32 | 33 | /** 34 | * \file rtprandomurandom.h 35 | */ 36 | 37 | #ifndef RTPRANDOMURANDOM_H 38 | 39 | #define RTPRANDOMURANDOM_H 40 | 41 | #include "rtpconfig.h" 42 | #include "rtprandom.h" 43 | #include 44 | 45 | namespace jrtplib 46 | { 47 | 48 | /** A random number generator which uses bytes delivered by the /dev/urandom device. */ 49 | class JRTPLIB_IMPORTEXPORT RTPRandomURandom : public RTPRandom 50 | { 51 | public: 52 | RTPRandomURandom(); 53 | ~RTPRandomURandom(); 54 | 55 | /** Initialize the random number generator. */ 56 | int Init(); 57 | 58 | uint8_t GetRandom8(); 59 | uint16_t GetRandom16(); 60 | uint32_t GetRandom32(); 61 | double GetRandomDouble(); 62 | private: 63 | FILE *device; 64 | }; 65 | 66 | } // end namespace 67 | 68 | #endif // RTPRANDOMURANDOM_H 69 | -------------------------------------------------------------------------------- /jrtplib-3.9.1/rtptimeutilities.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | This file is a part of JRTPLIB 4 | Copyright (c) 1999-2011 Jori Liesenborgs 5 | 6 | Contact: jori.liesenborgs@gmail.com 7 | 8 | This library was developed at the Expertise Centre for Digital Media 9 | (http://www.edm.uhasselt.be), a research center of the Hasselt University 10 | (http://www.uhasselt.be). The library is based upon work done for 11 | my thesis at the School for Knowledge Technology (Belgium/The Netherlands). 12 | 13 | Permission is hereby granted, free of charge, to any person obtaining a 14 | copy of this software and associated documentation files (the "Software"), 15 | to deal in the Software without restriction, including without limitation 16 | the rights to use, copy, modify, merge, publish, distribute, sublicense, 17 | and/or sell copies of the Software, and to permit persons to whom the 18 | Software is furnished to do so, subject to the following conditions: 19 | 20 | The above copyright notice and this permission notice shall be included 21 | in all copies or substantial portions of the Software. 22 | 23 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 24 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 25 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 26 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 27 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 28 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 29 | IN THE SOFTWARE. 30 | 31 | */ 32 | 33 | #if (defined(WIN32) || defined(_WIN32_WCE)) 34 | 35 | #include "rtptimeutilities.h" 36 | #ifdef RTPDEBUG 37 | #include 38 | #endif // RTPDEBUG 39 | 40 | namespace jrtplib 41 | { 42 | 43 | RTPTimeInitializer::RTPTimeInitializer() 44 | { 45 | #ifdef RTPDEBUG 46 | std::cout << "RTPTimeInitializer: Initializing RTPTime::CurrentTime()" << std::endl; 47 | #endif // RTPDEBUG 48 | RTPTime curtime = RTPTime::CurrentTime(); 49 | dummy = -1; 50 | } 51 | 52 | RTPTimeInitializer timeinit; 53 | 54 | } // end namespace 55 | 56 | #endif // WIN32 || _WIN32_WCE 57 | 58 | -------------------------------------------------------------------------------- /jrtplib-3.9.1/rtptypes.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | -------------------------------------------------------------------------------- /jrtplib-3.9.1/rtptypes.h.in: -------------------------------------------------------------------------------- 1 | ${RTP_WINSOCK_HEADERS} 2 | ${RTP_INTTYPE_HEADERS} 3 | -------------------------------------------------------------------------------- /jrtplib-3.9.1/rtptypes_win.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | This file is a part of JRTPLIB 4 | Copyright (c) 1999-2011 Jori Liesenborgs 5 | 6 | Contact: jori.liesenborgs@gmail.com 7 | 8 | This library was developed at the Expertise Centre for Digital Media 9 | (http://www.edm.uhasselt.be), a research center of the Hasselt University 10 | (http://www.uhasselt.be). The library is based upon work done for 11 | my thesis at the School for Knowledge Technology (Belgium/The Netherlands). 12 | 13 | Permission is hereby granted, free of charge, to any person obtaining a 14 | copy of this software and associated documentation files (the "Software"), 15 | to deal in the Software without restriction, including without limitation 16 | the rights to use, copy, modify, merge, publish, distribute, sublicense, 17 | and/or sell copies of the Software, and to permit persons to whom the 18 | Software is furnished to do so, subject to the following conditions: 19 | 20 | The above copyright notice and this permission notice shall be included 21 | in all copies or substantial portions of the Software. 22 | 23 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 24 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 25 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 26 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 27 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 28 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 29 | IN THE SOFTWARE. 30 | 31 | */ 32 | 33 | #ifndef RTPTYPES_WIN_H 34 | 35 | #define RTPTYPES_WIN_H 36 | 37 | #ifndef INTTYPES_DEFINED 38 | 39 | #define INTTYPES_DEFINED 40 | 41 | typedef char int8_t; 42 | typedef unsigned char uint8_t; 43 | typedef short int16_t; 44 | typedef unsigned short uint16_t; 45 | typedef int int32_t; 46 | typedef unsigned int uint32_t; 47 | typedef __int64 int64_t; 48 | typedef unsigned __int64 uint64_t; 49 | 50 | #endif // INTTYPES_DEFINED 51 | 52 | #endif // RTPTYPES_WIN_H 53 | 54 | -------------------------------------------------------------------------------- /jthread-1.3.1/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | include $(CLEAR_VARS) 4 | 5 | LOCAL_MODULE_TAGS := optional 6 | 7 | LOCAL_SRC_FILES := \ 8 | $(subst $(LOCAL_PATH)/,,$(wildcard $(LOCAL_PATH)/pthread/*.c*)) 9 | 10 | LOCAL_MODULE:= libjthread 11 | 12 | LOCAL_PRELINK_MODULE:= false 13 | 14 | include $(BUILD_SHARED_LIBRARY) 15 | -------------------------------------------------------------------------------- /jthread-1.3.1/jmutexautolock.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | This file is a part of the JThread package, which contains some object- 4 | oriented thread wrappers for different thread implementations. 5 | 6 | Copyright (c) 2000-2011 Jori Liesenborgs (jori.liesenborgs@gmail.com) 7 | 8 | Permission is hereby granted, free of charge, to any person obtaining a 9 | copy of this software and associated documentation files (the "Software"), 10 | to deal in the Software without restriction, including without limitation 11 | the rights to use, copy, modify, merge, publish, distribute, sublicense, 12 | and/or sell copies of the Software, and to permit persons to whom the 13 | Software is furnished to do so, subject to the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be included in 16 | all copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 21 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | 26 | */ 27 | 28 | #ifndef JTHREAD_JMUTEXAUTOLOCK_H 29 | 30 | #define JTHREAD_JMUTEXAUTOLOCK_H 31 | 32 | #include "jthreadconfig.h" 33 | #include "jmutex.h" 34 | 35 | namespace jthread 36 | { 37 | 38 | class JTHREAD_IMPORTEXPORT JMutexAutoLock 39 | { 40 | public: 41 | JMutexAutoLock(JMutex &m) : mutex(m) { mutex.Lock(); } 42 | ~JMutexAutoLock() { mutex.Unlock(); } 43 | private: 44 | JMutex &mutex; 45 | }; 46 | 47 | } // end namespace 48 | 49 | #endif // JTHREAD_JMUTEXAUTOLOCK_H 50 | 51 | -------------------------------------------------------------------------------- /jthread-1.3.1/jthreadconfig.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | This file is a part of the JThread package, which contains some object- 4 | oriented thread wrappers for different thread implementations. 5 | 6 | Copyright (c) 2000-2011 Jori Liesenborgs (jori.liesenborgs@gmail.com) 7 | 8 | Permission is hereby granted, free of charge, to any person obtaining a 9 | copy of this software and associated documentation files (the "Software"), 10 | to deal in the Software without restriction, including without limitation 11 | the rights to use, copy, modify, merge, publish, distribute, sublicense, 12 | and/or sell copies of the Software, and to permit persons to whom the 13 | Software is furnished to do so, subject to the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be included in 16 | all copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 21 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | 26 | */ 27 | 28 | #ifndef JTHREADCONFIG_H 29 | 30 | #define JTHREADCONFIG_H 31 | 32 | #define JTHREAD_IMPORT 33 | #define JTHREAD_EXPORT 34 | #ifdef JTHREAD_COMPILING 35 | #define JTHREAD_IMPORTEXPORT JTHREAD_EXPORT 36 | #else 37 | #define JTHREAD_IMPORTEXPORT JTHREAD_IMPORT 38 | #endif // JTHREAD_COMPILING 39 | 40 | // Using pthread based threads 41 | 42 | 43 | 44 | #endif // JTHREADCONFIG_H 45 | 46 | -------------------------------------------------------------------------------- /jthread-1.3.1/jthreadconfig.h.in: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | This file is a part of the JThread package, which contains some object- 4 | oriented thread wrappers for different thread implementations. 5 | 6 | Copyright (c) 2000-2011 Jori Liesenborgs (jori.liesenborgs@gmail.com) 7 | 8 | Permission is hereby granted, free of charge, to any person obtaining a 9 | copy of this software and associated documentation files (the "Software"), 10 | to deal in the Software without restriction, including without limitation 11 | the rights to use, copy, modify, merge, publish, distribute, sublicense, 12 | and/or sell copies of the Software, and to permit persons to whom the 13 | Software is furnished to do so, subject to the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be included in 16 | all copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 21 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | 26 | */ 27 | 28 | #ifndef JTHREADCONFIG_H 29 | 30 | #define JTHREADCONFIG_H 31 | 32 | #define JTHREAD_IMPORT ${JTHREAD_IMPORT} 33 | #define JTHREAD_EXPORT ${JTHREAD_EXPORT} 34 | #ifdef JTHREAD_COMPILING 35 | #define JTHREAD_IMPORTEXPORT JTHREAD_EXPORT 36 | #else 37 | #define JTHREAD_IMPORTEXPORT JTHREAD_IMPORT 38 | #endif // JTHREAD_COMPILING 39 | 40 | ${JTHREAD_CONFIG_WIN32THREADS} 41 | 42 | ${JTHREAD_CONFIG_JMUTEXCRITICALSECTION} 43 | 44 | #endif // JTHREADCONFIG_H 45 | 46 | -------------------------------------------------------------------------------- /jthread-1.3.1/pthread/jmutex.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | This file is a part of the JThread package, which contains some object- 4 | oriented thread wrappers for different thread implementations. 5 | 6 | Copyright (c) 2000-2011 Jori Liesenborgs (jori.liesenborgs@gmail.com) 7 | 8 | Permission is hereby granted, free of charge, to any person obtaining a 9 | copy of this software and associated documentation files (the "Software"), 10 | to deal in the Software without restriction, including without limitation 11 | the rights to use, copy, modify, merge, publish, distribute, sublicense, 12 | and/or sell copies of the Software, and to permit persons to whom the 13 | Software is furnished to do so, subject to the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be included in 16 | all copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 21 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | 26 | */ 27 | 28 | #include "../jmutex.h" 29 | 30 | namespace jthread 31 | { 32 | 33 | JMutex::JMutex() 34 | { 35 | initialized = false; 36 | } 37 | 38 | JMutex::~JMutex() 39 | { 40 | if (initialized) 41 | pthread_mutex_destroy(&mutex); 42 | } 43 | 44 | int JMutex::Init() 45 | { 46 | if (initialized) 47 | return ERR_JMUTEX_ALREADYINIT; 48 | 49 | pthread_mutex_init(&mutex,NULL); 50 | initialized = true; 51 | return 0; 52 | } 53 | 54 | int JMutex::Lock() 55 | { 56 | if (!initialized) 57 | return ERR_JMUTEX_NOTINIT; 58 | 59 | pthread_mutex_lock(&mutex); 60 | return 0; 61 | } 62 | 63 | int JMutex::Unlock() 64 | { 65 | if (!initialized) 66 | return ERR_JMUTEX_NOTINIT; 67 | 68 | pthread_mutex_unlock(&mutex); 69 | return 0; 70 | } 71 | 72 | } // end namespace 73 | 74 | --------------------------------------------------------------------------------