input.std is of type v4l2_std_id which is defined as 64-bit unsigned integer.
Casting to uint means the higher bits, wich are used for the private video
standards of the TI video capture/display driver for example, are lost.
Sample the pipeline clock and device clock closer to eachother to reduce jitter.
Don't subtract the frame duration from the timestamp when we can use the device
timestamps.
Assume a delay of 1 frame in read-write mode.
Query the amount of available buffers when doing set_config(). This allows us to
configure the parent bufferpool with the number of buffers to preallocate.
Keep track of the provided allocator and use it when we need to allocate a
buffer in RW mode.
When we are can not allocate the requested max_buffers amount of buffers, make
sure we keep 2 buffers around in the pool and copy them into an output buffer.
This makes sure that we always have a buffer to capture into. We also need to
detect those copied buffers and unref them when they return to the pool.
Only free the queued buffers that we keep track of in our buffer array. for rw
io-mode, we do allocate buffers but we don't keep track of them in the buffer
array.
This is not enough to properly support H264 cameras, but it will
allow an H264 stream to be generated by v4l2src using the default
settings of the camera. If used with the pre-set-format signal, the
H264 encoder can be fully configured.
Conflicts:
sys/v4l2/gstv4l2object.c
In order to support UVC H264 encoding cameras, an H264 Probe&Commit
must happen before the normal v4l2 set-format. This new signal is
meant to allow an external application or bin to do it.
It also serves to expose the file descriptor used by v4l2src in case
some custom ioctls need to be called.
Conflicts:
sys/v4l2/Makefile.am
sys/v4l2/gstv4l2src.c
sys/v4l2/v4l2src_calls.c
The tuner marshal and enumtypes are autogenerated, and they need
to be created before the compilation of gstv4l2tuner.c
This patch adds the automake instruction for ensuring the
autogeneration of those files previous the compilation.
The base class may have set the DISCONT flag on the first buffer pushed
out. We need to clear that when recycling buffers back into the buffer
pool, otherwise we constantly push out buffers with the discont flag
set, which might upset downstream elements, esp. for compressed
formats like mpeg-ts.
Make sure we always call munmap() with the same size we called mmap()
with before.
Current v4l2src uses the same structure for VIDIOC_QUERYBUF, VIDIOC_QBUF
and v4l2_munmap calls. The problem is that the video buffer size (length)
may vary for compressed or emulated bufs. VIDIOC_QBUF will change it if
we pass the pointer of a v4l2_buffer. This is why we should avoid using
same variable for mmap and video buffers.
https://bugzilla.gnome.org/show_bug.cgi?id=671126
Don't post a (fatal) error message on the bus just because we
failed to query some control. Fixes issue with built-in
Suyin Corp webcam for HP notebook (usbid 064e:e28a) on
OpenSuse 12.1, where querying red/blue balance fails.
https://bugzilla.gnome.org/show_bug.cgi?id=670197
Add private replacements for deprecated functions such as
g_mutex_new(), g_mutex_free(), g_cond_new() etc., mostly
to avoid the deprecation warnings. We'll change these
over to the new API once we depend on glib >= 2.32.
We don't currently support setting the pixel-aspect-ratio from V4L2. So
simply set it to be 1/1 in the caps to prevent negotiation failures when
fixating to weird values (e.g. when the downstream caps has
pixel-aspect-ratio = [ MIN, MAX ] )
https://bugzilla.gnome.org/show_bug.cgi?id=663580
A particular window may be selected using the new xid (X-Window
XID, eg a pointer) and xname (window title) properties. If both
are specified, the XID is used in preference, falling back to
xname if not found.
Default (if none of xid and xname are specified, or if no such
window is found) is to capture the root window.
https://bugzilla.gnome.org/show_bug.cgi?id=546932
We used to skip frame rate setup if the camera was already setup
with the requested frame rate. This breaks some cameras though,
causing them to not output data (several models of Thinkpad cameras
have this problem at least).
So, don't skip.
https://bugzilla.gnome.org/show_bug.cgi?id=638300
This will ensure a logically new buffer does not keep flags from
a previous use of that buffer (eg, DISCONT would be set on the first
buffer, and mistakenly kept when reused).
https://bugzilla.gnome.org/show_bug.cgi?id=653709
Some drivers are buggy are will change the current format when
processing VIDIOC_TRY_FMT. Save and restore the current format
to ensure the format is kept unchanged.
https://bugzilla.gnome.org/show_bug.cgi?id=649067
Use the fraction compare utility to compare function, not the
handcrafted one. The handcrafted one is buggy as it doesn't take into
account rounding error. For example comparing a framerate of 20/1 on a
camera configured as 30/1 fps would yield true: 1 == (1 * 20)/30 and not
re-configure the camera. Fixes#656104
When nobody is using our pool, activate it ourselves.
Avoid leaking the buffer array.
Set default pool configuration with caps.
Don't keep current_caps, core does that for us now.
Use the more specialized type for the bufferpool.
Use the size from the driver as the size of the image to read.
Don't configure the pool when created. This will be done in the setup_allocation
method later or by upstream for sinks.
Remove unused properties and variables. Bufferpool sizes are now configured in
the bufferpool by the elements in the pipeline. We might want to influence the
pool size later somehow.
Prefer to always use the default bufferpool queue for the _acquire function
because it properly supports unblocking when setting inactive etc. As a result,
we need to dequeue buffers and put them back in the bufferpool queue when we
have queued all buffers in the sink.
Rename some variables to more meaningfull names to avoid a problem with
freeing the wrong amount of buffers.
Remove old method, use neww _process method for the sink.
Inform the parent bufferpool class about the settings too. This is needed to let
it know about the max-buffers.
Allocate the negotiated max-buffers and initially mmap min-buffers. The idea is
that the bufferpool will allocate more when needed.
Improve debugging.
Only poll in capture mode, it does not seem to work in playback mode on this
beagleboard.
Add different transport methods to the bufferpool (MMAP and READ/WRITE)
Do more parsing of the bufferpool config.
Start and stop streaming based on the bufferpool state.
Make separate methods for getting a buffer from the pool and filling it with
data. This allows us to fill buffers from other pools too. Either use copy or
read to fill up the target buffers.
Add property to force a transfer mode in v4l2src.
Increase default number of buffers to 4.
Negotiate bufferpool and its properties in v4l2src.
Pass the caps and the default video size to the bufferpool config.
Don't activate the bufferpool, this will be done by the object that decides to
use the bufferpool.
Improve debugging and error reporting.
When we have all buffers queued for playback and we need a new empty buffer,
dequeue one and return it.
Set the right size for sink buffers.
Improve counting of queued buffers.
Extend from GstBufferPool.
Handle the lifetime of the pool buffers correctly with the start/stop vmethods.
Map acquire and release directly to QBUF and DQBUF. We still expose an explicit
qbuf for the v4l2sink for now.
Move the details of how to capture to the device object. Remove the
v4l2src_calls.[ch] files because they are empty now.
Provide two simple methods to get and return a buffer to the device.
Also do a slow copy when the buffer is not from our pool.
Rename start and stop methods to open and close because that is what they do.
After setting the format on the device object, setup the bufferpools. Move this
code from the v4l2src_calls.c file, it is shared between source and sink.
Make new device start and stop method that merges various bits of common code
spread over several files.
We want to keep the default strides in the videoinfo. Keep the stride of the
video frames separate so that we can use both to copy a video frame and do
correct stride conversion.
Use GstVideoInfo to store the parsed caps.
Remove outsize from the caps parsing code, it's wrong because it does not use
the stride given by the driver.
Move the configuration of the framerate to where we set the other format
parameters.
Remove hack to check if the device is active.
Store streamparm in the device info.
Use some macros to access the current device configuration.
Remove some duplicate fields in src and sink and use the device configuration
instead.
Pass the caps to the set_format function and make _set_format parse the caps.
Also keep the parsed values in the v4l2object so that we can refer to them when
we want.
Keep track of the currently configured format and setting in the
v4l2object.
Pass the v4l2object to the bufferpool constructor so that the bufferpool can
know everything about the currently configured settings. This also allows us
to remove some awkward code.
Create a new pool in setcaps and stop/destroy the old one.
Remove buffer_alloc functions.
Check that we have v4l2 metadata in show_frame and fall back to memcpy into a
buffer from our pool if we don't receive one of our own buffers.
Various cleanups, avoids useless casts, move error handling outside of the main
code flow.
Negotiate to a resonable resolution instead of the max resolution.
Pretending to handle 8-bit signed causes distorted audio when
actually given such audio, which you will get if passing 8-bit
unsigned through audioconvert ! audioresample, as audioresample
only handles 8-bit signed. Fixes#605834.
Signed-off-by: David Schleef <ds@schleef.org>
Based on a patch by Guennadi Liakhovetski.
v2: updates because I forgot to add GstTuner interface to v4l2sink
v3: update to add all possible values to norm enum