GStreamer1-0.003/0000755000175000017500000000000012435652102013456 5ustar tmurraytmurrayGStreamer1-0.003/MANIFEST0000644000175000017500000000043212435652102014606 0ustar tmurraytmurray# This file was automatically generated by Dist::Zilla::Plugin::Manifest v5.019. CHANGELOG MANIFEST META.json Makefile.PL dist.ini examples/hello.pl examples/rpi_pic.pl examples/symdump.pl lib/GStreamer1.pm lib/GStreamer1/Caps/Simple.pm t/001_load.t t/002_pod.t t/010_caps_simple.t GStreamer1-0.003/lib/0000755000175000017500000000000012435652102014224 5ustar tmurraytmurrayGStreamer1-0.003/lib/GStreamer1.pm0000644000175000017500000001426412435652102016543 0ustar tmurraytmurray# Copyright (c) 2014 Timm Murray # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the above copyright notice, # this list of conditions and the following disclaimer. # * Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. package GStreamer1; $GStreamer1::VERSION = '0.003'; use v5.12; use warnings; use Glib::Object::Introspection; # ABSTRACT: Bindings for GStreamer 1.0, the open source multimedia framework BEGIN { foreach my $name ('', ( #'Allocators', 'App', #'Audio', 'Base', #'Check', 'Controller', #'Fft', #'InsertBin', #'Mpegts', #'Net', #'Pbutils', #'Riff', #'Rtp', #'Rtsp', #'Sdp', #'Tag', #'Video', )) { my $basename = 'Gst' . $name; my $pkg = $name ? 'GStreamer1::' . $name : 'GStreamer1'; Glib::Object::Introspection->setup( basename => $basename, version => '1.0', package => $pkg, ); } } use GStreamer1::Caps::Simple; 1; __END__ =encoding utf8 =head1 NAME GStreamer1 - Bindings for GStreamer 1.0, the open source multimedia framework =head1 SYNOPSIS use GStreamer1; GStreamer1::init([ $0, @ARGV ]); my $pipeline = GStreamer1::parse_launch( "playbin uri=$URI" ); $pipeline->set_state( "playing" ); my $bus = $pipeline->get_bus; my $msg = $bus->timed_pop_filtered( GStreamer1::CLOCK_TIME_NONE, [ 'error', 'eos' ]); $pipeline->set_state( "null" ); =head1 DESCRIPTION GStreamer1 implements a framework that allows for processing and encoding of multimedia sources in a manner similar to a shell pipeline. Because it's introspection-based, most of the classes follow directly from the C API. Therefore, most of the documentation is by example rather than a full breakdown of the class structure. =head1 PORTING FROM GStreamer If you're porting from the original GStreamer module, here are some things to keep in mind. =head2 ElementFactory The original GStreamer had a version of C<< ElementFactory->make() >> which could be called with a list of gst plugins and associated names. GStreamer1 may add a similar method in the future. For now, the bindings directly follow from the C interface, so they take only one at a time. Example: my $rpi = GStreamer1::ElementFactory::make( rpicamsrc => 'and_who' ); my $h264parse = GStreamer1::ElementFactory::make( h264parse => 'are_you' ); my $capsfilter = GStreamer1::ElementFactory::make( capsfilter => 'the_proud_lord_said' ); my $avdec_h264 = GStreamer1::ElementFactory::make( avdec_h264 => 'that_i_should_bow_so_low' ); my $jpegenc = GStreamer1::ElementFactory::make( jpegenc => 'only_a_cat' ); my $fakesink = GStreamer1::ElementFactory::make( fakesink => 'of_a_different_coat' ); =head2 Adding/linking The original GStreamer added methods for C<< Pipeline->add() >> and C<< Element->link() >> that could take lists of objects. GStreamer1 may add similar methods in the future. For now, the bindings directly follow from the C interface, so they take only one object at a time. Example: my @link = ( $rpi, $h264parse, $capsfilter, $avdec_h264, $jpegenc, $fakesink ); $pipeline->add( $_ ) for @link; foreach my $i (0 .. $#link) { last if ! exists $link[$i+1]; my $this = $link[$i]; my $next = $link[$i+1]; $this->link( $next ); } =head1 EXAMPLES See the C directory in the distribution. =head1 SEE ALSO L - Perl bindings to the old 0.10 version of GStreamer L =head1 SPECIAL THANKS To Torsten Schönfeld for pointing me in the right direction on creating this module. =head1 LICENSE Copyright (c) 2014 Timm Murray All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. =cut GStreamer1-0.003/lib/GStreamer1/0000755000175000017500000000000012435652102016176 5ustar tmurraytmurrayGStreamer1-0.003/lib/GStreamer1/Caps/0000755000175000017500000000000012435652102017064 5ustar tmurraytmurrayGStreamer1-0.003/lib/GStreamer1/Caps/Simple.pm0000644000175000017500000000363412435652102020661 0ustar tmurraytmurray# Copyright (c) 2014 Timm Murray # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the above copyright notice, # this list of conditions and the following disclaimer. # * Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. package GStreamer1::Caps::Simple; $GStreamer1::Caps::Simple::VERSION = '0.003'; use v5.12; use warnings; sub new { my ($class, $media_type, @args) = @_; my $self = GStreamer1::Caps->new_empty_simple( $media_type ); while( scalar(@args) >= 3 ) { my $name = shift @args; my $type = shift @args; my $value = shift @args; my $glib_type_value = Glib::Object::Introspection::GValueWrapper->new( $type => $value, ); $self->set_value( $name => $glib_type_value ); } return $self; } 1; __END__ GStreamer1-0.003/examples/0000755000175000017500000000000012435652102015274 5ustar tmurraytmurrayGStreamer1-0.003/examples/rpi_pic.pl0000644000175000017500000000463412435652102017265 0ustar tmurraytmurray#!/usr/bin/perl use v5.12; use warnings; use GStreamer1; use Glib qw( TRUE FALSE ); # Get a jpeg image from the Raspberry Pi camera. This requires the rpicamsrc # gst plugin, which you can download and compile from: # # https://github.com/thaytan/gst-rpicamsrc # # Duplicates this command line: # # gst-launch-1.0 rpicamsrc ! h264parse ! 'video/x-h264,width=800,height=600' \ # ! avdec_h264 ! jpegenc quality=50 ! filesink location=output.jpg # # Except that we use an appsink to get the jpeg and then save it. # my $OUT_FILE = shift || die "Need file to save to\n"; sub dump_to_file { my ($output_file, $jpeg_data) = @_; my @jpeg_bytes = @$jpeg_data; say "Got jpeg, saving " . scalar(@jpeg_bytes) . " bytes . . . "; open( my $fh, '>', $output_file ) or die "Can't open '$output_file': $!\n"; binmode $fh; print $fh pack( 'C*', @jpeg_bytes ); close $fh; say "Saved jpeg to $output_file (size: " . (-s $output_file) . ")"; return 1; } GStreamer1::init([ $0, @ARGV ]); my $loop = Glib::MainLoop->new( undef, FALSE ); my $pipeline = GStreamer1::Pipeline->new( 'pipeline' ); my $rpi = GStreamer1::ElementFactory::make( rpicamsrc => 'and_who' ); my $h264parse = GStreamer1::ElementFactory::make( h264parse => 'are_you' ); my $capsfilter = GStreamer1::ElementFactory::make( capsfilter => 'the_proud_lord_said' ); my $avdec_h264 = GStreamer1::ElementFactory::make( avdec_h264 => 'that_i_should_bow_so_low' ); my $jpegenc = GStreamer1::ElementFactory::make( jpegenc => 'only_a_cat' ); my $appsink = GStreamer1::ElementFactory::make( appsink => 'of_a_different_coat' ); my $caps = GStreamer1::Caps::Simple->new( 'video/x-h264', width => 'Glib::Int' => 800, height => 'Glib::Int' => 600, ); $capsfilter->set( caps => $caps ); $appsink->set( 'max-buffers' => 20 ); $appsink->set( 'emit-signals' => TRUE ); $appsink->set( 'sync' => FALSE ); my @link = ( $rpi, $h264parse, $capsfilter, $avdec_h264, $jpegenc, $appsink ); $pipeline->add( $_ ) for @link; foreach my $i (0 .. $#link) { last if ! exists $link[$i+1]; my $this = $link[$i]; my $next = $link[$i+1]; $this->link( $next ); } $pipeline->set_state( "playing" ); my $jpeg_sample = $appsink->pull_sample; $pipeline->set_state( "null" ); my $jpeg_buf = $jpeg_sample->get_buffer; my $size = $jpeg_buf->get_size; my $buf = $jpeg_buf->extract_dup( 0, $size, undef, $size ); dump_to_file( $OUT_FILE, $buf ); GStreamer1-0.003/examples/hello.pl0000644000175000017500000000107212435652102016734 0ustar tmurraytmurray#!perl use v5.12; use warnings; use GStreamer1; # This is based on the GStreamer Hello, World! tutorial at: # # http://docs.gstreamer.com/pages/viewpage.action?pageId=327735 # # You can download 'sintel_trailer-480p.webm' from there # my $URI = shift || die "Need URI to play\n"; GStreamer1::init([ $0, @ARGV ]); my $pipeline = GStreamer1::parse_launch( "playbin uri=$URI" ); $pipeline->set_state( "playing" ); my $bus = $pipeline->get_bus; my $msg = $bus->timed_pop_filtered( GStreamer1::CLOCK_TIME_NONE, [ 'error', 'eos' ]); $pipeline->set_state( "null" ); GStreamer1-0.003/examples/symdump.pl0000644000175000017500000000033412435652102017327 0ustar tmurraytmurray#!perl use v5.12; use warnings; use GStreamer1; use Devel::Symdump; # Dump out everything under the GStreamer1:: namespace recursively my $dump = Devel::Symdump->rnew( 'GStreamer1' ); say $_ for sort $dump->functions; GStreamer1-0.003/META.json0000644000175000017500000000214312435652102015077 0ustar tmurraytmurray{ "abstract" : "Bindings for GStreamer 1.0, the open source multimedia framework", "author" : [ "Timm Murray " ], "dynamic_config" : 0, "generated_by" : "Dist::Zilla version 5.019, CPAN::Meta::Converter version 2.140640", "license" : [ "bsd" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : "2" }, "name" : "GStreamer1", "prereqs" : { "configure" : { "requires" : { "Devel::CheckLib" : "0.9", "ExtUtils::MakeMaker" : "6.30" } }, "runtime" : { "requires" : { "Glib::Object::Introspection" : "0.009" } }, "test" : { "requires" : { "Test::Pod" : "0" } } }, "release_status" : "stable", "resources" : { "homepage" : "http://www.wumpus-cave.net", "repository" : { "type" : "git", "url" : "https://github.com/frezik/GStreamer1.git", "web" : "https://github.com/frezik/GStreamer1" } }, "version" : "0.003" } GStreamer1-0.003/CHANGELOG0000644000175000017500000000041112435652102014664 0ustar tmurraytmurrayRevision history for perl module CHANGELOG 0.003 2014-11-27 - Specify libgstreamer >= 1.0.0 as a requirement - Add repository URL - Build META.json 0.002 2014-11-22 - Don't include sintel trailer in dist - Cleanup POD typos 0.001 2014-11-21 - Initial release GStreamer1-0.003/Makefile.PL0000644000175000017500000000235112435652102015431 0ustar tmurraytmurray # This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v5.019. use strict; use warnings; # inserted by Dist::Zilla::Plugin::CheckLib 0.006 use Devel::CheckLib; check_lib_or_exit( lib => 'gstreamer-1.0', ); use ExtUtils::MakeMaker 6.30; my %WriteMakefileArgs = ( "ABSTRACT" => "Bindings for GStreamer 1.0, the open source multimedia framework", "AUTHOR" => "Timm Murray ", "CONFIGURE_REQUIRES" => { "Devel::CheckLib" => "0.9", "ExtUtils::MakeMaker" => "6.30" }, "DISTNAME" => "GStreamer1", "EXE_FILES" => [], "LICENSE" => "bsd", "NAME" => "GStreamer1", "PREREQ_PM" => { "Glib::Object::Introspection" => "0.009" }, "TEST_REQUIRES" => { "Test::Pod" => 0 }, "VERSION" => "0.003", "test" => { "TESTS" => "t/*.t" } ); my %FallbackPrereqs = ( "Glib::Object::Introspection" => "0.009", "Test::Pod" => 0 ); unless ( eval { ExtUtils::MakeMaker->VERSION(6.63_03) } ) { delete $WriteMakefileArgs{TEST_REQUIRES}; delete $WriteMakefileArgs{BUILD_REQUIRES}; $WriteMakefileArgs{PREREQ_PM} = \%FallbackPrereqs; } delete $WriteMakefileArgs{CONFIGURE_REQUIRES} unless eval { ExtUtils::MakeMaker->VERSION(6.52) }; WriteMakefile(%WriteMakefileArgs); GStreamer1-0.003/dist.ini0000644000175000017500000000105012435652102015116 0ustar tmurraytmurrayname = GStreamer1 author = Timm Murray license = BSD copyright_holder = Timm Murray version = 0.003 [PkgVersion] [GatherDir] [Manifest] [MakeMaker] [CheckLib] lib = gstreamer-1.0 [Prereqs] Glib::Object::Introspection = 0.009 [Prereqs / TestRequires] Test::Pod = 0 [MetaResources] homepage = http://www.wumpus-cave.net repository.web = https://github.com/frezik/GStreamer1 repository.url = https://github.com/frezik/GStreamer1.git repository.type = git [MetaJSON] [TestRelease] [ConfirmRelease] [UploadToCPAN] GStreamer1-0.003/t/0000755000175000017500000000000012435652102013721 5ustar tmurraytmurrayGStreamer1-0.003/t/010_caps_simple.t0000644000175000017500000000350412435652102016767 0ustar tmurraytmurray# Copyright (c) 2014 Timm Murray # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the above copyright notice, # this list of conditions and the following disclaimer. # * Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. use Test::More tests => 3; use v5.14; use GStreamer1; # This should load GStreamer1::Caps::Simple on its own GStreamer1::init([ $0, @ARGV ]); my $caps = GStreamer1::Caps::Simple->new( 'video/x-h264', width => 'Glib::Int' => 800, height => 'Glib::Int' => 600, ); isa_ok( $caps => 'GStreamer1::Caps' ); my $struct = $caps->get_structure( 0 ); cmp_ok( $struct->get_value( 'width' ), '==', 800, "Width set" ); cmp_ok( $struct->get_value( 'height' ), '==', 600, "Height set" ); GStreamer1-0.003/t/001_load.t0000644000175000017500000000270112435652102015405 0ustar tmurraytmurray# Copyright (c) 2014 Timm Murray # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the above copyright notice, # this list of conditions and the following disclaimer. # * Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. use Test::More tests => 2; use v5.12; use_ok( 'GStreamer1' ); use_ok( 'GStreamer1::Caps::Simple' ); GStreamer1-0.003/t/002_pod.t0000644000175000017500000000007312435652102015251 0ustar tmurraytmurrayuse Test::Pod; all_pod_files_ok( all_pod_files( 'lib' ) );