00001
00002
00003
00004
00005 #ifndef RTSP_H
00006 #define RTSP_H
00007
00008 enum RTSPStatusCode {
00009 #define DEF(n, c, s) c = n,
00010 #include "rtspcodes.h"
00011 #undef DEF
00012 };
00013
00014 enum RTSPProtocol {
00015 RTSP_PROTOCOL_RTP_UDP = 0,
00016 RTSP_PROTOCOL_RTP_TCP = 1,
00017 RTSP_PROTOCOL_RTP_UDP_MULTICAST = 2,
00018 };
00019
00020 #define RTSP_DEFAULT_PORT 554
00021 #define RTSP_MAX_TRANSPORTS 8
00022 #define RTSP_TCP_MAX_PACKET_SIZE 1472
00023 #define RTSP_DEFAULT_NB_AUDIO_CHANNELS 2
00024 #define RTSP_DEFAULT_AUDIO_SAMPLERATE 44100
00025 #define RTSP_RTP_PORT_MIN 5000
00026 #define RTSP_RTP_PORT_MAX 10000
00027
00028 typedef struct RTSPTransportField {
00029 int interleaved_min, interleaved_max;
00030 int port_min, port_max;
00031 int client_port_min, client_port_max;
00032 int server_port_min, server_port_max;
00033 int ttl;
00034 uint32_t destination;
00035 enum RTSPProtocol protocol;
00036 } RTSPTransportField;
00037
00038 typedef struct RTSPHeader {
00039 int content_length;
00040 enum RTSPStatusCode status_code;
00041 int nb_transports;
00042
00043 int64_t range_start, range_end;
00044 RTSPTransportField transports[RTSP_MAX_TRANSPORTS];
00045 int seq;
00046 char session_id[512];
00047 } RTSPHeader;
00048
00049 enum RTSPCallbackAction {
00050 RTSP_ACTION_SERVER_SETUP,
00051 RTSP_ACTION_SERVER_TEARDOWN,
00052 RTSP_ACTION_CLIENT_SETUP,
00053 RTSP_ACTION_CLIENT_TEARDOWN,
00054 };
00055
00056 typedef struct RTSPActionServerSetup {
00057 uint32_t ipaddr;
00058 char transport_option[512];
00059 } RTSPActionServerSetup;
00060
00061 typedef int FFRTSPCallback(enum RTSPCallbackAction action,
00062 const char *session_id,
00063 char *buf, int buf_size,
00064 void *arg);
00065
00066 void rtsp_set_callback(FFRTSPCallback *rtsp_cb);
00067
00068 int rtsp_init(void);
00069 void rtsp_parse_line(RTSPHeader *reply, const char *buf);
00070
00071 extern int rtsp_default_protocols;
00072 extern int rtsp_rtp_port_min;
00073 extern int rtsp_rtp_port_max;
00074 extern FFRTSPCallback *ff_rtsp_callback;
00075 extern AVInputFormat rtsp_demuxer;
00076
00077 int rtsp_pause(AVFormatContext *s);
00078 int rtsp_resume(AVFormatContext *s);
00079
00080 #endif