liveMedia/MPEG1or2VideoFileServerMediaSubsession.cpp

Go to the documentation of this file.
00001 /**********
00002 This library is free software; you can redistribute it and/or modify it under
00003 the terms of the GNU Lesser General Public License as published by the
00004 Free Software Foundation; either version 2.1 of the License, or (at your
00005 option) any later version. (See <http://www.gnu.org/copyleft/lesser.html>.)
00006 
00007 This library is distributed in the hope that it will be useful, but WITHOUT
00008 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00009 FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for
00010 more details.
00011 
00012 You should have received a copy of the GNU Lesser General Public License
00013 along with this library; if not, write to the Free Software Foundation, Inc.,
00014 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
00015 **********/
00016 // "liveMedia"
00017 // Copyright (c) 1996-2013 Live Networks, Inc.  All rights reserved.
00018 // A 'ServerMediaSubsession' object that creates new, unicast, "RTPSink"s
00019 // on demand, from a MPEG-1 or 2 Elementary Stream video file.
00020 // Implementation
00021 
00022 #include "MPEG1or2VideoFileServerMediaSubsession.hh"
00023 #include "MPEG1or2VideoRTPSink.hh"
00024 #include "ByteStreamFileSource.hh"
00025 #include "MPEG1or2VideoStreamFramer.hh"
00026 
00027 MPEG1or2VideoFileServerMediaSubsession*
00028 MPEG1or2VideoFileServerMediaSubsession::createNew(UsageEnvironment& env,
00029                                                   char const* fileName,
00030                                                   Boolean reuseFirstSource,
00031                                                   Boolean iFramesOnly,
00032                                                   double vshPeriod) {
00033   return new MPEG1or2VideoFileServerMediaSubsession(env, fileName, reuseFirstSource,
00034                                                     iFramesOnly, vshPeriod);
00035 }
00036 
00037 MPEG1or2VideoFileServerMediaSubsession
00038 ::MPEG1or2VideoFileServerMediaSubsession(UsageEnvironment& env,
00039                                          char const* fileName,
00040                                          Boolean reuseFirstSource,
00041                                          Boolean iFramesOnly,
00042                                          double vshPeriod)
00043   : FileServerMediaSubsession(env, fileName, reuseFirstSource),
00044     fIFramesOnly(iFramesOnly), fVSHPeriod(vshPeriod) {
00045 }
00046 
00047 MPEG1or2VideoFileServerMediaSubsession
00048 ::~MPEG1or2VideoFileServerMediaSubsession() {
00049 }
00050 
00051 FramedSource* MPEG1or2VideoFileServerMediaSubsession
00052 ::createNewStreamSource(unsigned /*clientSessionId*/, unsigned& estBitrate) {
00053   estBitrate = 500; // kbps, estimate
00054 
00055   ByteStreamFileSource* fileSource
00056     = ByteStreamFileSource::createNew(envir(), fFileName);
00057   if (fileSource == NULL) return NULL;
00058   fFileSize = fileSource->fileSize();
00059 
00060   return MPEG1or2VideoStreamFramer
00061     ::createNew(envir(), fileSource, fIFramesOnly, fVSHPeriod);
00062 }
00063 
00064 RTPSink* MPEG1or2VideoFileServerMediaSubsession
00065 ::createNewRTPSink(Groupsock* rtpGroupsock,
00066                    unsigned char /*rtpPayloadTypeIfDynamic*/,
00067                    FramedSource* /*inputSource*/) {
00068   return MPEG1or2VideoRTPSink::createNew(envir(), rtpGroupsock);
00069 }

Generated on Mon Apr 29 13:28:02 2013 for live by  doxygen 1.5.2