![]() |
University of Murcia, Spain ![]() |
QVMPlayerProxy Class ReferenceClass to read from many video formats and devices, based on the MPlayer application.
More...
|
Public Types | |
enum | OpenOption { Default = 0x0, RealTime = 0x1, Deinterlaced = 0x2, NoLoop = 0x4, RGBMEncoder = 0x8 } |
Public Slots | |
void | pauseCam () |
void | unpauseCam () |
void | nextFrameCam () |
void | setSpeedCam (double d) |
Set the camera speed. | |
void | seekCam (QVCamera::TSeekType type, double pos) |
Moves the camera file to a given position. | |
void | closeCam () |
void | pauseCamSlot () |
void | unpauseCamSlot () |
void | nextFrameCamSlot () |
void | setSpeedCamSlot (double d) |
void | seekCamSlot (QVCamera::TSeekType type, double pos) |
Public Member Functions | |
QVMPlayerProxy (QString name=QString()) | |
~QVMPlayerProxy () | |
bool | openCam (const QString &urlstring, OpenOptions opts=Default, unsigned int r=0, unsigned int c=0) |
Opens a mplayer source given by its URL, and scales output to a requested size. | |
bool | grab (QVImage< uChar, 3 > &image) |
Grabs a frame in RGB format. | |
bool | grab (QVImage< uChar, 1 > &image) |
Grabs a gray scale frame. | |
bool | grab (QVImage< uChar > &imgY, QVImage< uChar > &imgU, QVImage< uChar > &imgV) |
Grabs a frame in YUV format. | |
const QString | getUrlBase () const |
Returns the current camera name (without path). | |
OpenOptions | getOptions () const |
Returns current camera options. | |
unsigned int | getFramesUpdated () const |
Returns the total number of updated frames. | |
unsigned int | getRows () const |
Returns the number of rows of the buffer. | |
unsigned int | getCols () const |
Returns the number of cols of the buffer. | |
double | getFPS () const |
Returns the camera speed in frames per second. | |
double | getTimeLength () const |
Returns the video file length in seconds. | |
double | getTimePos () const |
Returns the current video position in seconds. | |
double | getSpeed () const |
Returns the current video speed. | |
unsigned int | getFramesGrabbed () const |
Returns number of frames grabbed. | |
unsigned int | getFramesRead () const |
Returns number of frames read. | |
bool | isLiveCamera () const |
Tells if the camera is a live camera. | |
QVCamera::TCameraStatus | getCameraStatus () const |
bool | isClosed () const |
bool | isRunning () const |
bool | isRunningOneStep () const |
bool | isPaused () const |
This class is based on the MPlayer application. It can read videos from a wide variety of media formats, webcams and digital cameras.
Internally, when used to read from a video source compatible with MPlayer, the QVMPlayerProxy object will launch the MPlayer application to open and read from a video source. The MPlayer will be configured to redirect its output to a pipeline, from which the QVMPlayerProxy class will read the input frames. deo source.
path-to-file/file-name.{avi, mpg, dv, ...}
/dev/devicename
path-to-directory/filemask.{jpg, png, ...}
file://[path-to-file/]file-name.{avi, mpg, dv, ...}
file:///home/vision/penguin.dv
file://../../home/vision/penguin.dv
{http,rtsp,ftp}://domain-name/path-to-file/file.{avi, mpg, dv, ...}
rtsp://ficheros.7rm.es/7RM/7rm06-01-071430.rm
http://perception.inf.um.es/public_data/videos/misc/penguin.dv
ftp://user:passwd@server.dom/data/video.avi
{dvd,vcd}://{video track}
dvd://2
vcd://1
mf://path-to/filemask.{jpg, png, ...}
mf:///home/user/images/img*.jpg
mf:///./images/img*.png
{v4l,v4l2,analog}://{device file}?[options]
v4l:///dev/video0
analog:///dev/video0
r
and c
parameters (see overloaded function). Check manual page for mplayer, for a complete list of options, at parameter '-tv' option specifications.Setting the with and height for the images read from the input device using parameters width and height differs from doing so with options --Cols and --Rows of the input command line. The former can configure the device to capture images using a higher or lesser resolution, while the latter scale the image as MPlayer reads them from the input device.
These options work for video 4 Linux, video 4 Linux 2 camera, and analog inputs. They can be included appending a ? sign after the URL for the device, and separated with & signs. Some example usages of these URL options follow:
v4l2:///dev/video0?height=480&width=640&brightness=-100&fps=25
/dev/video0?height=480&width=640&brightness=-100&fps=25
analog:///dev/tv?height=240&width=320&channel=42
Definition at line 234 of file qvmplayerproxy.h.
Open options for a mplayer camera. Combine them using OR (|).
Definition at line 246 of file qvmplayerproxy.h.
QVMPlayerProxy::QVMPlayerProxy | ( | QString | name = QString() |
) |
Constructs a QVMPlayerProxy, which is initially in "Closed" status.
Definition at line 375 of file qvmplayerproxy.cpp.
QVMPlayerProxy::~QVMPlayerProxy | ( | ) |
Destroys a QVMPlayerProxy.
Definition at line 385 of file qvmplayerproxy.cpp.
bool QVMPlayerProxy::openCam | ( | const QString & | urlstring, | |
OpenOptions | opts = Default , |
|||
unsigned int | r = 0 , |
|||
unsigned int | c = 0 | |||
) |
Opens a mplayer source given by its URL, and scales output to a requested size.
(Overloaded function, provided by convenience).
url | Camera identifying URL string. See Video source identifier URL formats for URL formats. | |
r | Number of requested output rows. | |
c | Number of requested output cols. | |
opts | Camera opening options (see QVMPlayerProxy::openCam(const QString&,OpenOptions)) |
Definition at line 506 of file qvmplayerproxy.cpp.
bool QVMPlayerProxy::grab | ( | QVImage< uChar, 3 > & | image | ) |
Grabs a frame in RGB format.
If the camera is not opened with RGBMencoderMode option, this function will set parameter QVImage to null image.
image | QVImage that will store grabbed frame. |
Definition at line 632 of file qvmplayerproxy.cpp.
Referenced by QVMPlayerCamera::grab().
bool QVMPlayerProxy::grab | ( | QVImage< uChar, 1 > & | image | ) |
Grabs a gray scale frame.
If the camera is opened with RGBMencoderMode option, this function will set param QVImage to null image.
image | QVImage that will store grabbed frame. |
Definition at line 651 of file qvmplayerproxy.cpp.
bool QVMPlayerProxy::grab | ( | QVImage< uChar > & | imgY, | |
QVImage< uChar > & | imgU, | |||
QVImage< uChar > & | imgV | |||
) |
Grabs a frame in YUV format.
This function grabs the image in YUV format, storing each channel Y, U and V, in a separate QVImage of one channel. YUV format would be 422, thus QVImage corresponding to plane Y will be four times bigger than those corresponding to planes U and V.
If the camera is opened with RGBMencoderMode option, this function will set param QVImage's to null images.
imgY | QVImage that will store grabbed frame Y channel. | |
imgU | QVImage that will store grabbed frame U channel. | |
imgV | QVImage that will store grabbed frame V channel. |
Definition at line 618 of file qvmplayerproxy.cpp.
const QString QVMPlayerProxy::getUrlBase | ( | ) | const [inline] |
Returns the current camera name (without path).
Definition at line 301 of file qvmplayerproxy.h.
Referenced by QVMPlayerCamera::getUrlBase().
OpenOptions QVMPlayerProxy::getOptions | ( | ) | const [inline] |
Returns current camera options.
Definition at line 305 of file qvmplayerproxy.h.
Referenced by QVMPlayerCamera::getOptions().
unsigned int QVMPlayerProxy::getFramesUpdated | ( | ) | const [inline] |
Returns the total number of updated frames.
Definition at line 309 of file qvmplayerproxy.h.
Referenced by QVMPlayerCamera::getFramesUpdated().
unsigned int QVMPlayerProxy::getRows | ( | ) | const [inline] |
Returns the number of rows of the buffer.
Definition at line 313 of file qvmplayerproxy.h.
Referenced by QVMPlayerCamera::getRows().
unsigned int QVMPlayerProxy::getCols | ( | ) | const [inline] |
Returns the number of cols of the buffer.
Definition at line 317 of file qvmplayerproxy.h.
Referenced by QVMPlayerCamera::getCols().
double QVMPlayerProxy::getFPS | ( | ) | const [inline] |
Returns the camera speed in frames per second.
Definition at line 321 of file qvmplayerproxy.h.
Referenced by QVMPlayerCamera::getFPS().
double QVMPlayerProxy::getTimeLength | ( | ) | const [inline] |
Returns the video file length in seconds.
Definition at line 325 of file qvmplayerproxy.h.
Referenced by QVMPlayerCamera::getTimeLength().
double QVMPlayerProxy::getTimePos | ( | ) | const [inline] |
Returns the current video position in seconds.
Definition at line 329 of file qvmplayerproxy.h.
Referenced by QVMPlayerCamera::getTimePos().
double QVMPlayerProxy::getSpeed | ( | ) | const [inline] |
Returns the current video speed.
Definition at line 333 of file qvmplayerproxy.h.
Referenced by QVMPlayerCamera::getSpeed().
unsigned int QVMPlayerProxy::getFramesGrabbed | ( | ) | const [inline] |
Returns number of frames grabbed.
Definition at line 337 of file qvmplayerproxy.h.
Referenced by QVMPlayerCamera::getFramesGrabbed().
unsigned int QVMPlayerProxy::getFramesRead | ( | ) | const [inline] |
Returns number of frames read.
Definition at line 341 of file qvmplayerproxy.h.
Referenced by QVMPlayerCamera::getFramesRead().
bool QVMPlayerProxy::isLiveCamera | ( | ) | const [inline] |
Tells if the camera is a live camera.
Definition at line 345 of file qvmplayerproxy.h.
Referenced by QVMPlayerCamera::isLiveCamera().
void QVMPlayerProxy::pauseCam | ( | ) | [inline, slot] |
Pauses the camera.
Definition at line 356 of file qvmplayerproxy.h.
Referenced by QVMPlayerCamera::pauseCam().
void QVMPlayerProxy::unpauseCam | ( | ) | [inline, slot] |
Unpauses the camera.
Definition at line 359 of file qvmplayerproxy.h.
Referenced by QVMPlayerCamera::unpauseCam().
void QVMPlayerProxy::nextFrameCam | ( | ) | [inline, slot] |
Go to the next frame.
Definition at line 362 of file qvmplayerproxy.h.
Referenced by QVMPlayerCamera::nextFrameCam().
void QVMPlayerProxy::setSpeedCam | ( | double | d | ) | [inline, slot] |
Set the camera speed.
d | Camera speed (as a multiplier of the FPS) |
Definition at line 366 of file qvmplayerproxy.h.
Referenced by QVMPlayerCamera::setSpeedCam().
void QVMPlayerProxy::seekCam | ( | QVCamera::TSeekType | type, | |
double | pos | |||
) | [inline, slot] |
Moves the camera file to a given position.
type | Type of seek: Current=0,Percentage=1,Absolute=2. | |
pos |
|
Definition at line 374 of file qvmplayerproxy.h.
Referenced by QVMPlayerCamera::seekCam().
void QVMPlayerProxy::closeCam | ( | ) | [slot] |
Closes the camera.
Definition at line 583 of file qvmplayerproxy.cpp.
Referenced by QVMPlayerCamera::closeCam(), and ~QVMPlayerProxy().