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 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00015 **********/ 00016 // "liveMedia" 00017 // Copyright (c) 1996-2005 Live Networks, Inc. All rights reserved. 00018 // MPEG-1 or MPEG-2 Audio RTP Sources 00019 // Implementation 00020 00021 #include "MPEG1or2AudioRTPSource.hh" 00022 00023 MPEG1or2AudioRTPSource* 00024 MPEG1or2AudioRTPSource::createNew(UsageEnvironment& env, 00025 Groupsock* RTPgs, 00026 unsigned char rtpPayloadFormat, 00027 unsigned rtpTimestampFrequency) { 00028 return new MPEG1or2AudioRTPSource(env, RTPgs, rtpPayloadFormat, 00029 rtpTimestampFrequency); 00030 } 00031 00032 MPEG1or2AudioRTPSource::MPEG1or2AudioRTPSource(UsageEnvironment& env, 00033 Groupsock* rtpGS, 00034 unsigned char rtpPayloadFormat, 00035 unsigned rtpTimestampFrequency) 00036 : MultiFramedRTPSource(env, rtpGS, 00037 rtpPayloadFormat, rtpTimestampFrequency) { 00038 } 00039 00040 MPEG1or2AudioRTPSource::~MPEG1or2AudioRTPSource() { 00041 } 00042 00043 Boolean MPEG1or2AudioRTPSource 00044 ::processSpecialHeader(BufferedPacket* packet, 00045 unsigned& resultSpecialHeaderSize) { 00046 // There's a 4-byte header indicating fragmentation. 00047 if (packet->dataSize() < 4) return False; 00048 00049 // Note: This fragmentation header is actually useless to us, because 00050 // it doesn't tell us whether or not this RTP packet *ends* a 00051 // fragmented frame. Thus, we can't use it to properly set 00052 // "fCurrentPacketCompletesFrame". Instead, we assume that even 00053 // a partial audio frame will be usable to clients. 00054 00055 resultSpecialHeaderSize = 4; 00056 return True; 00057 } 00058 00059 char const* MPEG1or2AudioRTPSource::MIMEtype() const { 00060 return "audio/MPEG"; 00061 } 00062
1.6.3