-
Michael Niedermayer authored
Originally committed as revision 5146 to svn://svn.ffmpeg.org/ffmpeg/trunk
Michael Niedermayer authoredOriginally committed as revision 5146 to svn://svn.ffmpeg.org/ffmpeg/trunk
rtsp.c 40.65 KiB
/*
* RTSP/SDP client
* Copyright (c) 2002 Fabrice Bellard.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "avformat.h"
#include <unistd.h> /* for select() prototype */
#include <sys/time.h>
#include <netinet/in.h>
#include <sys/socket.h>
#ifndef __BEOS__
# include <arpa/inet.h>
#else
# include "barpainet.h"
#endif
//#define DEBUG
//#define DEBUG_RTP_TCP
enum RTSPClientState {
RTSP_STATE_IDLE,
RTSP_STATE_PLAYING,
RTSP_STATE_PAUSED,
};
typedef struct RTSPState {
URLContext *rtsp_hd; /* RTSP TCP connexion handle */
int nb_rtsp_streams;
struct RTSPStream **rtsp_streams;
enum RTSPClientState state;
int64_t seek_timestamp;
/* XXX: currently we use unbuffered input */
// ByteIOContext rtsp_gb;
int seq; /* RTSP command sequence number */
char session_id[512];
enum RTSPProtocol protocol;
char last_reply[2048]; /* XXX: allocate ? */
RTPDemuxContext *cur_rtp;
} RTSPState;
typedef struct RTSPStream {
URLContext *rtp_handle; /* RTP stream handle */
RTPDemuxContext *rtp_ctx; /* RTP parse context */
int stream_index; /* corresponding stream index, if any. -1 if none (MPEG2TS case) */
int interleaved_min, interleaved_max; /* interleave ids, if TCP transport */
char control_url[1024]; /* url for this stream (from SDP) */
int sdp_port; /* port (from SDP content - not used in RTSP) */
struct in_addr sdp_ip; /* IP address (from SDP content - not used in RTSP) */
int sdp_ttl; /* IP TTL (from SDP content - not used in RTSP) */
int sdp_payload_type; /* payload type - only used in SDP */
rtp_payload_data_t rtp_payload_data; /* rtp payload parsing infos from SDP */
} RTSPStream;