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