Author Topic: Tags Library  (Read 63424 times)

EWeiss

  • Posts: 355
Re: NEW: Tags Library
« Reply #300 on: 20 Apr '15 - 09:20 »
Would like to, but this site has a maximum of 1000kb for attachments  :-\
Even zipped my smallest file is larger. Sorry.

that Problem is my Opus file works
also no idea which is wrong in your Opus File.

without upload can't check for the error.
sorry..

greets
« Last Edit: 20 Apr '15 - 13:52 by EWeiss »

AussieOldTimer

  • Posts: 18
Re: NEW: Tags Library
« Reply #301 on: 20 Apr '15 - 09:25 »
I don't normally use OPUS files, I downloaded a converter program and converted one of my mp3 files.
Could be the converter is rubbish - any suggestions on what I can use?

3delite

  • Posts: 907
Re: NEW: Tags Library
« Reply #302 on: 20 Apr '15 - 10:43 »
Here's an update which will give more precise bit rate values for Opus files, and for Vorbis the header's 'nominal bit rate' is returned: TagsLib.zip

Note that for Opus files the bit rate needs to be calculated, as it's not stored in the file, so it might give back a little + values.
It is calculated as:

Code: [Select]
Info.BitRate := Trunc((Info.FileSize - Info.SPagePos) / Info.PlayTime / 125);

EWeiss

  • Posts: 355
Re: NEW: Tags Library
« Reply #303 on: 20 Apr '15 - 12:34 »
I don't normally use OPUS files, I downloaded a converter program and converted one of my mp3 files.
Could be the converter is rubbish - any suggestions on what I can use?

i use TAudioConverter which is open Source
http://sourceforge.net/projects/taudioconverter/
And from 3delite also (see a lot of source code by him)


Here's an update which will give more precise bit rate values for Opus files, and for Vorbis the header's 'nominal bit rate' is returned: TagsLib.zip

Note that for Opus files the bit rate needs to be calculated, as it's not stored in the file, so it might give back a little + values.
It is calculated as:

Code: [Select]
Info.BitRate := Trunc((Info.FileSize - Info.SPagePos) / Info.PlayTime / 125);

thank you i will test it
is now 323 instead of 320 ;) two pointer more

Quote
Note that for Opus files the bit rate needs to be calculated
that is hart  :(

the bigger Problem is that
Quote
3delite
found error.
After load .flac file and add a cover to it

MPEG AudioAttribute shown instead of Flac
after reload the *.flac Flac Attributes Show correctly.
after delete cover
MPEG AudioAttribute shown instead of Flac
after reload the *.flac Flac Attributes Show correctly.

same Problem with Opus

greets
« Last Edit: 20 Apr '15 - 12:57 by EWeiss »

3delite

  • Posts: 907
Re: NEW: Tags Library
« Reply #304 on: 20 Apr '15 - 16:42 »
Quote
is now 323 instead of 320  two pointer more

The problem is, here I get 159 instead of 160, that mp3Tag reports... ???
Now what? :)

The second one is problematic too. It's because of a feature asked a couple of months ago, to increase MPEG frame detection look-ahead, for corrupt ID3v2/MPEG files. It was 4096 bytes, which is quite a big number and causes false detection of MPEG sync's, as in this case too.
So I now limit this search to 32 bytes, it seems more important to support valid files then corrupt ones.

Here's the update: TagsLib.zip

« Last Edit: 20 Apr '15 - 17:26 by 3delite »

EWeiss

  • Posts: 355
Re: NEW: Tags Library
« Reply #305 on: 20 Apr '15 - 17:33 »
Quote
is now 323 instead of 320  two pointer more

The problem is, here I get 159 instead of 160, that mp3Tag reports... ???
Now what? :)

The second one is problematic too. It's because of a feature asked a couple of months ago, to increase MPEG frame detection look-ahead, for corrupt ID3v2/MPEG files. It was 4096 bytes, which is quite a big number and causes false detection of MPEG sync's, as in this case too.
So I now limit this search to 32 bytes, it seems more important to support valid files then corrupt ones.

Here's the update: TagsLib.zip



No idea what your has changed sorry the same as before. (no Problem)

Quote
3delite
found error.
After load .flac file and add a cover to it

MPEG AudioAttribute shown instead of Flac
after reload the *.flac Flac Attributes Show correctly.
after delete cover
MPEG AudioAttribute shown instead of Flac
after reload the *.flac Flac Attributes Show correctly.

same Problem with Opus

Problem is fixed .. sorry error by me.

greets
« Last Edit: 20 Apr '15 - 17:56 by EWeiss »

