Author Topic: Editing Wma Tags  (Read 116223 times)

kenshin1101

  • Posts: 545
Re: Editing Wma Tags
« Reply #125 on: 15 Sep '06 - 08:13 »
Does anybody know how to get (from wma tag , not from channel  8)) number of channel ? (Stereo, Mono or 5.1 , etc...)

Erazer

  • Posts: 441
Re: Editing Wma Tags
« Reply #126 on: 28 Sep '06 - 13:05 »
When i try touse WMAReader.pas, on some wma files i get EAccessViolation at adress.... in module 'oleaut32.dll' do anybody have any ideas ?

// ERROR Happens Here Result := ShowTags(fFileName, TagsData);
« Last Edit: 29 Sep '06 - 10:45 by Erazer »

sail2000

  • Posts: 42
Re: Editing Wma Tags
« Reply #127 on: 28 Sep '06 - 13:24 »
hi:
i find use WMAReader.pas can read MP3 IDV2's tag too! :D

Erazer

  • Posts: 441
Re: Editing Wma Tags
« Reply #128 on: 28 Sep '06 - 14:12 »
Very interesting!, so how ?, and what about writing ? ::)

kenshin1101

  • Posts: 545
Re: Editing Wma Tags
« Reply #129 on: 28 Sep '06 - 16:18 »
Read WM-SDK

Erazer

  • Posts: 441
Re: Editing Wma Tags
« Reply #130 on: 29 Sep '06 - 10:44 »
Havn't spare time  :-\ so have to ask essence ::)

In delphi 7 TagsData.Title := Widestring(PValue); works fine, but in delphi 2006 gives  "EAccessViolation at adress.... in module 'oleaut32.dll' "
Had to do so: TagsData.Title := Widestring(PWideChar(PValue)); -in delphi 2006 Works FINE  ;D ......

Vitaly

  • Posts: 49
Re: Editing Wma Tags
« Reply #131 on: 30 Jul '07 - 16:33 »
I try to delete all attributes in the WMA file, using the following code.
But it doesn't work. Does anybody know why?

Operation code (without loading/unloading WMVCORE.DLL stuff):

AttribStream := 0;
ppHeaderInfo3.GetAttributeCountEx(AttribStream, AttributeCount);
for i := AttributeCount - 1 downto 0 do
  ppHeaderInfo3.DeleteAttribute(AttribStream, i);

// Failed(ppHeaderInfo3.DeleteAttribute(AttribStream, i)) returns TRUE

Function's full code:

function RemoveTags(FileName: PWideChar): Boolean; stdcall;
var
  AttribStream, AttributeCount: Word;
  i: Integer;
  HR: HRESULT;
begin
  DllHandle := LoadLibraryW(LibName);

  if DllHandle = 0 then
  begin
    Result := False;
    Exit;
  end else
    _WMCreateEditor := GetProcAddress(DllHandle, 'WMCreateEditor');

  try

    HR := _WMCreateEditor(ppEditor);

    if Failed(HR) then
    begin
      Result := False;
      Exit;
    end;

    ppEditor.Open(FileName);

    HR := ppEditor.QueryInterface(IID_IWMHeaderInfo3, ppHeaderInfo3);

    if Failed(HR) then
    begin
      Result := False;
      Exit;
    end;

    Result := True;

    AttribStream := 0;

    ppHeaderInfo3.GetAttributeCountEx(AttribStream, AttributeCount);

    for i := AttributeCount - 1 downto 0 do
      ppHeaderInfo3.DeleteAttribute(AttribStream, i);

  finally

    ppEditor.Close;
    ppEditor := nil;

    if DllHandle <> 0 then
    begin
      FreeLibrary(DllHandle);
      _WMCreateEditor := nil;
    end;

  end;
end;

Vitaly

  • Posts: 49
Re: Editing Wma Tags
« Reply #132 on: 30 Jul '07 - 17:36 »
Never mind. I forgot to flush :) (ppEditor.Flush)

Vitaly

  • Posts: 49
Re: Editing Wma Tags
« Reply #133 on: 14 Feb '08 - 08:49 »
Hi,
could anyone repost these two units for OggVorbis and ID3v2 tag editing please?

Erazer

  • Posts: 441
Re: Editing Wma Tags
« Reply #134 on: 14 Feb '08 - 18:00 »
not sure that,but working truly :)
mail...

Vitaly

  • Posts: 49
Re: Editing Wma Tags
« Reply #135 on: 14 Feb '08 - 21:59 »
Hmm... it doesn't work for me (
Please, mail to vitalyx <at> gmail <dot> com. Thank you.

firemen

  • Posts: 151
Re: Editing Wma Tags
« Reply #136 on: 19 Feb '08 - 14:42 »
Prompt me please, I must in a wma file add markers.
How can it be done?

Vitaly

  • Posts: 49
Re: Editing Wma Tags
« Reply #137 on: 14 Mar '08 - 14:44 »
Please,
anyone who have downloaded these two Audio Tools Library units for tag editing with support for the Lyrics field,
could you post them here again.
Thanks!

