Differenze tra le versioni di "Riproduzione dell'audio di radio WEB con le funzioni esterne del API di GStreamer"

Da Gambas-it.org - Wikipedia.
 
(7 versioni intermedie di uno stesso utente non sono mostrate)
Riga 2: Riga 2:
  
  
===Uso del plug-in ''playbin''===
+
==Uso del plug-in ''playbin''==
 
  Private play As Pointer
 
  Private play As Pointer
 
   
 
   
Riga 31: Riga 31:
 
   
 
   
 
   
 
   
  '''Public''' Sub Form_Open()
+
  Public Sub Form_Open()
 
   
 
   
Dim retI As Integer
+
  Dim retI As Integer
 
   
 
   
 
   gst_init(0, 0)
 
   gst_init(0, 0)
Riga 39: Riga 39:
 
   play = gst_element_factory_make("playbin", "play")
 
   play = gst_element_factory_make("playbin", "play")
 
   
 
   
  <FONT color=gray>' ''Nel terzo argomento della seguente funzione va inserito''
+
  <FONT color=gray>' ''Nel terzo argomento della seguente funzione va inserito l'indirizzo web del flusso di dati audio in tempo reale:''</font>
' ''l'indirizzo web del flusso di dati audio in tempo reale:''</font>
+
   g_object_set(play, "uri", "https&#058;//funkyradio.streamingmedia.it/audio.aac", Null)
   g_object_set(play, "uri", "<FONT color=gray>''http&#058;//indirizzo/web/del/flusso/dati/della/radio-web''</font>", Null)
 
 
   
 
   
  <FONT color=gray>' ''Avviamo la riproduzione audio della radio-web:''</font>
+
  <FONT color=gray>' ''Avvia la riproduzione audio della radio-web:''</font>
 
   retI = gst_element_set_state(play, GST_STATE_PLAYING)
 
   retI = gst_element_set_state(play, GST_STATE_PLAYING)
 
   Print "Stato di cambiamento = "; retI
 
   Print "Stato di cambiamento = "; retI
 
   
 
   
  '''End'''
+
  End
 
   
 
   
 
   
 
   
  '''Public''' Sub Button1_Click()
+
  Public Sub Button1_Click()
 
   
 
   
Dim retI As Integer
+
  Dim retI As Integer
 
   
 
   
  <FONT color=gray>' ''Arrestiamo la riproduzione audio:''</font>
+
  <FONT color=gray>' ''Arresta la riproduzione audio:''</font>
 
   retI = gst_element_set_state(play, GST_STATE_NULL)
 
   retI = gst_element_set_state(play, GST_STATE_NULL)
 
   Print "Stato di cambiamento = "; retI
 
   Print "Stato di cambiamento = "; retI
Riga 60: Riga 59:
 
   gst_object_unref(play)
 
   gst_object_unref(play)
 
   
 
   
  '''End'''
+
  End
  
  
===Uso della funzione ''gst_parse_launch( )'' e il plugin "''uridecodebin''"===
+
==Uso della funzione ''gst_parse_launch( )'' e il plugin "''uridecodebin''"==
 
Nell'esempio, che segue, sarà sufficiente premere il tasto "Invio" per chiudere il programma.
 
Nell'esempio, che segue, sarà sufficiente premere il tasto "Invio" per chiudere il programma.
 
  Private bo As Boolean
 
  Private bo As Boolean
Riga 94: Riga 93:
 
   
 
   
 
   
 
   
  '''Public''' Sub Main()
+
  Public Sub Main()
 
   
 
   
 
   Dim audio As Pointer
 
   Dim audio As Pointer
 
   Dim pos As Long
 
   Dim pos As Long
 
      
 
      
  gst_init(0, 0)
+
  gst_init(0, 0)
 
    
 
    
  audio = gst_parse_launch("uridecodebin uri=<FONT color=gray>''http&#058;//indirizzo/della/radio/web/live''</font> ! autoaudiosink", 0)
+
  audio = gst_parse_launch("uridecodebin uri=<FONT color=darkgreen>''http&#058;//indirizzo/del/flusso/della/radio/web/live''</font> ! audioconvert ! autoaudiosink", 0)
 
        
 
        
  <FONT color=gray>' ''Avviamo l'esecuzione audio della radio web:''</font>
+
  <FONT color=gray>' ''Avvia l'esecuzione audio della radio web:''</font>
  gst_element_set_state(audio, GST_STATE_PLAYING)