3delite

  • Posts: 907
Re: NEW: Tags Library
« Reply #306 on: 20 Apr '15 - 18:04 »
Could you please attach a test app. to check? I don't quite understand what the problem is.
For TagsLibrary_GetAudioAttributes() you have to specify a TAudioType, that specifies what is returned (atAutomatic: TAudioAttributes, atMPEG: TMPEGAudioAttributes).
Please describe in more details what the problem is, please! :-\


Regarding the bit rate, made some tests, and it seems, mp3Tag and MediaInfo (these 2 I checked) calculate the bit rate with including the tag part too. I don't think that's right. So in fact Tags Library will give you more precise values for Opus files then other software it seems. (Try opusinfo.exe.)

EDIT: Ok, then the first issue is solved then, that's good.

EWeiss

  • Posts: 355
Re: NEW: Tags Library
« Reply #307 on: 20 Apr '15 - 18:19 »
Quote
EDIT: Ok, then the first issue is solved then, that's good.
yes sorry for the Trouble my fault ;)

Bitrate should good you can no more do i think (if not available in the Tag it self)

Attach last source code and binary.

all functions which Report should work now.
work on it again if other Trouble reportet.

greets
« Last Edit: 21 Apr '15 - 11:07 by EWeiss »

3delite

  • Posts: 907
Re: NEW: Tags Library
« Reply #308 on: 20 Apr '15 - 18:23 »
Ok, thank you!

The last update was still broken. The latest version will calculate the Opus bit rate correctly (I hope): TagsLib.zip

EDIT: I was wrong, mp3Tag does seem to display the bit rate correctly for Opus files, MediaInfo doesn't. ::)
« Last Edit: 20 Apr '15 - 18:28 by 3delite »

EWeiss

  • Posts: 355
Re: NEW: Tags Library
« Reply #309 on: 20 Apr '15 - 18:36 »
Ok, thank you!

The last update was still broken. The latest version will calculate the Opus bit rate correctly (I hope): TagsLib.zip

EDIT: I was wrong, mp3Tag does seem to display the bit rate correctly for Opus files, MediaInfo doesn't. ::)

322 instead of 320 ;)
better send me a file which is correctly ripped.
no idea is my own wrong.

winamp and Wmp can't play the file.

greets
« Last Edit: 20 Apr '15 - 20:57 by EWeiss »

3delite

  • Posts: 907
Re: NEW: Tags Library
« Reply #310 on: 20 Apr '15 - 21:33 »
That's confusing.

Last try: TagsLib.zip

Added a new config option:

Code: [Select]
#define TAGSLIBRARY_DEEP_OPUS_BITRATE_SCAN                              7

Please add that to the .NET .dll.

Before calling TagsLibrary_Create(), enable it with (Delphi):

Code: [Select]
TagsLibrary_SetConfig(nil, Pointer(1), TAGSLIBRARY_DEEP_OPUS_BITRATE_SCAN, ttAutomatic);

Here's a sample Opus file: Test.opus

Here:
Tags Library without TAGSLIBRARY_DEEP_OPUS_BITRATE_SCAN: 113
Tags Library with TAGSLIBRARY_DEEP_OPUS_BITRATE_SCAN: 112 (this will always be smaller, because the Ogg headers are excluded, gives the real, raw, bit rate)
mp3Tag: 277
MediaInfo: 277

It's interesting because this file gives wrong value with mp3Tag also, which I don't understand... If I remove the cover art mp3Tag reports 113, so it does seem to calculate the bit rate with including the tags.

Would you please try that "322 instead of 320" file with and without the TAGSLIBRARY_DEEP_OPUS_BITRATE_SCAN flag?
And one more, what does opusinfo.exe report (attached) for that file?

EWeiss

  • Posts: 355
Re: NEW: Tags Library
« Reply #311 on: 21 Apr '15 - 11:08 »
works perfect now.. with Bitrate
Quote
Would you please try that "322 instead of 320" file with and without the TAGSLIBRARY_DEEP_OPUS_BITRATE_SCAN flag?
Without Deep scan 322 with 320..


Attach last source code and binary.

greets
« Last Edit: 22 Apr '15 - 13:37 by EWeiss »

EWeiss

  • Posts: 355
Re: NEW: Tags Library
« Reply #312 on: 21 Apr '15 - 11:26 »
Add missing SetConfig Flags for VB6 Module

greets
« Last Edit: 22 Apr '15 - 10:24 by EWeiss »

3delite

  • Posts: 907
