MP4ReadRtpPacket man page
MP4ReadRtpPacket — Read an RTP packet
u_int32_t ssrc = 0,
bool includeHeader = true,
bool includePayload = true
Specifies the mp4 file to which the operation applies.
Specifies the hint track to which the operation applies.
Specifies which packet is to be read. Valid values range from zero to the number of packets in this hint minus one.
Pointer to variable that will be hold the number of packets in the hint.
Pointer to the pointer to the packet data. See Description for details on this argument.
Pointer to variable that will be hold the size in bytes of the packet.
Specifies the RTP SSRC to be used when constructing the RTP packet header.
Specifies whether the library should include the standard 12 byte RTP header to the returned packet. The header is constructed from the information in the hint sample and the specified ssrc.
Specifies whether the library should include the packet payload (RTP payload header and media data) in the returned packet.
Upon success, true (1). Upon an error, false (0).
MP4ReadRtpPacket reads the specified packet from the current hint sample, as previously read by MP4ReadRtpHint().
The argument, ppBytes, allows for two possible approaches for buffering:
If the calling application wishes to handle its own buffering it can set *ppBytes to the buffer it wishes to use. The calling application is responsible for ensuring that the buffer is large enough to hold the packet. This can be done by using MP4GetRtpPayload() to retrieve the maximum packet payload size and hence how large the receiving buffer must be. Caveat: the value returned by MP4GetRtpPayload is the maxiumum payload size, if the RTP packet header is going to be included by the library this value should be incremented by 12.
If the value of *ppBytes is NULL, then an appropriately sized buffer is automatically malloc'ed for the sample data and *ppBytes set to this pointer. The calling application is responsible for free'ing this memory.
The application is expected to provide the value of the RTP SSRC identifier which uniquely identifies the originator of the media stream. For most applications, a single random value can be provided. The value should be the same for all packets for the duration of the RTP transmission. If the parameter "includeHeader" is false, then this value has no effect.
By default the library constructs the standard 12 byte RTP header from the information in the hint sample, and the specified SSRC. It then concatenates the RTP header with the packet payload, that is the RTP payload specific header and the media data for the packet. The "includeHeader" and "includePayload" parameters allow control over these steps, so that either just the packet payloads or just the RTP headers can be returned. A potential use of this feature is if the calling application wishes to construct an extended RTP header with non-standard options.
MP4GetRtpPacketBFrame(3), MP4GetRtpPacketTransmitOffset(3), MP4ReadRtpHint(3).