annotate libmpdemux/stream_vstream.c @ 17487:fa17424b4c7b

change muxer_write_chunk() so that pts/dts _could_ be passed from encoder to muxer
author michael
date Thu, 26 Jan 2006 19:32:07 +0000
parents 6ff3379a0862
children d2d9d011203f
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 #ifdef HAVE_VSTREAM
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 <sys/types.h>
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
41 #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
42 #include <fcntl.h>
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
43 #include <unistd.h>
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
44 #include <stdarg.h>
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
45
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
46 #include <stdlib.h>
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
47 #include <stdio.h>
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
48 #include <inttypes.h>
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
49 #include <errno.h>
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
50
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
51 #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
52 #include "stream.h"
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
53 #include "help_mp.h"
17012
6ff3379a0862 Unify include path handling, -I.. is in CFLAGS.
diego
parents: 14838
diff changeset
54 #include "m_option.h"
6ff3379a0862 Unify include path handling, -I.. is in CFLAGS.
diego
parents: 14838
diff changeset
55 #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
56
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
57 #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
58
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
59 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
60 char buf[1024];
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
61 va_list va;
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
62 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
63 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
64 va_end(va);
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
65 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
66 }
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
67
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
68 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
69 char* host;
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
70 char* fsid;
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
71 } stream_priv_dflts = {
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 NULL
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
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
76 #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
77 /// URL definition
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
78 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
79 {"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
80 {"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
81 { 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
82 };
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
83
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
84 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
85 "vstream",
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
86 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
87 &stream_priv_dflts,
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
88 stream_opts_fields
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
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
91 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
92 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
93 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
94 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
95 return len;
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 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
99 s->pos = newpos;
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
100 return 1;
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
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
103 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
104 return STREAM_UNSUPORTED;
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
105 }
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
106
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
107 static 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
108 }
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
109
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
110 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
111 int f;
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
112 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
113
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
114 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
115 return STREAM_UNSUPORTED;
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 if(!p->host) {
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
118 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
119 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
120 return STREAM_ERROR;
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
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
123 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
124 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
125 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
126 return STREAM_ERROR;
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
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
129 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
130
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
131 if(f < 0) {
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
132 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
133 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
134 return STREAM_ERROR;
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 stream->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 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
139
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
140 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
141 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
142 return STREAM_ERROR;
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
143 } 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
144 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
145 return STREAM_ERROR;
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
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
148 if (vstream_start()) {
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 #1\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 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
154 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
155 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
156 return STREAM_ERROR;
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
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
159 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
160 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
161 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
162
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
163 stream->priv = p;
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
164 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
165 stream->control = control;
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
166 stream->seek = seek;
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
167 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
168 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
169
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
170 return STREAM_OK;
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
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
173 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
174 "vstream client",
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
175 "vstream",
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
176 "Joey",
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
177 "",
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
178 open_s,
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
179 { "tivo", NULL },
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
180 &stream_opts,
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
181 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
182 };
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
183
8d0555e96c69 more on tivo vstream support.. 1000l to Joey for forgetting this file and breaking MPlayer build! :)
rfelker
parents:
diff changeset
184 #endif