Commit graph

758 commits

Author SHA1 Message Date
Tim-Philipp Müller
9dcb60822f v4l2: define V4L2_FIELD_INTERLACED_{TB,BT} if not available in header
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
2011-01-12 22:41:17 +00:00
Tim-Philipp Müller
09d19e7dcd v4l2sink: don't put functional code like ioctl calls into g_return_if_fail()
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.
2011-01-07 01:35:45 +00:00
Tim-Philipp Müller
06b68c81b4 v4l2src: undo presumably accidental enablement of the GstXOverlay interface
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.
2011-01-03 15:16:48 +00:00
Tim-Philipp Müller
b0eb10cc53 v4l2: mark v4l2sink as experimental and build only if --enable-experimental is passed
It's not really of 'good' quality yet, but there's a lot of
code shared with v4l2src, so not so easy to move it elswhere.

https://bugzilla.gnome.org/show_bug.cgi?id=612244
2011-01-02 11:40:29 +00:00
Tim-Philipp Müller
0be6bd355a Revert "v4l2: add norm property"
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).
2011-01-02 11:40:28 +00:00
Rob Clark
6c8268dbfd v4l2: add interlaced support 2010-12-29 11:46:42 -06:00
Rob Clark
538d3a959b v4l2sink: add navigation support 2010-12-29 11:46:42 -06:00
Rob Clark
9e1d419d07 v4l2: add norm property
Based on a patch by Guennadi Liakhovetski.
2010-12-29 11:46:42 -06:00
Rob Clark
bb07a39c67 v4l2: cleanup get/set input/output
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
2010-12-29 11:46:41 -06:00
Rob Clark
bf88547489 v4l2xoverlay: add support to create window
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).
2010-12-29 11:46:41 -06:00
Rob Clark
ff5494046a v4l2sink: special handling for cases gst_buffer_make_metadata_writable()
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
2010-12-29 11:46:41 -06:00
Rob Clark
c3721534c9 v4l2: fix race condition
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.
2010-12-29 11:46:41 -06:00
Rob Clark
34e448980b v4l2sink: add properties to control crop 2010-12-29 11:46:41 -06:00
Rob Clark
67cd90408f v4l2: re-enable x-overlay support 2010-12-29 11:46:41 -06:00
Rob Clark
417b899c44 v4l2sink: fix for PAUSED->READY->PAUSED state transitions
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.
2010-12-29 11:46:41 -06:00
Rob Clark
61db502a12 v4l2sink: add "min-queued-bufs" property 2010-12-29 11:46:41 -06:00
Rob Clark
0cec72b97e v4l2sink: Add support for blocking dequeue.
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.
2010-12-29 11:46:40 -06:00
Rob Clark
ecfbaf58a5 v4l2: clear flags before reusing buffer from buffer pool
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())
2010-12-29 11:46:40 -06:00
Rob Clark
e24cfa7250 v4l2sink: don't render preroll buffers
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.
2010-12-29 11:46:40 -06:00
Rob Clark
48a8b53bdd v4l2sink: Improve behavior for shared buffers.
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.
2010-12-29 11:46:40 -06:00
Rob Clark
60c1a44917 v4l2: fix typo 2010-12-23 16:44:06 -06:00
Edward Hervey
d2a43eb8ff ximagesrc: remote is a boolean (and not uint) property 2010-12-22 21:27:11 +01:00
Vincent Penquerc'h
7ac31b3d22 ximagesrc: change from XGetImage to XGetSubImage dependant on a property
ximagesrc: change from XGetImage to XGetSubImage dependant on a property
 to avoid unnecessary performance hits by default.
2010-12-18 15:35:19 +01:00
Vincent Penquerc'h
ac872f61cf ximagesrc: use XGetSubImage instead of XGetImage, works with remote X
ximagesrc: use XGetSubImage instead of XGetImage, works with remote X
 (on my setup anyway...)
