annotate stream/stream_vstream.c @ 28513:9f085caed8c2

synced with r28532
author Gabrov
date Thu, 12 Feb 2009 19:28:04 +0000
parents a26e50cae389
children 0f1b5b68af32
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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 /*
26737
a26e50cae389 Use standard license headers with standard formatting.
diego
parents: 25691
diff changeset
2 * Copyright (C) Joey Parrish
14838
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
3 *
26737
a26e50cae389 Use standard license headers with standard formatting.
diego
parents: 25691
diff changeset
4 * This file is part of MPlayer.
14838
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
5 *
26737
a26e50cae389 Use standard license headers with standard formatting.
diego
parents: 25691
diff changeset
6 * MPlayer is free software; you can redistribute it and/or modify
a26e50cae389 Use standard license headers with standard formatting.
diego
parents: 25691
diff changeset
7 * it under the terms of the GNU General Public License as published by
a26e50cae389 Use standard license headers with standard formatting.
diego
parents: 25691
diff changeset
8 * the Free Software Foundation; either version 2 of the License, or
a26e50cae389 Use standard license headers with standard formatting.
diego
parents: 25691
diff changeset
9 * (at your option) any later version.
a26e50cae389 Use standard license headers with standard formatting.
diego
parents: 25691
diff changeset
10 *
a26e50cae389 Use standard license headers with standard formatting.
diego
parents: 25691
diff changeset
11 * MPlayer is distributed in the hope that it will be useful,
a26e50cae389 Use standard license headers with standard formatting.
diego
parents: 25691
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
a26e50cae389 Use standard license headers with standard formatting.
diego
parents: 25691
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
a26e50cae389 Use standard license headers with standard formatting.
diego
parents: 25691
diff changeset
14 * GNU General Public License for more details.
a26e50cae389 Use standard license headers with standard formatting.
diego
parents: 25691
diff changeset
15 *
a26e50cae389 Use standard license headers with standard formatting.
diego
parents: 25691
diff changeset
16 * You should have received a copy of the GNU General Public License along
a26e50cae389 Use standard license headers with standard formatting.
diego
parents: 25691
diff changeset
17 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
a26e50cae389 Use standard license headers with standard formatting.
diego
parents: 25691
diff changeset
18 * 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
19 */
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
20
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 * 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
23 * 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
24 * 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
25 * 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
26 * 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
27 * 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
28 *
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
29 */
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 #include "config.h"
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 <sys/types.h>
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
35 #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
36 #include <fcntl.h>
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
37 #include <unistd.h>
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
38 #include <stdarg.h>
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
39
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
40 #include <stdlib.h>
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
41 #include <stdio.h>
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
42 #include <inttypes.h>
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
43 #include <errno.h>
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
44
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
45 #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
46 #include "stream.h"
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
47 #include "help_mp.h"
17012
6ff3379a0862 Unify include path handling, -I.. is in CFLAGS.
diego
parents: 14838
diff changeset
48 #include "m_option.h"
6ff3379a0862 Unify include path handling, -I.. is in CFLAGS.
diego
parents: 14838
diff changeset
49 #include "m_struct.h"
19335
2a9d669e5ff6 isolated tcp socket code from network.c to a dedicated file
ben
parents: 19271
diff changeset
50 #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
51
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
52 #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
53
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
54 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
55 char buf[1024];
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
56 va_list va;
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
57 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
58 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
59 va_end(va);
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
60 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
61 }
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
62
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
63 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
64 char* host;
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
65 char* fsid;
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
66 } stream_priv_dflts = {
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
67 NULL,
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
68 NULL
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
69 };
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
70
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
71 #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
72 /// URL definition
25242
371a40dcc1cc stream_opts arrays should be const
reimar
parents: 25211
diff changeset
73 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
74 {"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
75 {"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
76 { 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
77 };
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
78
25691
68015115f63a stream_opts should be const
reimar
parents: 25242
diff changeset
79 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
80 "vstream",
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
81 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
82 &stream_priv_dflts,
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
83 stream_opts_fields
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
84 };
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
85
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
86 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
87 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
88 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
89 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
90 return len;
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
91 }
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
92
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
93 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
94 s->pos = newpos;
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
95 return 1;
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
96 }
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
97
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
98 static int control(struct stream_st *s,int cmd,void* arg) {
24257
d261f5109660 cosmetics: typo fix UNSUPORTED --> UNSUPPORTED
diego
parents: 21977
diff changeset
99 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
100 }
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
101
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
102 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
103 }
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
104
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
105 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
106 int f;
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
107 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
108
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
109 if(mode != STREAM_READ)
24257
d261f5109660 cosmetics: typo fix UNSUPORTED --> UNSUPPORTED
diego
parents: 21977
diff changeset
110 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
111
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
112 if(!p->host) {
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
113 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
114 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
115 return STREAM_ERROR;
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
116 }
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
117
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
118 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
119 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
120 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
121 return STREAM_ERROR;
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
122 }
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
123
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
124 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
125
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
126 if(f < 0) {
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
127 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
128 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
129 return STREAM_ERROR;
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
130 }
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
131 stream->fd = f;
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 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
134
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
135 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
136 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
137 return STREAM_ERROR;
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
138 } 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
139 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
140 return STREAM_ERROR;
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
141 }
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
142
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
143 if (vstream_start()) {
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
144 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
145 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
146 return STREAM_ERROR;
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
147 }
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
148 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
149 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
150 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
151 return STREAM_ERROR;
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
152 }
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
153
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
154 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
155 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
156 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
157
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
158 stream->priv = p;
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
159 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
160 stream->control = control;
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
161 stream->seek = seek;
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
162 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
163 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
164
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
165 return STREAM_OK;
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
25211
c1d17bd6683c Mark all stream_info_t as const
reimar
parents: 24257
diff changeset
168 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
169 "vstream client",
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
170 "vstream",
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
171 "Joey",
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
172 "",
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
173 open_s,
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
174 { "tivo", NULL },
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
175 &stream_opts,
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
176 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
177 };