 |
Das deutsche QBasic- und FreeBASIC-Forum Für euch erreichbar unter qb-forum.de, fb-forum.de und freebasic-forum.de!
|
Vorheriges Thema anzeigen :: Nächstes Thema anzeigen |
Autor |
Nachricht |
Andy19312
Anmeldungsdatum: 22.10.2005 Beiträge: 428
|
Verfasst am: 31.12.2008, 13:16 Titel: mp3 Frame Header |
|
|
Ich probiere schon die ganze Zeit, verzweifelt den Frameheader aus einer mp3 datei auszulesen, jedoch vergebens.
Hier ein paar Links, was ich überhaupt meine:
http://de.wikipedia.org/wiki/Mp3
http://www.mp3-tech.org/programmer/frame_header.html
Hier mein Programmiercode:
Code: |
DIM FixedLenBuffer AS STRING * 1
Dim f as integer
Dim aa as uinteger
Dim asci as single
Dim binaer as string
Dim sync as single
Dim daten (1 to 4) as string
Dim weiter as single
DIM binaera AS string
Dim hexa as single
f = Freefile
'hier mp3 Datei eingeben
Open ".mp3" For Binary As #f
do
aa = aa + 1
Get #f, aa , FixedLenBuffer
asci = ASC(FixedLenBuffer)
binaer = BIN(asci, 8)
binaera = "&b" + binaer
hexa = VAL(binaera)
'1 Byte auslesen, wenn das Byte 255 hat
if hexa = 255 then
daten(1) = binaer
sync = aa + 1
weiter = 1
end if
'2 Byte auslesen, wenn das Byte 224-255 ist
if hexa = 224 or hexa > 224 and hexa < 255 or hexa = 255 and weiter = 1 and aa = sync then
daten(2) = binaer
sync = aa + 1
weiter = 2
end if
'3 Byte auslesen
if weiter = 2 and aa = sync then
daten(3) = binaer
sync = aa + 1
weiter = 3
end if
'4 Byte auslesen
if weiter = 3 and aa = sync then
daten(4) = binaer
sync = aa + 1
end if
loop until eof (f)
Close #f
'Anzahl der Bytes in der mp3 Datei
print aa
print
'darstellen der Daten
print daten(1)
print daten(2)
print daten(3)
print daten(4)
sleep
|
Ich hoffe, dass ihr was mit dem Programmiercode anfangen könnt.
Wenn ja, verändert ihn, dass er funktioniert.
Cu Andreas |
|
Nach oben |
|
 |
Mao
Anmeldungsdatum: 25.09.2005 Beiträge: 4409 Wohnort: /dev/hda1
|
Verfasst am: 31.12.2008, 13:40 Titel: |
|
|
Andy19312 hat Folgendes geschrieben: |
Wenn ja, verändert ihn, dass er funktioniert.
|
Zu Befehl. _________________ Eine handvoll Glück reicht nie für zwei.
--
 |
|
Nach oben |
|
 |
Andy19312
Anmeldungsdatum: 22.10.2005 Beiträge: 428
|
|
Nach oben |
|
 |
Jojo alter Rang

Anmeldungsdatum: 12.02.2005 Beiträge: 9736 Wohnort: Neben der Festplatte
|
Verfasst am: 31.12.2008, 14:47 Titel: |
|
|
enthält die datei vielleicht ID3v2-Tags...? Dann ist der Header nämlich nicht am Dateianfang. _________________ » Die Mathematik wurde geschaffen, um Probleme zu lösen, die es nicht gäbe, wenn die Mathematik nicht erschaffen worden wäre.
 |
|
Nach oben |
|
 |
volta
Anmeldungsdatum: 04.05.2005 Beiträge: 1876 Wohnort: D59192
|
Verfasst am: 31.12.2008, 16:58 Titel: |
|
|
Code: | Type mpeg
Emphasis : 2 As UInteger' 0 = keine
' 1 = 50/15 ms
' 2 = reserviert
' 3 = ITU-T J.17
Original : 1 As UInteger' 0 = Kopie
' 1 = Original
Copyright : 1 As UInteger' 0 = ohne Copyright
' 1 = mit Copyright
Mode_Extension : 2 As UInteger' (nur für Joint Stereo)
' gemäß Mode-Extension-Tabelle
Kanalmodus : 2 As UInteger' 0 = Stereo
' 1 = Joint Stereo
' 2 = 2 Mono Kanäle
' 3 = ein Kanal (Mono)
Privat : 1 As UInteger' nur informativ
Padding : 1 As UInteger' 0 = Frame wird nicht aufgefüllt
' 1 = Frame mit Extraslot gefüllt
' Slotgröße: Layer I = 32 Bits; Layer II+III 8 Bits
Samplingfrequenz : 2 As UInteger' gemäß Sampling-Tabelle
Bitrate : 4 As UInteger' gemäß Bitraten-Tabelle
Protection : 1 As UInteger' 0 = 16-Bit CRC nach dem Header
' 1 = keine CRC
Layer : 2 As UInteger' 0 = reserviert
' 1 = Layer III
' 2 = Layer II
' 3 = Layer I
ID : 2 As UInteger' 0 = MPEG Version 2.5
' 1 = reserviert
' 2 = MPEG Version 2
' 3 = MPEG Version 1
Sync : 11 As UInteger' alle Bits sind auf 1 gesetzt
End Type
Dim mp3header As mpeg
Dim As Integer y,ff = FreeFile
Open "Sandy Nelson - Drums A Go Go.mp3" For Binary As #ff
If Lof(ff)>8195 Then
For i As Integer=1 To 9000
Get #ff,i,mp3header
Asm
mov ebx, [mp3header]
bswap ebx
mov [mp3header], ebx
End Asm
If mp3header.Sync = &H7ff Then
?i,
With mp3header
?.Sync
?.ID
?.Layer
?.Protection
?.Bitrate
?.Samplingfrequenz
?.Padding
?.Privat
?.Kanalmodus
?.Mode_Extension
?.Copyright
?.Original
?.Emphasis
End With
Exit For
EndIf
Next
EndIf
Close #ff
Sleep
|
EDIT/
ups, da war doch ein Bug in der Auswertung  _________________ Warnung an Choleriker:
Dieser Beitrag kann Spuren von Ironie & Sarkasmus enthalten.
Zu Risiken & Nebenwirkungen fragen Sie Ihren Therapeuten oder Psychiater.
Zuletzt bearbeitet von volta am 31.12.2008, 20:35, insgesamt einmal bearbeitet |
|
Nach oben |
|
 |
ThePuppetMaster

