ffmpeg_grabber
: An image frame grabber device using ffmpeg to capture images from AVI files.
More...
#include <ffmpeg/FfmpegGrabber.h>
Public Member Functions | |
FfmpegGrabber () | |
bool | open (yarp::os::Searchable &config) override |
Open the DeviceDriver. | |
bool | close () override |
Close the DeviceDriver. | |
bool | getImage (yarp::sig::ImageOf< yarp::sig::PixelRgb > &image) override |
Get an image from the frame grabber. | |
bool | getSound (yarp::sig::Sound &sound, size_t min_number_of_samples, size_t max_number_of_samples, double max_samples_timeout_s) override |
Get a sound from a device. | |
int | height () const override |
Return the height of each frame. | |
int | width () const override |
Return the width of each frame. | |
virtual bool | getAudioVisual (yarp::sig::ImageOf< yarp::sig::PixelRgb > &image, yarp::sig::Sound &sound) override |
Get an image and sound. | |
bool | hasAudio () override |
bool | hasVideo () override |
bool | startRecording () override |
Start the recording. | |
bool | stopRecording () override |
Stop the recording. | |
bool | isRecording (bool &recording_enabled) override |
Check if the recording has been enabled (e.g. | |
bool | getRecordingAudioBufferMaxSize (yarp::sig::AudioBufferSize &) override |
bool | getRecordingAudioBufferCurrentSize (yarp::sig::AudioBufferSize &) override |
bool | resetRecordingAudioBuffer () override |
bool | setHWGain (double gain) override |
Sets the hardware gain of the grabbing device (if supported by the hardware) | |
bool | setSWGain (double gain) override |
Sets a software gain for the grabbed audio. | |
Public Member Functions inherited from yarp::dev::IFrameGrabberOf< yarp::sig::ImageOf< yarp::sig::PixelRgb > > | |
virtual bool | getImageCrop (cropType_id_t cropType, yarp::sig::VectorOf< std::pair< int, int > > vertices, yarp::sig::ImageOf< yarp::sig::PixelRgb > &image) |
Get a crop of the image from the frame grabber. | |
Public Member Functions inherited from yarp::dev::IFrameGrabberImageBase | |
virtual | ~IFrameGrabberImageBase () |
Destructor. | |
Public Member Functions inherited from yarp::dev::IAudioGrabberSound | |
virtual | ~IAudioGrabberSound () |
Destructor. | |
Public Member Functions inherited from yarp::dev::IAudioVisualGrabber | |
virtual | ~IAudioVisualGrabber () |
Destructor. | |
Public Member Functions inherited from yarp::dev::IAudioVisualStream | |
virtual | ~IAudioVisualStream () |
Destructor. | |
virtual bool | hasRawVideo () |
Public Member Functions inherited from yarp::dev::DeviceDriver | |
DeviceDriver () | |
DeviceDriver (const DeviceDriver &other)=delete | |
DeviceDriver (DeviceDriver &&other) noexcept=delete | |
DeviceDriver & | operator= (const DeviceDriver &other)=delete |
DeviceDriver & | operator= (DeviceDriver &&other) noexcept=delete |
virtual | ~DeviceDriver () |
virtual std::string | id () const |
Return the id assigned to the PolyDriver. | |
virtual void | setId (const std::string &id) |
Set the id for this device. | |
template<class T > | |
bool | view (T *&x) |
Get an interface to the device driver. | |
virtual DeviceDriver * | getImplementation () |
Some drivers are bureaucrats, pointing at others. | |
Public Member Functions inherited from FfmpegGrabber_ParamsParser | |
FfmpegGrabber_ParamsParser () | |
~FfmpegGrabber_ParamsParser () override=default | |
bool | parseParams (const yarp::os::Searchable &config) override |
Parse the DeviceDriver parameters. | |
std::string | getDeviceClassName () const override |
Get the name of the DeviceDriver class. | |
std::string | getDeviceName () const override |
Get the name of the device (i.e. | |
std::string | getDocumentationOfDeviceParams () const override |
Get the documentation of the DeviceDriver's parameters. | |
std::vector< std::string > | getListOfParams () const override |
Return a list of all params used by the device. | |
Public Member Functions inherited from yarp::dev::IDeviceDriverParams | |
virtual | ~IDeviceDriverParams () |
Protected Member Functions | |
bool | openFirewire (yarp::os::Searchable &config, AVFormatContext **ppFormatCtx) |
bool | openV4L (yarp::os::Searchable &config, AVFormatContext **ppFormatCtx, AVFormatContext **ppFormatCtx2) |
bool | openFile (AVFormatContext **ppFormatCtx, const char *fname) |
Protected Attributes | |
void * | system_resource = nullptr |
AVDictionary * | formatParamsVideo = nullptr |
AVDictionary * | formatParamsAudio = nullptr |
AVFormatContext * | pFormatCtx = nullptr |
AVFormatContext * | pFormatCtx2 = nullptr |
AVFormatContext * | pAudioFormatCtx = nullptr |
AVPacket | packet |
bool | active |
double | startTime |
bool | _hasAudio = false |
bool | _hasVideo = false |
bool | needRateControl |
bool | imageSync |
std::string | m_uri |
Uri of the images a grabber produces. | |
int | m_w = 0 |
Width of the images a grabber produces. | |
int | m_h = 0 |
Height of the images a grabber produces. | |
int | m_channels = 0 |
int | m_rate = 0 |
void * | m_capture = nullptr |
Opaque ffmpeg structure for image capture. | |
Additional Inherited Members | |
Public Attributes inherited from FfmpegGrabber_ParamsParser | |
const std::string | m_device_classname = {"FfmpegGrabber"} |
const std::string | m_device_name = {"ffmpeg_grabber"} |
bool | m_parser_is_strict = false |
const parser_version_type | m_parser_version = {} |
const std::string | m_source_defaultValue = {"default.avi"} |
const std::string | m_loop_defaultValue = {"true"} |
const std::string | m_sync_defaultValue = {"image"} |
const std::string | m_nodelay_defaultValue = {"false"} |
const std::string | m_pace_defaultValue = {"1.0"} |
const std::string | m_v4l_defaultValue = {"false"} |
const std::string | m_v4l1_defaultValue = {"false"} |
const std::string | m_v4l2_defaultValue = {"false"} |
const std::string | m_ieee1394_defaultValue = {"false"} |
const std::string | m_v4ldevice_defaultValue = {"/dev/video0"} |
const std::string | m_audio_defaultValue = {"/dev/dsp"} |
const std::string | m_audio_rate_defaultValue = {"44100"} |
const std::string | m_channels_defaultValue = {"1"} |
const std::string | m_time_base_num_defaultValue = {"1"} |
const std::string | m_time_base_den_defaultValue = {"29"} |
const std::string | m_channel_defaultValue = {"0"} |
const std::string | m_standard_defaultValue = {""} |
const std::string | m_width_defaultValue = {"640"} |
const std::string | m_height_defaultValue = {"480"} |
const std::string | m_devname_defaultValue = {"/dev/dv1394"} |
std::string | m_source = {"default.avi"} |
bool | m_loop = {true} |
std::string | m_sync = {"image"} |
bool | m_nodelay = {false} |
double | m_pace = {1.0} |
bool | m_v4l = {false} |
bool | m_v4l1 = {false} |
bool | m_v4l2 = {false} |
bool | m_ieee1394 = {false} |
std::string | m_v4ldevice = {"/dev/video0"} |
std::string | m_audio = {"/dev/dsp"} |
int | m_audio_rate = {44100} |
int | m_channels = {1} |
int | m_time_base_num = {1} |
int | m_time_base_den = {29} |
int | m_channel = {0} |
std::string | m_standard = {} |
int | m_width = {640} |
int | m_height = {480} |
std::string | m_devname = {"/dev/dv1394"} |
ffmpeg_grabber
: An image frame grabber device using ffmpeg to capture images from AVI files.
Parameters required by this device are shown in class: FfmpegGrabber_ParamsParser
Definition at line 38 of file FfmpegGrabber.h.
|
inline |
Definition at line 48 of file FfmpegGrabber.h.
|
overridevirtual |
Close the DeviceDriver.
Reimplemented from yarp::dev::DeviceDriver.
Definition at line 569 of file FfmpegGrabber.cpp.
|
overridevirtual |
Get an image and sound.
image | the image to be filled |
sound | the sound to be filled |
Implements yarp::dev::IAudioVisualGrabber.
Definition at line 619 of file FfmpegGrabber.cpp.
|
overridevirtual |
Get an image from the frame grabber.
image | the image to be filled |
Implements yarp::dev::IFrameGrabberOf< yarp::sig::ImageOf< yarp::sig::PixelRgb > >.
Definition at line 600 of file FfmpegGrabber.cpp.
|
inlineoverridevirtual |
Implements yarp::dev::IAudioGrabberSound.
Definition at line 97 of file FfmpegGrabber.h.
|
inlineoverridevirtual |
Implements yarp::dev::IAudioGrabberSound.
Definition at line 93 of file FfmpegGrabber.h.
|
overridevirtual |
Get a sound from a device.
Examples: getSound(s, 0, 100, 0.1); returns a sound whose size can vary between 0 and 100, with a maximum blocking time of 0.1 getSound(s, 100, 100, 0.0); returns a sound with exact size of 100. It may block forever (more specifically, until sound size is at least 100). getSound(s, 100, 100000, 0.0); returns a sound with a minimum size of 0, while trying to transfer all the internal buffer. It may block forever (more specifically, until sound size is at least 100).
sound | the sound to be filled |
min_number_of_samples. | The function will block until the driver is able to collect at least min_number_of_samples. If set to zero, the function may return empty sounds. |
max_number_of_samples. | The function will block until the driver is either able to collect max_number_of_samples or the timeout expires. |
max_samples_timeout_s. | The timeout (in seconds) to retrieve max_number_of_samples. |
Implements yarp::dev::IAudioGrabberSound.
Definition at line 609 of file FfmpegGrabber.cpp.
|
inlineoverridevirtual |
Implements yarp::dev::IAudioVisualStream.
Definition at line 73 of file FfmpegGrabber.h.
|
inlineoverridevirtual |
Implements yarp::dev::IAudioVisualStream.
Definition at line 77 of file FfmpegGrabber.h.
|
inlineoverridevirtual |
Return the height of each frame.
Implements yarp::dev::IFrameGrabberImageBase.
Definition at line 65 of file FfmpegGrabber.h.
|
inlineoverridevirtual |
Check if the recording has been enabled (e.g.
via startRecording()/stopRecording())
recording_enabled | the status of the device |
Implements yarp::dev::IAudioGrabberSound.
Definition at line 89 of file FfmpegGrabber.h.
|
overridevirtual |
Open the DeviceDriver.
config | is a list of parameters for the device. Which parameters are effective for your device can vary. See device invocation examples. If there is no example for your device, you can run the "yarpdev" program with the verbose flag set to probe what parameters the device is checking. If that fails too, you'll need to read the source code (please nag one of the yarp developers to add documentation for your device). |
Reimplemented from yarp::dev::DeviceDriver.
Definition at line 435 of file FfmpegGrabber.cpp.
|
protected |
Definition at line 427 of file FfmpegGrabber.cpp.
|
protected |
Definition at line 414 of file FfmpegGrabber.cpp.
|
protected |
Definition at line 326 of file FfmpegGrabber.cpp.
|
inlineoverridevirtual |
Implements yarp::dev::IAudioGrabberSound.
Definition at line 101 of file FfmpegGrabber.h.
|
inlineoverridevirtual |
Sets the hardware gain of the grabbing device (if supported by the hardware)
gain | the audio gain (1.0 is the default value) |
Implements yarp::dev::IAudioGrabberSound.
Definition at line 105 of file FfmpegGrabber.h.
|
inlineoverridevirtual |
Sets a software gain for the grabbed audio.
gain | the audio gain (1.0 is the default value) |
Implements yarp::dev::IAudioGrabberSound.
Definition at line 109 of file FfmpegGrabber.h.
|
inlineoverridevirtual |
Start the recording.
Implements yarp::dev::IAudioGrabberSound.
Definition at line 81 of file FfmpegGrabber.h.
|
inlineoverridevirtual |
Stop the recording.
Implements yarp::dev::IAudioGrabberSound.
Definition at line 85 of file FfmpegGrabber.h.
|
inlineoverridevirtual |
Return the width of each frame.
Implements yarp::dev::IFrameGrabberImageBase.
Definition at line 67 of file FfmpegGrabber.h.
|
protected |
Definition at line 124 of file FfmpegGrabber.h.
|
protected |
Definition at line 125 of file FfmpegGrabber.h.
|
protected |
Definition at line 122 of file FfmpegGrabber.h.
|
protected |
Definition at line 117 of file FfmpegGrabber.h.
|
protected |
Definition at line 116 of file FfmpegGrabber.h.
|
protected |
Definition at line 127 of file FfmpegGrabber.h.
|
protected |
Opaque ffmpeg structure for image capture.
Definition at line 141 of file FfmpegGrabber.h.
|
protected |
Definition at line 137 of file FfmpegGrabber.h.
|
protected |
Height of the images a grabber produces.
Definition at line 135 of file FfmpegGrabber.h.
|
protected |
Definition at line 138 of file FfmpegGrabber.h.
|
protected |
Uri of the images a grabber produces.
Definition at line 130 of file FfmpegGrabber.h.
|
protected |
Width of the images a grabber produces.
Definition at line 133 of file FfmpegGrabber.h.
|
protected |
Definition at line 126 of file FfmpegGrabber.h.
|
protected |
Definition at line 121 of file FfmpegGrabber.h.
|
protected |
Definition at line 120 of file FfmpegGrabber.h.
|
protected |
Definition at line 118 of file FfmpegGrabber.h.
|
protected |
Definition at line 119 of file FfmpegGrabber.h.
|
protected |
Definition at line 123 of file FfmpegGrabber.h.
|
protected |
Definition at line 114 of file FfmpegGrabber.h.