+
  gst_element_set_state(audio, GST_STATE_PLAYING)
 
    
 
    
  Repeat
+
  Repeat
 
     gst_element_query_position(audio, GST_FORMAT_TIME, VarPtr(pos))
 
     gst_element_query_position(audio, GST_FORMAT_TIME, VarPtr(pos))
     Write "\rTempo trascorso: " & Date(0, 0, 0, 0, 0, 0, pos / 1000000)
+
     Write "\rTempo trascorso: " & Str(Time(0, 0, 0, pos / 1000000))
     Wait 0.001
+
     Wait 0.01
 
   Until bo = True
 
   Until bo = True
 
    
 
    
Riga 116: Riga 115:
 
   Quit
 
   Quit
 
    
 
    
  '''End'''
+
  End
 +
 +
 +
Public Sub Application_Read()  <FONT color=gray>' ''Premendo il tasto "Invio", si chiuderà il programma''</font>
 +
 
 +
  bo = True
 +
 
 +
End
 +
 
 +
===Riproduzione audio e finale registrazione del flusso di una radio-web in un file MP3===
 +
Private bo As Boolean
 +
 +
 +
Library "libgstreamer-1.0"
 +
 +
Private Enum GST_STATE_VOID_PENDING = 0, GST_STATE_NULL, GST_STATE_READY, GST_STATE_PAUSED, GST_STATE_PLAYING
 +
Private Const GST_FORMAT_TIME As Integer = 3
 +
 +
<FONT color=gray>' ''gst_init (int *argc, char **argv[])''
 +
' ''Initializes the GStreamer library, setting up internal path lists, registering built-in elements, and loading standard plugins.''</font>
 +
Private Extern gst_init(argc As Pointer, argv As Pointer)
 +
 +
<FONT color=gray>' ''GstElement * gst_parse_launch (const gchar *pipeline_description, GError **error)
 +
' ''Create a new pipeline based on command line syntax.''</font>
 +
Private Extern gst_parse_launch(description As String, GError As Pointer) As Pointer
 +
 +
<FONT color=gray>' ''GstStateChangeReturn gst_element_set_state(GstElement *element, GstState state)
 +
' ''Sets the state of the element.''</font>
 +
Private Extern gst_element_set_state(gstelement As Pointer, state As Integer) As Integer
 +
 +
<FONT color=gray>' ''gboolean gst_element_query_position (GstElement *element, GstFormat format, gint64 *cur)
 +
' ''Queries an element for the stream position in nanoseconds.''</font>
 +
Private Extern gst_element_query_position(gstelement As Pointer, gstformat As Pointer, cur As Pointer) As Boolean
 +
 +
<FONT color=gray>' ''void gst_object_unref(gpointer object)
 +
' ''Decrements the reference count on object.''</font>
 +
Private Extern gst_object_unref(gobject As Pointer)
 +
 
   
 
   
 +
Public Sub Main()
 
   
 
   
  '''Public''' Sub Application_Read()
+
  Dim audio As Pointer
 +
  Dim pos As Long
 +
   
 +
  gst_init(0, 0)
 +
 
 +
  audio = gst_parse_launch("uridecodebin uri=<FONT color=darkgreen>''http&#058;//indirizzo/del/flusso/della/radio/web/live''</font> ! audioconvert ! tee name=radio ! queue ! autoaudiosink radio. ! queue ! lamemp3enc target=bitrate bitrate=128 cbr=true ! filesink location=/tmp/output.mp3", 0)
 +
     
 +
  <FONT color=gray>' ''Avvia l'esecuzione audio della radio web:''</font>
 +
  gst_element_set_state(audio, GST_STATE_PLAYING)
 +
 
 +
  Repeat
 +
    gst_element_query_position(audio, GST_FORMAT_TIME, VarPtr(pos))
 +
    Write "\rTempo trascorso: " & Str(Time(0, 0, 0, pos / 1000000))
 +
    Wait 0.01
 +
  Until bo = True
 
    
 
    
   Dim s As String
+
   gst_object_unref(audio)
 
    
 
    
   Input s
+
   Quit
 +
 
 +
End
 +
 +
 +
Public Sub Application_Read()  <FONT color=gray>' ''Premendo il tasto "Invio", si chiuderà il programma''</font>
 
    
 
    
 
   bo = True
 
   bo = True
 
    
 
    
  '''End'''
