Mercurial > mplayer.hg
annotate stream/stream_vstream.c @ 26489:925b2b7a1f34
dependency generation infrastructure for C++ files
author | diego |
---|---|
date | Thu, 24 Apr 2008 21:46:50 +0000 |
parents | 68015115f63a |
children | a26e50cae389 |
rev | line source |
---|---|
14838
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
1 /* |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
2 * stream_vstream.c |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
3 * |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
4 * Copyright (C) Joey Parrish |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
5 * |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
6 * This file is part of MPlayer, a free movie player. |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
7 * |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
8 * MPlayer is free software; you can redistribute it and/or modify |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
9 * it under the terms of the GNU General Public License as published by |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
10 * the Free Software Foundation; either version 2, or (at your option) |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
11 * any later version. |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
12 * |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
13 * MPlayer is distributed in the hope that it will be useful, |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
16 * GNU General Public License for more details. |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
17 * |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
18 * You should have received a copy of the GNU General Public License |
21977
cea0eb833758
Fix FSF address and otherwise broken license headers.
diego
parents:
19335
diff
changeset
|
19 * along with MPlayer; if not, write to the Free Software |
cea0eb833758
Fix FSF address and otherwise broken license headers.
diego
parents:
19335
diff
changeset
|
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
14838
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
21 */ |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
22 |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
23 /* |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
24 * If you have a tivo with the vstream server installed, (and most tivo |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
25 * hackers do,) then you can connect to it and stream ty files using |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
26 * this module. The url syntax is tivo://host/fsid or tivo://host/list |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
27 * to list the available recordings and their fsid's. |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
28 * This module depends on libvstream-client, which is available from |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
29 * http://armory.nicewarrior.org/projects/vstream-client . |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
30 * |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
31 */ |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
32 |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
33 |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
34 #include "config.h" |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
35 |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
36 #include <sys/types.h> |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
37 #include <sys/stat.h> |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
38 #include <fcntl.h> |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
39 #include <unistd.h> |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
40 #include <stdarg.h> |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
41 |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
42 #include <stdlib.h> |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
43 #include <stdio.h> |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
44 #include <inttypes.h> |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
45 #include <errno.h> |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
46 |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
47 #include "mp_msg.h" |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
48 #include "stream.h" |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
49 #include "help_mp.h" |
17012 | 50 #include "m_option.h" |
51 #include "m_struct.h" | |
19335
2a9d669e5ff6
isolated tcp socket code from network.c to a dedicated file
ben
parents:
19271
diff
changeset
|
52 #include "tcp.h" |
14838
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
53 |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
54 #include <vstream-client.h> |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
55 |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
56 void vstream_error(const char *format, ...) { |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
57 char buf[1024]; |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
58 va_list va; |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
59 va_start(va, format); |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
60 vsnprintf(buf, 1024, format, va); |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
61 va_end(va); |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
62 mp_msg(MSGT_STREAM, MSGL_ERR, buf); |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
63 } |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
64 |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
65 static struct stream_priv_s { |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
66 char* host; |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
67 char* fsid; |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
68 } stream_priv_dflts = { |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
69 NULL, |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
70 NULL |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
71 }; |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
72 |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
73 #define ST_OFF(f) M_ST_OFF(struct stream_priv_s,f) |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
74 /// URL definition |
25242 | 75 static const m_option_t stream_opts_fields[] = { |
14838
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
76 {"hostname", ST_OFF(host), CONF_TYPE_STRING, 0, 0 ,0, NULL}, |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
77 {"filename", ST_OFF(fsid), CONF_TYPE_STRING, 0, 0 ,0, NULL}, |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
78 { NULL, NULL, 0, 0, 0, 0, NULL } |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
79 }; |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
80 |
25691 | 81 static const struct m_struct_st stream_opts = { |
14838
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
82 "vstream", |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
83 sizeof(struct stream_priv_s), |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
84 &stream_priv_dflts, |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
85 stream_opts_fields |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
86 }; |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
87 |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
88 static int fill_buffer(stream_t *s, char* buffer, int max_len){ |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
89 struct stream_priv_s* p = (struct stream_priv_s*)s->priv; |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
90 int len = vstream_load_chunk(p->fsid, buffer, max_len, s->pos); |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
91 if (len <= 0) return 0; |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
92 return len; |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
93 } |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
94 |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
95 static int seek(stream_t *s,off_t newpos) { |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
96 s->pos = newpos; |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
97 return 1; |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
98 } |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
99 |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
100 static int control(struct stream_st *s,int cmd,void* arg) { |
24257 | 101 return STREAM_UNSUPPORTED; |
14838
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
102 } |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
103 |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
104 static void close_s(struct stream_st *s) { |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
105 } |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
106 |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
107 static int open_s(stream_t *stream, int mode, void* opts, int* file_format) { |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
108 int f; |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
109 struct stream_priv_s* p = (struct stream_priv_s*)opts; |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
110 |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
111 if(mode != STREAM_READ) |
24257 | 112 return STREAM_UNSUPPORTED; |
14838
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
113 |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
114 if(!p->host) { |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
115 mp_msg(MSGT_OPEN, MSGL_ERR, "We need a host name (ex: tivo://hostname/fsid)\n"); |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
116 m_struct_free(&stream_opts, opts); |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
117 return STREAM_ERROR; |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
118 } |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
119 |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
120 if(!p->fsid || strlen(p->fsid) == 0) { |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
121 mp_msg(MSGT_OPEN, MSGL_ERR, "We need an fsid (ex: tivo://hostname/fsid)\n"); |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
122 m_struct_free(&stream_opts, opts); |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
123 return STREAM_ERROR; |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
124 } |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
125 |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
126 f = connect2Server(p->host, VSERVER_PORT, 1); |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
127 |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
128 if(f < 0) { |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
129 mp_msg(MSGT_OPEN, MSGL_ERR, "Connection to %s failed\n", p->host); |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
130 m_struct_free(&stream_opts, opts); |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
131 return STREAM_ERROR; |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
132 } |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
133 stream->fd = f; |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
134 |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
135 vstream_set_socket_fd(f); |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
136 |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
137 if (!strcmp(p->fsid, "list")) { |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
138 vstream_list_streams(0); |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
139 return STREAM_ERROR; |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
140 } else if (!strcmp(p->fsid, "llist")) { |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
141 vstream_list_streams(1); |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
142 return STREAM_ERROR; |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
143 } |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
144 |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
145 if (vstream_start()) { |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
146 mp_msg(MSGT_OPEN, MSGL_ERR, "Cryptic internal error #1\n"); |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
147 m_struct_free(&stream_opts, opts); |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
148 return STREAM_ERROR; |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
149 } |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
150 if (vstream_startstream(p->fsid)) { |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
151 mp_msg(MSGT_OPEN, MSGL_ERR, "Cryptic internal error #2\n"); |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
152 m_struct_free(&stream_opts, opts); |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
153 return STREAM_ERROR; |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
154 } |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
155 |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
156 stream->start_pos = 0; |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
157 stream->end_pos = vstream_streamsize(); |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
158 mp_msg(MSGT_OPEN, MSGL_DBG2, "Tivo stream size is %d\n", stream->end_pos); |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
159 |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
160 stream->priv = p; |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
161 stream->fill_buffer = fill_buffer; |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
162 stream->control = control; |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
163 stream->seek = seek; |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
164 stream->close = close_s; |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
165 stream->type = STREAMTYPE_VSTREAM; |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
166 |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
167 return STREAM_OK; |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
168 } |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
169 |
25211 | 170 const stream_info_t stream_info_vstream = { |
14838
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
171 "vstream client", |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
172 "vstream", |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
173 "Joey", |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
174 "", |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
175 open_s, |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
176 { "tivo", NULL }, |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
177 &stream_opts, |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
178 1 // Url is an option string |
8d0555e96c69
more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff
changeset
|
179 }; |