libgpac
Documentation of the core library of GPAC
ISOBMFF RTP Hinting
+ Collaboration diagram for ISOBMFF RTP Hinting:

Enumerations

enum  GF_ISOHintFormat { GF_ISOM_HINT_RTP = GF_4CC('r', 't', 'p', ' ') }
 

Functions

GF_Err gf_isom_setup_hint_track (GF_ISOFile *isom_file, u32 trackNumber, GF_ISOHintFormat HintType)
 
GF_Err gf_isom_new_hint_description (GF_ISOFile *isom_file, u32 trackNumber, s32 HintTrackVersion, s32 LastCompatibleVersion, u8 Rely, u32 *HintDescriptionIndex)
 
GF_Err gf_isom_begin_hint_sample (GF_ISOFile *isom_file, u32 trackNumber, u32 HintDescriptionIndex, u32 TransmissionTime)
 
GF_Err gf_isom_end_hint_sample (GF_ISOFile *isom_file, u32 trackNumber, u8 IsRandomAccessPoint)
 
GF_Err gf_isom_hint_blank_data (GF_ISOFile *isom_file, u32 trackNumber, u8 AtBegin)
 
GF_Err gf_isom_hint_direct_data (GF_ISOFile *isom_file, u32 trackNumber, u8 *data, u32 dataLength, u8 AtBegin)
 
GF_Err gf_isom_hint_sample_data (GF_ISOFile *isom_file, u32 trackNumber, GF_ISOTrackID SourceTrackID, u32 SampleNumber, u16 DataLength, u32 offsetInSample, u8 *extra_data, u8 AtBegin)
 
GF_Err gf_isom_hint_sample_description_data (GF_ISOFile *isom_file, u32 trackNumber, GF_ISOTrackID SourceTrackID, u32 sampleDescriptionIndex, u16 DataLength, u32 offsetInDescription, u8 AtBegin)
 
GF_Err gf_isom_rtp_packet_begin (GF_ISOFile *isom_file, u32 trackNumber, s32 relativeTime, u8 PackingBit, u8 eXtensionBit, u8 MarkerBit, u8 PayloadType, u8 disposable_packet, u8 IsRepeatedPacket, u16 SequenceNumber)
 
GF_Err gf_isom_rtp_packet_set_flags (GF_ISOFile *isom_file, u32 trackNumber, u8 PackingBit, u8 eXtensionBit, u8 MarkerBit, u8 disposable_packet, u8 IsRepeatedPacket)
 
GF_Err gf_isom_rtp_packet_set_offset (GF_ISOFile *isom_file, u32 trackNumber, s32 timeOffset)
 
GF_Err gf_isom_rtp_set_timescale (GF_ISOFile *isom_file, u32 trackNumber, u32 HintDescriptionIndex, u32 TimeScale)
 
GF_Err gf_isom_rtp_set_time_offset (GF_ISOFile *isom_file, u32 trackNumber, u32 HintDescriptionIndex, u32 TimeOffset)
 
GF_Err gf_isom_rtp_set_time_sequence_offset (GF_ISOFile *isom_file, u32 trackNumber, u32 HintDescriptionIndex, u32 SequenceNumberOffset)
 
GF_Err gf_isom_sdp_add_track_line (GF_ISOFile *isom_file, u32 trackNumber, const char *text)
 
GF_Err gf_isom_sdp_clean_track (GF_ISOFile *isom_file, u32 trackNumber)
 
GF_Err gf_isom_sdp_add_line (GF_ISOFile *isom_file, const char *text)
 
GF_Err gf_isom_sdp_clean (GF_ISOFile *isom_file)
 
GF_Err gf_isom_dump_hint_sample (GF_ISOFile *isom_file, u32 trackNumber, u32 SampleNum, FILE *trace)
 
GF_Err gf_isom_sdp_get (GF_ISOFile *isom_file, const char **sdp, u32 *length)
 
GF_Err gf_isom_sdp_track_get (GF_ISOFile *isom_file, u32 trackNumber, const char **sdp, u32 *length)
 
u32 gf_isom_get_payt_count (GF_ISOFile *isom_file, u32 trackNumber)
 
const char * gf_isom_get_payt_info (GF_ISOFile *isom_file, u32 trackNumber, u32 index, u32 *payID)
 

Detailed Description

Enumeration Type Documentation

◆ GF_ISOHintFormat

supported hint formats - ONLY RTP now