Re: NEW: Tags Library
« Reply #313 on: 21 Apr '15 - 12:09 »
Cool! Thank you!

I'll update the package later today.

EWeiss

  • Posts: 355
Re: NEW: Tags Library
« Reply #314 on: 21 Apr '15 - 12:13 »
Cool! Thank you!

I'll update the package later today.

If you has time for it :)

greets

3delite

  • Posts: 907
Re: NEW: Tags Library
« Reply #315 on: 21 Apr '15 - 13:42 »
It's just quite boring, publishing an update takes around 15 minutes, but the problem is it's very boring doing the same 15 min. procedure every second day... :)

But whatever, update available in the first post:

  • Improved bit rate calculation for Vorbis and Opus files
  • Added 'TAGSLIBRARY_DEEP_OPUS_BITRATE_SCAN' config option to deep scan Opus files to parse the bit rate
  • Fixed parsing MPEG audio attributes when there is no ID3v2 tag in the file
  • Fixes and improvements for the .NET wrapper

Separate thanks goes for EWeiss for his thorough work on the .NET wrapper! :) Thank you!

AussieOldTimer

  • Posts: 18
Re: NEW: Tags Library
« Reply #316 on: 22 Apr '15 - 05:21 »
Thank you 3delite and EWeiss, you've made an old man very happy.  : ;D
You had some battles but seem to have won the war, well done.
I look forward to whatever you come up with next.

Thanks again and cheers,

AussieOldTimer
(Brisbane, Australia)


EWeiss

  • Posts: 355
Re: NEW: Tags Library
« Reply #317 on: 22 Apr '15 - 13:36 »
found other Problem..  :'(
with musepack.

after SetConfig with
Code: [Select]
TagsLib.TagsLibrary_SetConfig(Tags, (IntPtr)1, TConfigFlags.TAGSLIBRARY_PARSE_MUSEPACK_AUDIO_ATTRIBUTES, TTagType.ttAutomatic);
Tags Attribute is parsing and work..
Not the Audio Attributes.
all Attributes are 0

using  
Code: [Select]
TAudioType.atMPEGfor MusePack

if use TAudioType.ttAutomatic app Crash.
which TAudioType should i use?

same Trouble with WavePack
using  
Code: [Select]
TAudioType.atWAVfor WavePack

CoverArt
after set CoverArt Type 3 (FrontCover)
MusePack and WavePack return 0 also (Other Picture)
that also is wrong.

greets
« Last Edit: 24 Apr '15 - 15:08 by EWeiss »

3delite

  • Posts: 907
Re: NEW: Tags Library
« Reply #318 on: 22 Apr '15 - 15:14 »
Possibly you are using the wrong structures.

atMusePack -> TMusePackAttributes
atWAVPack -> TWAVPackAttributes

The following works here fine:

Code: [Select]
procedure TForm1.ListAttributes;
var
    AudioAttributes: TAudioAttributes;
    MPEGAudioAttributes: TMPEGAudioAttributes;
    VorbisAudioAttributes: TVorbisAudioAttributes;
    MusePackAttributes: TMusePackAttributes;
    WAVPackAttributes: TWAVPackAttributes;