Anmeldungsdatum: 18.02.2007 Beiträge: 1839 Wohnort: [JN58JR]
|
Verfasst am: 31.12.2008, 18:10 Titel: |
|
|
is zwar ne VisualBasic Klasse, sollte aber portierbar sein
Code: | VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
Persistable = 0 'NotPersistable
DataBindingBehavior = 0 'vbNone
DataSourceBehavior = 0 'vbNone
MTSTransactionMode = 0 'NotAnMTSObject
END
Attribute VB_Name = "FSC_MP3"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
'######################################################################################################################################################
'######################################################################################################################################################
'### AIO - Control
'######################################################################################################################################################
'######################################################################################################################################################
'###### A.I.O - Audio Input Output
'######################################################################################################################################################
'###### Copyright: /_\ DeltaLabs Deutschland
'###### Autor: Martin Wiemann
'###### Version: 1.00.0
'###### Revision: 0
'###### Zeitpunkt: 2007.10.08 - Oktober - Montag - 03:30:25
'######################################################################################################################################################
'###### IDE: Visual Basic 6
'###### System: MS Windows 98 SE
'######################################################################################################################################################
'### Dieser Quellcode darf weder Kopiert noch in irgend einer anderen Form Analog oder Digital vervielf�lltigt, genuzt oder weitergegeben werden
'######################################################################################################################################################
'######################################################################################################################################################
'### DIESER QUELLCODE UNTERLIEGT DEN RICHTLINIEN DER DeltaLab's Deutschland Group
'######################################################################################################################################################
'######################################################################################################################################################
Option Explicit
Public X_AIOObj As AIO
Private X_File_WriteMode As Boolean
Private X_File_ID As Integer
Private X_FramePos As Long
Private X_FrameCount As Long
Private X_Codec_DID As Long
Private X_Codec_CID As Long
Private X_Codec_FID As Long
Private C_Bitrate(7, 15) As Integer
Private C_Frequenz(3, 7) As Long
Private C_FrameRate(3) As Single
Private Type MP3_Header_Type
T_ID3V1_Tag As Long
T_ID3V2_Tag As Long
T_ID3V2_Len As Long
T_Version As Byte
T_Layer As Byte
T_CRCProtect As Boolean
T_BitRate As Long
T_Frequenz As Long
T_Padding As Boolean
T_Privat As Boolean
T_ChannelMode As Byte
T_ChannelModeExt As Byte
T_Copyright As Boolean
T_Original As Boolean
T_Emphasis As Byte
T_FrameSize As Long
T_Frames As Long
T_Seconds As Long
End Type
Private T_XHB0 As Byte
Private T_XHB1 As Byte
Private T_XHB2 As Byte
Private T_XHB3 As Byte
Private X_Header As MP3_Header_Type
Private X_HeaderEnd As Long
Private X_DataLen As Long
Private X_DataPos As Long
Private X_WaveFormat As WAVEFORMATEX
Private X_WaveFormatIn As WAVEFORMATEX
Private X_WaveFormatOut As WAVEFORMATEX
Private X_ACMID As Long
Private X_BlockLenIn As Long
Private X_BlockLenOut As Long
Private X_ACMData As String
Private Sub Class_Initialize()
On Error Resume Next
Dim X As Long
Dim Y As Long
Dim XBitRate() As String
Dim XFrequenz() As String
XBitRate = Split("999,999,999,999,999,999,032,032,032,032,008,008,064,048,040,048,016,016,096,056,048,056,024,024,128,064,056,064,032,032,160,080,064,080,040,040,192,096,080,096,048,048,224,112,096,112,056,056,256,128,112,128,064,064,288,160,128,144,080,080,320,192,160,160,096,096,352,224,192,176,112,112,384,256,224,192,128,128,416,320,256,224,144,144,448,384,320,256,160,160,999,999,999,999,999,999", ",")
For X = 1 To 14
For Y = 0 To 2
C_Bitrate(7 - Y, X) = Val(XBitRate((X * 6) + Y))
Next
For Y = 0 To 2
C_Bitrate(3 - Y, X) = Val(XBitRate((X * 6) + 3 + Y))
Next
Next
XFrequenz = Split("44100,22050,11025,48000,24000,12000,32000,16000,08000,99999,99999,99999", ",")
For X = 0 To 3
C_Frequenz(3, X) = Val(XFrequenz((X * 3)))
C_Frequenz(2, X) = Val(XFrequenz((X * 3) + 1))
C_Frequenz(0, X) = Val(XFrequenz((X * 3) + 2))
Next
C_FrameRate(0) = 38.5
C_FrameRate(1) = 32.5
C_FrameRate(2) = 27.8
C_FrameRate(3) = 0
FSC_Reset
End Sub
Private Sub Class_Terminate()
On Error Resume Next
FSC_File_Close
Set X_AIOObj = Nothing
End Sub
Public Function FSC_SupportType() As String
On Error Resume Next
FSC_SupportType = "MP3"
End Function
Private Function FSC_Reset()
On Error Resume Next
Dim TMP3H As MP3_Header_Type
X_Header = TMP3H
X_Codec_DID = 0
X_Codec_CID = 0
X_Codec_FID = 0
X_ACMData = ""
X_File_WriteMode = False
End Function
Public Function FSC_File_Open(V_FilePathName As String) As Long
On Error Resume Next
FSC_File_Open = -1
If X_File_ID <> 0 Then FSC_File_Open = -101
X_File_WriteMode = False
If File_CheckExistFile(X_AIOObj, V_FilePathName) = False Then FSC_File_Open = -100: Exit Function
X_File_ID = File_Open(X_AIOObj, V_FilePathName)
If X_File_ID = 0 Then FSC_File_Open = -101: Exit Function
Dim XMP3 As MP3_Header_Type
Dim XMP3End As Long
If F_FMT_Header_Read(XMP3, XMP3End) = False Then FSC_File_Close: FSC_File_Open = -102: Exit Function
X_Header = XMP3
X_HeaderEnd = XMP3End
X_DataLen = File_LOF(X_AIOObj, X_File_ID) - XMP3End - X_Header.T_ID3V2_Len
With X_WaveFormat
.wFormatTag = WAVE_FORMAT_MPEGLAYER3
.nSamplesPerSec = X_Header.T_Frequenz
.wBitsPerSample = X_Header.T_BitRate / 8
Select Case X_Header.T_ChannelMode
Case 0, 1, 2: .nChannels = 2
Case 3: .nChannels = 1
End Select
End With
If ACM_FindCodec(X_WaveFormat, X_Codec_DID, X_Codec_CID, X_Codec_FID) = False Then FSC_File_Close: FSC_File_Open = -118: Exit Function
Dim WFI() As Byte
Dim WFO() As Byte
WFI = ACM_Codecs.V_Drivers(X_Codec_DID).V_Tags(X_Codec_CID).V_Formats(X_Codec_FID).V_Wfx
RtlMoveMemory X_WaveFormatIn, WFI(0), Len(X_WaveFormatIn)
With X_WaveFormatIn
.wFormatTag = .wFormatTag
.nChannels = .nChannels
.nSamplesPerSec = .nSamplesPerSec
.wBitsPerSample = .wBitsPerSample
.nBlockAlign = .nBlockAlign
.nAvgBytesPerSec = .nAvgBytesPerSec
End With
With X_WaveFormatOut
.wFormatTag = WAVE_FORMAT_PCM
.nChannels = X_WaveFormat.nChannels
.nSamplesPerSec = X_WaveFormat.nSamplesPerSec
.wBitsPerSample = 16
.nBlockAlign = .nChannels * (.wBitsPerSample / 8)
.nAvgBytesPerSec = .nSamplesPerSec * .nBlockAlign
X_BlockLenOut = .wBitsPerSample * 1024
End With
ReDim WFO(Len(X_WaveFormatOut)) As Byte
RtlMoveMemory WFO(0), X_WaveFormatOut, Len(X_WaveFormatOut)
FSC_File_Open = ACM_Compressor_Create(WFI, WFO, X_BlockLenOut, X_BlockLenIn, X_ACMID)
If FSC_File_Open <> 0 Then FSC_File_Close: Exit Function
FSC_File_Open = 0
End Function
Public Sub FSC_File_Close()
On Error Resume Next
If X_ACMID <> 0 Then
ACM_Compressor_Destroy X_ACMID
X_ACMID = 0
End If
If X_File_ID <> 0 Then
File_Close X_AIOObj, X_File_ID
X_File_ID = 0
End If
FSC_Reset
End Sub
Public Function FSC_File_Create(V_FilePathName As String) As Long
On Error Resume Next
If X_File_ID <> 0 Then FSC_File_Create = -101
X_File_WriteMode = True
End Function
Public Function FSC_Stream_Frame_Count_Get(V_FrameCount As Long) As Long
On Error Resume Next
FSC_Stream_Frame_Count_Get = -1
If X_File_ID = 0 Then FSC_Stream_Frame_Count_Get = -101
V_FrameCount = X_DataLen
FSC_Stream_Frame_Count_Get = 0
End Function
Public Function FSC_Stream_Frame_Position_Get(V_FrameID As Long) As Long
On Error Resume Next
FSC_Stream_Frame_Position_Get = -1
If X_File_ID = 0 Then FSC_Stream_Frame_Position_Get = -101
V_FrameID = X_DataPos - X_Header.T_ID3V2_Len
FSC_Stream_Frame_Position_Get = 0
End Function
Public Function FSC_Stream_Frame_Position_Set(V_FrameID As Long) As Long
On Error Resume Next
FSC_Stream_Frame_Position_Set = -1
If X_File_ID = 0 Then FSC_Stream_Frame_Position_Set = -101
If V_FrameID <= 0 Or V_FrameID > X_DataLen Then FSC_Stream_Frame_Position_Set = -104
X_DataPos = V_FrameID + X_Header.T_ID3V2_Len
X_ACMData = ""
FSC_Stream_Frame_Position_Set = 0
End Function
Public Function FSC_Stream_Seconds_Count(B_Seconds As Long) As Long
On Error Resume Next
FSC_Stream_Seconds_Count = -1
If X_File_ID = 0 Then FSC_Stream_Seconds_Count = -101
B_Seconds = X_Header.T_Seconds
FSC_Stream_Seconds_Count = 0
End Function
Private Function F_SamplesPerFrame() As Integer
On Error Resume Next
Select Case X_Header.T_Version
Case 3
Select Case X_Header.T_Layer
Case 2: F_SamplesPerFrame = 384
Case 2, 1: F_SamplesPerFrame = 1152
End Select
Case 2, 0:
Select Case X_Header.T_Layer
Case 3: F_SamplesPerFrame = 384
Case 2: F_SamplesPerFrame = 1152
Case 1: F_SamplesPerFrame = 576
End Select
End Select
End Function
Public Function FSC_Stream_Seconds_Position(B_Seconds As Long) As Long
On Error Resume Next
FSC_Stream_Seconds_Position = -1
If X_File_ID = 0 Then FSC_Stream_Seconds_Position = -101
B_Seconds = X_DataPos / X_Header.T_FrameSize * CDbl(F_SamplesPerFrame) / CDbl(X_WaveFormat.nSamplesPerSec)
FSC_Stream_Seconds_Position = 0
End Function
Public Function FSC_Stream_Frame_Get(V_BufferSize As Long, B_Data As String) As Long
On Error Resume Next
FSC_Stream_Frame_Get = -1
If X_File_ID = 0 Then FSC_Stream_Frame_Get = -101
Dim TWH As WAVEHDR_Type
Dim TD As String
Dim XP As Long
Dim TBI() As Byte
Dim TBO() As Byte
Dim TBOC As Long
Dim TBIUse As Long
Dim TDO() As Byte
Dim TDOX As Long
Dim BV As Long
Dim Tot As Long
Dim XBufS As Long
Dim XT As Long
ReDim TDO(V_BufferSize) As Byte
XBufS = X_BlockLenIn
TDOX = 1
Do
If X_ACMData <> "" Then
XT = Len(B_Data)
B_Data = B_Data & Mid(X_ACMData, 1, V_BufferSize - XT)
X_ACMData = Mid(X_ACMData, (Len(B_Data) - XT) + 1)
End If
If Len(B_Data) < V_BufferSize Then
XP = X_DataPos + 1
File_Get X_AIOObj, X_File_ID, XP, XBufS, TD
ReDim TBI(Len(TD)) As Byte
RtlMoveMemory TBI(0), ByVal TD, Len(TD)
BV = ACM_Compressor_Convert(X_ACMID, TBI, XBufS, TBO, TBOC, TBIUse)
If BV <> 0 Then FSC_Stream_Frame_Get = -122: Exit Function
TD = Space(TBOC)
RtlMoveMemory ByVal TD, TBO(0), TBOC
X_ACMData = X_ACMData & TD
X_DataPos = X_DataPos + TBIUse
Else: Exit Do
End If
Loop
FSC_Stream_Frame_Get = 0
End Function
Public Function FSC_GetWaveFormat(B_BypS As Long, B_BA As Integer, B_Ch As Integer, B_SpS As Long, B_BpS As Integer, B_FT As Integer) As Long
On Error Resume Next
FSC_GetWaveFormat = -1
If X_File_ID = 0 Then FSC_GetWaveFormat = -101
With X_WaveFormatOut
B_BypS = .nAvgBytesPerSec
B_BA = .nBlockAlign
B_Ch = .nChannels
B_SpS = .nSamplesPerSec
B_BpS = .wBitsPerSample
B_FT = WAVE_FORMAT_PCM
End With
FSC_GetWaveFormat = 0
End Function
Public Function FSC_GetCodecIDs(B_DriverID As Long, B_CodecID As Long, B_FormatID As Long) As Long
On Error Resume Next
FSC_GetCodecIDs = -1
If X_File_ID = 0 Then FSC_GetCodecIDs = -101
B_DriverID = X_Codec_DID
B_CodecID = X_Codec_CID
B_FormatID = X_Codec_FID
FSC_GetCodecIDs = 0
End Function
Public Function FSC_GetInfo(B_Channel As Integer, B_SampleRate As Long, B_FrameByteLen As Long) As Long
On Error Resume Next
FSC_GetInfo = -1
If X_File_ID = 0 Then FSC_GetInfo = -101
With X_WaveFormat
B_Channel = .nChannels
B_SampleRate = .nSamplesPerSec
B_FrameByteLen = X_WaveFormatOut.nBlockAlign
End With
FSC_GetInfo = 0
End Function
Public Function FSC_Info_Version(B_Version As Single) As Long
On Error Resume Next
FSC_Info_Version = -1
If X_File_ID = 0 Then FSC_Info_Version = -101
Select Case X_Header.T_Version
Case 0: B_Version = 2.5
Case 2: B_Version = 2
Case 3: B_Version = 1
End Select
FSC_Info_Version = 0
End Function
Public Function FSC_Info_Channels(B_Channels As Long) As Long
On Error Resume Next
FSC_Info_Channels = -1
If X_File_ID = 0 Then FSC_Info_Channels = -101
B_Channels = X_WaveFormat.nChannels
FSC_Info_Channels = 0
End Function
Public Function FSC_Info_Copyright(B_Copyright As String) As Long
On Error Resume Next
FSC_Info_Copyright = -1
If X_File_ID = 0 Then FSC_Info_Copyright = -101
B_Copyright = X_Header.T_Copyright
FSC_Info_Copyright = 0
End Function
Public Function FSC_GetInfo_ChannelMode_Desc() As String
On Error Resume Next
'Select Case T_MP3ChannelMode
' Case 0: FSC_GetInfo_ChannelMode_Desc = "Stereo"
' Case 1: FSC_GetInfo_ChannelMode_Desc = "Joint Stereo"
' Case 2: FSC_GetInfo_ChannelMode_Desc = "Dual Mono"
' Case 3: FSC_GetInfo_ChannelMode_Desc = "Mono"
' Case Else: FSC_GetInfo_ChannelMode_Desc = "-?-"
'End Select
End Function
Public Function FSC_GetInfo_Version_Desc() As String
On Error Resume Next
'Select Case T_MP3Version
' Case 0: FSC_GetInfo_Version_Desc = "MPEG-2.5 Layer " & CStr(4 - T_MP3Layer)
' Case 2: FSC_GetInfo_Version_Desc = "MPEG-2.0 Layer " & CStr(4 - T_MP3Layer)
' Case 3: FSC_GetInfo_Version_Desc = "MPEG-1.0 Layer " & CStr(4 - T_MP3Layer)
' Case Else: FSC_GetInfo_Version_Desc = "-?-"
'End Select
End Function
Private Function F_FMT_Header_Read(B_Header As MP3_Header_Type, B_HeaderEnd As Long) As Boolean
On Error Resume Next
F_FMT_Header_Read = False
Dim D As String
Dim T As String
Dim XID3V1Tag As Boolean
Dim XID3V2Tag As Boolean
Dim TMP3H As MP3_Header_Type
Dim MX As Long
Dim X As Long
Dim XID3Len As Long
Dim XStart As Long
MX = File_LOF(X_AIOObj, X_File_ID)
If MX <= 4 Then Exit Function
XStart = 1
If MX > 128 Then
File_Get X_AIOObj, X_File_ID, MX - 127, 128, D
If Left(D, 3) = "TAG" Then XID3V1Tag = True
End If
File_Get X_AIOObj, X_File_ID, 1, 3, D
If Left(D, 3) = "ID3" Then
XID3V2Tag = True
File_Get X_AIOObj, X_File_ID, 7, 4, D
T = Mid(D, 4, 1) & Mid(D, 3, 1) & Mid(D, 2, 1) & Mid(D, 1, 1)
RtlMoveMemory XID3Len, ByVal T, 4
XStart = XID3Len + 11
Else
If Left(D, 3) = "TAG" Then
XID3V1Tag = True
XStart = 128
End If
End If
File_Get X_AIOObj, X_File_ID, XStart, 8192, D
For X = 1 To Len(D) - 4
B_Header = TMP3H
T_XHB1 = Asc(Mid(D, X, 1))
T_XHB2 = Asc(Mid(D, X + 1, 1))
If (T_XHB1 = &HFF) And ((T_XHB2 And &HE0) = &HE0) Then
T_XHB0 = Asc(Mid(D, X, 3))
T_XHB1 = Asc(Mid(D, X + 1, 3))
T_XHB2 = Asc(Mid(D, X + 2, 1))
T_XHB3 = Asc(Mid(D, X + 3, 1))
With B_Header
.T_Version = (T_XHB1 And &H18) / 8
.T_Layer = (T_XHB1 And &H6) / 2
If (T_XHB1 And &H1) <> 0 Then .T_CRCProtect = True
.T_BitRate = 1000 * CLng(C_Bitrate(((.T_Version And &H1) * 4) Or .T_Layer, (T_XHB2 And &HF0) / 16))
.T_Frequenz = C_Frequenz(.T_Version, (T_XHB2 And &HC) / 4)
If .T_Frequenz <> 99999 And .T_Frequenz <> 0 And .T_BitRate <> 0 Then
If ((T_XHB2 And &H2) / 2) = 1 Then .T_Padding = True
If ((T_XHB3 And &H10) / 2) = 1 Then .T_Privat = True
.T_ChannelMode = (T_XHB3 And &HC0) / 64
.T_ChannelModeExt = (T_XHB3 And &H30) / 16
If ((T_XHB3 And &H8) / 8) = 1 Then .T_Copyright = True
If ((T_XHB3 And &H4) / 4) = 1 Then .T_Original = True
.T_Emphasis = T_XHB3 And &H3
Select Case .T_Layer
Case 1, 2: .T_FrameSize = (144 * (.T_BitRate / .T_Frequenz))
Case 3: .T_FrameSize = ((12 * (.T_BitRate / .T_Frequenz) + Abs(.T_Padding))) * 4
End Select
.T_Frames = (MX - XID3Len) / .T_FrameSize
.T_Seconds = .T_Frames / C_FrameRate((T_XHB2 And &HC) / 4)
If CheckIfValidMP3(B_Header, T_XHB0, T_XHB1) = True Then
.T_ID3V2_Len = XID3Len
F_FMT_Header_Read = True
B_HeaderEnd = X + 4
Exit For
End If
Else: X = X + 4
End If
End With
End If
Next
End Function
Private Function CheckIfValidMP3(V_Header As MP3_Header_Type, V_B0 As Byte, V_B1 As Byte) As Boolean
On Error Resume Next
CheckIfValidMP3 = False
If (V_Header.T_Version = &H1) Then Exit Function
If (V_Header.T_Layer = &H0) Then Exit Function
If (V_B0 <> &HFF) Then Exit Function
If (V_Header.T_BitRate And &HF) = &HF Then Exit Function
'If (V_B1 <> &HFB) Then Exit Function
CheckIfValidMP3 = True
End Function
|
_________________ [ WebFBC ][ OPS ][ ToOFlo ][ Wiemann.TV ] |
|
Nach oben |
|
 |
|
|
Du kannst keine Beiträge in dieses Forum schreiben. Du kannst auf Beiträge in diesem Forum nicht antworten. Du kannst deine Beiträge in diesem Forum nicht bearbeiten. Du kannst deine Beiträge in diesem Forum nicht löschen. Du kannst an Umfragen in diesem Forum nicht mitmachen.
|
|