• Main Page
  • Related Pages
  • Modules
  • Data Structures
  • Files
  • File List
  • Globals

libavformat/rtsp.h

Go to the documentation of this file.
00001 /*
00002  * RTSP definitions
00003  * Copyright (c) 2002 Fabrice Bellard
00004  *
00005  * This file is part of FFmpeg.
00006  *
00007  * FFmpeg 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  * FFmpeg 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 FFmpeg; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
00020  */
00021 #ifndef AVFORMAT_RTSP_H
00022 #define AVFORMAT_RTSP_H
00023 
00024 #include <stdint.h>
00025 #include "avformat.h"
00026 #include "rtspcodes.h"
00027 #include "rtpdec.h"
00028 #include "network.h"
00029 #include "httpauth.h"
00030 
00034 enum RTSPLowerTransport {
00035     RTSP_LOWER_TRANSPORT_UDP = 0,           
00036     RTSP_LOWER_TRANSPORT_TCP = 1,           
00037     RTSP_LOWER_TRANSPORT_UDP_MULTICAST = 2, 
00038     RTSP_LOWER_TRANSPORT_NB
00039 };
00040 
00046 enum RTSPTransport {
00047     RTSP_TRANSPORT_RTP, 
00048     RTSP_TRANSPORT_RDT, 
00049     RTSP_TRANSPORT_NB
00050 };
00051 
00052 #define RTSP_DEFAULT_PORT   554
00053 #define RTSP_MAX_TRANSPORTS 8
00054 #define RTSP_TCP_MAX_PACKET_SIZE 1472
00055 #define RTSP_DEFAULT_NB_AUDIO_CHANNELS 2
00056 #define RTSP_DEFAULT_AUDIO_SAMPLERATE 44100
00057 #define RTSP_RTP_PORT_MIN 5000
00058 #define RTSP_RTP_PORT_MAX 10000
00059 
00067 typedef struct RTSPTransportField {
00072     int interleaved_min, interleaved_max;
00073 
00076     int port_min, port_max;
00077 
00080     int client_port_min, client_port_max;
00081 
00084     int server_port_min, server_port_max;
00085 
00088     int ttl;
00089 
00090     uint32_t destination; 
00093     enum RTSPTransport transport;
00094 
00096     enum RTSPLowerTransport lower_transport;
00097 } RTSPTransportField;
00098 
00102 typedef struct RTSPMessageHeader {
00104     int content_length;
00105 
00106     enum RTSPStatusCode status_code; 
00109     int nb_transports;
00110 
00113     int64_t range_start, range_end;
00114 
00117     RTSPTransportField transports[RTSP_MAX_TRANSPORTS];
00118 
00119     int seq;                         
00123     char session_id[512];
00124 
00127     char location[4096];
00128 
00130     char real_challenge[64];
00131 
00139     char server[64];
00140 
00147     int timeout;
00148 
00152     int notice;
00153 } RTSPMessageHeader;
00154 
00160 enum RTSPClientState {
00161     RTSP_STATE_IDLE,    
00162     RTSP_STATE_STREAMING, 
00163     RTSP_STATE_PAUSED,  
00164     RTSP_STATE_SEEKING, 
00165 };
00166 
00171 enum RTSPServerType {
00172     RTSP_SERVER_RTP,  
00173     RTSP_SERVER_REAL, 
00174     RTSP_SERVER_WMS,  
00175     RTSP_SERVER_NB
00176 };
00177 
00183 typedef struct RTSPState {
00184     URLContext *rtsp_hd; /* RTSP TCP connexion handle */
00185 
00187     int nb_rtsp_streams;
00188 
00189     struct RTSPStream **rtsp_streams; 
00195     enum RTSPClientState state;
00196 
00203     int64_t seek_timestamp;
00204 
00205     /* XXX: currently we use unbuffered input */
00206     //    ByteIOContext rtsp_gb;
00207 
00208     int seq;                          
00212     char session_id[512];
00213 
00217     int timeout;
00218 
00222     int64_t last_cmd_time;
00223 
00225     enum RTSPTransport transport;
00226 
00229     enum RTSPLowerTransport lower_transport;
00230 
00234     enum RTSPServerType server_type;
00235 
00237     char auth[128];
00238 
00240     HTTPAuthState auth_state;
00241 
00243     char last_reply[2048]; /* XXX: allocate ? */
00244 
00247     void *cur_transport_priv;
00248 
00252     int need_subscription;
00253 
00256     enum AVDiscard real_setup_cache[MAX_STREAMS];
00257 
00261     char last_subscription[1024];
00263 
00267     AVFormatContext *asf_ctx;
00268 
00271     uint64_t asf_pb_pos;
00273 
00277     char control_uri[1024];
00278 
00280     int64_t start_time;
00281 } RTSPState;
00282 
00289 typedef struct RTSPStream {
00290     URLContext *rtp_handle;   
00291     void *transport_priv; 
00294     int stream_index;
00295 
00298     int interleaved_min, interleaved_max;
00299 
00300     char control_url[1024];   
00304     int sdp_port;             
00305     struct in_addr sdp_ip;    
00306     int sdp_ttl;              
00307     int sdp_payload_type;     
00309 
00313     RTPPayloadData rtp_payload_data;
00314 
00318     RTPDynamicProtocolHandler *dynamic_handler;
00319 
00321     PayloadContext *dynamic_protocol_context;
00323 } RTSPStream;
00324 
00325 void ff_rtsp_parse_line(RTSPMessageHeader *reply, const char *buf,
00326                         HTTPAuthState *auth_state);
00327 
00328 #if LIBAVFORMAT_VERSION_INT < (53 << 16)
00329 extern int rtsp_default_protocols;
00330 #endif
00331 extern int rtsp_rtp_port_min;
00332 extern int rtsp_rtp_port_max;
00333 
00345 void ff_rtsp_send_cmd_with_content_async(AVFormatContext *s,
00346                                          const char *method, const char *url,
00347                                          const char *headers,
00348                                          const unsigned char *send_content,
00349                                          int send_content_length);
00355 void ff_rtsp_send_cmd_async(AVFormatContext *s, const char *method,
00356                             const char *url, const char *headers);
00357 
00372 void ff_rtsp_send_cmd_with_content(AVFormatContext *s,
00373                                    const char *method, const char *url,
00374                                    const char *headers,
00375                                    RTSPMessageHeader *reply,
00376                                    unsigned char **content_ptr,
00377                                    const unsigned char *send_content,
00378                                    int send_content_length);
00379 
00385 void ff_rtsp_send_cmd(AVFormatContext *s, const char *method,
00386                       const char *url, const char *headers,
00387                       RTSPMessageHeader *reply, unsigned char **content_ptr);
00388 
00410 int ff_rtsp_read_reply(AVFormatContext *s, RTSPMessageHeader *reply,
00411                        unsigned char **content_ptr,
00412                        int return_on_interleaved_data);
00413 
00417 void ff_rtsp_skip_packet(AVFormatContext *s);
00418 
00428 int ff_rtsp_connect(AVFormatContext *s);
00429 
00435 void ff_rtsp_close_streams(AVFormatContext *s);
00436 
00437 #endif /* AVFORMAT_RTSP_H */

Generated on Fri Sep 16 2011 17:17:51 for FFmpeg by  doxygen 1.7.1