1/**********
2This library is free software; you can redistribute it and/or modify it under
3the terms of the GNU Lesser General Public License as published by the
4Free Software Foundation; either version 3 of the License, or (at your
5option) any later version. (See <http://www.gnu.org/copyleft/lesser.html>.)
6
7This library is distributed in the hope that it will be useful, but WITHOUT
8ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
9FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
10more details.
11
12You should have received a copy of the GNU Lesser General Public License
13along with this library; if not, write to the Free Software Foundation, Inc.,
1451 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
15**********/
16// "liveMedia"
17// Copyright (c) 1996-2020 Live Networks, Inc. All rights reserved.
18// H.261 Video RTP Sources
19// Implementation
20
21#include "H261VideoRTPSource.hh"
22
23H261VideoRTPSource*
24H261VideoRTPSource::createNew(UsageEnvironment& env, Groupsock* RTPgs,
25 unsigned char rtpPayloadFormat,
26 unsigned rtpTimestampFrequency) {
27 return new H261VideoRTPSource(env, RTPgs, rtpPayloadFormat,
28 rtpTimestampFrequency);
29}
30
31H261VideoRTPSource
32::H261VideoRTPSource(UsageEnvironment& env, Groupsock* RTPgs,
33 unsigned char rtpPayloadFormat,
34 unsigned rtpTimestampFrequency)
35 : MultiFramedRTPSource(env, RTPgs,
36 rtpPayloadFormat, rtpTimestampFrequency),
37 fLastSpecialHeader(0) {
38}
39
40H261VideoRTPSource::~H261VideoRTPSource() {
41}
42
43Boolean H261VideoRTPSource
44::processSpecialHeader(BufferedPacket* packet,
45 unsigned& resultSpecialHeaderSize) {
46 // There's a 4-byte video-specific header
47 if (packet->dataSize() < 4) return False;
48
49 unsigned char* headerStart = packet->data();
50 fLastSpecialHeader
51 = (headerStart[0]<<24)|(headerStart[1]<<16)|(headerStart[2]<<8)|headerStart[3];
52
53#ifdef DELIVER_COMPLETE_FRAMES
54 fCurrentPacketBeginsFrame = fCurrentPacketCompletesFrame;
55 // whether the *previous* packet ended a frame
56
57 // The RTP "M" (marker) bit indicates the last fragment of a frame:
58 fCurrentPacketCompletesFrame = packet->rtpMarkerBit();
59#endif
60
61 resultSpecialHeaderSize = 4;
62 return True;
63}
64
65char const* H261VideoRTPSource::MIMEtype() const {
66 return "video/H261";
67}
68