2 * GPAC - Multimedia Framework C SDK
\r
4 * Copyright (c) Jean Le Feuvre 2000-2005
\r
5 * All rights reserved
\r
7 * This file is part of GPAC / IETF RTP/RTSP/SDP sub-project
\r
9 * GPAC is free software; you can redistribute it and/or modify
\r
10 * it under the terms of the GNU Lesser General Public License as published by
\r
11 * the Free Software Foundation; either version 2, or (at your option)
\r
12 * any later version.
\r
14 * GPAC is distributed in the hope that it will be useful,
\r
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
17 * GNU Lesser General Public License for more details.
\r
19 * You should have received a copy of the GNU Lesser General Public
\r
20 * License along with this library; see the file COPYING. If not, write to
\r
21 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
\r
34 #include <gpac/list.h>
\r
35 #include <gpac/bitstream.h>
\r
36 #include <gpac/sync_layer.h>
\r
37 #include <gpac/network.h>
\r
40 /****************************************************************************
\r
42 RTSP VERSION 1.0 LIBRARY EXPORTS
\r
44 ****************************************************************************/
\r
46 #define GF_RTSP_VERSION "RTSP/1.0"
\r
54 NC_RTSP_Continue = 100,
\r
56 NC_RTSP_Created = 201,
\r
57 NC_RTSP_Low_on_Storage_Space = 250,
\r
59 NC_RTSP_Multiple_Choice = 300,
\r
60 NC_RTSP_Moved_Permanently = 301,
\r
61 NC_RTSP_Moved_Temporarily = 302,
\r
62 NC_RTSP_See_Other = 303,
\r
63 NC_RTSP_Use_Proxy = 305,
\r
65 NC_RTSP_Bad_Request = 400,
\r
66 NC_RTSP_Unauthorized = 401,
\r
67 NC_RTSP_Payment_Required = 402,
\r
68 NC_RTSP_Forbidden = 403,
\r
69 NC_RTSP_Not_Found = 404,
\r
70 NC_RTSP_Method_Not_Allowed = 405,
\r
71 NC_RTSP_Not_Acceptable = 406,
\r
72 NC_RTSP_Proxy_Authentication_Required = 407,
\r
73 NC_RTSP_Request_Timeout = 408,
\r
75 NC_RTSP_Length_Required = 411,
\r
76 NC_RTSP_Precondition_Failed = 412,
\r
77 NC_RTSP_Request_Entity_Too_Large = 413,
\r
78 NC_RTSP_Request_URI_Too_Long = 414,
\r
79 NC_RTSP_Unsupported_Media_Type = 415,
\r
81 NC_RTSP_Invalid_parameter = 451,
\r
82 NC_RTSP_Illegal_Conference_Identifier = 452,
\r
83 NC_RTSP_Not_Enough_Bandwidth = 453,
\r
84 NC_RTSP_Session_Not_Found = 454,
\r
85 NC_RTSP_Method_Not_Valid_In_This_State = 455,
\r
86 NC_RTSP_Header_Field_Not_Valid = 456,
\r
87 NC_RTSP_Invalid_Range = 457,
\r
88 NC_RTSP_Parameter_Is_ReadOnly = 458,
\r
89 NC_RTSP_Aggregate_Operation_Not_Allowed = 459,
\r
90 NC_RTSP_Only_Aggregate_Operation_Allowed = 460,
\r
91 NC_RTSP_Unsupported_Transport = 461,
\r
92 NC_RTSP_Destination_Unreachable = 462,
\r
94 NC_RTSP_Internal_Server_Error = 500,
\r
95 NC_RTSP_Not_Implemented = 501,
\r
96 NC_RTSP_Bad_Gateway = 502,
\r
97 NC_RTSP_Service_Unavailable = 503,
\r
98 NC_RTSP_Gateway_Timeout = 504,
\r
99 NC_RTSP_RTSP_Version_Not_Supported = 505,
\r
101 NC_RTSP_Option_not_support = 551,
\r
104 const char *gf_rtsp_nc_to_string(u32 ErrCode);
\r
107 Common structures between commands and responses
\r
111 RTSP Range information - RTSP Session level only (though this is almost the same
\r
112 format as an SDP range, this is not used in the SDP lib as "a=range" is not part of SDP
\r
116 /* start and end range. If end is -1, the range is open (from start to unknown) */
\r
118 /* use SMPTE range (Start and End specify the number of frames) (currently not supported) */
\r
120 /* framerate for SMPTE range */
\r
125 parses a Range line and returns range header structure. can be used for RTSP extension of SDP
\r
126 NB: Only support for npt for now
\r
128 GF_RTSPRange *gf_rtsp_range_parse(char *range_buf);
\r
130 GF_RTSPRange *gf_rtsp_range_new();
\r
131 void gf_rtsp_range_del(GF_RTSPRange *range);
\r
134 Transport structure
\r
135 contains all network info for RTSP sessions (ports, uni/multi-cast, ...)
\r
139 Transport Profiles as defined in RFC 2326
\r
141 #define GF_RTSP_PROFILE_RTP_AVP "RTP/AVP"
\r
142 #define GF_RTSP_PROFILE_RTP_AVP_TCP "RTP/AVP/TCP"
\r
143 #define GF_RTSP_PROFILE_UDP "udp"
\r
148 /* set to 1 if unicast */
\r
150 /* for multicast */
\r
152 /* for redirections internal to servers */
\r
154 /*IsRecord is usually 0 (PLAY) . If set, Append specify that the stream should
\r
155 be concatenated to existing resources */
\r
156 Bool IsRecord, Append;
\r
157 /* in case transport is on TCP/RTSP, If only 1 ID is specified, it is stored in rtpID (this
\r
158 is not RTP interleaving) */
\r
159 Bool IsInterleaved, rtpID, rtcpID;
\r
160 /* Multicast specific */
\r
161 u32 MulticastLayers;
\r
165 /*port for multicast*/
\r
166 /*server port in unicast - RTP implies low is even , and last is low+1*/
\r
167 u16 port_first, port_last;
\r
168 /*client port in unicast - RTP implies low is even , and last is low+1*/
\r
169 u16 client_port_first, client_port_last;
\r
172 /*Transport protocol. In this version we only support RTP/AVP, the following flag tells
\r
173 us if this is RTP/AVP/TCP or RTP/AVP (default)*/
\r
175 } GF_RTSPTransport;
\r
178 GF_RTSPTransport *gf_rtsp_transport_clone(GF_RTSPTransport *original);
\r
179 void gf_rtsp_transport_del(GF_RTSPTransport *transp);
\r
184 the RTSP Response is sent by a client / received by a server
\r
185 text Allocation is done by the lib when parsing a command, and
\r
186 is automatically freed when calling reset / delete. Therefore you must
\r
187 set/allocate the fields yourself when writing a command (client)
\r
191 /*ALL RTSP METHODS - all other methods will be ignored*/
\r
192 #define GF_RTSP_DESCRIBE "DESCRIBE"
\r
193 #define GF_RTSP_SETUP "SETUP"
\r
194 #define GF_RTSP_PLAY "PLAY"
\r
195 #define GF_RTSP_PAUSE "PAUSE"
\r
196 #define GF_RTSP_RECORD "RECORD"
\r
197 #define GF_RTSP_TEARDOWN "TEARDOWN"
\r
198 #define GF_RTSP_GET_PARAMETER "GET_PARAMETER"
\r
199 #define GF_RTSP_SET_PARAMETER "SET_PARAMETER"
\r
200 #define GF_RTSP_OPTIONS "OPTIONS"
\r
201 #define GF_RTSP_ANNOUNCE "ANNOUNCE"
\r
202 #define GF_RTSP_REDIRECTE "REDIRECT"
\r
208 char *Accept_Encoding;
\r
209 char *Accept_Language;
\r
210 char *Authorization;
\r
213 char *Cache_Control;
\r
216 u32 Content_Length;
\r
219 char *Proxy_Authorization;
\r
220 char *Proxy_Require;
\r
221 GF_RTSPRange *Range;
\r
226 /*nota : RTSP allows several configurations for a single channel (multicast and
\r
227 unicast , ...). Usually only 1*/
\r
228 GF_List *Transports;
\r
231 /*type of the command, one of the described above*/
\r
234 /*Header extensions*/
\r
235 GF_List *Xtensions;
\r
237 /*body of the command, size is Content-Length (auto computed when sent). It is not
\r
238 terminated by a NULL char*/
\r
242 Specify ControlString if your request targets
\r
243 a specific media stream in the service. If null, the service name only will be used
\r
244 for control (for ex, both A and V streams in a single file)
\r
245 If the request is GF_RTSP_OPTIONS, you must provide a control string containing the options
\r
248 char *ControlString;
\r
250 /*user data: this is never touched by the lib, its intend is to help stacking
\r
251 RTSP commands in your app*/
\r
256 Server side Extensions
\r
259 /*full URL of the command. Not used at client side, as the URL is ALWAYS relative
\r
260 to the server / service of the RTSP session
\r
261 On the server side however redirections are up to the server, so we cannot decide for it */
\r
262 char *service_name;
\r
263 /*RTSP status code of the command as parsed. One of the above RTSP StatusCode*/
\r
268 GF_RTSPCommand *gf_rtsp_command_new();
\r
269 void gf_rtsp_command_del(GF_RTSPCommand *com);
\r
270 void gf_rtsp_command_reset(GF_RTSPCommand *com);
\r
276 the RTSP Response is received by a client / sent by a server
\r
277 text Allocation is done by the lib when parsing a response, and
\r
278 is automatically freed when calling reset / delete. Therefore you must
\r
279 allocate the fields yourself when writing a response (server)
\r
284 RTP-Info for RTP channels. There may be several RTP-Infos in one response
\r
285 based on the server implementation (DSS/QTSS begaves this way)
\r
289 /*control string of the channel*/
\r
291 /*seq num for asociated rtp_time*/
\r
293 /*rtp TimeStamp corresponding to the Range start specified in the PLAY request*/
\r
295 /*ssrc of sender if known, 0 otherwise*/
\r
308 /* comment from the server */
\r
309 char *ResponseInfo;
\r
311 /* Header Fields */
\r
313 char *Accept_Encoding;
\r
314 char *Accept_Language;
\r
316 char *Authorization;
\r
319 char *Cache_Control;
\r
322 char *Content_Base;
\r
323 char *Content_Encoding;
\r
324 char *Content_Language;
\r
325 u32 Content_Length;
\r
326 char *Content_Location;
\r
327 char *Content_Type;
\r
334 char *If_Modified_Since;
\r
335 char *Last_Modified;
\r
337 char *Proxy_Authenticate;
\r
338 char *Proxy_Require;
\r
340 GF_RTSPRange *Range;
\r
344 GF_List *RTP_Infos;
\r
348 u32 SessionTimeOut;
\r
351 /*nota : RTSP allows several configurations for a single channel (multicast and
\r
352 unicast , ...). Usually only 1*/
\r
353 GF_List *Transports;
\r
358 char *WWW_Authenticate;
\r
360 /*Header extensions*/
\r
361 GF_List *Xtensions;
\r
363 /*body of the response, size is Content-Length (auto computed when sent). It is not
\r
364 terminated by a NULL char when response is parsed but must be null-terminated when
\r
365 response is being sent*/
\r
370 GF_RTSPResponse *gf_rtsp_response_new();
\r
371 void gf_rtsp_response_del(GF_RTSPResponse *rsp);
\r
372 void gf_rtsp_response_reset(GF_RTSPResponse *rsp);
\r
376 typedef struct _tag_rtsp_session GF_RTSPSession;
\r
378 GF_RTSPSession *gf_rtsp_session_new(char *sURL, u16 DefaultPort);
\r
379 void gf_rtsp_session_del(GF_RTSPSession *sess);
\r
381 GF_Err gf_rtsp_set_buffer_size(GF_RTSPSession *sess, u32 BufferSize);
\r
383 /*force the IP address the client is using*/
\r
384 void gf_rtsp_set_mobile_ip(GF_RTSPSession *sess, char *MobileIP);
\r
387 /*Reset state machine, invalidate SessionID
\r
388 NOTE: RFC2326 requires that the session is reseted when all RTP streams
\r
389 are closed. As this lib doesn't maintain the number of valid streams
\r
390 you MUST call reset when all your streams are shutdown (either requested through
\r
391 TEARDOWN or signaled through RTCP BYE packets for RTP, or any other signaling means
\r
392 for other protocols)
\r
393 reset connection will destroy the socket - this is isefull in case of timeouts, because
\r
394 some servers do not restart with the right CSeq...*/
\r
395 void gf_rtsp_session_reset(GF_RTSPSession *sess, Bool ResetConnection);
\r
397 u32 gf_rtsp_is_my_session(GF_RTSPSession *sess, char *url);
\r
398 const char *gf_rtsp_get_last_session_id(GF_RTSPSession *sess);
\r
399 char *gf_rtsp_get_server_name(GF_RTSPSession *sess);
\r
400 char *gf_rtsp_get_service_name(GF_RTSPSession *sess);
\r
401 u16 gf_rtsp_get_session_port(GF_RTSPSession *sess);
\r
403 /*Fetch an RTSP response from the server the GF_RTSPResponse will be reseted before fetch*/
\r
404 GF_Err gf_rtsp_get_response(GF_RTSPSession *sess, GF_RTSPResponse *rsp);
\r
407 /*RTSP State Machine. The only non blocking mode is GF_RTSP_STATE_WAIT_FOR_CONTROL*/
\r
410 /*Initialized (connection might be off, but all structures are in place)
\r
411 This is the default state between # requests (aka, DESCRIBE and SETUP
\r
412 or SETUP and PLAY ...)*/
\r
413 GF_RTSP_STATE_INIT = 0,
\r
415 GF_RTSP_STATE_WAITING,
\r
416 /*PLAY, PAUSE, RECORD. Aggregation is allowed for the same type, you can send several command
\r
417 in a row. However the session will return GF_SERVICE_ERROR if you do not have
\r
418 a valid SessionID in the command
\r
419 You cannot issue a SETUP / DESCRIBE while in this state*/
\r
420 GF_RTSP_STATE_WAIT_FOR_CONTROL,
\r
422 /*FATAL ERROR: session is invalidated by server. Call reset and restart from SETUP if needed*/
\r
423 GF_RTSP_STATE_INVALIDATED
\r
426 u32 gf_rtsp_get_session_state(GF_RTSPSession *sess);
\r
427 /*aggregate command state-machine: the PLAY/PAUSE can be aggregated
\r
428 (sent before the reply is received). This function gets the last command sent*/
\r
429 char *gf_rtsp_get_last_request(GF_RTSPSession *sess);
\r
430 /*foce a reset in case of pbs*/
\r
431 void gf_rtsp_reset_aggregation(GF_RTSPSession *sess);
\r
434 Send an RTSP request to the server.
\r
436 GF_Err gf_rtsp_send_command(GF_RTSPSession *sess, GF_RTSPCommand *com);
\r
439 GF_Err gf_rtsp_set_interleave_callback(GF_RTSPSession *sess,
\r
440 GF_Err (*SignalData)(GF_RTSPSession *sess, void *cbk_ptr, char *buffer, u32 bufferSize, Bool IsRTCP)
\r
444 GF_Err gf_rtsp_session_read(GF_RTSPSession *sess);
\r
446 GF_Err gf_rtsp_register_interleave(GF_RTSPSession *sess, void *the_ch, u8 LowInterID, u8 HighInterID);
\r
447 u32 gf_rtsp_unregister_interleave(GF_RTSPSession *sess, u8 LowInterID);
\r
452 Server side session constructor
\r
453 create a new RTSP session from an existing socket in listen state. If no pending connection
\r
454 is detected, return NULL
\r
456 GF_RTSPSession *gf_rtsp_session_new_server(GF_Socket *rtsp_listener);
\r
458 /*fetch an RTSP request. The GF_RTSPCommand will be reseted before fetch*/
\r
459 GF_Err gf_rtsp_get_command(GF_RTSPSession *sess, GF_RTSPCommand *com);
\r
461 /*unpack the URL, check the service name / server. Typically used when a client sends a
\r
462 DESCRIBE || SETUP url RTSP/1.0. Server / service name check must be performed by your app as redirection
\r
463 or services available are unknown here.*/
\r
464 GF_Err gf_rtsp_load_service_name(GF_RTSPSession *sess, char *URL);
\r
466 /*geenrates a session ID fpor the given session*/
\r
467 char *gf_rtsp_generate_session_id(GF_RTSPSession *sess);
\r
469 /*send the RTSP response*/
\r
470 GF_Err gf_rtsp_send_response(GF_RTSPSession *sess, GF_RTSPResponse *rsp);
\r
472 /*gets the IP address of the local host running the session
\r
473 buffer shall be GF_MAX_IP_NAME_LEN long*/
\r
474 GF_Err gf_rtsp_get_session_ip(GF_RTSPSession *sess, char *buffer);
\r
476 /*returns the next available ID for interleaving. It is recommended that you use 2
\r
477 consecutive IDs for RTP/RTCP interleaving*/
\r
478 u8 gf_rtsp_get_next_interleave_id(GF_RTSPSession *sess);
\r
480 /*gets the IP address of the connected peer - buffer shall be GF_MAX_IP_NAME_LEN long*/
\r
481 GF_Err gf_rtsp_get_remote_address(GF_RTSPSession *sess, char *buffer);
\r
489 typedef struct tagRTP_HEADER {
\r
490 /*version, must be 2*/
\r
492 /*padding bits in the payload*/
\r
494 /*header extension is defined*/
\r
496 /*number of CSRC (<=15)*/
\r
500 /*payload type on 7 bits*/
\r
502 /*packet seq number*/
\r
503 u16 SequenceNumber;
\r
504 /*packet time stamp*/
\r
506 /*sync source identifier*/
\r
508 /*in our basic client, CSRC should always be NULL*/
\r
516 structure containing the rtpmap information
\r
520 /*dynamic payload type of this map*/
\r
522 /*registered payload name of this map*/
\r
523 char *payload_name;
\r
524 /*RTP clock rate (TS resolution) of this map*/
\r
526 /*optional parameters for audio, specifying number of channels. Unused for other media types.*/
\r
532 typedef struct __tag_rtp_channel GF_RTPChannel;
\r
534 GF_RTPChannel *gf_rtp_new();
\r
535 void gf_rtp_del(GF_RTPChannel *ch);
\r
537 /*you configure a server channel through the transport structure, with the same info as a
\r
538 client channel, the client_port_* info designing the REMOTE client and port_* designing
\r
539 your server channel*/
\r
540 GF_Err gf_rtp_setup_transport(GF_RTPChannel *ch, GF_RTSPTransport *trans_info, char *remote_address);
\r
542 /*auto-setup of rtp/rtcp transport ports - only effective in unicast, non interleaved cases.
\r
543 for multicast port setup MUST be done through the above gf_rtp_setup_transport function
\r
544 this will take care of port reuse*/
\r
545 GF_Err gf_rtp_set_ports(GF_RTPChannel *ch, u16 first_port);
\r
547 /*init of payload information. only ONE payload per sync source is supported in this
\r
548 version of the library (a sender cannot switch payload types on a single media)*/
\r
549 GF_Err gf_rtp_setup_payload(GF_RTPChannel *ch, GF_RTPMap *map);
\r
551 /*enables sending of NAT keep-alive packets for NAT traversal
\r
552 @nat_timeout: specifies the inactivity period in ms after which NAT keepalive packets are sent.
\r
553 If 0, disables NAT keep-alive packets
\r
555 void gf_rtp_enable_nat_keepalive(GF_RTPChannel *ch, u32 nat_timeout);
\r
558 /*initialize the RTP channel.
\r
560 UDPBufferSize: UDP stack buffer size if configurable by OS/ISP - ignored otherwise
\r
561 NOTE: on WinCE devices, this is not configurable on an app bases but for the whole OS
\r
562 you must update the device registry with:
\r
563 [HKEY_LOCAL_MACHINE\Comm\Afd]
\r
564 DgramBuffer=dword:N
\r
566 where N is the number of UDP datagrams a socket should be able to buffer. For multimedia
\r
567 app you should set N as large as possible. The device MUST be reseted for the param to take effect
\r
569 ReorederingSize: max number of packets to queue for reordering. 0 means no reordering
\r
570 MaxReorderDelay: max time to wait in ms before releasing first packet in reoderer when only one packet is present.
\r
571 If 0 and reordering size is specified, defaults to 200 ms (usually enough).
\r
572 IsSource: if true, the channel is a sender (media data, sender report, Receiver report processing)
\r
573 if source, you must specify the Path MTU size. The RTP lib won't send any packet bigger than this size
\r
574 your application shall perform payload size splitting if needed
\r
575 local_interface_ip: local interface address to use for multicast. If NULL, default address is used
\r
577 GF_Err gf_rtp_initialize(GF_RTPChannel *ch, u32 UDPBufferSize, Bool IsSource, u32 PathMTU, u32 ReorederingSize, u32 MaxReorderDelay, char *local_interface_ip);
\r
579 /*init the RTP info after a PLAY or PAUSE, rtp_time is the rtp TimeStamp of the RTP packet
\r
580 with seq_num sequence number. This info is needed to compute the CurrentTime of the RTP channel
\r
581 ssrc may not be known if sender hasn't indicated it (use 0 then)*/
\r
582 GF_Err gf_rtp_set_info_rtp(GF_RTPChannel *ch, u32 seq_num, u32 rtp_time, u32 ssrc);
\r
584 /*retrieve current RTP time in sec. If rtp_time was unknown (not on demand media) the time is absolute.
\r
585 Otherwise this is the time in ms elapsed since the last PLAY range start value
\r
586 Not supported yet if played without RTSP (aka RTCP time not supported)*/
\r
587 Double gf_rtp_get_current_time(GF_RTPChannel *ch);
\r
590 void gf_rtp_reset_buffers(GF_RTPChannel *ch);
\r
592 /*read any data on UDP only (not valid for TCP). Performs re-ordering if configured for it
\r
593 returns amount of data read (raw UDP packet size)*/
\r
594 u32 gf_rtp_read_rtp(GF_RTPChannel *ch, char *buffer, u32 buffer_size);
\r
595 u32 gf_rtp_read_rtcp(GF_RTPChannel *ch, char *buffer, u32 buffer_size);
\r
597 /*decodes an RTP packet and gets the begining of the RTP payload*/
\r
598 GF_Err gf_rtp_decode_rtp(GF_RTPChannel *ch, char *pck, u32 pck_size, GF_RTPHeader *rtp_hdr, u32 *PayloadStart);
\r
600 /*decodes an RTCP packet and update timing info, send RR too*/
\r
601 GF_Err gf_rtp_decode_rtcp(GF_RTPChannel *ch, char *pck, u32 pck_size);
\r
603 /*computes and send Receiver report. If the channel is a TCP channel, you must specify
\r
604 the callback function. NOTE: many RTP implementation do NOT process RTCP info received on TCP...
\r
605 the lib will decide whether the report shall be sent or not, therefore you should call
\r
606 this function at regular times*/
\r
607 GF_Err gf_rtp_send_rtcp_report(GF_RTPChannel *ch,
\r
608 GF_Err (*RTP_TCPCallback)(void *cbk, char *pck, u32 pck_size),
\r
611 /*send a BYE info (leaving the session)*/
\r
612 GF_Err gf_rtp_send_bye(GF_RTPChannel *ch,
\r
613 GF_Err (*RTP_TCPCallback)(void *cbk, char *pck, u32 pck_size),
\r
617 /*send RTP packet*/
\r
618 GF_Err gf_rtp_send_packet(GF_RTPChannel *ch, GF_RTPHeader *rtp_hdr, char *extra_header, u32 extra_header_size, char *pck, u32 pck_size);
\r
622 GF_RTCP_INFO_NAME = 0,
\r
623 GF_RTCP_INFO_EMAIL,
\r
624 GF_RTCP_INFO_PHONE,
\r
625 GF_RTCP_INFO_LOCATION,
\r
631 /*sets RTCP info sent in RTCP reports. info_string shall NOT exceed 255 chars*/
\r
632 GF_Err gf_rtp_set_info_rtcp(GF_RTPChannel *ch, u32 InfoCode, char *info_string);
\r
634 u32 gf_rtp_is_unicast(GF_RTPChannel *ch);
\r
635 u32 gf_rtp_is_interleaved(GF_RTPChannel *ch);
\r
636 u32 gf_rtp_get_clockrate(GF_RTPChannel *ch);
\r
637 u32 gf_rtp_is_active(GF_RTPChannel *ch);
\r
638 u8 gf_rtp_get_low_interleave_id(GF_RTPChannel *ch);
\r
639 u8 gf_rtp_get_hight_interleave_id(GF_RTPChannel *ch);
\r
640 GF_RTSPTransport *gf_rtp_get_transport(GF_RTPChannel *ch);
\r
641 u32 gf_rtp_get_local_ssrc(GF_RTPChannel *ch);
\r
643 Float gf_rtp_get_loss(GF_RTPChannel *ch);
\r
644 u32 gf_rtp_get_tcp_bytes_sent(GF_RTPChannel *ch);
\r
645 void gf_rtp_get_ports(GF_RTPChannel *ch, u16 *rtp_port, u16 *rtcp_port);
\r
651 /****************************************************************************
\r
653 SDP LIBRARY EXPORTS
\r
655 Note: SDP is mainly a text protocol with
\r
656 well defined containers. The following structures are used to write / read
\r
657 SDP informations, and the library also provides consistency checking
\r
659 When reading SDP, all text items/structures are allocated by the lib, and you
\r
660 must call gf_sdp_info_reset(GF_SDPInfo *sdp) or gf_sdp_info_del(GF_SDPInfo *sdp) to release the memory
\r
662 When writing the SDP from a GF_SDPInfo, the output buffer is allocated by the library,
\r
663 and you must release it yourself
\r
665 Some quick constructors are available for GF_SDPConnection and GF_SDPMedia in order to set up
\r
666 some specific parameters to their default value
\r
668 An extra function gf_sdp_info_check(GF_SDPInfo *sdp) is provided for compliency check
\r
669 with RFC2327: all requested fields are checked as well as conflicting information forbidden
\r
671 ****************************************************************************/
\r
674 All attributes x-ZZZZ are considered as extensions attributes. If no "x-" is found
\r
675 the attributes in the RTSP response is SKIPPED. The "x-" radical is removed in the structure
\r
676 when parsing commands / responses
\r
686 Structure for bandwidth info
\r
690 /*"CT", "AS" are defined. Private extensions must be "X-*" ( * "are recommended to be short")*/
\r
697 Structure for Time info
\r
699 /*we do not support more than ... time offsets / zone adjustment
\r
700 if more are needed, RFC recommends to use several entries rather than a big*/
\r
701 #define GF_SDP_MAX_TIMEOFFSET 10
\r
705 /*NPT time in sec*/
\r
707 /*if 0, session is unbound. NPT time in sec*/
\r
709 /*if 0 session is not repeated. Expressed in sec.
\r
710 Session is signaled repeated every repeatInterval*/
\r
711 u32 RepeatInterval;
\r
712 /*active duration of the session in sec*/
\r
713 u32 ActiveDuration;
\r
715 /*time offsets to use with repeat. Specify a non-regular repeat time from the Start time*/
\r
716 u32 OffsetFromStart[GF_SDP_MAX_TIMEOFFSET];
\r
717 /*Number of offsets*/
\r
718 u32 NbRepeatOffsets;
\r
721 a session happens 3 times a week, on mon 1PM, thu 3PM and fri 10AM
\r
722 1- StartTime should be NPT for the session on the very first monday, StopTime
\r
723 the end of this session
\r
724 2- the repeatInterval should be 1 week, ActiveDuration the length of the session
\r
725 3- 3 offsets: 0 (for monday) (3*24+2)*3600 for thu and (4*24-3) for fri
\r
729 /*timezone adjustments, to cope with #timezones, daylight saving countries and co ...
\r
730 Ex: adjTime = [2882844526 2898848070] adjOffset=[-1h 0]
\r
731 [0]: at 2882844526 the time base by which the session's repeat times are calculated
\r
732 is shifted back by 1 hour
\r
733 [1]: at time 2898848070 the session's original time base is restored
\r
736 /*Adjustment time at which the corresponding time offset is to be applied to the
\r
737 session time line (time used to compute the "repeat session").
\r
738 All Expressed in NPT*/
\r
739 u32 AdjustmentTime[GF_SDP_MAX_TIMEOFFSET];
\r
740 /* Offset with the session time line, ALWAYS ABSOLUTE OFFSET TO the specified StartTime*/
\r
741 s32 AdjustmentOffset[GF_SDP_MAX_TIMEOFFSET];
\r
742 /*Number of offsets.*/
\r
749 /*only "IN" currently defined*/
\r
753 /*hex IPv6 address or doted IPv4 address*/
\r
755 /*TTL - MUST BE PRESENT if IP is multicast - -1 otherwise*/
\r
757 /*multiple address counts - ONLY in media descriptions if needed. This
\r
758 is used for content scaling, when # quality of the same media are multicasted on
\r
761 } GF_SDPConnection;
\r
764 FMTP: description of dynamic payload types. This is opaque at the SDP level.
\r
765 Each attributes is assumed to be formatted as <param_name=param_val; ...>
\r
766 If not the case the attribute will have an empty value string and only the
\r
771 /*payload type of the format described*/
\r
773 /*list of GF_X_Attribute elements. The Value field may be NULL*/
\r
774 GF_List *Attributes;
\r
780 0: application - 1:video - 2: audio - 3: text - 4:data - 5: control*/
\r
782 /*Port Number - For transports based on UDP, the value should be in the range 1024
\r
783 to 65535 inclusive. For RTP compliance it should be an even number*/
\r
785 /*number of ports described. If >= 2, the next media(s) in the SDP will be configured
\r
786 to use the next tuple (for RTP). If 0 or 1, ignored
\r
787 Note: this is used for scalable media: PortNumber indicates the port of the base
\r
788 media and NumPorts the ports||total number of the upper layers*/
\r
790 /*currently ony "RTP/AVP" and "udp" defined*/
\r
793 /*list of GF_SDPConnection's. A media can have several connection in case of scalable content*/
\r
794 GF_List *Connections;
\r
796 /*RTPMaps contains a list SDPRTPMaps*/
\r
799 /*FMTP contains a list of FMTP structures*/
\r
802 /*for RTP this is PayloadType, but can be opaque (string) depending on the app.
\r
803 Formated as XX WW QQ FF
\r
804 When reading the SDP, the payloads defined in RTPMap are removed from this list
\r
805 When writing the SDP for RTP, you should only specify static payload types here,
\r
806 as dynamic ones are stored in RTPMaps and automatically written*/
\r
809 /*all attributes not defined in RFC 2327 for the media*/
\r
810 GF_List *Attributes;
\r
812 /*Other SDP attributes for media desc*/
\r
815 method is 'clear' (key follows), 'base64' (key in base64), 'uri' (key is the URI)
\r
816 or 'prompt' (key not included)*/
\r
817 char *k_method, *k_key;
\r
819 GF_List *Bandwidths;
\r
821 /*0 if not present*/
\r
823 /*0: none - 1: recv, 2: send, 3 both*/
\r
825 char *orientation, *sdplang, *lang;
\r
826 /*for video only, 0.0 if not present*/
\r
828 /*between 0 and 10, -1 if not present*/
\r
837 char *o_username, *o_session_id, *o_version, *o_address;
\r
838 /*"IN" for Net, "IP4" or "IP6" for address are currently valid*/
\r
839 char *o_net_type, *o_add_type;
\r
842 char *s_session_name;
\r
844 char *i_description;
\r
851 /*c= either 1 or 0 GF_SDPConnection */
\r
852 GF_SDPConnection *c_connection;
\r
854 GF_List *b_bandwidth;
\r
855 /*All time info (t, r, z)*/
\r
858 method is 'clear' (key follows), 'base64' (key in base64), 'uri' (key is the URI)
\r
859 or 'prompt' (key not included)*/
\r
860 char *k_method, *k_key;
\r
861 /*all possible attributes (a=), session level*/
\r
862 char *a_cat, *a_keywds, *a_tool;
\r
863 /*0: none, 1: recv, 2: send, 3 both*/
\r
865 /*should be `broadcast', `meeting', `moderated', `test' or `H332'*/
\r
868 char *a_sdplang, *a_lang;
\r
870 /*all attributes not defined in RFC 2327 for the presentation*/
\r
871 GF_List *Attributes;
\r
873 /*list of media in the SDP*/
\r
874 GF_List *media_desc;
\r
879 Memory Consideration: the destructors free all non-NULL string. You should therefore
\r
880 be carefull while (de-)assigning the strings. The function gf_sdp_info_parse() performs a complete
\r
881 reset of the GF_SDPInfo
\r
884 GF_SDPInfo *gf_sdp_info_new();
\r
886 void gf_sdp_info_del(GF_SDPInfo *sdp);
\r
887 /*reset all structures (destroys substructure too)*/
\r
888 void gf_sdp_info_reset(GF_SDPInfo *sdp);
\r
889 /*Parses a memory SDP buffer*/
\r
890 GF_Err gf_sdp_info_parse(GF_SDPInfo *sdp, char *sdp_text, u32 text_size);
\r
891 /*check the consistency of the GF_SDPInfo*/
\r
892 GF_Err gf_sdp_info_check(GF_SDPInfo *sdp);
\r
893 /*write the SDP to a new buffer and returns it. Automatically checks the SDP before calling*/
\r
894 GF_Err gf_sdp_info_write(GF_SDPInfo *sdp, char **out_str_buf);
\r
898 Const/dest for GF_SDPMedia
\r
900 GF_SDPMedia *gf_sdp_media_new();
\r
901 void gf_sdp_media_del(GF_SDPMedia *media);
\r
904 Const/dest for GF_SDPConnection
\r
906 GF_SDPConnection *gf_sdp_conn_new();
\r
907 void gf_sdp_conn_del(GF_SDPConnection *conn);
\r
910 Const/dest for SDP FMTP
\r
912 GF_SDP_FMTP *gf_sdp_fmtp_new();
\r
913 void gf_sdp_fmtp_del(GF_SDP_FMTP *fmtp);
\r
922 /*RTP<->SL mapping*/
\r
925 /*1 - required options*/
\r
927 /*mode, or "" if no mode ("generic" should be used instead)*/
\r
930 /*config of the stream if carried in SDP*/
\r
935 /* stream profile and level indication - for AVC/H264, 0xPPCCLL, with PP:profile, CC:compatibility, LL:level*/
\r
939 /*2 - optional options*/
\r
941 /*size of AUs if constant*/
\r
943 /*duration of AUs if constant, in RTP timescale*/
\r
944 u32 ConstantDuration;
\r
946 /* Object Type Indication */
\r
947 u8 ObjectTypeIndication;
\r
948 /*audio max displacement when interleaving (eg, de-interleaving window buffer max length) in RTP timescale*/
\r
949 u32 maxDisplacement;
\r
950 /*de-interleaveBufferSize if not recomputable from maxDisplacement*/
\r
951 u32 deinterleaveBufferSize;
\r
953 /*The number of bits on which the AU-size field is encoded in the AU-header*/
\r
955 /*The number of bits on which the AU-Index is encoded in the first AU-header*/
\r
957 /*The number of bits on which the AU-Index-delta field is encoded in any non-first AU-header*/
\r
958 u32 IndexDeltaLength;
\r
960 /*The number of bits on which the DTS-delta field is encoded in the AU-header*/
\r
961 u32 DTSDeltaLength;
\r
962 /*The number of bits on which the CTS-delta field is encoded in the AU-header*/
\r
963 u32 CTSDeltaLength;
\r
964 /*random access point flag present*/
\r
965 Bool RandomAccessIndication;
\r
967 /*The number of bits on which the Stream-state field is encoded in the AU-header (systems only)*/
\r
968 u32 StreamStateIndication;
\r
969 /*The number of bits that is used to encode the auxiliary-data-size field
\r
970 (no normative usage of this section)*/
\r
971 u32 AuxiliaryDataSizeLength;
\r
974 u8 IV_length, IV_delta_length;
\r
978 /*len of first AU header in an RTP payload*/
\r
979 u32 auh_first_min_len;
\r
984 /*packetizer config flags - some flags are dynamically re-assigned when detecting multiSL / B-Frames / ...*/
\r
987 /*forces MPEG-4 generic transport if MPEG-4 systems mapping is available*/
\r
988 GP_RTP_PCK_FORCE_MPEG4 = (1),
\r
989 /*Enables AUs concatenation in an RTP packet (if payload supports it) - this forces GP_RTP_PCK_SIGNAL_SIZE for MPEG-4*/
\r
990 GP_RTP_PCK_USE_MULTI = (1<<1),
\r
991 /*if set, audio interleaving is used if payload supports it (forces GP_RTP_PCK_USE_MULTI flag)
\r
992 THIS IS CURRENTLY NOT IMPLEMENTED*/
\r
993 GP_RTP_PCK_USE_INTERLEAVING = (1<<2),
\r
994 /*uses static RTP payloadID if any defined*/
\r
995 GP_RTP_PCK_USE_STATIC_ID = (1<<3),
\r
997 /*MPEG-4 generic transport option*/
\r
998 /*if flag set, RAP flag is signaled in RTP payload*/
\r
999 GP_RTP_PCK_SIGNAL_RAP = (1<<4),
\r
1000 /*if flag set, AU indexes are signaled in RTP payload*/
\r
1001 GP_RTP_PCK_SIGNAL_AU_IDX = (1<<5),
\r
1002 /*if flag set, AU size is signaled in RTP payload*/
\r
1003 GP_RTP_PCK_SIGNAL_SIZE = (1<<6),
\r
1004 /*if flag set, CTS is signaled in RTP payload - DTS is automatically set if needed*/
\r
1005 GP_RTP_PCK_SIGNAL_TS = (1<<7),
\r
1007 /*setup payload for carouseling of systems streams*/
\r
1008 GP_RTP_PCK_AUTO_CAROUSEL = (1<<8),
\r
1010 /*use LATM payload for AAC-LC*/
\r
1011 GP_RTP_PCK_USE_LATM_AAC = (1<<9),
\r
1013 /*ISMACryp options*/
\r
1014 /*signals that input data is selectively encrypted (eg not all input frames are encrypted)
\r
1015 - this is usually automatically set by hinter*/
\r
1016 GP_RTP_PCK_SELECTIVE_ENCRYPTION = (1<<10),
\r
1017 /*signals that each sample will have its own key indicator - ignored in non-multi modes
\r
1018 if not set and key indicator changes, a new RTP packet will be forced*/
\r
1019 GP_RTP_PCK_KEY_IDX_PER_AU = (1<<11),
\r
1025 Generic packetization tools - used by track hinters and future live tools
\r
1028 /*currently supported payload types*/
\r
1032 GF_RTP_PAYT_UNKNOWN,
\r
1033 /*use generic MPEG-4 transport - RFC 3016 and RFC 3640*/
\r
1034 GF_RTP_PAYT_MPEG4,
\r
1035 /*use generic MPEG-1/2 video transport - RFC 2250*/
\r
1036 GF_RTP_PAYT_MPEG12_VIDEO,
\r
1037 /*use generic MPEG-1/2 audio transport - RFC 2250*/
\r
1038 GF_RTP_PAYT_MPEG12_AUDIO,
\r
1039 /*use H263 transport - RFC 2429*/
\r
1041 /*use AMR transport - RFC 3267*/
\r
1043 /*use AMR-WB transport - RFC 3267*/
\r
1044 GF_RTP_PAYT_AMR_WB,
\r
1045 /*use QCELP transport - RFC 2658*/
\r
1046 GF_RTP_PAYT_QCELP,
\r
1047 /*use EVRC/SMV transport - RFC 3558*/
\r
1048 GF_RTP_PAYT_EVRC_SMV,
\r
1049 /*use 3GPP Text transport - no RFC yet, only draft*/
\r
1050 GF_RTP_PAYT_3GPP_TEXT,
\r
1051 /*use H264 transport - no RFC yet, only draft*/
\r
1052 GF_RTP_PAYT_H264_AVC,
\r
1053 /*use LATM for AAC-LC*/
\r
1055 /*use 3GPP DIMS format*/
\r
1056 GF_RTP_PAYT_3GPP_DIMS,
\r
1057 /*use AC3 audio format*/
\r
1070 RTP -> SL packetization tool
\r
1071 You should ONLY modify the GF_SLHeader while packetizing, all the rest is private
\r
1073 Also note that AU start/end is automatically updated, therefore you should only
\r
1074 set CTS-DTS-OCR-sequenceNumber (which is automatically incremented when spliting a payload)
\r
1075 -padding-idle infos
\r
1076 SL flags are computed on the fly, but you may wish to modify them in case of
\r
1077 packet drop/... at the encoder side
\r
1080 struct __tag_rtp_packetizer
\r
1082 /*input packet sl header cfg. modify only if needed*/
\r
1083 GF_SLHeader sl_header;
\r
1087 PRIVATE _ DO NOT TOUCH
\r
1090 /*RTP payload type (RFC type, NOT the RTP hdr payT)*/
\r
1092 /*packetization flags*/
\r
1094 /*Path MTU size without 12-bytes RTP header*/
\r
1096 /*max packet duration in RTP TS*/
\r
1099 /*payload type of RTP packets - only one payload type can be used in GPAC*/
\r
1102 /*RTP header of current packet*/
\r
1103 GF_RTPHeader rtp_header;
\r
1105 /*RTP packet handling callbacks*/
\r
1106 void (*OnNewPacket)(void *cbk_obj, GF_RTPHeader *header);
\r
1107 void (*OnPacketDone)(void *cbk_obj, GF_RTPHeader *header);
\r
1108 void (*OnDataReference)(void *cbk_obj, u32 payload_size, u32 offset_from_orig);
\r
1109 void (*OnData)(void *cbk_obj, char *data, u32 data_size, Bool is_header);
\r
1112 /*********************************
\r
1113 MPEG-4 Generic hinting
\r
1114 *********************************/
\r
1117 GP_RTPSLMap slMap;
\r
1118 /*SL conf and state*/
\r
1119 GF_SLConfig sl_config;
\r
1121 /*set to 1 if firstSL in RTP packet*/
\r
1122 Bool first_sl_in_rtp;
\r
1123 Bool has_AU_header;
\r
1124 /*current info writers*/
\r
1125 GF_BitStream *pck_hdr, *payload;
\r
1127 /*AU SN of last au*/
\r
1130 /*info for the current packet*/
\r
1131 u32 auh_size, bytesInPacket;
\r
1133 /*********************************
\r
1135 *********************************/
\r
1136 Bool force_flush, is_encrypted;
\r
1137 u64 IV, first_AU_IV;
\r
1138 char *key_indicator;
\r
1140 /*********************************
\r
1142 *********************************/
\r
1143 /*AVC non-IDR flag: set if all NAL in current packet are non-IDR (disposable)*/
\r
1146 /*********************************
\r
1148 *********************************/
\r
1154 /*generic rtp builder (packetizer)*/
\r
1155 typedef struct __tag_rtp_packetizer GP_RTPPacketizer;
\r
1157 /*creates a new builder
\r
1158 @hintType: hint media type, one of the above
\r
1159 @flags: hint flags (cf above)
\r
1160 @slc: user-given SL config to use. If none specified, default RFC config is used
\r
1161 @cbk_obj: callback object passed back in functions
\r
1162 @OnNewPacket: callback function starting new RTP packet
\r
1163 @header: rtp header for new packet - note that RTP header flags are not used until PacketDone is called
\r
1164 @OnPacketDone: callback function closing current RTP packet
\r
1165 @header: final rtp header for packet
\r
1166 @OnDataReference: optional, to call each time data from input buffer is added to current RTP packet.
\r
1167 If not set, data must be added through OnData
\r
1168 @payload_size: size of reference data
\r
1169 @offset_from_orig: start offset in input buffer
\r
1170 @OnData: to call each time data is added to current RTP packet (either extra data from payload or
\r
1171 data from input when not using referencing)
\r
1172 @is_head: signal the data added MUST be inserted at the begining of the payload. Otherwise data
\r
1173 is concatenated as received
\r
1175 GP_RTPPacketizer *gf_rtp_builder_new(u32 hintType,
\r
1176 GF_SLConfig *slc,
\r
1179 void (*OnNewPacket)(void *cbk, GF_RTPHeader *header),
\r
1180 void (*OnPacketDone)(void *cbk, GF_RTPHeader *header),
\r
1181 void (*OnDataReference)(void *cbk, u32 payload_size, u32 offset_from_orig),
\r
1182 void (*OnData)(void *cbk, char *data, u32 data_size, Bool is_head)
\r
1185 /*destroy builder*/
\r
1186 void gf_rtp_builder_del(GP_RTPPacketizer *builder);
\r
1190 @MaxPayloadSize: maximum payload size of RTP packets (eg MTU minus IP/UDP/RTP headers)
\r
1191 @max_ptime: maximum packet duration IN RTP TIMESCALE
\r
1192 @StreamType: MPEG-4 system stream type - MUST always be provided for payloads format specifying
\r
1193 audio or video streams
\r
1194 @OTI : MPEG-4 system objectTypeIndication - may be 0 if stream is not mpeg4 systems
\r
1196 *** all other params are for MultiSL draft ***
\r
1198 @avgSize: average size of an AU. This is not always known (real-time encoding).
\r
1199 In this case you should specify a rough compute indicating how many packets could be
\r
1200 stored per RTP packet. for ex AAC stereo at 44100 k / 64kbps , one AU ~= 380 bytes
\r
1201 so 3 AUs for 1500 MTU is ok - BE CAREFULL: MultiSL adds some SL info on top of the 12
\r
1202 byte RTP header so you should specify a smaller size
\r
1203 The packetizer will ALWAYS make sure there's no pb storing the packets so specifying
\r
1204 more will result in a slight overhead in the SL mapping but the gain to singleSL
\r
1205 will still be worth it.
\r
1206 -Nota: at init, the packetizer can decide to switch to SingleSL if the average size
\r
1207 specified is too close to the PathMTU
\r
1209 @maxSize: max size of an AU. If unknown (real-time) set to 0
\r
1210 @avgTS: average CTS progression (1000/FPS for video)
\r
1211 @maxDTS: maximum DTS offset in case of bidirectional coding.
\r
1212 @IV_length: size (in bytes) of IV when ISMACrypted
\r
1213 @KI_length: size (in bytes) of key indicator when ISMACrypted
\r
1214 @pref_mode: MPEG-4 generic only, specifies the payload mode - can be NULL (mode generic)
\r
1217 void gf_rtp_builder_init(GP_RTPPacketizer *builder, u8 PayloadType, u32 MaxPayloadSize, u32 max_ptime,
\r
1218 u32 StreamType, u32 OTI, u32 PL_ID,
\r
1219 u32 avgSize, u32 maxSize,
\r
1220 u32 avgTS, u32 maxDTS,
\r
1221 u32 IV_length, u32 KI_length,
\r
1224 /*set frame crypto info*/
\r
1225 void gp_rtp_builder_set_cryp_info(GP_RTPPacketizer *builder, u64 IV, char *key_indicator, Bool is_encrypted);
\r
1226 /*packetize input buffer
\r
1227 @data, @data_size: input buffer
\r
1228 @IsAUEnd: set to one if this buffer is the last of the AU
\r
1229 @FullAUSize: complete access unit size if known, 0 otherwise
\r
1230 @duration: sample duration in rtp timescale (only needed for 3GPP text streams)
\r
1231 @descIndex: sample description index (only needed for 3GPP text streams)
\r
1233 GF_Err gf_rtp_builder_process(GP_RTPPacketizer *builder, char *data, u32 data_size, u8 IsAUEnd, u32 FullAUSize, u32 duration, u8 descIndex);
\r
1235 /*format the "fmtp: " attribute for the MPEG-4 generic packetizer. sdpline shall be at least 2000 char*/
\r
1236 GF_Err gf_rtp_builder_format_sdp(GP_RTPPacketizer *builder, char *payload_name, char *sdpLine, char *dsi, u32 dsi_size);
\r
1237 /*formats SDP payload name and media name - both MUST be at least 20 bytes*/
\r
1238 Bool gf_rtp_builder_get_payload_name(GP_RTPPacketizer *builder, char *szPayloadName, char *szMediaName);
\r
1244 /*rtp payload flags*/
\r
1247 /*AU end was detected (eg next packet is AU start)*/
\r
1248 GF_RTP_NEW_AU = (1),
\r
1250 GF_RTP_AMR_ALIGN = (1<<1),
\r
1251 /*for RFC3016, signals bitstream inspection for RAP discovery*/
\r
1252 GF_RTP_M4V_CHECK_RAP = (1<<2),
\r
1253 /*flag set when unreliable usage of the M bit is detected*/
\r
1254 GF_RTP_UNRELIABLE_M = (1<<3),
\r
1256 /*AWFULL hack at rtp level to cope with ffmpeg h264 crashes when jumping in stream without IDR*/
\r
1257 GF_RTP_AVC_WAIT_RAP = (1<<4),
\r
1258 /*ISMACryp stuff*/
\r
1259 GF_RTP_HAS_ISMACRYP = (1<<5),
\r
1260 GF_RTP_ISMA_SEL_ENC = (1<<6),
\r
1261 GF_RTP_ISMA_HAS_KEY_IDX = (1<<7)
\r
1265 SL -> RTP packetization tool
\r
1268 struct __tag_rtp_depacketizer
\r
1270 /*depacketize routine*/
\r
1271 void (*depacketize)(struct __tag_rtp_depacketizer *rtp, GF_RTPHeader *hdr, char *payload, u32 size);
\r
1273 /*output packet sl header cfg*/
\r
1274 GF_SLHeader sl_hdr;
\r
1276 /*RTP payload type (RFC type, NOT the RTP hdr payT)*/
\r
1278 /*depacketization flags*/
\r
1281 /*callback routine*/
\r
1282 void (*on_sl_packet)(void *udta, char *payload, u32 size, GF_SLHeader *hdr, GF_Err e);
\r
1285 /*SL <-> RTP map*/
\r
1286 GP_RTPSLMap sl_map;
\r
1289 /*inter-packet reconstruction bitstream (for 3GP text and H264)*/
\r
1290 GF_BitStream *inter_bs;
\r
1292 /*H264/AVC config*/
\r
1293 u32 h264_pck_mode;
\r
1295 /*3GP text reassembler state*/
\r
1296 u8 nb_txt_frag, cur_txt_frag, sidx, txt_len, nb_mod_frag;
\r
1303 /*generic rtp builder (packetizer)*/
\r
1304 typedef struct __tag_rtp_depacketizer GF_RTPDepacketizer;
\r
1306 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);
\r
1307 void gf_rtp_depacketizer_del(GF_RTPDepacketizer *rtp);
\r
1308 void gf_rtp_depacketizer_reset(GF_RTPDepacketizer *rtp, Bool full_reset);
\r
1309 void gf_rtp_depacketizer_process(GF_RTPDepacketizer *rtp, GF_RTPHeader *hdr, char *payload, u32 size);
\r
1311 void gf_rtp_depacketizer_get_slconfig(GF_RTPDepacketizer *rtp, GF_SLConfig *sl);
\r
1314 #ifdef __cplusplus
\r
1318 #endif /*_GF_IETF_H_*/
\r