Enumerator
GF_ISOM_HINT_RTP 

RTP hint type

Function Documentation

◆ gf_isom_setup_hint_track()

GF_Err gf_isom_setup_hint_track ( GF_ISOFile isom_file,
u32  trackNumber,
GF_ISOHintFormat  HintType 
)

sets up a hint track based on the hint format

Warning
This function MUST be called after creating a new hint track and before any other calls on this track
Parameters
isom_filethe target ISO file
trackNumberthe target hint track
HintTypethe desired hint type
Returns
error if any

◆ gf_isom_new_hint_description()

GF_Err gf_isom_new_hint_description ( GF_ISOFile isom_file,
u32  trackNumber,
s32  HintTrackVersion,
s32  LastCompatibleVersion,
u8  Rely,
u32 HintDescriptionIndex 
)

creates a HintDescription for the HintTrack

Parameters
isom_filethe target ISO file
trackNumberthe target hint track
HintTrackVersionversion of hint track
LastCompatibleVersionlast compatible version of hint track
Relyflag indicating whether a reliable transport protocol is desired/required for data transport 0: not desired (UDP/IP). NB: most RTP streaming servers only support UDP/IP for data 1: preferable (TCP/IP if possible or UDP/IP) 2: required (TCP/IP only)
HintDescriptionIndexis set to the newly created hint sample description index
Returns
error if any

◆ gf_isom_begin_hint_sample()

GF_Err gf_isom_begin_hint_sample ( GF_ISOFile isom_file,
u32  trackNumber,
u32  HintDescriptionIndex,
u32  TransmissionTime 
)

starts a new sample for the hint track. A sample is just a collection of packets the transmissionTime is indicated in the media timeScale of the hint track

Parameters
isom_filethe target ISO file
trackNumberthe target hint track
HintDescriptionIndexthe target hint sample description index
TransmissionTimethe target transmission time in hint media timescale
Returns
error if any

◆ gf_isom_end_hint_sample()

GF_Err gf_isom_end_hint_sample ( GF_ISOFile isom_file,
u32  trackNumber,
u8  IsRandomAccessPoint 
)

ends an hint sample once all your packets for this sample are done

Parameters
isom_filethe target ISO file
trackNumberthe target hint track
IsRandomAccessPointset to GF_TRUE if you want to indicate that this is a random access point in the stream
Returns
error if any

◆ gf_isom_hint_blank_data()

GF_Err gf_isom_hint_blank_data ( GF_ISOFile isom_file,
u32  trackNumber,
u8  AtBegin 
)

PacketHandling functions Data can be added at the end or at the beginning of the current packet by setting AtBegin to 1 the data will be added at the beginning This allows constructing the packet payload before any meta-data

adds a blank chunk of data in the sample that is skipped while streaming

Parameters
isom_filethe target ISO file
trackNumberthe target hint track
AtBeginindicates if the blank chunk should be at the end or at the beginning of the hint packet
Returns
error if any

◆ gf_isom_hint_direct_data()

GF_Err gf_isom_hint_direct_data ( GF_ISOFile isom_file,
u32  trackNumber,
u8 data,
u32  dataLength,
u8  AtBegin 
)

adds a chunk of data in the packet that is directly copied while streaming

Note
DataLength MUST BE <= 14 bytes, and you should only use this function to add small blocks of data (encrypted parts, specific headers, ...)
Parameters
isom_filethe target ISO file
trackNumberthe target hint track
databuffer to add to the RTP packet
dataLengthsize of buffer to add to the RTP packet
AtBeginindicates if the blank chunk should be at the end or at the beginning of the hint packet
Returns
error if any

◆ gf_isom_hint_sample_data()

GF_Err gf_isom_hint_sample_data ( GF_ISOFile isom_file,
u32  trackNumber,
GF_ISOTrackID  SourceTrackID,
u32  SampleNumber,
u16  DataLength,
u32  offsetInSample,
u8 extra_data,
u8  AtBegin 
)

adds a reference to some sample data in the packet

Note
if you want to reference a previous HintSample in the hintTrack, you will have to parse the sample yourself ...
Parameters
isom_filethe target ISO file
trackNumberthe target hint track
SourceTrackIDthe ID of the track where the referenced sample is
SampleNumberthe sample number containing the data to be added
DataLengththe length of bytes to copy in the packet
offsetInSamplethe offset in bytes in the sample at which to begin copying data
extra_dataonly used when the sample is actually the sample that will contain this packet (useful to store en encrypted version of a packet only available while streaming) In this case, set SourceTrackID to the HintTrack ID and SampleNumber to 0 In this case, the DataOffset MUST BE NULL and length will indicate the extra_data size
AtBeginindicates if the blank chunk should be at the end or at the beginning of the hint packet
Returns
error if any

