liveMedia/AC3AudioRTPSource.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 // 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 2-byte payload header at the beginning:
00050   if (packetSize < 2) return False;
00051   resultSpecialHeaderSize = 2;
00052 
00053   unsigned char FT = headerStart[0]&0x03;
00054   fCurrentPacketBeginsFrame = FT != 3;
00055 
00056   // The RTP "M" (marker) bit indicates the last fragment of a frame.
00057   // In case the sender did not set the "M" bit correctly, we also test for FT == 0:
00058   fCurrentPacketCompletesFrame = packet->rtpMarkerBit() || FT == 0;
00059 
00060   return True;
00061 }
00062 
00063 char const* AC3AudioRTPSource::MIMEtype() const {
00064   return "audio/AC3";
00065 }
00066 

Generated on Thu Feb 2 23:51:29 2012 for live by  doxygen 1.5.2