Tenemos que activar los Componentes gb.desktop y gb.dsktop.x11 .
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_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
' gchar * g_filename_to_uri (const gchar *filename, const gchar *hostname, GError **error)
' Converts an absolute filename to an escaped ASCII-encoded URI.
Private Extern g_filename_to_uri(filename As String, hostname As String, GError As Pointer) As String
' 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, tertium As String)
' 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_duration (GstElement *element, GstFormat format, gint64 *duration)
' Queries an element for the total stream duration in nanoseconds.
Private Extern gst_element_query_duration(gstelement As Pointer, gstformat As Pointer, duration As Pointer) As Boolean
' 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
Library "libgstvideo-1.0"
' void gst_video_overlay_set_window_handle (GstVideoOverlay *overlay, guintptr handle)
' Calls the video overlay's set_window_handle method.
Private Extern gst_video_overlay_set_window_handle(overlay As Pointer, handle As Long)
Public Sub Button1_Click()
Dim video As Pointer
Dim fileVideo As String
Dim posizione, durata As Long
Dim id As Integer
Dim dw As DesktopWindow
fileVideo = "/ruta/del/archivo/video"
gst_init(0, 0)
video = gst_element_factory_make("playbin", "video")
g_object_set(video, "uri", g_filename_to_uri(fileVideo, Null, 0), Null)
' Seteamos el nombre ****visible**** (como lo veis escrito en el "margen superior") de la ventana de "gedit" (o... si estais muy locos, de la ventana de una Carpeta):
For Each dw In Desktop.Windows
If dw.VisibleName = "gedit" Then id = dw.Id
Next
if id = 0 then Error.Raise("El nombre seteado de la ventana no es exacto !\nDebe ser el nombre \"visible\" en el margen superior de la ventana.!")
gst_video_overlay_set_window_handle(video, CLong(id))
gst_element_set_state(video, GST_STATE_PLAYING)
While (posizione = 0) Or (durata > posizione)
gst_element_query_duration(video, GST_FORMAT_TIME, VarPtr(durata))
gst_element_query_position(video, GST_FORMAT_TIME, VarPtr(posizione))
Write #File.Out, "\rDuración: " & Date(0, 0, 0, 0, 0, 0, durata / 1000000) & " Pos. " & Date(0, 0, 0, 0, 0, 0, posizione / 1000000)
Wait 0.01
Wend
End
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_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
' gchar * g_filename_to_uri (const gchar *filename, const gchar *hostname, GError **error)
' Converts an absolute filename to an escaped ASCII-encoded URI.
Private Extern g_filename_to_uri(filename As String, hostname As String, GError As Pointer) As String
' 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, tertium As String)
' 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_duration (GstElement *element, GstFormat format, gint64 *duration)
' Queries an element for the total stream duration in nanoseconds.
Private Extern gst_element_query_duration(gstelement As Pointer, gstformat As Pointer, duration As Pointer) As Boolean
' 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
Library "libgstvideo-1.0"
' void gst_video_overlay_set_window_handle (GstVideoOverlay *overlay, guintptr handle)
' Calls the video overlay's set_window_handle method.
Private Extern gst_video_overlay_set_window_handle(overlay As Pointer, handle As Long)
Public Sub Button1_Click()
Dim video As Pointer
Dim fileVideo As String
Dim posizione, durata As Long
Dim id As Integer
Dim dw As DesktopWindow
fileVideo = "/ruta/del/archivo/video"
gst_init(0, 0)
video = gst_element_factory_make("playbin", "video")
g_object_set(video, "uri", g_filename_to_uri(fileVideo, Null, 0), Null)
' Seteamos el nombre ****visible**** (como lo veis escrito en el "margen superior") de la ventana de "gedit" (o... si estais muy locos, de la ventana de una Carpeta):
For Each dw In Desktop.Windows
If dw.VisibleName = "gedit" Then id = dw.Id
Next
if id = 0 then Error.Raise("El nombre seteado de la ventana no es exacto !\nDebe ser el nombre \"visible\" en el margen superior de la ventana.!")
gst_video_overlay_set_window_handle(video, CLong(id))
gst_element_set_state(video, GST_STATE_PLAYING)
While (posizione = 0) Or (durata > posizione)
gst_element_query_duration(video, GST_FORMAT_TIME, VarPtr(durata))
gst_element_query_position(video, GST_FORMAT_TIME, VarPtr(posizione))
Write #File.Out, "\rDuración: " & Date(0, 0, 0, 0, 0, 0, durata / 1000000) & " Pos. " & Date(0, 0, 0, 0, 0, 0, posizione / 1000000)
Wait 0.01
Wend
End
...pero vosotros podeis estar más lcos que yo usando la ventana de una Carpeta !