liveMedia/MP3AudioMatroskaFileServerMediaSubsession.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-2012 Live Networks, Inc.  All rights reserved.
00018 // A 'ServerMediaSubsession' object that creates new, unicast, "RTPSink"s
00019 // on demand, from an MP3 audio track within a Matroska file.
00020 // (Actually, MPEG-1 or MPEG-2 audio file should also work.)
00021 // Implementation
00022 
00023 #include "MP3AudioMatroskaFileServerMediaSubsession.hh"
00024 #include "MatroskaDemuxedTrack.hh"
00025 
00026 MP3AudioMatroskaFileServerMediaSubsession* MP3AudioMatroskaFileServerMediaSubsession
00027 ::createNew(MatroskaFileServerDemux& demux, unsigned trackNumber, Boolean generateADUs, Interleaving* interleaving) {
00028   return new MP3AudioMatroskaFileServerMediaSubsession(demux, trackNumber, generateADUs, interleaving);
00029 }
00030 
00031 MP3AudioMatroskaFileServerMediaSubsession
00032 ::MP3AudioMatroskaFileServerMediaSubsession(MatroskaFileServerDemux& demux, unsigned trackNumber,
00033                                             Boolean generateADUs, Interleaving* interleaving)
00034   : MP3AudioFileServerMediaSubsession(demux.envir(), demux.fileName(), False, generateADUs, interleaving),
00035     fOurDemux(demux), fTrackNumber(trackNumber) {
00036   fFileDuration = fOurDemux.fileDuration();
00037 }
00038 
00039 MP3AudioMatroskaFileServerMediaSubsession::~MP3AudioMatroskaFileServerMediaSubsession() {
00040 }
00041 
00042 void MP3AudioMatroskaFileServerMediaSubsession
00043 ::seekStreamSource(FramedSource* inputSource, double& seekNPT, double /*streamDuration*/, u_int64_t& /*numBytes*/) {
00044   FramedSource* sourceMP3Stream;
00045   ADUFromMP3Source* aduStream;
00046   getBaseStreams(inputSource, sourceMP3Stream, aduStream);
00047 
00048   if (aduStream != NULL) aduStream->resetInput(); // because we're about to seek within its source
00049   ((MatroskaDemuxedTrack*)sourceMP3Stream)->seekToTime(seekNPT);
00050 }
00051 
00052 FramedSource* MP3AudioMatroskaFileServerMediaSubsession
00053 ::createNewStreamSource(unsigned clientSessionId, unsigned& estBitrate) {
00054   FramedSource* baseMP3Source = fOurDemux.newDemuxedTrack(clientSessionId, fTrackNumber);
00055   return createNewStreamSourceCommon(baseMP3Source, 0, estBitrate);
00056 }

Generated on Thu May 17 07:11:46 2012 for live by  doxygen 1.5.2