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
GCC 4.6.x complains about such variable usage. Unused but set variables
were removed except that gst_oss4_mixer_slider_set_mute () now returns
the value from the call to gst_oss4_mixer_set_control_val ().
Commit 6c8268dbfd broke recording
from interlaced v4l2 source (e.g. typical tv capture card) since
V4L2_FIELD_SEQ_TB (with fields stored separately) does not map
to currently defined interlaced format (fields stored interleaved).
Besides this mismatch, hardware might quite likely not support or
appreciate this field value, since querying supported formats mapped
_INTERLACED field formats to interlaced=true caps (so the latter should
not be mapped to field value that is not known to be supported).
gstdirectsoundsink.c: In function 'gst_directsound_sink_write':
gstdirectsoundsink.c:557: error: implicit declaration of function '_swab'
gstdirectsoundsink.c:557: error: nested extern declaration of '_swab'
Older kernels don't have these, and there's no easy way to check for the
existance of enums that doesn't involve a configure check, so just define
these if the V4L2_CAP_VIDEO_OUTPUT_OVERLAY define is not there, which was
added in the same commit as the TB/BT enum. Fixes compilation on CentOS 5.
https://bugzilla.gnome.org/show_bug.cgi?id=639339
These macros will expand to NOOPs given the right defines. Also,
g_return_if_fail() and friends are meant to be used to catch programming
errors (like invalid input to functions), not runtime error handling.
Looks like this got enabled by accident when adding it to v4l2sink,
so undo this for now. Not sure it makes much sense in a GStreamer
context with current hardware.
This reverts commit 9e1d419d07.
Reverting this since it adds unreviewed and bad API to v4l2src
(property of type enum, with seemingly random and unsorted values).
output devices should use get/set output, and in either case we should
not print a warning message if the ioctl fails but the device does not
claim to support the tuner interface
If xoverlay is available, v4l2sink should create a window for the overlay to
display in.
The window automatically tries to make itself as large as possible.
This works well on a small screen, but perhaps should first attempt to use
the size of the video that is played (no scaling).
Special case check for sub-buffers: In certain cases, places like
GstBaseTransform, which might check that the buffer is writable before copying
metadata, timestamp, and such, will find that the buffer has more than one
reference to it. In these cases, they will create a sub-buffer with an offset=0
and length equal to the original buffer size.
This could happen in two scenarios: (1) a tee in the pipeline, and (2) because
the refcnt is incremented in gst_mini_object_free() before the finalize function
is called, and decremented after it returns.. but returning this buffer to the
buffer pool in the finalize function, could wake up a thread blocked in
_buffer_alloc() which could run and get a buffer w/ refcnt==2 before the thread
originally unref'ing the buffer returns from finalize function and decrements
the refcnt back to 1!
This is related to issue #545501
The size of the buffer would be zero'd out in gst_v4l2_buffer_finalize()
after the buffer is qbuf'd or pushed onto the queue of available buffers..
leaving a race condition where the thread waiting for the buffer could awake
and set back a valid size before the finalizing thread zeros out the length.
This would result that the newly allocated buffer has length of zero.
When v4l2sink goes to PAUSED->READY it only stops streaming, so the state
should be set to STATE_PENDING_STREAMON in case the element transitions
back to PLAYING.
We'd prefer to throttle the decoder if we run out of buffers, to keep a bound
on memory usage. Also, for OMAP4 it is a requirement of the decoder to not
alternate between memory alloced by the display driver and malloc'd userspace
memory.
note: this really only affects v4l2sink since gst_v4l2_buffer_pool_get() is
only called once per buffer in the v4l2src case (in
gst_v4l2src_buffer_pool_activate())
Most v4l2 drivers will get upset when you queue the same buffer twice in a
row without first dequeueing it.
Rendering of pre-roll buffers can be re-introduced later, but will require
tracking the state of the buffer, and avoiding to re-QBUF if the buffer has
already been passed to the driver.
When the decoder is using pad_alloc(), v4l2sink would behave badly if
the number of buffers ('queue-size' property) was not high enough to
account for all the buffers needed by the decoder, and other elements
(such as queues) between the decoder and v4l2sink. This patch
slightly increases the default number of buffers, and changes v4l2sink
to drop frames rather than return an error in case the number of
buffers is not high enough.
ximagesrc: fix various width/height calculations being off by one,
and make it so a single pixel width/height can be captured (except
the top left one, as 0,0,0,0 is reserved for full screen as per
the property comments).
with i686-apple-darwin10-gcc-4.2.1:
gstv4l2object.c: In function 'gst_v4l2_object_get_nearest_size':
gstv4l2object.c:1988: warning: format '%u' expects type 'unsigned int', but argument 12 has type 'gint *'
gstv4l2object.c:1988: warning: format '%u' expects type 'unsigned int', but argument 13 has type 'gint *'
it's perfectly ok for a video output device to not have overlay capabilities.
this patch removes the need to get/set the overlay parameters if the user
does not explicitely request one of the overlay properties
MPEG doesn't have a static size per frame, so don't pretend it has one
and fail when capturing because it doesn't match. Instead mark the size
as unknown and let the read frame grabbing method use a reasonable fallback
value (assuming that's only for actual streaming formats)
Fixes bug #628349.
The format list should be sorted from high ranks to low ranks. In the GSList
sorting function this means the compare needs to return a positive value if
format a has a lower rank than format b.
Among other things this fixes v4l2src to prefer non-emulated formats
to emulated formats when built against libv4l.
In the case we change the State from READY_TO_NULL the buffers in the pool
still hold an open dup file descriptor to the device, therefore the device
release function will not be called and the device will probably answer with
-EBUSY when we reopen it in the next NULL_TO_READY transition.
Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
See bug #622500 and #612244.
This allows set_caps to succeed if caps change in a way that
would not modify the format we're getting from the hardware.
Otherwise if not in NULL state, setting caps would fail
with EBUSY.
With this change, in some cases it's OK to go PLAYING->READY->PLAYING
rather than PLAYING->NULL->PLAYING to avoid a time-consuming close
and reopen of the device.
Fixes#621723
Fixes#621723 (partially)
set_caps can fail if the video device is running, in that case
setting its format leads to EBUSY.
If set_caps fails then we will not have set up the buffer pool
(it will be NULL) which leads to a crash when we try to pull
buffers. If we fail the negotiate on set_caps failure, then we
won't go to playing state and won't crash.
This is a small improvement. Of course, a nicer fix would
be to make set_caps work in the case where the format is
unchanged. If the format has changed, failing is
probably correct because we need to close the device
(go to NULL state) in order to set caps.
"Low" etc. are quality settings here (e.g. for the internal resampler).
Some day when we use GLib's i18n functions we might want to use
NC_() and g_dpgettext2() here instead of the comments.
Fixes#555967.
OSS4 supports per-stream volume control, so expose this using the right
API, so that playbin2 and applications like totem can make use of it
(instead of using a volume element for volume control).
Fixes#614305.
When iterating the formats table, we can just pass the whole
entry to our helper function, which avoids iterating the table
again to find the entry structure from the passed format id.
Also accept formats that are not natively supported by the
hardware, OSS4 can convert them internally. List the native
formats first in the caps though, to express our preference
for the native formats. We need this in order to support the
case properly where the audio hardware supports only e.g.
little endian PCM, but the host is big endian, since many
audio elements only support native endianness and make the
reasonable assumption that any audiosink will be able to
handle audio in native endianness.
Based on patch by Jerry Tan <jerry.tan@sun.com>
Fixes#614317.
A side effect is that it passes -Wformat-nonliteral and doesn't read
invalid memory in some cases, like when the mixer track contains
a % sign or there is a number but not a known mixer name.
Code cleanups, general improvements, support for the
new mixer flags in latest gst-plugins-base.
Fixes: #584252
Patch By: Brian Cameron <brian.cameron@sun.com>
Patch By: Garrett D'Amore <garrett.damore@sun.com>
Original commit message from CVS:
* sys/oss4/oss4-mixer.c:
* sys/oss4/oss4-sink.c:
* sys/oss4/oss4-source.c:
Add some spaces in translateable strings.
Fixes: #555969#555968#555965
Original commit message from CVS:
Patch by: Frederic Crozat <fcrozat@mandriva.org>
* ext/sndfile/gstsf.c: (plugin_init):
* sys/dvb/gstdvbsrc.c: (gst_dvbsrc_plugin_init):
* sys/oss4/oss4-audio.c: (plugin_init):
Make sure gettext returns translations in UTF-8 encoding rather
than in the current locale encoding (#546822).
Original commit message from CVS:
* ext/dc1394/gstdc1394.c:
* ext/ivorbis/vorbisdec.c:
* ext/jack/gstjackaudiosink.c:
* ext/metadata/gstmetadatademux.c:
* ext/mythtv/gstmythtvsrc.c:
* ext/theora/theoradec.c:
* gst-libs/gst/app/gstappsink.c:
* gst/bayer/gstbayer2rgb.c:
* gst/deinterlace/gstdeinterlace.c:
* gst/rawparse/gstaudioparse.c:
* gst/rawparse/gstvideoparse.c:
* gst/rtpmanager/gstrtpbin.c:
* gst/rtpmanager/gstrtpclient.c:
* gst/rtpmanager/gstrtpjitterbuffer.c:
* gst/rtpmanager/gstrtpptdemux.c:
* gst/rtpmanager/gstrtpsession.c:
* gst/rtpmanager/gstrtpssrcdemux.c:
* gst/selector/gstinputselector.c:
* gst/selector/gstoutputselector.c:
* gst/videosignal/gstvideoanalyse.c:
* gst/videosignal/gstvideodetect.c:
* gst/videosignal/gstvideomark.c:
* sys/oss4/oss4-mixer.c:
* sys/oss4/oss4-sink.c:
* sys/oss4/oss4-source.c:
Do not use short_description in section docs for elements. We extract
them from element details and there will be warnings if they differ.
Also fixing up the ChangeLog order.
Original commit message from CVS:
* sys/oss4/oss4-mixer.c: (gst_oss4_mixer_open):
* sys/oss4/oss4-property-probe.c:
(gst_oss4_property_probe_find_device_name),
(gst_oss4_property_probe_find_device_name_nofd):
* sys/oss4/oss4-property-probe.h:
* sys/oss4/oss4-sink.c: (gst_oss4_sink_get_property):
* sys/oss4/oss4-source.c: (gst_oss4_source_get_property):
Make device-name probing in NULL state work better (e.g. for the
gnome-control-center sound capplet).
Original commit message from CVS:
Based on patch by: Clive Wright <clive_wright ntlworld com>
* sys/oss4/oss4-mixer-slider.c: (gst_oss4_mixer_slider_unpack_volume):
Apparently mono sliders have the mono value repeated in the upper bits,
so mask those out when reading them. Probably makes the mixer applet
work properly in some more cases.
Instead of using BaseSrc default format GST_FORMAT_BYTES, send it in
GST_FORMAT_TIME.
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
Fixes#611659
The compiler wants a cast here even though the type is already
typedefed as 64-bit integer (presumably because glib has typedefed
guint64 to unsigned long here).
Don't leak a string everytime get_uri() is called and a device
has been set. There's a limited number of devices, so just
intern the string instead of doing more elaborate housekeeping
and storing it in the instance struct or so.
Old videodevice2.h kernel headers used ioctl stuff without
including ioctl.h, making compilation fail on older systems.
Note: Including ioctl.h here is only a workaround for old kernel
headers, should be removed once everybody has new enough headers.
Fixes bug #597867.
For cameras/drivers that don't support e.g. VIDIOC_G_PARM we'd end up without
a framerate and would try to divide by 0, causing run-time warnings and all
frames to be timestamped with 0, which makes sinks that sync against the clock
drop them, causing 'hangs' (observed with the pwc driver and a Logitech QuickCam
Pro 4000). So if we do not know the framerate, simply don't adjust the
timestamps. Fixes#591451.
Clear format list and probed caps when going to NULL so if a new device
is set we'll probe the formats again instead of using previously
detected ones. Fixes bug #591747.
It seems to cause strange occasional high latencies (almost 200ms) when dequeuing buffers from _buffer_alloc(). It is simpler and seems to work much better to dqbuf from the same thread that is queuing the next buffer.
This also does the following changes:
(1) pull the bufferpool code out into gstv4l2bufferpool.c, and make a
bit more generic so it can be used both for v4l2src and v4l2sink
(2) move some of the device probing/configuration/caps stuff into
gstv4l2object.c so it does not have to be duplicated between
v4l2src and v4l2sink
Fixes bug #590280.
The v4l2 driver for USB webcams on OpenSolaris does not support select()
calls. Detect when select() fails, and skip polling the device afterward,
which restores the pre 0.10.14 behaviour on OpenSolaris.
Signed-off-by: Jan Schmidt <thaytan@noraisin.net>
We need a cast here for pointer arithmetic to work correctly, but some
MSVC versions don't seem to like 'byte', so use guint8 here. Hopefully
fixes#585361.
Fix the setting of toggle switches on some broken audio drivers which
report that no audio ports are settable by ignoring the mod_port field
there.
Add some debug statements.
Fix a FIXME now that Good relies on a new enough gst-plugins-base.
Use new audio mixer flags added in Base 0.10.23 to expose flags and options
on the SunAudio devices.
Fixes: #583593
Patch By: Brian Cameron <brian.cameron@sun.com>
Patch By: Garrett D'Amore <garrett.damore@sun.com>