+
  End
 
 
  
===Uso della funzione ''gst_parse_launch( )'' e i plugin "''souphttpsrc''" e "''decodebin''"===
+
==Uso della funzione ''gst_parse_launch( )'' e i plugin "''souphttpsrc''" e "''decodebin''"==
 
Nell'esempio, che segue, sarà sufficiente premere il tasto "Invio" per chiudere il programma.
 
Nell'esempio, che segue, sarà sufficiente premere il tasto "Invio" per chiudere il programma.
 
  Private bo As Boolean
 
  Private bo As Boolean
Riga 161: Riga 216:
 
   
 
   
 
   
 
   
  '''Public''' Sub Main()
+
  Public Sub Main()
 
   
 
   
 
   Dim audio As Pointer
 
   Dim audio As Pointer
 
   Dim pos As Long
 
   Dim pos As Long
 
      
 
      
  gst_init(0, 0)
+
  gst_init(0, 0)
 
    
 
    
  audio = gst_parse_launch("souphttpsrc location=<FONT color=gray>''http&#058;//indirizzo/della/radio/web/live''</font> ! decodebin ! autoaudiosink", 0)
+
  audio = gst_parse_launch("souphttpsrc location=<FONT color=darkgreen>''http&#058;//indirizzo/del/flusso/della/radio/web/live''</font> ! decodebin ! audioconvert ! autoaudiosink", 0)
 
        
 
        
  <FONT color=gray>' ''Avviamo l'esecuzione audio della radio web:''</font>
+
  <FONT color=gray>' ''Avvia l'esecuzione audio della radio web:''</font>
  gst_element_set_state(audio, GST_STATE_PLAYING)
+
  gst_element_set_state(audio, GST_STATE_PLAYING)
 
    
 
    
  Repeat
+
  Repeat
 
     gst_element_query_position(audio, GST_FORMAT_TIME, VarPtr(pos))
 
     gst_element_query_position(audio, GST_FORMAT_TIME, VarPtr(pos))
     Write "\rTempo trascorso: " & Date(0, 0, 0, 0, 0, 0, pos / 1000000)
+
     Write "\rTempo trascorso: " & Str(Time(0, 0, 0, pos / 1000000))
     Wait 0.001
+
     Wait 0.01
 
   Until bo = True
 
   Until bo = True
 
    
 
    
Riga 183: Riga 238:
 
   Quit
 
   Quit
 
    
 
    
  '''End'''
+
  End
 
   
 
   
 
   
 
   
  '''Public''' Sub Application_Read()
+
  Public Sub Application_Read()  <FONT color=gray>' ''Premendo il tasto "Invio", si chiuderà il programma''</font>
 
 
  Dim s As String
 
 
 
  Input s
 
 
    
 
    
 
   bo = True
 
   bo = True
 
    
 
    
  '''End'''
+
  End
  
  
  
===Uso della funzione ''gst_parse_launch( )'' e del plugin ''jackaudiosink''===
+
==Uso della funzione ''gst_parse_launch( )'' e del plugin ''jackaudiosink''==
 
Per l'esecuzione del seguente codice è necessario avviare preliminarmente il programma ''Jack''.
 
Per l'esecuzione del seguente codice è necessario avviare preliminarmente il programma ''Jack''.
 
<BR>Sarà sufficiente premere il tasto "Invio" per chiudere il programma.
 
<BR>Sarà sufficiente premere il tasto "Invio" per chiudere il programma.
Riga 230: Riga 281:
 
   
 
   
 
   
 
   
  '''Public''' Sub Main()
+
  Public Sub Main()
 
   
 
   
 
   Dim audio As Pointer
 
   Dim audio As Pointer
 
   Dim pos As Long
 
   Dim pos As Long
 
      
 
      
  gst_init(0, 0)
+
  gst_init(0, 0)
 
    
 
    
  audio = gst_parse_launch("uridecodebin uri=<FONT color=gray>''http&#058;//indirizzo/della/radio/web/live''</font> ! audioconvert ! audioresample ! <FONT color=#B22222>jackaudiosink</font>", 0)
+
  audio = gst_parse_launch("uridecodebin uri=http&#058;//maxxima.mine.nu:8080/maxxima.mp3 ! audioconvert ! audioresample ! <FONT color=#B22222>jackaudiosink</font>", 0)
 
        
 
        
  <FONT color=gray>' ''Avviamo l'esecuzione audio della radio web:''</font>
+
  <FONT color=gray>' ''Avvia l'esecuzione audio della radio web:''</font>
  gst_element_set_state(audio, GST_STATE_PLAYING)
+
  gst_element_set_state(audio, GST_STATE_PLAYING)
 
    
 
    
  Repeat
+
  Repeat
 
     gst_element_query_position(audio, GST_FORMAT_TIME, VarPtr(pos))
 
     gst_element_query_position(audio, GST_FORMAT_TIME, VarPtr(pos))
     Write "\rTempo trascorso: " & Date(0, 0, 0, 0, 0, 0, pos / 1000000)
+
     Write "\rTempo trascorso: " & Str(Time(0, 0, 0, pos / 1000000))
     Wait 0.001
+
     Wait 0.01
 
   Until bo = True
 
   Until bo = True
 
    
 
    
Riga 252: Riga 303:
 
   Quit
 
   Quit
 
    
 
    
  '''End'''
+
  End
 
   
 
   
 
   
 
   
  '''Public''' Sub Application_Read()
+
  Public Sub Application_Read()  <FONT color=gray>' ''Premendo il tasto "Invio", si chiuderà il programma''</font>
 
 
  Dim s As String
 
 
 
  Input s
 
 
    
 
    
 
   bo = True
 
   bo = True
 
    
 
    
  '''End'''
+
  End

Versione attuale delle 09:40, 16 gen 2024

Le stazioni radio via WEB possono essere ascoltate utilizzando le risorse del API di GStreamer.


Uso del plug-in playbin

Private play As Pointer

Library "libgstreamer-1.0"

Private Const GST_STATE_NULL As Integer = 1
Private Const GST_STATE_PLAYING As Integer = 4

' gst_init (&argc, &argv)
' Initializes the GStreamer library, setting up internal path lists, registering built-in elements, and loading standard plugins.
Private Extern gst_init(argc As Integer, argv As Pointer)

' GstElement * gst_element_factory_make(const gchar *factoryname, Const gchar * name)
' Create a new element of the type defined by the given element factory.
Private Extern gst_element_factory_make(factoryname As String, name As String) As Pointer

' void g_object_set(gpointer object, const gchar *first_property_name, ...)
' Sets properties on an object.
Private Extern g_object_set(gobject As Pointer, key As String, value As String, nl As String)

' GstStateChangeReturn gst_element_set_state(GstElement *element, GstState state)
' Sets the state of the element.
Private Extern gst_element_set_state(gstobject As Pointer, state As Integer) As Integer

' void gst_object_unref(gpointer object)
' Decrements the reference count on object .
Private Extern gst_object_unref(gobject As Pointer)


Public Sub Form_Open()

 Dim retI As Integer

 gst_init(0, 0)

 play = gst_element_factory_make("playbin", "play")

' Nel terzo argomento della seguente funzione va inserito l'indirizzo web del flusso di dati audio in tempo reale:
 g_object_set(play, "uri", "https://funkyradio.streamingmedia.it/audio.aac", Null)

' Avvia la riproduzione audio della radio-web:
 retI = gst_element_set_state(play, GST_STATE_PLAYING)
 Print "Stato di cambiamento = "; retI

End


Public Sub Button1_Click()

 Dim retI As Integer

' Arresta la riproduzione audio:
 retI = gst_element_set_state(play, GST_STATE_NULL)
 Print "Stato di cambiamento = "; retI
  
 gst_object_unref(play)

End


Uso della funzione gst_parse_launch( ) e il plugin "uridecodebin"

Nell'esempio, che segue, sarà sufficiente premere il tasto "Invio" per chiudere il programma.

Private bo As Boolean


Library "libgstreamer-1.0"

Private Enum GST_STATE_VOID_PENDING = 0, GST_STATE_NULL, GST_STATE_READY, GST_STATE_PAUSED, GST_STATE_PLAYING
Private Const GST_FORMAT_TIME As Integer = 3

' gst_init (int *argc, char **argv[])
' Initializes the GStreamer library, setting up internal path lists, registering built-in elements, and loading standard plugins.
Private Extern gst_init(argc As Pointer, argv As Pointer)

' GstElement * gst_parse_launch (const gchar *pipeline_description, GError **error)
' Create a new pipeline based on command line syntax.
Private Extern gst_parse_launch(description As String, GError As Pointer) As Pointer

' GstStateChangeReturn gst_element_set_state(GstElement *element, GstState state)
' Sets the state of the element.
Private Extern gst_element_set_state(gstelement As Pointer, state As Integer) As Integer

' gboolean gst_element_query_position (GstElement *element, GstFormat format, gint64 *cur)
' Queries an element for the stream position in nanoseconds.
Private Extern gst_element_query_position(gstelement As Pointer, gstformat As Pointer, cur As Pointer) As Boolean

' void gst_object_unref(gpointer object)
' Decrements the reference count on object.
Private Extern gst_object_unref(gobject As Pointer)


Public Sub Main()

 Dim audio As Pointer
 Dim pos As Long
    
 gst_init(0, 0)
  
 audio = gst_parse_launch("uridecodebin uri=http://indirizzo/del/flusso/della/radio/web/live ! audioconvert ! autoaudiosink", 0)
      
' Avvia l'esecuzione audio della radio web:
 gst_element_set_state(audio, GST_STATE_PLAYING)
  
 Repeat
   gst_element_query_position(audio, GST_FORMAT_TIME, VarPtr(pos))
   Write "\rTempo trascorso: " & Str(Time(0, 0, 0, pos / 1000000))
   Wait 0.01
 Until bo = True
 
 gst_object_unref(audio)
 
 Quit
 
End


Public Sub Application_Read()  ' Premendo il tasto "Invio", si chiuderà il programma
 
 bo = True
 
End

Riproduzione audio e finale registrazione del flusso di una radio-web in un file MP3

Private bo As Boolean


Library "libgstreamer-1.0"

Private Enum GST_STATE_VOID_PENDING = 0, GST_STATE_NULL, GST_STATE_READY, GST_STATE_PAUSED, GST_STATE_PLAYING
Private Const GST_FORMAT_TIME As Integer = 3

' gst_init (int *argc, char **argv[])
' Initializes the GStreamer library, setting up internal path lists, registering built-in elements, and loading standard plugins.
Private Extern gst_init(argc As Pointer, argv As Pointer)

' GstElement * gst_parse_launch (const gchar *pipeline_description, GError **error)
' Create a new pipeline based on command line syntax.
Private Extern gst_parse_launch(description As String, GError As Pointer) As Pointer

' GstStateChangeReturn gst_element_set_state(GstElement *element, GstState state)
' Sets the state of the element.
Private Extern gst_element_set_state(gstelement As Pointer, state As Integer) As Integer

' gboolean gst_element_query_position (GstElement *element, GstFormat format, gint64 *cur)
' Queries an element for the stream position in nanoseconds.
Private Extern gst_element_query_position(gstelement As Pointer, gstformat As Pointer, cur As Pointer) As Boolean

' void gst_object_unref(gpointer object)
' Decrements the reference count on object.
Private Extern gst_object_unref(gobject As Pointer)


Public Sub Main()

 Dim audio As Pointer
 Dim pos As Long
    
 gst_init(0, 0)
  
 audio = gst_parse_launch("uridecodebin uri=http://indirizzo/del/flusso/della/radio/web/live ! audioconvert ! tee name=radio ! queue ! autoaudiosink radio. ! queue ! lamemp3enc target=bitrate bitrate=128 cbr=true ! filesink location=/tmp/output.mp3", 0)
      
' Avvia l'esecuzione audio della radio web:
 gst_element_set_state(audio, GST_STATE_PLAYING)
  
 Repeat
   gst_element_query_position(audio, GST_FORMAT_TIME, VarPtr(pos))
   Write "\rTempo trascorso: " & Str(Time(0, 0, 0, pos / 1000000))
   Wait 0.01
 Until bo = True
 
 gst_object_unref(audio)
 
 Quit
 
End


Public Sub Application_Read()  ' Premendo il tasto "Invio", si chiuderà il programma
 
 bo = True
 
End

Uso della funzione gst_parse_launch( ) e i plugin "souphttpsrc" e "decodebin"

Nell'esempio, che segue, sarà sufficiente premere il tasto "Invio" per chiudere il programma.

Private bo As Boolean


Library "libgstreamer-1.0"

Private Enum GST_STATE_VOID_PENDING = 0, GST_STATE_NULL, GST_STATE_READY, GST_STATE_PAUSED, GST_STATE_PLAYING
Private Const GST_FORMAT_TIME As Integer = 3

