Adam Nielsen wrote:
Hi all,

I'm working on an input plugin for XMMS2 to allow playback of AdPlug supported files, and it's pretty much working except for one thing.

AdPlug supports a whole bunch of different files, and for a lot of them it uses the file extension to figure out which format a song is. This means I need to pass it a filename, even though it never tries to open that file.

However I can't see how to retrieve the filename of the file I'm trying to play. I thought getting the URL from the medialib might yield a file:// URL for local files (which would be fine, all AdPlug needs is the extension) but it seems the URL field is blank for local files.

Is there any other way I can get hold of the filename? The only other workaround I can think of is to get the MIME type and create a dummy filename with the appropriate extension.

I'm sure you already have solved this. I just wanted to make sure this is in the mail archive.

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");


and then you can use:

xmms_stream_type_get_str (xform, XMMS_STREAM_TYPE_MIMETYPE);

to get the mimetype.

 anders

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

Reply via email to