annotate libmpdemux/demux_xmms.c @ 36945:22750a12bdc7

Cosmetic: Adjust indent.
author ib
date Sat, 22 Mar 2014 19:48:39 +0000
parents 92dd1764392a
children
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 *
26742
0c1db5fd3f79 Use standard license headers with standard formatting.
diego
parents: 25883
diff changeset
4 * This file is part of MPlayer.
22271
8cbd58f431ec proper GPL heading
ivo
parents: 22270
diff changeset
5 *
26742
0c1db5fd3f79 Use standard license headers with standard formatting.
diego
parents: 25883
diff changeset
6 * MPlayer is free software; you can redistribute it and/or modify
0c1db5fd3f79 Use standard license headers with standard formatting.
diego
parents: 25883
diff changeset
7 * it under the terms of the GNU General Public License as published by
0c1db5fd3f79 Use standard license headers with standard formatting.
diego
parents: 25883
diff changeset
8 * the Free Software Foundation; either version 2 of the License, or
0c1db5fd3f79 Use standard license headers with standard formatting.
diego
parents: 25883
diff changeset
9 * (at your option) any later version.
0c1db5fd3f79 Use standard license headers with standard formatting.
diego
parents: 25883
diff changeset
10 *
0c1db5fd3f79 Use standard license headers with standard formatting.
diego
parents: 25883
diff changeset
11 * MPlayer is distributed in the hope that it will be useful,
22272
3d5a5178fc9c more cosmetics
ivo
parents: 22271
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
3d5a5178fc9c more cosmetics
ivo
parents: 22271
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3d5a5178fc9c more cosmetics
ivo
parents: 22271
diff changeset
14 * GNU General Public License for more details.
22271
8cbd58f431ec proper GPL heading
ivo
parents: 22270
diff changeset
15 *
26742
0c1db5fd3f79 Use standard license headers with standard formatting.
diego
parents: 25883
diff changeset
16 * You should have received a copy of the GNU General Public License along
0c1db5fd3f79 Use standard license headers with standard formatting.
diego
parents: 25883
diff changeset
17 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
0c1db5fd3f79 Use standard license headers with standard formatting.
diego
parents: 25883
diff changeset
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22271
8cbd58f431ec proper GPL heading
ivo
parents: 22270
diff changeset
19 */
8cbd58f431ec proper GPL heading
ivo
parents: 22270
diff changeset
20
8542
222c0a39c977 I cleaned up the source a bit, hopefully fixed hanging, also
arpi
parents: 8536
diff changeset
21 // This is not reentrant because of global static variables, but most of
22272
3d5a5178fc9c more cosmetics
ivo
parents: 22271
diff changeset
22 // the plugins are not reentrant either perhaps
8528
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
23 #include "config.h"
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
24
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
25 #include <stdlib.h>
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
26 #include <stdio.h>
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
27 #include <unistd.h>
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
28 #include <pthread.h>
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
29 #include <dlfcn.h>
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
30 #include <dirent.h>
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
31 #include <inttypes.h>
8623
440301fef3fe Added/reordered #includes to silence warnings about "implicit declaration".
rathann
parents: 8611
diff changeset
32 #include <string.h>
440301fef3fe Added/reordered #includes to silence warnings about "implicit declaration".
rathann
parents: 8611
diff changeset
33 #include <sys/stat.h>
8528
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
34
17012
6ff3379a0862 Unify include path handling, -I.. is in CFLAGS.
diego
parents: 16877
diff changeset
35 #include "m_option.h"
6ff3379a0862 Unify include path handling, -I.. is in CFLAGS.
diego
parents: 16877
diff changeset
36 #include "libaf/af_format.h"
22605
4d81dbdf46b9 Add explicit location for headers from the stream/ directory.
diego
parents: 22274
diff changeset
37 #include "stream/stream.h"
8528
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
38 #include "demuxer.h"
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
39 #include "stheader.h"
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
40
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
41 #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
42 #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
43
8528
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
44 #define XMMS_PACKETSIZE 65536 // some plugins won't play if this is too small
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
45
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
46 #include "demux_xmms_plugin.h"
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
47
8542
222c0a39c977 I cleaned up the source a bit, hopefully fixed hanging, also
arpi
parents: 8536
diff changeset
48 typedef struct {
222c0a39c977 I cleaned up the source a bit, hopefully fixed hanging, also
arpi
parents: 8536
diff changeset
49 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
50 InputPlugin* ip;
222c0a39c977 I cleaned up the source a bit, hopefully fixed hanging, also
arpi
parents: 8536
diff changeset
51 } xmms_priv_t;
8528
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
52
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
53 static pthread_mutex_t xmms_mutex;
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
54 static int format = 0x1; // Raw PCM
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
55 static char xmms_audiobuffer[XMMS_PACKETSIZE];
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
56 static uint32_t xmms_channels;
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
57 static uint32_t xmms_samplerate;
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
58 static uint32_t xmms_afmt;
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
59 static int xmms_length;
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
60 static char *xmms_title=NULL;
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
61 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
62 static int xmms_playing=0;
8542
222c0a39c977 I cleaned up the source a bit, hopefully fixed hanging, also
arpi
parents: 8536
diff changeset
63 static xmms_priv_t *xmms_priv=NULL;
222c0a39c977 I cleaned up the source a bit, hopefully fixed hanging, also
arpi
parents: 8536
diff changeset
64 static uint32_t xmms_byterate;
222c0a39c977 I cleaned up the source a bit, hopefully fixed hanging, also
arpi
parents: 8536
diff changeset
65 static int64_t xmms_flushto=-1;
8528
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
66
8542
222c0a39c977 I cleaned up the source a bit, hopefully fixed hanging, also
arpi
parents: 8536
diff changeset
67 // =========== mplayer xmms outputplugin stuff ==============
8528
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
68
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
69 static void disk_close(void) {}
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
70 static void disk_pause(short p) {}
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
71 static void disk_init(void) {}
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
72
8542
222c0a39c977 I cleaned up the source a bit, hopefully fixed hanging, also
arpi
parents: 8536
diff changeset
73 static void disk_flush(int time) {
22270
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
74 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
75 }
222c0a39c977 I cleaned up the source a bit, hopefully fixed hanging, also
arpi
parents: 8536
diff changeset
76
8528
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
77 static int disk_free(void) { // vqf plugin sends more than it should
26758
9fb1d2c3dbd4 cosmetics: Remove pointless parentheses from return statements.
diego
parents: 26742
diff changeset
78 return XMMS_PACKETSIZE - xmms_audiopos < XMMS_PACKETSIZE / 4 ?
9fb1d2c3dbd4 cosmetics: Remove pointless parentheses from return statements.
diego
parents: 26742
diff changeset
79 0 : XMMS_PACKETSIZE - xmms_audiopos - XMMS_PACKETSIZE / 4;
8528
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
80 }
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
81
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
82 static int disk_playing(void) {
22270
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
83 return 0; //?? maybe plugins wait on exit until oplugin is not playing?
8528
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
84 }
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
85
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
86 static int disk_get_output_time(void) {
22270
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
87 if (xmms_byterate)
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
88 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
89 else return 0;
8528
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
90 }
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
91
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
92 static int disk_open(AFormat fmt, int rate, int nch) {
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
93 switch (fmt) {
22270
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
94 case FMT_U8:
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
95 xmms_afmt=AF_FORMAT_U8;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
96 break;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
97 case FMT_S8:
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
98 xmms_afmt=AF_FORMAT_S8;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
99 break;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
100 case FMT_U16_LE:
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
101 xmms_afmt=AF_FORMAT_U16_LE;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
102 break;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
103 case FMT_U16_NE:
29401
f01023c524c3 Replace WORDS_BIGENDIAN by HAVE_BIGENDIAN in all internal code.
diego
parents: 28339
diff changeset
104 #if HAVE_BIGENDIAN
22270
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
105 xmms_afmt=AF_FORMAT_U16_BE;
8528
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
106 #else
22270
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
107 xmms_afmt=AF_FORMAT_U16_LE;
8528
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
108 #endif
22270
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
109 break;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
110 case FMT_U16_BE:
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
111 xmms_afmt=AF_FORMAT_U16_BE;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
112 break;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
113 case FMT_S16_NE:
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
114 xmms_afmt=AF_FORMAT_S16_NE;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
115 break;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
116 case FMT_S16_LE:
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
117 xmms_afmt=AF_FORMAT_S16_LE;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
118 break;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
119 case FMT_S16_BE:
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
120 xmms_afmt=AF_FORMAT_S16_BE;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
121 break;
8528
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
122 }
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
123 xmms_samplerate=rate;
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
124 xmms_channels=nch;
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
125 return 1;
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
126 }
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
127
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
128 static void disk_write(void *ptr, int length) {
22270
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
129 if (!xmms_playing) return;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
130 pthread_mutex_lock(&xmms_mutex);
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
131 if (xmms_flushto!=-1) {
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
132 xmms_priv->spos=xmms_flushto;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
133 xmms_flushto=-1;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
134 xmms_audiopos=0;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
135 }
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
136 xmms_priv->spos+= length;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
137 memcpy(&xmms_audiobuffer[xmms_audiopos],ptr,length);
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
138 xmms_audiopos+=length;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
139 pthread_mutex_unlock(&xmms_mutex);
8528
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
140 }
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
141
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
142 static OutputPlugin xmms_output_plugin =
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
143 {
22270
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
144 NULL,
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
145 NULL,
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
146 "MPlayer output interface plugin ", /* Description */
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
147 disk_init,
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
148 NULL, /* about */
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
149 NULL, /* configure */
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
150 NULL, /* get_volume */
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
151 NULL, /* set_volume */
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
152 disk_open,
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
153 disk_write,
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
154 disk_close,
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
155 disk_flush,
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
156 disk_pause,
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
157 disk_free,
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
158 disk_playing,
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
159 disk_get_output_time,
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
160 disk_get_output_time //we pretend that everything written is played at once
8528
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
161 };
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
162
8542
222c0a39c977 I cleaned up the source a bit, hopefully fixed hanging, also
arpi
parents: 8536
diff changeset
163 // ==================== mplayer xmms inputplugin helper stuff =================
8528
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
164
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
165 static InputPlugin* input_plugins[100];
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
166 static int no_plugins=0;
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
167
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
168 /* Dummy functions */
28232
8df85ad26746 Add missing 'void' keyword to parameterless function declarations.
diego
parents: 26758
diff changeset
169 static InputVisType input_get_vis_type(void){return 0;}
22272
3d5a5178fc9c more cosmetics
ivo
parents: 22271
diff changeset
170 static void input_add_vis_pcm(int time, AFormat fmt, int nch, int length,
3d5a5178fc9c more cosmetics
ivo
parents: 22271
diff changeset
171 void *ptr){}
8528
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
172 static void input_set_info_text(char * text){}
28232
8df85ad26746 Add missing 'void' keyword to parameterless function declarations.
diego
parents: 26758
diff changeset
173 char *xmms_get_gentitle_format(void){ return ""; }
8528
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
174 /* Dummy functions END*/
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
175
22272
3d5a5178fc9c more cosmetics
ivo
parents: 22271
diff changeset
176 static void input_set_info(char* title,int length, int rate, int freq, int nch)
3d5a5178fc9c more cosmetics
ivo
parents: 22271
diff changeset
177 {
8536
ff192e1b018f xmp hangign I noticed too, and is fixed with this patch, seeking works now
arpi
parents: 8528
diff changeset
178 xmms_length=length;
ff192e1b018f xmp hangign I noticed too, and is fixed with this patch, seeking works now
arpi
parents: 8528
diff changeset
179 }
ff192e1b018f xmp hangign I noticed too, and is fixed with this patch, seeking works now
arpi
parents: 8528
diff changeset
180
22265
02333de881a7 probe ~/.xmms/Plugins for plugins too, so users without root access on their
ivo
parents: 19062
diff changeset
181 static void init_plugins_from_dir(const char *plugin_dir){
8528
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
182 DIR *dir;
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
183 struct dirent *ent;
22270
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
184
22265
02333de881a7 probe ~/.xmms/Plugins for plugins too, so users without root access on their
ivo
parents: 19062
diff changeset
185 dir = opendir(plugin_dir);
8528
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
186 if (!dir) return;
22270
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
187
8528
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
188 while ((ent = readdir(dir)) != NULL){
22270
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
189 char filename[strlen(plugin_dir)+strlen(ent->d_name)+4];
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
190 void* handle;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
191 sprintf(filename, "%s/%s", plugin_dir, ent->d_name);
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
192 handle=dlopen(filename, RTLD_NOW);
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
193 if(handle){
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
194 void *(*gpi) (void);
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
195 gpi=dlsym(handle, "get_iplugin_info");
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
196 if(gpi){
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
197 InputPlugin *p=gpi();
22272
3d5a5178fc9c more cosmetics
ivo
parents: 22271
diff changeset
198 mp_msg(MSGT_DEMUX, MSGL_INFO, MSGTR_MPDEMUX_XMMS_FoundPlugin,
3d5a5178fc9c more cosmetics
ivo
parents: 22271
diff changeset
199 ent->d_name,p->description);
22270
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
200 p->handle = handle;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
201 p->filename = strdup(filename);
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
202 p->get_vis_type = input_get_vis_type;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
203 p->add_vis_pcm = input_add_vis_pcm;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
204 p->set_info = input_set_info;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
205 p->set_info_text = input_set_info_text;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
206 if(p->init) p->init();
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
207 input_plugins[no_plugins++]=p;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
208 } else
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
209 dlclose(handle);
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
210 }
8528
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
211 }
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
212 closedir(dir);
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
213 }
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
214
28232
8df85ad26746 Add missing 'void' keyword to parameterless function declarations.
diego
parents: 26758
diff changeset
215 static void init_plugins(void) {
22265
02333de881a7 probe ~/.xmms/Plugins for plugins too, so users without root access on their
ivo
parents: 19062
diff changeset
216 char *home;
02333de881a7 probe ~/.xmms/Plugins for plugins too, so users without root access on their
ivo
parents: 19062
diff changeset
217
02333de881a7 probe ~/.xmms/Plugins for plugins too, so users without root access on their
ivo
parents: 19062
diff changeset
218 no_plugins=0;
02333de881a7 probe ~/.xmms/Plugins for plugins too, so users without root access on their
ivo
parents: 19062
diff changeset
219
02333de881a7 probe ~/.xmms/Plugins for plugins too, so users without root access on their
ivo
parents: 19062
diff changeset
220 home = getenv("HOME");
02333de881a7 probe ~/.xmms/Plugins for plugins too, so users without root access on their
ivo
parents: 19062
diff changeset
221 if(home != NULL) {
22270
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
222 char xmms_home[strlen(home) + 15];
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
223 sprintf(xmms_home, "%s/.xmms/Plugins", home);
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
224 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
225 }
02333de881a7 probe ~/.xmms/Plugins for plugins too, so users without root access on their
ivo
parents: 19062
diff changeset
226
02333de881a7 probe ~/.xmms/Plugins for plugins too, so users without root access on their
ivo
parents: 19062
diff changeset
227 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
228 }
02333de881a7 probe ~/.xmms/Plugins for plugins too, so users without root access on their
ivo
parents: 19062
diff changeset
229
28232
8df85ad26746 Add missing 'void' keyword to parameterless function declarations.
diego
parents: 26758
diff changeset
230 static void cleanup_plugins(void) {
8528
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
231 while(no_plugins>0){
22270
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
232 --no_plugins;
22272
3d5a5178fc9c more cosmetics
ivo
parents: 22271
diff changeset
233 mp_msg(MSGT_DEMUX, MSGL_INFO, MSGTR_MPDEMUX_XMMS_ClosingPlugin,
3d5a5178fc9c more cosmetics
ivo
parents: 22271
diff changeset
234 input_plugins[no_plugins]->filename);
22270
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
235 if(input_plugins[no_plugins]->cleanup)
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
236 input_plugins[no_plugins]->cleanup();
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
237 dlclose(input_plugins[no_plugins]->handle);
8528
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
238 }
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
239 }
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
240
8542
222c0a39c977 I cleaned up the source a bit, hopefully fixed hanging, also
arpi
parents: 8536
diff changeset
241 // ============================ mplayer demuxer stuff ===============
222c0a39c977 I cleaned up the source a bit, hopefully fixed hanging, also
arpi
parents: 8536
diff changeset
242
16175
6b86089c2edd Demuxer modularization
rtognimp
parents: 14248
diff changeset
243 static int demux_xmms_open(demuxer_t* demuxer) {
22270
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
244 InputPlugin* ip = NULL;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
245 sh_audio_t* sh_audio;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
246 WAVEFORMATEX* w;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
247 xmms_priv_t *priv;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
248 int i;
8528
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
249
22270
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
250 if (xmms_priv) return 0; // as I said, it's not reentrant :)
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
251 init_plugins();
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
252 for(i=0;i<no_plugins;i++){
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
253 if (input_plugins[i]->is_our_file(demuxer->stream->url)){
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
254 ip=input_plugins[i]; break;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
255 }
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
256 }
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
257 if(!ip) return 0; // no plugin to handle this...
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
258
22272
3d5a5178fc9c more cosmetics
ivo
parents: 22271
diff changeset
259 pthread_mutex_init(&xmms_mutex,NULL);
8528
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
260
22270
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
261 xmms_priv=priv=malloc(sizeof(xmms_priv_t));
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
262 memset(priv,0,sizeof(xmms_priv_t));
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
263 priv->ip=ip;
8528
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
264
22270
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
265 memset(xmms_audiobuffer,0,XMMS_PACKETSIZE);
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
266
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
267 xmms_channels=0;
31609
cd81fce1f010 Make the stream language an argument to the stream creation function
reimar
parents: 29401
diff changeset
268 sh_audio = new_sh_audio(demuxer,0, NULL);
32121
d332ea379205 Replace sizeof(WAVEFORMATEX) occurrences.
reimar
parents: 31609
diff changeset
269 sh_audio->wf = w = malloc(sizeof(*w));
22270
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
270 w->wFormatTag = sh_audio->format = format;
8528
9d143176d95f XMMS Input plugin support
arpi
parents:
diff changeset
271
22270
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
272 demuxer->movi_start = 0;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
273 demuxer->movi_end = 100;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
274 demuxer->audio->id = 0;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
275 demuxer->audio->sh = sh_audio;
9d2aaf9197d6 cosmetics
ivo
parents: 22267
diff changeset
276 demuxer->priv=priv;
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
25883
baf32110d3fc Use defines to give names to the different seek flags.
reimar
parents: 25707
diff changeset
353 pos = (flags & SEEK_ABSOLUTE) ? 0 : priv->spos / sh_audio->wf->nAvgBytesPerSec;
baf32110d3fc Use defines to give names to the different seek flags.
reimar
parents: 25707
diff changeset
354 if (flags & SEEK_FACTOR)
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
25707
d4fe6e23283e Make all demuxer_desc_t const, thus moving them to .rodata
reimar
parents: 22605
diff changeset
402 const 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 };