' gst_init (int *argc, char **argv[])
' Initializes the GStreamer library, setting up internal path lists, registering built-in elements, and loading standard plugins.
Private Extern gst_init(argc As Pointer, argv As Pointer)

' GstElement * gst_parse_launch (const gchar *pipeline_description, GError **error)
' Create a new pipeline based on command line syntax.
Private Extern gst_parse_launch(description As String, GError As Pointer) As Pointer

' GstStateChangeReturn gst_element_set_state(GstElement *element, GstState state)
' Sets the state of the element.
Private Extern gst_element_set_state(gstelement As Pointer, state As Integer) As Integer

' gboolean gst_element_query_position (GstElement *element, GstFormat format, gint64 *cur)
' Queries an element for the stream position in nanoseconds.
Private Extern gst_element_query_position(gstelement As Pointer, gstformat As Pointer, cur As Pointer) As Boolean

' void gst_object_unref(gpointer object)
' Decrements the reference count on object.
Private Extern gst_object_unref(gobject As Pointer)


Public Sub Main()

 Dim audio As Pointer
 Dim pos As Long
    
 gst_init(0, 0)
  
 audio = gst_parse_launch("souphttpsrc location=http://indirizzo/del/flusso/della/radio/web/live ! decodebin ! audioconvert ! autoaudiosink", 0)
      
' Avvia l'esecuzione audio della radio web:
 gst_element_set_state(audio, GST_STATE_PLAYING)
  
 Repeat
   gst_element_query_position(audio, GST_FORMAT_TIME, VarPtr(pos))
   Write "\rTempo trascorso: " & Str(Time(0, 0, 0, pos / 1000000))
   Wait 0.01
 Until bo = True
 
 gst_object_unref(audio)
 
 Quit
 
End


Public Sub Application_Read()  ' Premendo il tasto "Invio", si chiuderà il programma
 
 bo = True
 
End


Uso della funzione gst_parse_launch( ) e del plugin jackaudiosink

Per l'esecuzione del seguente codice è necessario avviare preliminarmente il programma Jack.
Sarà sufficiente premere il tasto "Invio" per chiudere il programma.

Private bo As Boolean


Library "libgstreamer-1.0"

Private Enum GST_STATE_VOID_PENDING = 0, GST_STATE_NULL, GST_STATE_READY, GST_STATE_PAUSED, GST_STATE_PLAYING
Private Const GST_FORMAT_TIME As Integer = 3

' gst_init (int *argc, char **argv[])
' Initializes the GStreamer library, setting up internal path lists, registering built-in elements, and loading standard plugins.
Private Extern gst_init(argc As Pointer, argv As Pointer)

' GstElement * gst_parse_launch (const gchar *pipeline_description, GError **error)
' Create a new pipeline based on command line syntax.
Private Extern gst_parse_launch(description As String, GError As Pointer) As Pointer

' GstStateChangeReturn gst_element_set_state(GstElement *element, GstState state)
' Sets the state of the element.
Private Extern gst_element_set_state(gstelement As Pointer, state As Integer) As Integer

' gboolean gst_element_query_position (GstElement *element, GstFormat format, gint64 *cur)
' Queries an element for the stream position in nanoseconds.
Private Extern gst_element_query_position(gstelement As Pointer, gstformat As Pointer, cur As Pointer) As Boolean

' void gst_object_unref(gpointer object)
' Decrements the reference count on object.
Private Extern gst_object_unref(gobject As Pointer)


Public Sub Main()

 Dim audio As Pointer
 Dim pos As Long
    
 gst_init(0, 0)
  
 audio = gst_parse_launch("uridecodebin uri=http://maxxima.mine.nu:8080/maxxima.mp3 ! audioconvert ! audioresample ! jackaudiosink", 0)
      
' Avvia l'esecuzione audio della radio web:
 gst_element_set_state(audio, GST_STATE_PLAYING)
  
 Repeat
   gst_element_query_position(audio, GST_FORMAT_TIME, VarPtr(pos))
   Write "\rTempo trascorso: " & Str(Time(0, 0, 0, pos / 1000000))
   Wait 0.01
 Until bo = True
 
 gst_object_unref(audio)
 
 Quit
 
End


Public Sub Application_Read()  ' Premendo il tasto "Invio", si chiuderà il programma
 
 bo = True
 
End