1 | /********** |
2 | This library is free software; you can redistribute it and/or modify it under |
3 | the terms of the GNU Lesser General Public License as published by the |
4 | Free Software Foundation; either version 3 of the License, or (at your |
5 | option) any later version. (See <http://www.gnu.org/copyleft/lesser.html>.) |
6 | |
7 | This library is distributed in the hope that it will be useful, but WITHOUT |
8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for |
10 | more details. |
11 | |
12 | You should have received a copy of the GNU Lesser General Public License |
13 | along with this library; if not, write to the Free Software Foundation, Inc., |
14 | 51 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 | |
23 | H261VideoRTPSource* |
24 | H261VideoRTPSource::createNew(UsageEnvironment& env, Groupsock* RTPgs, |
25 | unsigned char rtpPayloadFormat, |
26 | unsigned rtpTimestampFrequency) { |
27 | return new H261VideoRTPSource(env, RTPgs, rtpPayloadFormat, |
28 | rtpTimestampFrequency); |
29 | } |
30 | |
31 | H261VideoRTPSource |
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 | |
40 | H261VideoRTPSource::~H261VideoRTPSource() { |
41 | } |
42 | |
43 | Boolean H261VideoRTPSource |
44 | ::(BufferedPacket* packet, |
45 | unsigned& ) { |
46 | // There's a 4-byte video-specific header |
47 | if (packet->dataSize() < 4) return False; |
48 | |
49 | unsigned char* = 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 | |
65 | char const* H261VideoRTPSource::MIMEtype() const { |
66 | return "video/H261" ; |
67 | } |
68 | |