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 3 of the License, or (at your |
5 | option) any later version. (See <http://www.gnu.org/copyleft/lesser.html>.) |
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-2020 Live Networks, Inc. All rights reserved. |
18 | // A 'ServerMediaSubsession' object that creates new, unicast, "RTPSink"s |
19 | // on demand, from a H263 video file. |
20 | // Implementation |
21 | |
22 | // Author: Bernhard Feiten. // Based on MPEG4VideoFileServerMediaSubsession |
23 | // Updated by Ross FInlayson (December 2007) |
24 | |
25 | #include "H263plusVideoFileServerMediaSubsession.hh" |
26 | #include "H263plusVideoRTPSink.hh" |
27 | #include "ByteStreamFileSource.hh" |
28 | #include "H263plusVideoStreamFramer.hh" |
29 | |
30 | H263plusVideoFileServerMediaSubsession* |
31 | H263plusVideoFileServerMediaSubsession::createNew(UsageEnvironment& env, |
32 | char const* fileName, |
33 | Boolean reuseFirstSource) { |
34 | return new H263plusVideoFileServerMediaSubsession(env, fileName, reuseFirstSource); |
35 | } |
36 | |
37 | H263plusVideoFileServerMediaSubsession |
38 | ::H263plusVideoFileServerMediaSubsession(UsageEnvironment& env, |
39 | char const* fileName, |
40 | Boolean reuseFirstSource) |
41 | : FileServerMediaSubsession(env, fileName, reuseFirstSource) { |
42 | } |
43 | |
44 | H263plusVideoFileServerMediaSubsession::~H263plusVideoFileServerMediaSubsession() { |
45 | } |
46 | |
47 | FramedSource* H263plusVideoFileServerMediaSubsession |
48 | ::createNewStreamSource(unsigned /*clientSessionId*/, unsigned& estBitrate) { |
49 | estBitrate = 500; // kbps, estimate ?? |
50 | |
51 | // Create the video source: |
52 | ByteStreamFileSource* fileSource = ByteStreamFileSource::createNew(envir(), fFileName); |
53 | if (fileSource == NULL) return NULL; |
54 | fFileSize = fileSource->fileSize(); |
55 | |
56 | // Create a framer for the Video Elementary Stream: |
57 | return H263plusVideoStreamFramer::createNew(envir(), fileSource); |
58 | } |
59 | |
60 | RTPSink* H263plusVideoFileServerMediaSubsession::createNewRTPSink(Groupsock* rtpGroupsock, |
61 | unsigned char rtpPayloadTypeIfDynamic, |
62 | FramedSource* /*inputSource*/) { |
63 | return H263plusVideoRTPSink::createNew(envir(), rtpGroupsock, rtpPayloadTypeIfDynamic); |
64 | } |
65 | |