Odd results from taglib_tag_comment
Andrew Krage
null.public at gmail.com
Thu Dec 10 23:09:31 CET 2009
I am trying to get the comment from MP3s using taglib_tag_comment "tag_c.h". Everything works fine if there is a comment in the MP3 but if the comment field is empty I get the results from the OUTPUT section below.
I have included the relevant code, basically a stripped down tagreader_c.c found in examples. I would expect that instead of the values I am getting I would be getting the empty string, or maybe NULL, but that does not seem to be the case. taglib_tag_album, taglib_tag_artist etc. all seem to be working properly and return an empty string if there is nothing there.
I have looked at the documentation online and it seems that the C++ version of this function returns String::NULL, so perhaps that has something to do with what is going on? I am not an expert at C++ and I am having difficulty figuring out what is going on.
If someone could explain what is going on, or tell me what I am doing wrong I would appreciate it.
Thank you,
- Andrew
CODE
function() {
taglib_set_strings_unicode(TRUE);
taglib_id3v2_set_default_text_encoding(TagLib_ID3v2_UTF8);
TagLib_File *file = taglib_file_new(filename);
if(file != NULL) {
TagLib_Tag *tag = taglib_file_tag(file);
properties = taglib_file_audioproperties(file);
printf("comment: %s\n", taglib_tag_comment(tag));
taglib_tag_free_strings();
taglib_file_free(file);
}
}
OUTPUT (from calling the function on 11 different MP3s)
comment: 00000E3A 00000EB1 00007652 00007670 0000EA77 0000EA77 00008000 00008000 00009C57 00009C57
comment: 00000CCC 00000E49 0000427B 000044EC 0001ADC7 0001ADC7 00008000 00008000 00009C40 00009C40
comment: 00001E5A 00001F37 00009A90 00009DDB 00030D57 00030D57 00008000 00008000 00007530 00007530
comment: 00001589 0000154B 00009065 00009233 0000EA77 0000EA77 00008000 00008000 00009C40 00009C40
comment: 000013E8 00001503 0000911B 000089A7 0002BF37 0002BF37 00008000 00008000 0000EA77 0000EA77
comment: 00001227 0000129E 0000520A 00005418 0000EA77 0002E647 00008000 00008000 00007530 0000C367
comment: 0000078D 000008CE 000055D5 00005136 0000C350 0000C350 00008000 00008000 0000C350 0000C350
comment: 000010FA 00001086 000093F3 0000A3C0 00027117 00027117 00008000 00008000 00009C57 00009C57
comment: 00001500 00001769 0000C21D 0000CCFC 00027117 00027117 00008000 00008000 00011170 00011170
comment: 00000027 00000026 0000005F 00000062 0001ADDE 0001ADDE 00001F8E 00002007 0001ADC7 0001ADC7
comment: 00001680 00001494 000098EF 000092C1 00013897 00013897 00008000 00008000 00002727 00002727
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.kde.org/pipermail/taglib-devel/attachments/20091210/380228d7/attachment.htm
More information about the taglib-devel
mailing list