[Flac-dev] FLAC: library for C#

Pyt py.thoulon at gmail.com
Fri Jun 15 00:20:46 PDT 2007


It's not so much a matter of interface as a matter of the complex data
structures used by the library. To call a C or C++ library, you have to map
the data types used by the interface to something that .NET can manipulate,
i.e., .NET types. It is pretty easy to do for simple types or structures,
but it becomes a nightmare when you deal with nested structs and unions.

The approach you're proposing might work. I need to take a look at your
latest interface (I last tried on 1.1.3). Maybe I'll try again some day,
just subsetting the decoder and wrapping it into an API that does not expose
the complex data structure. It will probably boost my performance...

Pyt.

On 6/14/07, xflac at yahoo.com <xflac at yahoo.com> wrote:
>
> is wrapping c++ any easier?  because there is libFLAC++
>
> otherwise, if you only need a certain subset of what FLAC does
> it might be easier to write a smaller C interface + wrapper
> implementation, then import that in c#.
>
> Josh
>
> --- Pyt <py.thoulon at gmail.com> wrote:
>
> > I tried that approach a while ago and failed miserably. Marshalling
> > the
> > structs of structs in the flac lib turned out to be a nightmare (I
> > don't
> > pretend to be an expert, mind you...).
> > I eventually switched to writing my own C# lib from scratch. Work is
> > still
> > under progress. It's no rocket science, I do this a G-job. It has
> > definite
> > limitations (no documentation, decodes only 16-bit files, no encode,
> > *much*
> > slower than the flac reference implementation, but still reasonable
> > for what
> > I do), but it can read and write metadata. It still needs a bit of
> > polishing
> > (esp. the documentation to be usable), but I'd be willing to share it
> > at
> > some point. Note that it's not open source for the time being, but
> > that
> > could be considered.
> >
> > Pyt.
> >
> > PS: If anybody has a real pinvoke wrapper for the reference lib, I'd
> > gladly
> > take it... !
> >
> >
> > On 6/14/07, Jud White - jwhite at cdtag.com <+flac-
> > dev+pyt+af0255c9db.jwhite#cdtag.com at spamgourmet.com> wrote:
> > >
> > > Harry,
> > >
> > > DllImport is the way to go, but it's not always straightforward
> > what to
> > > do (callbacks, pointers, and structs can get tricky).
> > > http://pinvoke.net/ is a good resource for mapping Win32 API to C#
> > using
> > > DllImport, you may find it useful for your efforts.  I also found
> > this
> > > article helpful in context of DllImport:
> > > http://www.vsj.co.uk/articles/display.asp?id=501.
> > >
> > > I have some C# code for working with FLAC and Vorbis Comments that
> > does
> > > not use the FLAC libraries:
> > >
> > >
> >
>
> http://idsharp.svn.sourceforge.net/viewvc/idsharp/IdSharp.Tagging/trunk/Tagging/VorbisComment/Classes/
> > >
> > >
> >
>
> http://idsharp.svn.sourceforge.net/viewvc/idsharp/IdSharp.AudioInfo/trunk/Flac/
> > >
> > > taglib# also handles flac
> > >
> > > Erik de Castro Lopo wrote:
> > > > Harry Sack wrote:
> > > >
> > > >
> > > >> but aren't they C++ headers en lib's?
> > > >>
> > > >
> > > > Not C++, C.
> > > >
> > > >
> > > >> I have no idea how I can include a C++
> > > >> header in a C# project.
> > > >> It this even possible?
> > > >>
> > > >
> > > > Yes. Google for "dllimport csharp".
> > > >
> > > > Erik
> > > >
> > > _______________________________________________
> > > Flac-dev mailing list
> > > Flac-dev at xiph.org
> > > http://lists.xiph.org/mailman/listinfo/flac-dev
> > >
> > > _______________________________________________
> > Flac-dev mailing list
> > Flac-dev at xiph.org
> > http://lists.xiph.org/mailman/listinfo/flac-dev
> >
>
>
>
>
>
> ____________________________________________________________________________________
> Get the free Yahoo! toolbar and rest assured with the added security of
> spyware protection.
> http://new.toolbar.yahoo.com/toolbar/features/norton/index.php
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.xiph.org/pipermail/flac-dev/attachments/20070615/a183867b/attachment.html


More information about the Flac-dev mailing list