Re: [Gambas-user] MediaPlayer bug with AboutToFinish and URL?

2016-10-18 Thread Benoît Minisini
Le 18/10/2016 à 13:18, Piper984 a écrit :
> OK, thanks for continuing to look into it!
>
> In case it helps: Below is a Python script + Gstreamer lib where setting the
> URL property behaves as expected.  It just toggles between playing two video
> clips, setting the URL property when the 'about-to-finish' event fires. Not
> sure if this will be of any use, but it might?  I ran this script w/ Ubuntu
> 16.04 and GStreamer 1.8.2, which is a different system than the one I
> originally asked about.  I have confirmed that running Gambas 3.9.0 on the
> same system that the Python script below runs doesn't behave as expected.
>
> Thanks again!
>

OK, I understood the problem:

If you want to define the next media to play, you HAVE TO do it during 
the 'about-to-finish' GStreamer signal, which is not run in the main thread.

As Gambas is not multi-threaded, its 'AboutToFinish' event is a delayed 
version of the 'about-to-finish' signal, raised in the main thread.

And apparently, setting the uri outside of the 'about-to-finish' leads 
to unexpected result, and to deadlock on my system.

When I say that GStreamer is an huge sensitive beast... :-/

Now I will try to find a workaround.

Regards,

-- 
Benoît Minisini

--
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] MediaPlayer bug with AboutToFinish and URL?

2016-10-18 Thread Benoît Minisini
Le 18/10/2016 à 13:18, Piper984 a écrit :
> OK, thanks for continuing to look into it!
>
> In case it helps: Below is a Python script + Gstreamer lib where setting the
> URL property behaves as expected.  It just toggles between playing two video
> clips, setting the URL property when the 'about-to-finish' event fires. Not
> sure if this will be of any use, but it might?  I ran this script w/ Ubuntu
> 16.04 and GStreamer 1.8.2, which is a different system than the one I
> originally asked about.  I have confirmed that running Gambas 3.9.0 on the
> same system that the Python script below runs doesn't behave as expected.
>
> Thanks again!
>

Can you send the python code as a file attachment?

Thanks.

-- 
Benoît Minisini

--
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] MediaPlayer bug with AboutToFinish and URL?

2016-10-18 Thread Piper984
OK, thanks for continuing to look into it!

In case it helps: Below is a Python script + Gstreamer lib where setting the
URL property behaves as expected.  It just toggles between playing two video
clips, setting the URL property when the 'about-to-finish' event fires. Not
sure if this will be of any use, but it might?  I ran this script w/ Ubuntu
16.04 and GStreamer 1.8.2, which is a different system than the one I
originally asked about.  I have confirmed that running Gambas 3.9.0 on the
same system that the Python script below runs doesn't behave as expected.

Thanks again!


#!/usr/bin/env python

import sys, os
import gi
gi.require_version('Gst', '1.0')
gi.require_version('Gtk', '3.0')
gi.require_version('GstVideo', '1.0') 
from gi.repository import Gst, GObject, Gtk
 
# Needed for window.get_xid(), xvimagesink.set_window_handle(),
respectively:
from gi.repository import GdkX11, GstVideo

class GTK_Main(object):
  
def __init__(self):
window = Gtk.Window(Gtk.WindowType.TOPLEVEL)
window.set_title("Video-Player")
window.set_default_size(500, 400)
window.connect("destroy", Gtk.main_quit, "WM destroy")
vbox = Gtk.VBox()
window.add(vbox)
hbox = Gtk.HBox()
vbox.pack_start(hbox, False, False, 0)
self.entry = Gtk.Entry()
hbox.add(self.entry)
self.button = Gtk.Button("Start")
hbox.pack_start(self.button, False, False, 0)
self.button.connect("clicked", self.start_stop)
self.movie_window = Gtk.DrawingArea()
vbox.add(self.movie_window)
window.show_all()
self.iPos = 0
self.player = Gst.ElementFactory.make("playbin", "player")
bus = self.player.get_bus()
bus.add_signal_watch()
bus.enable_sync_message_emission()
bus.connect("message", self.on_message)
bus.connect("sync-message::element", self.on_sync_message)
self.player.connect("about-to-finish",  self.finished)


def finished(self, player):
print "About to Finish"
if self.iPos == 0:
self.player.set_property("uri", 
"file:///home/chris/Desktop/test5.mp4" )
self.iPos = 1
else:
self.player.set_property("uri", 
"file:///home/chris/Desktop/output.mp4" )
self.iPos = 0

def start_stop(self, w):
if self.button.get_label() == "Start":
filepath = self.entry.get_text().strip()
if os.path.isfile(filepath):
filepath = os.path.realpath(filepath)
self.button.set_label("Stop")
self.player.set_property("uri", 
"file:///home/chris/Desktop/output.mp4"
)
self.player.set_state(Gst.State.PLAYING)
else:
self.player.set_state(Gst.State.NULL)
self.button.set_label("Start")  

def on_message(self, bus, message):
t = message.type
if t == Gst.MessageType.EOS:
self.player.set_state(Gst.State.NULL)
self.button.set_label("Start")
elif t == Gst.MessageType.ERROR:
self.player.set_state(Gst.State.NULL)
err, debug = message.parse_error()
print "Error: %s" % err, debug
self.button.set_label("Start")

def on_sync_message(self, bus, message):
if message.get_structure().get_name() == 
'prepare-window-handle':
imagesink = message.src
imagesink.set_property("force-aspect-ratio", True)

imagesink.set_window_handle(self.movie_window.get_property('window').get_xid())
 

GObject.threads_init()
Gst.init(None)
GTK_Main()
Gtk.main()










--
View this message in context: 
http://gambas.8142.n7.nabble.com/MediaPlayer-bug-with-AboutToFinish-and-URL-tp57513p57595.html
Sent from the gambas-user mailing list archive at Nabble.com.

--
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] MediaPlayer bug with AboutToFinish and URL?

2016-10-18 Thread Benoît Minisini
Le 18/10/2016 à 01:01, Piper984 a écrit :
> Hi Benoît,
>
> Just checking in to see if you were able to learn any more regarding setting
> the URI during the about to finish event for the MediaPlayer component?
>
> Thanks and regards!
>

I started working on the problem, but just to not be able to reproduce 
yours, but find other ones. At the moment, when I try to change the URL 
property, GStreamer deadlocks, and the program freezes.

Maybe it's gb.media code's fault, but I didn't found what is wrong in it 
yet.

Regards,

-- 
Benoît Minisini

--
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] New update on Gambas Farm

2016-10-18 Thread Gianluigi
Hi Jorge,
Upgraded, thanks. :-)
Regards
Gianluigi

2016-10-18 12:08 GMT+02:00 Jorge Carrión :

> ¡¡KISS!! Keep It Simple Stupid!!
>
> The htEdit 1.0.6 version does very tricky things in order to prevent
> webview to follow the externals Links. I forgot the wonderfull simplicity
> of STOP EVENT sentence... (Here comes the "Stupid" word).
> I've Updated to 1.0.7 Version in Gambas's Farm. Much more simple and solid.
> Sorry about the noise, GianLuigi.
>
> Best Regards
>
> 2016-10-17 21:11 GMT+02:00 Jorge Carrión :
>
> > I've updloaded a new project in Gambas Farm (the first I upload!). Is a
> > light html Editor control who aims to accomplish the same task than
> > TextEdit, but using html insted of RichText.
> > It allows url and Image links. I have been based on webrowser example
> > from Gambas Farm.
> >
> > It is a component, so you can create the insallation pack and add to you
> > system or jus copy/paste de source code to your proyect.
> >
> > I've translated to French, English ang German... but if there errors is
> > google fault  I don't speak French or German...
> >
> > Hope will be useful for someone
> >
> >
> > Best Regards
> >
> 
> --
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, SlashDot.org! http://sdm.link/slashdot
> ___
> Gambas-user mailing list
> Gambas-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
--
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] New update on Gambas Farm

2016-10-18 Thread Jorge Carrión
¡¡KISS!! Keep It Simple Stupid!!

The htEdit 1.0.6 version does very tricky things in order to prevent
webview to follow the externals Links. I forgot the wonderfull simplicity
of STOP EVENT sentence... (Here comes the "Stupid" word).
I've Updated to 1.0.7 Version in Gambas's Farm. Much more simple and solid.
Sorry about the noise, GianLuigi.

Best Regards

2016-10-17 21:11 GMT+02:00 Jorge Carrión :

> I've updloaded a new project in Gambas Farm (the first I upload!). Is a
> light html Editor control who aims to accomplish the same task than
> TextEdit, but using html insted of RichText.
> It allows url and Image links. I have been based on webrowser example
> from Gambas Farm.
>
> It is a component, so you can create the insallation pack and add to you
> system or jus copy/paste de source code to your proyect.
>
> I've translated to French, English ang German... but if there errors is
> google fault  I don't speak French or German...
>
> Hope will be useful for someone
>
>
> Best Regards
>
--
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user