📄 jvqid3v2types.pas
字号:
{******************************************************************************}
{* WARNING: JEDI VCL To CLX Converter generated unit. *}
{* Manual modifications will be lost on next release. *}
{******************************************************************************}
{-----------------------------------------------------------------------------
The contents of this file are subject to the Mozilla Public License
Version 1.1 (the "License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/MPL-1.1.html
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See the License for
the specific language governing rights and limitations under the License.
The Original Code is: JvID3v2Types.PAS, released on 2001-02-28.
The Initial Developer of the Original Code is S閎astien Buysse [sbuysse att buypin dott com]
Portions created by S閎astien Buysse are Copyright (C) 2001 S閎astien Buysse.
All Rights Reserved.
Contributor(s):
Michael Beck [mbeck att bigfoot dott com].
Remko Bonte [remkobonte att myrealbox dott com].
You may retrieve the latest version of this file at the Project JEDI's JVCL home page,
located at http://jvcl.sourceforge.net
Known Issues:
-----------------------------------------------------------------------------}
// $Id: JvQId3v2Types.pas,v 1.16 2004/11/06 22:08:18 asnepvangers Exp $
unit JvQID3v2Types;
{$I jvcl.inc}
interface
uses
Classes;
type
TJvID3TagSizeRestriction = (tsrMax128Frames_1MB, tsrMax64Frames_128KB, tsrMax32Frames_40KB,
tsrMax32Frames_4KB);
TJvID3TextEncodingRestriction = (terNoRestrictions, terOnlyISO_8859_1orUTF8);
TJvID3TextFieldsSizeRestriction = (tfszNoRestrictions, tfszMax1024Char, tfszMax128Char,
tfszMax30Char);
TJvID3ImageEncodingRestriction = (ierNoRestrictions, ierOnlyPNGorJPEG);
TJvID3ImageSizeRestriction = (isrNoRestrictions, isrMax256x256, isrMax64x64, isr64x64UnlessRequired);
TJvID3Restrictions = record
RTagSize: TJvID3TagSizeRestriction;
RTextEncoding: TJvID3TextEncodingRestriction;
RTextFieldsSize: TJvID3TextFieldsSizeRestriction;
RImageEncoding: TJvID3ImageEncodingRestriction;
RImageSize: TJvID3ImageSizeRestriction;
end;
TJvID3HeaderExtendedFlag = (hefTagIsAnUpdate, hefCRCDataPresent, hefTagRestrictions);
TJvID3HeaderExtendedFlags = set of TJvID3HeaderExtendedFlag;
TJvID3HeaderFlag = (hfUnsynchronisation, hfExtendedHeader, hfExperimentalIndicator, hfFooterPresent);
TJvID3HeaderFlags = set of TJvID3HeaderFlag;
TJvID3FrameHeaderFlag = (fhfOnTagAlterDiscardFrame, fhfOnFileAlterDiscardFrame,
fhfReadOnly, fhfIsCompressed, fhfIsEncrypted, fhfContainsGroupInformation, fhfUnsynchronisationApplied,
fhfDataLengthIndicator);
TJvID3FrameHeaderFlags = set of TJvID3FrameHeaderFlag;
{ $00 ISO-8859-1 [ISO-8859-1]. Terminated with $00.
$01 UTF-16 [UTF-16] encoded Unicode [UNICODE] with BOM. All
strings in the same frame SHALL have the same byteorder.
Terminated with $00 00.
$02 UTF-16BE [UTF-16] encoded Unicode [UNICODE] without BOM.
Terminated with $00 00.
$03 UTF-8 [UTF-8] encoded Unicode [UNICODE]. Terminated with $00.
}
TJvID3ForceEncoding = (ifeDontCare, ifeISO_8859_1, ifeUTF_16, ifeUTF_16BE, ifeUTF_8);
TJvID3Encoding = (ienISO_8859_1, ienUTF_16, ienUTF_16BE, ienUTF_8);
TJvID3Encodings = set of TJvID3Encoding;
TJvID3ForceVersion = (ifvDontCare, ifv2_2, ifv2_3, ifv2_4);
TJvID3Version = (iveLowerThan2_2, ive2_2, ive2_3, ive2_4, iveHigherThan2_4);
const
CForceEncodingToEncoding: array [TJvID3ForceEncoding] of TJvID3Encoding =
(ienISO_8859_1, ienISO_8859_1, ienUTF_16, ienUTF_16BE, ienUTF_8);
CForceVersionToVersion: array [TJvID3ForceVersion] of TJvID3Version =
(ive2_3, ive2_2, ive2_3, ive2_4);
type
TJvID3StringPair = record
SA: string;
SW: WideString;
end;
TID3v2HeaderRec = packed record
Identifier: array [0..2] of Char;
MajorVersion: Byte;
RevisionNumber: Byte;
Flags: Byte;
Size: Cardinal;
end;
TID3v2FrameRec = packed record
ID: array [0..3] of Char;
// (rom) changed to Cardinal sizes are usually unsigned
Size: Cardinal;
Flag0: Byte;
Flag1: Byte;
end;
TJvID3PictureType = (
ptOther, { Other }
ptFileIcon, { 32x32 pixels 'file icon' (PNG only) }
ptOtherFileIcon, { Other file icon }
ptCoverFront, { Cover (front) }
ptCoverBack, { Cover (back) }
ptLeafletPage, { Leaflet page }
ptMedia, { Media (e.g. lable side of CD) }
ptLeadArtist, { Lead artist/lead performer/soloist }
ptArtist, { Artist/performer }
ptConductor, { Conductor }
ptBand, { Band/Orchestra }
ptComposer, { Composer }
ptLyricist, { Lyricist/text writer }
ptRecordingLocation, { Recording Location }
ptDuringRecording, { During recording }
ptDuringPerformance, { During performance }
ptMovieVideoScreenCapture, { Movie/video screen capture }
ptBrightColouredFish, { A bright coloured fish }
ptIllustration, { Illustration }
ptBandLogotype, { Band/artist logotype }
ptPublisherLogotype { Publisher/Studio logotype }
);
TJvID3FrameID =
(
{ ---- } fiErrorFrame, { Erroneous frame, ie chars not in [a..z, A..Z, 0..9] }
{ #0 } fiPaddingFrame, { Padding }
{ ???? } fiUnknownFrame, { No known frame }
{ AENC } fiAudioCrypto, { Audio encryption }
{ APIC } fiPicture, { Attached picture }
{ ASPI } fiAudioSeekPoint, { Audio seek point index }
{ COMM } fiComment, { Comments }
{ COMR } fiCommercial, { Commercial frame }
{ ENCR } fiCryptoReg, { Encryption method registration }
{ EQU2 } fiEqualization2, { Equalisation (2) }
{ EQUA } fiEqualization, { Equalization }
{ ETCO } fiEventTiming, { Event timing codes }
{ GEOB } fiGeneralObject, { General encapsulated object }
{ GRID } fiGroupingReg, { Group identification registration }
{ IPLS } fiInvolvedPeople, { Involved people list }
{ LINK } fiLinkedInfo, { Linked information }
{ MCDI } fiCDID, { Music CD identifier }
{ MLLT } fiMPEGLookup, { MPEG location lookup table }
{ OWNE } fiOwnership, { Ownership frame }
{ PRIV } fiPrivate, { Private frame }
{ PCNT } fiPlayCounter, { Play counter }
{ POPM } fiPopularimeter, { Popularimeter }
{ POSS } fiPositionsync, { Position synchronisation frame }
{ RBUF } fiBufferSize, { Recommended buffer size }
{ RVA2 } fiVolumeAdj2, { Relative volume adjustment (2) }
{ RVAD } fiVolumeAdj, { Relative volume adjustment }
{ RVRB } fiReverb, { Reverb }
{ SEEK } fiSeekFrame, { Seek frame }
{ SIGN } fiSignature, { Signature frame }
{ SYLT } fiSyncedLyrics, { Synchronized lyric/text }
{ SYTC } fiSyncedTempo, { Synchronized tempo codes }
{ TALB } fiAlbum, { Album/Movie/Show title }
{ TBPM } fiBPM, { BPM (beats per minute) }
{ TCOM } fiComposer, { Composer }
{ TCON } fiContentType, { Content type }
{ TCOP } fiCopyright, { Copyright message }
{ TDAT } fiDate, { Date }
{ TDEN } fiEncodingTime, { Encoding time }
{ TDLY } fiPlaylistDelay, { Playlist delay }
{ TDOR } fiOrigReleaseTime, { Original release time }
{ TDRC } fiRecordingTime, { Recording time }
{ TDRL } fiReleaseTime, { Release time }
{ TDTG } fiTaggingTime, { Tagging time }
{ TIPL } fiInvolvedPeople2, { Involved people list }
{ TENC } fiEncodedBy, { Encoded by }
{ TEXT } fiLyricist, { Lyricist/Text writer }
{ TFLT } fiFileType, { File type }
{ TIME } fiTime, { Time }
{ TIT1 } fiContentGroup, { Content group description }
{ TIT2 } fiTitle, { Title/songname/content description }
{ TIT3 } fiSubTitle, { Subtitle/Description refinement }
{ TKEY } fiInitialKey, { Initial key }
{ TLAN } fiLanguage, { Language(s) }
{ TLEN } fiSongLen, { Length }
{ TMCL } fiMusicianCreditList, { Musician credits list }
{ TMED } fiMediaType, { Media type }
{ TMOO } fiMood, { Mood }
{ TOAL } fiOrigAlbum, { Original album/movie/show title }
{ TOFN } fiOrigFileName, { Original filename }
{ TOLY } fiOrigLyricist, { Original lyricist(s)/text writer(s) }
{ TOPE } fiOrigArtist, { Original artist(s)/performer(s) }
{ TORY } fiOrigYear, { Original release year }
{ TOWN } fiFileOwner, { File owner/licensee }
{ TPE1 } fiLeadArtist, { Lead performer(s)/Soloist(s) }
{ TPE2 } fiBand, { Band/orchestra/accompaniment }
{ TPE3 } fiConductor, { Conductor/performer refinement }
{ TPE4 } fiMixArtist, { Interpreted, remixed, or otherwise modified by }
{ TPOS } fiPartInSet, { Part of a set }
{ TPRO } fiProducedNotice, { Produced notice }
{ TPUB } fiPublisher, { Publisher }
{ TRCK } fiTrackNum, { Track number/Position in set }
{ TRDA } fiRecordingDates, { Recording dates }
{ TRSN } fiNetRadioStation, { Internet radio station name }
{ TRSO } fiNetRadioOwner, { Internet radio station owner }
{ TSIZ } fiSize, { Size }
{ TSOA } fiAlbumSortOrder, { Album sort order }
{ TSOP } fiPerformerSortOrder, { Performer sort order }
{ TSOT } fiTitleSortOrder, { Title sort order }
{ TSRC } fiISRC, { ISRC (international standard recording code) }
{ TSSE } fiEncoderSettings, { Software/Hardware and settings used for encoding }
{ TSST } fiSetSubTitle, { Set subtitle }
{ TXXX } fiUserText, { User defined text information }
{ TYER } fiYear, { Year }
{ UFID } fiUniqueFileID, { Unique file identifier }
{ USER } fiTermsOfUse, { Terms of use }
{ USLT } fiUnsyncedLyrics, { Unsynchronized lyric/text transcription }
{ WCOM } fiWWWCommercialInfo, { Commercial information }
{ WCOP } fiWWWCopyright, { Copyright/Legal information }
{ WOAF } fiWWWAudioFile, { Official audio file webpage }
{ WOAR } fiWWWArtist, { Official artist/performer webpage }
{ WOAS } fiWWWAudioSource, { Official audio source webpage }
{ WORS } fiWWWRadioPage, { Official internet radio station homepage }
{ WPAY } fiWWWPayment, { Payment }
{ WPUB } fiWWWPublisher, { Official publisher webpage }
{ WXXX } fiWWWUser, { User defined URL link }
{ } fiMetaCrypto, { Encrypted meta frame (ID3v2.2.x) }
{ } fiMetaCompression { Compressed meta frame (ID3v2.2.1) }
);
TJvID3FrameIDs = set of TJvID3FrameID;
{ Frame ID procedures }
function ID3_StringToFrameID(const S: string): TJvID3FrameID;
function ID3_FrameIDToString(const ID: TJvID3FrameID; const Size: Integer = 4): string;
{ Genre procedures }
function ID3_GenreToID(const AGenre: string; const InclWinampGenres: Boolean = True): Integer;
{ searches for a genre that is a prefix for AGenreLong }
function ID3_LongGenreToID(const ALongGenre: string; const InclWinampGenres: Boolean = True): Integer;
function ID3_IDToGenre(const ID: Integer; const InclWinampGenres: Boolean = True): string;
procedure ID3_Genres(Strings: TStrings; const InclWinampGenres: Boolean = True);
{ Language ISO 639-2 procedures }
function ISO_639_2IsCode(const Code: string): Boolean;
function ISO_639_2CodeToName(const Code: string): string;
{ Known problem: some codes such as 'dut' and 'nld', have the same name value,
thus ISO_639_2NameToCode('Dutch') = 'dut' not 'nld' }
function ISO_639_2NameToCode(const Name: string): string;
procedure ISO_639_2Names(Strings: TStrings);
implementation
uses
{$IFDEF UNITVERSIONING}
JclUnitVersioning,
{$ENDIF UNITVERSIONING}
Math, SysUtils,
JvQConsts, JvQResources, JvQTypes;
type
TJvListType =
(ltID3LongText, ltID3ShortText, ltISO_639_2Code, ltISO_639_2Name, ltID3Genres);
TJvID3FrameDef = packed record
ShortTextID: array [0..2] of Char;
LongTextID: array [0..3] of Char;
end;
{ Note: When you change type of S or L to 'string' it will increase the exe size
with minimal 475x8 bytes }
TShortToLongName = record
S: array [0..2] of Char;
L: PChar;
end;
TJvID3TermFinder = class
private
FLists: array [TJvListType] of TStringList;
protected
procedure BuildList_ISO_639_2Name;
procedure BuildList_ISO_639_2Code;
procedure BuildList_ID3LongText;
procedure BuildList_ID3ShortText;
procedure BuildList_ID3Genres;
function IsFrameOk(const S: string): Boolean;
public
constructor Create; virtual;
destructor Destroy; override;
class function Instance: TJvID3TermFinder;
function ID3LongTextToFrameID(const S: string): TJvID3FrameID;
function ID3ShortTextToFrameID(const S: string): TJvID3FrameID;
function ID3GenreToID(const AGenre: string; const InclWinampGenres: Boolean): Integer;
procedure ID3Genres(AStrings: TStrings; const InclWinampGenres: Boolean);
function ID3LongGenreToID(const ALongGenre: string; const InclWinampGenres: Boolean): Integer;
function ISO_639_2CodeToIndex(const ACode: string): Integer;
function ISO_639_2NameToIndex(const AName: string): Integer;
procedure ISO_639_2Names(AStrings: TStrings);
end;
const
CID3FrameDefs: array [TJvID3FrameID] of TJvID3FrameDef = ( { Ver. 2 3 4 }
(ShortTextID: ''; LongTextID: '' ), { fiErrorFrame - - - }
(ShortTextID: ''; LongTextID: '' ), { fiPaddingFrame - - - }
(ShortTextID: ''; LongTextID: '' ), { fiUnknownFrame - - - }
(ShortTextID: 'CRA'; LongTextID: 'AENC'), { fiAudioCrypto X X X }
(ShortTextID: 'PIC'; LongTextID: 'APIC'), { fiPicture X X X }
(ShortTextID: ''; LongTextID: 'ASPI'), { fiAudioSeekPoint - - X }
(ShortTextID: 'COM'; LongTextID: 'COMM'), { fiComment X X X }
(ShortTextID: ''; LongTextID: 'COMR'), { fiCommercial - X X }
(ShortTextID: ''; LongTextID: 'ENCR'), { fiCryptoReg - X X }
(ShortTextID: ''; LongTextID: 'EQU2'), { fiEqualization2 - - X }
(ShortTextID: 'EQU'; LongTextID: 'EQUA'), { fiEqualization X X d }
(ShortTextID: 'ETC'; LongTextID: 'ETCO'), { fiEventTiming X X X }
(ShortTextID: 'GEO'; LongTextID: 'GEOB'), { fiGeneralObject X X X }
(ShortTextID: ''; LongTextID: 'GRID'), { fiGroupingReg - X X }
(ShortTextID: 'IPL'; LongTextID: 'IPLS'), { fiInvolvedPeople X X d }
(ShortTextID: 'LNK'; LongTextID: 'LINK'), { fiLinkedInfo X X X }
(ShortTextID: 'MCI'; LongTextID: 'MCDI'), { fiCDID X X X }
(ShortTextID: 'MLL'; LongTextID: 'MLLT'), { fiMPEGLookup X X X }
(ShortTextID: ''; LongTextID: 'OWNE'), { fiOwnership - X X }
(ShortTextID: ''; LongTextID: 'PRIV'), { fiPrivate - X X }
(ShortTextID: 'CNT'; LongTextID: 'PCNT'), { fiPlayCounter X X X }
(ShortTextID: 'POP'; LongTextID: 'POPM'), { fiPopularimeter X X X }
(ShortTextID: ''; LongTextID: 'POSS'), { fiPositionsync - X X }
(ShortTextID: 'BUF'; LongTextID: 'RBUF'), { fiBufferSize X X X }
(ShortTextID: ''; LongTextID: 'RVA2'), { fiVolumeAdj2 - - X }
(ShortTextID: 'RVA'; LongTextID: 'RVAD'), { fiVolumeAdj X X d }
(ShortTextID: 'REV'; LongTextID: 'RVRB'), { fiReverb X X X }
(ShortTextID: ''; LongTextID: 'SEEK'), { fiSeekFrame - - X }
(ShortTextID: ''; LongTextID: 'SIGN'), { fiSignature - - X }
(ShortTextID: 'SLT'; LongTextID: 'SYLT'), { fiSyncedLyrics X X X }
(ShortTextID: 'STC'; LongTextID: 'SYTC'), { fiSyncedTempo X X X }
(ShortTextID: 'TAL'; LongTextID: 'TALB'), { fiAlbum X X X }
(ShortTextID: 'TBP'; LongTextID: 'TBPM'), { fiBPM X X X }
(ShortTextID: 'TCM'; LongTextID: 'TCOM'), { fiComposer X X X }
(ShortTextID: 'TCO'; LongTextID: 'TCON'), { fiContentType X X X }
(ShortTextID: 'TCR'; LongTextID: 'TCOP'), { fiCopyright X X X }
(ShortTextID: 'TDA'; LongTextID: 'TDAT'), { fiDate X X d }
(ShortTextID: ''; LongTextID: 'TDEN'), { fiEncodingTime - - X }
(ShortTextID: 'TDY'; LongTextID: 'TDLY'), { fiPlaylistDelay X X X }
(ShortTextID: ''; LongTextID: 'TDOR'), { fiOrigReleaseTime - - X }
(ShortTextID: ''; LongTextID: 'TDRC'), { fiRecordingTime - - X }
(ShortTextID: ''; LongTextID: 'TDRL'), { fiReleaseTime - - X }
(ShortTextID: ''; LongTextID: 'TDTG'), { fiTaggingTime - - X }
(ShortTextID: ''; LongTextID: 'TIPL'), { fiInvolvedPeople2 - - X }
(ShortTextID: 'TEN'; LongTextID: 'TENC'), { fiEncodedBy X X X }
(ShortTextID: 'TXT'; LongTextID: 'TEXT'), { fiLyricist X X X }
(ShortTextID: 'TFT'; LongTextID: 'TFLT'), { fiFileType X X X }
(ShortTextID: 'TIM'; LongTextID: 'TIME'), { fiTime X X d }
(ShortTextID: 'TT1'; LongTextID: 'TIT1'), { fiContentGroup X X X }
(ShortTextID: 'TT2'; LongTextID: 'TIT2'), { fiTitle X X X }
(ShortTextID: 'TT3'; LongTextID: 'TIT3'), { fiSubTitle X X X }
(ShortTextID: 'TKE'; LongTextID: 'TKEY'), { fiInitialKey X X X }
(ShortTextID: 'TLA'; LongTextID: 'TLAN'), { fiLanguage X X X }
(ShortTextID: 'TLE'; LongTextID: 'TLEN'), { fiSongLen X X X }
(ShortTextID: ''; LongTextID: 'TMCL'), { fiMusicianCreditList - - X }
(ShortTextID: 'TMT'; LongTextID: 'TMED'), { fiMediaType X X X }
(ShortTextID: ''; LongTextID: 'TMOO'), { fiMood - - X }
(ShortTextID: 'TOT'; LongTextID: 'TOAL'), { fiOrigAlbum X X X }
(ShortTextID: 'TOF'; LongTextID: 'TOFN'), { fiOrigFileName X X X }
(ShortTextID: 'TOL'; LongTextID: 'TOLY'), { fiOrigLyricist X X X }
(ShortTextID: 'TOA'; LongTextID: 'TOPE'), { fiOrigArtist X X X }
(ShortTextID: 'TOR'; LongTextID: 'TORY'), { fiOrigYear X X d }
(ShortTextID: ''; LongTextID: 'TOWN'), { fiFileOwner - X X }
(ShortTextID: 'TP1'; LongTextID: 'TPE1'), { fiLeadArtist X X X }
(ShortTextID: 'TP2'; LongTextID: 'TPE2'), { fiBand X X X }
(ShortTextID: 'TP3'; LongTextID: 'TPE3'), { fiConductor X X X }
(ShortTextID: 'TP4'; LongTextID: 'TPE4'), { fiMixArtist X X X }
(ShortTextID: 'TPA'; LongTextID: 'TPOS'), { fiPartInSet X X X }
(ShortTextID: ''; LongTextID: 'TPRO'), { fiProducedNotice - - X }
(ShortTextID: 'TPB'; LongTextID: 'TPUB'), { fiPublisher X X X }
(ShortTextID: 'TRK'; LongTextID: 'TRCK'), { fiTrackNum X X X }
(ShortTextID: 'TRD'; LongTextID: 'TRDA'), { fiRecordingDates X X d }
(ShortTextID: 'TRN'; LongTextID: 'TRSN'), { fiNetRadioStation X X X }
(ShortTextID: 'TRO'; LongTextID: 'TRSO'), { fiNetRadioOwner X X X }
(ShortTextID: 'TSI'; LongTextID: 'TSIZ'), { fiSize X X d }
(ShortTextID: ''; LongTextID: 'TSOA'), { fiAlbumSortOrder - - X }
(ShortTextID: ''; LongTextID: 'TSOP'), { fiPerformerSortOrder - - X }
(ShortTextID: ''; LongTextID: 'TSOT'), { fiTitleSortOrder - - X }
(ShortTextID: 'TRC'; LongTextID: 'TSRC'), { fiISRC X X X }
(ShortTextID: ''; LongTextID: 'TSSE'), { fiEncoderSettings - X X }
(ShortTextID: 'TSS'; LongTextID: 'TSST'), { fiSetSubTitle - - X }
(ShortTextID: 'TXX'; LongTextID: 'TXXX'), { fiUserText X X X }
(ShortTextID: 'TYE'; LongTextID: 'TYER'), { fiYear X X d }
(ShortTextID: 'UFI'; LongTextID: 'UFID'), { fiUniqueFileID X X X }
(ShortTextID: ''; LongTextID: 'USER'), { fiTermsOfUse - X X }
(ShortTextID: 'ULT'; LongTextID: 'USLT'), { fiUnsyncedLyrics X X X }
(ShortTextID: 'WCM'; LongTextID: 'WCOM'), { fiWWWCommercialInfo X X X }
(ShortTextID: 'WCP'; LongTextID: 'WCOP'), { fiWWWCopyright X X X }
(ShortTextID: 'WAF'; LongTextID: 'WOAF'), { fiWWWAudioFile X X X }
(ShortTextID: 'WAR'; LongTextID: 'WOAR'), { fiWWWArtist X X X }
(ShortTextID: 'WAS'; LongTextID: 'WOAS'), { fiWWWAudioSource X X X }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -