Generally speaking, there are two types of v4l2 devices [1]:
1) devices that support a standard, like PAL or NTFS (tv cards, for example). For
this class of devices the framerate is fixed by the standard (for example PAL uses
25 fps) and the v4l2 driver cannot usually negotiate a different framerate (unless
it can skip frames on the driver side, to save I/O bandwidth).
2) devices for which the notion of standard does not make sense (webcams, for example).
For these devices it is usually possibile to request a desidered framerate.
In either case, the desidered frame rate can be requested when the VIDIOC_G_PARM
ioctl returns the V4L2_CAP_TIMEPERFRAME flag in the capability field.
Currently the code does not check for V4L2_CAP_TIMEPERFRAME and supports only the
second category of devices, returning a time per frame of 0/0 for devices in the
first group that do not permit to negotiate the framerate.
This patch adds support to read the correct framerate in all cases.
[1] http://linuxtv.org/downloads/v4l-dvb-apis/standard.html
Signed-off-by: Stefano Sabatini <stefasab@gmail.com>
Since the user is expected to choose the standard by name (with -standard
option), add the possibility to list all the supported standards.
Signed-off-by: Stefano Sabatini <stefasab@gmail.com>
Because libavdevice/v4l2 is a demuxer, it makes sense to look for
decoders instead of encoders when listing the formats supported by the
device.
Signed-off-by: Stefano Sabatini <stefasab@gmail.com>
Make device_try_init() return an error value, and allow to properly
report errors which are not due to a wrong pixel/codec configuration.
In particular, report intelligible feedback in case of busy device.
The function find_things() in configure is confused by component
registration calls as part of multiline macros defining combined
component registration. Coalesce those macros into one line to
work around the issue.
Signed-off-by: Diego Biurrun <diego@biurrun.de>
Signed-off-by: Martin Storsjö <martin@martin.st>
Handling DirectShow events prevents infinite loops when there is an error in
the graph, such as a device being disconnected. This makes it possible for
dshow to return an error to the caller and run the cleanup code.
Based on patch by Don Moir <donmoir@comcast.net>.
Successfully opening a device altered the ret variable, making the function
not cleanup properly and return an incorrect value for errors that happened
afterwards.
Reviewed-by: Stefano Sabatini <stefasab@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This change requires the user to specify min and max value, and makes
possible to prevent the user to set AV_{SAMPLE,PIX}_FMT_NONE if
forbidden.
Add required ifdeffery in case of mixed libraries, when libavutil is
updated but not the other libraries.
This is a followup of 08d0969c14.
Use the i64 field rather than the string value. Using a string to set a
default sample/pixel format is weird, also the new interface is more
consistent with the rest of the API.
This is technically an API break, but hopefully there are no applications
using this feature outside of FFmpeg. In order to save backward
compatibility with mixed libraries in case libavutil is updated but not
the other libraries, some ifdeffery hacks are added.
Note that the version check is only performed when class->version != 0,
since if it is not defined then we assume that no version was defined and
the class is not affected by the change.
We will luckily get rid of the hack at the next major bump.
Move the NO_DSHOW_STRSAFE macro definition in front of the dshow.h
system header inclusion.
This excludes the usage of the STRSAFE functions consistently.
Further background on this can be found in the commit message of
revision 05ee0db1 where the #define was initially introduced.
Signed-off-by: Alexander Strasser <eclipse7@gmx.net>
Allow to specify a filename where to put the filtergraph description.
This is useful to override limitations or glitches of particular shell
environments, and allows a level of indirection for specifying
filtergraphs.