2010-12-18 15:35:09 +01:00
Vincent Penquerc'h
fbd9581f87 ximagesrc: fix various width/height calculations being off by one,
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).
2010-12-18 15:34:59 +01:00
Rob Clark
66387181ac fix compile errors on macosx
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 *'
2010-12-17 19:19:35 -06:00
Janne Grunau
ab69275f4d v4l2src: set top field first for interlaced buffers if v4l2 exports it
https://bugzilla.gnome.org/show_bug.cgi?id=634393
2010-12-04 16:42:21 +00:00
Janne Grunau
351ac54822 v4l2src: check field information and set interlaced caps accordingly
Reject the format if the field type is not supported.

https://bugzilla.gnome.org/show_bug.cgi?id=634391
2010-12-04 16:39:35 +00:00
Stefan Kost
d8167e3071 various (gst): add a missing G_PARAM_STATIC_STRINGS flags 2010-10-13 18:00:28 +03:00
Stefan Kost
77b656eec1 various (sys): add a missing G_PARAM_STATIC_STRINGS flags 2010-10-13 17:39:36 +03:00
IOhannes m zmölnig
b37845dac0 v4l2sink: Only get/set overlay params if needed
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
2010-10-10 11:23:39 +02:00
IOhannes m zmölnig
4ba93e9f1a v4l2sink: Protect against NULL-pointer access
gst_v4l2sink_change_state() would free the pool without checking whether there
was a valid pool...
2010-10-10 11:23:39 +02:00
Philippe Normand
672bfc3369 v4l2: use the xoverlay APIs 2010-09-21 13:40:33 +02:00
Philippe Normand
720369c06e osxvideosink: use the new xoverlay APIs
Also bumped -base requirements.
2010-09-21 13:40:33 +02:00
Tim-Philipp Müller
601b993f95 docs: add gtk-doc chunks with Since: markers for new v4l2src properties 2010-09-15 17:05:30 +01:00
Stefan Kost
1f4f4581d8 v4l2src: don't skip calculating the duration 2010-09-10 17:00:58 +03:00
Stefan Kost
a08d4a5447 v4l2src: add controlable colorbalance parameters
Expose colorbalance controls as object properties (like we do on xvimagesink).
Make them controlable.
2010-09-10 17:00:58 +03:00
David Schleef
178c57be4f v4l2src: add decimate property 2010-09-04 12:39:26 -07:00
Sjoerd Simons
e9a30e454a v4l2src: Use GstBaseSrc::block-size as fallback size 2010-09-04 14:52:11 +02:00
Sjoerd Simons
74d7521a7c v4l2src: Fix using mpegts via the mmap interface
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.
2010-09-04 14:52:11 +02:00
Tim-Philipp Müller
6321d9910d v4l2src: also log pixel formats in sorted order 2010-08-06 20:07:26 +01:00
Sjoerd Simons
dcea1b2dfc v4l2: sort formats in the right order so that non-emulated formats are prefered
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.
2010-08-06 20:07:21 +01:00
Michael Grzeschik
34c7cabe2c v4l2sink: destroy buffer pool when changing state to NULL
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.
2010-07-06 11:03:39 +01:00
Stefan Kost
23106e243b v4l2: precalculate duration
Have frame duration in the instance struct and calculate it after changing the caps.
2010-06-22 15:46:51 +03:00
Stefan Kost
ac8e87bb2c v4l2sink: use glib defines in property declarations for readability 2010-06-21 12:19:59 +03:00
Stefan Kost
f9fe85dbb2 v4l2: use G_PARAM_STATIC_STRINGS to save a few bytes and strdups 2010-06-21 12:19:59 +03:00
Sebastian Dröge
34d42e4ea3 ximagesrc: Fix NULL pointer dereference when allocation of the ximage fails 2010-06-16 19:30:25 +02:00
Havoc Pennington
f06b105058 v4l2src: do not try to change device format if it's already correct
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
2010-06-16 17:48:47 +02:00
Havoc Pennington
9b9f9d0a2a v4l2src: in negotiate, check for error return from set_caps
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.
2010-06-16 17:48:47 +02:00
Sebastian Dröge
acd0c1ff90 v4l2: Initialize variable 2010-06-15 19:47:16 +02:00