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// DV Video RTP Sources
19// Implementation
20
21#include "DVVideoRTPSource.hh"
22
23DVVideoRTPSource*
24DVVideoRTPSource::createNew(UsageEnvironment& env,
25 Groupsock* RTPgs,
26 unsigned char rtpPayloadFormat,
27 unsigned rtpTimestampFrequency) {
28 return new DVVideoRTPSource(env, RTPgs, rtpPayloadFormat, rtpTimestampFrequency);
29}
30
31DVVideoRTPSource::DVVideoRTPSource(UsageEnvironment& env,
32 Groupsock* rtpGS,
33 unsigned char rtpPayloadFormat,
34 unsigned rtpTimestampFrequency)
35 : MultiFramedRTPSource(env, rtpGS,
36 rtpPayloadFormat, rtpTimestampFrequency) {
37}
38
39DVVideoRTPSource::~DVVideoRTPSource() {
40}
41
42#define DV_DIF_BLOCK_SIZE 80
43#define DV_SECTION_HEADER 0x1F
44
45Boolean DVVideoRTPSource
46::processSpecialHeader(BufferedPacket* packet,
47 unsigned& resultSpecialHeaderSize) {
48 unsigned const packetSize = packet->dataSize();
49 if (packetSize < DV_DIF_BLOCK_SIZE) return False; // TARFU!
50
51 u_int8_t const* data = packet->data();
52 fCurrentPacketBeginsFrame = data[0] == DV_SECTION_HEADER && (data[1]&0xf8) == 0 && data[2] == 0; // thanks to Ben Hutchings
53
54 // The RTP "M" (marker) bit indicates the last fragment of a frame:
55 fCurrentPacketCompletesFrame = packet->rtpMarkerBit();
56
57 // There is no special header
58 resultSpecialHeaderSize = 0;
59 return True;
60}
61
62char const* DVVideoRTPSource::MIMEtype() const {
63 return "video/DV";
64}
65
66