liveMedia/AC3AudioFileServerMediaSubsession.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-2014 Live Networks, Inc.  All rights reserved.
00018 // A 'ServerMediaSubsession' object that creates new, unicast, "RTPSink"s
00019 // on demand, from an AC3 audio file.
00020 // Implementation
00021 
00022 #include "AC3AudioFileServerMediaSubsession.hh"
00023 #include "ByteStreamFileSource.hh"
00024 #include "AC3AudioStreamFramer.hh"
00025 #include "AC3AudioRTPSink.hh"
00026 
00027 AC3AudioFileServerMediaSubsession*
00028 AC3AudioFileServerMediaSubsession::createNew(UsageEnvironment& env,
00029                                              char const* fileName,
00030                                              Boolean reuseFirstSource) {
00031   return new AC3AudioFileServerMediaSubsession(env, fileName, reuseFirstSource);
00032 }
00033 
00034 AC3AudioFileServerMediaSubsession
00035 ::AC3AudioFileServerMediaSubsession(UsageEnvironment& env,
00036                                     char const* fileName, Boolean reuseFirstSource)
00037   : FileServerMediaSubsession(env, fileName, reuseFirstSource) {
00038 }
00039 
00040 AC3AudioFileServerMediaSubsession::~AC3AudioFileServerMediaSubsession() {
00041 }
00042 
00043 FramedSource* AC3AudioFileServerMediaSubsession
00044 ::createNewStreamSource(unsigned /*clientSessionId*/, unsigned& estBitrate) {
00045   estBitrate = 48; // kbps, estimate
00046 
00047   ByteStreamFileSource* fileSource = ByteStreamFileSource::createNew(envir(), fFileName);
00048   if (fileSource == NULL) return NULL;
00049 
00050   return AC3AudioStreamFramer::createNew(envir(), fileSource);
00051 }
00052 
00053 RTPSink* AC3AudioFileServerMediaSubsession
00054 ::createNewRTPSink(Groupsock* rtpGroupsock,
00055                    unsigned char rtpPayloadTypeIfDynamic,
00056                    FramedSource* inputSource) {
00057   AC3AudioStreamFramer* audioSource = (AC3AudioStreamFramer*)inputSource;
00058   return AC3AudioRTPSink::createNew(envir(), rtpGroupsock,
00059                                     rtpPayloadTypeIfDynamic,
00060                                     audioSource->samplingRate());
00061 }

Generated on Wed Apr 23 16:11:59 2014 for live by  doxygen 1.5.2