Mercurial > mplayer.hg
annotate libmpdemux/rtsp.c @ 19109:6e840952870d
Removes an unneeded cast. Patch by Stefan Huehner, stefan AT.. huehner.org
author | reynaldo |
---|---|
date | Sun, 16 Jul 2006 01:24:42 +0000 |
parents | e16345b97dab |
children |
rev | line source |
---|---|
18794
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
1 /* |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
2 * Copyright (C) 2006 Benjamin Zores |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
3 * based on previous Real RTSP support from Roberto Togni and xine team. |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
4 * |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
5 * This program is free software; you can redistribute it and/or modify |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
6 * it under the terms of the GNU General Public License as published by |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
7 * the Free Software Foundation; either version 2 of the License, or |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
8 * (at your option) any later version. |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
9 * |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
10 * This program is distributed in the hope that it will be useful, |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
13 * GNU General Public License for more details. |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
14 * |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
16 * along with this program; if not, write to the Free Software Foundation, |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
17 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
18 */ |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
19 |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
20 #include <stdlib.h> |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
21 #include <string.h> |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
22 #include <unistd.h> |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
23 #include <stdlib.h> |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
24 #include <stdio.h> |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
25 #include <sys/types.h> |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
26 #include <ctype.h> |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
27 #include "config.h" |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
28 #ifndef HAVE_WINSOCK2 |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
29 #include <netinet/in.h> |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
30 #include <sys/socket.h> |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
31 #include <arpa/inet.h> |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
32 #define closesocket close |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
33 #else |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
34 #include <winsock2.h> |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
35 #include <ws2tcpip.h> |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
36 #endif |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
37 #include <errno.h> |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
38 |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
39 #include "stream.h" |
18799
e16345b97dab
moved generic rtsp related files from realrtsp to librtsp
ben
parents:
18797
diff
changeset
|
40 #include "librtsp/rtsp.h" |
e16345b97dab
moved generic rtsp related files from realrtsp to librtsp
ben
parents:
18797
diff
changeset
|
41 #include "librtsp/rtsp_session.h" |
18794
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
42 |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
43 #define RTSP_DEFAULT_PORT 554 |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
44 |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
45 extern int network_bandwidth; |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
46 |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
47 static int |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
48 rtsp_streaming_read (int fd, char *buffer, |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
49 int size, streaming_ctrl_t *stream_ctrl) |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
50 { |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
51 return rtsp_session_read (stream_ctrl->data, buffer, size); |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
52 } |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
53 |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
54 static int |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
55 rtsp_streaming_start (stream_t *stream) |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
56 { |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
57 int fd; |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
58 rtsp_session_t *rtsp; |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
59 char *mrl; |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
60 char *file; |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
61 int port; |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
62 int redirected, temp; |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
63 |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
64 if (!stream) |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
65 return -1; |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
66 |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
67 /* counter so we don't get caught in infinite redirections */ |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
68 temp = 5; |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
69 |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
70 do { |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
71 redirected = 0; |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
72 |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
73 fd = connect2Server (stream->streaming_ctrl->url->hostname, |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
74 port = (stream->streaming_ctrl->url->port ? |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
75 stream->streaming_ctrl->url->port : |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
76 RTSP_DEFAULT_PORT), 1); |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
77 |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
78 if (fd < 0 && !stream->streaming_ctrl->url->port) |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
79 fd = connect2Server (stream->streaming_ctrl->url->hostname, |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
80 port = 7070, 1); |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
81 |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
82 if (fd < 0) |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
83 return -1; |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
84 |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
85 file = stream->streaming_ctrl->url->file; |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
86 if (file[0] == '/') |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
87 file++; |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
88 |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
89 mrl = malloc (strlen (stream->streaming_ctrl->url->hostname) |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
90 + strlen (file) + 16); |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
91 |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
92 sprintf (mrl, "rtsp://%s:%i/%s", |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
93 stream->streaming_ctrl->url->hostname, port, file); |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
94 |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
95 rtsp = rtsp_session_start (fd, &mrl, file, |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
96 stream->streaming_ctrl->url->hostname, |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
97 port, &redirected, |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
98 stream->streaming_ctrl->bandwidth); |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
99 |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
100 if (redirected == 1) |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
101 { |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
102 url_free (stream->streaming_ctrl->url); |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
103 stream->streaming_ctrl->url = url_new (mrl); |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
104 closesocket (fd); |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
105 } |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
106 |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
107 free (mrl); |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
108 temp--; |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
109 } while ((redirected != 0) && (temp > 0)); |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
110 |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
111 if (!rtsp) |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
112 return -1; |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
113 |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
114 stream->fd = fd; |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
115 stream->streaming_ctrl->data = rtsp; |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
116 |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
117 stream->streaming_ctrl->streaming_read = rtsp_streaming_read; |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
118 stream->streaming_ctrl->streaming_seek = NULL; |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
119 stream->streaming_ctrl->prebuffer_size = 128*1024; // 640 KBytes |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
120 stream->streaming_ctrl->buffering = 1; |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
121 stream->streaming_ctrl->status = streaming_playing_e; |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
122 |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
123 return 0; |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
124 } |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
125 |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
126 static void |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
127 rtsp_streaming_close (struct stream_st *s) |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
128 { |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
129 rtsp_session_t *rtsp = NULL; |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
130 |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
131 rtsp = (rtsp_session_t *) s->streaming_ctrl->data; |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
132 if (rtsp) |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
133 rtsp_session_end (rtsp); |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
134 } |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
135 |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
136 static int |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
137 rtsp_streaming_open (stream_t *stream, int mode, void *opts, int *file_format) |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
138 { |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
139 URL_t *url; |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
140 extern int index_mode; |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
141 |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
142 mp_msg (MSGT_OPEN, MSGL_INFO, "STREAM_RTSP, URL: %s\n", stream->url); |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
143 stream->streaming_ctrl = streaming_ctrl_new (); |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
144 if (!stream->streaming_ctrl) |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
145 return STREAM_ERROR; |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
146 |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
147 stream->streaming_ctrl->bandwidth = network_bandwidth; |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
148 url = url_new (stream->url); |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
149 stream->streaming_ctrl->url = check4proxies (url); |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
150 |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
151 stream->fd = -1; |
18797 | 152 index_mode = -1; /* prevent most RTSP streams from locking due to -idx */ |
18794
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
153 if (rtsp_streaming_start (stream) < 0) |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
154 { |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
155 streaming_ctrl_free (stream->streaming_ctrl); |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
156 stream->streaming_ctrl = NULL; |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
157 return STREAM_UNSUPORTED; |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
158 } |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
159 |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
160 fixup_network_stream_cache (stream); |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
161 stream->type = STREAMTYPE_STREAM; |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
162 stream->close = rtsp_streaming_close; |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
163 |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
164 return STREAM_OK; |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
165 } |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
166 |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
167 stream_info_t stream_info_rtsp = { |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
168 "RTSP streaming", |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
169 "rtsp", |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
170 "Benjamin Zores, Roberto Togni", |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
171 "ported from xine", |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
172 rtsp_streaming_open, |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
173 {"rtsp", NULL}, |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
174 NULL, |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
175 0 /* Urls are an option string */ |
42001f5086d2
new RTSP demuxer dedicated file, based on old code from realrtsp one but intended to be much more generic
ben
parents:
diff
changeset
|
176 }; |