annotate stream/stream_vstream.c @ 21925:1c93736b6751

fix identation, broken by last commit
author gpoirier
date Tue, 16 Jan 2007 13:28:22 +0000
parents 2a9d669e5ff6
children cea0eb833758
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"
19335
2a9d669e5ff6 isolated tcp socket code from network.c to a dedicated file
ben
parents: 19271
diff changeset
54 #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
55
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
56 #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
57
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
58 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
59 char buf[1024];
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
60 va_list va;
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
61 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
62 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
63 va_end(va);
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
64 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
65 }
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
66
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
67 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
68 char* host;
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
69 char* fsid;
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
70 } stream_priv_dflts = {
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 NULL
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
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
75 #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
76 /// URL definition
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
77 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
78 {"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
79 {"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
80 { 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
81 };
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
82
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
83 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
84 "vstream",
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
85 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
86 &stream_priv_dflts,
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
87 stream_opts_fields
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
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
90 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
91 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
92 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
93 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
94 return len;
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
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
97 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
98 s->pos = newpos;
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
99 return 1;
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 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
103 return STREAM_UNSUPORTED;
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
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
106 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
107 }
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 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
110 int f;
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
111 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
112
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
113 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
114 return STREAM_UNSUPORTED;
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
115
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
116 if(!p->host) {
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
117 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
118 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
119 return STREAM_ERROR;
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
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
122 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
123 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
124 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
125 return STREAM_ERROR;
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
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
128 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
129
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
130 if(f < 0) {
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
131 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
132 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
133 return STREAM_ERROR;
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 stream->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 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
138
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
139 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
140 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
141 return STREAM_ERROR;
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
142 } 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
143 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
144 return STREAM_ERROR;
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
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
147 if (vstream_start()) {
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
148 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
149 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
150 return STREAM_ERROR;
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
151 }
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
152 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
153 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
154 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
155 return STREAM_ERROR;
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
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
158 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
159 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
160 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
161
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
162 stream->priv = p;
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
163 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
164 stream->control = control;
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
165 stream->seek = seek;
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
166 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
167 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
168
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
169 return STREAM_OK;
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
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
172 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
173 "vstream client",
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
174 "vstream",
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
175 "Joey",
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
176 "",
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
177 open_s,
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
178 { "tivo", NULL },
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
179 &stream_opts,
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
180 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
181 };