annotate libmpdemux/stream_livedotcom.c @ 16844:2f36ffebc37c

minor spelling wording fixes
author diego
date Sun, 23 Oct 2005 16:51:39 +0000
parents 56a5f69e9b35
children 1e8962ee910f
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) {
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
59 FILE *f;
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 }
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
96 }
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 stream_info_t stream_info_rtsp_sip = {
15777
diego
parents: 15585
diff changeset
100 "standard RTSP and SIP",
diego
parents: 15585
diff changeset
101 "RTSP and SIP",
15585
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
102 "Ross Finlayson",
16572
56a5f69e9b35 "LIVE.COM Streaming Media" is now called "LIVE555 Streaming Media".
rsf
parents: 15777
diff changeset
103 "Uses LIVE555 Streaming Media library.",
15585
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
104 open_live_rtsp_sip,
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
105 {"rtsp", "sip", NULL },
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
106 NULL,
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
107 0 // Urls are an option string
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
108 };
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 stream_info_t stream_info_sdp = {
15777
diego
parents: 15585
diff changeset
111 "SDP stream descriptor",
diego
parents: 15585
diff changeset
112 "SDP",
15585
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
113 "Ross Finlayson",
16572
56a5f69e9b35 "LIVE.COM Streaming Media" is now called "LIVE555 Streaming Media".
rsf
parents: 15777
diff changeset
114 "Uses LIVE555 Streaming Media library.",
15585
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
115 open_live_sdp,
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
116 {"sdp", NULL },
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
117 NULL,
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
118 0 // Urls are an option string
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
119 };
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 #endif
281d155fb37f ported all network streams to the new API
nicodvb
parents:
diff changeset
122 #endif