[speex-dev] [PATCH] speex-xmms endian problems fixed

Ben Stanley bds02 at uow.edu.au
Thu Apr 17 08:36:51 PDT 2003



I found a problem with trying to use the speex plugin for xmms on my
PowerBook G3 'Pismo' PPC machine, running kernel 2.4.19. It turns out
that the kernel sound driver ignores the endian of the data format flag
and instead expects the data to be native endian. This is the same
problem that was affecting speexdec.

I have now fixed this problem, and another compilation issue that I
found. I am mailing these patches here, and to the last known email
address of the author so that they will be publicly accessible.

While it could be argued that the driver should be fixed instead, the
redundant conversion of the data format from native endian (big) to
little endian may also be argued to be inefficient. I will also look
into fixing the kernel driver at another time.

I am now able to listen to the linux.conf.au 2003 talks. Thanks to all
those involved in writing speex, giving the talks, and recording and
encoding the talks! Most entertaining!

Ben Stanley.

<p>


--- speex-xmms-0.8/libspeex.c	Mon Sep 23 06:28:37 2002
+++ speex-xmms-0.8-works/libspeex.c	Thu Apr 17 12:41:12 2003
@@ -328,7 +328,7 @@
 
                 speex_ip.set_info(speex_fs->title, speex_fs->length, -1, speex_fs->freq, speex_fs->channels);
                 
-		if (speex_ip.output->open_audio(FMT_S16_LE, speex_fs->freq, speex_fs->channels) == 0)
+		if (speex_ip.output->open_audio(FMT_S16_NE, speex_fs->freq, speex_fs->channels) == 0)
                 {
                         fprintf(stderr, SELF ": audio error\n");
                         return;
@@ -427,7 +427,7 @@
                                                         while (speex_ip.output->buffer_free() < (speex_fs->framesize * sizeof(short)) && speex_fs->playing)
                                                                 xmms_usleep(10000);
 
-							speex_ip.add_vis_pcm(speex_ip.output->written_time(), FMT_S16_LE, speex_fs->channels, speex_fs->framesize * sizeof(short), &output);
+							speex_ip.add_vis_pcm(speex_ip.output->written_time(), FMT_S16_NE, speex_fs->channels, speex_fs->framesize * sizeof(short), &output);
                                                         
                                                         speex_ip.output->write_audio(&output, speex_fs->framesize * sizeof(short));
 
@@ -497,7 +497,7 @@
                                                                 while (speex_ip.output->buffer_free() < (speex_fs->framesize * sizeof(short)) && speex_fs->playing)
                                                                         xmms_usleep(10000);
 
-								speex_ip.add_vis_pcm(speex_ip.output->written_time(), FMT_S16_LE, speex_fs->channels, speex_fs->framesize * sizeof(short), &output);
+								speex_ip.add_vis_pcm(speex_ip.output->written_time(), FMT_S16_NE, speex_fs->channels, speex_fs->framesize * sizeof(short), &output);
                                                                 speex_ip.output->write_audio(&output, speex_fs->framesize * sizeof(short));
 
                                                         }




--- speex-xmms-0.8/config.c	Sat Oct 12 08:00:44 2002
+++ speex-xmms-0.8-works/config.c	Thu Apr 17 12:05:10 2003
@@ -66,7 +66,7 @@
         gtk_label_set_justify(GTK_LABEL(cfg_buffer_label), GTK_JUSTIFY_LEFT);
         gtk_container_add(GTK_CONTAINER(cfg_buffer_label_box), GTK_WIDGET(cfg_buffer_label));
         
-	cfg_buffer_adj = gtk_adjustment_new( ((gfloat)speex_cfg->buffersize), 0., 4096., 4., 4., 5.);
+	cfg_buffer_adj = GTK_WIDGET(gtk_adjustment_new( ((gfloat)speex_cfg->buffersize), 0., 4096., 4., 4., 5.));
         
         cfg_buffer_input = gtk_spin_button_new(GTK_ADJUSTMENT(cfg_buffer_adj), 4., 0);
         if (speex_cfg->buffersize)
@@ -80,7 +80,7 @@
         gtk_label_set_justify(GTK_LABEL(cfg_prebuf_label), GTK_JUSTIFY_LEFT);
         gtk_container_add(GTK_CONTAINER(cfg_buffer_label_box), GTK_WIDGET(cfg_prebuf_label));
 
-	cfg_prebuf_adj = gtk_adjustment_new(speex_cfg->prebuffer, 0, 100, 1, 1, 1);
+	cfg_prebuf_adj = GTK_WIDGET(gtk_adjustment_new(speex_cfg->prebuffer, 0, 100, 1, 1, 1));
 
         cfg_prebuf_inp = gtk_spin_button_new(GTK_ADJUSTMENT(cfg_prebuf_adj), 1, 0);
         gtk_spin_button_set_value(GTK_SPIN_BUTTON(cfg_prebuf_inp), speex_cfg->prebuffer);

<p>--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'speex-dev-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the Speex-dev mailing list