Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for host Endian-ness #30

Closed
psi29a opened this issue Feb 24, 2014 · 16 comments
Closed

Support for host Endian-ness #30

psi29a opened this issue Feb 24, 2014 · 16 comments

Comments

@psi29a
Copy link
Member

psi29a commented Feb 24, 2014

With this task, we are going to do the following:

libwildmidi:

  • PCM data provided will be in the host's native Endian

wildmidi:

  • write WAV out in LE, doing the conversion if host is BE.
  • use the relevant audio function for Endian-ness

Things to keep in mind:

  • OpenAL will always expect PCM to be in the host's Endian.
  • OSS and ALSA have functions specific to Endianess.
  • This will break all applications using libwildmidi on BE systems, because of this, we are bumping the version to 0.4 (wildmidi-0.4 branch).
  • Version 0.3 (wildmidi-0.3 branch) will be put in into maintenance mode.

Further reading from previous issues:

@psi29a psi29a added this to the 0.4 - Now with more support! milestone Feb 24, 2014
@sezero
Copy link
Contributor

sezero commented Feb 24, 2014

On 2/24/14, Bret Curtis [email protected] wrote:

With this task, we are going to do the following:

libwildmidi:

  • PCM data provided will be in the host's native Endian

wildmidi:

  • write WAV out in LE, doing the conversion if host is BE.
  • use the relevant audio function for Endian-ness

Things to keep in mind:

  • OpenAL will always expect PCM to be in the host's Endian.

I have a patch for openal-player on big-endian systems: I'm waiting
for feed back from my buddy with ppc/osx.

  • OSS and ALSA have functions specific to Endianess.
  • This will break all applications using libwildmidi on BE systems, because
    of this, we are bumping the version to 0.4 (wildmidi-0.4 branch).
  • Version 0.3 (wildmidi-0.3 branch) will be put in into maintenance mode.

May I suggest that master be back merged to 0.3 branch before
moving forward in this direction?

Further reading from previous issues:

@psi29a psi29a mentioned this issue Feb 24, 2014
@psi29a
Copy link
Member Author

psi29a commented Feb 24, 2014

Yes, I was planning on doing that in a few minutes then sealing the lid on it for only updates from down-stream that we can cherry-pick back into master.

@psi29a
Copy link
Member Author

psi29a commented Feb 24, 2014

Sezero, would you mind terribly if I made you a "Wildcoder" as well? Gives you write access, so you don't have to worry about pull/merge requests. Do you have a gmail address? Feel free to bug me directly at psi29a at gmail dot com.

@sezero
Copy link
Contributor

sezero commented Feb 24, 2014

On 2/24/14, Bret Curtis [email protected] wrote:

Sezero, would you mind terribly if I made you a "Wildcoder" as well? Gives
you write access, so you don't have to worry about pull/merge requests. Do
you have a gmail address? Feel free to bug me directly at psi29a at gmail
dot com.

My thanks! My gmail address is sezeroz at gmail dot com, feel free
to drop me a note whenever you like.

@psi29a
Copy link
Member Author

psi29a commented Feb 24, 2014

Just created a mips (BE) qemu VM, I'll do a bit of testing on there. It will purely be for WAV output, but it is a begin.

@psi29a
Copy link
Member Author

psi29a commented Feb 25, 2014

I just tested master on a MIPS machine, the WAV output is 1:1 same as on my host system:
test.wav: RIFF (little-endian) data, WAVE audio, Microsoft PCM, 16 bit, setero 32072 Hz

Testing methodology:

  • Download
    ftp://ftp.sunet.se/pub/Linux/distributions/debian/dists/stable/main/installer-mips/current/images/malta/netboot/vmlinux-3.2.0-4-4kc-malta
    ftp://ftp.sunet.se/pub/Linux/distributions/debian/dists/stable/main/installer-mips/current/images/malta/netboot/initrd.gz
  • Install: qemu-system-mips -M malta -kernel vmlinux-3.2.0-4-4kc-malta -initrd initrd.gz -hda disk.img -append "console=ttyS0" -nographic
  • Boot: qemu-system-mips -M malta -kernel vmlinux-3.2.0-4-4kc-malta -hda disk.img -append "root=/dev/sda1 console=ttyS0" -nographic

@sezero
Copy link
Contributor

sezero commented Feb 25, 2014

  • wildmidi-0.3 branch: merged the openal_endian branch so that openal-player would sound correctly on big-endian systems.
  • master: push a patch as a first shot at making the library to output host-endian audio data. please test.

@psi29a
Copy link
Member Author

psi29a commented Feb 26, 2014

Great work. :)

