annotate libmpdemux/stream_livedotcom.c @ 17089:1e8962ee910f

fix stream_livedotcom.c:70: warning: assignment makes pointer from integer without a cast stream_livedotcom.c:77: warning: passing argument 1 of 'lseek' makes integer from pointer without a cast stream_livedotcom.c:78: warning: passing argument 1 of 'lseek' makes integer from pointer without a cast stream_livedotcom.c:84: warning: passing argument 1 of 'read' makes integer from pointer without a cast stream_livedotcom.c:96: warning: control reaches end of non-void function
author rathann
date Mon, 05 Dec 2005 01:24:27 +0000
parents 56a5f69e9b35
children 4928dd61f136
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15585
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
1
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
2 #include "config.h"
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
3
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
4 #ifdef MPLAYER_NETWORK
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
5 #include <unistd.h>
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
6 #include <stdlib.h>
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
7 #include <stdio.h>
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
8 #include <string.h>
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
9
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
10 #include "stream.h"
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
11 #include "network.h"
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
12 #include "demuxer.h"
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
13 #include "help_mp.h"
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
14
16572
56a5f69e9b35 "LIVE.COM Streaming Media" is now called "LIVE555 Streaming Media".
rsf
parents: 15777
diff changeset
15 #ifdef STREAMING_LIVE555
15585
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
16
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
17 extern int network_bandwidth;
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
18
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
19 static int _rtsp_streaming_seek(int fd, off_t pos, streaming_ctrl_t* streaming_ctrl) {
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
20 return -1; // For now, we don't handle RTSP stream seeking
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
21 }
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
22
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
23 static int rtsp_streaming_start(stream_t* stream) {
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
24 stream->streaming_ctrl->streaming_seek = _rtsp_streaming_seek;
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
25 return 0;
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
26 }
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
27
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
28
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
29 static int open_live_rtsp_sip(stream_t *stream,int mode, void* opts, int* file_format) {
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
30 URL_t *url;
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
31
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
32 stream->streaming_ctrl = streaming_ctrl_new();
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
33 if( stream->streaming_ctrl==NULL ) {
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
34 return STREAM_ERROR;
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
35 }
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
36 stream->streaming_ctrl->bandwidth = network_bandwidth;
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
37 url = url_new(stream->url);
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
38 stream->streaming_ctrl->url = check4proxies(url);
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
39 //url_free(url);
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
40
16572
56a5f69e9b35 "LIVE.COM Streaming Media" is now called "LIVE555 Streaming Media".
rsf
parents: 15777
diff changeset
41 mp_msg(MSGT_OPEN, MSGL_INFO, "STREAM_LIVE555, URL: %s\n", stream->url);
15585
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
42
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
43 if(rtsp_streaming_start(stream) < 0) {
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
44 mp_msg(MSGT_NETWORK,MSGL_ERR,"rtsp_streaming_start failed\n");
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
45 goto fail;
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
46 }
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
47
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
48 *file_format = DEMUXER_TYPE_RTP;
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
49 stream->type = STREAMTYPE_STREAM;
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
50 return STREAM_OK;
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
51
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
52 fail:
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
53 streaming_ctrl_free( stream->streaming_ctrl );
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
54 stream->streaming_ctrl = NULL;
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
55 return STREAM_ERROR;
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
56 }
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
57
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
58 static int open_live_sdp(stream_t *stream,int mode, void* opts, int* file_format) {
17089
rathann
parents: 16572
diff changeset
59 int f;
15585
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
60 char *filename = stream->url;
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
61 off_t len;
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
62 char* sdpDescription;
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
63 ssize_t numBytesRead;
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
64
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
65 if(strncmp("sdp://",filename,6) == 0) {
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
66 filename += 6;
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
67 #if defined(__CYGWIN__) || defined(__MINGW32__)
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
68 f = open(filename,O_RDONLY|O_BINARY);
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
69 #else
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
70 f = open(filename,O_RDONLY);
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
71 #endif
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
72 if(f < 0) {
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
73 mp_msg(MSGT_OPEN,MSGL_ERR,MSGTR_FileNotFound,filename);
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
74 return STREAM_ERROR;
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
75 }
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
76
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
77 len=lseek(f,0,SEEK_END);
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
78 lseek(f,0,SEEK_SET);
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
79 if(len == -1)
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
80 return STREAM_ERROR;
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
81
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
82 sdpDescription = (char*)malloc(len+1);
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
83 if(sdpDescription == NULL) return STREAM_ERROR;
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
84 numBytesRead = read(f, sdpDescription, len);
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
85 if(numBytesRead != len) {
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
86 free(sdpDescription);
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
87 return STREAM_ERROR;
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
88 }
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
89 sdpDescription[len] = '\0'; // to be safe
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
90 stream->priv = sdpDescription;
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
91
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
92 stream->type = STREAMTYPE_SDP;
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
93 *file_format = DEMUXER_TYPE_RTP;
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
94 return STREAM_OK;
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
95 }
17089
rathann
parents: 16572
diff changeset
96 return STREAM_UNSUPORTED;
15585
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
97 }
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
98
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
99
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
100 stream_info_t stream_info_rtsp_sip = {
15777
diego
parents: 15585
diff changeset
101 "standard RTSP and SIP",
diego
parents: 15585
diff changeset
102 "RTSP and SIP",
15585
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
103 "Ross Finlayson",
16572
56a5f69e9b35 "LIVE.COM Streaming Media" is now called "LIVE555 Streaming Media".
rsf
parents: 15777
diff changeset
104 "Uses LIVE555 Streaming Media library.",
15585
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
105 open_live_rtsp_sip,
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
106 {"rtsp", "sip", NULL },
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
107 NULL,
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
108 0 // Urls are an option string
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
109 };
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
110
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
111 stream_info_t stream_info_sdp = {
15777
diego
parents: 15585
diff changeset
112 "SDP stream descriptor",
diego
parents: 15585
diff changeset
113 "SDP",
15585
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
114 "Ross Finlayson",
16572
56a5f69e9b35 "LIVE.COM Streaming Media" is now called "LIVE555 Streaming Media".
rsf
parents: 15777
diff changeset
115 "Uses LIVE555 Streaming Media library.",
15585
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
116 open_live_sdp,
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
117 {"sdp", NULL },
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
118 NULL,
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
119 0 // Urls are an option string
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
120 };
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
121
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
122 #endif
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
123 #endif