◆ gf_isom_hint_sample_description_data()

GF_Err gf_isom_hint_sample_description_data ( GF_ISOFile isom_file,
u32  trackNumber,
GF_ISOTrackID  SourceTrackID,
u32  sampleDescriptionIndex,
u16  DataLength,
u32  offsetInDescription,
u8  AtBegin 
)

adds a reference to some stream description data in the packet (headers, ...)

Parameters
isom_filethe target ISO file
trackNumberthe target hint track
SourceTrackIDthe ID of the track where the referenced sample is
sampleDescriptionIndexthe index of the stream description in the desired track
DataLengththe length of bytes to copy in the packet
offsetInDescriptionthe offset in bytes in the description at which to begin copying data. Since it is far from being obvious / interoperable what this offset is, we recommend not using this function and injecting the data instead using gf_isom_hint_direct_data.
AtBeginindicates if the blank chunk should be at the end or at the beginning of the hint packet
Returns
error if any

◆ gf_isom_rtp_packet_begin()

GF_Err gf_isom_rtp_packet_begin ( GF_ISOFile isom_file,
u32  trackNumber,
s32  relativeTime,
u8  PackingBit,
u8  eXtensionBit,
u8  MarkerBit,
u8  PayloadType,
u8  disposable_packet,
u8  IsRepeatedPacket,
u16  SequenceNumber 
)

creates a new RTP packet in the HintSample. If a previous packet was created, it is stored in the hint sample and a new packet is created.

Parameters
isom_filethe target ISO file
trackNumberthe target hint track
relativeTimeRTP time offset of this packet in the HintSample if any - in hint track time scale. Used for data smoothing by servers.
PackingBitthe 'P' bit of the RTP packet header
eXtensionBitthe'X' bit of the RTP packet header
MarkerBitthe 'M' bit of the RTP packet header
PayloadTypethe payload type, on 7 bits, format 0x0XXXXXXX
disposable_packetindicates if this packet can be skipped by a server
IsRepeatedPacketindicates if this is a duplicate packet of a previous one and can be skipped by a server
SequenceNumberthe RTP base sequence number of the packet. Because of support for repeated packets, you have to set the sequence number yourself.
Returns
error if any

◆ gf_isom_rtp_packet_set_flags()

GF_Err gf_isom_rtp_packet_set_flags ( GF_ISOFile isom_file,
u32  trackNumber,
u8  PackingBit,
u8  eXtensionBit,
u8  MarkerBit,
u8  disposable_packet,
u8  IsRepeatedPacket 
)

sets the flags of the RTP packet

Parameters
isom_filethe target ISO file
trackNumberthe target hint track
PackingBitthe 'P' bit of the RTP packet header
eXtensionBitthe'X' bit of the RTP packet header
MarkerBitthe 'M' bit of the RTP packet header
disposable_packetindicates if this packet can be skipped by a server
IsRepeatedPacketindicates if this is a duplicate packet of a previous one and can be skipped by a server
Returns
error if any

◆ gf_isom_rtp_packet_set_offset()

GF_Err gf_isom_rtp_packet_set_offset ( GF_ISOFile isom_file,
u32  trackNumber,
s32  timeOffset 
)

sets the time offset of this packet. This enables packets to be placed in the hint track in decoding order, but have their presentation time-stamp in the transmitted packet in a different order. Typically used for MPEG video with B-frames

Parameters
isom_filethe target ISO file
trackNumberthe target hint track
timeOffsettime offset in RTP media timescale
Returns
error if any

◆ gf_isom_rtp_set_timescale()

GF_Err gf_isom_rtp_set_timescale ( GF_ISOFile isom_file,
u32  trackNumber,
u32  HintDescriptionIndex,
u32  TimeScale 
)

sets the RTP TimeScale that the server use to send packets some RTP payloads may need a specific timeScale that is not the timeScale in the file format the default timeScale choosen by the API is the MediaTimeScale of the hint track

Parameters
isom_filethe target ISO file
trackNumberthe target hint track
HintDescriptionIndexthe target hint sample description index
TimeScalethe RTP timescale to use
Returns
error if any

◆ gf_isom_rtp_set_time_offset()

GF_Err gf_isom_rtp_set_time_offset ( GF_ISOFile isom_file,
u32  trackNumber,
u32  HintDescriptionIndex,
u32  TimeOffset 
)

sets the RTP TimeOffset that the server will add to the packets if not set, the server adds a random offset

Parameters
isom_filethe target ISO file
trackNumberthe target hint track
HintDescriptionIndexthe target hint sample description index
TimeOffsetthe time offset in RTP timescale
Returns
error if any

◆ gf_isom_rtp_set_time_sequence_offset()

GF_Err gf_isom_rtp_set_time_sequence_offset ( GF_ISOFile isom_file,
u32  trackNumber,
u32  HintDescriptionIndex,
u32  SequenceNumberOffset 
)

sets the RTP SequenceNumber Offset that the server will add to the packets if not set, the server adds a random offset

Parameters
isom_filethe target ISO file
trackNumberthe target hint track
HintDescriptionIndexthe target hint sample description index
SequenceNumberOffsetthe sequence number offset
Returns
error if any

◆ gf_isom_sdp_add_track_line()

GF_Err gf_isom_sdp_add_track_line ( GF_ISOFile isom_file,
u32  trackNumber,
const char *  text 
)

adds an SDP line to the SDP container at the track level (media-specific SDP info)

Note
the CRLF end of line for SDP is automatically inserted
Parameters
isom_filethe target ISO file
trackNumberthe target hint track
textthe SDP text to add the target hint track
Returns
error if any

◆ gf_isom_sdp_clean_track()

GF_Err gf_isom_sdp_clean_track ( GF_ISOFile isom_file,
u32  trackNumber 
)

removes all SDP info at the track level

Parameters
isom_filethe target ISO file
trackNumberthe target hint track
Returns
error if any

◆ gf_isom_sdp_add_line()

GF_Err gf_isom_sdp_add_line ( GF_ISOFile isom_file,
const char *  text 
)

adds an SDP line to the SDP container at the movie level (presentation SDP info)

Note
The CRLF end of line for SDP is automatically inserted
Parameters
isom_filethe target ISO file
textthe SDP text to add the target hint track
Returns
error if any

◆ gf_isom_sdp_clean()

GF_Err gf_isom_sdp_clean ( GF_ISOFile isom_file)

removes all SDP info at the movie level

Parameters
isom_filethe target ISO file
Returns
error if any

◆ gf_isom_dump_hint_sample()

GF_Err gf_isom_dump_hint_sample ( GF_ISOFile isom_file,
u32  trackNumber,
u32  SampleNum,
FILE *  trace 
)

dumps RTP hint samples structure into XML trace file

Parameters
isom_filethe target ISO file
trackNumberthe target track
SampleNumthe target sample number
tracethe file object to dump to
Returns
error if any

◆ gf_isom_sdp_get()

GF_Err gf_isom_sdp_get ( GF_ISOFile isom_file,
const char **  sdp,
u32 length 
)

gets SDP info at the movie level

Parameters
isom_filethe target ISO file
sdpset to the sdp text, including a null-terminating character - do not modify
lengthset to the sdp length, not including the null-terminating character
Returns
error if any

◆ gf_isom_sdp_track_get()

GF_Err gf_isom_sdp_track_get ( GF_ISOFile isom_file,
u32  trackNumber,
const char **  sdp,
u32 length 
)

gets SDP info at the track level

Parameters
isom_filethe target ISO file
trackNumberthe target track
sdpset to the sdp text, including a null-terminating character - do not modify
lengthset to the sdp length, not including the null-terminating character
Returns
error if any

◆ gf_isom_get_payt_count()

u32 gf_isom_get_payt_count ( GF_ISOFile isom_file,
u32  trackNumber 
)

gets number of payload type defines for an RTP hint track

Parameters
isom_filethe target ISO file
trackNumberthe target track
Returns
the number of payload types defined

◆ gf_isom_get_payt_info()

const char* gf_isom_get_payt_info ( GF_ISOFile isom_file,
u32  trackNumber,
u32  index,
u32 payID 
)

gets payload type information for an RTP hint track

Parameters
isom_filethe target ISO file
trackNumberthe target track
indexthe payload type 1_based index
payIDset to the ID of the payload type
Returns
the sdp fmtp attribute describing the payload