Hi Guys,

I've been using Audio::Ao (http://search.cpan.org/~dbp/Audio-Ao-0.01/Ao.pm) for some weeks and it's great.

It's an interface to the libao library (http://xiph.org/ao/)

However, until today I have only used it on Linux x64 (Fedora 14), I compiled it on i686 (Fedora 14) and it segfaults when I call the open_live() function.

I created a clean F14 VM and get the same results as the i686 machine.

The other functions/methods appear to work and return the corrected data from the library.

I do not understand C or XS and am incapable of fixing this issue myself and was hoping someone could help resolve this problem as the Author is AWAL :(

I'm pretty sure the bug is in the C/XS code:

Also: You are also supposed to be able to pass some optional parameters to the open_live function, but if you pass anything other than an empty hash ref (e.g. {}) it always segfaults :(, it would be nice to know why that does not work as it should, but that is secondary.

To clarify, this works on x64, but _not_ on i686, but in both causes it compiles fine.

The C/XS code is:

SV *open_live ( int id, int bits, int rate, int channels, int bform, void *o)
{
        ao_option *opstruct = NULL;
        ao_sample_format format;
        ao_device *device;
        SV *hval;
        HV *options;
        char **hkey;
        I32 *retlen;
        int ops = 0;
        
        if (o != NULL)
                options = (HV *) o;
        else
                options = newHV();

        hv_iterinit(options);
        while ((hval = hv_iternextsv(options, hkey, retlen)) != NULL) {
                ops = 1;
                if (ao_append_option(&opstruct, *hkey, SvPV_nolen(hval)) != 1) {
                        perror("Bad value in options hash, aborting open_live");
                        return &PL_sv_undef;
                }
        }

        format.bits = bits;
        format.rate = rate;
        format.channels = channels;
        format.byte_format = bform;

        if (ops > 0)
                device = (ao_device *) ao_open_live(id, &format, opstruct);
        else
                device = (ao_device *) ao_open_live(id, &format, NULL);

        ao_free_options(opstruct);
        
        return newSViv((IV) device);
}


NOTE: The same issue exists with the open_file() function, so I assume that is the same problem, as they are almost identical functions.

Thanks in advance

Albert

Reply via email to