annotate stream/stream_vstream.c @ 19292:20938447bb55

'make clean' now recurses through subdirectories as expected, 'make dirclean' can be used to clean just the toplevel directory.
author diego
date Thu, 03 Aug 2006 17:31:30 +0000
parents 64d82a45a05d
children 2a9d669e5ff6
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 /*
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
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
19 * along with GNU Make; see the file COPYING. If not, write to
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
20 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
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
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
25 /*
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
26 * 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
27 * 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
28 * 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
29 * 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
30 * 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
31 * 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
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
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 "config.h"
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
37
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
38 #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
39 #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
40 #include <fcntl.h>
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
41 #include <unistd.h>
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
42 #include <stdarg.h>
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
43
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
44 #include <stdlib.h>
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
45 #include <stdio.h>
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
46 #include <inttypes.h>
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
47 #include <errno.h>
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
48
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
49 #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
50 #include "stream.h"
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
51 #include "help_mp.h"
17012
6ff3379a0862 Unify include path handling, -I.. is in CFLAGS.
diego
parents: 14838
diff changeset
52 #include "m_option.h"
6ff3379a0862 Unify include path handling, -I.. is in CFLAGS.
diego
parents: 14838
diff changeset
53 #include "m_struct.h"
14838
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
54
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
55 #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
56
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
57 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
58 char buf[1024];
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
59 va_list va;
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
60 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
61 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
62 va_end(va);
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
63 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
64 }
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
65
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
66 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
67 char* host;
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
68 char* fsid;
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
69 } stream_priv_dflts = {
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 NULL
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
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
74 #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
75 /// URL definition
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
76 static m_option_t stream_opts_fields[] = {
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
77 {"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
78 {"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
79 { 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
80 };
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
81
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
82 static struct m_struct_st stream_opts = {
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
83 "vstream",
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
84 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
85 &stream_priv_dflts,
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
86 stream_opts_fields
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
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
89 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
90 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
91 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
92 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
93 return len;
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
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
96 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
97 s->pos = newpos;
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
98 return 1;
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
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
101 static int control(struct stream_st *s,int cmd,void* arg) {
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
102 return STREAM_UNSUPORTED;
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 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
106 }
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
107
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
108 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
109 int f;
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
110 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
111
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
112 if(mode != STREAM_READ)
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
113 return STREAM_UNSUPORTED;
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
114
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
115 if(!p->host) {
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
116 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
117 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
118 return STREAM_ERROR;
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
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
121 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
122 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
123 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
124 return STREAM_ERROR;
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
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
127 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
128
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
129 if(f < 0) {
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
130 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
131 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
132 return STREAM_ERROR;
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
133 }
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
134 stream->fd = f;
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
135
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
136 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
137
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
138 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
139 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
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 } 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
142 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
143 return STREAM_ERROR;
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
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
146 if (vstream_start()) {
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
147 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
148 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
149 return STREAM_ERROR;
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
150 }
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
151 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
152 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
153 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
154 return STREAM_ERROR;
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
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
157 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
158 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
159 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
160
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
161 stream->priv = p;
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
162 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
163 stream->control = control;
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
164 stream->seek = seek;
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
165 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
166 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
167
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
168 return STREAM_OK;
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
169 }
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
170
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
171 stream_info_t stream_info_vstream = {
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
172 "vstream client",
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
173 "vstream",
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
174 "Joey",
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
175 "",
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
176 open_s,
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
177 { "tivo", NULL },
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
178 &stream_opts,
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
179 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
180 };