m4a issues
Kyle
gonemad at gmail.com
Sun Jun 19 01:33:51 CEST 2011
the m4a tags reading improperly was caused by a very similar issue...
wstring < operator doesnt work correctly and that is used by the map class.
bool String::operator<(const String &s) const
{
#ifndef __ANDROID__
//ORIGINAL TAGLIB CODE
return d->data < s.d->data;
#else
//STLPORT wstring < operator is broken so do the string comparison
const wchar_t* a = d->data.data();
const wchar_t* b = s.d->data.data();
while(*a && *b)
{
if(*a < *b)
return true;
else if(*a > *b)
return false;
a++;
b++;
}
//one of the strings ended
return *a < *b;
#endif
}
On Sat, Jun 18, 2011 at 6:51 PM, Kyle <gonemad at gmail.com> wrote:
> it appears wstring doesnt work very well on the android. the compare
> function returns true because it only scans the first letter
>
> my workaround
>
> bool String::operator==(const String &s) const
>
> {
> #ifndef __ANDROID__
> //ORIGINAL TAGLIB CODE
> return d == s.d || d->data == s.d->data;
> #else
> //STLPORT wstring == operator is broken so do the string comparison
> bool equal = true;
> if (d != s.d)
> {
> if (d->data.size() == s.d->data.size())
> {
> const wchar_t* a = d->data.data();
> const wchar_t* b = s.d->data.data();
>
> equal = (memcmp(a, b, d->data.size() * sizeof(wchar_t)) == 0);
> }
> else
> equal = false;
> }
> return equal;
> #endif
> }
>
> so that fixes half of my problem.. now to find out why the tags don't read
> in properly
>
>
> On Sat, Jun 18, 2011 at 3:51 PM, Kyle <gonemad at gmail.com> wrote:
>
>> After loading up the code with trace statements I discovered why the
>> fileref was not returning anything for the tags
>>
>> in fileref::create
>>
>> if(pos != -1) {
>> String ext = s.substr(pos + 1).upper();
>>
>> ext is "M4A" but when it hits the first if statement.. it passes
>>
>> if(ext == "MP3")
>> return new MPEG::File(fileName, readAudioProperties,
>> audioPropertiesStyle);
>>
>> so an MPEG::File is created instead.. something must be wrong with the
>> file comparison operator on the android.... my guess is it has something to
>> do with the number.. ogg and flac work correctly.... mp3 is supposed to pass
>> taht first if statement anyway so that works correctly as well.. i'll post
>> if i find out anything else
>>
>> 2011/6/14 Lukáš Lalinský <lalinsky at gmail.com>
>>
>>> On Tue, Jun 14, 2011 at 1:13 AM, Kyle <gonemad at gmail.com> wrote:
>>> > however my issue is on the android os. I took the code from the sample
>>> and
>>> > put it into mine.. only changing the way of output (android log instead
>>> of
>>> > cout) and the result is all blacks
>>> >
>>> > 06-13 22:58:34.975: INFO/NDK(4986): ********************
>>> > 06-13 22:58:34.975: INFO/NDK(4986): /mnt/sdcard/aac-test.m4a
>>> > 06-13 22:58:34.975: INFO/NDK(4986): ********************
>>> > 06-13 22:58:35.155: INFO/NDK(4986): -- TAG --
>>> > 06-13 22:58:35.155: INFO/NDK(4986): title -
>>> > 06-13 22:58:35.155: INFO/NDK(4986): artist -
>>> > 06-13 22:58:35.155: INFO/NDK(4986): album -
>>> > 06-13 22:58:35.165: INFO/NDK(4986): comment -
>>> > 06-13 22:58:35.165: INFO/NDK(4986): genre -
>>> > 06-13 22:58:35.165: INFO/NDK(4986): -- AUDIO --
>>> >
>>> > Using an mp4file instead of fileref i get this
>>> >
>>> > 06-13 23:12:02.844: INFO/NDK(5340): ********************
>>> > 06-13 23:12:02.844: INFO/NDK(5340): /mnt/sdcard/aac-test.m4a
>>> > 06-13 23:12:02.844: INFO/NDK(5340): ********************
>>> > 06-13 23:12:02.934: INFO/NDK(5340): -- TAG --
>>> > 06-13 23:12:02.945: INFO/NDK(5340): title -
>>> > 06-13 23:12:02.945: INFO/NDK(5340): 2011-03-25T07:00:00Z
>>> > 06-13 23:12:02.945: INFO/NDK(5340): artist -
>>> > 06-13 23:12:02.945: INFO/NDK(5340): 2011-03-25T07:00:00Z
>>> > 06-13 23:12:02.945: INFO/NDK(5340): album -
>>> > 06-13 23:12:02.954: INFO/NDK(5340): 2011-03-25T07:00:00Z
>>> > 06-13 23:12:02.954: INFO/NDK(5340): comment -
>>> > 06-13 23:12:02.954: INFO/NDK(5340): 2011-03-25T07:00:00Z
>>> > 06-13 23:12:02.954: INFO/NDK(5340): genre -
>>> > 06-13 23:12:02.954: INFO/NDK(5340): 2011-03-25T07:00:00Z
>>> > 06-13 23:12:02.954: INFO/NDK(5340): -- AUDIO --
>>>
>>> This looks like it's failing to load the file, then you are ignoring
>>> some check and then it's trying to print uninitialized strings. I
>>> don't know what would be wrong, you will probably have to do some
>>> debugging to see at which point it decides that it doesn't know about
>>> the file format.
>>>
>>> Lukas
>>> _______________________________________________
>>> taglib-devel mailing list
>>> taglib-devel at kde.org
>>> https://mail.kde.org/mailman/listinfo/taglib-devel
>>>
>>
>>
>>
>> --
>> -Kyle
>>
>
>
>
> --
> -Kyle
>
--
-Kyle
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.kde.org/pipermail/taglib-devel/attachments/20110618/9154d0a3/attachment-0001.htm
More information about the taglib-devel
mailing list