Author Topic: Tags Library  (Read 62566 times)

frytech

  • Posts: 11
Re: NEW: Tags Library
« Reply #350 on: 3 Sep '15 - 00:16 »
Yes, that's the way it should work. But if you have any issues with it please post it!

ID3v1 must be at the file end, the library won't read it if it is at the beginning. If the file starts with 'ID3' then that's an ID3v2 tag.

EDIT: The package has been updated with the fix for the "if no ID3v2 in the file but there is ID3v1 no ID3v2 will be written".
Please download (link) in the first post.

I will get the new package as soon as I finish here, but I found another error for you.

I have several MP3 files that have an empty ID3v2 tag, (I don't know what they were encoded with) the first 4 characters are TAG + chr(04) and there are no markers for any of the fields ... TSSE TIT2 etc.  The music data follows within 30 characters.  If I attempt to load these files as ID3v1 I get an overflow error in the VB6 class module.

ID3TagV2.Load FilePath, ttID3v1 >>>  Load = TagsLibrary_Load(LngTags, StrPtr(filename), TagType, True) >>> Runtime Error (6) Overflow

I have commented out all of the ID3v1 code, modified the tag and saved in ttAutomatic and it reads and writes correctly under ttAutomatic.  If I read it back as ID3v2 I get all nulls, if I read it back as ID3v1 I again get an overflow error.  

I have a page that displays the results of all three reads which I have been commenting and uncommenting.  I hope I have been clear in my explanation.

EDIT: I forgot to mention, when I saved in ttautomatic, no ID3v1 tag was written to the file.  I am assuming this is normal behavior.  Also, thanks for your response  :)
« Last Edit: 3 Sep '15 - 00:22 by frytech »

frytech

  • Posts: 11
Re: NEW: Tags Library
« Reply #351 on: 3 Sep '15 - 10:08 »
With regards to the BASS library, something that would be very helpful would be one more data type under BASS_ChannelIsActive to include BASS_ACTIVE_COMPLETE to indicate that playback has completed rather than simply stopped. 

I have two active playback channels that require a small amount of overlap. I have to test whether I have clicked the stop button, or it's stopped because it hasn't yet been started. 

Regards,
Frytech

3delite

  • Posts: 895
Re: NEW: Tags Library
« Reply #352 on: 3 Sep '15 - 14:04 »
Could you please give a link to one of that file (before using the save function on it) so I can check?
Also you can send it to 3delite@3delite.hu if that's more appropriate.

Thank you!

Glenn9999

  • Posts: 46
Re: NEW: Tags Library
« Reply #353 on: 3 Sep '15 - 19:18 »
With regards to the BASS library, something that would be very helpful would be one more data type under BASS_ChannelIsActive to include BASS_ACTIVE_COMPLETE to indicate that playback has completed rather than simply stopped.

The functionality is there.

Code: [Select]
// to enable, where SyncHandle1 is a 4-byte THandle type.  (for example),
// where Channel is a valid channel handle.
SyncHandle1 := BASS_ChannelSetSync(Channel, BASS_SYNC_END, 0, @EndSongProc, nil);

// where EndSongProc looks like this and is called when a song completes on its own
procedure EndSongProc(handle: HSYNC; channel, data: DWord; user: Pointer); stdcall;

// and when done, call this.
BASS_ChannelRemoveSync(Channel, SyncHandle1);
« Last Edit: 3 Sep '15 - 19:23 by Glenn9999 »

frytech

  • Posts: 11
Re: NEW: Tags Library
« Reply #354 on: 3 Sep '15 - 23:43 »
With regards to the BASS library, something that would be very helpful would be one more data type under BASS_ChannelIsActive to include BASS_ACTIVE_COMPLETE to indicate that playback has completed rather than simply stopped.

The functionality is there.

Code: [Select]
// to enable, where SyncHandle1 is a 4-byte THandle type.  (for example),
// where Channel is a valid channel handle.
SyncHandle1 := BASS_ChannelSetSync(Channel, BASS_SYNC_END, 0, @EndSongProc, nil);

// where EndSongProc looks like this and is called when a song completes on its own
procedure EndSongProc(handle: HSYNC; channel, data: DWord; user: Pointer); stdcall;

