You shouldn't have to care about filenames at all. I really urge you to
use separate mimetypes instead.

src/plugins/gme/gme_xform.cpp does this.

xmms_xform_plugin_indata_add (xf, MIMETYPE, "audio/whatever1", NULL);
xmms_magic_add("foo", "audio/whatever1", ....);
xmms_magic_extension_add("audio/whatever1", ".whatever");

xmms_xform_plugin_indata_add (xf, MIMETYPE, "audio/whatever2", NULL);
xmms_magic_add("foo", "audio/whatever2", ....);
xmms_magic_extension_add("audio/whatever2", ".whatever");

That's pretty much the way I'm doing it now, just without the magic_add (because some files don't have *anything* you could use to identify them apart from the filename.) Believe me we've tried, the AdPlug library has resorted to CRC32 checks to identify a handful of known files...

What I meant by a 'dummy filename' was to do like you suggest:

and then you can use:

xmms_stream_type_get_str (xform, XMMS_STREAM_TYPE_MIMETYPE);

to get the mimetype.

And then create a filename from that, so audio/whatever1 becomes "dummy.wa1" and audio/whatever2 becomes "dummy.wa2", which then allows the AdPlug library to get ".wa1" or ".wa2" for its handler-lookup functions. (Perhaps I should make it clear that I don't tell the AdPlug library what format the file is in, I give it the filename plus the file data and it just returns true or false if it can play the file or not.)

But as I now have the file:// URL, that gives me the file extension which is enough for AdPlug's lookup to work, so no dummy filenames required.

Cheers,
Adam.

--
_______________________________________________
Xmms2-devel mailing list
Xmms2-devel@lists.xmms.se
http://lists.xmms.se/cgi-bin/mailman/listinfo/xmms2-devel

Reply via email to