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 | // MP4V-ES video RTP stream sources |
19 | // Implementation |
20 | |
21 | #include "MPEG4ESVideoRTPSource.hh" |
22 | |
23 | ///////// MPEG4ESVideoRTPSource implementation //////// |
24 | |
25 | //##### NOTE: INCOMPLETE!!! ##### |
26 | |
27 | MPEG4ESVideoRTPSource* |
28 | MPEG4ESVideoRTPSource::createNew(UsageEnvironment& env, Groupsock* RTPgs, |
29 | unsigned char rtpPayloadFormat, |
30 | unsigned rtpTimestampFrequency) { |
31 | return new MPEG4ESVideoRTPSource(env, RTPgs, rtpPayloadFormat, |
32 | rtpTimestampFrequency); |
33 | } |
34 | |
35 | MPEG4ESVideoRTPSource |
36 | ::MPEG4ESVideoRTPSource(UsageEnvironment& env, Groupsock* RTPgs, |
37 | unsigned char rtpPayloadFormat, |
38 | unsigned rtpTimestampFrequency) |
39 | : MultiFramedRTPSource(env, RTPgs, |
40 | rtpPayloadFormat, rtpTimestampFrequency) { |
41 | } |
42 | |
43 | MPEG4ESVideoRTPSource::~MPEG4ESVideoRTPSource() { |
44 | } |
45 | |
46 | Boolean MPEG4ESVideoRTPSource |
47 | ::(BufferedPacket* packet, |
48 | unsigned& ) { |
49 | // The packet begins a frame iff its data begins with a system code |
50 | // (i.e., 0x000001??) |
51 | fCurrentPacketBeginsFrame |
52 | = packet->dataSize() >= 4 && (packet->data())[0] == 0 |
53 | && (packet->data())[1] == 0 && (packet->data())[2] == 1; |
54 | |
55 | // The RTP "M" (marker) bit indicates the last fragment of a frame: |
56 | fCurrentPacketCompletesFrame = packet->rtpMarkerBit(); |
57 | |
58 | // There is no special header |
59 | resultSpecialHeaderSize = 0; |
60 | return True; |
61 | } |
62 | |
63 | char const* MPEG4ESVideoRTPSource::MIMEtype() const { |
64 | return "video/MP4V-ES" ; |
65 | } |
66 | |