Namespace: Un4seen.Bass.AddOn.Wma
Assembly: Bass.Net (in Bass.Net.dll) Version: 2.4.17.5
[DllImportAttribute("basswma")] public static bool BASS_WMA_EncodeSetTag( int handle, IntPtr tag, IntPtr value, BASSWMATag type )
Parameters
- handle
- Type: SystemInt32
The encoder handle. - tag
- Type: SystemIntPtr
The pointer to the tag to set. - value
- Type: SystemIntPtr
The pointer to the tag's text/data. - type
- Type: Un4seen.Bass.AddOn.WmaBASSWMATag
The format of the tag and value strings. One of the following (see BASSWMATag):BASS_WMA_TAG_ANSI ANSI strings. BASS_WMA_TAG_UNICODE Unicode (UTF-16) strings. BASS_WMA_TAG_UTF8 UTF-8 strings. BASS_WMA_TAG_BINARY value contains binary data rather than text. The length of the data is in the HIWORD.
Return Value
Type: BooleanIf succesful, is returned, else is returned. Use BASS_ErrorGetCode to get the error code.
Header tags must be set before encoding any data - no more header tags can be set once BASS_WMA_EncodeWrite(Int32, IntPtr, Int32) has been called.
To set tags mid-stream (after encoding has begun), the BASS_WMA_ENCODE_SCRIPT flag needs to have been specified in the encoder's creation. A mid-stream tag typically used is "Caption", which get's displayed in Windows Media Player 9 and above (if the user has enabled captions).
When using a network encoder, it should be noted that while all header tags are sent to newly connecting clients, prior mid-stream tags are not. So if, for example, you're using the "Caption" tag to indicate the current song title, it should be sent at fairly regular intervals (not only at the start of the song).
On the playback side, mid-stream tags can be processed using BASS_ChannelSetSync(Int32, BASSSync, Int64, SYNCPROC, IntPtr) (with BASS_TAG_WMA_META).
ERROR CODE | Description |
---|---|
BASS_ERROR_HANDLE | handle is not valid. |
BASS_ERROR_NOTAVAIL | The encoder does not have mid-stream tags enabled, so tags can not be set once encoding has begun. |
BASS_ERROR_ILLPARAM | tag and/or value is invalid. |
BASS_ERROR_UNKNOWN | Some other mystery problem! |
int encoder = BassWma.BASS_WMA_EncodeOpenFile(44100, 2, BASSWMAEncode.BASS_WMA_ENCODE_DEFAULT, 128000, "out.wma"); // set the title tag BassWma.BASS_WMA_EncodeSetTag(encoder, "Title", "Something", BASSWMATag.BASS_WMA_TAG_UNICODE);