shaohao
07-20-2005, 01:51 PM
Here is my idea on Read/Write tag info in plug-in.
Wish the coming new PDK will support it:
the meta data receive/send in the form of:
Key=Vaule
e.g:
Artist=k.d.lang
Title=My Okd Addiction
.
.
opGetTagHandle // Return the handle of supported tag plug-in based on a given extension
// INVALID_HANDLE_VALUE for no found
// buffer = (char *)expected extension
opGetTrackNumMetaData // Returns number of meta-data of track
// param1 = index of track, -1 for current
opGetTrackMetaData // Returns length of value of index of meta data
// buffer = (char *)meta data value (in form of key=value)
// buffer = NULL used to return length of key name
// param1 = size of buffer in bytes
// param2 = index of meta data
opSetTrackMetaData // Set meta data into track, return 0 for error, 1 for ok
// buffer = (char *)meta data value (in form of key=value)
// param1 = (char *)file name
// param2 = (HANDLE)tag plug-in to set meta data (0 for default tag plug-in)
// get all meta data of current track then save them into a certain file
HANDLE hTag = (HANDLE)QCDCallbacks.Service(opGetTagHandle, _T("mp3"), 0, 0); // get the handle of tag plug-in which support mp3 file.
if ( hTag != INVALID_HANDLE_VALUE) {
int mds = QCDCallbacks.Service(opGetTrackNumMetaData, NULL, -1, 0); // get number of current track's meta data
long ok = 1;
for ( int i = 0; i < mds && ok; i++) {
LPTSTR value = NULL:
int len = 0;
len = QCDCallbacks.Service(opGetTrackMetaData, NULL, 0, i); // get the length of meta data of index i.
if ( len > 0) {
key = new TCHAR[len+1];
ok = QCDCallbacks.Service(opGetTrackMetaData, value, len+1, i); // get meta data of index i.
}
if ( ok)
ok = QCDCallbacks.Service(opSetMetaData, (void *)value, (long)filetosave, (long)hTag);
}
}
Maybe opGetTrackMetaDataKey, opGetTrackMetaDataValue, opSetTrackMetaDataKey, opSetTrackMetaDataValue will be useful.
If the new PDK will support above, it will be very easy for developer to trans-save tag info when writing a encoder plug-in.
Wish the coming new PDK will support it:
the meta data receive/send in the form of:
Key=Vaule
e.g:
Artist=k.d.lang
Title=My Okd Addiction
.
.
opGetTagHandle // Return the handle of supported tag plug-in based on a given extension
// INVALID_HANDLE_VALUE for no found
// buffer = (char *)expected extension
opGetTrackNumMetaData // Returns number of meta-data of track
// param1 = index of track, -1 for current
opGetTrackMetaData // Returns length of value of index of meta data
// buffer = (char *)meta data value (in form of key=value)
// buffer = NULL used to return length of key name
// param1 = size of buffer in bytes
// param2 = index of meta data
opSetTrackMetaData // Set meta data into track, return 0 for error, 1 for ok
// buffer = (char *)meta data value (in form of key=value)
// param1 = (char *)file name
// param2 = (HANDLE)tag plug-in to set meta data (0 for default tag plug-in)
// get all meta data of current track then save them into a certain file
HANDLE hTag = (HANDLE)QCDCallbacks.Service(opGetTagHandle, _T("mp3"), 0, 0); // get the handle of tag plug-in which support mp3 file.
if ( hTag != INVALID_HANDLE_VALUE) {
int mds = QCDCallbacks.Service(opGetTrackNumMetaData, NULL, -1, 0); // get number of current track's meta data
long ok = 1;
for ( int i = 0; i < mds && ok; i++) {
LPTSTR value = NULL:
int len = 0;
len = QCDCallbacks.Service(opGetTrackMetaData, NULL, 0, i); // get the length of meta data of index i.
if ( len > 0) {
key = new TCHAR[len+1];
ok = QCDCallbacks.Service(opGetTrackMetaData, value, len+1, i); // get meta data of index i.
}
if ( ok)
ok = QCDCallbacks.Service(opSetMetaData, (void *)value, (long)filetosave, (long)hTag);
}
}
Maybe opGetTrackMetaDataKey, opGetTrackMetaDataValue, opSetTrackMetaDataKey, opSetTrackMetaDataValue will be useful.
If the new PDK will support above, it will be very easy for developer to trans-save tag info when writing a encoder plug-in.