[Request] MediaTransferProtocol (MTP, PlaysForSure) fplugin

Discuss and announce Total Commander plugins, addons and other useful tools here, both their usage and their development.

Moderators: white, Hacker, petermad, Stefan2

Post Reply
kovacsgejza
Junior Member
Junior Member
Posts: 14
Joined: 2006-06-05, 23:22 UTC

Post by *kovacsgejza »

Too bad, doesn't seem to me that playlist management is TCMD's job. When you copy files with Explorer, does that work? The problem is that it's not a generic thing, many players don't require playlists, and many players support other file formats, like pictures, so it would be hard to determine when to use playlists.
kovacsgejza
Junior Member
Junior Member
Posts: 14
Joined: 2006-06-05, 23:22 UTC

Post by *kovacsgejza »

Sorry, I mixed something up, it doesn't show up in my player either. I'm gonna debug this even further.

But I'm still sure that it's not a playlist issue (according to the terminology of WMP)
Pathduck
Junior Member
Junior Member
Posts: 18
Joined: 2007-11-23, 19:43 UTC
Location: Oslo

Post by *Pathduck »

Hi, I just joined!
Been a LONG time TC user, not very active here :)

I bought a shiny new Creative Zen 16GB today, and went to look for a plugin to support this device, and lo and behold found this thread. How awesome is that 8)

Anyway, it seems to be working, its copying away right now, also seems much faster to browse than the default windows way.

My biggest issue if it works would be the ability to copy in the background (separate thread) and add to transfer queue (F2) just like for instance the FTP client. That way I can still use TC while I'm copying which would be neat.

Thanks for the great job, will most def check back for new versions!
kovacsgejza
Junior Member
Junior Member
Posts: 14
Joined: 2006-06-05, 23:22 UTC

Post by *kovacsgejza »

I've been trying to fill that metadata structure the entire day, without any success. I set the values, AddItem keeps returning S_OK. Before calling Insert3(), I check all the values by QueryByIndex(), and everything is there. But Insert3() just ignores everything. No metadata is set at all, just default values. And I have no idea why. I'm sure this is the reason why files don't show up in the player, it has nothing to do with playlists. Anyone any idea, how is this possible? It would be good to see the source code of an application which can transfer files without problems. I'm puzzled...
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48077
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

2kovacsgejza

Here is what I have tried. Since I don't have this problem, can you try if it helps you? This code is just for MP3 files, it sets the file type WMDM_FORMATCODE_MP3 and tries to add fake author and title tags.

Code: Select all

				hr1 = pIWMDMStorageControl->QueryInterface(IID_IWMDMStorageControl3,
					(void**)&pIWMDMStorageControl3);
				hr2 = pIStorageFile->QueryInterface(IID_IWMDMStorage3,
						(void**)&pIWMDMStorage3);
				if SUCCEEDED(hr2) {
					hr2 = pIWMDMStorage3->CreateEmptyMetadataObject(&pIWMDMMetaData);
					if (!SUCCEEDED(hr2))
						pIWMDMStorage3->Release();
					else {
						DWORD dw = WMDM_FORMATCODE_MP3;
                        pIWMDMMetaData->AddItem(WMDM_TYPE_DWORD, g_wszWMDMFormatCode, (BYTE*)&dw, sizeof(dw));
						// Create fake Author+Title fields from name in form Author - Title.mp3
                        WCHAR *p1,*p2,*p3;
						p1=wcsrchr(p,'\\');
						if (p1) p1++; else p1=p;
						p3=wcsrchr(p1,'.');   // remove extension
						if (p3)
							p3[0]=0;
						p2=wcsstr(p,L" - ");
						if (p2) {
							p2[0]=0;
							pIWMDMMetaData->AddItem(WMDM_TYPE_STRING, g_wszWMDMTitle, (BYTE *)p1,(wcslen(p1)+1)*2);
						    pIWMDMMetaData->AddItem(WMDM_TYPE_STRING, g_wszWMDMAuthor, (BYTE *)(p2+3),(wcslen(p2+3)+1)*2) ;
							p2[0]=' ';
						} else {   // just the title
							pIWMDMMetaData->AddItem(WMDM_TYPE_STRING, g_wszWMDMTitle, (BYTE *)p1, (wcslen(p1)+1)*2);
						}
						if (p3)
							p3[0]='.';
					}
				}
