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// MPEG-1 or MPEG-2 Audio RTP Sources
19// Implementation
20
21#include "MPEG1or2AudioRTPSource.hh"
22
23MPEG1or2AudioRTPSource*
24MPEG1or2AudioRTPSource::createNew(UsageEnvironment& env,
25 Groupsock* RTPgs,
26 unsigned char rtpPayloadFormat,
27 unsigned rtpTimestampFrequency) {
28 return new MPEG1or2AudioRTPSource(env, RTPgs, rtpPayloadFormat,
29 rtpTimestampFrequency);
30}
31
32MPEG1or2AudioRTPSource::MPEG1or2AudioRTPSource(UsageEnvironment& env,
33 Groupsock* rtpGS,
34 unsigned char rtpPayloadFormat,
35 unsigned rtpTimestampFrequency)
36 : MultiFramedRTPSource(env, rtpGS,
37 rtpPayloadFormat, rtpTimestampFrequency) {
38}
39
40MPEG1or2AudioRTPSource::~MPEG1or2AudioRTPSource() {
41}
42
43Boolean MPEG1or2AudioRTPSource
44::processSpecialHeader(BufferedPacket* packet,
45 unsigned& resultSpecialHeaderSize) {
46 // There's a 4-byte header indicating fragmentation.
47 if (packet->dataSize() < 4) return False;
48
49 // Note: This fragmentation header is actually useless to us, because
50 // it doesn't tell us whether or not this RTP packet *ends* a
51 // fragmented frame. Thus, we can't use it to properly set
52 // "fCurrentPacketCompletesFrame". Instead, we assume that even
53 // a partial audio frame will be usable to clients.
54
55 resultSpecialHeaderSize = 4;
56 return True;
57}
58
59char const* MPEG1or2AudioRTPSource::MIMEtype() const {
60 return "audio/MPEG";
61}
62
63