diff options
Diffstat (limited to 'src/input/librtsp')
-rw-r--r-- | src/input/librtsp/Makefile.am | 16 | ||||
-rw-r--r-- | src/input/librtsp/rtsp.c | 27 | ||||
-rw-r--r-- | src/input/librtsp/rtsp.h | 10 | ||||
-rw-r--r-- | src/input/librtsp/rtsp_session.c | 22 |
4 files changed, 39 insertions, 36 deletions
diff --git a/src/input/librtsp/Makefile.am b/src/input/librtsp/Makefile.am index bb85f9cf4..68d554c2c 100644 --- a/src/input/librtsp/Makefile.am +++ b/src/input/librtsp/Makefile.am @@ -1,16 +1,10 @@ include $(top_srcdir)/misc/Makefile.common -AM_CPPFLAGS = -D_LARGEFILE64_SOURCE -I$(srcdir)/../libreal +AM_CFLAGS = $(DEFAULT_OCFLAGS) $(VISIBILITY_FLAG) +AM_CPPFLAGS = -I$(top_srcdir)/src/input/libreal -noinst_LTLIBRARIES = librtsp.la - -librtsp_la_SOURCES = \ - rtsp.c \ - rtsp_session.c +noinst_HEADERS = rtsp.h rtsp_session.h -librtsp_la_CFLAGS = $(VISIBILITY_FLAG) -librtsp_la_LDFLAGS = -avoid-version -module +noinst_LTLIBRARIES = librtsp.la -noinst_HEADERS = \ - rtsp.h \ - rtsp_session.h +librtsp_la_SOURCES = rtsp.c rtsp_session.c diff --git a/src/input/librtsp/rtsp.c b/src/input/librtsp/rtsp.c index 07769064a..cc1f398ac 100644 --- a/src/input/librtsp/rtsp.c +++ b/src/input/librtsp/rtsp.c @@ -25,6 +25,8 @@ #include <config.h> #endif +#include <config.h> + #include <unistd.h> #include <stdio.h> #include <assert.h> @@ -47,8 +49,8 @@ */ #include "rtsp.h" -#include "io_helper.h" -#include "xineutils.h" +#include <xine/io_helper.h> +#include <xine/xineutils.h> #define BUF_SIZE 4096 #define HEADER_SIZE 1024 @@ -81,7 +83,7 @@ struct rtsp_s { * constants */ -const char rtsp_protocol_version[]="RTSP/1.0"; +static const char rtsp_protocol_version[]="RTSP/1.0"; /* server states */ #define RTSP_CONNECTED 1 @@ -107,8 +109,7 @@ const char rtsp_protocol_version[]="RTSP/1.0"; */ static char *rtsp_get(rtsp_t *s) { - - char *buffer = malloc(BUF_SIZE); + char buffer[BUF_SIZE]; char *string = NULL; if ( _x_io_tcp_read_line(s->stream, s->s, buffer, BUF_SIZE) >= 0 ) { @@ -116,7 +117,6 @@ static char *rtsp_get(rtsp_t *s) { string = strdup( buffer ); } - free(buffer); return string; } @@ -139,8 +139,6 @@ static void rtsp_put(rtsp_t *s, const char *string) { _x_io_tcp_write(s->stream, s->s, buf, len+2); lprintf("done.\n"); - - free(buf); } /* @@ -179,7 +177,7 @@ static void rtsp_send_request(rtsp_t *s, const char *type, const char *what) { asprintf(&buf,"%s %s %s",type, what, rtsp_protocol_version); rtsp_put(s,buf); - free(buf); + if (payload) while (*payload) { rtsp_put(s,*payload); @@ -204,7 +202,6 @@ static void rtsp_schedule_standard(rtsp_t *s) { char *buf; asprintf(&buf, "Session: %s", s->session); rtsp_schedule_field(s, buf); - free(buf); } } /* @@ -362,19 +359,21 @@ int rtsp_request_play(rtsp_t *s, const char *what) { return rtsp_get_answers(s); } +#if 0 int rtsp_request_tearoff(rtsp_t *s, const char *what) { rtsp_send_request(s,"TEAROFF",what); return rtsp_get_answers(s); } +#endif /* * read opaque data from stream */ -int rtsp_read_data(rtsp_t *s, char *buffer, unsigned int size) { - +int rtsp_read_data(rtsp_t *s, void *buffer_gen, unsigned int size) { + uint8_t *buffer = buffer_gen; int i,seq; if (size>=4) { @@ -560,6 +559,7 @@ char *rtsp_search_answers(rtsp_t *s, const char *tag) { return NULL; } +#if 0 /* * session id management */ @@ -577,6 +577,7 @@ char *rtsp_get_session(rtsp_t *s) { return s->session; } +#endif char *rtsp_get_mrl(rtsp_t *s) { @@ -600,6 +601,7 @@ void rtsp_schedule_field(rtsp_t *s, const char *string) { s->scheduled[i]=strdup(string); } +#if 0 /* * removes the first scheduled field which prefix matches string. */ @@ -620,6 +622,7 @@ void rtsp_unschedule_field(rtsp_t *s, const char *string) { *(ptr-1)=*ptr; } while(*ptr); } +#endif /* * unschedule all fields diff --git a/src/input/librtsp/rtsp.h b/src/input/librtsp/rtsp.h index 2e1fd6aa0..8aee8e049 100644 --- a/src/input/librtsp/rtsp.h +++ b/src/input/librtsp/rtsp.h @@ -25,7 +25,7 @@ #define HAVE_RTSP_H /*#include <inttypes.h> */ -#include "xine_internal.h" +#include <xine/xine_internal.h> #ifdef __CYGWIN__ #define uint32_t unsigned int @@ -47,11 +47,13 @@ int rtsp_request_describe(rtsp_t *s, const char *what); int rtsp_request_setup(rtsp_t *s, const char *what); int rtsp_request_setparameter(rtsp_t *s, const char *what); int rtsp_request_play(rtsp_t *s, const char *what); +#if 0 int rtsp_request_tearoff(rtsp_t *s, const char *what); +#endif int rtsp_send_ok(rtsp_t *s); -int rtsp_read_data(rtsp_t *s, char *buffer, unsigned int size); +int rtsp_read_data(rtsp_t *s, void *buffer, unsigned int size); char* rtsp_search_answers(rtsp_t *s, const char *tag); void rtsp_add_to_payload(char **payload, const char *string); @@ -61,15 +63,19 @@ void rtsp_free_answers(rtsp_t *this); int rtsp_read (rtsp_t *this, char *data, int len); void rtsp_close (rtsp_t *this); +#if 0 void rtsp_set_session(rtsp_t *s, const char *id); char *rtsp_get_session(rtsp_t *s); +#endif char *rtsp_get_mrl(rtsp_t *s); /*int rtsp_peek_header (rtsp_t *this, char *data); */ void rtsp_schedule_field(rtsp_t *s, const char *string); +#if 0 void rtsp_unschedule_field(rtsp_t *s, const char *string); +#endif void rtsp_unschedule_all(rtsp_t *s); #endif diff --git a/src/input/librtsp/rtsp_session.c b/src/input/librtsp/rtsp_session.c index 4e636410d..88e0f87d1 100644 --- a/src/input/librtsp/rtsp_session.c +++ b/src/input/librtsp/rtsp_session.c @@ -41,7 +41,7 @@ #include "real.h" #include "rmff.h" #include "asmrp.h" -#include "xineutils.h" +#include <xine/xineutils.h> #define BUF_SIZE 4096 #define HEADER_SIZE 4096 @@ -65,15 +65,15 @@ struct rtsp_session_s { }; /* network bandwidth */ -const uint32_t rtsp_bandwidths[]={14400,19200,28800,33600,34430,57600, - 115200,262200,393216,524300,1544000,10485800}; +static const uint32_t rtsp_bandwidths[]={14400,19200,28800,33600,34430,57600, + 115200,262200,393216,524300,1544000,10485800}; -const char *rtsp_bandwidth_strs[]={"14.4 Kbps (Modem)", "19.2 Kbps (Modem)", - "28.8 Kbps (Modem)", "33.6 Kbps (Modem)", - "34.4 Kbps (Modem)", "57.6 Kbps (Modem)", - "115.2 Kbps (ISDN)", "262.2 Kbps (Cable/DSL)", - "393.2 Kbps (Cable/DSL)","524.3 Kbps (Cable/DSL)", - "1.5 Mbps (T1)", "10.5 Mbps (LAN)", NULL}; +static const char *const rtsp_bandwidth_strs[]={"14.4 Kbps (Modem)", "19.2 Kbps (Modem)", + "28.8 Kbps (Modem)", "33.6 Kbps (Modem)", + "34.4 Kbps (Modem)", "57.6 Kbps (Modem)", + "115.2 Kbps (ISDN)", "262.2 Kbps (Cable/DSL)", + "393.2 Kbps (Cable/DSL)","524.3 Kbps (Cable/DSL)", + "1.5 Mbps (T1)", "10.5 Mbps (LAN)", NULL}; rtsp_session_t *rtsp_session_start(xine_stream_t *stream, char *mrl) { @@ -87,7 +87,7 @@ rtsp_session_t *rtsp_session_start(xine_stream_t *stream, char *mrl) { uint32_t bandwidth; bandwidth_id = xine->config->register_enum(xine->config, "media.network.bandwidth", 10, - (char **)rtsp_bandwidth_strs, + rtsp_bandwidth_strs, _("network bandwidth"), _("Specify the bandwidth of your internet connection here. " "This will be used when streaming servers offer different versions " @@ -195,7 +195,7 @@ int rtsp_session_read (rtsp_session_t *this, char *data, int len) { int to_copy; char *dest=data; - char *source=this->recv + this->recv_read; + uint8_t *source=this->recv + this->recv_read; int fill=this->recv_size - this->recv_read; if (len < 0) |