rtsp.h

Go to the documentation of this file.
00001 /* * 
00002  * This file is part of libnemesi
00003  *
00004  * Copyright (C) 2007 by LScube team <team@streaming.polito.it>
00005  * See AUTHORS for more details
00006  * 
00007  * libnemesi is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU Lesser General Public
00009  * License as published by the Free Software Foundation; either
00010  * version 2.1 of the License, or (at your option) any later version.
00011  *
00012  * libnemesi is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015  * Lesser General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Lesser General Public
00018  * License along with libnemesi; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
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     /* Do NOT USE IT! JUST FOR INTERNAL USAGE!  */
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; /* Description format inside RTSP body */ \
00146             rtsp_session *rtsp_queue; \
00147             cc_perm_mask accepted_CC;    /* accepted CC licenses */ \
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 /* NEMESI_RTSP_H */

Generated on Tue Feb 3 03:10:02 2009 for libnemesi by  doxygen 1.5.4