00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00027 #ifndef NEMESI_RTSP_H
00028 #define NEMESI_RTSP_H
00029
00030 #include <pthread.h>
00031 #include "cc.h"
00032 #include "transport.h"
00033 #include "rtp.h"
00034 #include "sdp.h"
00035 #include <netembryo/rtsp_errors.h>
00036
00038 #define RTSP_DEFAULT_PORT 554
00039
00041 #define RTSP_VER "RTSP/1.0"
00042
00044 #define RTSP_EL "\r\n"
00045
00047 #define RTSP_MIN_RTP_PORT 1024
00048
00049 #define RTSP_READY 0
00050 #define RTSP_BUSY 1
00051
00052 #define RTSP_SESSION_ID_LEN 256
00053
00054 typedef struct {
00055 int first_rtp_port;
00056 int prebuffer_size;
00057 sock_type pref_rtsp_proto;
00058 sock_type pref_rtp_proto;
00059 } nms_rtsp_hints;
00060
00075 typedef struct rtsp_medium_s {
00076 sdp_medium_info *medium_info;
00077 rtp_session *rtp_sess;
00079 struct rtsp_medium_s *next;
00080 char *filename;
00083 } rtsp_medium;
00084
00103 typedef struct rtsp_session_s {
00104 char Session_ID[RTSP_SESSION_ID_LEN];
00105 int CSeq;
00107 char *pathname;
00110 char *content_base;
00116 sdp_session_info *info;
00118 rtsp_medium *media_queue;
00119 struct rtsp_session_s *next;
00121
00122
00123
00124 char *body;
00128 } rtsp_session;
00129
00133 enum states { INIT, READY, PLAYING, RECORDING, STATES_NUM };
00134
00138 #define RTSP_COMMON_IF \
00139 pthread_mutex_t comm_mutex; \
00140 struct command *comm; \
00141 enum states status; \
00142 unsigned char busy; \
00144 pthread_t rtsp_tid; \
00145 char descr_fmt; \
00146 rtsp_session *rtsp_queue; \
00147 cc_perm_mask accepted_CC; \
00148 int response_id;
00150 typedef struct rtsp_ctrl_t {
00151 RTSP_COMMON_IF
00152 } rtsp_ctrl;
00153
00154 extern RTSP_Error const RTSP_Ready;
00155 extern RTSP_Error const RTSP_Reinitialized;
00156
00174 rtsp_ctrl *rtsp_init(nms_rtsp_hints *);
00175 int rtsp_is_busy(rtsp_ctrl *);
00176
00177 RTSP_Error rtsp_wait(rtsp_ctrl *);
00178 int rtsp_close(rtsp_ctrl *);
00179 int rtsp_open(rtsp_ctrl *, char *);
00180 int rtsp_pause(rtsp_ctrl *);
00181 int rtsp_stop(rtsp_ctrl *);
00182
00183 int rtsp_play(rtsp_ctrl *, double, double);
00184 int rtsp_seek(rtsp_ctrl *, double, double);
00185
00186 int rtsp_uninit(rtsp_ctrl *);
00187
00188 #define rtsp_status(ctrl) ctrl->status
00189 void rtsp_info_print(rtsp_ctrl *);
00190
00191 rtp_thread *rtsp_get_rtp_th(rtsp_ctrl * rtsp_ctl);
00192 rtp_session *rtsp_get_rtp_queue(rtsp_ctrl * rtsp_ctl);
00193
00198 #endif