Old 27th March 2010, 21:13   #1
LOPAN
Junior Member
 
Join Date: Mar 2010
Posts: 5
in_mp3-Play() question

I don't know if Play method is common to every input plugin, but this one I'm interested in is from in_mp3 plugin. I see it receives only a (char *) as parameter (the name of the file to be played).

Suppose I have a mp3 file completely loaded into memory, and instead of a char * filename, I need to pass a memory pointer with the location of the mp3 file in memory as the parameter. Is that possible?

Thanks in advance.
LOPAN is offline   Reply With Quote
Old 27th March 2010, 21:31   #2
DrO
 
Join Date: Sep 2003
Posts: 27,873
every input plug-in which will properly play a file entered in the playlist editor will require a play(..) function.

unless you can map the memory to appear as a file which can then be loaded via CreateFile(..) then i don't think there's much which can be done (no idea if a memory mapped file would work). also for quite a while now it's a wchar_t* path which is accepted by the plug-in.

this then throws up the issue in how you're intending to pass this memory pointer (if it could be mapped & used by the plug-in) to the plug-in as the only way i can see it being viable is through hooking the play(..) function or passing things onto in_mp3's play(..) function from a custom file type handler (sort of like the in_chain example in the sdk).

-daz
DrO is offline   Reply With Quote
Old 27th March 2010, 21:59   #3
LOPAN
Junior Member
 
Join Date: Mar 2010
Posts: 5
yes, i was analysing the in_chain example. do you know of any alternative to pass a memory location to a input plugin rathen than a path? I don't know if that is possible.

thanks DrO
LOPAN is offline   Reply With Quote
Old 27th March 2010, 23:01   #4
DrO
 
Join Date: Sep 2003
Posts: 27,873
unless CreateFile() accepts a memory-mapped file which may be able to create a 'fake' file out of the memory (not something i've ever tried) i doubt it'll work as everything in the plug-ins is designed to work via CreateFile(..) with the loading of the data from the file.

this does lead to another question in why you're wanting to pass a memory copy of an mp3 (as it sounds like you're trying to do) in the first place...?

-daz
DrO is offline   Reply With Quote
Old 27th March 2010, 23:32   #5
LOPAN
Junior Member
 
Join Date: Mar 2010
Posts: 5
This memory-mapped file workaround seems a bit clumsy, but anyway I'm giving it a try as a last resort.

I've thought of a plugin that, at first would load a certain type of file into memory, then it would make some in-memory alterations to this loaded file (it's paramount that these alterations are made in-memory) and finally it would forward the result (also in-memory) to the appropriate plugin (as I've seen in the in_chain sdk example).

I see you are a mod and have been working with Winamp for at least since 2003, if you are telling the memory-mapped faking is the only solution you know of then probably there is none other. I think I'll have to discard the plugin and make my whole engine.
LOPAN is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > Winamp Development

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump