WMPTSE API: Difference between revisions

From Hydrogenaudio Knowledgebase
Line 62: Line 62:
On load, [[WMPTSE]] browse the '''HKEY_LOCAL_MACHINE\SOFTWARE\piPOol\WMPTSE''' registry key.
On load, [[WMPTSE]] browse the '''HKEY_LOCAL_MACHINE\SOFTWARE\piPOol\WMPTSE''' registry key.


Each subkey it finds will be consider a tag format definition.
Each subkey it finds will be consider a <font style="color:green"><TagFormat></font> definition.


Inside each subkey (or tag format definition), WMPTSE browse for file type support.
Inside each subkey (or <font style="color:green"><TagFormat></font> definition), WMPTSE browse for file type support.


For each string key it finds, it loads the corresponding "tag support dll" and try to get the '''Read<TagFormat>Tag''' and '''Write<TagFormat>Tag'''.
Each string in '''HKEY_LOCAL_MACHINE\SOFTWARE\piPOol\WMPTSE\<font style="color:green"><TagFormat></font>''' describe the file type to support (registry string name) and the path to the "tag support dll" to load.


If one
After reading all file types definitions, [[WMPTSE]] loads each "tag support dll" and try to get the '''Read<font style="color:green"><TagFormat></font>Tag''' and '''Write<font style="color:green"><TagFormat></font>Tag'''.
 
If one of those two function doesn't exist, the dll is considered non-WMPTSE API compatible and unloaded.
It those two function exist, the dll is registered as a "tag support dll" for the file type

Revision as of 12:26, 9 November 2006

The WMPTSE API is the interface between the WMPTSE plug-in and its "tag support dll".

A tag support dll give WMPTSE the ability to add support of a tag format in Windows Media Player. With the this "tag support dll" properly installed, files tagged with its format are readable inside WMP.


API

Every WMPTSE API application must export two function (c standard call):

BOOL Read<TagFormat>Tag( LPTSTR lpstrFileFullPath, METATAG * pMetaTag )

BOOL Write<TagFormat>Tag( LPTSTR lpstrFileFullPath, TAGITEM tagiChangedItem )

<TagFormat> will be the name of the corresponding tag format (APE, Vorbis, MPEG4). It will be search by WMPTSE during the load process.


The boolean return value is important.

For the read function, it tells WMPTSE if the "tag support dll" has find the correct tag format structures (even if they are empty). If the value is TRUE, WMPTSE will stop searching for compatible tag format for this file (yes, a file can be multi-tagged). If the value is FALSE, WMPTSE will continue searching in its compatible tag format list.

For the write function, it tells WMPTSE if the "tag support dll" has correctly write the new value. If this is true, WMPTSE will continue using this "tag support dll" with its filetype. If this value is false, WMPTSE may unload the "tag support dll".


These interface are defined as FP_TAGREAD (read), FP_TAGWRITE (write) in "WMPTSE.h"


Definition

Note : All types and definition are declared in WMPTSE.h. It is simple for developper to include it at first.

For reading purpose, we will expose the necessary structure definition here.

struct stTagItem											
{
	char *	MetaTagWMPKey;	/** the MediaLibrary attribute's name */
	LPTSTR	MetaTagValue;	/** the value to set */
};
#define TAGITEM struct stTagItem		
typedef struct stTagItem * LPTAGITEM;				
struct stMetaTag
{
	UINT	uiNbItems;	/** number of list tags */
	LPTAGITEM tagiItems;	/** pointer to array of pointer to tag items */
};
#define METATAG struct stMetaTag
typedef struct stMetaTag * LPMETATAG;


Installation

To be effective, a "tag support dll" must be correctly installed in WMPTSE.

You have two choice to install a "tag support dll" :


Note : In this guide, we will not expose the registry editing for complete file type support in Windows (MIME Types, Media Library Support, etc...). Please refer to Microsoft Windows Media Player documentation for this.


On load, WMPTSE browse the HKEY_LOCAL_MACHINE\SOFTWARE\piPOol\WMPTSE registry key.

Each subkey it finds will be consider a <TagFormat> definition.

Inside each subkey (or <TagFormat> definition), WMPTSE browse for file type support.

Each string in HKEY_LOCAL_MACHINE\SOFTWARE\piPOol\WMPTSE\<TagFormat> describe the file type to support (registry string name) and the path to the "tag support dll" to load.

After reading all file types definitions, WMPTSE loads each "tag support dll" and try to get the Read<TagFormat>Tag and Write<TagFormat>Tag.

If one of those two function doesn't exist, the dll is considered non-WMPTSE API compatible and unloaded. It those two function exist, the dll is registered as a "tag support dll" for the file type