annotate stream/stream_nemesi.c @ 29385:f9ae25067fe0

Fix 24bit audio playback. The reordering channels code had reoccurring bug where in switch(samplesize) block the case 3 (3 bytes) doesn't end with break; leading to execution of the next case 4 too. This mangles the already processed data and causes massive memory corruption.
author iive
date Sun, 19 Jul 2009 09:55:29 +0000
parents a26e50cae389
children 32725ca88fed
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
24564
e4a38a7cdb81 libnemesi support, yet another rtsp/rtp library...
lu_zero
parents:
diff changeset
1 /*
26737
a26e50cae389 Use standard license headers with standard formatting.
diego
parents: 25268
diff changeset
2 * based on previous RTSP support from Benjamin Zores.
24564
e4a38a7cdb81 libnemesi support, yet another rtsp/rtp library...
lu_zero
parents:
diff changeset
3 *
26737
a26e50cae389 Use standard license headers with standard formatting.
diego
parents: 25268
diff changeset
4 * Copyright (C) 2007 Alessandro Molina <amol.wrk@gmail.com>
a26e50cae389 Use standard license headers with standard formatting.
diego
parents: 25268
diff changeset
5 *
a26e50cae389 Use standard license headers with standard formatting.
diego
parents: 25268
diff changeset
6 * This file is part of MPlayer.
24564
e4a38a7cdb81 libnemesi support, yet another rtsp/rtp library...
lu_zero
parents:
diff changeset
7 *
26737
a26e50cae389 Use standard license headers with standard formatting.
diego
parents: 25268
diff changeset
8 * MPlayer is free software; you can redistribute it and/or modify
a26e50cae389 Use standard license headers with standard formatting.
diego
parents: 25268
diff changeset
9 * it under the terms of the GNU General Public License as published by
a26e50cae389 Use standard license headers with standard formatting.
diego
parents: 25268
diff changeset
10 * the Free Software Foundation; either version 2 of the License, or
a26e50cae389 Use standard license headers with standard formatting.
diego
parents: 25268
diff changeset
11 * (at your option) any later version.
24564
e4a38a7cdb81 libnemesi support, yet another rtsp/rtp library...
lu_zero
parents:
diff changeset
12 *
26737
a26e50cae389 Use standard license headers with standard formatting.
diego
parents: 25268
diff changeset
13 * MPlayer is distributed in the hope that it will be useful,
a26e50cae389 Use standard license headers with standard formatting.
diego
parents: 25268
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
a26e50cae389 Use standard license headers with standard formatting.
diego
parents: 25268
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
a26e50cae389 Use standard license headers with standard formatting.
diego
parents: 25268
diff changeset
16 * GNU General Public License for more details.
a26e50cae389 Use standard license headers with standard formatting.
diego
parents: 25268
diff changeset
17 *
a26e50cae389 Use standard license headers with standard formatting.
diego
parents: 25268
diff changeset
18 * You should have received a copy of the GNU General Public License along
a26e50cae389 Use standard license headers with standard formatting.
diego
parents: 25268
diff changeset
19 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
a26e50cae389 Use standard license headers with standard formatting.
diego
parents: 25268
diff changeset
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24564
e4a38a7cdb81 libnemesi support, yet another rtsp/rtp library...
lu_zero
parents:
diff changeset
21 */
e4a38a7cdb81 libnemesi support, yet another rtsp/rtp library...
lu_zero
parents:
diff changeset
22
e4a38a7cdb81 libnemesi support, yet another rtsp/rtp library...
lu_zero
parents:
diff changeset
23 #define HAVE_STRUCT_SOCKADDR_STORAGE
e4a38a7cdb81 libnemesi support, yet another rtsp/rtp library...
lu_zero
parents:
diff changeset
24
e4a38a7cdb81 libnemesi support, yet another rtsp/rtp library...
lu_zero
parents:
diff changeset
25 #include <stdlib.h>
e4a38a7cdb81 libnemesi support, yet another rtsp/rtp library...
lu_zero
parents:
diff changeset
26 #include <string.h>
e4a38a7cdb81 libnemesi support, yet another rtsp/rtp library...
lu_zero
parents:
diff changeset
27 #include <stdlib.h>
e4a38a7cdb81 libnemesi support, yet another rtsp/rtp library...
lu_zero
parents:
diff changeset
28 #include <stdio.h>
e4a38a7cdb81 libnemesi support, yet another rtsp/rtp library...
lu_zero
parents:
diff changeset
29 #include <ctype.h>
e4a38a7cdb81 libnemesi support, yet another rtsp/rtp library...
lu_zero
parents:
diff changeset
30 #include "config.h"
e4a38a7cdb81 libnemesi support, yet another rtsp/rtp library...
lu_zero
parents:
diff changeset
31 #include "nemesi/rtsp.h"
e4a38a7cdb81 libnemesi support, yet another rtsp/rtp library...
lu_zero
parents:
diff changeset
32
e4a38a7cdb81 libnemesi support, yet another rtsp/rtp library...
lu_zero
parents:
diff changeset
33 #include <errno.h>
e4a38a7cdb81 libnemesi support, yet another rtsp/rtp library...
lu_zero
parents:
diff changeset
34
e4a38a7cdb81 libnemesi support, yet another rtsp/rtp library...
lu_zero
parents:
diff changeset
35 #include "stream.h"
25268
23c21064c571 10l ... the header was used there too
lu_zero
parents: 25266
diff changeset
36 #include "libmpdemux/demuxer.h"
23c21064c571 10l ... the header was used there too
lu_zero
parents: 25266
diff changeset
37
24564
e4a38a7cdb81 libnemesi support, yet another rtsp/rtp library...
lu_zero
parents:
diff changeset
38 #include "tcp.h"
e4a38a7cdb81 libnemesi support, yet another rtsp/rtp library...
lu_zero
parents:
diff changeset
39
e4a38a7cdb81 libnemesi support, yet another rtsp/rtp library...
lu_zero
parents:
diff changeset
40 extern int network_bandwidth;
e4a38a7cdb81 libnemesi support, yet another rtsp/rtp library...
lu_zero
parents:
diff changeset
41 char *rtsp_destination = NULL;
e4a38a7cdb81 libnemesi support, yet another rtsp/rtp library...
lu_zero
parents:
diff changeset
42
e4a38a7cdb81 libnemesi support, yet another rtsp/rtp library...
lu_zero
parents:
diff changeset
43 static int rtsp_streaming_seek(int fd, off_t pos,
e4a38a7cdb81 libnemesi support, yet another rtsp/rtp library...
lu_zero
parents:
diff changeset
44 streaming_ctrl_t* streaming_ctrl) {
e4a38a7cdb81 libnemesi support, yet another rtsp/rtp library...
lu_zero
parents:
diff changeset
45 return -1;
e4a38a7cdb81 libnemesi support, yet another rtsp/rtp library...
lu_zero
parents:
diff changeset
46 }
e4a38a7cdb81 libnemesi support, yet another rtsp/rtp library...
lu_zero
parents:
diff changeset
47
e4a38a7cdb81 libnemesi support, yet another rtsp/rtp library...
lu_zero
parents:
diff changeset
48 static int rtsp_streaming_open (stream_t *stream, int mode, void *opts,
e4a38a7cdb81 libnemesi support, yet another rtsp/rtp library...
lu_zero
parents:
diff changeset
49 int *file_format)
e4a38a7cdb81 libnemesi support, yet another rtsp/rtp library...
lu_zero
parents:
diff changeset
50 {
e4a38a7cdb81 libnemesi support, yet another rtsp/rtp library...
lu_zero
parents:
diff changeset
51 rtsp_ctrl * ctl;
e4a38a7cdb81 libnemesi support, yet another rtsp/rtp library...
lu_zero
parents:
diff changeset
52 URL_t *url;
e4a38a7cdb81 libnemesi support, yet another rtsp/rtp library...
lu_zero
parents:
diff changeset
53 stream->fd = -1;
e4a38a7cdb81 libnemesi support, yet another rtsp/rtp library...
lu_zero
parents:
diff changeset
54
e4a38a7cdb81 libnemesi support, yet another rtsp/rtp library...
lu_zero
parents:
diff changeset
55 mp_msg (MSGT_OPEN, MSGL_V, "STREAM_RTSP, URL: %s\n", stream->url);
e4a38a7cdb81 libnemesi support, yet another rtsp/rtp library...
lu_zero
parents:
diff changeset
56 stream->streaming_ctrl = streaming_ctrl_new ();
e4a38a7cdb81 libnemesi support, yet another rtsp/rtp library...
lu_zero
parents:
diff changeset
57 if (!stream->streaming_ctrl)
e4a38a7cdb81 libnemesi support, yet another rtsp/rtp library...
lu_zero
parents:
diff changeset
58 return STREAM_ERROR;
e4a38a7cdb81 libnemesi support, yet another rtsp/rtp library...
lu_zero
parents:
diff changeset
59
e4a38a7cdb81 libnemesi support, yet another rtsp/rtp library...
lu_zero
parents:
diff changeset
60 stream->streaming_ctrl->bandwidth = network_bandwidth;
e4a38a7cdb81 libnemesi support, yet another rtsp/rtp library...
lu_zero
parents:
diff changeset
61 url = url_new(stream->url);
e4a38a7cdb81 libnemesi support, yet another rtsp/rtp library...
lu_zero
parents:
diff changeset
62 stream->streaming_ctrl->url = check4proxies(url);
e4a38a7cdb81 libnemesi support, yet another rtsp/rtp library...
lu_zero
parents:
diff changeset
63 stream->streaming_ctrl->streaming_seek = rtsp_streaming_seek;
e4a38a7cdb81 libnemesi support, yet another rtsp/rtp library...
lu_zero
parents:
diff changeset
64
25266
239330301b33 Make libnemesi use specific struct and DEMUXER_TYPE
lu_zero
parents: 25211
diff changeset
65 *file_format = DEMUXER_TYPE_RTP_NEMESI;
24564
e4a38a7cdb81 libnemesi support, yet another rtsp/rtp library...
lu_zero
parents:
diff changeset
66 stream->type = STREAMTYPE_STREAM;
e4a38a7cdb81 libnemesi support, yet another rtsp/rtp library...
lu_zero
parents:
diff changeset
67 return STREAM_OK;
e4a38a7cdb81 libnemesi support, yet another rtsp/rtp library...
lu_zero
parents:
diff changeset
68 }
e4a38a7cdb81 libnemesi support, yet another rtsp/rtp library...
lu_zero
parents:
diff changeset
69
25211
c1d17bd6683c Mark all stream_info_t as const
reimar
parents: 25156
diff changeset
70 const stream_info_t stream_info_rtsp = {
24564
e4a38a7cdb81 libnemesi support, yet another rtsp/rtp library...
lu_zero
parents:
diff changeset
71 "RTSP streaming",
e4a38a7cdb81 libnemesi support, yet another rtsp/rtp library...
lu_zero
parents:
diff changeset
72 "rtsp",
e4a38a7cdb81 libnemesi support, yet another rtsp/rtp library...
lu_zero
parents:
diff changeset
73 "Alessandro Molina",
e4a38a7cdb81 libnemesi support, yet another rtsp/rtp library...
lu_zero
parents:
diff changeset
74 "implemented over libnemesi",
e4a38a7cdb81 libnemesi support, yet another rtsp/rtp library...
lu_zero
parents:
diff changeset
75 rtsp_streaming_open,
e4a38a7cdb81 libnemesi support, yet another rtsp/rtp library...
lu_zero
parents:
diff changeset
76 {"rtsp", NULL},
e4a38a7cdb81 libnemesi support, yet another rtsp/rtp library...
lu_zero
parents:
diff changeset
77 NULL,
e4a38a7cdb81 libnemesi support, yet another rtsp/rtp library...
lu_zero
parents:
diff changeset
78 0 /* Urls are an option string */
e4a38a7cdb81 libnemesi support, yet another rtsp/rtp library...
lu_zero
parents:
diff changeset
79 };
e4a38a7cdb81 libnemesi support, yet another rtsp/rtp library...
lu_zero
parents:
diff changeset
80