P.S.
Chris, I wanted to PM you in the first place, but found no such option in your profile :(

radio42

  • Posts: 4576
Re: Editing Wma Tags
« Reply #138 on: 14 Mar '08 - 15:23 »
A very good TAG edit library is also: www.audiogenie.de

Vitaly

  • Posts: 49
Re: Editing Wma Tags
« Reply #139 on: 14 Mar '08 - 16:22 »
Still, I feel safer with the source code, so I'd really appreciate if some could post those two ATL units.
The AudioGenie donation link is broken, BTW. And without making a donation you can't get rid of the popup.

rogier21

  • Posts: 33
Re: Editing Wma Tags
« Reply #140 on: 19 May '08 - 20:10 »
kick, but does somebody has the source codes for Delphi around? None of the links in this topic still work... Maybe an idea to host it on www.un4seen.com ?

Chris

  • Posts: 1810
Re: Editing Wma Tags
« Reply #141 on: 19 May '08 - 21:55 »
Hi I will add tomorror the new  Links where you can download the stuff
Cheers Chris

rogier21

  • Posts: 33
Re: Editing Wma Tags
« Reply #142 on: 22 May '08 - 07:45 »
Thanks Chris! Did you manage to have a look at it :D

Vitaly

  • Posts: 49
Re: Editing Wma Tags
« Reply #143 on: 24 May '08 - 11:40 »
Hi,

Thanks Chris! However, I already managed to update those ATL units myself.
Here is the link (which won't die) in case someone needs them too:
http://spider-player.com/spider/files/ATL_ID3v2_OGG.zip
P.S.
These units also feature full Unicode support and have some other improvements.

Silhwan

  • Posts: 81
Re: Editing Wma Tags
« Reply #144 on: 5 Jun '10 - 02:46 »
After long long waiting...

I have managed to add reading Sync Lyrics function for my own program.
Here is the addition to get Synchronised Lyrics to WMAReader.pas written by Philip Hadar.

Quote
// Added function GetSyncLyricsText to format Synch Lyrics Output
// TBuffer = Array of byte;
function GetSyncLyricsText(const fData: TBuffer) : WideString;
var
   i, j, k : integer;
   PrecedeLF : boolean;
   T : integer;
   ms, ss, nn : integer;
   T_Str : WideString;
   L_Str : WideString;

begin
   result := '';

   i := 0;
   repeat
    // Check if there is preceding line feed code.
      if (fData = $0A) and (fData[i+1] = 0) then
      begin
         PrecedeLF := true;
         inc(i, 2);
      end else
         PrecedeLF := false;

      k := i;

    // Get the last position of a line (or syllable)
      while (i < length(fData)-1) and ((fData <> 0) or (fData[i+1] <> 0)) do
         inc(i, 2);

      if i < (length(fData) - 4) then
      begin
         T := fData[i+2] shl 24  + fData[i+3] shl 16 + fData[i+4] shl 8 + fData[i+5];
         ms := (T mod 1000);
         ss := (T div 1000) mod 60;
         nn := (T div 1000) div 60;
         T_Str := '[' + Format('%2d:%2d:%3d', [nn, ss, ms]) + ']';
         for j := 2 to (Length(T_Str) - 2) do
            if T_Str[j] = ' ' then
               T_Str[j] := '0';
      end;

      SetLength(L_Str, (i - k) div 2);
      move(fData[k], L_Str[1], 2 * length(L_Str));
      if PrecedeLF then
         result := result + Chr(13) + Chr(10) + T_Str + L_Str
      else
         result := result + T_Str + L_Str;

      inc(i, 6);  // point to next line (or syllable)
   until (i >= (length(fData) - 4));  // end of repeat
end;

// Modified function ShowTags to process Synch Lyrics
function ShowTags(var FileName: PWideChar;...
                     .
                     .

   // Add Following code within checking pType routine (if pType = ... then)    
      if pType = WMT_TYPE_BINARY then
      begin
        if UpperCase(pwszName) = 'WM/LYRICS_SYNCHRONISED' then
        begin
          WM_Synchronised_Lyrics := PWM_SYNCHRONISED_LYRICS(PValue)^;
          if WM_Synchronised_Lyrics.bContentType <> 1 then  // not a Song lyrics ?
             Continue;
          if WM_Synchronised_Lyrics.bTimeStampFormat <> 2 then  // not time in milliseconds ?
             Continue;
          if WM_Synchronised_Lyrics.dwLyricsLen < 4 then   // no valid data ?
             Continue;

          TagsData.SyncLyricsDesc := WideString(WM_Synchronised_Lyrics.pwszContentDescriptor);
          SetLength(bLyricsData, WM_Synchronised_Lyrics.dwLyricsLen);  // bLyricsData : TBuffer;
          CopyMemory(@bLyricsData[0], WM_Synchronised_Lyrics.pbLyrics, length(bLyricsData));
          TagsData.SyncLyrics := GetSyncLyricsText(bLyricsData);

          Continue;
        end;
      end;
                       .
                       .
end;


// WM_SYNCHRONISED_LYRICS is a instance of record type defined as follows,
                      
 TWM_SYNCHRONISED_LYRICS = packed record
    bTimeStampFormat : BYTE;
    bContentType : BYTE;
    pwszContentDescriptor : PWideChar;
    dwLyricsLen : DWORD;
    pbLyrics : PBYTE;
  end;

// TagsData.SyncLyricsDesc, TagsData.SyncLyrics are WideString types, which are the added items to TagsData.

The output format of Synchronised Lyrics is as follows,
(similar to the output of unsynchronised Lyrics except preceding text for sync time)

[mm:ss:nnn] Text of the 1st line + chr($0d)+chr($0a)   // LF & CR code at the end of each line
            .
            .
[mm:ss:nnn] Text of the last line

I hope Philip Hadar adopt these codes and release next version which includes Writing Synch
Lyrics.
« Last Edit: 5 Jun '10 - 02:56 by Silhwan »