📄 ietf.h
字号:
char *a_sdplang, *a_lang; /*all attributes not defined in RFC 2327 for the presentation*/ GF_List *Attributes; /*list of media in the SDP*/ GF_List *media_desc;} GF_SDPInfo;/* Memory Consideration: the destructors free all non-NULL string. You should therefore be carefull while (de-)assigning the strings. The function gf_sdp_info_parse() performs a complete reset of the GF_SDPInfo*//*constructor*/GF_SDPInfo *gf_sdp_info_new();/*destructor*/void gf_sdp_info_del(GF_SDPInfo *sdp);/*reset all structures (destroys substructure too)*/void gf_sdp_info_reset(GF_SDPInfo *sdp);/*Parses a memory SDP buffer*/GF_Err gf_sdp_info_parse(GF_SDPInfo *sdp, char *sdp_text, u32 text_size);/*check the consistency of the GF_SDPInfo*/GF_Err gf_sdp_info_check(GF_SDPInfo *sdp);/*write the SDP to a new buffer and returns it. Automatically checks the SDP before calling*/GF_Err gf_sdp_info_write(GF_SDPInfo *sdp, char **out_str_buf);/* Const/dest for GF_SDPMedia*/GF_SDPMedia *gf_sdp_media_new();void gf_sdp_media_del(GF_SDPMedia *media);/* Const/dest for GF_SDPConnection*/GF_SDPConnection *gf_sdp_conn_new();void gf_sdp_conn_del(GF_SDPConnection *conn);/* Const/dest for SDP FMTP*/GF_SDP_FMTP *gf_sdp_fmtp_new();void gf_sdp_fmtp_del(GF_SDP_FMTP *fmtp);/* RTP packetizer*//*RTP<->SL mapping*/typedef struct { /*1 - required options*/ /*mode, or "" if no mode ("generic" should be used instead)*/ char mode[30]; /*config of the stream if carried in SDP*/ char *config; u32 configSize; /* Stream Type*/ u8 StreamType; /* stream profile and level indication - for AVC/H264, 0xPPCCLL, with PP:profile, CC:compatibility, LL:level*/ u32 PL_ID; /*2 - optional options*/ /*size of AUs if constant*/ u32 ConstantSize; /*duration of AUs if constant, in RTP timescale*/ u32 ConstantDuration; /* Object Type Indication */ u8 ObjectTypeIndication; /*audio max displacement when interleaving (eg, de-interleaving window buffer max length) in RTP timescale*/ u32 maxDisplacement; /*de-interleaveBufferSize if not recomputable from maxDisplacement*/ u32 deinterleaveBufferSize; /*The number of bits on which the AU-size field is encoded in the AU-header*/ u32 SizeLength; /*The number of bits on which the AU-Index is encoded in the first AU-header*/ u32 IndexLength; /*The number of bits on which the AU-Index-delta field is encoded in any non-first AU-header*/ u32 IndexDeltaLength; /*The number of bits on which the DTS-delta field is encoded in the AU-header*/ u32 DTSDeltaLength; /*The number of bits on which the CTS-delta field is encoded in the AU-header*/ u32 CTSDeltaLength; /*random access point flag present*/ Bool RandomAccessIndication; /*The number of bits on which the Stream-state field is encoded in the AU-header (systems only)*/ u32 StreamStateIndication; /*The number of bits that is used to encode the auxiliary-data-size field (no normative usage of this section)*/ u32 AuxiliaryDataSizeLength; /*ISMACryp stuff*/ u8 IV_length, IV_delta_length; u8 KI_length; /*internal stuff*/ /*len of first AU header in an RTP payload*/ u32 auh_first_min_len; u32 auh_min_len;} GP_RTPSLMap; /*packetizer config flags - some flags are dynamically re-assigned when detecting multiSL / B-Frames / ...*/enum{ /*forces MPEG-4 generic transport if MPEG-4 systems mapping is available*/ GP_RTP_PCK_FORCE_MPEG4 = (1), /*Enables AUs concatenation in an RTP packet (if payload supports it) - this forces GP_RTP_PCK_SIGNAL_SIZE for MPEG-4*/ GP_RTP_PCK_USE_MULTI = (1<<1), /*if set, audio interleaving is used if payload supports it (forces GP_RTP_PCK_USE_MULTI flag) THIS IS CURRENTLY NOT IMPLEMENTED*/ GP_RTP_PCK_USE_INTERLEAVING = (1<<2), /*uses static RTP payloadID if any defined*/ GP_RTP_PCK_USE_STATIC_ID = (1<<3), /*MPEG-4 generic transport option*/ /*if flag set, RAP flag is signaled in RTP payload*/ GP_RTP_PCK_SIGNAL_RAP = (1<<4), /*if flag set, AU indexes are signaled in RTP payload*/ GP_RTP_PCK_SIGNAL_AU_IDX = (1<<5), /*if flag set, AU size is signaled in RTP payload*/ GP_RTP_PCK_SIGNAL_SIZE = (1<<6), /*if flag set, CTS is signaled in RTP payload - DTS is automatically set if needed*/ GP_RTP_PCK_SIGNAL_TS = (1<<7), /*setup payload for carouseling of systems streams*/ GP_RTP_PCK_AUTO_CAROUSEL = (1<<8), /*use LATM payload for AAC-LC*/ GP_RTP_PCK_USE_LATM_AAC = (1<<9), /*ISMACryp options*/ /*signals that input data is selectively encrypted (eg not all input frames are encrypted) - this is usually automatically set by hinter*/ GP_RTP_PCK_SELECTIVE_ENCRYPTION = (1<<10), /*signals that each sample will have its own key indicator - ignored in non-multi modes if not set and key indicator changes, a new RTP packet will be forced*/ GP_RTP_PCK_KEY_IDX_PER_AU = (1<<11),};/* Generic packetization tools - used by track hinters and future live tools*//*currently supported payload types*/enum { /*not defined*/ GF_RTP_PAYT_UNKNOWN, /*use generic MPEG-4 transport - RFC 3016 and RFC 3640*/ GF_RTP_PAYT_MPEG4, /*use generic MPEG-1/2 video transport - RFC 2250*/ GF_RTP_PAYT_MPEG12_VIDEO, /*use generic MPEG-1/2 audio transport - RFC 2250*/ GF_RTP_PAYT_MPEG12_AUDIO, /*use H263 transport - RFC 2429*/ GF_RTP_PAYT_H263, /*use AMR transport - RFC 3267*/ GF_RTP_PAYT_AMR, /*use AMR-WB transport - RFC 3267*/ GF_RTP_PAYT_AMR_WB, /*use QCELP transport - RFC 2658*/ GF_RTP_PAYT_QCELP, /*use EVRC/SMV transport - RFC 3558*/ GF_RTP_PAYT_EVRC_SMV, /*use 3GPP Text transport - no RFC yet, only draft*/ GF_RTP_PAYT_3GPP_TEXT, /*use H264 transport - no RFC yet, only draft*/ GF_RTP_PAYT_H264_AVC, /*use LATM for AAC-LC*/ GF_RTP_PAYT_LATM,};/* RTP packetizer*//* RTP -> SL packetization tool You should ONLY modify the GF_SLHeader while packetizing, all the rest is private to the tool. Also note that AU start/end is automatically updated, therefore you should only set CTS-DTS-OCR-sequenceNumber (which is automatically incremented when spliting a payload) -padding-idle infos SL flags are computed on the fly, but you may wish to modify them in case of packet drop/... at the encoder side*/struct __tag_rtp_packetizer{ /*input packet sl header cfg. modify only if needed*/ GF_SLHeader sl_header; /* PRIVATE _ DO NOT TOUCH */ /*RTP payload type (RFC type, NOT the RTP hdr payT)*/ u32 rtp_payt; /*packetization flags*/ u32 flags; /*Path MTU size without 12-bytes RTP header*/ u32 Path_MTU; /*max packet duration in RTP TS*/ u32 max_ptime; /*payload type of RTP packets - only one payload type can be used in GPAC*/ u8 PayloadType; /*RTP header of current packet*/ GF_RTPHeader rtp_header; /*RTP packet handling callbacks*/ void (*OnNewPacket)(void *cbk_obj, GF_RTPHeader *header); void (*OnPacketDone)(void *cbk_obj, GF_RTPHeader *header); void (*OnDataReference)(void *cbk_obj, u32 payload_size, u32 offset_from_orig); void (*OnData)(void *cbk_obj, char *data, u32 data_size, Bool is_header); void *cbk_obj; /*rest of struct is for MPEG-4 Generic hinting */ /*SL to RTP map*/ GP_RTPSLMap slMap; /*SL conf and state*/ GF_SLConfig sl_config; /*set to 1 if firstSL in RTP packet*/ Bool first_sl_in_rtp; Bool has_AU_header; /*current info writers*/ GF_BitStream *pck_hdr, *payload; /*AU SN of last au*/ u32 last_au_sn; /*info for the current packet*/ u32 auh_size, bytesInPacket; /*ISMACryp info*/ Bool force_flush, is_encrypted; u64 IV, first_AU_IV; char *key_indicator; /*AVC non-IDR flag: set if all NAL in current packet are non-IDR (disposable)*/ Bool avc_non_idr;};/*generic rtp builder (packetizer)*/typedef struct __tag_rtp_packetizer GP_RTPPacketizer;/*creates a new builder @hintType: hint media type, one of the above @flags: hint flags (cf above) @slc: user-given SL config to use. If none specified, default RFC config is used @cbk_obj: callback object passed back in functions @OnNewPacket: callback function starting new RTP packet @header: rtp header for new packet - note that RTP header flags are not used until PacketDone is called @OnPacketDone: callback function closing current RTP packet @header: final rtp header for packet @OnDataReference: optional, to call each time data from input buffer is added to current RTP packet. If not set, data must be added through OnData @payload_size: size of reference data @offset_from_orig: start offset in input buffer @OnData: to call each time data is added to current RTP packet (either extra data from payload or data from input when not using referencing) @is_head: signal the data added MUST be inserted at the begining of the payload. Otherwise data is concatenated as recieved*/GP_RTPPacketizer *gf_rtp_builder_new(u32 hintType, GF_SLConfig *slc, u32 flags, void *cbk_obj, void (*OnNewPacket)(void *cbk, GF_RTPHeader *header), void (*OnPacketDone)(void *cbk, GF_RTPHeader *header), void (*OnDataReference)(void *cbk, u32 payload_size, u32 offset_from_orig), void (*OnData)(void *cbk, char *data, u32 data_size, Bool is_head) );/*destroy builder*/void gf_rtp_builder_del(GP_RTPPacketizer *builder);/* init the builder @PathMTU: the network transmission unit size (UDP packet size for IP, ..) @max_ptime: maximum packet duration IN RTP TIMESCALE @StreamType: MPEG-4 system stream type - MUST always be provided for payloads format specifying audio or video streams @OTI : MPEG-4 system objectTypeIndication - may be 0 if stream is not mpeg4 systems *** all other params are for MultiSL draft *** @avgSize: average size of an AU. This is not always known (real-time encoding). In this case you should specify a rough compute indicating how many packets could be stored per RTP packet. for ex AAC stereo at 44100 k / 64kbps , one AU ~= 380 bytesso 3 AUs for 1500 MTU is ok - BE CAREFULL: MultiSL adds some SL info on top of the 12byte RTP header so you should specify a smaller sizeThe packetizer will ALWAYS make sure there's no pb storing the packets so specifying more will result in a slight overhead in the SL mapping but the gain to singleSL will still be worth it. -Nota: at init, the packetizer can decide to switch to SingleSL if the average size specified is too close to the PathMTU @maxSize: max size of an AU. If unknown (real-time) set to 0 @avgTS: average CTS progression (1000/FPS for video) @maxDTS: maximum DTS offset in case of bidirectional coding. @IV_length: size (in bytes) of IV when ISMACrypted @KI_length: size (in bytes) of key indicator when ISMACrypted @pref_mode: MPEG-4 generic only, specifies the payload mode - can be NULL (mode generic)*/void gf_rtp_builder_init(GP_RTPPacketizer *builder, u8 PayloadType, u32 PathMTU, u32 max_ptime, u32 StreamType, u32 OTI, u32 PL_ID, u32 avgSize, u32 maxSize, u32 avgTS, u32 maxDTS, u32 IV_length, u32 KI_length, char *pref_mode);/*set frame crypto info*/void gp_rtp_builder_set_cryp_info(GP_RTPPacketizer *builder, u64 IV, char *key_indicator, Bool is_encrypted);/*packetize input buffer@data, @data_size: input buffer@IsAUEnd: set to one if this buffer is the last of the AU@FullAUSize: complete access unit size if known, 0 otherwise@duration: sample duration in rtp timescale (only needed for 3GPP text streams)@descIndex: sample description index (only needed for 3GPP text streams)*/GF_Err gf_rtp_builder_process(GP_RTPPacketizer *builder, char *data, u32 data_size, u8 IsAUEnd, u32 FullAUSize, u32 duration, u8 descIndex);/*format the "fmtp: " attribute for the MPEG-4 generic packetizer. sdpline shall be at least 2000 char*/GF_Err gf_rtp_builder_format_sdp(GP_RTPPacketizer *builder, char *payload_name, char *sdpLine, char *dsi, u32 dsi_size);/*formats SDP payload name and media name - both MUST be at least 20 bytes*/Bool gf_rtp_builder_get_payload_name(GP_RTPPacketizer *builder, char *szPayloadName, char *szMediaName);/*rtp payload flags*/enum{ /*AU end was detected (eg next packet is AU start)*/ GF_RTP_NEW_AU = (1), /*AMR config*/ GF_RTP_AMR_ALIGN = (1<<1), /*for RFC3016, signals bitstream inspection for RAP discovery*/ GF_RTP_M4V_CHECK_RAP = (1<<2), /*AWFULL hack at rtp level to cope with ffmpeg h264 crashes when jumping in stream without IDR*/ GF_RTP_AVC_WAIT_RAP = (1<<3), /*ISMACryp stuff*/ GF_RTP_HAS_ISMACRYP = (1<<4), GF_RTP_ISMA_SEL_ENC = (1<<5), GF_RTP_ISMA_HAS_KEY_IDX = (1<<6)};/* SL -> RTP packetization tool*/struct __tag_rtp_depacketizer{ /*depacketize routine*/ void (*depacketize)(struct __tag_rtp_depacketizer *rtp, GF_RTPHeader *hdr, char *payload, u32 size); /*output packet sl header cfg*/ GF_SLHeader sl_hdr; /*RTP payload type (RFC type, NOT the RTP hdr payT)*/ u32 payt; /*depacketization flags*/ u32 flags; /*callback routine*/ void (*on_sl_packet)(void *udta, char *payload, u32 size, GF_SLHeader *hdr, GF_Err e); void *udta; /*SL <-> RTP map*/ GP_RTPSLMap sl_map; u32 clock_rate; /*inter-packet reconstruction bitstream (for 3GP text and H264)*/ GF_BitStream *inter_bs; /*H264/AVC config*/ u32 h264_pck_mode; /*3GP text reassembler state*/ u8 nb_txt_frag, cur_txt_frag, sidx, txt_len, nb_mod_frag; /*ISMACryp*/ u32 isma_scheme; char *key;};/*generic rtp builder (packetizer)*/typedef struct __tag_rtp_depacketizer GF_RTPDepacketizer;GF_RTPDepacketizer *gf_rtp_depacketizer_new(GF_SDPMedia *media, void (*sl_packet_cbk)(void *udta, char *payload, u32 size, GF_SLHeader *hdr, GF_Err e), void *udta);void gf_rtp_depacketizer_del(GF_RTPDepacketizer *rtp);void gf_rtp_depacketizer_reset(GF_RTPDepacketizer *rtp, Bool full_reset);void gf_rtp_depacketizer_process(GF_RTPDepacketizer *rtp, GF_RTPHeader *hdr, char *payload, u32 size);void gf_rtp_depacketizer_get_slconfig(GF_RTPDepacketizer *rtp, GF_SLConfig *sl);#ifdef __cplusplus}#endif#endif /*_GF_IETF_H_*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -