Differenze tra le versioni di "Estrarre informazioni da un file OggVorbis con le funzioni esterne del API di Vorbisfile"

Da Gambas-it.org - Wikipedia.
Riga 4: Riga 4:
  
  
Vediamo di seguito un esempio pratico:
+
Vediamo di seguito un primo esempio pratico:
  Library "libvorbisfile:3"
+
  Library "libvorbisfile"
 +
 +
Public Struct vorbis_comment
 +
  user_comments As Pointer
 +
  comment_lengths As Pointer
 +
  comments As Integer
 +
  vendor As Pointer
 +
End Struct
 +
 +
Public Struct ogg_sync_state
 +
  data As Pointer
 +
  storage As Integer
 +
  fill As Integer
 +
  returned As Integer
 +
  unisynced As Integer
 +
  headerbytes As Integer
 +
  bodybytes As Integer
 +
End Struct
 +
 +
Public Struct ogg_stream_state
 +
  body_data As Pointer
 +
  body_storage As Long
 +
  body_fill As Long
 +
  body_returned As Long
 +
  lacing_vals As Pointer
 +
  granule_vals As Pointer
 +
  lacing_storage As Long
 +
  lacing_fill As Long
 +
  lacing_packet As Long
 +
  lacing_returned As Long
 +
  header[282] As Byte
 +
  header_fill As Integer
 +
  e_o_s As Integer
 +
  b_o_s As Integer
 +
  serialno As Long
 +
  pageno As Long
 +
  packetno As Long
 +
  granulepos As Long
 +
End Struct
 +
 +
Public Struct vorbis_dsp_state
 +
  analysisp As Integer
 +
  vi As Pointer
 +
  pcm As Pointer
 +
  pcmret As Pointer
 +
  pcm_storage As Integer
 +
  pcm_current As Integer
 +
  pcm_returned As Integer
 +
  preextrapolate As Integer
 +
  eofflag As Integer
 +
  lW As Long
 +
  W As Long
 +
  nW As Long
 +
  centerW As Long
 +
  granulepos As Long
 +
  sequence As Long
 +
  glue_bits As Long
 +
  time_bits As Long
 +
  floor_bits As Long
 +
  res_bits As Long
 +
End Struct
 +
 +
Public Struct oggpack_buffer
 +
  endbyte As Long
 +
  endbit As Integer
 +
  buffer As Pointer
 +
  ptr As Pointer
 +
  storage As Long
 +
End Struct
 +
 +
Public Struct vorbis_block
 +
  pcm As Pointer
 +
  opb As Struct Oggpack_buffer
 +
  lW As Long
 +
  W As Long
 +
  nW As Long
 +
  pcmend As Integer
 +
  mode As Integer
 +
  eofflag As Integer
 +
  granulepos As Long
 +
  sequence As Long
 +
  vd As Pointer
 +
  localstore As Pointer
 +
  localtop As Long
 +
  localalloc As Long
 +
  totaluse As Long
 +
  reap As Pointer
 +
  glue_bits As Long
 +
  time_bits As Long
 +
  floor_bits As Long
 +
  res_bits As Long
 +
  internal As Pointer
 +
End Struct
 +
 +
Public Struct ov_callbacks
 +
  fread As Pointer
 +
  _ov_header_fseek_wrap As Pointer
 +
  void As Pointer
 +
  ftell As Pointer
 +
End Struct
 +
 +
Public Struct OggVorbis_File
 +
  datasource As Pointer
 +
  seekable As Integer
 +
  offset As Long
 +
  end_ As Long
 +
  oy As Struct Ogg_sync_state
 +
  links As IntegerLibrary "libvorbisfile:3"
 +
 +
Public Struct vorbis_comment
 +
  user_comments As Pointer
 +
  comment_lengths As Pointer
 +
  comments As Integer
 +
  vendor As Pointer
 +
End Struct
 +
 +
Public Struct ogg_sync_state
 +
  data As Pointer
 +
  storage As Integer
 +
  fill As Integer
 +
  returned As Integer
 +
  unisynced As Integer
 +
  headerbytes As Integer
 +
  bodybytes As Integer
 +
End Struct
 +
 +
Public Struct ogg_stream_state
 +
  body_data As Pointer
 +
  body_storage As Long
 +
  body_fill As Long
 +
  body_returned As Long
 +
  lacing_vals As Pointer
 +
  granule_vals As Pointer
 +
  lacing_storage As Long
 +
  lacing_fill As Long
 +
  lacing_packet As Long
 +
  lacing_returned As Long
 +
  header[282] As Byte
 +
  header_fill As Integer
 +
  e_o_s As Integer
 +
  b_o_s As Integer
 +
  serialno As Long
 +
  pageno As Long
 +
  packetno As Long
 +
  granulepos As Long
 +
End Struct
 +
 +
Public Struct vorbis_dsp_state
 +
  analysisp As Integer
 +
  vi As Pointer
 +
  pcm As Pointer
 +
  pcmret As Pointer
 +
  pcm_storage As Integer
 +
  pcm_current As Integer
 +
  pcm_returned As Integer
 +
  preextrapolate As Integer
 +
  eofflag As Integer
 +
  lW As Long
 +
  W As Long
 +
  nW As Long
 +
  centerW As Long
 +
  granulepos As Long
 +
  sequence As Long
 +
  glue_bits As Long
 +
  time_bits As Long
 +
  floor_bits As Long
 +
  res_bits As Long
 +
End Struct
 +
 +
Public Struct oggpack_buffer
 +
  endbyte As Long
 +
  endbit As Integer
 +
  buffer As Pointer
 +
  ptr As Pointer
 +
  storage As Long
 +
End Struct
 +
 +
Public Struct vorbis_block
 +
  pcm As Pointer
 +
  opb As Struct Oggpack_buffer
 +
  lW As Long
 +
  W As Long
 +
  nW As Long
 +
  pcmend As Integer
 +
  mode As Integer
 +
  eofflag As Integer
 +
  granulepos As Long
 +
  sequence As Long
 +
  vd As Pointer
 +
  localstore As Pointer
 +
  localtop As Long
 +
  localalloc As Long
 +
  totaluse As Long
 +
  reap As Pointer
 +
  glue_bits As Long
 +
  time_bits As Long
 +
  floor_bits As Long
 +
  res_bits As Long
 +
  internal As Pointer
 +
End Struct
 +
 +
Public Struct ov_callbacks
 +
  fread As Pointer
 +
  _ov_header_fseek_wrap As Pointer
 +
  void As Pointer
 +
  ftell As Pointer
 +
End Struct
 +
 +
Public Struct OggVorbis_File
 +
  datasource As Pointer
 +
  seekable As Integer
 +
  offset As Long
 +
  end_ As Long
 +
  oy As Struct Ogg_sync_state
 +
  links As Integer
 +
  offsets As Pointer
 +
  dataoffsets As Pointer
 +
  serialnos As Pointer
 +
  pcmlengths As Pointer
 +
  vi As Pointer
 +
  vc As Pointer
 +
  pcm_offset As Long
 +
  ready_state As Integer
 +
  current_serialno As Long
 +
  current_link As Integer
 +
  bittrack As Float
 +
  samptrack As Float
 +
  os As Struct Ogg_stream_state
 +
  vd As Struct Vorbis_dsp_state
 +
  vb As Struct Vorbis_block
 +
  callbacks As Struct Ov_callbacks
 +
End Struct
 +
 +
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
 +
End Struct
 +
 +
Public Struct vorbis_comment
 +
  user_comments As Pointer
 +
  comment_lengths As Pointer
 +
  comments As Integer
 +
  vendor As Pointer
 +
End Struct
 +
 
 +
<FONT color=gray>' ''int ov_fopen(const char *path,OggVorbis_File *vf)''
 +
' ''Opens and initialize an OggVorbis_File structure.''</font>
 +
Private Extern ov_fopen(path As String, vf As OggVorbis_File) As Integer
 +
 +
<FONT color=gray>' ''vorbis_info *ov_info(OggVorbis_File *vf,int link)''
 +
' ''Returns the vorbis_info struct for the specified bitstream.''</font>
 +
Private Extern ov_info(vf As Byte[], olink As Integer) As Vorbis_info
 +
 +
<FONT color=gray>' ''ogg_int64_t ov_raw_total(OggVorbis_File *vf,int i)''
 +
' ''Returns the total (compressed) bytes.''</font>
 +
Private Extern ov_raw_total(vf As Byte[], i As Integer) As Long
 +
 +
<FONT color=gray>' ''ogg_int64_t ov_pcm_total(OggVorbis_File *vf,int i)''
 +
' ''Returns the total pcm samples.''</font>
 +
Private Extern ov_pcm_total(vf As OggVorbis_File, i As Integer) As Long
 +
 +
<FONT color=gray>' ''double ov_time_total(OggVorbis_File *vf,int i)''
 +
' ''Returns the total time in seconds of the physical bitstream or a specified logical bitstream.''</font>
 +
Private Extern ov_time_total(vf As OggVorbis_File, i As Integer) As Float
 +
 +
<FONT color=gray>' ''vorbis_comment *ov_comment(OggVorbis_File *vf,int link)''
 +
' ''Returns a pointer to the vorbis_comment struct for the specified bitstream.''</font>
 +
Private Extern ov_comment(vf As Byte[], olink As Integer) As Vorbis_comment
 +
 +
<FONT color=gray>' ''long ov_serialnumber(OggVorbis_File *vf,int i)''
 +
' ''Returns the serialnumber of the specified logical bitstream link number within the overall physical bitstream.''</font>
 +
Private Extern ov_serialnumber(vf As OggVorbis_File, i As Integer) As Long
 +
 +
<FONT color=gray>' ''int ov_clear(OggVorbis_File *vf)''
 +
' ''Clears the decoder's buffers.''</font>
 +
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 av As Integer
 +
   
 +
  ogg = "<FONT color=gray>''/percorso/del/file.ogg''</font>"
 +
 
 +
  if ov_fopen(ogg, ovf) < 0 Then Error.Raise("Impossibile aprire il file: " & ogg & " !")
 +
 
 +
  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 (compressi)"
 +
  Print "Dimensione pcm:              "; ov_pcm_total(ovf, -1); " byte (pcm)"
 +
  Print "Numero seriale: "; ov_serialnumber(ovf, -1)
 +
  Print "\nDurata:                "; 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 "\nCommenti:"
 +
      For av = 0 To .comments - 1
 +
        Print String@(Pointer@(comm.user_comments + (8 * av)))
 +
      Next
 +
    Endif
 +
  End With
 +
 
 +
  ov_clear(ovf)
 +
 
 +
   
 +
'''End'''
 +
 
 +
 
 +
Di seguito un altro esempio:
 +
Library "libvorbisfile:3"
 
   
 
   
 
  Public Struct vorbis_comment
 
  Public Struct vorbis_comment
Riga 221: Riga 544:
 
      
 
      
 
  '''End'''
 
  '''End'''
 +
 +
  
  

Versione delle 18:07, 4 ago 2018

La libreria di VorbisFile consente di estrarre informazioni di carattere generale da un file audio OggVorbis.

E' necessario avere installata nel sistema e richiamare nel programma Gambas la libreria dinamica condivisa: libvorbisfile.so.3


Vediamo di seguito un primo esempio pratico:

Library "libvorbisfile"

Public Struct vorbis_comment
  user_comments As Pointer
  comment_lengths As Pointer
  comments As Integer
  vendor As Pointer
End Struct

Public Struct ogg_sync_state
  data As Pointer
  storage As Integer
  fill As Integer
  returned As Integer
  unisynced As Integer
  headerbytes As Integer
  bodybytes As Integer
End Struct

Public Struct ogg_stream_state
  body_data As Pointer
  body_storage As Long
  body_fill As Long
  body_returned As Long
  lacing_vals As Pointer
  granule_vals As Pointer
  lacing_storage As Long
  lacing_fill As Long
  lacing_packet As Long
  lacing_returned As Long
  header[282] As Byte
  header_fill As Integer
  e_o_s As Integer
  b_o_s As Integer
  serialno As Long
  pageno As Long
  packetno As Long
  granulepos As Long
End Struct

Public Struct vorbis_dsp_state
  analysisp As Integer
  vi As Pointer
  pcm As Pointer
  pcmret As Pointer
  pcm_storage As Integer
  pcm_current As Integer
  pcm_returned As Integer
  preextrapolate As Integer
  eofflag As Integer
  lW As Long
  W As Long
  nW As Long
  centerW As Long
  granulepos As Long
  sequence As Long
  glue_bits As Long
  time_bits As Long
  floor_bits As Long
  res_bits As Long
End Struct

Public Struct oggpack_buffer
  endbyte As Long
  endbit As Integer
  buffer As Pointer
  ptr As Pointer
  storage As Long
End Struct

Public Struct vorbis_block
  pcm As Pointer
  opb As Struct Oggpack_buffer
  lW As Long
  W As Long
  nW As Long
  pcmend As Integer
  mode As Integer
  eofflag As Integer
  granulepos As Long
  sequence As Long
  vd As Pointer
  localstore As Pointer
  localtop As Long
  localalloc As Long
  totaluse As Long
  reap As Pointer
  glue_bits As Long
  time_bits As Long
  floor_bits As Long
  res_bits As Long
  internal As Pointer
End Struct

Public Struct ov_callbacks
  fread As Pointer
  _ov_header_fseek_wrap As Pointer
  void As Pointer
  ftell As Pointer
End Struct

Public Struct OggVorbis_File
  datasource As Pointer
  seekable As Integer
  offset As Long
  end_ As Long
  oy As Struct Ogg_sync_state
  links As IntegerLibrary "libvorbisfile:3"

Public Struct vorbis_comment
  user_comments As Pointer
  comment_lengths As Pointer
  comments As Integer
  vendor As Pointer
End Struct

Public Struct ogg_sync_state
  data As Pointer
  storage As Integer
  fill As Integer
  returned As Integer
  unisynced As Integer
  headerbytes As Integer
  bodybytes As Integer
End Struct

Public Struct ogg_stream_state
  body_data As Pointer
  body_storage As Long
  body_fill As Long
  body_returned As Long
  lacing_vals As Pointer
  granule_vals As Pointer
  lacing_storage As Long
  lacing_fill As Long
  lacing_packet As Long
  lacing_returned As Long
  header[282] As Byte
  header_fill As Integer
  e_o_s As Integer
  b_o_s As Integer
  serialno As Long
  pageno As Long
  packetno As Long
  granulepos As Long
End Struct

Public Struct vorbis_dsp_state
  analysisp As Integer
  vi As Pointer
  pcm As Pointer
  pcmret As Pointer
  pcm_storage As Integer
  pcm_current As Integer
  pcm_returned As Integer
  preextrapolate As Integer
  eofflag As Integer
  lW As Long
  W As Long
  nW As Long
  centerW As Long
  granulepos As Long
  sequence As Long
  glue_bits As Long
  time_bits As Long
  floor_bits As Long
  res_bits As Long
End Struct

Public Struct oggpack_buffer
  endbyte As Long
  endbit As Integer
  buffer As Pointer
  ptr As Pointer
  storage As Long
End Struct

Public Struct vorbis_block
  pcm As Pointer
  opb As Struct Oggpack_buffer
  lW As Long
  W As Long
  nW As Long
  pcmend As Integer
  mode As Integer
  eofflag As Integer
  granulepos As Long
  sequence As Long
  vd As Pointer
  localstore As Pointer
  localtop As Long
  localalloc As Long
  totaluse As Long
  reap As Pointer
  glue_bits As Long
  time_bits As Long
  floor_bits As Long
  res_bits As Long
  internal As Pointer
End Struct

Public Struct ov_callbacks
  fread As Pointer
  _ov_header_fseek_wrap As Pointer
  void As Pointer
  ftell As Pointer
End Struct

Public Struct OggVorbis_File
  datasource As Pointer
  seekable As Integer
  offset As Long
  end_ As Long
  oy As Struct Ogg_sync_state
  links As Integer
  offsets As Pointer
  dataoffsets As Pointer
  serialnos As Pointer
  pcmlengths As Pointer
  vi As Pointer
  vc As Pointer
  pcm_offset As Long
  ready_state As Integer
  current_serialno As Long
  current_link As Integer
  bittrack As Float
  samptrack As Float
  os As Struct Ogg_stream_state
  vd As Struct Vorbis_dsp_state
  vb As Struct Vorbis_block
  callbacks As Struct Ov_callbacks
End Struct

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
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)
' Opens and initialize an OggVorbis_File structure.
Private Extern ov_fopen(path As String, vf As OggVorbis_File) 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 OggVorbis_File, i As Integer) As Long

' double ov_time_total(OggVorbis_File *vf,int i)
' Returns the total time in seconds of the physical bitstream or a specified logical bitstream.
Private Extern ov_time_total(vf As OggVorbis_File, 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

' long ov_serialnumber(OggVorbis_File *vf,int i)
' Returns the serialnumber of the specified logical bitstream link number within the overall physical bitstream.
Private Extern ov_serialnumber(vf As OggVorbis_File, i As Integer) As Long

' 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 av As Integer
    
 ogg = "/percorso/del/file.ogg"
  
 if ov_fopen(ogg, ovf) < 0 Then Error.Raise("Impossibile aprire il file: " & ogg & " !")
 
 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 (compressi)"
 Print "Dimensione pcm:              "; ov_pcm_total(ovf, -1); " byte (pcm)"
 Print "Numero seriale: "; ov_serialnumber(ovf, -1)
 Print "\nDurata:                "; 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 "\nCommenti:"
     For av = 0 To .comments - 1
       Print String@(Pointer@(comm.user_comments + (8 * av)))
     Next
   Endif
 End With
 
 ov_clear(ovf)
  
   
End


Di seguito un altro esempio: Library "libvorbisfile:3"

Public Struct vorbis_comment
  user_comments As Pointer
  comment_lengths As Pointer
  comments As Integer
  vendor As Pointer
End Struct

Public Struct ogg_sync_state
  data As Pointer
  storage As Integer
  fill As Integer
  returned As Integer
  unisynced As Integer
  headerbytes As Integer
  bodybytes As Integer
End Struct

Public Struct ogg_stream_state
  body_data As Pointer
  body_storage As Long
  body_fill As Long
  body_returned As Long
  lacing_vals As Pointer
  granule_vals As Pointer
  lacing_storage As Long
  lacing_fill As Long
  lacing_packet As Long
  lacing_returned As Long
  header[282] As Byte
  header_fill As Integer
  e_o_s As Integer
  b_o_s As Integer
  serialno As Long
  pageno As Long
  packetno As Long
  granulepos As Long
End Struct

Public Struct vorbis_dsp_state
  analysisp As Integer
  vi As Pointer
  pcm As Pointer
  pcmret As Pointer
  pcm_storage As Integer
  pcm_current As Integer
  pcm_returned As Integer
  preextrapolate As Integer
  eofflag As Integer
  lW As Long
  W As Long
  nW As Long
  centerW As Long
  granulepos As Long
  sequence As Long
  glue_bits As Long
  time_bits As Long
  floor_bits As Long
  res_bits As Long
End Struct

Public Struct oggpack_buffer
  endbyte As Long
  endbit As Integer
  buffer As Pointer
  ptr As Pointer
  storage As Long
End Struct

Public Struct vorbis_block
  pcm As Pointer
  opb As Struct Oggpack_buffer
  lW As Long
  W As Long
  nW As Long
  pcmend As Integer
  mode As Integer
  eofflag As Integer
  granulepos As Long
  sequence As Long
  vd As Pointer
  localstore As Pointer
  localtop As Long
  localalloc As Long
  totaluse As Long
  reap As Pointer
  glue_bits As Long
  time_bits As Long
  floor_bits As Long
  res_bits As Long
  internal As Pointer
End Struct

Public Struct ov_callbacks
  fread As Pointer
  _ov_header_fseek_wrap As Pointer
  void As Pointer
  ftell As Pointer
End Struct

Public Struct OggVorbis_File
  datasource As Pointer
  seekable As Integer
  offset As Long
  end_ As Long
  oy As Struct Ogg_sync_state
  links As Integer
  offsets As Pointer
  dataoffsets As Pointer
  serialnos As Pointer
  pcmlengths As Pointer
  vi As Pointer
  vc As Pointer
  pcm_offset As Long
  ready_state As Integer
  current_serialno As Long
  current_link As Integer
  bittrack As Float
  samptrack As Float
  os As Struct Ogg_stream_state
  vd As Struct Vorbis_dsp_state
  vb As Struct Vorbis_block
  callbacks As Struct Ov_callbacks
End Struct

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
End Struct
 
' int ov_fopen(const char *path,OggVorbis_File *vf)
' Opens and initialize an OggVorbis_File structure.
Private Extern ov_fopen(path As String, vf As OggVorbis_File) As Integer

' long ov_seekable(OggVorbis_File *vf)
' This indicates whether or not the bitstream is seekable.
Private Extern ov_seekable(vf As OggVorbis_File) As Long

' long ov_streams(OggVorbis_File *vf)
' Returns the number of logical bitstreams within our physical bitstream.
Private Extern ov_streams(vf As OggVorbis_File) As Long

' ogg_int64_t ov_pcm_total(OggVorbis_File *vf,int i)
' Returns the total pcm samples of the physical bitstream or a specified logical bitstream.
Private Extern ov_pcm_total(vf As OggVorbis_File, i As Integer) As Long

' vorbis_info *ov_info(OggVorbis_File *vf,int link)
' Returns the vorbis_info struct for the specified bitstream.
Private Extern ov_info(vf As OggVorbis_File, linkI As Integer) As Vorbis_info

' long ov_bitrate(OggVorbis_File *vf,int i)
' Returns the average bitrate for the specified logical bitstream.
Private Extern ov_bitrate(vf As OggVorbis_File, i As Integer) As Long

' long ov_serialnumber(OggVorbis_File *vf,int i)
' Returns the serialnumber of the specified logical bitstream link number within the overall physical bitstream.
Private Extern ov_serialnumber(vf As OggVorbis_File, i As Integer) As Long

' ogg_int64_t ov_raw_total(OggVorbis_File *vf,int i)
' Returns the total (compressed) bytes of the physical bitstream or a specified logical bitstream.
Private Extern ov_raw_total(vf As OggVorbis_File, i As Integer) As Long
 
' double ov_time_total(OggVorbis_File *vf,int i)
' Returns the total time in seconds of the physical bitstream or a specified logical bitstream.
Private Extern ov_time_total(vf As OggVorbis_File, 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 OggVorbis_File, lnk As Integer) As Pointer


Public Sub Main()

 Dim percorsoOGG As String
 Dim ovf As New OggVorbis_File
 Dim err, i As Integer
 Dim vi As Vorbis_info
 Dim vc As Vorbis_comment
    
  percorsoOGG = "/percorso/del/file.ogg"
  
  err = ov_fopen(percorsoOGG, ovf)
  If err < 0 Then Error.Raise("Impossibile aprire il file: " & percorsoOGG & " !")
   
  Print "File audio: "; percorsoOGG
  Print "\n==Caratteristiche del file audio==\n"
  
  If ov_seekable(ovf) Then
    Print "Il flusso di dati in ingresso è contenuto in "; ov_streams(ovf); " sezioni logiche di dati"
    Print "Totale campioni di dati: "; ov_pcm_total(ovf, -1)
  Else
    Print "Il file non ha consentito la ricerca."
    Print "Informazioni sul primo flusso di dati logico:\n"
  Endif
   
  For i = 0 To ov_streams(ovf) - 1
    vi = ov_info(ovf, i)
    Print "\n\tInformazioni sulla sezione "; i + 1; " di dati logici:"
    Print "\t\tFrequenza di campionamento: Hz "; vi.rate
    Print "\t\tCanali di uscita: "; vi.channels
    Print "\t\tBitrate: "; ov_bitrate(ovf, i) \ 1000; " kbps"
    Print "\t\tNumero seriale: "; ov_serialnumber(ovf, i)
    Print "\t\tLunghezza dell'header: "; Int@(ovf.dataoffsets + i) - Int@(ovf.offsets + i); " byte"
    Print "\t\tLunghezza file compresso: "; ov_raw_total(ovf, i); " byte"
    Print "\t\tDurata dell'esecuzione: "; CStr(Date(0, 0, 0, 0, 0, 0, ov_time_total(ovf, i) * 1000))
    vc = ov_comment(ovf, -1)
    Print "\t\tCodificato con "; String@(vc.vendor)
  Next
   
End




Riferimenti

[1] Vorbisfile Documentation