Re: GStreamer cairooverlay
- From: "g.schlmm" <g schlmm googlemail com>
- To: gtk-perl-list gnome org
- Subject: Re: GStreamer cairooverlay
- Date: Tue, 03 May 2011 19:44:49 +0200
Hey again,
just tried some stuff :)
I made Cairo gobjects available for GStreamer-Interfaces
via the "maps" file:
GST_TYPE_PROPERTY_PROBE GstPropertyProbe GInterface
GStreamer::PropertyProbe
GST_TYPE_X_OVERLAY GstXOverlay GInterface GStreamer::XOverlay
CAIRO_GOBJECT_TYPE_CONTEXT CairoContext GBoxed Cairo::Context
CAIRO_GOBJECT_TYPE_DEVICE CairoDevice GBoxed Cairo::Device
CAIRO_GOBJECT_TYPE_PATTERN CairoPattern GBoxed Cairo::Pattern
CAIRO_GOBJECT_TYPE_SURFACE CairoSurface GBoxed Cairo::Surface
CAIRO_GOBJECT_TYPE_SCALED_FONT CairoScaledFont GBoxed Cairo::ScaledFont
CAIRO_GOBJECT_TYPE_FONT_FACE CairoFontFace GBoxed Cairo::FontFacedd
CAIRO_GOBJECT_TYPE_FONT_OPTIONS CairoFontOptions GBoxed Cairo::FontOptions
CAIRO_GOBJECT_TYPE_REGION CairoRegion GBoxed Cairo::Region
CAIRO_GOBJECT_TYPE_Rectangle CairoRectangle GBoxed Cairo::Rectangle
i also modified the MakeFile.PL to include cairo headers
i dont think GStreamer::Interfaces is the right place for doing this.
Would a Cairo-GObject package be the best? or including it right to the
Cairo package?
Now CairoContext seems mapped to Cairo::Context
Im not really in C and XS coding, so i dont know if its enough.
Sometimes if i start the program, i get:
perl: cairo.c:435: cairo_destroy: Assertion
`((*&(&cr->ref_count)->ref_count) > 0)' failed.
if i do
print Dumper($context->status, $context->get_target->status);
im getting this:
unknown cairo_status_t value 32521 encountered at /tmp/test2.pl line 41.
$VAR1 = undef;
$VAR2 = 'no-memory';
and the example doesnt work at all. nothin to see over the videotestsrc
output.
Somebody has an advice for me?
my current perl code is at the bottom
Best regards
Georg
use strict;
use Glib qw(TRUE FALSE);
use GStreamer '-init';
use Cairo;
use GStreamer::Interfaces;
use Data::Dumper;
Glib->install_exception_handler (sub {require Data::Dumper;
print Data::Dumper::Dumper(\ _, $!);
});
my $loop = Glib::MainLoop->new;
# create the pipeline
my $pipeline = GStreamer::Pipeline->new("cairo-overlay-example");
my ($source, $a1, $a2, $sink) = GStreamer::ElementFactory->make(
videotestsrc => "source",
ffmpegcolorspace => "a1",
ffmpegcolorspace => "a2",
autovideosink => "sink"
);
my $cairo_overlay = GStreamer::ElementFactory->make('cairooverlay',
'overlay');
my ($width, $height, $valid);
$cairo_overlay->signal_connect ("draw", sub {
my ($overlay, $context, $timestamp, $duration) = @_;
return if (!$valid);
my $scale = 2 * ((($timestamp / int(1e7)) % 70) + 30) / 100.0;
$context->translate($width / 2, ($height / 2) - 30);
$context->scale($scale, $scale);
$context->move_to(0, 0);
$context->curve_to(0, -30, -50, -30, -50, 0);
$context->curve_to (-50, 30, 0, 35, 0, 60);
$context->curve_to (0, 35, 50, 30, 50, 0);
$context->curve_to (50, -30, 0, -30, 0, 0);
$context->set_source_rgba (0.9, 0.0, 0.1, 0.7);
$context->fill;
print Dumper($context->status, $context->get_target->status);
});
$cairo_overlay->signal_connect ("caps-changed", sub {
my ($overlay, $caps) = @_;
$width = 0; $height = 0;
for (@{$caps->get_structure(0)->{fields}}) {
$width = $_->[2]
if ($_->[0] == 'width');
$height = $_->[2]
if ($_->[0] == 'height');
last if ($height > 0 && $width > 0);
}
$valid = 1 if ($height > 0 && $width > 0);
});
$pipeline->add ($source, $a1, $cairo_overlay, $a2, $sink);
$source->link($a1);
$a1->link($cairo_overlay);
$cairo_overlay->link($a2);
$a2->link($sink);
$pipeline->set_state('playing');
$loop->run;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]