annotate stream/librtsp/rtsp_session.c @ 31366:0bf908d29807

SIGPIPE is not really a crash, try to exit cleanly in case we receive one. Particularly in the network code it would be better to ignore it, but some window managers use it to indicate a close request.
author reimar
date Wed, 16 Jun 2010 17:33:17 +0000
parents 629b30951662
children 8fa2f43cb760
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9922
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
1 /*
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
2 * This file was ported to MPlayer from xine CVS rtsp_session.c,v 1.9 2003/02/11 16:20:40
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
3 */
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
4
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
5 /*
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
6 * Copyright (C) 2000-2002 the xine project
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
7 *
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
8 * This file is part of xine, a free video player.
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
9 *
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
10 * xine is free software; you can redistribute it and/or modify
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
11 * it under the terms of the GNU General Public License as published by
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
12 * the Free Software Foundation; either version 2 of the License, or
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
13 * (at your option) any later version.
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
14 *
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
15 * xine is distributed in the hope that it will be useful,
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
18 * GNU General Public License for more details.
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
19 *
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
20 * You should have received a copy of the GNU General Public License
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
21 * along with this program; if not, write to the Free Software
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
22 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
23 *
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
24 *
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
25 * high level interface to rtsp servers.
18829
317e0fd394c5 added new native rtsp demuxer code for mpeg-ts over rtp (now both real and non-real servers should be handled)
ben
parents: 18822
diff changeset
26 *
317e0fd394c5 added new native rtsp demuxer code for mpeg-ts over rtp (now both real and non-real servers should be handled)
ben
parents: 18822
diff changeset
27 * 2006, Benjamin Zores and Vincent Mussard
317e0fd394c5 added new native rtsp demuxer code for mpeg-ts over rtp (now both real and non-real servers should be handled)
ben
parents: 18822
diff changeset
28 * Support for MPEG-TS streaming through RFC compliant RTSP servers
9922
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
29 */
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
30
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
31 #include <sys/types.h>
27472
c0b233cd30ca Revert moving closesocket definition and network headers to network.h.
diego
parents: 27464
diff changeset
32 #include "config.h"
28402
c884d17bd005 Convert HAVE_WINSOCK2_H into a 0/1 definition.
diego
parents: 27473
diff changeset
33 #if !HAVE_WINSOCK2_H
27472
c0b233cd30ca Revert moving closesocket definition and network headers to network.h.
diego
parents: 27464
diff changeset
34 #include <sys/socket.h>
c0b233cd30ca Revert moving closesocket definition and network headers to network.h.
diego
parents: 27464
diff changeset
35 #include <netinet/in.h>
c0b233cd30ca Revert moving closesocket definition and network headers to network.h.
diego
parents: 27464
diff changeset
36 #include <netdb.h>
c0b233cd30ca Revert moving closesocket definition and network headers to network.h.
diego
parents: 27464
diff changeset
37 #else
c0b233cd30ca Revert moving closesocket definition and network headers to network.h.
diego
parents: 27464
diff changeset
38 #include <winsock2.h>
c0b233cd30ca Revert moving closesocket definition and network headers to network.h.
diego
parents: 27464
diff changeset
39 #endif
c0b233cd30ca Revert moving closesocket definition and network headers to network.h.
diego
parents: 27464
diff changeset
40
c0b233cd30ca Revert moving closesocket definition and network headers to network.h.
diego
parents: 27464
diff changeset
41
9922
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
42 #include <unistd.h>
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
43 #include <stdio.h>
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
44 #include <fcntl.h>
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
45 #include <stdlib.h>
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
46 #include <string.h>
17351
2518f4341587 OS X compilation fix: Include inttypes.h so that uint32_t is not undefined.
diego
parents: 17332
diff changeset
47 #include <inttypes.h>
9922
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
48
18793
be9e036d38ad some printf() to mp_msg() replacements
ben
parents: 18792
diff changeset
49 #include "mp_msg.h"
9922
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
50 #include "rtsp.h"
18829
317e0fd394c5 added new native rtsp demuxer code for mpeg-ts over rtp (now both real and non-real servers should be handled)
ben
parents: 18822
diff changeset
51 #include "rtsp_rtp.h"
9922
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
52 #include "rtsp_session.h"
27473
ae5da477539e Move '#define closesocket close' preprocessor directive to a common place
diego
parents: 27472
diff changeset
53 #include "stream/network.h"
27463
e16088a911c1 consistency cosmetics: Avoid using .. in #include paths.
diego
parents: 27461
diff changeset
54 #include "stream/url.h"
e16088a911c1 consistency cosmetics: Avoid using .. in #include paths.
diego
parents: 27461
diff changeset
55 #include "stream/rtp.h"
e16088a911c1 consistency cosmetics: Avoid using .. in #include paths.
diego
parents: 27461
diff changeset
56 #include "stream/realrtsp/real.h"
e16088a911c1 consistency cosmetics: Avoid using .. in #include paths.
diego
parents: 27461
diff changeset
57 #include "stream/realrtsp/rmff.h"
e16088a911c1 consistency cosmetics: Avoid using .. in #include paths.
diego
parents: 27461
diff changeset
58 #include "stream/realrtsp/asmrp.h"
e16088a911c1 consistency cosmetics: Avoid using .. in #include paths.
diego
parents: 27461
diff changeset
59 #include "stream/realrtsp/xbuffer.h"
9922
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
60
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
61 /*
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
62 #define LOG
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
63 */
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
64
18829
317e0fd394c5 added new native rtsp demuxer code for mpeg-ts over rtp (now both real and non-real servers should be handled)
ben
parents: 18822
diff changeset
65 #define RTSP_OPTIONS_PUBLIC "Public"
18822
a48dead7424a cosmetic changes to avoid constants redefinition
ben
parents: 18799
diff changeset
66 #define RTSP_OPTIONS_SERVER "Server"
a48dead7424a cosmetic changes to avoid constants redefinition
ben
parents: 18799
diff changeset
67 #define RTSP_OPTIONS_LOCATION "Location"
a48dead7424a cosmetic changes to avoid constants redefinition
ben
parents: 18799
diff changeset
68 #define RTSP_OPTIONS_REAL "RealChallenge1"
a48dead7424a cosmetic changes to avoid constants redefinition
ben
parents: 18799
diff changeset
69 #define RTSP_SERVER_TYPE_REAL "Real"
a48dead7424a cosmetic changes to avoid constants redefinition
ben
parents: 18799
diff changeset
70 #define RTSP_SERVER_TYPE_HELIX "Helix"
a48dead7424a cosmetic changes to avoid constants redefinition
ben
parents: 18799
diff changeset
71 #define RTSP_SERVER_TYPE_UNKNOWN "unknown"
a48dead7424a cosmetic changes to avoid constants redefinition
ben
parents: 18799
diff changeset
72
9922
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
73 struct rtsp_session_s {
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
74 rtsp_t *s;
18792
6a015ba5bf45 move real_rtsp init/uninit code to its dedicated place to simplify a bit rtsp session demuxer
ben
parents: 17351
diff changeset
75 struct real_rtsp_session_t* real_session;
18829
317e0fd394c5 added new native rtsp demuxer code for mpeg-ts over rtp (now both real and non-real servers should be handled)
ben
parents: 18822
diff changeset
76 struct rtp_rtsp_session_t* rtp_session;
9922
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
77 };
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
78
27103
a3f6dc43b585 Move rtsp_close away by simplification - avoids symbol clash with libnemesi
lu_zero
parents: 22803
diff changeset
79 /*
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28402
diff changeset
80 * closes an rtsp connection
27103
a3f6dc43b585 Move rtsp_close away by simplification - avoids symbol clash with libnemesi
lu_zero
parents: 22803
diff changeset
81 */
a3f6dc43b585 Move rtsp_close away by simplification - avoids symbol clash with libnemesi
lu_zero
parents: 22803
diff changeset
82
a3f6dc43b585 Move rtsp_close away by simplification - avoids symbol clash with libnemesi
lu_zero
parents: 22803
diff changeset
83 static void rtsp_close(rtsp_t *s) {
a3f6dc43b585 Move rtsp_close away by simplification - avoids symbol clash with libnemesi
lu_zero
parents: 22803
diff changeset
84
a3f6dc43b585 Move rtsp_close away by simplification - avoids symbol clash with libnemesi
lu_zero
parents: 22803
diff changeset
85 if (s->server_state)
a3f6dc43b585 Move rtsp_close away by simplification - avoids symbol clash with libnemesi
lu_zero
parents: 22803
diff changeset
86 {
a3f6dc43b585 Move rtsp_close away by simplification - avoids symbol clash with libnemesi
lu_zero
parents: 22803
diff changeset
87 if (s->server_state == RTSP_PLAYING)
a3f6dc43b585 Move rtsp_close away by simplification - avoids symbol clash with libnemesi
lu_zero
parents: 22803
diff changeset
88 rtsp_request_teardown (s, NULL);
a3f6dc43b585 Move rtsp_close away by simplification - avoids symbol clash with libnemesi
lu_zero
parents: 22803
diff changeset
89 closesocket (s->s);
a3f6dc43b585 Move rtsp_close away by simplification - avoids symbol clash with libnemesi
lu_zero
parents: 22803
diff changeset
90 }
a3f6dc43b585 Move rtsp_close away by simplification - avoids symbol clash with libnemesi
lu_zero
parents: 22803
diff changeset
91
a3f6dc43b585 Move rtsp_close away by simplification - avoids symbol clash with libnemesi
lu_zero
parents: 22803
diff changeset
92 if (s->path) free(s->path);
a3f6dc43b585 Move rtsp_close away by simplification - avoids symbol clash with libnemesi
lu_zero
parents: 22803
diff changeset
93 if (s->host) free(s->host);
a3f6dc43b585 Move rtsp_close away by simplification - avoids symbol clash with libnemesi
lu_zero
parents: 22803
diff changeset
94 if (s->mrl) free(s->mrl);
a3f6dc43b585 Move rtsp_close away by simplification - avoids symbol clash with libnemesi
lu_zero
parents: 22803
diff changeset
95 if (s->session) free(s->session);
a3f6dc43b585 Move rtsp_close away by simplification - avoids symbol clash with libnemesi
lu_zero
parents: 22803
diff changeset
96 if (s->user_agent) free(s->user_agent);
29583
c990a2cbfa8d Fix several more rtsp-related memleaks.
reimar
parents: 29580
diff changeset
97 free(s->server);
27103
a3f6dc43b585 Move rtsp_close away by simplification - avoids symbol clash with libnemesi
lu_zero
parents: 22803
diff changeset
98 rtsp_free_answers(s);
a3f6dc43b585 Move rtsp_close away by simplification - avoids symbol clash with libnemesi
lu_zero
parents: 22803
diff changeset
99 rtsp_unschedule_all(s);
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28402
diff changeset
100 free(s);
27103
a3f6dc43b585 Move rtsp_close away by simplification - avoids symbol clash with libnemesi
lu_zero
parents: 22803
diff changeset
101 }
a3f6dc43b585 Move rtsp_close away by simplification - avoids symbol clash with libnemesi
lu_zero
parents: 22803
diff changeset
102
9922
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
103 //rtsp_session_t *rtsp_session_start(char *mrl) {
20527
b8f069b793c2 Realrtsp authentication
rtogni
parents: 19595
diff changeset
104 rtsp_session_t *rtsp_session_start(int fd, char **mrl, char *path, char *host,
b8f069b793c2 Realrtsp authentication
rtogni
parents: 19595
diff changeset
105 int port, int *redir, uint32_t bandwidth, char *user, char *pass) {
9922
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
106
18792
6a015ba5bf45 move real_rtsp init/uninit code to its dedicated place to simplify a bit rtsp session demuxer
ben
parents: 17351
diff changeset
107 rtsp_session_t *rtsp_session = NULL;
9922
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
108 char *server;
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
109 char *mrl_line = NULL;
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
110
18792
6a015ba5bf45 move real_rtsp init/uninit code to its dedicated place to simplify a bit rtsp session demuxer
ben
parents: 17351
diff changeset
111 rtsp_session = malloc (sizeof (rtsp_session_t));
6a015ba5bf45 move real_rtsp init/uninit code to its dedicated place to simplify a bit rtsp session demuxer
ben
parents: 17351
diff changeset
112 rtsp_session->s = NULL;
6a015ba5bf45 move real_rtsp init/uninit code to its dedicated place to simplify a bit rtsp session demuxer
ben
parents: 17351
diff changeset
113 rtsp_session->real_session = NULL;
18829
317e0fd394c5 added new native rtsp demuxer code for mpeg-ts over rtp (now both real and non-real servers should be handled)
ben
parents: 18822
diff changeset
114 rtsp_session->rtp_session = NULL;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28402
diff changeset
115
10199
0c72c1d0d6a4 Fix redirection in real rtsp connections.
rtognimp
parents: 10198
diff changeset
116 //connect:
0c72c1d0d6a4 Fix redirection in real rtsp connections.
rtognimp
parents: 10198
diff changeset
117 *redir = 0;
9922
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
118
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
119 /* connect to server */
10199
0c72c1d0d6a4 Fix redirection in real rtsp connections.
rtognimp
parents: 10198
diff changeset
120 rtsp_session->s=rtsp_connect(fd,*mrl,path,host,port,NULL);
9922
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
121 if (!rtsp_session->s)
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
122 {
18793
be9e036d38ad some printf() to mp_msg() replacements
ben
parents: 18792
diff changeset
123 mp_msg (MSGT_OPEN, MSGL_ERR,"rtsp_session: failed to connect to server %s\n", path);
9922
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
124 free(rtsp_session);
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
125 return NULL;
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
126 }
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
127
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
128 /* looking for server type */
18822
a48dead7424a cosmetic changes to avoid constants redefinition
ben
parents: 18799
diff changeset
129 if (rtsp_search_answers(rtsp_session->s,RTSP_OPTIONS_SERVER))
a48dead7424a cosmetic changes to avoid constants redefinition
ben
parents: 18799
diff changeset
130 server=strdup(rtsp_search_answers(rtsp_session->s,RTSP_OPTIONS_SERVER));
9922
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
131 else {
18822
a48dead7424a cosmetic changes to avoid constants redefinition
ben
parents: 18799
diff changeset
132 if (rtsp_search_answers(rtsp_session->s,RTSP_OPTIONS_REAL))
a48dead7424a cosmetic changes to avoid constants redefinition
ben
parents: 18799
diff changeset
133 server=strdup(RTSP_SERVER_TYPE_REAL);
9922
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
134 else
18822
a48dead7424a cosmetic changes to avoid constants redefinition
ben
parents: 18799
diff changeset
135 server=strdup(RTSP_SERVER_TYPE_UNKNOWN);
9922
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
136 }
18822
a48dead7424a cosmetic changes to avoid constants redefinition
ben
parents: 18799
diff changeset
137 if (strstr(server,RTSP_SERVER_TYPE_REAL) || strstr(server,RTSP_SERVER_TYPE_HELIX))
9922
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
138 {
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
139 /* we are talking to a real server ... */
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
140
29580
d3df5ca12917 Move variable declaration to where it is used.
reimar
parents: 29263
diff changeset
141 rmff_header_t *h=real_setup_and_get_header(rtsp_session->s, bandwidth, user, pass);
29584
dc57d7bd98e1 Fix possible crashes with invalid SDPs that result in stream descriptions
reimar
parents: 29583
diff changeset
142 if (!h || !h->streams[0]) {
dc57d7bd98e1 Fix possible crashes with invalid SDPs that result in stream descriptions
reimar
parents: 29583
diff changeset
143 rmff_free_header(h);
9922
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
144 /* got an redirect? */
18822
a48dead7424a cosmetic changes to avoid constants redefinition
ben
parents: 18799
diff changeset
145 if (rtsp_search_answers(rtsp_session->s, RTSP_OPTIONS_LOCATION))
9922
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
146 {
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
147 free(mrl_line);
18822
a48dead7424a cosmetic changes to avoid constants redefinition
ben
parents: 18799
diff changeset
148 mrl_line=strdup(rtsp_search_answers(rtsp_session->s, RTSP_OPTIONS_LOCATION));
18793
be9e036d38ad some printf() to mp_msg() replacements
ben
parents: 18792
diff changeset
149 mp_msg (MSGT_OPEN, MSGL_INFO,"rtsp_session: redirected to %s\n", mrl_line);
9922
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
150 rtsp_close(rtsp_session->s);
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
151 free(server);
10199
0c72c1d0d6a4 Fix redirection in real rtsp connections.
rtognimp
parents: 10198
diff changeset
152 free(*mrl);
0c72c1d0d6a4 Fix redirection in real rtsp connections.
rtognimp
parents: 10198
diff changeset
153 free(rtsp_session);
0c72c1d0d6a4 Fix redirection in real rtsp connections.
rtognimp
parents: 10198
diff changeset
154 /* tell the caller to redirect, return url to redirect to in mrl */
0c72c1d0d6a4 Fix redirection in real rtsp connections.
rtognimp
parents: 10198
diff changeset
155 *mrl = mrl_line;
0c72c1d0d6a4 Fix redirection in real rtsp connections.
rtognimp
parents: 10198
diff changeset
156 *redir = 1;
0c72c1d0d6a4 Fix redirection in real rtsp connections.
rtognimp
parents: 10198
diff changeset
157 return NULL;
0c72c1d0d6a4 Fix redirection in real rtsp connections.
rtognimp
parents: 10198
diff changeset
158 // goto connect; /* *shudder* i made a design mistake somewhere */
9922
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
159 } else
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
160 {
18793
be9e036d38ad some printf() to mp_msg() replacements
ben
parents: 18792
diff changeset
161 mp_msg (MSGT_OPEN, MSGL_ERR,"rtsp_session: session can not be established.\n");
9922
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
162 rtsp_close(rtsp_session->s);
18792
6a015ba5bf45 move real_rtsp init/uninit code to its dedicated place to simplify a bit rtsp session demuxer
ben
parents: 17351
diff changeset
163 free (server);
9922
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
164 free(rtsp_session);
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
165 return NULL;
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
166 }
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
167 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28402
diff changeset
168
18792
6a015ba5bf45 move real_rtsp init/uninit code to its dedicated place to simplify a bit rtsp session demuxer
ben
parents: 17351
diff changeset
169 rtsp_session->real_session = init_real_rtsp_session ();
22703
7526ff6035c1 Support application/smil as mimetype for smil-over-realrtsp
rtogni
parents: 22242
diff changeset
170 if(!strncmp(h->streams[0]->mime_type, "application/vnd.rn-rmadriver", h->streams[0]->mime_type_size) ||
7526ff6035c1 Support application/smil as mimetype for smil-over-realrtsp
rtogni
parents: 22242
diff changeset
171 !strncmp(h->streams[0]->mime_type, "application/smil", h->streams[0]->mime_type_size)) {
22242
4cabf7499fef Add support for smil playlist served over realrtsp
rtogni
parents: 21842
diff changeset
172 rtsp_session->real_session->header_len = 0;
4cabf7499fef Add support for smil playlist served over realrtsp
rtogni
parents: 21842
diff changeset
173 rtsp_session->real_session->recv_size = 0;
4cabf7499fef Add support for smil playlist served over realrtsp
rtogni
parents: 21842
diff changeset
174 rtsp_session->real_session->rdt_rawdata = 1;
4cabf7499fef Add support for smil playlist served over realrtsp
rtogni
parents: 21842
diff changeset
175 mp_msg(MSGT_OPEN, MSGL_V, "smil-over-realrtsp playlist, switching to raw rdt mode\n");
4cabf7499fef Add support for smil playlist served over realrtsp
rtogni
parents: 21842
diff changeset
176 } else {
18792
6a015ba5bf45 move real_rtsp init/uninit code to its dedicated place to simplify a bit rtsp session demuxer
ben
parents: 17351
diff changeset
177 rtsp_session->real_session->header_len =
30152
629b30951662 Disambiguate HEADER_SIZE definition in stream/librtsp and stream/realrtsp.
diego
parents: 29584
diff changeset
178 rmff_dump_header (h, (char *) rtsp_session->real_session->header, RTSP_HEADER_SIZE);
22803
4401909aac98 Check buffer size in header dump functions
rtogni
parents: 22703
diff changeset
179
4401909aac98 Check buffer size in header dump functions
rtogni
parents: 22703
diff changeset
180 if (rtsp_session->real_session->header_len < 0) {
4401909aac98 Check buffer size in header dump functions
rtogni
parents: 22703
diff changeset
181 mp_msg (MSGT_OPEN, MSGL_ERR,"rtsp_session: error while dumping RMFF headers, session can not be established.\n");
4401909aac98 Check buffer size in header dump functions
rtogni
parents: 22703
diff changeset
182 free_real_rtsp_session(rtsp_session->real_session);
4401909aac98 Check buffer size in header dump functions
rtogni
parents: 22703
diff changeset
183 rtsp_close(rtsp_session->s);
4401909aac98 Check buffer size in header dump functions
rtogni
parents: 22703
diff changeset
184 free (server);
4401909aac98 Check buffer size in header dump functions
rtogni
parents: 22703
diff changeset
185 free (mrl_line);
4401909aac98 Check buffer size in header dump functions
rtogni
parents: 22703
diff changeset
186 free(rtsp_session);
4401909aac98 Check buffer size in header dump functions
rtogni
parents: 22703
diff changeset
187 return NULL;
4401909aac98 Check buffer size in header dump functions
rtogni
parents: 22703
diff changeset
188 }
9922
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
189
18792
6a015ba5bf45 move real_rtsp init/uninit code to its dedicated place to simplify a bit rtsp session demuxer
ben
parents: 17351
diff changeset
190 rtsp_session->real_session->recv =
6a015ba5bf45 move real_rtsp init/uninit code to its dedicated place to simplify a bit rtsp session demuxer
ben
parents: 17351
diff changeset
191 xbuffer_copyin (rtsp_session->real_session->recv, 0,
6a015ba5bf45 move real_rtsp init/uninit code to its dedicated place to simplify a bit rtsp session demuxer
ben
parents: 17351
diff changeset
192 rtsp_session->real_session->header,
6a015ba5bf45 move real_rtsp init/uninit code to its dedicated place to simplify a bit rtsp session demuxer
ben
parents: 17351
diff changeset
193 rtsp_session->real_session->header_len);
6a015ba5bf45 move real_rtsp init/uninit code to its dedicated place to simplify a bit rtsp session demuxer
ben
parents: 17351
diff changeset
194
6a015ba5bf45 move real_rtsp init/uninit code to its dedicated place to simplify a bit rtsp session demuxer
ben
parents: 17351
diff changeset
195 rtsp_session->real_session->recv_size =
6a015ba5bf45 move real_rtsp init/uninit code to its dedicated place to simplify a bit rtsp session demuxer
ben
parents: 17351
diff changeset
196 rtsp_session->real_session->header_len;
22242
4cabf7499fef Add support for smil playlist served over realrtsp
rtogni
parents: 21842
diff changeset
197 }
18792
6a015ba5bf45 move real_rtsp init/uninit code to its dedicated place to simplify a bit rtsp session demuxer
ben
parents: 17351
diff changeset
198 rtsp_session->real_session->recv_read = 0;
29583
c990a2cbfa8d Fix several more rtsp-related memleaks.
reimar
parents: 29580
diff changeset
199 rmff_free_header(h);
18829
317e0fd394c5 added new native rtsp demuxer code for mpeg-ts over rtp (now both real and non-real servers should be handled)
ben
parents: 18822
diff changeset
200 } else /* not a Real server : try RTP instead */
9922
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
201 {
18829
317e0fd394c5 added new native rtsp demuxer code for mpeg-ts over rtp (now both real and non-real servers should be handled)
ben
parents: 18822
diff changeset
202 char *public = NULL;
317e0fd394c5 added new native rtsp demuxer code for mpeg-ts over rtp (now both real and non-real servers should be handled)
ben
parents: 18822
diff changeset
203
317e0fd394c5 added new native rtsp demuxer code for mpeg-ts over rtp (now both real and non-real servers should be handled)
ben
parents: 18822
diff changeset
204 /* look for the Public: field in response to RTSP OPTIONS */
19595
c19e6c7487b1 Avoid a potential strdup(NULL)
rtogni
parents: 19316
diff changeset
205 if (!(public = rtsp_search_answers (rtsp_session->s, RTSP_OPTIONS_PUBLIC)))
18829
317e0fd394c5 added new native rtsp demuxer code for mpeg-ts over rtp (now both real and non-real servers should be handled)
ben
parents: 18822
diff changeset
206 {
317e0fd394c5 added new native rtsp demuxer code for mpeg-ts over rtp (now both real and non-real servers should be handled)
ben
parents: 18822
diff changeset
207 rtsp_close (rtsp_session->s);
317e0fd394c5 added new native rtsp demuxer code for mpeg-ts over rtp (now both real and non-real servers should be handled)
ben
parents: 18822
diff changeset
208 free (server);
317e0fd394c5 added new native rtsp demuxer code for mpeg-ts over rtp (now both real and non-real servers should be handled)
ben
parents: 18822
diff changeset
209 free (mrl_line);
317e0fd394c5 added new native rtsp demuxer code for mpeg-ts over rtp (now both real and non-real servers should be handled)
ben
parents: 18822
diff changeset
210 free (rtsp_session);
317e0fd394c5 added new native rtsp demuxer code for mpeg-ts over rtp (now both real and non-real servers should be handled)
ben
parents: 18822
diff changeset
211 return NULL;
317e0fd394c5 added new native rtsp demuxer code for mpeg-ts over rtp (now both real and non-real servers should be handled)
ben
parents: 18822
diff changeset
212 }
317e0fd394c5 added new native rtsp demuxer code for mpeg-ts over rtp (now both real and non-real servers should be handled)
ben
parents: 18822
diff changeset
213
317e0fd394c5 added new native rtsp demuxer code for mpeg-ts over rtp (now both real and non-real servers should be handled)
ben
parents: 18822
diff changeset
214 /* check for minimalistic RTSP RFC compliance */
317e0fd394c5 added new native rtsp demuxer code for mpeg-ts over rtp (now both real and non-real servers should be handled)
ben
parents: 18822
diff changeset
215 if (!strstr (public, RTSP_METHOD_DESCRIBE)
317e0fd394c5 added new native rtsp demuxer code for mpeg-ts over rtp (now both real and non-real servers should be handled)
ben
parents: 18822
diff changeset
216 || !strstr (public, RTSP_METHOD_SETUP)
317e0fd394c5 added new native rtsp demuxer code for mpeg-ts over rtp (now both real and non-real servers should be handled)
ben
parents: 18822
diff changeset
217 || !strstr (public, RTSP_METHOD_PLAY)
317e0fd394c5 added new native rtsp demuxer code for mpeg-ts over rtp (now both real and non-real servers should be handled)
ben
parents: 18822
diff changeset
218 || !strstr (public, RTSP_METHOD_TEARDOWN))
317e0fd394c5 added new native rtsp demuxer code for mpeg-ts over rtp (now both real and non-real servers should be handled)
ben
parents: 18822
diff changeset
219 {
317e0fd394c5 added new native rtsp demuxer code for mpeg-ts over rtp (now both real and non-real servers should be handled)
ben
parents: 18822
diff changeset
220 mp_msg (MSGT_OPEN, MSGL_ERR,
317e0fd394c5 added new native rtsp demuxer code for mpeg-ts over rtp (now both real and non-real servers should be handled)
ben
parents: 18822
diff changeset
221 "Remote server does not meet minimal RTSP 1.0 compliance.\n");
317e0fd394c5 added new native rtsp demuxer code for mpeg-ts over rtp (now both real and non-real servers should be handled)
ben
parents: 18822
diff changeset
222 rtsp_close (rtsp_session->s);
317e0fd394c5 added new native rtsp demuxer code for mpeg-ts over rtp (now both real and non-real servers should be handled)
ben
parents: 18822
diff changeset
223 free (server);
317e0fd394c5 added new native rtsp demuxer code for mpeg-ts over rtp (now both real and non-real servers should be handled)
ben
parents: 18822
diff changeset
224 free (mrl_line);
317e0fd394c5 added new native rtsp demuxer code for mpeg-ts over rtp (now both real and non-real servers should be handled)
ben
parents: 18822
diff changeset
225 free (rtsp_session);
317e0fd394c5 added new native rtsp demuxer code for mpeg-ts over rtp (now both real and non-real servers should be handled)
ben
parents: 18822
diff changeset
226 return NULL;
317e0fd394c5 added new native rtsp demuxer code for mpeg-ts over rtp (now both real and non-real servers should be handled)
ben
parents: 18822
diff changeset
227 }
317e0fd394c5 added new native rtsp demuxer code for mpeg-ts over rtp (now both real and non-real servers should be handled)
ben
parents: 18822
diff changeset
228
317e0fd394c5 added new native rtsp demuxer code for mpeg-ts over rtp (now both real and non-real servers should be handled)
ben
parents: 18822
diff changeset
229 rtsp_session->rtp_session = rtp_setup_and_play (rtsp_session->s);
317e0fd394c5 added new native rtsp demuxer code for mpeg-ts over rtp (now both real and non-real servers should be handled)
ben
parents: 18822
diff changeset
230
317e0fd394c5 added new native rtsp demuxer code for mpeg-ts over rtp (now both real and non-real servers should be handled)
ben
parents: 18822
diff changeset
231 /* neither a Real or an RTP server */
317e0fd394c5 added new native rtsp demuxer code for mpeg-ts over rtp (now both real and non-real servers should be handled)
ben
parents: 18822
diff changeset
232 if (!rtsp_session->rtp_session)
317e0fd394c5 added new native rtsp demuxer code for mpeg-ts over rtp (now both real and non-real servers should be handled)
ben
parents: 18822
diff changeset
233 {
317e0fd394c5 added new native rtsp demuxer code for mpeg-ts over rtp (now both real and non-real servers should be handled)
ben
parents: 18822
diff changeset
234 mp_msg (MSGT_OPEN, MSGL_ERR, "rtsp_session: unsupported RTSP server. ");
317e0fd394c5 added new native rtsp demuxer code for mpeg-ts over rtp (now both real and non-real servers should be handled)
ben
parents: 18822
diff changeset
235 mp_msg (MSGT_OPEN, MSGL_ERR, "Server type is '%s'.\n", server);
317e0fd394c5 added new native rtsp demuxer code for mpeg-ts over rtp (now both real and non-real servers should be handled)
ben
parents: 18822
diff changeset
236 rtsp_close (rtsp_session->s);
317e0fd394c5 added new native rtsp demuxer code for mpeg-ts over rtp (now both real and non-real servers should be handled)
ben
parents: 18822
diff changeset
237 free (server);
317e0fd394c5 added new native rtsp demuxer code for mpeg-ts over rtp (now both real and non-real servers should be handled)
ben
parents: 18822
diff changeset
238 free (mrl_line);
317e0fd394c5 added new native rtsp demuxer code for mpeg-ts over rtp (now both real and non-real servers should be handled)
ben
parents: 18822
diff changeset
239 free (rtsp_session);
317e0fd394c5 added new native rtsp demuxer code for mpeg-ts over rtp (now both real and non-real servers should be handled)
ben
parents: 18822
diff changeset
240 return NULL;
317e0fd394c5 added new native rtsp demuxer code for mpeg-ts over rtp (now both real and non-real servers should be handled)
ben
parents: 18822
diff changeset
241 }
9922
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
242 }
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
243 free(server);
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28402
diff changeset
244
9922
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
245 return rtsp_session;
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
246 }
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
247
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
248 int rtsp_session_read (rtsp_session_t *this, char *data, int len) {
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28402
diff changeset
249
18792
6a015ba5bf45 move real_rtsp init/uninit code to its dedicated place to simplify a bit rtsp session demuxer
ben
parents: 17351
diff changeset
250 if (this->real_session) {
9922
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
251 int to_copy=len;
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
252 char *dest=data;
18792
6a015ba5bf45 move real_rtsp init/uninit code to its dedicated place to simplify a bit rtsp session demuxer
ben
parents: 17351
diff changeset
253 char *source =
6a015ba5bf45 move real_rtsp init/uninit code to its dedicated place to simplify a bit rtsp session demuxer
ben
parents: 17351
diff changeset
254 (char *) (this->real_session->recv + this->real_session->recv_read);
6a015ba5bf45 move real_rtsp init/uninit code to its dedicated place to simplify a bit rtsp session demuxer
ben
parents: 17351
diff changeset
255 int fill = this->real_session->recv_size - this->real_session->recv_read;
9922
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
256
21842
f0040ff1ba40 Don't drop last rdt packet on eof
rtogni
parents: 21836
diff changeset
257 if(this->real_session->rdteof)
f0040ff1ba40 Don't drop last rdt packet on eof
rtogni
parents: 21836
diff changeset
258 return -1;
9922
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
259 if (len < 0) return 0;
21836
7c5e893dff54 Make sure we do not crash when eof is reset, e.g. due to an attempt to seek.
reimar
parents: 20527
diff changeset
260 if (this->real_session->recv_size < 0) return -1;
9922
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
261 while (to_copy > fill) {
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28402
diff changeset
262
9922
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
263 memcpy(dest, source, fill);
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
264 to_copy -= fill;
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
265 dest += fill;
18792
6a015ba5bf45 move real_rtsp init/uninit code to its dedicated place to simplify a bit rtsp session demuxer
ben
parents: 17351
diff changeset
266 this->real_session->recv_read = 0;
6a015ba5bf45 move real_rtsp init/uninit code to its dedicated place to simplify a bit rtsp session demuxer
ben
parents: 17351
diff changeset
267 this->real_session->recv_size =
22242
4cabf7499fef Add support for smil playlist served over realrtsp
rtogni
parents: 21842
diff changeset
268 real_get_rdt_chunk (this->s, (char **)&(this->real_session->recv), this->real_session->rdt_rawdata);
21842
f0040ff1ba40 Don't drop last rdt packet on eof
rtogni
parents: 21836
diff changeset
269 if (this->real_session->recv_size < 0) {
f0040ff1ba40 Don't drop last rdt packet on eof
rtogni
parents: 21836
diff changeset
270 this->real_session->rdteof = 1;
f0040ff1ba40 Don't drop last rdt packet on eof
rtogni
parents: 21836
diff changeset
271 this->real_session->recv_size = 0;
f0040ff1ba40 Don't drop last rdt packet on eof
rtogni
parents: 21836
diff changeset
272 }
18792
6a015ba5bf45 move real_rtsp init/uninit code to its dedicated place to simplify a bit rtsp session demuxer
ben
parents: 17351
diff changeset
273 source = (char *) this->real_session->recv;
6a015ba5bf45 move real_rtsp init/uninit code to its dedicated place to simplify a bit rtsp session demuxer
ben
parents: 17351
diff changeset
274 fill = this->real_session->recv_size;
9922
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
275
18792
6a015ba5bf45 move real_rtsp init/uninit code to its dedicated place to simplify a bit rtsp session demuxer
ben
parents: 17351
diff changeset
276 if (this->real_session->recv_size == 0) {
9922
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
277 #ifdef LOG
18793
be9e036d38ad some printf() to mp_msg() replacements
ben
parents: 18792
diff changeset
278 mp_msg (MSGT_OPEN, MSGL_INFO, "librtsp: %d of %d bytes provided\n", len-to_copy, len);
9922
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
279 #endif
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
280 return len-to_copy;
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
281 }
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
282 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28402
diff changeset
283
9922
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
284 memcpy(dest, source, to_copy);
18792
6a015ba5bf45 move real_rtsp init/uninit code to its dedicated place to simplify a bit rtsp session demuxer
ben
parents: 17351
diff changeset
285 this->real_session->recv_read += to_copy;
9922
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
286
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
287 #ifdef LOG
18793
be9e036d38ad some printf() to mp_msg() replacements
ben
parents: 18792
diff changeset
288 mp_msg (MSGT_OPEN, MSGL_INFO, "librtsp: %d bytes provided\n", len);
9922
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
289 #endif
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
290
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
291 return len;
18792
6a015ba5bf45 move real_rtsp init/uninit code to its dedicated place to simplify a bit rtsp session demuxer
ben
parents: 17351
diff changeset
292 }
18829
317e0fd394c5 added new native rtsp demuxer code for mpeg-ts over rtp (now both real and non-real servers should be handled)
ben
parents: 18822
diff changeset
293 else if (this->rtp_session)
317e0fd394c5 added new native rtsp demuxer code for mpeg-ts over rtp (now both real and non-real servers should be handled)
ben
parents: 18822
diff changeset
294 {
317e0fd394c5 added new native rtsp demuxer code for mpeg-ts over rtp (now both real and non-real servers should be handled)
ben
parents: 18822
diff changeset
295 int l = 0;
317e0fd394c5 added new native rtsp demuxer code for mpeg-ts over rtp (now both real and non-real servers should be handled)
ben
parents: 18822
diff changeset
296
317e0fd394c5 added new native rtsp demuxer code for mpeg-ts over rtp (now both real and non-real servers should be handled)
ben
parents: 18822
diff changeset
297 l = read_rtp_from_server (this->rtp_session->rtp_socket, data, len);
317e0fd394c5 added new native rtsp demuxer code for mpeg-ts over rtp (now both real and non-real servers should be handled)
ben
parents: 18822
diff changeset
298 /* send RTSP and RTCP keepalive */
317e0fd394c5 added new native rtsp demuxer code for mpeg-ts over rtp (now both real and non-real servers should be handled)
ben
parents: 18822
diff changeset
299 rtcp_send_rr (this->s, this->rtp_session);
317e0fd394c5 added new native rtsp demuxer code for mpeg-ts over rtp (now both real and non-real servers should be handled)
ben
parents: 18822
diff changeset
300
317e0fd394c5 added new native rtsp demuxer code for mpeg-ts over rtp (now both real and non-real servers should be handled)
ben
parents: 18822
diff changeset
301 if (l == 0)
317e0fd394c5 added new native rtsp demuxer code for mpeg-ts over rtp (now both real and non-real servers should be handled)
ben
parents: 18822
diff changeset
302 rtsp_session_end (this);
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28402
diff changeset
303
18829
317e0fd394c5 added new native rtsp demuxer code for mpeg-ts over rtp (now both real and non-real servers should be handled)
ben
parents: 18822
diff changeset
304 return l;
317e0fd394c5 added new native rtsp demuxer code for mpeg-ts over rtp (now both real and non-real servers should be handled)
ben
parents: 18822
diff changeset
305 }
18792
6a015ba5bf45 move real_rtsp init/uninit code to its dedicated place to simplify a bit rtsp session demuxer
ben
parents: 17351
diff changeset
306
6a015ba5bf45 move real_rtsp init/uninit code to its dedicated place to simplify a bit rtsp session demuxer
ben
parents: 17351
diff changeset
307 return 0;
9922
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
308 }
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
309
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
310 void rtsp_session_end(rtsp_session_t *session) {
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
311
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
312 rtsp_close(session->s);
18792
6a015ba5bf45 move real_rtsp init/uninit code to its dedicated place to simplify a bit rtsp session demuxer
ben
parents: 17351
diff changeset
313 if (session->real_session)
6a015ba5bf45 move real_rtsp init/uninit code to its dedicated place to simplify a bit rtsp session demuxer
ben
parents: 17351
diff changeset
314 free_real_rtsp_session (session->real_session);
18829
317e0fd394c5 added new native rtsp demuxer code for mpeg-ts over rtp (now both real and non-real servers should be handled)
ben
parents: 18822
diff changeset
315 if (session->rtp_session)
317e0fd394c5 added new native rtsp demuxer code for mpeg-ts over rtp (now both real and non-real servers should be handled)
ben
parents: 18822
diff changeset
316 rtp_session_free (session->rtp_session);
9922
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
317 free(session);
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
318 }