Video::ivtv (3)
Leading comments
Automatically generated by Pod::Man 4.09 (Pod::Simple 3.35) Standard preamble: ========================================================================
NAME
Video::ivtv - Perl extension for using V4l2 in the ivtv perl scriptsSYNOPSIS
use Video::ivtv; open(my $tuner, "</dev/video0") or die "Error opening /dev/video0! $!"; my $tunerFD = fileno($tuner); # the C functions need the file handle #. # initialize the Video::ivtv module my $ivtvObj = Video::ivtv->new(); # get the current resolution my ($width, $height) = $ivtvObj->getResolution($tunerFD); # set the new resolution $ivtvObj->setResolution($tunerFD, 640, 480); close($tuner);
DESCRIPTION
The Video::ivtv module will provide helper methods for working with videodev2.h structures and making ioctl calls that have proven to be too difficult to create pack strings for in perl itself.This is not supposed to be an equivalent of the Video::Capture::V4l module which was created for videodev.h.
EXPORT
All functions and the variables section.
VARIABLES
- %codecIndexes
-
This contains the index names and their position in the ivtv_ioctl_codec structure as returned by getCodecInfo() and as expected by setCodecInfo().
- %capIndexes
-
This contains the index names and their position in the v4l2_capability structure as returned by getCapabilities().
FUNCTIONS
- @(driver, card, bus_info, version, capabilities) getCapabilities(fd)
-
Returns the contents of the v4l2_capability structure. If the ioctl fails, then an empty list is returned.
- @(width,height) getResolution(fd)
-
Pass in the file handle number using fileno($fd) and the width and height are returned in an array ref. If an error is encountered in the ioctl call, then width and height will = -1.
- int setResolution(fd, width, height)
-
Specify the new width, height to set the capture to. Returns undef if invalid resolution is specified. Returns a 1 if sucess, 0 if error from the actual code.
- int getStandard(fd)
-
Returns the current video standard the card is using.
- int setStandard(fd, standard)
-
Sets the video standard to what is specified (hex value). Returns 1 on success, 0 on error.
- @(index, id, name, frameperiod_numerator, frameperiod_denominator, framelines) enumerateStandard(fd, index)
-
Returns the contents of the v4l2_standard structure for the specified index. If the ioctl fails then index = -1.
- int getFrequency(fd, tuner)
-
Returns the current frequency for the specified tuner or -1 if an ioctl error occured. Returns undef on invalid parameters.
- int setFrequency(fd, tuner, freq)
-
Sets the specified frequency on the specified tuner. Returns 1 on success, 0 on error.
- int getInput(fd)
-
Returns the current input number starting from 0. Returns -1 if an error occured.
- int setInput(fd, input)
-
Sets the input to the specified value. input is a 0 indexed value. Returns 1 on success, 0 on error.
- @(index, name, type, audioset, tuner, std, status) enumerateInput(fd, index)
-
Returns the contents of the v4l2_input structure for the specified index. If the ioctl fails then index = -1.
- @(aspect, audio_bitmask, bframes, bitrate, bitrate_peak, dnr_mode, dnr_spatial, dnr_temporal, dnr_type, framerate, framespergop, gop_closure, pulldown, stream_type) getCodecInfo(fd)
-
Returns the contents of the ivtv_ioctl_codec structure. If the ioctl fails then an empty list is returned. audio_bitmask is what audio used to be.
- int setCodecInfo(fd, aspect, audio_bitmask, bframes, bitrate, bitrate_peak, dnr_mode, dnr_spatial, dnr_temporal, dnr_type, framerate, framespergop, gop_closure, pulldown, stream_type)
-
Sets the card to the specified codec related stuff. Returns 1 on success, 0 on error. audio_bitmask is what audio used to be.
- int setEndGOP(fd, end_gop)
-
Sets the GOP_END flag to the specified value (1 or 0) to instruct the driver to finish a recording with a closed GOP. Returns undef if end_gop < 0 or > 1. Returns 1 on success, 0 on error.
- int stopEncoding(fd)
-
Calls the VIDIOC_STREAMOFF ioctl to signal we want to stop encoding (reading from the driver). Returns 1 on success, 0 on error.