liveMedia/H261VideoRTPSource.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 // H.261 Video RTP Sources
00019 // Implementation
00020 
00021 #include "H261VideoRTPSource.hh"
00022 
00023 H261VideoRTPSource*
00024 H261VideoRTPSource::createNew(UsageEnvironment& env, Groupsock* RTPgs,
00025                                   unsigned char rtpPayloadFormat,
00026                                   unsigned rtpTimestampFrequency) {
00027   return new H261VideoRTPSource(env, RTPgs, rtpPayloadFormat,
00028                                     rtpTimestampFrequency);
00029 }
00030 
00031 H261VideoRTPSource
00032 ::H261VideoRTPSource(UsageEnvironment& env, Groupsock* RTPgs,
00033                          unsigned char rtpPayloadFormat,
00034                          unsigned rtpTimestampFrequency)
00035   : MultiFramedRTPSource(env, RTPgs,
00036                          rtpPayloadFormat, rtpTimestampFrequency),
00037   fLastSpecialHeader(0) {
00038 }
00039 
00040 H261VideoRTPSource::~H261VideoRTPSource() {
00041 }
00042 
00043 Boolean H261VideoRTPSource
00044 ::processSpecialHeader(BufferedPacket* packet,
00045                        unsigned& resultSpecialHeaderSize) {
00046   // There's a 4-byte video-specific header
00047   if (packet->dataSize() < 4) return False;
00048 
00049   unsigned char* headerStart = packet->data();
00050   fLastSpecialHeader
00051     = (headerStart[0]<<24)|(headerStart[1]<<16)|(headerStart[2]<<8)|headerStart[3];
00052 
00053 #ifdef DELIVER_COMPLETE_FRAMES
00054   fCurrentPacketBeginsFrame = fCurrentPacketCompletesFrame;
00055   // whether the *previous* packet ended a frame
00056 
00057   // The RTP "M" (marker) bit indicates the last fragment of a frame:
00058   fCurrentPacketCompletesFrame = packet->rtpMarkerBit();
00059 #endif
00060 
00061   resultSpecialHeaderSize = 4;
00062   return True;
00063 }
00064 
00065 char const* H261VideoRTPSource::MIMEtype() const {
00066   return "video/H261";
00067 }

Generated on Tue Mar 25 14:35:34 2014 for live by  doxygen 1.5.2