Author of Total Commander
https://www.ghisler.com
kovacsgejza
Junior Member
Junior Member
Posts: 14
Joined: 2006-06-05, 23:22 UTC

Post by *kovacsgejza »

I found the problem, now it's completely working!

Let's start with beta 0.4, and let's forget your last post about the metadata for now.

pIdvMgr needs to be IWMDeviceManager2 type, and query the interface IID_IWMDeviceManager2 when you initialize it. No other changes, this will compile.

Second, when you call EnumDevices, make it EnumDevices2. No other changes here either, this will work.

Now the only metadata you need to set is the formatcode. At least, for my player, no artist or title is needed, only the MP3 formatcode.

And that's all, it works for my player.

MSDN says that EnumDevices2 is recommended instead of EnumDevices, but the connection between this and the metadata? Beats me...

So, let's do this for the next version: change DeviceManager and EnumDevices to version 2, create a file extension -> formatcode mapping table for most common file formats, set the formatcode accordingly, and see if it works for others.

Setting artist, title and others might be an overkill, since TCMD is not a media player, it's a very complicated task if you want to detect all kinds of metadata in all kinds of file formats. Let's just hope it works with the formatcode only.

Seems to me that when you set the formatcode, WMDM adds every other data automatically (artist, title, bitrate, etc), except one: the last modified date. So the times don't appear in TCMD, just a blank space. Not a big problem, just looks strange. So if what I said works and you plan on adding additional metadata, I vote that the timestamp be the second.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48077
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Wow, thanks for finding out all this info! If you want, you can have a free licence of Total Commander for you or a friend, just contact me by e-mail unsing the forum mail function!

I will try what you suggest, and post the link to the new beta here soon.
Author of Total Commander
https://www.ghisler.com
kovacsgejza
Junior Member
Junior Member
Posts: 14
Joined: 2006-06-05, 23:22 UTC

Post by *kovacsgejza »

Thank you! But I will only accept it when we confirm that it's working :)
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48077
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

I have added your suggestions now:

1. IWMDeviceManager -> IWMDeviceManager2
2. EnumDevices -> EnumDevices2
3. Set format code for: aiff, wav, mp2, mp3, avi, mpg, mpeg, asf, wmv, dvr-ms, jpg, jpe, jpeg, bmp, gif, png, wma, mpl, asx, pls, m3u, ogg.

I have uploaded the new beta to the same address, you can get it here:
Windows Media Device plugin 0.5 beta
The sources

Please try it!

Currently I'm not asking the player what formats it supports, I just set the bit. If this doesn't work, I can add this check too, but some players may report invalid types...
Author of Total Commander
https://www.ghisler.com
kovacsgejza
Junior Member
Junior Member
Posts: 14
Joined: 2006-06-05, 23:22 UTC

Post by *kovacsgejza »

Now it works for me, finally I can forget about Explorer's drag-and-drop or copy-and-paste torture!
kovacsgejza
Junior Member
Junior Member
Posts: 14
Joined: 2006-06-05, 23:22 UTC

Post by *kovacsgejza »

Just noticed a bug: I get interface not released errors from line 465, while I'm browsing around directories.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48077
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Nice to hear that it works now!
I get interface not released errors from line 465
That makes little sense, the interface is requested at line 457, and released at line 465. It means that some other object has opened this interface - but I can't see any. Maybe you have an idea what could be causing this error?
Author of Total Commander
https://www.ghisler.com
kovacsgejza
Junior Member
Junior Member
Posts: 14
Joined: 2006-06-05, 23:22 UTC

Post by *kovacsgejza »

Maybe WMDM keeps it open, I see nothing wrong with the code. As long as you release what you get, you don't need that ReleaseInterfaceWarn. You write in line 486 that the object is cached, must be something similar.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48077
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Well, I didn't get this error here on Windows 2000 with my device, but I have still recompiled my source with a simple ->Release() call. Please re-download from the above links (the version remains 0.5 beta).
Author of Total Commander
https://www.ghisler.com
kovacsgejza
Junior Member
Junior Member
Posts: 14
Joined: 2006-06-05, 23:22 UTC

Post by *kovacsgejza »

It's OK now. I'm wondering what the others will say about this 0.5 version.
Post Reply