begin
    Memo1.Clear;
    //* Get audio attributes
    if RadioButton1.Checked then begin
        //* MusePack
        TagsLibrary_GetAudioAttributes(Tags, atMusePack, @MusePackAttributes);
        Memo1.Lines.Append('ChannelModeID: ' + IntToStr(MusePackAttributes.ChannelModeID));
        Memo1.Lines.Append('ChannelMode: ' + MusePackAttributes.ChannelMode);
        Memo1.Lines.Append('FrameCount: ' + IntToStr(MusePackAttributes.FrameCount));
        Memo1.Lines.Append('BitRate: ' + IntToStr(MusePackAttributes.BitRate));
        Memo1.Lines.Append('StreamVersion: ' + IntToStr(MusePackAttributes.StreamVersion));
        Memo1.Lines.Append('StreamStreamVersionString: ' + MusePackAttributes.StreamStreamVersionString);
        Memo1.Lines.Append('SampleRate: ' + IntToStr(MusePackAttributes.SampleRate));
        Memo1.Lines.Append('ProfileID: ' + IntToStr(MusePackAttributes.ProfileID));
        Memo1.Lines.Append('Profile: ' + MusePackAttributes.Profile);
        Memo1.Lines.Append('PlayTime: ' + FloatToStr(MusePackAttributes.PlayTime));
        Memo1.Lines.Append('Encoder: ' + MusePackAttributes.Encoder);
        Memo1.Lines.Append('Ratio: ' + FloatToStr(MusePackAttributes.Ratio));
    end else if RadioButton2.Checked then begin
        //* WavPack
        TagsLibrary_GetAudioAttributes(Tags, atWAVPack, @WAVPackAttributes);
        Memo1.Lines.Append('FormatTag: ' + IntToStr(WAVPackAttributes.FormatTag));
        Memo1.Lines.Append('Version: ' + IntToStr(WAVPackAttributes.Version));
        Memo1.Lines.Append('Channels: ' + IntToStr(WAVPackAttributes.Channels));
        Memo1.Lines.Append('ChannelMode: ' + WAVPackAttributes.ChannelMode);
        Memo1.Lines.Append('SampleRate: ' + IntToStr(WAVPackAttributes.SampleRate));
        Memo1.Lines.Append('Bits: ' + IntToStr(WAVPackAttributes.Bits));
        Memo1.Lines.Append('Bitrate: ' + FloatToStr(WAVPackAttributes.Bitrate));
        Memo1.Lines.Append('PlayTime: ' + FloatToStr(WAVPackAttributes.PlayTime));
        Memo1.Lines.Append('Samples: ' + IntToStr(WAVPackAttributes.Samples));
        Memo1.Lines.Append('BSamples: ' + IntToStr(WAVPackAttributes.BSamples));
        Memo1.Lines.Append('Ratio: ' + FloatToStr(WAVPackAttributes.Ratio));
        Memo1.Lines.Append('Encoder: ' + WAVPackAttributes.Encoder);
    end else begin
        //* Automatic
        TagsLibrary_GetAudioAttributes(Tags, atAutomatic, @AudioAttributes);
        Memo1.Lines.Append('Channels: ' + IntToStr(AudioAttributes.Channels));
        Memo1.Lines.Append('SamplesPerSec: ' + IntToStr(AudioAttributes.SamplesPerSec));
        Memo1.Lines.Append('BitsPerSample: ' + IntToStr(AudioAttributes.BitsPerSample));
        Memo1.Lines.Append('PlayTime: ' + FloatToStr(AudioAttributes.PlayTime));
        Memo1.Lines.Append('SampleCount: ' + IntToStr(AudioAttributes.SampleCount));
        Memo1.Lines.Append('BitRate: ' + IntToStr(AudioAttributes.BitRate));
    end;
end;

Here's a test app. with source code: TutorialDLLAudioAttributes.zip

Or if you have the bug with a particular file, please give a link to it!

EWeiss

  • Posts: 355
Re: NEW: Tags Library
« Reply #319 on: 22 Apr '15 - 15:28 »
i have NO atMusePack
and NO atWAVPack

that is why i call which TAudioType should use.. ;)

the same in VB6
Code: [Select]
Public Enum TAudioType
    atAutomatic
    atFlac
    atMPEG
    atDSDDSF
    atWAV
    atAIFF
    atMP4
    atOpus
    atVorbis
    atWMA
End Enum


OK available in Delphi Header..
your should also check for C++ Header also if any missing ?

greets
« Last Edit: 22 Apr '15 - 15:31 by EWeiss »

EWeiss

  • Posts: 355
Re: NEW: Tags Library
« Reply #320 on: 22 Apr '15 - 17:34 »
CoverArtType
please check this

Code: [Select]
procedure TForm1.Button4Click(Sender: TObject);
var
  CoverArtCount: Integer;
  CoverArtData: TCoverArtData;
  IntI: Integer;

begin
    AddCoverArt;
    ListAttributes;
    TagsLibrary_Save(Tags, PWideChar(Edit1.Text), TTagType.ttAutomatic);
    // Free Resources after saving
    TagsLibrary_Free(Tags);
    // new instance
    Tags := TagsLibrary_Create;
    // load file
    TagsLibrary_Load(Tags, PWideChar(Edit1.Text), ttAutomatic, True);

    // check Cover art Count
    CoverArtCount := TagsLibrary_CoverArtCount(Tags, ttAutomatic);
    // parse it
    for IntI := 0 to CoverArtCount - 1 do
      TagsLibrary_GetCoverArt(Tags, ttAutomatic, IntI, CoverArtData)

end;

add to your sample
and you can see CoverArt Type is 0 instead of 3
Musepack and WavePack

mp3 works....

Memoryleak ?
first start of MusePack or WavePack Attributes work.
with same instance of Application Change from MusePack to WavPack Attribute always 0.
Close Application start again MousePack or WavePack works if not Change to another.

i can Change from MusePack to mp3 and back without any Problem all Attributes show fine.
not from MusePack to WavePack and back..

