The current code returned a period=0, resulting in identical pts for all frames
after time-filtering. This is because AV_TIME_BASE_Q={1, AV_TIME_BASE} and
not {AV_TIME_BASE, 1}. With this patch the correct period in microseconds is computed.
struct buff_data contains a pointer to struct video_data, so passing the
file descriptor again is redundant.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
In particular:
1) save errno before it (possibly) gets overwritten by other calls
2) do not forget to enqueue the buffer again in case of error
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This will avoid the possibility that we dequeue more buffers than we
have obtained from the v4l2 driver.
Fixes ticket #1570
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This ensures that fps and other values are estimated correctly,
the probesize also is intended to limit disk/protocol reads which
does not apply to lavfi inputs at all.
Fixes Ticket1051
Something similar could be usefull to other input devices
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
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.