We should also help GStreamer guys out as well:
http://cgit.freedesktop.org/gstreamer/gst-plugins-bad/tree/ext/timidity/gstwildmidi.c

This plugin is not ideal and there are bugs that are commented on, but fixed and not yet updated.
The goal here is not to break with gstreamer, so we need to fix the Endian-ness issue there as well.

@sezero
Copy link
Contributor

sezero commented Feb 26, 2014

On 2/26/14, Bret Curtis [email protected] wrote:

Great work. :)

Does your mips vm still generate identical wav? if it doesn't, that
means I messed it.

We should also help GStreamer guys out as well:
http://cgit.freedesktop.org/gstreamer/gst-plugins-bad/tree/ext/timidity/gstwildmidi.c

This plugin is not ideal and there are bugs that are commented on, but fixed
and not yet updated.
The goal here is not to break with gstreamer, so we need to fix the
Endian-ness issue there as well.

Yeah. Not very much familiar with that code, but I'll try looking at it
when we settle things at our end.

@psi29a
Copy link
Member Author

psi29a commented Feb 26, 2014

Just tested on my MIPS vm using HEAD of master: result is 1:1 as vbindiff can't find find a difference in the WAV data.
Great work!

@sezero
Copy link
Contributor

sezero commented Feb 26, 2014

On 2/26/14, Bret Curtis [email protected] wrote:

We should also help GStreamer guys out as well:
http://cgit.freedesktop.org/gstreamer/gst-plugins-bad/tree/ext/timidity/gstwildmidi.c

This plugin is not ideal and there are bugs that are commented on, but fixed
and not yet updated.
The goal here is not to break with gstreamer, so we need to fix the
Endian-ness issue there as well.

By only comparing with others, I cooked the following patch for gst
(not even compile tested, though..)

diff --git a/ext/timidity/gstwildmidi.c b/ext/timidity/gstwildmidi.c
index 24e6740..b0c7a32 100644
--- a/ext/timidity/gstwildmidi.c
+++ b/ext/timidity/gstwildmidi.c
@@ -113,7 +113,11 @@ static GstStaticPadTemplate src_factory =
GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("audio/x-raw, "
+#if defined(LIBWILDMIDI_VERSION) && (LIBWILDMIDI_VERSION+0 >= 0x000400)

  •    "endianness = (int) BYTE_ORDER, "
    
    +#else
    "format = (string) S16LE, "
    +#endif
    "rate = (int) 44100, "
    "channels = (int) 2, " "layout = (string) interleaved"));

@psi29a
Copy link
Member Author

psi29a commented Feb 27, 2014

Do we need to wait until 0.4 release? Slomo said we can push this patch on their bugzilla and someone will look at it: http://gstreamer.freedesktop.org/bugs/

Slomo also responded with this:
that patch is not 100% correct, there is no endianess field
it should be: "format = (int) " GST_AUDIO_NE(S16)
check e.g. ext/faac/gstfaac.c

@sezero
Copy link
Contributor

sezero commented Feb 27, 2014

On 2/27/14, Bret Curtis [email protected] wrote:

Do we need to wait until 0.4 release? Slomo said we can push this patch on

I guess not: they can continue testing while we prepare

their bugzilla and someone will look at it:
http://gstreamer.freedesktop.org/bugs/

Slomo also responded with this:
that patch is not 100% correct, there is no endianess field
it should be: "format = (int) " GST_AUDIO_NE(S16)
check e.g. ext/faac/gstfaac.c

If it is the correct way, then it is. As I said, I don't have a clue
about gst :)

@psi29a
Copy link
Member Author

psi29a commented Feb 27, 2014

Slomo suggests:
https://wiki.pitivi.org/wiki/GStreamer_from_Git
^-- see the bits about gst-uninstalled

alternatively just build gst-plugins-bad and install the libgstwildmidi.so to /usr/lib/x86_64-linux-gnu/gstreamer-1.0 or similar

@sezero
Copy link
Contributor

sezero commented Feb 27, 2014

On 2/27/14, Bret Curtis [email protected] wrote:

Slomo suggests:
https://wiki.pitivi.org/wiki/GStreamer_from_Git
^-- see the bits about gst-uninstalled

alternatively just build gst-plugins-bad and install the libgstwildmidi.so
to /usr/lib/x86_64-linux-gnu/gstreamer-1.0 or similar

Well, I'll leave patching of gst to Shlomi and/or other developers.
(I'd like to know about the merged solution, though.)

@sezero
Copy link
Contributor

sezero commented Mar 6, 2014

This is fixed, closing.

As for gst fixes, that library should be able adjust itself. If not, then a new issue should be opened.

@sezero sezero closed this as completed Mar 6, 2014
@sezero sezero mentioned this issue Mar 8, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants