NAME

UAV::Pilot::ARDrone::Video

SYNOPSIS

my $cv      = AnyEvent->condvar;
my $handler = ...; # An object that does UAV::Pilot::Video::H264Handler
my $ardrone = ...; # An instance of UAV::Pilot::ARDrone::Driver
my $video = UAV::Pilot::ARDrone::Video->new({
    handlers => [ $handler ],
    condvar  => $cv,
    driver   => $ardrone,
});

$video->init_event_loop;
$cv->recv;

DESCRIPTION

Processes the Parrot AR.Drone v2 video stream, which is an h264 stream with some additional header data.

Note that this will not work with the AR.Drone v1.

METHODS

new

new({
    handlers => [ $handler ],
    condvar  => $cv,
    driver   => $ardrone,
})

Constructor. The handlers param is an array of objects that do the role UAV::Pilot::Video::H264Handler. Param condvar is an AnyEvent::CondVar. Param driver is an instance of UAV::Pilot::Driver::ARDrone.

init_event_loop

Starts the AnyEvent loop for processing video packets.

emergency_restart

The AR.Drone will close the connection when emergency mode is toggled. Calling this will close the stream on our end and reintitlize.

You shouldn't have to call this directly. Pass this object to your UAV::Pilot::Control::ARDrone instance and it will do it for you.

add_handler

add_handler( $handler );

Adds a UAV::Pilot::Video::H264Handler object to the list of handlers.