// and when done, call this.
BASS_ChannelRemoveSync(Channel, SyncHandle1);

Thank you Glenn9999 for your reply.  I didn't realize I was still under this subject line when I posted and don't want to go off topic.  I will end this thread here and repost under a new subject line.

Moderator, feel free to delete this post.

3delite

  • Posts: 895
Re: NEW: Tags Library
« Reply #355 on: 12 Oct '15 - 16:49 »
Update 1.0.47.85 is available, updates since last post:

  • Fixed APE tags, on tag value convert error frame is reported as binary
  • Fixed FLAC tags writing padding bytes slow-down
  • Fixed MP4 tags writing padding bytes slow-down
  • Fixed writing WMA tags, multiple same field name values
  • Fixed array overrun bug when loading tags in some cases
  • Fixed range check errors for ID3v2

Download link in the first post.

Steve Grant

  • Posts: 136
Re: NEW: Tags Library
« Reply #356 on: 6 Mar '16 - 08:29 »
Hi 3deLite,

Is it possible to get a faster function to just tell me if a picture is present in a file?

At the moment I use this

Code: [Select]
Public Function HasPicture(Filename As String) As Boolean
    Dim PTags As Long
    PTags = TagsLibrary_Create
    TagsLibrary_Load PTags, StrPtr(Filename), ttAutomatic, False
    HasPicture = (TagsLibrary_CoverArtCount(PTags, ttAutomatic) <> 0)
    TagsLibrary_Free PTags
End Function

I don't need to know anything about the picture, just if there is one. When looping through a few hundred files it is quite slow.

Many thanks - Steve.

Guest

  • Guest
Re: NEW: Tags Library
« Reply #357 on: 6 Mar '16 - 13:22 »
why your create TagsLibrary on every call and then destroy it ?

create TagsLibrary on first application create and destroy it after application Close.
same as Bass

call only
Code: [Select]
    TagsLibrary_Load PTags, StrPtr(Filename), ttAutomatic, False
    HasPicture = (TagsLibrary_CoverArtCount(PTags, ttAutomatic) <> 0)

in HasPicture
should Speed up your check for Picture in the tag.

Steve Grant

  • Posts: 136
Re: NEW: Tags Library
« Reply #358 on: 6 Mar '16 - 21:17 »
Hi Guest and thank you for your comment. Surprisingly it makes hardly any difference to the speed if the library is released or not.

313 tracks took 10.65 secs my way and 10.59 secs by keeping the library open. This is with a reboot between tests so that the cache did not interfere with the results.

If it possible I would like a function that is considerably faster.

Steve.

Steve Grant

  • Posts: 136
Re: NEW: Tags Library
« Reply #359 on: 6 Mar '16 - 22:18 »
Ok I've found a different way to achieve what I need. So I don't need anything - thank you.

3delite

  • Posts: 895
Re: NEW: Tags Library
« Reply #360 on: 7 Mar '16 - 00:54 »
The library is not optimized for just getting the cover art count. When TagsLibrary_Load() is called all tags are parsed, if you use ttAutomatic then file's tags are loaded in the particular tag class, for example in ID3v2 tag class, then all tags are parsed into the global tag class.

What can be done to speed things up:

If you need a particular tag use that option for example for ID3v2, always use 'ttID3v2'.

Disable all audio attributes parsing before creating a tags instance:

TagsLibrary_SetConfig(nil, 0, TAGSLIBRARY_PARSE_OGG_PLAYTIME, ttAutomatic);
TagsLibrary_SetConfig(nil, 0, TAGSLIBRARY_PARSE_ID3v2_AUDIO_ATTRIBUTES, ttAutomatic);
TagsLibrary_SetConfig(nil, 0, TAGSLIBRARY_PARSE_WAVPACK_AUDIO_ATTRIBUTES, ttAutomatic);
TagsLibrary_SetConfig(nil, 0, TAGSLIBRARY_PARSE_MUSEPACK_AUDIO_ATTRIBUTES, ttAutomatic);
TagsLibrary_SetConfig(nil, 0, TAGSLIBRARY_DEEP_OPUS_BITRATE_SCAN, ttAutomatic);

