annotate libmpdemux/demux_xmms.c @ 24386:3a8d72016ed7

warning fixes: resource.c: In function 'RES_SizeofResource': resource.c:111: warning: unused variable 'hRsrc32' resource.c: In function 'RES_LoadResource': resource.c:157: warning: unused variable 'hRsrc32'
author diego
date Mon, 10 Sep 2007 13:06:54 +0000
parents 4d81dbdf46b9
children d4fe6e23283e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
22271
8cbd58f431ec proper GPL heading
ivo
parents: 22270
diff changeset
1 /*
22272
3d5a5178fc9c more cosmetics
ivo
parents: 22271
diff changeset
2 * Copyright (C) 2002-2004 Balatoni Denes and A'rpi
22271
8cbd58f431ec proper GPL heading
ivo
parents: 22270
diff changeset
3 *
22272
3d5a5178fc9c more cosmetics
ivo
parents: 22271
diff changeset
4 * This program is free software; you can redistribute it and/or
3d5a5178fc9c more cosmetics
ivo
parents: 22271
diff changeset
5 * modify it under the terms of the GNU General Public License
3d5a5178fc9c more cosmetics
ivo
parents: 22271
diff changeset
6 * as published by the Free Software Foundation; either version 2
3d5a5178fc9c more cosmetics
ivo
parents: 22271
diff changeset
7 * of the License, or (at your option) any later version.
22271
8cbd58f431ec proper GPL heading
ivo
parents: 22270
diff changeset
8 *
22272
3d5a5178fc9c more cosmetics
ivo
parents: 22271
diff changeset
9 * This program is distributed in the hope that it will be useful,
3d5a5178fc9c more cosmetics
ivo
parents: 22271
diff changeset
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
3d5a5178fc9c more cosmetics
ivo
parents: 22271
diff changeset
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3d5a5178fc9c more cosmetics
ivo
parents: 22271
diff changeset
12 * GNU General Public License for more details.
22271
8cbd58f431ec proper GPL heading
ivo
parents: 22270
diff changeset
13 *
22272
3d5a5178fc9c more cosmetics
ivo
parents: 22271
diff changeset
14 * You should have received a copy of the GNU General Public License
3d5a5178fc9c more cosmetics
ivo
parents: 22271
diff changeset
15 * along with this program; if not, write to the Free Software
3d5a5178fc9c more cosmetics
ivo
parents: 22271
diff changeset
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22271
8cbd58f431ec proper GPL heading
ivo
parents: 22270
diff changeset
17 *
8cbd58f431ec proper GPL heading
ivo
parents: 22270
diff changeset
18 */
8cbd58f431ec proper GPL heading
ivo
parents: 22270
diff changeset
19
8542
222c0a39c977 I cleaned up the source a bit, hopefully fixed hanging, also
arpi
parents: 8536
diff changeset
20 // This is not reentrant because of global static variables, but most of
22272
3d5a5178fc9c more cosmetics
ivo
parents: 22271
diff changeset
21 // the plugins are not reentrant either perhaps
8528
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
22 #include "config.h"
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
23
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
24 #include <stdlib.h>
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
25 #include <stdio.h>
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
26 #include <unistd.h>
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
27 #include <pthread.h>
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
28 #include <dlfcn.h>
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
29 #include <dirent.h>
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
30 #include <inttypes.h>
8623
440301fef3fe Added/reordered #includes to silence warnings about "implicit declaration".
rathann
parents: 8611
diff changeset
31 #include <string.h>
440301fef3fe Added/reordered #includes to silence warnings about "implicit declaration".
rathann
parents: 8611
diff changeset
32 #include <sys/stat.h>
8528
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
33
17012
6ff3379a0862 Unify include path handling, -I.. is in CFLAGS.
diego
parents: 16877
diff changeset
34 #include "m_option.h"
6ff3379a0862 Unify include path handling, -I.. is in CFLAGS.
diego
parents: 16877
diff changeset
35 #include "libaf/af_format.h"
22605
4d81dbdf46b9 Add explicit location for headers from the stream/ directory.
diego
parents: 22274
diff changeset
36 #include "stream/stream.h"
8528
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
37 #include "demuxer.h"
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
38 #include "stheader.h"
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
39
18176
f72bc5754209 Part3 of Otvos Attila's oattila AT chello-hu mp_msg changes, with lots of modifications as usual
reynaldo
parents: 17636
diff changeset
40 #include "mp_msg.h"
f72bc5754209 Part3 of Otvos Attila's oattila AT chello-hu mp_msg changes, with lots of modifications as usual
reynaldo
parents: 17636
diff changeset
41 #include "help_mp.h"
f72bc5754209 Part3 of Otvos Attila's oattila AT chello-hu mp_msg changes, with lots of modifications as usual
reynaldo
parents: 17636
diff changeset
42
8528
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
43 #define XMMS_PACKETSIZE 65536 // some plugins won't play if this is too small
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
44
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
45 #include "demux_xmms_plugin.h"
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
46
8542
222c0a39c977 I cleaned up the source a bit, hopefully fixed hanging, also
arpi
parents: 8536
diff changeset
47 typedef struct {
222c0a39c977 I cleaned up the source a bit, hopefully fixed hanging, also
arpi
parents: 8536
diff changeset
48 uint64_t spos; // stream position in number of output bytes from 00:00:00
222c0a39c977 I cleaned up the source a bit, hopefully fixed hanging, also
arpi
parents: 8536
diff changeset
49 InputPlugin* ip;
222c0a39c977 I cleaned up the source a bit, hopefully fixed hanging, also
arpi
parents: 8536
diff changeset
50 } xmms_priv_t;
8528
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
51
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
52 static pthread_mutex_t xmms_mutex;
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
53 static int format = 0x1; // Raw PCM
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
54 static char xmms_audiobuffer[XMMS_PACKETSIZE];
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
55 static uint32_t xmms_channels;
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
56 static uint32_t xmms_samplerate;
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
57 static uint32_t xmms_afmt;
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
58 static int xmms_length;
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
59 static char *xmms_title=NULL;
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
60 static uint32_t xmms_audiopos=0;
8536
ff192e1b018f xmp hangign I noticed too, and is fixed with this patch, seeking works now
arpi
parents: 8528
diff changeset
61 static int xmms_playing=0;
8542
222c0a39c977 I cleaned up the source a bit, hopefully fixed hanging, also
arpi
parents: 8536
diff changeset
62 static xmms_priv_t *xmms_priv=NULL;
222c0a39c977 I cleaned up the source a bit, hopefully fixed hanging, also
arpi
parents: 8536
diff changeset
63 static uint32_t xmms_byterate;
222c0a39c977 I cleaned up the source a bit, hopefully fixed hanging, also
arpi
parents: 8536
diff changeset
64 static int64_t xmms_flushto=-1;
8528
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
65
8542
222c0a39c977 I cleaned up the source a bit, hopefully fixed hanging, also
arpi
parents: 8536
diff changeset
66 // =========== mplayer xmms outputplugin stuff ==============
8528
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
67
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
68 static void disk_close(void) {}
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
69 static void disk_pause(short p) {}
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
70 static void disk_init(void) {}
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
71
8542
222c0a39c977 I cleaned up the source a bit, hopefully fixed hanging, also
arpi
parents: 8536
diff changeset
72 static void disk_flush(int time) {
22270
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
73 if (xmms_priv) xmms_flushto=time*((long long) xmms_byterate)/1000LL;
8542
222c0a39c977 I cleaned up the source a bit, hopefully fixed hanging, also
arpi
parents: 8536
diff changeset
74 }
222c0a39c977 I cleaned up the source a bit, hopefully fixed hanging, also
arpi
parents: 8536
diff changeset
75
8528
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
76 static int disk_free(void) { // vqf plugin sends more than it should
22272
3d5a5178fc9c more cosmetics
ivo
parents: 22271
diff changeset
77 return (XMMS_PACKETSIZE-xmms_audiopos<XMMS_PACKETSIZE/4 ?
3d5a5178fc9c more cosmetics
ivo
parents: 22271
diff changeset
78 0:XMMS_PACKETSIZE-xmms_audiopos-XMMS_PACKETSIZE/4);
8528
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
79 }
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
80
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
81 static int disk_playing(void) {
22270
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
82 return 0; //?? maybe plugins wait on exit until oplugin is not playing?
8528
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
83 }
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
84
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
85 static int disk_get_output_time(void) {
22270
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
86 if (xmms_byterate)
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
87 return xmms_priv->spos*1000LL/((long long)xmms_byterate);
8542
222c0a39c977 I cleaned up the source a bit, hopefully fixed hanging, also
arpi
parents: 8536
diff changeset
88 else return 0;
8528
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
89 }
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
90
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
91 static int disk_open(AFormat fmt, int rate, int nch) {
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
92 switch (fmt) {
22270
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
93 case FMT_U8:
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
94 xmms_afmt=AF_FORMAT_U8;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
95 break;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
96 case FMT_S8:
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
97 xmms_afmt=AF_FORMAT_S8;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
98 break;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
99 case FMT_U16_LE:
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
100 xmms_afmt=AF_FORMAT_U16_LE;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
101 break;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
102 case FMT_U16_NE:
8528
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
103 #if WORDS_BIGENDIAN
22270
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
104 xmms_afmt=AF_FORMAT_U16_BE;
8528
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
105 #else
22270
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
106 xmms_afmt=AF_FORMAT_U16_LE;
8528
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
107 #endif
22270
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
108 break;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
109 case FMT_U16_BE:
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
110 xmms_afmt=AF_FORMAT_U16_BE;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
111 break;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
112 case FMT_S16_NE:
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
113 xmms_afmt=AF_FORMAT_S16_NE;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
114 break;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
115 case FMT_S16_LE:
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
116 xmms_afmt=AF_FORMAT_S16_LE;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
117 break;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
118 case FMT_S16_BE:
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
119 xmms_afmt=AF_FORMAT_S16_BE;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
120 break;
8528
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
121 }
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
122 xmms_samplerate=rate;
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
123 xmms_channels=nch;
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
124 return 1;
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
125 }
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
126
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
127 static void disk_write(void *ptr, int length) {
22270
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
128 if (!xmms_playing) return;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
129 pthread_mutex_lock(&xmms_mutex);
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
130 if (xmms_flushto!=-1) {
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
131 xmms_priv->spos=xmms_flushto;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
132 xmms_flushto=-1;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
133 xmms_audiopos=0;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
134 }
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
135 xmms_priv->spos+= length;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
136 memcpy(&xmms_audiobuffer[xmms_audiopos],ptr,length);
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
137 xmms_audiopos+=length;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
138 pthread_mutex_unlock(&xmms_mutex);
8528
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
139 }
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
140
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
141 static OutputPlugin xmms_output_plugin =
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
142 {
22270
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
143 NULL,
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
144 NULL,
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
145 "MPlayer output interface plugin ", /* Description */
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
146 disk_init,
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
147 NULL, /* about */
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
148 NULL, /* configure */
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
149 NULL, /* get_volume */
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
150 NULL, /* set_volume */
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
151 disk_open,
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
152 disk_write,
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
153 disk_close,
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
154 disk_flush,
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
155 disk_pause,
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
156 disk_free,
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
157 disk_playing,
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
158 disk_get_output_time,
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
159 disk_get_output_time //we pretend that everything written is played at once
8528
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
160 };
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
161
8542
222c0a39c977 I cleaned up the source a bit, hopefully fixed hanging, also
arpi
parents: 8536
diff changeset
162 // ==================== mplayer xmms inputplugin helper stuff =================
8528
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
163
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
164 static InputPlugin* input_plugins[100];
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
165 static int no_plugins=0;
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
166
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
167 /* Dummy functions */
10211
4bc481804519 warning fixes by Dominik Mierzejewski <dominik@rangers.eu.org>
alex
parents: 9211
diff changeset
168 static InputVisType input_get_vis_type(){return 0;}
22272
3d5a5178fc9c more cosmetics
ivo
parents: 22271
diff changeset
169 static void input_add_vis_pcm(int time, AFormat fmt, int nch, int length,
3d5a5178fc9c more cosmetics
ivo
parents: 22271
diff changeset
170 void *ptr){}
8528
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
171 static void input_set_info_text(char * text){}
9211
383e3cc8ee88 xmms_demuxer missing symbol
arpi
parents: 8623
diff changeset
172 char *xmms_get_gentitle_format(){ return ""; }
8528
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
173 /* Dummy functions END*/
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
174
22272
3d5a5178fc9c more cosmetics
ivo
parents: 22271
diff changeset
175 static void input_set_info(char* title,int length, int rate, int freq, int nch)
3d5a5178fc9c more cosmetics
ivo
parents: 22271
diff changeset
176 {
8536
ff192e1b018f xmp hangign I noticed too, and is fixed with this patch, seeking works now
arpi
parents: 8528
diff changeset
177 xmms_length=length;
ff192e1b018f xmp hangign I noticed too, and is fixed with this patch, seeking works now
arpi
parents: 8528
diff changeset
178 }
ff192e1b018f xmp hangign I noticed too, and is fixed with this patch, seeking works now
arpi
parents: 8528
diff changeset
179
22265
02333de881a7 probe ~/.xmms/Plugins for plugins too, so users without root access on their
ivo
parents: 19062
diff changeset
180 static void init_plugins_from_dir(const char *plugin_dir){
8528
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
181 DIR *dir;
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
182 struct dirent *ent;
22270
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
183
22265
02333de881a7 probe ~/.xmms/Plugins for plugins too, so users without root access on their
ivo
parents: 19062
diff changeset
184 dir = opendir(plugin_dir);
8528
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
185 if (!dir) return;
22270
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
186
8528
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
187 while ((ent = readdir(dir)) != NULL){
22270
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
188 char filename[strlen(plugin_dir)+strlen(ent->d_name)+4];
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
189 void* handle;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
190 sprintf(filename, "%s/%s", plugin_dir, ent->d_name);
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
191 handle=dlopen(filename, RTLD_NOW);
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
192 if(handle){
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
193 void *(*gpi) (void);
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
194 gpi=dlsym(handle, "get_iplugin_info");
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
195 if(gpi){
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
196 InputPlugin *p=gpi();
22272
3d5a5178fc9c more cosmetics
ivo
parents: 22271
diff changeset
197 mp_msg(MSGT_DEMUX, MSGL_INFO, MSGTR_MPDEMUX_XMMS_FoundPlugin,
3d5a5178fc9c more cosmetics
ivo
parents: 22271
diff changeset
198 ent->d_name,p->description);
22270
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
199 p->handle = handle;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
200 p->filename = strdup(filename);
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
201 p->get_vis_type = input_get_vis_type;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
202 p->add_vis_pcm = input_add_vis_pcm;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
203 p->set_info = input_set_info;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
204 p->set_info_text = input_set_info_text;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
205 if(p->init) p->init();
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
206 input_plugins[no_plugins++]=p;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
207 } else
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
208 dlclose(handle);
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
209 }
8528
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
210 }
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
211 closedir(dir);
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
212 }
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
213
22265
02333de881a7 probe ~/.xmms/Plugins for plugins too, so users without root access on their
ivo
parents: 19062
diff changeset
214 static void init_plugins(){
02333de881a7 probe ~/.xmms/Plugins for plugins too, so users without root access on their
ivo
parents: 19062
diff changeset
215 char *home;
02333de881a7 probe ~/.xmms/Plugins for plugins too, so users without root access on their
ivo
parents: 19062
diff changeset
216
02333de881a7 probe ~/.xmms/Plugins for plugins too, so users without root access on their
ivo
parents: 19062
diff changeset
217 no_plugins=0;
02333de881a7 probe ~/.xmms/Plugins for plugins too, so users without root access on their
ivo
parents: 19062
diff changeset
218
02333de881a7 probe ~/.xmms/Plugins for plugins too, so users without root access on their
ivo
parents: 19062
diff changeset
219 home = getenv("HOME");
02333de881a7 probe ~/.xmms/Plugins for plugins too, so users without root access on their
ivo
parents: 19062
diff changeset
220 if(home != NULL) {
22270
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
221 char xmms_home[strlen(home) + 15];
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
222 sprintf(xmms_home, "%s/.xmms/Plugins", home);
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
223 init_plugins_from_dir(xmms_home);
22265
02333de881a7 probe ~/.xmms/Plugins for plugins too, so users without root access on their
ivo
parents: 19062
diff changeset
224 }
02333de881a7 probe ~/.xmms/Plugins for plugins too, so users without root access on their
ivo
parents: 19062
diff changeset
225
02333de881a7 probe ~/.xmms/Plugins for plugins too, so users without root access on their
ivo
parents: 19062
diff changeset
226 init_plugins_from_dir(XMMS_INPUT_PLUGIN_DIR);
02333de881a7 probe ~/.xmms/Plugins for plugins too, so users without root access on their
ivo
parents: 19062
diff changeset
227 }
02333de881a7 probe ~/.xmms/Plugins for plugins too, so users without root access on their
ivo
parents: 19062
diff changeset
228
8528
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
229 static void cleanup_plugins(){
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
230 while(no_plugins>0){
22270
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
231 --no_plugins;
22272
3d5a5178fc9c more cosmetics
ivo
parents: 22271
diff changeset
232 mp_msg(MSGT_DEMUX, MSGL_INFO, MSGTR_MPDEMUX_XMMS_ClosingPlugin,
3d5a5178fc9c more cosmetics
ivo
parents: 22271
diff changeset
233 input_plugins[no_plugins]->filename);
22270
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
234 if(input_plugins[no_plugins]->cleanup)
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
235 input_plugins[no_plugins]->cleanup();
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
236 dlclose(input_plugins[no_plugins]->handle);
8528
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
237 }
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
238 }
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
239
8542
222c0a39c977 I cleaned up the source a bit, hopefully fixed hanging, also
arpi
parents: 8536
diff changeset
240 // ============================ mplayer demuxer stuff ===============
222c0a39c977 I cleaned up the source a bit, hopefully fixed hanging, also
arpi
parents: 8536
diff changeset
241
16175
6b86089c2edd Demuxer modularization
rtognimp
parents: 14248
diff changeset
242 static int demux_xmms_open(demuxer_t* demuxer) {
22270
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
243 InputPlugin* ip = NULL;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
244 sh_audio_t* sh_audio;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
245 WAVEFORMATEX* w;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
246 xmms_priv_t *priv;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
247 int i;
8528
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
248
22270
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
249 if (xmms_priv) return 0; // as I said, it's not reentrant :)
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
250 init_plugins();
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
251 for(i=0;i<no_plugins;i++){
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
252 if (input_plugins[i]->is_our_file(demuxer->stream->url)){
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
253 ip=input_plugins[i]; break;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
254 }
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
255 }
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
256 if(!ip) return 0; // no plugin to handle this...
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
257
22272
3d5a5178fc9c more cosmetics
ivo
parents: 22271
diff changeset
258 pthread_mutex_init(&xmms_mutex,NULL);
8528
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
259
22270
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
260 xmms_priv=priv=malloc(sizeof(xmms_priv_t));
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
261 memset(priv,0,sizeof(xmms_priv_t));
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
262 priv->ip=ip;
8528
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
263
22270
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
264 memset(xmms_audiobuffer,0,XMMS_PACKETSIZE);
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
265
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
266 xmms_channels=0;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
267 sh_audio = new_sh_audio(demuxer,0);
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
268 sh_audio->wf = w = malloc(sizeof(WAVEFORMATEX));
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
269 w->wFormatTag = sh_audio->format = format;
8528
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
270
22270
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
271 demuxer->movi_start = 0;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
272 demuxer->movi_end = 100;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
273 demuxer->audio->id = 0;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
274 demuxer->audio->sh = sh_audio;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
275 demuxer->priv=priv;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
276 sh_audio->ds = demuxer->audio;
8528
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
277
22270
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
278 xmms_output_plugin.init();
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
279 ip->output = &xmms_output_plugin;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
280 xmms_playing=1;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
281 ip->play_file(demuxer->stream->url);
22272
3d5a5178fc9c more cosmetics
ivo
parents: 22271
diff changeset
282 if (ip->get_song_info)
3d5a5178fc9c more cosmetics
ivo
parents: 22271
diff changeset
283 ip->get_song_info(demuxer->stream->url,&xmms_title,&xmms_length);
22270
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
284 if (xmms_length<=0) demuxer->seekable=0;
8528
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
285
22274
7cb8c95727ab make message translatable
ivo
parents: 22272
diff changeset
286 mp_msg(MSGT_DEMUX,MSGL_INFO,MSGTR_MPDEMUX_XMMS_WaitForStart,
7cb8c95727ab make message translatable
ivo
parents: 22272
diff changeset
287 demuxer->stream->url);
22270
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
288 while (xmms_channels==0) {
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
289 usleep(10000);
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
290 if(ip->get_time()<0) return 0;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
291 }
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
292 sh_audio->sample_format= xmms_afmt;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
293 switch (xmms_afmt) {
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
294 case AF_FORMAT_S16_LE:
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
295 case AF_FORMAT_S16_BE:
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
296 case AF_FORMAT_U16_LE:
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
297 case AF_FORMAT_U16_BE:
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
298 sh_audio->samplesize = 2;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
299 break;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
300 default:
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
301 sh_audio->samplesize = 1;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
302 }
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
303 w->wBitsPerSample = sh_audio->samplesize*8;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
304 w->nChannels = sh_audio->channels = xmms_channels;
22272
3d5a5178fc9c more cosmetics
ivo
parents: 22271
diff changeset
305 w->nSamplesPerSec = sh_audio->samplerate = xmms_samplerate;
3d5a5178fc9c more cosmetics
ivo
parents: 22271
diff changeset
306 xmms_byterate = w->nAvgBytesPerSec =
3d5a5178fc9c more cosmetics
ivo
parents: 22271
diff changeset
307 xmms_samplerate*sh_audio->channels*sh_audio->samplesize;
22270
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
308 w->nBlockAlign = sh_audio->samplesize*sh_audio->channels;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
309 w->cbSize = 0;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
310
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
311 return DEMUXER_TYPE_XMMS;
8528
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
312 }
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
313
16175
6b86089c2edd Demuxer modularization
rtognimp
parents: 14248
diff changeset
314 static int demux_xmms_fill_buffer(demuxer_t* demuxer, demux_stream_t *ds) {
22270
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
315 sh_audio_t *sh_audio = demuxer->audio->sh;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
316 xmms_priv_t *priv=demuxer->priv;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
317 demux_packet_t* dp;
8528
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
318
22270
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
319 if (xmms_length<=0) demuxer->seekable=0;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
320 else demuxer->seekable=1;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
321
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
322 while (xmms_audiopos<XMMS_PACKETSIZE/2) {
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
323 if((priv->ip->get_time()<0) || !xmms_playing)
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
324 return 0;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
325 usleep(1000);
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
326 }
8528
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
327
22270
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
328 pthread_mutex_lock(&xmms_mutex);
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
329 dp = new_demux_packet(XMMS_PACKETSIZE/2);
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
330 dp->pts = priv->spos / sh_audio->wf->nAvgBytesPerSec;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
331 ds->pos = priv->spos;
8542
222c0a39c977 I cleaned up the source a bit, hopefully fixed hanging, also
arpi
parents: 8536
diff changeset
332
22270
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
333 memcpy(dp->buffer,xmms_audiobuffer,XMMS_PACKETSIZE/2);
22272
3d5a5178fc9c more cosmetics
ivo
parents: 22271
diff changeset
334 memcpy(xmms_audiobuffer,&xmms_audiobuffer[XMMS_PACKETSIZE/2],
3d5a5178fc9c more cosmetics
ivo
parents: 22271
diff changeset
335 xmms_audiopos-XMMS_PACKETSIZE/2);
22270
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
336 xmms_audiopos-=XMMS_PACKETSIZE/2;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
337 pthread_mutex_unlock(&xmms_mutex);
8528
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
338
22270
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
339 ds_add_packet(ds,dp);
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
340
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
341 return 1;
8528
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
342 }
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
343
22272
3d5a5178fc9c more cosmetics
ivo
parents: 22271
diff changeset
344 static void demux_xmms_seek(demuxer_t *demuxer,float rel_seek_secs,
3d5a5178fc9c more cosmetics
ivo
parents: 22271
diff changeset
345 float audio_delay,int flags){
22270
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
346 stream_t* s = demuxer->stream;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
347 sh_audio_t* sh_audio = demuxer->audio->sh;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
348 xmms_priv_t *priv=demuxer->priv;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
349 int32_t pos;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
350
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
351 if(priv->ip->get_time()<0) return;
8528
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
352
22270
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
353 pos = (flags & 1) ? 0 : priv->spos / sh_audio->wf->nAvgBytesPerSec;
22272
3d5a5178fc9c more cosmetics
ivo
parents: 22271
diff changeset
354 if (flags & 2)
22270
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
355 pos+= rel_seek_secs*xmms_length;
22272
3d5a5178fc9c more cosmetics
ivo
parents: 22271
diff changeset
356 else
3d5a5178fc9c more cosmetics
ivo
parents: 22271
diff changeset
357 pos+= rel_seek_secs;
8528
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
358
22270
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
359 if (pos<0) pos=0;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
360 if (pos>=xmms_length) pos=xmms_length-1;
8528
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
361
22270
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
362 priv->ip->seek((pos<0)?0:pos);
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
363 priv->spos=pos * sh_audio->wf->nAvgBytesPerSec;
8528
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
364 }
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
365
16175
6b86089c2edd Demuxer modularization
rtognimp
parents: 14248
diff changeset
366 static void demux_close_xmms(demuxer_t* demuxer) {
22270
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
367 xmms_priv_t *priv=demuxer->priv;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
368 xmms_playing=0;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
369 xmms_audiopos=0; // xmp on exit waits until buffer is free enough
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
370 if (priv != NULL) {
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
371 if (priv->ip != NULL)
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
372 priv->ip->stop();
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
373 free(priv); xmms_priv=demuxer->priv=NULL;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
374 }
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
375 cleanup_plugins();
8528
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
376 }
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
377
16175
6b86089c2edd Demuxer modularization
rtognimp
parents: 14248
diff changeset
378 static int demux_xmms_control(demuxer_t *demuxer,int cmd, void *arg){
8528
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
379 demux_stream_t *d_video=demuxer->video;
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
380 sh_audio_t *sh_audio=demuxer->audio->sh;
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
381 xmms_priv_t *priv=demuxer->priv;
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
382
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
383 switch(cmd) {
22270
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
384 case DEMUXER_CTRL_GET_TIME_LENGTH:
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
385 if (xmms_length<=0) return DEMUXER_CTRL_DONTKNOW;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
386 *((double *)arg)=(double)xmms_length/1000;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
387 return DEMUXER_CTRL_GUESS;
8528
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
388
22270
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
389 case DEMUXER_CTRL_GET_PERCENT_POS:
22272
3d5a5178fc9c more cosmetics
ivo
parents: 22271
diff changeset
390 if (xmms_length<=0)
22270
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
391 return DEMUXER_CTRL_DONTKNOW;
22272
3d5a5178fc9c more cosmetics
ivo
parents: 22271
diff changeset
392 *((int *)arg)=(int)( priv->spos /
3d5a5178fc9c more cosmetics
ivo
parents: 22271
diff changeset
393 (float)(sh_audio->wf->nAvgBytesPerSec) / xmms_length );
22270
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
394 return DEMUXER_CTRL_OK;
8528
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
395
22270
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
396 default:
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
397 return DEMUXER_CTRL_NOTIMPL;
8528
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
398 }
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
399 }
16175
6b86089c2edd Demuxer modularization
rtognimp
parents: 14248
diff changeset
400
6b86089c2edd Demuxer modularization
rtognimp
parents: 14248
diff changeset
401
6b86089c2edd Demuxer modularization
rtognimp
parents: 14248
diff changeset
402 demuxer_desc_t demuxer_desc_xmms = {
22270
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
403 "XMMS demuxer",
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
404 "xmms",
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
405 "XMMS",
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
406 "Balatoni Denes, A'rpi",
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
407 "requires XMMS plugins",
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
408 DEMUXER_TYPE_XMMS,
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
409 0, // safe autodetect
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
410 demux_xmms_open,
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
411 demux_xmms_fill_buffer,
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
412 NULL,
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
413 demux_close_xmms,
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
414 demux_xmms_seek,
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
415 demux_xmms_control
16175
6b86089c2edd Demuxer modularization
rtognimp
parents: 14248
diff changeset
416 };