changeset 517:55dc40ff1aff trunk

[svn] Add tell_audio(AFormat *, gint *, gint *), for retrieving audio format information from an output plugin. Right now, we need this inside the core to do effects processing. Rationale: - If tell_audio() is unavailable, do not do processing. - If tell_audio() is available and there is a format mismatch, do not do processing yet -- we need to reinitialize the output port before we can do anything useful. Disk Writer and Crossfade are too fragile to make these changes to, so they do not support tell_audio yet.
author nenolod
date Thu, 26 Jan 2006 11:37:48 -0800
parents 69a70ab41ed7
children 6c28a04d1254
files Plugins/Output/OSS/OSS.c Plugins/Output/OSS/OSS.h Plugins/Output/OSS/audio.c Plugins/Output/alsa/alsa.c Plugins/Output/alsa/alsa.h Plugins/Output/alsa/audio.c Plugins/Output/crossfade/crossfade.c Plugins/Output/disk_writer/disk_writer.c Plugins/Output/esd/audio.c Plugins/Output/esd/esd.c Plugins/Output/esd/esdout.h Plugins/Output/jack/jack.c
diffstat 12 files changed, 39 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/Plugins/Output/OSS/OSS.c	Thu Jan 26 11:18:52 2006 -0800
+++ b/Plugins/Output/OSS/OSS.c	Thu Jan 26 11:37:48 2006 -0800
@@ -43,6 +43,7 @@
     oss_playing,
     oss_get_output_time,
     oss_get_written_time,
+    oss_tell
 };
 
 OutputPlugin *
--- a/Plugins/Output/OSS/OSS.h	Thu Jan 26 11:18:52 2006 -0800
+++ b/Plugins/Output/OSS/OSS.h	Thu Jan 26 11:37:48 2006 -0800
@@ -70,4 +70,6 @@
 int (*oss_get_stereo_convert_func(int output, int input)) (void **, int,
                                                            int);
 
+void oss_tell(AFormat * fmt, gint * rate, gint * nch);
+
 #endif
--- a/Plugins/Output/OSS/audio.c	Thu Jan 26 11:18:52 2006 -0800
+++ b/Plugins/Output/OSS/audio.c	Thu Jan 26 11:37:48 2006 -0800
@@ -714,3 +714,10 @@
         buffer_thread = g_thread_create(oss_loop, NULL, TRUE, NULL);
     return 1;
 }
+
+void oss_tell(AFormat * fmt, gint * rate, gint * nch)
+{
+	(*fmt) = input.format.xmms;
+	(*rate) = input.frequency;
+	(*nch) = input.channels;
+}
--- a/Plugins/Output/alsa/alsa.c	Thu Jan 26 11:18:52 2006 -0800
+++ b/Plugins/Output/alsa/alsa.c	Thu Jan 26 11:37:48 2006 -0800
@@ -38,6 +38,7 @@
 	alsa_playing,
 	alsa_get_output_time,
 	alsa_get_written_time,
+	alsa_tell
 };
 
 OutputPlugin *get_oplugin_info(void)
--- a/Plugins/Output/alsa/alsa.h	Thu Jan 26 11:18:52 2006 -0800
+++ b/Plugins/Output/alsa/alsa.h	Thu Jan 26 11:37:48 2006 -0800
@@ -79,5 +79,6 @@
 int alsa_open(AFormat fmt, int rate, int nch);
 int alsa_get_output_time(void);
 int alsa_get_written_time(void);
+void alsa_tell(AFormat * fmt, gint * rate, gint * nch);
 
 #endif
--- a/Plugins/Output/alsa/audio.c	Thu Jan 26 11:18:52 2006 -0800
+++ b/Plugins/Output/alsa/audio.c	Thu Jan 26 11:37:48 2006 -0800
@@ -1177,3 +1177,10 @@
 
 	return 0;
 }
+
+void alsa_tell(AFormat * fmt, gint * rate, gint * nch)
+{
+	(*fmt) = inputf->xmms_format;
+	(*rate) = inputf->rate;
+	(*nch) = inputf->channels;
+}
--- a/Plugins/Output/crossfade/crossfade.c	Thu Jan 26 11:18:52 2006 -0800
+++ b/Plugins/Output/crossfade/crossfade.c	Thu Jan 26 11:37:48 2006 -0800
@@ -89,6 +89,7 @@
   xfade_buffer_playing,
   xfade_output_time,
   xfade_written_time,
+  NULL			/* we do not support effects on crossfade, too fragile */
 };
 
 /* internal prototypes */
--- a/Plugins/Output/disk_writer/disk_writer.c	Thu Jan 26 11:18:52 2006 -0800
+++ b/Plugins/Output/disk_writer/disk_writer.c	Thu Jan 26 11:37:48 2006 -0800
@@ -98,6 +98,7 @@
 	disk_playing,
 	disk_get_output_time,
 	disk_get_written_time,
+	NULL
 };
 
 OutputPlugin *get_oplugin_info(void)
--- a/Plugins/Output/esd/audio.c	Thu Jan 26 11:18:52 2006 -0800
+++ b/Plugins/Output/esd/audio.c	Thu Jan 26 11:37:48 2006 -0800
@@ -478,3 +478,11 @@
         buffer_thread = g_thread_create(esdout_loop, NULL, TRUE, NULL);
     return 1;
 }
+
+void
+esdout_tell(AFormat * fmt, gint * rate, gint * nch)
+{
+	(*fmt) = format;
+	(*rate) = frequency;
+	(*nch) = channels;
+}
--- a/Plugins/Output/esd/esd.c	Thu Jan 26 11:18:52 2006 -0800
+++ b/Plugins/Output/esd/esd.c	Thu Jan 26 11:37:48 2006 -0800
@@ -40,6 +40,7 @@
     esdout_playing,
     esdout_get_output_time,
     esdout_get_written_time,
+    esdout_tell
 };
 
 OutputPlugin *
--- a/Plugins/Output/esd/esdout.h	Thu Jan 26 11:18:52 2006 -0800
+++ b/Plugins/Output/esd/esdout.h	Thu Jan 26 11:37:48 2006 -0800
@@ -65,5 +65,6 @@
 int esdout_get_output_time(void);
 int esdout_get_written_time(void);
 void esdout_set_audio_params(void);
+void esdout_tell(AFormat * fmt, gint * rate, gint * nch);
 
 #endif
--- a/Plugins/Output/jack/jack.c	Thu Jan 26 11:18:52 2006 -0800
+++ b/Plugins/Output/jack/jack.c	Thu Jan 26 11:37:48 2006 -0800
@@ -587,6 +587,13 @@
 	gtk_widget_grab_focus(button);
 }
 
+static void
+jack_tell_audio(AFormat * fmt, gint * srate, gint * nch)
+{
+	(*fmt) = input.format;
+	(*srate) = input.frequency;
+	(*nch) = input.channels;
+}
 
 OutputPlugin jack_op =
 {
@@ -608,6 +615,7 @@
 	jack_playing,
 	jack_get_output_time,
 	jack_get_written_time,
+	jack_tell_audio
 };