|
MythTV
0.25-pre
|
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 // AC3 Audio RTP Sources 00019 // Implementation 00020 00021 #include "AC3AudioRTPSource.hh" 00022 00023 AC3AudioRTPSource* 00024 AC3AudioRTPSource::createNew(UsageEnvironment& env, 00025 Groupsock* RTPgs, 00026 unsigned char rtpPayloadFormat, 00027 unsigned rtpTimestampFrequency) { 00028 return new AC3AudioRTPSource(env, RTPgs, rtpPayloadFormat, 00029 rtpTimestampFrequency); 00030 } 00031 00032 AC3AudioRTPSource::AC3AudioRTPSource(UsageEnvironment& env, 00033 Groupsock* rtpGS, 00034 unsigned char rtpPayloadFormat, 00035 unsigned rtpTimestampFrequency) 00036 : MultiFramedRTPSource(env, rtpGS, 00037 rtpPayloadFormat, rtpTimestampFrequency) { 00038 } 00039 00040 AC3AudioRTPSource::~AC3AudioRTPSource() { 00041 } 00042 00043 Boolean AC3AudioRTPSource 00044 ::processSpecialHeader(BufferedPacket* packet, 00045 unsigned& resultSpecialHeaderSize) { 00046 unsigned char* headerStart = packet->data(); 00047 unsigned packetSize = packet->dataSize(); 00048 00049 // There's a 1-byte "NDU" header, containing the number of frames 00050 // present in this RTP packet. 00051 if (packetSize < 2) return False; 00052 unsigned char numFrames = headerStart[0]; 00053 if (numFrames == 0) return False; 00054 00055 // TEMP: We can't currently handle packets containing > 1 frame ##### 00056 if (numFrames > 1) { 00057 envir() << "AC3AudioRTPSource::processSpecialHeader(): packet contains " 00058 << numFrames << " frames (we can't handle this!)\n"; 00059 return False; 00060 } 00061 00062 // We current can't handle packets that consist only of redundant data: 00063 unsigned char typ_field = headerStart[1] >> 6; 00064 if (typ_field >= 2) return False; 00065 00066 fCurrentPacketBeginsFrame = fCurrentPacketCompletesFrame; 00067 // whether the *previous* packet ended a frame 00068 00069 // The RTP "M" (marker) bit indicates the last fragment of a frame: 00070 fCurrentPacketCompletesFrame = packet->rtpMarkerBit(); 00071 00072 resultSpecialHeaderSize = 2; 00073 return True; 00074 } 00075 00076 char const* AC3AudioRTPSource::MIMEtype() const { 00077 return "audio/AC3"; 00078 } 00079
1.7.6.1