Hi Terrence,
Do you have any idea how to do a video-overlay using this mechanism?
I suspect that I have to wrap a different package, but I have no idea which one.
I guess this is why Torsten wrapped the original packages. It doesn't seem that you can have 2 lots ofin one module, so that'2 why we have GStreamer.pm and GStreamer::GConf.pm and so on.
Glib::Object::Introspection->invoke ($_GST_BASENAME, undef, 'init', undef);
And at that point you might as well put them on CPAN.
So I'm a bit lost with the videooverlay, because I don't know what package to wrap.
What do you think?
Regards
Steve
On 27/04/14 07:42, Terence Ferraro wrote:
I did a little more playing around with this...Here's my working example:
#!/usr/bin/perl -w
use strict;
use Glib;
use Gtk3 -init;
Gst::init();
my $play = Gst::ElementFactory->new("playbin","play");
my $fn = "http://www.csoft.co.uk/video/original/earth.avi";
$play->set_uri($fn);
$play->set_state('playing');
my $bus = $play->get_bus;
my $int = $bus->add_watch(\&my_callback);
Gtk3::main;
sub my_callback
{
my ($bus, $message) = @_;
if ($message->type =~ /error/)
{
warn "error\n";
Gtk3->main_quit;
exit;
}
elsif ($message->type =~ /eos/)
{
warn "end\n";
Gtk3->main_quit;
exit;
}
return 1;
}
Accomplished by placing the following in my Gtk3.pm file (in their respective portions of the file, left to the reader):
my $_GST_BASENAME = 'Gst';
my $_GST_VERSION = '1.0';
my $_GST_PACKAGE = 'Gst';
Glib::Object::Introspection->setup (
basename => $_GST_BASENAME,
version => $_GST_VERSION,
package => $_GST_PACKAGE);
sub Gst::init {
Glib::Object::Introspection->invoke ($_GST_BASENAME, undef, 'init', undef);
}
sub Gst::ElementFactory::new
{
my ($self,$factory_name,$name) = @_;
my $e = Gst::ElementFactory::make($factory_name,$name);
my $package = 'Gst::Element';
return bless $e, $package;
}
sub Gst::Element::set_uri
{
my ($self,$uri) = @_;
Glib::Object::set($self,'uri' => $uri);
}
sub Gst::Bus::add_watch
{
my ($self,$callback,$data) = @_;
my $int = Glib::Object::Introspection->invoke ('Gst', 'Bus', 'add_watch',$self,0,$callback,$data);
return($int);
}
Not sure if that's of use to anyone, but, hey, it works :)
Terence J. Ferraro
On Sat, Apr 26, 2014 at 9:05 PM, Terence Ferraro <terencejferraro gmail com> wrote:
I knew nothing about GStreamer a couple hours ago, but, since I have had a lot of dealings with perl/introspection of late, I went ahead and did some digging. Compiled with gstreamer-1.2.4.
So, first off, instead of: my $play = GStreamer::ElementFactory -> make("playbin", "play");
It should be: my $play = GStreamer::ElementFactory::make("playbin", "play");
Due to the class-static stuff.
I was, however, running into the same issue. I first verified that this works:
my $fake_factory = Glib::Object::Introspection->invoke ('Gst', 'ElementFactory', 'find', 'fakesrc');
my $fake_element = GStreamer::ElementFactory::create($fake_factory,"source");
After attempting a find on playbin, it would seem that the plugin simply isn't installed as the fakesrc is working. Looking at: plugins/elements/, I only see a handful of source files; playbin not being one of them.
That's when I remembered seeing a number of plugin subdirectories in http://gstreamer.freedesktop.org/src/.
It looks like gst-plugins-base provides playbin. After installing, now the aforementioned playbin call returns correctly.
Terence J. Ferraro
On Sat, Apr 26, 2014 at 6:13 PM, Steve Cookson <it sca-uk com> wrote:
Hi Guys,Well actually, it's amazing. I've just been trying it.
On 26/04/14 09:30, Steve Cookson wrote:
>
> > I'd suggest basing them on Glib::Object::Introspection.
It's not so easy to install you have to install libgirepository1.0-dev first (apt-get install libgirepository1.0-dev).
This code:
#!/usr/bin/perl -w
use strict;
use Glib::Object::Introspection;
Glib::Object::Introspection->setup (basename => 'Gst', version => '1.0', package => 'GStreamer');
my @version=();
@version = GStreamer::version();
print "This program is linked against GStreamer @version\n";
my $i = GStreamer::init ([$0, @ARGV]);
Gave me "This program is linked against GStreamer 1 2 3 0".
However, when I tried:
my $play = GStreamer::ElementFactory -> make("playbin", "play");
I get:
*** GStreamer::ElementFactory::make: passed too many parameters (expected 2, got 3); ignoring excess at ~/test_code/GStreamer_test_4.pl line 129.
When I drop the final parameter, I get an empty string passed in $play.
Any ideas?
Regards
Steve.
_______________________________________________
gtk-perl-list mailing list
gtk-perl-list gnome org
https://mail.gnome.org/mailman/listinfo/gtk-perl-list