Device-WebIO-RaspberryPi
view release on metacpan or search on metacpan
lib/Device/WebIO/RaspberryPi.pm view on Meta::CPAN
476477478479480481482483484485486487488489490491492493494495496
default
=>
sub
{[
30
]},
);
has
'_vid_bitrate'
=> (
is
=>
'rw'
,
default
=>
sub
{[
8000
]},
);
has
'_vid_stream_callbacks'
=> (
is
=>
'rw'
,
default
=>
sub
{[]},
);
has
'_vid_stream_callback_types'
=> (
is
=>
'rw'
,
default
=>
sub
{[]},
);
has
'cv'
=> (
is
=>
'rw'
,
default
=>
sub
{ AnyEvent->condvar },
lib/Device/WebIO/RaspberryPi.pm view on Meta::CPAN
569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601
my
(
$self
,
$pin
,
$type
) =
@_
;
die
"Do not support type '$type'"
unless
exists
$ALLOWED_VIDEO_TYPES
{
$type
};
$self
->_init_gstreamer;
return
1;
}
sub
vid_stream_callback
{
my
(
$self
,
$pin
,
$type
,
$callback
) =
@_
;
die
"Do not support type '$type'"
unless
exists
$ALLOWED_VIDEO_TYPES
{
$type
};
$self
->_vid_stream_callbacks->[
$pin
] =
$callback
;
$self
->_vid_stream_callback_types->[
$pin
] =
$type
;
return
1;
}
sub
vid_stream_begin_loop
{
my
(
$self
,
$channel
) =
@_
;
my
$width
=
$self
->vid_width(
$channel
);
my
$height
=
$self
->vid_height(
$channel
);
my
$fps
=
$self
->vid_fps(
$channel
);
my
$bitrate
=
$self
->vid_kbps(
$channel
);
my
$callback
=
$self
->_vid_stream_callbacks->[
$channel
];
my
$type
=
$self
->_vid_stream_callback_types->[
$channel
];
my
$use_audio
=
$self
->vid_use_audio;
my
$audio_dev
=
$self
->vid_audio_input_device;
$self
->_init_gstreamer;
my
$cv
=
$self
->cv;
my
$pipeline
= GStreamer1::Pipeline->new(
'pipeline'
);
my
$rpi
= GStreamer1::ElementFactory::make(
rpicamsrc
=>
'and_who'
);
( run in 0.225 second using v1.01-cache-2.11-cpan-05444aca049 )