Library "libvorbisfile"
Public Struct vorbis_info
version As Integer
channels As Integer
rate As Long
bitrate_upper As Long
bitrate_nominal As Long
bitrate_lower As Long
bitrate_window As Long
codec_setup As Pointer
End Struct
Public Struct vorbis_comment
user_comments As Pointer
comment_lengths As Pointer
comments As Integer
vendor As Pointer
End Struct
' int ov_fopen(const char *path,OggVorbis_File *vf)
' Initializes an OggVorbis_File structure
Private Extern ov_fopen(path As String, vf As Byte[]) As Integer
' vorbis_info *ov_info(OggVorbis_File *vf,int link)
' Returns the vorbis_info struct for the specified bitstream.
Private Extern ov_info(vf As Byte[], olink As Integer) As Vorbis_info
' ogg_int64_t ov_raw_total(OggVorbis_File *vf,int i)
' Returns the total (compressed) bytes.
Private Extern ov_raw_total(vf As Byte[], i As Integer) As Long
' ogg_int64_t ov_pcm_total(OggVorbis_File *vf,int i)
' Returns the total pcm samples.
Private Extern ov_pcm_total(vf As Byte[], i As Integer) As Long
' double ov_time_total(OggVorbis_File *vf,int i)
' Returns the total time in seconds.
Private Extern ov_time_total(vf As Byte[], i As Integer) As Float
' vorbis_comment *ov_comment(OggVorbis_File *vf,int link)
' Returns a pointer to the vorbis_comment struct for the specified bitstream.
Private Extern ov_comment(vf As Byte[], olink As Integer) As Vorbis_comment
' int ov_clear(OggVorbis_File *vf)
' Clears the decoder's buffers.
Private Extern ov_clear(vf As Byte[]) As Integer
Public Sub Main()
Dim ogg As String
Dim ovf As New Byte[944]
Dim info As Vorbis_info
Dim comm As Vorbis_comment
Dim n As Integer
ogg = "/ruta/del/archivo.ogg"
n = ov_fopen(ogg, ovf)
If n < 0 Then Error.Raise("Error !")
Print "\nFile audio ogg: "; ogg
With info = ov_info(ovf, 0)
Print "\nNumero canales: "; .channels
Print "Frecuencia: "; .rate; " hertz"
Print "Bitrate nominal: "; .bitrate_nominal \ 1000; " Kbps"
End With
Print "Tamaño total: "; ov_raw_total(ovf, -1); " byte (comprimidos)"
Print "Tamaño pcm: "; ov_pcm_total(ovf, -1); " byte (pcm)"
Print "\nDuración: "; Date(0, 0, 0, 0, 0, 0, ov_time_total(ovf, -1) * 1000)
With comm = ov_comment(ovf, 0)
If .comments > 0 Then
Print "\nVendor: "; String@(.vendor)
Print "\nComentarios:"
For n = 0 To .comments - 1
Print String@(Pointer@(comm.user_comments + (8 * n)))
Next
Endif
End With
ov_clear(ovf)
End
Public Struct vorbis_info
version As Integer
channels As Integer
rate As Long
bitrate_upper As Long
bitrate_nominal As Long
bitrate_lower As Long
bitrate_window As Long
codec_setup As Pointer
End Struct
Public Struct vorbis_comment
user_comments As Pointer
comment_lengths As Pointer
comments As Integer
vendor As Pointer
End Struct
' int ov_fopen(const char *path,OggVorbis_File *vf)
' Initializes an OggVorbis_File structure
Private Extern ov_fopen(path As String, vf As Byte[]) As Integer
' vorbis_info *ov_info(OggVorbis_File *vf,int link)
' Returns the vorbis_info struct for the specified bitstream.
Private Extern ov_info(vf As Byte[], olink As Integer) As Vorbis_info
' ogg_int64_t ov_raw_total(OggVorbis_File *vf,int i)
' Returns the total (compressed) bytes.
Private Extern ov_raw_total(vf As Byte[], i As Integer) As Long
' ogg_int64_t ov_pcm_total(OggVorbis_File *vf,int i)
' Returns the total pcm samples.
Private Extern ov_pcm_total(vf As Byte[], i As Integer) As Long
' double ov_time_total(OggVorbis_File *vf,int i)
' Returns the total time in seconds.
Private Extern ov_time_total(vf As Byte[], i As Integer) As Float
' vorbis_comment *ov_comment(OggVorbis_File *vf,int link)
' Returns a pointer to the vorbis_comment struct for the specified bitstream.
Private Extern ov_comment(vf As Byte[], olink As Integer) As Vorbis_comment
' int ov_clear(OggVorbis_File *vf)
' Clears the decoder's buffers.
Private Extern ov_clear(vf As Byte[]) As Integer
Public Sub Main()
Dim ogg As String
Dim ovf As New Byte[944]
Dim info As Vorbis_info
Dim comm As Vorbis_comment
Dim n As Integer
ogg = "/ruta/del/archivo.ogg"
n = ov_fopen(ogg, ovf)
If n < 0 Then Error.Raise("Error !")
Print "\nFile audio ogg: "; ogg
With info = ov_info(ovf, 0)
Print "\nNumero canales: "; .channels
Print "Frecuencia: "; .rate; " hertz"
Print "Bitrate nominal: "; .bitrate_nominal \ 1000; " Kbps"
End With
Print "Tamaño total: "; ov_raw_total(ovf, -1); " byte (comprimidos)"
Print "Tamaño pcm: "; ov_pcm_total(ovf, -1); " byte (pcm)"
Print "\nDuración: "; Date(0, 0, 0, 0, 0, 0, ov_time_total(ovf, -1) * 1000)
With comm = ov_comment(ovf, 0)
If .comments > 0 Then
Print "\nVendor: "; String@(.vendor)
Print "\nComentarios:"
For n = 0 To .comments - 1
Print String@(Pointer@(comm.user_comments + (8 * n)))
Next
Endif
End With
ov_clear(ovf)
End