Commit graph

281 commits

Author SHA1 Message Date
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
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
David Schleef
3478f31664 v4l2src: Fix element description 2010-06-11 16:24:15 -07:00
Benjamin Otte
3f511ec361 Add -Wwrite-strings to the configure flags
... and fix all warnings
2010-03-21 14:17:47 +01:00
Benjamin Otte
cccfeaa59c gst_element_class_set_details => gst_element_class_set_details_simple 2010-03-18 14:32:00 +01:00
Benjamin Otte
1055aaa9cb Add -Wredundant-decls warning flag
Also fix compile issues
2010-03-17 19:35:10 +01:00
Benjamin Otte
3342b1679e Add -Wmissing-declarations -Wmissing-prototypes warning flags
And fix all the warnings.
2010-03-17 18:23:28 +01:00
Stefan Kost
0134e950fa v4l2: log more details in buffer pool finalize
Helps to align with the loggin from libv4l.
2010-02-16 10:15:22 +02:00
Stefan Kost
f94bfc65a5 v4l2: init datastructures after pre-conditions checks 2010-02-16 10:15:22 +02:00
Tim-Philipp Müller
2baa107562 v4l2: printf format string fix
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).
2010-02-15 12:13:43 +00:00
Tim-Philipp Müller
532bbf36ee v4l2sink: change rank to NONE so it is never autoplugged 2010-02-13 20:59:42 +00:00
Tim-Philipp Müller
114ba3dc6e v4lsink: lower rank to MARGINAL 2010-02-12 15:56:01 +00:00
Tim-Philipp Müller
5290b514c8 v4l2: fix unportable printf format 2010-02-01 09:18:53 +00:00
Stefan Kost
21a8cb1e06 v4l2src: don't deref NULL
Error out when the pool gets shutdown.
2010-01-25 17:23:43 +02:00
Stefan Kost
8576a11dae Revert "v4l2src: don't deref NULL"
This reverts commit 3d9d34bd60.
2010-01-25 17:21:13 +02:00
Stefan Kost
3d9d34bd60 v4l2src: don't deref NULL
Error out when the pool gets shutdown.
2010-01-25 14:16:22 +02:00
Stefan Kost
30b2cd42c5 v4l2: move G_END_DECLS to the end 2010-01-18 14:57:42 +02:00
Stefan Kost
e789d2253f v4l2: fix bufferpool file names in header comment 2010-01-18 14:55:38 +02:00
Tim-Philipp Müller
d68689255d v4l2src: fix memory leak in new uri handler code
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.
2010-01-05 09:49:16 +00:00
Edward Hervey
121c001437 v4l2src: Add GstURIHandler interface. Fixes #601143
This allows using v4l2://[<device>]
2009-12-21 13:54:40 +01:00
Sebastian Dröge
7ef43f021b v4l2: Make sure to initialize variables before using them 2009-11-11 10:45:23 +01:00
Thiago Santos
72af90ae31 v4l2src: Set duration on buffers
Use framerate to estimate duration of buffers.

Fixes #590362
2009-10-14 08:00:49 -03:00
Pau Garcia i Quiles
f10435580f v4l2: Include sys/ioctl.h for the V4L ioctl requests
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.
2009-10-09 11:34:16 +02:00
Stefan Kost
00ffa9c2dd v4l2src: add a function pointer for get_frame function and optimize a bit
Use a function-pointer for mmap/read, as this can't change during capture. Also
sprinkle a few G_LIKELY/UNLIKELY to improve the error-less code path.
2009-09-11 22:24:47 +03:00
Stefan Kost
1a945a32cc v4l2: log buffer copies on queue underrun in perf category
v4l2src has a slow path where it does buffer-copies when it runs out of queued
buffers. Log this to performance category to help monitoring it.
2009-09-11 22:19:23 +03:00
Stefan Kost
0a68003efe docs: fix gtk-doc warnings 2009-09-10 10:26:23 +03:00
Wim Taymans
5580571f8d whitespace fixes 2009-09-09 10:27:55 +02:00
Wim Taymans
796dec5920 v4l2src: add support for mpeg formats 2009-09-07 18:28:51 +02:00
David Schleef
55d2754098 Remove Ronald Bultje from Authors field
Replaced with "GStreamer maintainers
<gstreamer-devel@lists.sourceforge.net>" or just removed,
depending on the number of other authors.
2009-09-05 20:53:10 -07:00
Sebastian Dröge
686f8376a8 v4l2: Define V4L2_FMT_FLAG_EMULATED if it's not defined yet
libv4l2 already uses this flag, even on Linux kernel versions
before 2.6.32.
2009-09-04 09:32:42 +02:00
Sebastian Dröge
0c6fba9506 v4l2: Fix stupid typo in last commit 2009-09-03 20:40:17 +02:00
Sebastian Dröge
4fda384a83 v4l2: Put emulated formats behind native formats
Fixes bug #593764.
2009-09-03 20:39:44 +02:00
Hans de Goede
10d41286d5 v4l2src: fix 'hang' with some cameras caused by bad timestamping if no framerate is available
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.
2009-08-14 13:30:31 +01:00
Filippo Argiolas
a3a61f8940 v4l2src: clear format list in READY->NULL
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.
2009-08-14 10:15:43 +02:00
Tim-Philipp Müller
9590df3c2e v4l2: fix make distcheck by disting some more headers 2009-08-11 03:08:01 +01:00
Tim-Philipp Müller
8c8e6af45b v4l2src: if max == min width/height put an int in the probed caps, not an int range
Fixes #560033.
2009-08-09 14:19:42 +01:00
Sebastian Dröge
198604c108 v4l2: Directly use GST_PTR_FORMAT for printing caps with the LOG_CAPS macro 2009-08-04 14:45:31 +02:00
Sebastian Dröge
23dbb15ff5 v4l2: Remove some OMAP specific hacks
They require special build flags and are not useful in general.
2009-08-04 09:32:07 +02:00
Rob Clark
99e2ac121d v4l2sink: change where buffers get dequeued
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.
2009-08-04 09:22:29 +02:00
Rob Clark
f19cfbda96 v4l2: Add v4l2sink element
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.
2009-08-04 09:16:56 +02:00