Просмотр тэгов MP3
(* Mp3View v1.2 *)
(* Quick Viewer TAG'a Mp3 Files with Riff Wav format support *)
(* CopyRight (c) Maxim Kanoonnikov aka Maxis //UFS'99 *)
(* *)
Program mp3live;
uses dos,windos,crt;
type
tagID = record
tagident : array [1..03] of char; {сигнатура информационного тэга 'TAG'}
title : array [1..30] of char; {Hазвание 30 байт ASCII}
artist : array [1..30] of char; {Исполнитель 30 байт ASCII}
album : array [1..30] of char; {Альбом 30 байт ASCII}
year : array [1..04] of char; {Год 4 байта ASCII}
comment : array [1..30] of char; {Комментарий 30 байт ASCII}
genre : byte; {Жанр}
end;
const
(* UnCode win=>dos *)
xlat: array[1.. 66,1..2] of word =
(($0C0,$080),($0C1,$081),($0C2,$082),($0C3,$083),($0C4,$084),($0C5,$085),
($0C6,$086),($0C7,$087),($0C8,$088),($0C9,$089),($0CA,$08A),($0CB,$08B),
($0CC,$08C),($0CD,$08D),($0CE,$08E),($0CF,$08F),($0D0,$090),($0D1,$091),
($0D2,$092),($0D3,$093),($0D4,$094),($0D5,$095),($0D6,$096),($0D7,$097),
($0D8,$098),($0D9,$099),($0DA,$09A),($0DB,$09B),($0DC,$09C),($0DD,$09D),
($0DE,$09E),($0DF,$09F),($0E0,$0A0),($0E1,$0A1),($0E2,$0A2),($0E3,$0A3),
($0E4,$0A4),($0E5,$0A5),($0E6,$0A6),($0E7,$0A7),($0E8,$0A8),($0E9,$0A9),
($0EA,$0AA),($0EB,$0AB),($0EC,$0AC),($0ED,$0AD),($0EE,$0AE),($0EF,$0AF),
($0F0,$0E0),($0F1,$0E1),($0F2,$0E2),($0F3,$0E3),($0F4,$0E4),($0F5,$0E5),
($0F6,$0E6),($0F7,$0E7),($0F8,$0E8),($0F9,$0E9),($0FA,$0EA),($0FB,$0EB),
($0FC,$0EC),($0FD,$0ED),($0FE,$0EE),($0FF,$0EF),($0B9,$0FC),($0B8,$0F1));
kbps : array[0..14,1..6] of word =
(( 0, 0 , 0 , 0, 0, 0),
( 32, 32, 32, 32, 8, 8),
( 64, 48, 40, 48, 16, 16),
( 96, 56, 48, 56, 24, 24),
(128, 64, 56, 64, 32, 32),
(160, 80, 64, 80, 40, 40),
(192, 96, 80, 96, 48, 48),
(224, 112, 96, 112, 56, 56),
(256, 128, 112, 128, 64, 64),
(288, 160, 128, 144, 80, 80),
(320, 192, 160, 160, 96, 96),
(352, 224, 192, 176, 112, 112),
(384, 256, 224, 192, 128, 128),
(416, 320, 256, 224, 144, 144),
(448, 384, 320, 256, 160, 160));
genrestr: array[0..147] of string[16] =
('Blues','Classic Rock','Country','Dance','Disco','Funk','Grunge','Hip-Hop'
,'Jazz','Metal','New Age','Oldies','Other','Pop','R&B','Rap','Reggae','Rock'
,'Techno','Industrial','Alternative','Ska','Death Metal','Pranks','Soundtrack'
,'Euro-Techno','Ambient','Trip-Hop','Vocal','Jazz+Funk','Fusion','Trance'
,'Classical','Instrumental','Acid','House','Game','Sound Clip','Gospel','Noise'
,'Alt. Rock','Bass','Soul','Punk','Space','Meditative','Instrumental Pop'
,'Instrumental Rock','Ethnic','Gothic','Darkwave','Techno-Industrial'
,'Electronic','Pop-Folk','Eurodance','Dream','Southern Rock','Comedy','Cult'
,'Gangsta Rap','Top 40','Christian Rap','Pop/Funk','Jungle','Native American'
,'Cabaret','New Wave','Psychedelic','Rave','Showtunes','Trailer','Lo-Fi'
,'Tribal','Acid Punk','Acid Jazz','Polka','Retro','Musical','Rock & Roll'
,'Hard Rock','Folk','Folk/Rock','National Folk','Swing','Fast-Fusion','Bebob'
,'Latin','Revival','Celtic','Bluegrass','Avantgarde','Gothic Rock'
,'Progressive Rock','Psychedelic Rock','Symphonic Rock','Slow Rock','Big Band'
,'Chorus','Easy Listening','Acoustic','Humour','Speech','Chanson','Opera'
,'Chamber Music','Sonata','Symphony','Booty Bass','Primus','Porn Groove'
,'Satire','Slow Jam','Club','Tango','Samba','Folklore','Ballad','Power Ballad'
,'Rhythmic Soul','Freestyle','Duet','Punk Rock','Drum Solo','A Cappella'
,'Euro-House','Dance Hall','Goa','Drum & Bass','Club-House','Hardcore'
,'Terror','Indie','BritPop','Negerpunk','Polsk Punk','Beat'
,'Christian Gangsta Rap','Heavy Metal','Black Metal','Crossover'
,'Contemporary Christian','Christian Rock','Merengue','Salsa','Thrash Metal'
,'Anime','JPop','Synthpop');
khz:array[0..2,1..3] of word=((44100,22050,11025),
{ ^srate ^mpeg} (48000,24000,12000),
(32000,16000,8000));
bits:array[0..3,1..3] of word=((4,4,0),(8,8,4),(12,12,8),(16,16,16));
var
tag : tagID;
kol :integer;
a,B1,B2,B3,B4,i,j,atr,kbp :word;
kbpsb,srate,bit,error,tmp :byte;
f :file;
ch: char;
fpos: longint;
buf:array[1..4] of byte;
byt:byte;
emphasis,original,copyright,stereo,private_,crc,layer,mpeg:byte;
chanel,pathn,temp,fullname: string;
begin
if paramstr(1) = '' then begin
writeln('Quick Mp3 File TAG Viewer v1.1 by Maxim Kanoonnikov //UFS''99');
writeln('Use: Mp3View.exe ');
halt(1);
end;
Assign (f,paramstr(1));
GetFAttr(F, atr);
SetFAttr(F, faArchive);
reset(f,1);
SetFAttr(F, atr);
blockread(f,buf,sizeof(buf),a);
{close(f);}
b1:=buf[1];b2:=buf[2];b3:=buf[3];b4:=buf[4];
{for i:=1 to 4 do write(buf[i],' ');halt(1);}
asm
mov ch,byte ptr b1
mov cl,byte ptr b2
mov al,byte ptr b3
mov ah,byte ptr b4
{******fileID*******}
push cx
push cx
shr cx,4h { get mpegID }
cmp cx,0fffh
jz @noterror
mov error,1h
pop cx
cmp cl,49h { get riffID }
jne @nt
cmp ch,52h
jne @nt
cmp ah,46h
jne @nt
cmp al,46h
jne @nt
mov error,2 {error = 2 then wav}
@nt:
jmp @notmp3file
@noterror:
pop cx
test al,1
jz @aaa1 {IF PRIVATE IS ENABLE THEN not JUNP}
mov private_,1
@aaa1:
test ah,4
jz @aaa2 {IF ORIGINAL IS ENABLE THEN not JUNP}
mov original,1
@aaa2:
test ah,8
jz @aaa3 {IF COPYRIGHT IS ENABLE THEN not JUNP}
mov copyright,1
@aaa3:
test cl,0
jz @aaa4 {IF CRC32 IS ENABLE THEN JUNP}
mov crc,1
@aaa4:
{****EMPHASIS*****}
push ax
and ah,11b
mov emphasis,ah
pop ax
{*****STEREO******}
push ax
and ah,11000000b
shr ah,6h
mov stereo,ah
pop ax
{***LAYER*******}
{*****LAYER******}
test cl,0
jz @aa11l {IF LAYER IS enable THEN NOT JUNP}
mov layer,0
@aa11l:
test cl,02h
jz @aa22l
mov layer,3
@aa22l:
test cl,04h
jz @aa33l
mov layer,2
@aa33l:
test cl,04h
jz @aa333l
test cl,02h
jz @aa333l
mov layer,1
@aa333l:
{***}
{push cx
and cl,00000110b
shr cl,1
mov layer,cl
pop cx}
{*****MPEG******}
{push cx
and cl,00011000b
shr cl,3
mov mpeg,cl
pop cx}
{*****MPEG******}
test cl,0
jz @aa11m {IF MPEG IS enable THEN NOT JUNP}
mov mpeg,3
@aa11m:
test cl,00001000b
jz @aa22m
mov mpeg,0
@aa22m:
test cl,00010000b
jz @aa33m
mov mpeg,2
@aa33m:
test cl,00010000b
jz @aa333m
test cl,00001000b
jz @aa333m
mov mpeg,1
@aa333m:
{***}
{*****SampleRate******}
push ax
and al,00000110b
shr al,1
mov srate,al
pop ax
(*bit****************)
mov bh,ah
and bh,00110000b
shr bh,4
mov bit,bh
{**kbps****************}
push ax
shr al,4
xor ah,ah
mov kbpsb,al
pop ax
{**********************}
mov error,0
@notmp3file:
@aaa:
end;
(***************************TAGID***************************************)
fpos:= filesize(f) - sizeof(tag);
seek(f,fpos);
blockread(f,tag,sizeof(tag),a);
if tag.tagident 'TAG' then begin writeln('Tag not found');halt(1);end;
window (1,1,42,9);
textcolor(8);
textbackground(7);
clrscr;
for i:=1 to 66 do (* decode of char *)
for j:=1 to 30 do
begin
if tag.comment[j] = chr(xlat[i,1]) then tag.comment[j]:=chr(xlat[i,2]);
if tag.title[j] = chr(xlat[i,1]) then tag.title[j]:=chr(xlat[i,2]);
if tag.artist[j] = chr(xlat[i,1]) then tag.artist[j]:=chr(xlat[i,2]);
if tag.album[j] = chr(xlat[i,1]) then tag.album[j]:=chr(xlat[i,2])
end;
writeln('-----------------------------------------');
writeln('¦ Title : ',tag.title);
writeln('¦ Artist : ',tag.artist);
writeln('¦ Album : ',tag.album);
writeln('¦ Comment: ',tag.comment);
if tag.genre
Оставить комментарий
Комментарии
1.


3 декабря 2005, 20:11:49
Зайди Options-->Compiler и поставь галочку на :286 instructions
2.


4 сентября 2005, 00:35:03
Для участка кода: shr cx,4h { get mpegID }
пишет ошибку: Error 159: 286/287 instructions are not enabled.
Как это исправить?
пишет ошибку: Error 159: 286/287 instructions are not enabled.
Как это исправить?