Use multi-threading, in case of a 4 core CPU this might give 2x 3x speed-up.

BTW 30 files per second, that's not that bad.

Steve Grant

  • Posts: 136
Re: NEW: Tags Library
« Reply #361 on: 7 Mar '16 - 10:20 »
Many thanks for the detailed reply. Sadly the other method I found is not reliable, so I am back using my main Tags library. At least it is completely reliable.

I will try your suggestion of just calling the format I need to check. Under VB6 I cannot use multi-threading without creating external dependencies.


BaseHead

  • Posts: 136
Re: NEW: Tags Library
« Reply #362 on: 23 Jun '16 - 11:02 »
Hey...does this work with OSX desktop programs using Objective-C?
can't find examples of that anywhere.

thx!

Steve

3delite

  • Posts: 895
Re: NEW: Tags Library
« Reply #363 on: 23 Jun '16 - 15:24 »
It should, not tested yet though. There's an OSX32 dylib in the '\Bin\OSX32\' folder ('libTagsLib.dylib').
And there's an API for C++ in the '\C++\' folder ('TagsLibraryDefs.h').

BaseHead

  • Posts: 136
Re: NEW: Tags Library
« Reply #364 on: 23 Jun '16 - 19:11 »
Ok...I'll put my guy on the case to check it out tomorrow.
hopefully better then the library we are using now....too many memory crashes with the current one we are using...8(

since this in a OSX32 folder can we expect a OSX64 in the future?
We will need that come the 1st of the year probably.

thx man!

BaseHead

  • Posts: 136
Re: NEW: Tags Library
« Reply #365 on: 24 Jun '16 - 14:05 »
Hey...
we checked it out for a minute and found a few issues with the Example Programs included in the packages.
We haven't dove into the .dylib or dll's just yet


1. None of the EXE's worked in Windows TagLib package we tried on Win10.  Double click them an they never appeared on screen, But the similar ones in the ID3v2 package seemed to work.

2. The OSX ID3v2TutorialFM freezes every time you just try to open a file.

3. The Win64 EXE example works better but when try to write to a WAV file with ID3v1 tags first I only see a "TAG1" chunk created (that seem odd in the first place) and if I try to Save v2 Tags after in a WAV file after it gives me an error.

4. Same for the other direction if I write a v2 Tag first I see a more correct  "id3" chunk now in the WAV file and no error, but then try and write the v1 tag 2nd I get an error also.
So seems like I can only write one or the other with WAV files in the demo programs.

5. Your WAV Tag Library Example EXE only seems to write LIST chunk.  I was expecting to see all the chunks supported like BEXT also to appear.  Just mentioning that in case you didn't know....8)

We are gonna make our own test program with the .dylib this weekend. 
Will let you know how that goes...8)

Steve

3delite

  • Posts: 895
Re: NEW: Tags Library
« Reply #366 on: 24 Jun '16 - 17:54 »
Ok, please try the dylib version.

1.) The C++ example 'contest.exe' is a console application, run it as: 'contest "C:\Song.mp3"' - this should list the Song.mp3's tags.

2.) I'll check it, although it's not relevant for you it's a Delphi example (it does not use the dylib but the native Delphi units built in the executable).

3.) ID3v1 is not supported for WAV files, the library only writes ID3v2, LIST, CART and BEXT tags for WAV files. Didn't hear about WAV files with ID3v1 till now, if you save an ID3v1 for any file it will be just appended at the end (not in a chunk in case of WAV files).

4.) See 3.

5.) Yes the tutorial only lists the LIST tags, internally the CART and BEXT tags are loaded too, and can be accessed by code if needed.

Regarding OSX64: right now Delphi can only build OSX32 code, in the future OSX64 support will possibly be added to Delphi, then there will possibly be a OSX64 version of the dylib too.
« Last Edit: 24 Jun '16 - 18:08 by 3delite »

3delite

  • Posts: 895
Re: NEW: Tags Library
« Reply #367 on: 23 Nov '16 - 22:31 »
New version updates:
  • Fixed WMA tag loading exception when TRACKNUMBER is not an integer
  • MP4: fixed double parsing in GetTrack() and GetDisc()
  • MP4: fixed SetGenre() when switching atom
  • MP4: renamed functions that deal with multiple atoms
  • MP4: fixed parsing audio (now video width/height too) attributes when audio track is not the first track
  • MP4: added audio track attribute support of ALAC and AC3 format
Download link in the first post.

udo

  • Posts: 29
Re: NEW: Tags Library
« Reply #368 on: 18 Feb '17 - 17:46 »
Hi 3deLite,
i tried your C# sample but i always get an System.BadImageFormatException (wrong Fileformat) at
Code: [Select]
AudioFileFormat = TagsLib.TagsLibrary_GetAudioFormat(txtFilename.Text); It seems to happen at any Format. I had dsf, wav, m4a.
What can be the reason?
The Delphi-Sample works fine.

Edit: Its OK, the Exception was confusing. I had the wrong TagsLib.dll(x64).  ::)
« Last Edit: 18 Feb '17 - 18:11 by udo »

udo

  • Posts: 29
Re: NEW: Tags Library
« Reply #369 on: 20 Feb '17 - 12:54 »
Hi 3deLite,
there are some problems with C# and WAV:
- CoverartCount returns 0(although there is one):
Code: [Select]
TagsLib.TagsLibrary_CoverArtCount(Tags, TTagType.ttAutomatic)If i set a cover image i get an TAGSLIBRARY_ERROR_CORRUPT at save.
Code: [Select]
TagsError = TagsLib.TagsLibrary_Save(Tags, (txtFilename.Text), TTagType.ttAutomatic);
- The Tags ARTIST, TITLE, ALBUM are always empty.

The only example that shows everything right is at Delphi/TagsLibraryTutorialBASS


EWeiss

  • Posts: 342
Re: NEW: Tags Library
« Reply #370 on: 20 Feb '17 - 13:09 »
i have written the Library for *.NET and WAV works great here..

greets
« Last Edit: 20 Feb '17 - 14:01 by EWeiss »

udo

  • Posts: 29
Re: NEW: Tags Library
« Reply #371 on: 20 Feb '17 - 13:23 »
Hi EWeiss,
hmm, strange. Could you please check this WAV: http://www.udoassmus.bplaced.net/01.zip?

I used the Tags Library 1.0.56.96(zip) and copied the TagsLib.dll to the \.NET\Tutorial\C#\bin folder as only modification.
« Last Edit: 20 Feb '17 - 13:35 by udo »

EWeiss

  • Posts: 342
Re: NEW: Tags Library
« Reply #372 on: 20 Feb '17 - 13:37 »
Hi EWeiss,
hmm, strange. Could you please check this WAV: http://www.udoassmus.bplaced.net/01.zip?

i think your Wave File is corrupt.
i can not save the Tag or Cover with it.
your should add as reference TagsLibraryDefs.Net.dll and the 32Bit Version of TagsLib.dll

i am use TagsLib 1.0.44.88

Test with TagsLib 1.0.56.96 works fine see shot

greets
« Last Edit: 20 Feb '17 - 13:50 by EWeiss »

EWeiss

  • Posts: 342
Re: NEW: Tags Library
« Reply #373 on: 20 Feb '17 - 14:00 »
see myHeader and YourHeader
i think you has written the Tag on a wrong place.. no compatible to TagsLib.dll
@3delite should check for this Trouble.

greets
« Last Edit: 20 Feb '17 - 14:04 by EWeiss »

udo

  • Posts: 29
Re: NEW: Tags Library
« Reply #374 on: 20 Feb '17 - 14:09 »
i think your Wave File is corrupt.
I can see all tags with TagsLibraryTutorialBASS. http://www.mp3tag.de/ can read it too.

I removed all tags with Mp3tag. Now i can save ARTIST, TITLE and ALBUM.
At Cover i get TAGSLIBRARY_SUCCESS but no cover is saved.

The difference is that before the Tagging was ID3v2.3 and now its RIFF.

Quote
see myHeader and YourHeader
I dont know how it was tagged, but Mp3Tag can read booth.
Yes, its at another place. But is it wrong?

« Last Edit: 20 Feb '17 - 14:20 by udo »