1MP4(3) MP4 File Format Library MP4(3)
2
3
4
6 MP4ReadRtpPacket - Read an RTP packet
7
9 #include <mp4.h>
10
11 bool MP4ReadRtpPacket(
12 MP4FileHandle hFile,
13 MP4TrackId trackId,
14 u_int16_t packetIndex,
15 u_int8_t** ppBytes,
16 u_int32_t* pNumBytes,
17 u_int32_t ssrc = 0,
18 bool includeHeader = true,
19 bool includePayload = true
20 );
21
23 hFile Specifies the mp4 file to which the operation applies.
24
25 trackId
26 Specifies the hint track to which the operation applies.
27
28 packetIndex
29 Specifies which packet is to be read. Valid values range from
30 zero to the number of packets in this hint minus one.
31
32 pNumPackets
33 Pointer to variable that will be hold the number of packets in
34 the hint.
35
36 ppBytes
37 Pointer to the pointer to the packet data. See DESCRIPTION for
38 details on this argument.
39
40 pNumBytes
41 Pointer to variable that will be hold the size in bytes of the
42 packet.
43
44 ssrc Specifies the RTP SSRC to be used when constructing the RTP
45 packet header.
46
47 includeHeader
48 Specifies whether the library should include the standard 12
49 byte RTP header to the returned packet. The header is con‐
50 structed from the information in the hint sample and the speci‐
51 fied ssrc.
52
53 includePayload
54 Specifies whether the library should include the packet payload
55 (RTP payload header and media data) in the returned packet.
56
58 Upon success, true (1). Upon an error, false (0).
59
61 MP4ReadRtpPacket reads the specified packet from the current hint sam‐
62 ple, as previously read by MP4ReadRtpHint().
63
64 The argument, ppBytes, allows for two possible approaches for buffer‐
65 ing:
66
67 If the calling application wishes to handle its own buffering it can
68 set *ppBytes to the buffer it wishes to use. The calling application is
69 responsible for ensuring that the buffer is large enough to hold the
70 packet. This can be done by using MP4GetRtpPayload() to retrieve the
71 maximum packet payload size and hence how large the receiving buffer
72 must be. Caveat: the value returned by MP4GetRtpPayload is the maxiumum
73 payload size, if the RTP packet header is going to be included by the
74 library this value should be incremented by 12.
75
76 If the value of *ppBytes is NULL, then an appropriately sized buffer is
77 automatically malloc'ed for the sample data and *ppBytes set to this
78 pointer. The calling application is responsible for free'ing this mem‐
79 ory.
80
81 The application is expected to provide the value of the RTP SSRC iden‐
82 tifier which uniquely identifies the originator of the media stream.
83 For most applications, a single random value can be provided. The value
84 should be the same for all packets for the duration of the RTP trans‐
85 mission. If the parameter "includeHeader" is false, then this value has
86 no effect.
87
88 By default the library constructs the standard 12 byte RTP header from
89 the information in the hint sample, and the specified SSRC. It then
90 concatenates the RTP header with the packet payload, that is the RTP
91 payload specific header and the media data for the packet. The
92 "includeHeader" and "includePayload" parameters allow control over
93 these steps, so that either just the packet payloads or just the RTP
94 headers can be returned. A potential use of this feature is if the
95 calling application wishes to construct an extended RTP header with
96 non-standard options.
97
99 MP4(3) MP4ReadRtpHint(3)
100
101
102
103Cisco Systems Inc. Version 0.9 MP4(3)