BASS_WMA_EncodeSetTag

Sets a tag in a WMA encoding.

BOOL BASS_WMA_EncodeSetTag(
    HWMENCODE handle,
    char *tag,
    char *value,
    DWORD form
);

Parameters

handleThe encoder handle.
tagThe tag to set.The standard WMA header tags are as follows.
TitleContent title.
AuthorName of the content author.
DescriptionDescription of the content.
RatingContent rating.
CopyrightContent copyright message.
WM/AlbumTitleAlbum title.
WM/PromotionURLURL to an HTML page containing related information.
WM/AlbumCoverURLURL to an HTML page containing an image of the album cover.
WM/GenreGenre of the music.
WM/YearYear of publication of the music.
valueThe tag's text/data.
formThe format of the tag and value strings.
BASS_WMA_TAG_ANSIANSI strings.
BASS_WMA_TAG_UNICODEUTF-16 strings.
BASS_WMA_TAG_UTF8UTF-8 strings.
BASS_WMA_TAG_BINARYvalue contains binary data rather than text. The length of the data is in the HIWORD.

Return value

If successful, TRUE is returned, else FALSE is returned. Use BASS_ErrorGetCode to get the error code.

Error codes

BASS_ERROR_HANDLEhandle is not valid.
BASS_ERROR_NOTAVAILThe encoder does not have mid-stream tags enabled, so tags cannot be set once encoding has begun.
BASS_ERROR_ILLPARAMtag and/or value is invalid.
BASS_ERROR_UNKNOWNSome other mystery problem!

Remarks

Where the tags are located in the encoded stream depends on when this function is used. Calling this function before beginning encoding data puts the tags in the stream's header. Calling this function after encoding has begun puts the tags in the actual stream data, at the current encoding position.

Header tags must be set before encoding any data; no more header tags can be set once BASS_WMA_EncodeWrite 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 (BASS_SYNC_META).

Example

Initialize encoding 44100hz 16-bit stereo sample data at 128kb/s to a file called "blah.wma", and set the title to "Blah".
HWMENCODE encoder=BASS_WMA_EncodeOpenFile(44100, 2, 0, 128000, "blah.wma");
BASS_WMA_EncodeSetTag(encoder, "Title", "Blah", BASS_WMA_TAG_ANSI); // set the title tag

See also

BASS_WMA_EncodeOpen, BASS_WMA_EncodeOpenFile, BASS_WMA_EncodeOpenNetwork