Update of /cvsroot/xine/xine-lib/src/input/librtsp
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv14473/input/librtsp
Modified Files:
rtsp_session.c rtsp_session.h
Log Message:
Partially implemented RTSP seekability:
support starting the playback at an optional time by delaying the PLAY
request upon the first call to rtsp_session_read() and setting the playback
start time via input_plugin->seek_time().
Index: rtsp_session.c
===================================================================
RCS file: /cvsroot/xine/xine-lib/src/input/librtsp/rtsp_session.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- rtsp_session.c 24 Apr 2004 16:55:42 -0000 1.16
+++ rtsp_session.c 18 Dec 2006 21:31:47 -0000 1.17
@@ -53,7 +53,7 @@
rtsp_t *s;
/* receive buffer */
- uint8_t *recv;
+ uint8_t *recv;
int recv_size;
int recv_read;
@@ -62,11 +62,13 @@
int header_len;
int header_read;
+ int playing;
+ int start_time;
};
rtsp_session_t *rtsp_session_start(xine_stream_t *stream, char *mrl) {
- rtsp_session_t *rtsp_session = malloc(sizeof(rtsp_session_t));
+ rtsp_session_t *rtsp_session = xine_xmalloc(sizeof(rtsp_session_t));
char *server;
char *mrl_line=strdup(mrl);
rmff_header_t *h;
@@ -144,6 +146,23 @@
return rtsp_session;
}
+void rtsp_session_set_start_time (rtsp_session_t *this, int start_time) {
+
+ if (start_time >= 0)
+ this->start_time = start_time;
+}
+
+static void rtsp_session_play (rtsp_session_t *this) {
+
+ char buf[256];
+
+ snprintf (buf, sizeof(buf), "Range: npt=%d.%03d-",
+ this->start_time/1000, this->start_time%1000);
+
+ rtsp_schedule_field (this->s, buf);
+ rtsp_request_play (this->s,NULL);
+}
+
int rtsp_session_read (rtsp_session_t *this, char *data, int len) {
int to_copy=len;
@@ -154,6 +173,11 @@
if (len < 0) return 0;
while (to_copy > fill) {
+ if (!this->playing) {
+ rtsp_session_play (this);
+ this->playing = 1;
+ }
+
memcpy(dest, source, fill);
to_copy -= fill;
dest += fill;
Index: rtsp_session.h
===================================================================
RCS file: /cvsroot/xine/xine-lib/src/input/librtsp/rtsp_session.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- rtsp_session.h 9 Dec 2003 00:02:31 -0000 1.6
+++ rtsp_session.h 18 Dec 2006 21:31:47 -0000 1.7
@@ -29,6 +29,8 @@
rtsp_session_t *rtsp_session_start(xine_stream_t *stream, char *mrl);
+void rtsp_session_set_start_time(rtsp_session_t *this, int start_time);
+
int rtsp_session_read(rtsp_session_t *session, char *data, int len);
int rtsp_session_peek_header(rtsp_session_t *this, char *buf, int maxsize);
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Xine-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xine-cvslog