That work if not Free the Lib before..
The Question?
If that the right way load any files without Free the LIB before?

please test my sample

TTagType
has no Type for MusePack and WavePack
is that correctly?

greets
« Last Edit: 24 Apr '15 - 15:06 by EWeiss »

3delite

  • Posts: 907
Re: NEW: Tags Library
« Reply #321 on: 23 Apr '15 - 15:12 »
Indeed atWAVPack and atMusePack is missing from the VB header. I'll add that.

Yes, correct, WAVPack and MusePack is using APE(v2) tags, and ID3v2 is also supported by the library.

Sorry don't understand what you mean by "Change from MusePack to WavPack"? Load a MusePack then load a WavPack? It seems working here, please try the test app. I attached yesterday (TutorialDLLAudioAttributes) - is it affected?

Regarding the cover art, cover type, in APEv2 tags there is no "cover type" data, I can change the library to always return 3, but not quite sure what is it good for?

EWeiss

  • Posts: 355
Re: NEW: Tags Library
« Reply #322 on: 23 Apr '15 - 17:21 »
Quote
Sorry don't understand what you mean by "Change from MusePack to WavPack"? Load a MusePack then load a WavPack? It seems working here, please try the test app. I attached yesterday (TutorialDLLAudioAttributes) - is it affected?

if not free the lib before then
Change from MusePack to WavPack works good and all Data available.

If free the lib before
Change from MusePack to WavPack not works all Data are 0.

Quote
Regarding the cover art, cover type, in APEv2 tags there is no "cover type" data, I can change the library to always return 3, but not quite sure what is it good for?

NO, no i think Change nothing ... i will deaktivate CoverArt then for MusePack and WavePack.

on the other hand
should return -1 not 0 (0 = ctOther)
see
https://www.un4seen.com/forum/?topic=15754.msg115148#msg115148

greets
« Last Edit: 24 Apr '15 - 09:37 by EWeiss »

3delite

  • Posts: 907
Re: NEW: Tags Library
« Reply #323 on: 24 Apr '15 - 11:15 »
Quote
If free the lib before
Change from MusePack to WavPack not works all Data are 0.

I still can't reproduce this, modified the "TutorialDLLAudioAttributes.exe" like this:

Code: [Select]
procedure TForm1.Button2Click(Sender: TObject);
begin
    //* Free the Tags Library instance
    TagsLibrary_Free(Tags);
    //* Create a Tags Library instance
    Tags := TagsLibrary_Create;
    //* Load tags and attributes
    TagsLibrary_Load(Tags, PWideChar(Edit1.Text), ttAutomatic, True);
    //* Get audio attributes
    ListAttributes;
end;

Load a 'MusePack', display 'atMusePack', works. Load a 'WavPack', display 'atWAVPack' works. In this order and backward too.
Are you sure you are not querying an 'atMusePack' for 'WavPack', or vice versa? That of course won't work. ???

Please don't deactivate the cover art for 'MusePack' and 'WavPack'!
I thinked about this, and I think it should return 3 for them, because when you convert an APE(v2) tag to for example ID3v2 then it's better to set it as type 3 then 0.
I also modified to report MP4 cover arts as type 3 as well.
Please tell me what you think!
« Last Edit: 24 Apr '15 - 11:20 by 3delite »

EWeiss

  • Posts: 355
Re: NEW: Tags Library
« Reply #324 on: 24 Apr '15 - 12:00 »
Quote
I thinked about this, and I think it should return 3 for them, because when you convert an APE(v2) tag to for example ID3v2 then it's better to set it as type 3 then 0.

you has read the Struct of CoverTypes?
https://www.un4seen.com/forum/?topic=15754.msg115148#msg115148
i can set also more then a Front Cover to Tags if Supported
click on any radiobutton and see the result after load a Picture for the CoverType.

that Problem is also..
if i want use for MusePack or WavePck Front And Back Cover what your think is return then?
make many Trouble Hart Code of CoverType is not Support by Tags of Muse or WavePack.

should be -1 then also nothing! ;)
See Picture
CoverTypes should work correctly not Hard Coded
if i want use Front then other Software should tell me that is Front not a other Type of Coverart.
see which Covertype i have add that Shows perfect with *.mp3 (should also for Muse-WavePack also if supported for this Tags.)

Quote
I still can't reproduce
what i can do
upload a EXE with and without Free the Lib if your want.
then you can debug for the Trouble.

for Information only!
i have add all availabe Attributes to the Sample all works.. fine.

greets
« Last Edit: 24 Apr '15 - 12:11 by EWeiss »