├── README.md
├── mediaServer
├── include
│ ├── version.hh
│ └── DynamicRTSPServer.hh
└── mediaServer.vcxproj.filters
├── groupsock
├── include
│ ├── groupsock_version.hh
│ ├── IOHandlers.hh
│ └── GroupEId.hh
└── src
│ ├── GroupEId.cpp
│ └── IOHandlers.cpp
├── liveMedia
├── include
│ ├── liveMedia_version.hh
│ ├── OutputFile.hh
│ ├── FramedFileSource.hh
│ ├── QCELPAudioRTPSource.hh
│ ├── MP3Transcoder.hh
│ ├── TextRTPSink.hh
│ ├── VideoRTPSink.hh
│ ├── GSMAudioRTPSink.hh
│ ├── AudioRTPSink.hh
│ ├── AMRAudioFileSource.hh
│ ├── FileServerMediaSubsession.hh
│ ├── MP3ADURTPSource.hh
│ ├── H265VideoStreamFramer.hh
│ ├── H264VideoStreamFramer.hh
│ ├── Base64.hh
│ ├── H264or5VideoFileSink.hh
│ ├── AMRAudioSource.hh
│ ├── DVVideoRTPSource.hh
│ ├── FramedFilter.hh
│ ├── VP8VideoRTPSource.hh
│ ├── VP9VideoRTPSource.hh
│ ├── AC3AudioRTPSource.hh
│ ├── BasicUDPSource.hh
│ ├── MPEG4ESVideoRTPSource.hh
│ ├── H264VideoStreamDiscreteFramer.hh
│ ├── H265VideoStreamDiscreteFramer.hh
│ ├── MPEG1or2AudioRTPSink.hh
│ ├── AMRAudioFileSink.hh
│ ├── MPEG1or2AudioRTPSource.hh
│ ├── H264VideoFileSink.hh
│ ├── ourMD5.hh
│ ├── AMRAudioRTPSource.hh
│ ├── H261VideoRTPSource.hh
│ ├── TheoraVideoRTPSource.hh
│ ├── MPEG1or2VideoRTPSource.hh
│ ├── VP8VideoRTPSink.hh
│ ├── VP9VideoRTPSink.hh
│ ├── MP3ADURTPSink.hh
│ ├── AC3AudioFileServerMediaSubsession.hh
│ ├── AMRAudioFileServerMediaSubsession.hh
│ ├── ADTSAudioFileSource.hh
│ ├── JPEGVideoRTPSink.hh
│ ├── ADTSAudioFileServerMediaSubsession.hh
│ ├── H265VideoFileSink.hh
│ ├── H263plusVideoFileServerMediaSubsession.hh
│ ├── MediaSource.hh
│ ├── JPEGVideoRTPSource.hh
│ ├── MPEG1or2VideoStreamFramer.hh
│ ├── BasicUDPSink.hh
│ ├── H263plusVideoRTPSink.hh
│ ├── JPEGVideoSource.hh
│ ├── AC3AudioRTPSink.hh
│ ├── H263plusVideoRTPSource.hh
│ ├── MP3ADUTranscoder.hh
│ ├── DVVideoRTPSink.hh
│ ├── BitVector.hh
│ ├── H263plusVideoStreamFramer.hh
│ ├── H264or5VideoStreamDiscreteFramer.hh
│ ├── DVVideoFileServerMediaSubsession.hh
│ ├── MP3FileSource.hh
│ └── H264or5VideoRTPSink.hh
└── src
│ ├── FramedFileSource.cpp
│ ├── AMRAudioSource.cpp
│ ├── TextRTPSink.cpp
│ ├── FileServerMediaSubsession.cpp
│ ├── VideoRTPSink.cpp
│ ├── AudioRTPSink.cpp
│ ├── JPEGVideoSource.cpp
│ ├── GSMAudioRTPSink.cpp
│ ├── H264VideoStreamFramer.cpp
│ ├── H265VideoStreamFramer.cpp
│ ├── AudioInputDevice.cpp
│ ├── OggDemuxedTrack.cpp
│ ├── H264VideoStreamDiscreteFramer.cpp
│ ├── H265VideoStreamDiscreteFramer.cpp
│ ├── MPEGVideoStreamParser.cpp
│ ├── MP3ADUdescriptor.hh
│ ├── MatroskaDemuxedTrack.cpp
│ ├── MP3Transcoder.cpp
│ ├── FramedFilter.cpp
│ ├── OggFileServerMediaSubsession.hh
│ ├── Locale.cpp
│ ├── H264VideoFileSink.cpp
│ ├── OutputFile.cpp
│ ├── OggDemuxedTrack.hh
│ ├── MP3ADUdescriptor.cpp
│ ├── H265VideoFileSink.cpp
│ ├── MatroskaFileServerMediaSubsession.hh
│ ├── DVVideoRTPSource.cpp
│ ├── OggFileServerMediaSubsession.cpp
│ ├── MPEG1or2AudioRTPSource.cpp
│ └── AC3AudioRTPSource.cpp
├── UsageEnvironment
├── include
│ ├── UsageEnvironment_version.hh
│ ├── Boolean.hh
│ └── strDup.hh
├── src
│ ├── HashTable.cpp
│ ├── strDup.cpp
│ └── UsageEnvironment.cpp
└── UsageEnvironment.vcxproj.filters
├── BasicUsageEnvironment
├── include
│ ├── BasicUsageEnvironment_version.hh
│ └── HandlerSet.hh
└── BasicUsageEnvironment.vcxproj.filters
├── proxyServer
└── proxyServer.vcxproj.filters
├── testRTSPClient
└── testRTSPClient.vcxproj.filters
└── openRTSP
├── openRTSP.vcxproj.filters
└── include
└── playCommon.hh
/README.md:
--------------------------------------------------------------------------------
1 | # live555
2 | Live555 streaming library, compiling for Windows using VS2017.
3 |
--------------------------------------------------------------------------------
/mediaServer/include/version.hh:
--------------------------------------------------------------------------------
1 | // Copyright (c) 1996-2016, Live Networks, Inc. All rights reserved
2 | // Version information for the LIVE555 Media Server application
3 | // Header file
4 |
5 | #ifndef _MEDIA_SERVER_VERSION_HH
6 | #define _MEDIA_SERVER_VERSION_HH
7 |
8 | #define MEDIA_SERVER_VERSION_STRING "0.89"
9 |
10 | #endif
11 |
--------------------------------------------------------------------------------
/groupsock/include/groupsock_version.hh:
--------------------------------------------------------------------------------
1 | // Version information for the "groupsock" library
2 | // Copyright (c) 1996-2016 Live Networks, Inc. All rights reserved.
3 |
4 | #ifndef _GROUPSOCK_VERSION_HH
5 | #define _GROUPSOCK_VERSION_HH
6 |
7 | #define GROUPSOCK_LIBRARY_VERSION_STRING "2016.10.11"
8 | #define GROUPSOCK_LIBRARY_VERSION_INT 1476144000
9 |
10 | #endif
11 |
--------------------------------------------------------------------------------
/liveMedia/include/liveMedia_version.hh:
--------------------------------------------------------------------------------
1 | // Version information for the "liveMedia" library
2 | // Copyright (c) 1996-2016 Live Networks, Inc. All rights reserved.
3 |
4 | #ifndef _LIVEMEDIA_VERSION_HH
5 | #define _LIVEMEDIA_VERSION_HH
6 |
7 | #define LIVEMEDIA_LIBRARY_VERSION_STRING "2016.10.11"
8 | #define LIVEMEDIA_LIBRARY_VERSION_INT 1476144000
9 |
10 | #endif
11 |
--------------------------------------------------------------------------------
/UsageEnvironment/include/UsageEnvironment_version.hh:
--------------------------------------------------------------------------------
1 | // Version information for the "UsageEnvironment" library
2 | // Copyright (c) 1996-2016 Live Networks, Inc. All rights reserved.
3 |
4 | #ifndef _USAGEENVIRONMENT_VERSION_HH
5 | #define _USAGEENVIRONMENT_VERSION_HH
6 |
7 | #define USAGEENVIRONMENT_LIBRARY_VERSION_STRING "2016.10.11"
8 | #define USAGEENVIRONMENT_LIBRARY_VERSION_INT 1476144000
9 |
10 | #endif
11 |
--------------------------------------------------------------------------------
/BasicUsageEnvironment/include/BasicUsageEnvironment_version.hh:
--------------------------------------------------------------------------------
1 | // Version information for the "BasicUsageEnvironment" library
2 | // Copyright (c) 1996-2016 Live Networks, Inc. All rights reserved.
3 |
4 | #ifndef _BASICUSAGEENVIRONMENT_VERSION_HH
5 | #define _BASICUSAGEENVIRONMENT_VERSION_HH
6 |
7 | #define BASICUSAGEENVIRONMENT_LIBRARY_VERSION_STRING "2016.10.11"
8 | #define BASICUSAGEENVIRONMENT_LIBRARY_VERSION_INT 1476144000
9 |
10 | #endif
11 |
--------------------------------------------------------------------------------
/proxyServer/proxyServer.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hh;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 |
18 |
19 | Source Files
20 |
21 |
22 |
--------------------------------------------------------------------------------
/testRTSPClient/testRTSPClient.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hh;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 |
18 |
19 | Source Files
20 |
21 |
22 |
--------------------------------------------------------------------------------
/liveMedia/src/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-2016 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 |
--------------------------------------------------------------------------------
/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-2016 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 |
--------------------------------------------------------------------------------
/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-2016 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 |
--------------------------------------------------------------------------------
/openRTSP/openRTSP.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hh;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 |
18 |
19 | Source Files
20 |
21 |
22 | Source Files
23 |
24 |
25 |
26 |
27 | Header Files
28 |
29 |
30 |
--------------------------------------------------------------------------------
/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-2016 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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/mediaServer/mediaServer.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hh;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 |
18 |
19 | Header Files
20 |
21 |
22 | Header Files
23 |
24 |
25 |
26 |
27 | Source Files
28 |
29 |
30 | Source Files
31 |
32 |
33 |
--------------------------------------------------------------------------------
/liveMedia/src/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-2016 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 |
--------------------------------------------------------------------------------
/liveMedia/src/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-2016 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 |
--------------------------------------------------------------------------------
/liveMedia/src/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-2016 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 |
--------------------------------------------------------------------------------
/liveMedia/src/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-2016 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 |
--------------------------------------------------------------------------------
/liveMedia/src/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-2016 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 |
--------------------------------------------------------------------------------
/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-2016 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 |
--------------------------------------------------------------------------------
/liveMedia/src/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-2016 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 |
--------------------------------------------------------------------------------
/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-2016 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 | #include
26 |
27 | char* strDup(char const* str);
28 | // Note: strDup(NULL) returns NULL
29 |
30 | char* strDupSize(char const* str);
31 | // Like "strDup()", except that it *doesn't* copy the original.
32 | // (Instead, it just allocates a string of the same size as the original.)
33 |
34 | char* strDupSize(char const* str, size_t& resultBufSize);
35 | // An alternative form of "strDupSize()" that also returns the size of the allocated buffer.
36 |
37 | #endif
38 |
--------------------------------------------------------------------------------
/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-2016 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 |
--------------------------------------------------------------------------------
/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-2016 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 |
--------------------------------------------------------------------------------
/liveMedia/src/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-2016 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 |
--------------------------------------------------------------------------------
/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-2016 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 |
--------------------------------------------------------------------------------
/UsageEnvironment/src/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-2016 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 |
--------------------------------------------------------------------------------
/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-2016 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 |
--------------------------------------------------------------------------------
/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-2016 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 |
--------------------------------------------------------------------------------
/UsageEnvironment/src/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-2016 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 |
23 | char* strDup(char const* str) {
24 | if (str == NULL) return NULL;
25 | size_t len = strlen(str) + 1;
26 | char* copy = new char[len];
27 |
28 | if (copy != NULL) {
29 | memcpy(copy, str, len);
30 | }
31 | return copy;
32 | }
33 |
34 | char* strDupSize(char const* str) {
35 | size_t dummy;
36 |
37 | return strDupSize(str, dummy);
38 | }
39 |
40 | char* strDupSize(char const* str, size_t& resultBufSize) {
41 | if (str == NULL) {
42 | resultBufSize = 0;
43 | return NULL;
44 | }
45 |
46 | resultBufSize = strlen(str) + 1;
47 | char* copy = new char[resultBufSize];
48 |
49 | return copy;
50 | }
51 |
--------------------------------------------------------------------------------
/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-2016 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 |
--------------------------------------------------------------------------------
/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-2016 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 _SERVER_MEDIA_SESSION_HH
26 | #include "ServerMediaSession.hh"
27 | #endif
28 | #ifndef _ON_DEMAND_SERVER_MEDIA_SUBSESSION_HH
29 | #include "OnDemandServerMediaSubsession.hh"
30 | #endif
31 |
32 | class FileServerMediaSubsession: public OnDemandServerMediaSubsession {
33 | protected: // we're a virtual base class
34 | FileServerMediaSubsession(UsageEnvironment& env, char const* fileName,
35 | Boolean reuseFirstSource);
36 | virtual ~FileServerMediaSubsession();
37 |
38 | protected:
39 | char const* fFileName;
40 | u_int64_t fFileSize; // if known
41 | };
42 |
43 | #endif
44 |
--------------------------------------------------------------------------------
/liveMedia/src/H264VideoStreamFramer.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-2016 Live Networks, Inc. All rights reserved.
18 | // A filter that breaks up a H.264 Video Elementary Stream into NAL units.
19 | // Implementation
20 |
21 | #include "H264VideoStreamFramer.hh"
22 |
23 | H264VideoStreamFramer* H264VideoStreamFramer
24 | ::createNew(UsageEnvironment& env, FramedSource* inputSource, Boolean includeStartCodeInOutput) {
25 | return new H264VideoStreamFramer(env, inputSource, True, includeStartCodeInOutput);
26 | }
27 |
28 | H264VideoStreamFramer
29 | ::H264VideoStreamFramer(UsageEnvironment& env, FramedSource* inputSource, Boolean createParser, Boolean includeStartCodeInOutput)
30 | : H264or5VideoStreamFramer(264, env, inputSource, createParser, includeStartCodeInOutput) {
31 | }
32 |
33 | H264VideoStreamFramer::~H264VideoStreamFramer() {
34 | }
35 |
36 | Boolean H264VideoStreamFramer::isH264VideoStreamFramer() const {
37 | return True;
38 | }
39 |
--------------------------------------------------------------------------------
/liveMedia/src/H265VideoStreamFramer.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-2016 Live Networks, Inc. All rights reserved.
18 | // A filter that breaks up a H.265 Video Elementary Stream into NAL units.
19 | // Implementation
20 |
21 | #include "H265VideoStreamFramer.hh"
22 |
23 | H265VideoStreamFramer* H265VideoStreamFramer
24 | ::createNew(UsageEnvironment& env, FramedSource* inputSource, Boolean includeStartCodeInOutput) {
25 | return new H265VideoStreamFramer(env, inputSource, True, includeStartCodeInOutput);
26 | }
27 |
28 | H265VideoStreamFramer
29 | ::H265VideoStreamFramer(UsageEnvironment& env, FramedSource* inputSource, Boolean createParser, Boolean includeStartCodeInOutput)
30 | : H264or5VideoStreamFramer(265, env, inputSource, createParser, includeStartCodeInOutput) {
31 | }
32 |
33 | H265VideoStreamFramer::~H265VideoStreamFramer() {
34 | }
35 |
36 | Boolean H265VideoStreamFramer::isH265VideoStreamFramer() const {
37 | return True;
38 | }
39 |
--------------------------------------------------------------------------------
/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-2016 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 |
--------------------------------------------------------------------------------
/liveMedia/include/H265VideoStreamFramer.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-2016 Live Networks, Inc. All rights reserved.
18 | // A filter that breaks up a H.265 Video Elementary Stream into NAL units.
19 | // C++ header
20 |
21 | #ifndef _H265_VIDEO_STREAM_FRAMER_HH
22 | #define _H265_VIDEO_STREAM_FRAMER_HH
23 |
24 | #ifndef _H264_OR_5_VIDEO_STREAM_FRAMER_HH
25 | #include "H264or5VideoStreamFramer.hh"
26 | #endif
27 |
28 | class H265VideoStreamFramer: public H264or5VideoStreamFramer {
29 | public:
30 | static H265VideoStreamFramer* createNew(UsageEnvironment& env, FramedSource* inputSource,
31 | Boolean includeStartCodeInOutput = False);
32 |
33 | protected:
34 | H265VideoStreamFramer(UsageEnvironment& env, FramedSource* inputSource, Boolean createParser, Boolean includeStartCodeInOutput);
35 | // called only by "createNew()"
36 | virtual ~H265VideoStreamFramer();
37 |
38 | // redefined virtual functions:
39 | virtual Boolean isH265VideoStreamFramer() const;
40 | };
41 |
42 | #endif
43 |
--------------------------------------------------------------------------------
/liveMedia/include/H264VideoStreamFramer.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-2016 Live Networks, Inc. All rights reserved.
18 | // A filter that breaks up a H.264 Video Elementary Stream into NAL units.
19 | // C++ header
20 |
21 | #ifndef _H264_VIDEO_STREAM_FRAMER_HH
22 | #define _H264_VIDEO_STREAM_FRAMER_HH
23 |
24 | #ifndef _H264_OR_5_VIDEO_STREAM_FRAMER_HH
25 | #include "H264or5VideoStreamFramer.hh"
26 | #endif
27 |
28 | class H264VideoStreamFramer: public H264or5VideoStreamFramer {
29 | public:
30 | static H264VideoStreamFramer* createNew(UsageEnvironment& env, FramedSource* inputSource,
31 | Boolean includeStartCodeInOutput = False);
32 |
33 | protected:
34 | H264VideoStreamFramer(UsageEnvironment& env, FramedSource* inputSource,
35 | Boolean createParser, Boolean includeStartCodeInOutput);
36 | // called only by "createNew()"
37 | virtual ~H264VideoStreamFramer();
38 |
39 | // redefined virtual functions:
40 | virtual Boolean isH264VideoStreamFramer() const;
41 | };
42 |
43 | #endif
44 |
--------------------------------------------------------------------------------
/liveMedia/src/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 |
--------------------------------------------------------------------------------
/liveMedia/src/OggDemuxedTrack.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-2016 Live Networks, Inc. All rights reserved.
18 | // A media track, demultiplexed from an Ogg file
19 | // Implementation
20 |
21 | #include "OggDemuxedTrack.hh"
22 | #include "OggFile.hh"
23 |
24 | OggDemuxedTrack::OggDemuxedTrack(UsageEnvironment& env, unsigned trackNumber, OggDemux& sourceDemux)
25 | : FramedSource(env),
26 | fOurTrackNumber(trackNumber), fOurSourceDemux(sourceDemux),
27 | fCurrentPageIsContinuation(False) {
28 | fNextPresentationTime.tv_sec = 0; fNextPresentationTime.tv_usec = 0;
29 | }
30 |
31 | OggDemuxedTrack::~OggDemuxedTrack() {
32 | fOurSourceDemux.removeTrack(fOurTrackNumber);
33 | }
34 |
35 | void OggDemuxedTrack::doGetNextFrame() {
36 | fOurSourceDemux.continueReading();
37 | }
38 |
39 | char const* OggDemuxedTrack::MIMEtype() const {
40 | OggTrack* track = fOurSourceDemux.fOurFile.lookup(fOurTrackNumber);
41 | if (track == NULL) return "(unknown)"; // shouldn't happen
42 | return track->mimeType;
43 | }
44 |
--------------------------------------------------------------------------------
/liveMedia/src/H264VideoStreamDiscreteFramer.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-2016 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 | // Implementation
23 |
24 | #include "H264VideoStreamDiscreteFramer.hh"
25 |
26 | H264VideoStreamDiscreteFramer*
27 | H264VideoStreamDiscreteFramer::createNew(UsageEnvironment& env, FramedSource* inputSource) {
28 | return new H264VideoStreamDiscreteFramer(env, inputSource);
29 | }
30 |
31 | H264VideoStreamDiscreteFramer
32 | ::H264VideoStreamDiscreteFramer(UsageEnvironment& env, FramedSource* inputSource)
33 | : H264or5VideoStreamDiscreteFramer(264, env, inputSource) {
34 | }
35 |
36 | H264VideoStreamDiscreteFramer::~H264VideoStreamDiscreteFramer() {
37 | }
38 |
39 | Boolean H264VideoStreamDiscreteFramer::isH264VideoStreamFramer() const {
40 | return True;
41 | }
42 |
--------------------------------------------------------------------------------
/liveMedia/src/H265VideoStreamDiscreteFramer.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-2016 Live Networks, Inc. All rights reserved.
18 | // A simplified version of "H265VideoStreamFramer" 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 | // "H265VideoStreamFramer".
22 | // Implementation
23 |
24 | #include "H265VideoStreamDiscreteFramer.hh"
25 |
26 | H265VideoStreamDiscreteFramer*
27 | H265VideoStreamDiscreteFramer::createNew(UsageEnvironment& env, FramedSource* inputSource) {
28 | return new H265VideoStreamDiscreteFramer(env, inputSource);
29 | }
30 |
31 | H265VideoStreamDiscreteFramer
32 | ::H265VideoStreamDiscreteFramer(UsageEnvironment& env, FramedSource* inputSource)
33 | : H264or5VideoStreamDiscreteFramer(265, env, inputSource) {
34 | }
35 |
36 | H265VideoStreamDiscreteFramer::~H265VideoStreamDiscreteFramer() {
37 | }
38 |
39 | Boolean H265VideoStreamDiscreteFramer::isH265VideoStreamFramer() const {
40 | return True;
41 | }
42 |
--------------------------------------------------------------------------------
/liveMedia/src/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-2016 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 |
--------------------------------------------------------------------------------
/UsageEnvironment/UsageEnvironment.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hh;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 |
18 |
19 | Source Files
20 |
21 |
22 | Source Files
23 |
24 |
25 | Source Files
26 |
27 |
28 |
29 |
30 | Header Files
31 |
32 |
33 | Header Files
34 |
35 |
36 | Header Files
37 |
38 |
39 | Header Files
40 |
41 |
42 | Header Files
43 |
44 |
45 |
--------------------------------------------------------------------------------
/groupsock/src/GroupEId.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-2016, Live Networks, Inc. All rights reserved
17 | // "Group Endpoint Id"
18 | // Implementation
19 |
20 | #include "GroupEId.hh"
21 |
22 |
23 | GroupEId::GroupEId(struct in_addr const& groupAddr,
24 | portNumBits portNum, u_int8_t ttl) {
25 | struct in_addr sourceFilterAddr;
26 | sourceFilterAddr.s_addr = ~0; // indicates no source filter
27 |
28 | init(groupAddr, sourceFilterAddr, portNum, ttl);
29 | }
30 |
31 | GroupEId::GroupEId(struct in_addr const& groupAddr,
32 | struct in_addr const& sourceFilterAddr,
33 | portNumBits portNum) {
34 | init(groupAddr, sourceFilterAddr, portNum, 255);
35 | }
36 |
37 | Boolean GroupEId::isSSM() const {
38 | return fSourceFilterAddress.s_addr != netAddressBits(~0);
39 | }
40 |
41 | void GroupEId::init(struct in_addr const& groupAddr,
42 | struct in_addr const& sourceFilterAddr,
43 | portNumBits portNum,
44 | u_int8_t ttl) {
45 | fGroupAddress = groupAddr;
46 | fSourceFilterAddress = sourceFilterAddr;
47 | fPortNum = portNum;
48 | fTTL = ttl;
49 | }
50 |
--------------------------------------------------------------------------------
/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-2016 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 |
--------------------------------------------------------------------------------
/liveMedia/include/H264or5VideoFileSink.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-2016 Live Networks, Inc. All rights reserved.
18 | // H.264 or H.265 Video File Sinks
19 | // C++ header
20 |
21 | #ifndef _H264_OR_5_VIDEO_FILE_SINK_HH
22 | #define _H264_OR_5_VIDEO_FILE_SINK_HH
23 |
24 | #ifndef _FILE_SINK_HH
25 | #include "FileSink.hh"
26 | #endif
27 |
28 | class H264or5VideoFileSink: public FileSink {
29 | protected:
30 | H264or5VideoFileSink(UsageEnvironment& env, FILE* fid,
31 | unsigned bufferSize, char const* perFrameFileNamePrefix,
32 | char const* sPropParameterSetsStr1,
33 | char const* sPropParameterSetsStr2 = NULL,
34 | char const* sPropParameterSetsStr3 = NULL);
35 | // we're an abstract base class
36 | virtual ~H264or5VideoFileSink();
37 |
38 | protected: // redefined virtual functions:
39 | virtual void afterGettingFrame(unsigned frameSize, unsigned numTruncatedBytes, struct timeval presentationTime);
40 |
41 | private:
42 | char const* fSPropParameterSetsStr[3];
43 | Boolean fHaveWrittenFirstFrame;
44 | };
45 |
46 | #endif
47 |
--------------------------------------------------------------------------------
/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-2016 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 |
--------------------------------------------------------------------------------
/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-2016 Live Networks, Inc. All rights reserved.
18 | // DV Video RTP Sources
19 | // C++ header
20 |
21 | #ifndef _DV_VIDEO_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 |
--------------------------------------------------------------------------------
/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-2016 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();
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 |
--------------------------------------------------------------------------------
/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-2016 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 |
--------------------------------------------------------------------------------
/liveMedia/include/VP9VideoRTPSource.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-2016 Live Networks, Inc. All rights reserved.
18 | // VP9 Video RTP Sources
19 | // C++ header
20 |
21 | #ifndef _VP9_VIDEO_RTP_SOURCE_HH
22 | #define _VP9_VIDEO_RTP_SOURCE_HH
23 |
24 | #ifndef _MULTI_FRAMED_RTP_SOURCE_HH
25 | #include "MultiFramedRTPSource.hh"
26 | #endif
27 |
28 | class VP9VideoRTPSource: public MultiFramedRTPSource {
29 | public:
30 | static VP9VideoRTPSource*
31 | createNew(UsageEnvironment& env, Groupsock* RTPgs,
32 | unsigned char rtpPayloadFormat,
33 | unsigned rtpTimestampFrequency = 90000);
34 |
35 | protected:
36 | VP9VideoRTPSource(UsageEnvironment& env, Groupsock* RTPgs,
37 | unsigned char rtpPayloadFormat,
38 | unsigned rtpTimestampFrequency);
39 | // called only by createNew()
40 |
41 | virtual ~VP9VideoRTPSource();
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 |
--------------------------------------------------------------------------------
/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-2016 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 |
--------------------------------------------------------------------------------
/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-2016 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 |
--------------------------------------------------------------------------------
/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-2016 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 |
--------------------------------------------------------------------------------
/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-2016 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_OR_5_VIDEO_STREAM_DISCRETE_FRAMER_HH
28 | #include "H264or5VideoStreamDiscreteFramer.hh"
29 | #endif
30 |
31 | class H264VideoStreamDiscreteFramer: public H264or5VideoStreamDiscreteFramer {
32 | public:
33 | static H264VideoStreamDiscreteFramer*
34 | createNew(UsageEnvironment& env, FramedSource* inputSource);
35 |
36 | protected:
37 | H264VideoStreamDiscreteFramer(UsageEnvironment& env, FramedSource* inputSource);
38 | // called only by createNew()
39 | virtual ~H264VideoStreamDiscreteFramer();
40 |
41 | private:
42 | // redefined virtual functions:
43 | virtual Boolean isH264VideoStreamFramer() const;
44 | };
45 |
46 | #endif
47 |
--------------------------------------------------------------------------------
/liveMedia/include/H265VideoStreamDiscreteFramer.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-2016 Live Networks, Inc. All rights reserved.
18 | // A simplified version of "H265VideoStreamFramer" 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 | // "H265VideoStreamFramer".
22 | // C++ header
23 |
24 | #ifndef _H265_VIDEO_STREAM_DISCRETE_FRAMER_HH
25 | #define _H265_VIDEO_STREAM_DISCRETE_FRAMER_HH
26 |
27 | #ifndef _H264_OR_5_VIDEO_STREAM_DISCRETE_FRAMER_HH
28 | #include "H264or5VideoStreamDiscreteFramer.hh"
29 | #endif
30 |
31 | class H265VideoStreamDiscreteFramer: public H264or5VideoStreamDiscreteFramer {
32 | public:
33 | static H265VideoStreamDiscreteFramer*
34 | createNew(UsageEnvironment& env, FramedSource* inputSource);
35 |
36 | protected:
37 | H265VideoStreamDiscreteFramer(UsageEnvironment& env, FramedSource* inputSource);
38 | // called only by createNew()
39 | virtual ~H265VideoStreamDiscreteFramer();
40 |
41 | private:
42 | // redefined virtual functions:
43 | virtual Boolean isH265VideoStreamFramer() const;
44 | };
45 |
46 | #endif
47 |
--------------------------------------------------------------------------------
/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-2016 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 |
--------------------------------------------------------------------------------
/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-2016 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 |
--------------------------------------------------------------------------------
/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-2016 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 |
--------------------------------------------------------------------------------
/liveMedia/src/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-2016 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 |
--------------------------------------------------------------------------------
/liveMedia/src/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-2016 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 | fOpusTrackNumber(0) {
32 | fPrevPresentationTime.tv_sec = 0; fPrevPresentationTime.tv_usec = 0;
33 | }
34 |
35 | MatroskaDemuxedTrack::~MatroskaDemuxedTrack() {
36 | fOurSourceDemux.removeTrack(fOurTrackNumber);
37 | }
38 |
39 | void MatroskaDemuxedTrack::doGetNextFrame() {
40 | fOurSourceDemux.continueReading();
41 | }
42 |
43 | char const* MatroskaDemuxedTrack::MIMEtype() const {
44 | MatroskaTrack* track = fOurSourceDemux.fOurFile.lookup(fOurTrackNumber);
45 | if (track == NULL) return "(unknown)"; // shouldn't happen
46 | return track->mimeType;
47 | }
48 |
--------------------------------------------------------------------------------
/mediaServer/include/DynamicRTSPServer.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-2016, Live Networks, Inc. All rights reserved
17 | // A subclass of "RTSPServer" that creates "ServerMediaSession"s on demand,
18 | // based on whether or not the specified stream name exists as a file
19 | // Header file
20 |
21 | #ifndef _DYNAMIC_RTSP_SERVER_HH
22 | #define _DYNAMIC_RTSP_SERVER_HH
23 |
24 | #ifndef _RTSP_SERVER_SUPPORTING_HTTP_STREAMING_HH
25 | #include "RTSPServerSupportingHTTPStreaming.hh"
26 | #endif
27 |
28 | class DynamicRTSPServer: public RTSPServerSupportingHTTPStreaming {
29 | public:
30 | static DynamicRTSPServer* createNew(UsageEnvironment& env, Port ourPort,
31 | UserAuthenticationDatabase* authDatabase,
32 | unsigned reclamationTestSeconds = 65);
33 |
34 | protected:
35 | DynamicRTSPServer(UsageEnvironment& env, int ourSocket, Port ourPort,
36 | UserAuthenticationDatabase* authDatabase, unsigned reclamationTestSeconds);
37 | // called only by createNew();
38 | virtual ~DynamicRTSPServer();
39 |
40 | protected: // redefined virtual functions
41 | virtual ServerMediaSession*
42 | lookupServerMediaSession(char const* streamName, Boolean isFirstLookupInSession);
43 | };
44 |
45 | #endif
46 |
--------------------------------------------------------------------------------
/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-2016 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 _H264_OR_5_VIDEO_FILE_SINK_HH
25 | #include "H264or5VideoFileSink.hh"
26 | #endif
27 |
28 | class H264VideoFileSink: public H264or5VideoFileSink {
29 | public:
30 | static H264VideoFileSink* createNew(UsageEnvironment& env, char const* fileName,
31 | char const* sPropParameterSetsStr = NULL,
32 | // "sPropParameterSetsStr" is an optional 'SDP format' string
33 | // (comma-separated Base64-encoded) representing SPS and/or PPS NAL-units
34 | // to prepend to the output
35 | unsigned bufferSize = 100000,
36 | Boolean oneFilePerFrame = False);
37 | // See "FileSink.hh" for a description of these parameters.
38 |
39 | protected:
40 | H264VideoFileSink(UsageEnvironment& env, FILE* fid,
41 | char const* sPropParameterSetsStr,
42 | unsigned bufferSize, char const* perFrameFileNamePrefix);
43 | // called only by createNew()
44 | virtual ~H264VideoFileSink();
45 | };
46 |
47 | #endif
48 |
--------------------------------------------------------------------------------
/liveMedia/include/ourMD5.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-2016 Live Networks, Inc. All rights reserved.
18 | // Because MD5 may not be implemented (at least, with the same interface) on all systems,
19 | // we have our own implementation.
20 | // C++ header
21 |
22 | #ifndef _OUR_MD5_HH
23 | #define _OUR_MD5_HH
24 |
25 | extern char* our_MD5Data(unsigned char const* data, unsigned dataSize, char* outputDigest);
26 | // "outputDigest" must be either NULL (in which case this function returns a heap-allocated
27 | // buffer, which should be later delete[]d by the caller), or else it must point to
28 | // a (>=)33-byte buffer (which this function will also return).
29 |
30 | extern unsigned char* our_MD5DataRaw(unsigned char const* data, unsigned dataSize,
31 | unsigned char* outputDigest);
32 | // Like "ourMD5Data()", except that it returns the digest in 'raw' binary form, rather than
33 | // as an ASCII hex string.
34 | // "outputDigest" must be either NULL (in which case this function returns a heap-allocated
35 | // buffer, which should be later delete[]d by the caller), or else it must point to
36 | // a (>=)16-byte buffer (which this function will also return).
37 |
38 | #endif
39 |
--------------------------------------------------------------------------------
/liveMedia/src/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-2016 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 |
--------------------------------------------------------------------------------
/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-2016 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 |
--------------------------------------------------------------------------------
/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-2016 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 |
--------------------------------------------------------------------------------
/liveMedia/src/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-2016 Live Networks, Inc. All rights reserved.
18 | // Framed Filters
19 | // Implementation
20 |
21 | #include "FramedFilter.hh"
22 |
23 | ////////// FramedFilter //////////
24 | #include
25 |
26 | void FramedFilter::detachInputSource() {
27 | if (fInputSource != NULL) {
28 | fInputSource->stopGettingFrames();
29 | reassignInputSource(NULL);
30 | }
31 | }
32 |
33 | FramedFilter::FramedFilter(UsageEnvironment& env,
34 | FramedSource* inputSource)
35 | : FramedSource(env),
36 | fInputSource(inputSource) {
37 | }
38 |
39 | FramedFilter::~FramedFilter() {
40 | Medium::close(fInputSource);
41 | }
42 |
43 | // Default implementations of needed virtual functions. These merely
44 | // call the same function in the input source - i.e., act like a 'null filter
45 |
46 | char const* FramedFilter::MIMEtype() const {
47 | if (fInputSource == NULL) return "";
48 |
49 | return fInputSource->MIMEtype();
50 | }
51 |
52 | void FramedFilter::getAttributes() const {
53 | if (fInputSource != NULL) fInputSource->getAttributes();
54 | }
55 |
56 | void FramedFilter::doStopGettingFrames() {
57 | FramedSource::doStopGettingFrames();
58 | if (fInputSource != NULL) fInputSource->stopGettingFrames();
59 | }
60 |
--------------------------------------------------------------------------------
/liveMedia/include/TheoraVideoRTPSource.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-2016 Live Networks, Inc. All rights reserved.
18 | // Theora Video Audio RTP Sources
19 | // C++ header
20 |
21 | #ifndef _THEORA_VIDEO_RTP_SOURCE_HH
22 | #define _THEORA_VIDEO_RTP_SOURCE_HH
23 |
24 | #ifndef _MULTI_FRAMED_RTP_SOURCE_HH
25 | #include "MultiFramedRTPSource.hh"
26 | #endif
27 |
28 | class TheoraVideoRTPSource: public MultiFramedRTPSource {
29 | public:
30 | static TheoraVideoRTPSource*
31 | createNew(UsageEnvironment& env, Groupsock* RTPgs,
32 | unsigned char rtpPayloadFormat);
33 |
34 | u_int32_t curPacketIdent() const { return fCurPacketIdent; } // The current "Ident" field; only the low-order 24 bits are used
35 |
36 | protected:
37 | TheoraVideoRTPSource(UsageEnvironment& env, Groupsock* RTPgs,
38 | unsigned char rtpPayloadFormat);
39 | // called only by createNew()
40 |
41 | virtual ~TheoraVideoRTPSource();
42 |
43 | protected:
44 | // redefined virtual functions:
45 | virtual Boolean processSpecialHeader(BufferedPacket* packet,
46 | unsigned& resultSpecialHeaderSize);
47 | virtual char const* MIMEtype() const;
48 |
49 | private:
50 | u_int32_t fCurPacketIdent; // only the low-order 24 bits are used
51 | };
52 |
53 | #endif
54 |
--------------------------------------------------------------------------------
/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-2016 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 |
--------------------------------------------------------------------------------
/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-2016 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 |
--------------------------------------------------------------------------------
/liveMedia/include/VP9VideoRTPSink.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-2016 Live Networks, Inc. All rights reserved.
18 | // RTP sink for VP9 video
19 | // C++ header
20 |
21 | #ifndef _VP9_VIDEO_RTP_SINK_HH
22 | #define _VP9_VIDEO_RTP_SINK_HH
23 |
24 | #ifndef _VIDEO_RTP_SINK_HH
25 | #include "VideoRTPSink.hh"
26 | #endif
27 |
28 | class VP9VideoRTPSink: public VideoRTPSink {
29 | public:
30 | static VP9VideoRTPSink* createNew(UsageEnvironment& env, Groupsock* RTPgs, unsigned char rtpPayloadFormat);
31 |
32 | protected:
33 | VP9VideoRTPSink(UsageEnvironment& env, Groupsock* RTPgs, unsigned char rtpPayloadFormat);
34 | // called only by createNew()
35 |
36 | virtual ~VP9VideoRTPSink();
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 |
--------------------------------------------------------------------------------
/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-2016 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 |
--------------------------------------------------------------------------------
/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-2016 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 |
--------------------------------------------------------------------------------
/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-2016 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 |
--------------------------------------------------------------------------------
/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-2016 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 |
--------------------------------------------------------------------------------
/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-2016 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 |
--------------------------------------------------------------------------------
/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-2016 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 |
--------------------------------------------------------------------------------
/liveMedia/include/H265VideoFileSink.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-2016 Live Networks, Inc. All rights reserved.
18 | // H.265 Video File Sinks
19 | // C++ header
20 |
21 | #ifndef _H265_VIDEO_FILE_SINK_HH
22 | #define _H265_VIDEO_FILE_SINK_HH
23 |
24 | #ifndef _H264_OR_5_VIDEO_FILE_SINK_HH
25 | #include "H264or5VideoFileSink.hh"
26 | #endif
27 |
28 | class H265VideoFileSink: public H264or5VideoFileSink {
29 | public:
30 | static H265VideoFileSink* createNew(UsageEnvironment& env, char const* fileName,
31 | char const* sPropVPSStr = NULL,
32 | char const* sPropSPSStr = NULL,
33 | char const* sPropPPSStr = NULL,
34 | // The "sProp*Str" parameters are optional 'SDP format' strings
35 | // (comma-separated Base64-encoded) representing VPS, SPS, and/or PPS NAL-units
36 | // to prepend to the output
37 | unsigned bufferSize = 100000,
38 | Boolean oneFilePerFrame = False);
39 | // See "FileSink.hh" for a description of these parameters.
40 |
41 | protected:
42 | H265VideoFileSink(UsageEnvironment& env, FILE* fid,
43 | char const* sPropVPSStr,
44 | char const* sPropSPSStr,
45 | char const* sPropPPSStr,
46 | unsigned bufferSize, char const* perFrameFileNamePrefix);
47 | // called only by createNew()
48 | virtual ~H265VideoFileSink();
49 | };
50 |
51 | #endif
52 |
--------------------------------------------------------------------------------
/groupsock/src/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-2016 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 |
--------------------------------------------------------------------------------
/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-2016 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 |
--------------------------------------------------------------------------------
/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-2016 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 isH265VideoStreamFramer() const;
45 | virtual Boolean isDVVideoStreamFramer() const;
46 | virtual Boolean isJPEGVideoSource() const;
47 | virtual Boolean isAMRAudioSource() const;
48 |
49 | protected:
50 | MediaSource(UsageEnvironment& env); // abstract base class
51 | virtual ~MediaSource();
52 |
53 | private:
54 | // redefined virtual functions:
55 | virtual Boolean isSource() const;
56 | };
57 |
58 | #endif
59 |
--------------------------------------------------------------------------------
/liveMedia/src/OggFileServerMediaSubsession.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-2016 Live Networks, Inc. All rights reserved.
18 | // A 'ServerMediaSubsession' object that creates new, unicast, "RTPSink"s
19 | // on demand, from a track within an Ogg file.
20 | // C++ header
21 |
22 | #ifndef _OGG_FILE_SERVER_MEDIA_SUBSESSION_HH
23 | #define _OGG_FILE_SERVER_MEDIA_SUBSESSION_HH
24 |
25 | #ifndef _FILE_SERVER_MEDIA_SUBSESSION_HH
26 | #include "FileServerMediaSubsession.hh"
27 | #endif
28 | #ifndef _OGG_FILE_SERVER_DEMUX_HH
29 | #include "OggFileServerDemux.hh"
30 | #endif
31 |
32 | class OggFileServerMediaSubsession: public FileServerMediaSubsession {
33 | public:
34 | static OggFileServerMediaSubsession*
35 | createNew(OggFileServerDemux& demux, OggTrack* track);
36 |
37 | protected:
38 | OggFileServerMediaSubsession(OggFileServerDemux& demux, OggTrack* track);
39 | // called only by createNew(), or by subclass constructors
40 | virtual ~OggFileServerMediaSubsession();
41 |
42 | protected: // redefined virtual functions
43 | virtual FramedSource* createNewStreamSource(unsigned clientSessionId,
44 | unsigned& estBitrate);
45 | virtual RTPSink* createNewRTPSink(Groupsock* rtpGroupsock, unsigned char rtpPayloadTypeIfDynamic, FramedSource* inputSource);
46 |
47 | protected:
48 | OggFileServerDemux& fOurDemux;
49 | OggTrack* fTrack;
50 | unsigned fNumFiltersInFrontOfTrack;
51 | };
52 |
53 | #endif
54 |
--------------------------------------------------------------------------------
/groupsock/include/GroupEId.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 | // "multikit" Multicast Application Shell
17 | // Copyright (c) 1996-2016, Live Networks, Inc. All rights reserved
18 | // "Group Endpoint Id"
19 | // C++ header
20 |
21 | #ifndef _GROUPEID_HH
22 | #define _GROUPEID_HH
23 |
24 | #ifndef _BOOLEAN_HH
25 | #include "Boolean.hh"
26 | #endif
27 |
28 | #ifndef _NET_ADDRESS_HH
29 | #include "NetAddress.hh"
30 | #endif
31 |
32 | class GroupEId {
33 | public:
34 | GroupEId(struct in_addr const& groupAddr,
35 | portNumBits portNum, u_int8_t ttl);
36 | // used for a 'source-independent multicast' group
37 | GroupEId(struct in_addr const& groupAddr,
38 | struct in_addr const& sourceFilterAddr,
39 | portNumBits portNum);
40 | // used for a 'source-specific multicast' group
41 |
42 | struct in_addr const& groupAddress() const { return fGroupAddress; }
43 | struct in_addr const& sourceFilterAddress() const { return fSourceFilterAddress; }
44 |
45 | Boolean isSSM() const;
46 |
47 | portNumBits portNum() const { return fPortNum; }
48 |
49 | u_int8_t ttl() const { return fTTL; }
50 |
51 | private:
52 | void init(struct in_addr const& groupAddr,
53 | struct in_addr const& sourceFilterAddr,
54 | portNumBits portNum,
55 | u_int8_t ttl);
56 |
57 | private:
58 | struct in_addr fGroupAddress;
59 | struct in_addr fSourceFilterAddress;
60 | portNumBits fPortNum; // in network byte order
61 | u_int8_t fTTL;
62 | };
63 |
64 | #endif
65 |
--------------------------------------------------------------------------------
/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-2016 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 |
--------------------------------------------------------------------------------
/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-2016 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 |
--------------------------------------------------------------------------------
/liveMedia/src/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-2016 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 |
--------------------------------------------------------------------------------
/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-2016 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 |
--------------------------------------------------------------------------------
/liveMedia/src/H264VideoFileSink.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-2016 Live Networks, Inc. All rights reserved.
18 | // H.264 Video File sinks
19 | // Implementation
20 |
21 | #include "H264VideoFileSink.hh"
22 | #include "OutputFile.hh"
23 |
24 | ////////// H264VideoFileSink //////////
25 |
26 | H264VideoFileSink
27 | ::H264VideoFileSink(UsageEnvironment& env, FILE* fid,
28 | char const* sPropParameterSetsStr,
29 | unsigned bufferSize, char const* perFrameFileNamePrefix)
30 | : H264or5VideoFileSink(env, fid, bufferSize, perFrameFileNamePrefix,
31 | sPropParameterSetsStr, NULL, NULL) {
32 | }
33 |
34 | H264VideoFileSink::~H264VideoFileSink() {
35 | }
36 |
37 | H264VideoFileSink*
38 | H264VideoFileSink::createNew(UsageEnvironment& env, char const* fileName,
39 | char const* sPropParameterSetsStr,
40 | unsigned bufferSize, Boolean oneFilePerFrame) {
41 | do {
42 | FILE* fid;
43 | char const* perFrameFileNamePrefix;
44 | if (oneFilePerFrame) {
45 | // Create the fid for each frame
46 | fid = NULL;
47 | perFrameFileNamePrefix = fileName;
48 | } else {
49 | // Normal case: create the fid once
50 | fid = OpenOutputFile(env, fileName);
51 | if (fid == NULL) break;
52 | perFrameFileNamePrefix = NULL;
53 | }
54 |
55 | return new H264VideoFileSink(env, fid, sPropParameterSetsStr, bufferSize, perFrameFileNamePrefix);
56 | } while (0);
57 |
58 | return NULL;
59 | }
60 |
--------------------------------------------------------------------------------
/liveMedia/src/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-2016 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 |
--------------------------------------------------------------------------------
/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-2016 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 |
--------------------------------------------------------------------------------
/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-2016 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 |
--------------------------------------------------------------------------------
/liveMedia/src/OggDemuxedTrack.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-2016 Live Networks, Inc. All rights reserved.
18 | // A media track, demultiplexed from an Ogg file
19 | // C++ header
20 |
21 | #ifndef _OGG_DEMUXED_TRACK_HH
22 | #define _OGG_DEMUXED_TRACK_HH
23 |
24 | #ifndef _FRAMED_SOURCE_HH
25 | #include "FramedSource.hh"
26 | #endif
27 |
28 | class OggDemux; // forward
29 |
30 | class OggDemuxedTrack: public FramedSource {
31 | private: // We are created only by a OggDemux (a friend)
32 | friend class OggDemux;
33 | OggDemuxedTrack(UsageEnvironment& env, unsigned trackNumber, OggDemux& sourceDemux);
34 | virtual ~OggDemuxedTrack();
35 |
36 | private:
37 | // redefined virtual functions:
38 | virtual void doGetNextFrame();
39 | virtual char const* MIMEtype() const;
40 |
41 | private: // We are accessed only by OggDemux and by OggFileParser (a friend)
42 | friend class OggFileParser;
43 | unsigned char*& to() { return fTo; }
44 | unsigned& maxSize() { return fMaxSize; }
45 | unsigned& frameSize() { return fFrameSize; }
46 | unsigned& numTruncatedBytes() { return fNumTruncatedBytes; }
47 | struct timeval& presentationTime() { return fPresentationTime; }
48 | unsigned& durationInMicroseconds() { return fDurationInMicroseconds; }
49 | struct timeval& nextPresentationTime() { return fNextPresentationTime; }
50 |
51 | private:
52 | unsigned fOurTrackNumber;
53 | OggDemux& fOurSourceDemux;
54 | Boolean fCurrentPageIsContinuation;
55 | struct timeval fNextPresentationTime;
56 | };
57 |
58 | #endif
59 |
--------------------------------------------------------------------------------
/UsageEnvironment/src/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-2016 Live Networks, Inc. All rights reserved.
17 | // Usage Environment
18 | // Implementation
19 |
20 | #include "UsageEnvironment.hh"
21 |
22 | Boolean UsageEnvironment::reclaim() {
23 | // We delete ourselves only if we have no remainining state:
24 | if (liveMediaPriv == NULL && groupsockPriv == NULL) {
25 | delete this;
26 | return True;
27 | }
28 |
29 | return False;
30 | }
31 |
32 | UsageEnvironment::UsageEnvironment(TaskScheduler& scheduler)
33 | : liveMediaPriv(NULL), groupsockPriv(NULL), fScheduler(scheduler) {
34 | }
35 |
36 | UsageEnvironment::~UsageEnvironment() {
37 | }
38 |
39 | // By default, we handle 'should not occur'-type library errors by calling abort(). Subclasses can redefine this, if desired.
40 | // (If your runtime library doesn't define the "abort()" function, then define your own (e.g., that does nothing).)
41 | void UsageEnvironment::internalError() {
42 | abort();
43 | }
44 |
45 |
46 | TaskScheduler::TaskScheduler() {
47 | }
48 |
49 | TaskScheduler::~TaskScheduler() {
50 | }
51 |
52 | void TaskScheduler::rescheduleDelayedTask(TaskToken& task,
53 | int64_t microseconds, TaskFunc* proc,
54 | void* clientData) {
55 | unscheduleDelayedTask(task);
56 | task = scheduleDelayedTask(microseconds, proc, clientData);
57 | }
58 |
59 | // By default, we handle 'should not occur'-type library errors by calling abort(). Subclasses can redefine this, if desired.
60 | void TaskScheduler::internalError() {
61 | abort();
62 | }
63 |
--------------------------------------------------------------------------------
/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-2016 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 |
--------------------------------------------------------------------------------
/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-2016 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 |
--------------------------------------------------------------------------------
/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-2016 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 |
--------------------------------------------------------------------------------
/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-2016 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 |
--------------------------------------------------------------------------------
/BasicUsageEnvironment/BasicUsageEnvironment.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hh;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 |
18 |
19 | Source Files
20 |
21 |
22 | Source Files
23 |
24 |
25 | Source Files
26 |
27 |
28 | Source Files
29 |
30 |
31 | Source Files
32 |
33 |
34 | Source Files
35 |
36 |
37 |
38 |
39 | Header Files
40 |
41 |
42 | Header Files
43 |
44 |
45 | Header Files
46 |
47 |
48 | Header Files
49 |
50 |
51 | Header Files
52 |
53 |
54 | Header Files
55 |
56 |
57 |
--------------------------------------------------------------------------------
/liveMedia/src/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-2016 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 |
--------------------------------------------------------------------------------
/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-2016 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 |
--------------------------------------------------------------------------------
/openRTSP/include/playCommon.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-2016, Live Networks, Inc. All rights reserved
17 | // A common framework, used for the "openRTSP" and "playSIP" applications
18 | // Interfaces
19 |
20 | #include "liveMedia.hh"
21 |
22 | extern Medium* createClient(UsageEnvironment& env, char const* URL, int verbosityLevel, char const* applicationName);
23 | extern void assignClient(Medium* client);
24 | extern RTSPClient* ourRTSPClient;
25 | extern SIPClient* ourSIPClient;
26 |
27 | extern void getOptions(RTSPClient::responseHandler* afterFunc);
28 |
29 | extern void getSDPDescription(RTSPClient::responseHandler* afterFunc);
30 |
31 | extern void setupSubsession(MediaSubsession* subsession, Boolean streamUsingTCP, Boolean forceMulticastOnUnspecified, RTSPClient::responseHandler* afterFunc);
32 |
33 | extern void startPlayingSession(MediaSession* session, double start, double end, float scale, RTSPClient::responseHandler* afterFunc);
34 |
35 | extern void startPlayingSession(MediaSession* session, char const* absStartTime, char const* absEndTime, float scale, RTSPClient::responseHandler* afterFunc);
36 | // For playing by 'absolute' time (using strings of the form "YYYYMMDDTHHMMSSZ" or "YYYYMMDDTHHMMSS.Z"
37 |
38 | extern void tearDownSession(MediaSession* session, RTSPClient::responseHandler* afterFunc);
39 |
40 | extern void setUserAgentString(char const* userAgentString);
41 |
42 | extern Authenticator* ourAuthenticator;
43 | extern Boolean allowProxyServers;
44 | extern Boolean controlConnectionUsesTCP;
45 | extern Boolean supportCodecSelection;
46 | extern char const* clientProtocolName;
47 | extern unsigned statusCode;
48 |
--------------------------------------------------------------------------------
/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-2016 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 |
--------------------------------------------------------------------------------
/liveMedia/src/H265VideoFileSink.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-2016 Live Networks, Inc. All rights reserved.
18 | // H.265 Video File sinks
19 | // Implementation
20 |
21 | #include "H265VideoFileSink.hh"
22 | #include "OutputFile.hh"
23 |
24 | ////////// H265VideoFileSink //////////
25 |
26 | H265VideoFileSink
27 | ::H265VideoFileSink(UsageEnvironment& env, FILE* fid,
28 | char const* sPropVPSStr,
29 | char const* sPropSPSStr,
30 | char const* sPropPPSStr,
31 | unsigned bufferSize, char const* perFrameFileNamePrefix)
32 | : H264or5VideoFileSink(env, fid, bufferSize, perFrameFileNamePrefix,
33 | sPropVPSStr, sPropSPSStr, sPropPPSStr) {
34 | }
35 |
36 | H265VideoFileSink::~H265VideoFileSink() {
37 | }
38 |
39 | H265VideoFileSink*
40 | H265VideoFileSink::createNew(UsageEnvironment& env, char const* fileName,
41 | char const* sPropVPSStr,
42 | char const* sPropSPSStr,
43 | char const* sPropPPSStr,
44 | unsigned bufferSize, Boolean oneFilePerFrame) {
45 | do {
46 | FILE* fid;
47 | char const* perFrameFileNamePrefix;
48 | if (oneFilePerFrame) {
49 | // Create the fid for each frame
50 | fid = NULL;
51 | perFrameFileNamePrefix = fileName;
52 | } else {
53 | // Normal case: create the fid once
54 | fid = OpenOutputFile(env, fileName);
55 | if (fid == NULL) break;
56 | perFrameFileNamePrefix = NULL;
57 | }
58 |
59 | return new H265VideoFileSink(env, fid, sPropVPSStr, sPropSPSStr, sPropPPSStr, bufferSize, perFrameFileNamePrefix);
60 | } while (0);
61 |
62 | return NULL;
63 | }
64 |
--------------------------------------------------------------------------------
/liveMedia/include/H264or5VideoStreamDiscreteFramer.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-2016 Live Networks, Inc. All rights reserved.
18 | // A simplified version of "H264or5VideoStreamFramer" 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 | // "H264or5VideoStreamFramer".
22 | // C++ header
23 |
24 | #ifndef _H264_OR_5_VIDEO_STREAM_DISCRETE_FRAMER_HH
25 | #define _H264_OR_5_VIDEO_STREAM_DISCRETE_FRAMER_HH
26 |
27 | #ifndef _H264_OR_5_VIDEO_STREAM_FRAMER_HH
28 | #include "H264or5VideoStreamFramer.hh"
29 | #endif
30 |
31 | class H264or5VideoStreamDiscreteFramer: public H264or5VideoStreamFramer {
32 | protected:
33 | H264or5VideoStreamDiscreteFramer(int hNumber, UsageEnvironment& env, FramedSource* inputSource);
34 | // we're an abstract base class
35 | virtual ~H264or5VideoStreamDiscreteFramer();
36 |
37 | protected:
38 | // redefined virtual functions:
39 | virtual void doGetNextFrame();
40 |
41 | protected:
42 | static void afterGettingFrame(void* clientData, unsigned frameSize,
43 | unsigned numTruncatedBytes,
44 | struct timeval presentationTime,
45 | unsigned durationInMicroseconds);
46 | void afterGettingFrame1(unsigned frameSize,
47 | unsigned numTruncatedBytes,
48 | struct timeval presentationTime,
49 | unsigned durationInMicroseconds);
50 |
51 | virtual Boolean nalUnitEndsAccessUnit(u_int8_t nal_unit_type);
52 | };
53 |
54 | #endif
55 |
--------------------------------------------------------------------------------
/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-2016 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 void setStreamSourceDuration(FramedSource* inputSource, double streamDuration, u_int64_t& numBytes);
43 | virtual FramedSource* createNewStreamSource(unsigned clientSessionId, unsigned& estBitrate);
44 | virtual RTPSink* createNewRTPSink(Groupsock* rtpGroupsock, unsigned char rtpPayloadTypeIfDynamic, FramedSource* inputSource);
45 | virtual float duration() const;
46 |
47 | private:
48 | float fFileDuration; // in seconds
49 | };
50 |
51 | #endif
52 |
--------------------------------------------------------------------------------
/liveMedia/src/MatroskaFileServerMediaSubsession.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-2016 Live Networks, Inc. All rights reserved.
18 | // A 'ServerMediaSubsession' object that creates new, unicast, "RTPSink"s
19 | // on demand, from a track within a Matroska file.
20 | // C++ header
21 |
22 | #ifndef _MATROSKA_FILE_SERVER_MEDIA_SUBSESSION_HH
23 | #define _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 MatroskaFileServerMediaSubsession: public FileServerMediaSubsession {
33 | public:
34 | static MatroskaFileServerMediaSubsession*
35 | createNew(MatroskaFileServerDemux& demux, MatroskaTrack* track);
36 |
37 | protected:
38 | MatroskaFileServerMediaSubsession(MatroskaFileServerDemux& demux, MatroskaTrack* track);
39 | // called only by createNew(), or by subclass constructors
40 | virtual ~MatroskaFileServerMediaSubsession();
41 |
42 | protected: // 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 | protected:
50 | MatroskaFileServerDemux& fOurDemux;
51 | MatroskaTrack* fTrack;
52 | unsigned fNumFiltersInFrontOfTrack;
53 | };
54 |
55 | #endif
56 |
--------------------------------------------------------------------------------
/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-2016 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 |
--------------------------------------------------------------------------------
/liveMedia/src/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-2016 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 |
--------------------------------------------------------------------------------
/liveMedia/src/OggFileServerMediaSubsession.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-2016 Live Networks, Inc. All rights reserved.
18 | // A 'ServerMediaSubsession' object that creates new, unicast, "RTPSink"s
19 | // on demand, from a track within an Ogg file.
20 | // Implementation
21 |
22 | #include "OggFileServerMediaSubsession.hh"
23 | #include "OggDemuxedTrack.hh"
24 | #include "FramedFilter.hh"
25 |
26 | OggFileServerMediaSubsession* OggFileServerMediaSubsession
27 | ::createNew(OggFileServerDemux& demux, OggTrack* track) {
28 | return new OggFileServerMediaSubsession(demux, track);
29 | }
30 |
31 | OggFileServerMediaSubsession
32 | ::OggFileServerMediaSubsession(OggFileServerDemux& demux, OggTrack* track)
33 | : FileServerMediaSubsession(demux.envir(), demux.fileName(), False),
34 | fOurDemux(demux), fTrack(track), fNumFiltersInFrontOfTrack(0) {
35 | }
36 |
37 | OggFileServerMediaSubsession::~OggFileServerMediaSubsession() {
38 | }
39 |
40 | FramedSource* OggFileServerMediaSubsession
41 | ::createNewStreamSource(unsigned clientSessionId, unsigned& estBitrate) {
42 | FramedSource* baseSource = fOurDemux.newDemuxedTrack(clientSessionId, fTrack->trackNumber);
43 | if (baseSource == NULL) return NULL;
44 |
45 | return fOurDemux.ourOggFile()
46 | ->createSourceForStreaming(baseSource, fTrack->trackNumber,
47 | estBitrate, fNumFiltersInFrontOfTrack);
48 | }
49 |
50 | RTPSink* OggFileServerMediaSubsession
51 | ::createNewRTPSink(Groupsock* rtpGroupsock, unsigned char rtpPayloadTypeIfDynamic, FramedSource* /*inputSource*/) {
52 | return fOurDemux.ourOggFile()
53 | ->createRTPSinkForTrackNumber(fTrack->trackNumber, rtpGroupsock, rtpPayloadTypeIfDynamic);
54 | }
55 |
--------------------------------------------------------------------------------
/liveMedia/src/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-2016 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 |
--------------------------------------------------------------------------------
/liveMedia/src/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-2016 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 |
--------------------------------------------------------------------------------
/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-2016 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 |
--------------------------------------------------------------------------------
/liveMedia/include/H264or5VideoRTPSink.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-2016 Live Networks, Inc. All rights reserved.
18 | // RTP sink for H.264 or H.265 video
19 | // C++ header
20 |
21 | #ifndef _H264_OR_5_VIDEO_RTP_SINK_HH
22 | #define _H264_OR_5_VIDEO_RTP_SINK_HH
23 |
24 | #ifndef _VIDEO_RTP_SINK_HH
25 | #include "VideoRTPSink.hh"
26 | #endif
27 | #ifndef _FRAMED_FILTER_HH
28 | #include "FramedFilter.hh"
29 | #endif
30 |
31 | class H264or5VideoRTPSink: public VideoRTPSink {
32 | protected:
33 | H264or5VideoRTPSink(int hNumber, // 264 or 265
34 | UsageEnvironment& env, Groupsock* RTPgs, unsigned char rtpPayloadFormat,
35 | u_int8_t const* vps = NULL, unsigned vpsSize = 0,
36 | u_int8_t const* sps = NULL, unsigned spsSize = 0,
37 | u_int8_t const* pps = NULL, unsigned ppsSize = 0);
38 | // we're an abstrace base class
39 | virtual ~H264or5VideoRTPSink();
40 |
41 | private: // redefined virtual functions:
42 | virtual Boolean continuePlaying();
43 | virtual void doSpecialFrameHandling(unsigned fragmentationOffset,
44 | unsigned char* frameStart,
45 | unsigned numBytesInFrame,
46 | struct timeval framePresentationTime,
47 | unsigned numRemainingBytes);
48 | virtual Boolean frameCanAppearAfterPacketStart(unsigned char const* frameStart,
49 | unsigned numBytesInFrame) const;
50 |
51 | protected:
52 | int fHNumber;
53 | FramedFilter* fOurFragmenter;
54 | char* fFmtpSDPLine;
55 | u_int8_t* fVPS; unsigned fVPSSize;
56 | u_int8_t* fSPS; unsigned fSPSSize;
57 | u_int8_t* fPPS; unsigned fPPSSize;
58 | };
59 |
60 | #endif
61 |
--------------------------------------------------------------------------------