Commit graph

84 commits

Author SHA1 Message Date
Wim Taymans
c807bfb693 v4l2: unref copied buffer
After we copy the incomming buffer to one of our bufferpool buffers, unref the
target buffer after rendering so that it is put back in the pool.
2011-07-15 13:29:42 +01:00
Wim Taymans
47816e1155 v4l2: fix error messages 2011-07-15 12:00:54 +02:00
Wim Taymans
21f532ae10 v4l2: convert to GstBufferPool
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.
2011-07-15 11:27:18 +02:00
Wim Taymans
ef18a3c09b v4l2: merge code 2011-07-14 16:21:36 +02:00
Wim Taymans
33d93069c1 v4l2: Move output details to device object
Move the details of how a buffer is rendered to the device object.
2011-07-14 16:12:15 +02:00
Wim Taymans
7c5f5b1b7f v4l2: move capture code to device object
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.
2011-07-13 18:32:00 +02:00
Wim Taymans
ebd03a3fad v4l2: add some more debug 2011-07-13 16:58:08 +02:00
Wim Taymans
387e76114d v4l2: start streaming for the output as well 2011-07-13 16:40:39 +02:00
Wim Taymans
d9e61954a1 v4l2: Let the device object manage the 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.
2011-07-13 16:33:58 +02:00
Wim Taymans
398001f20d v4l2: don't store stride in the videoinfo
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.
2011-07-13 13:52:30 +01:00
Wim Taymans
be83e4f704 v4l2: small cleanups 2011-07-13 13:15:16 +02:00
Wim Taymans
01def08e7a v4l2: improve caps parsing
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.
2011-07-13 13:04:40 +02:00
Wim Taymans
c83730fc11 v4l2: use errno 2011-07-13 11:40:11 +01:00
Wim Taymans
6d97bfc41f v4l2: handle EINVAL without posting a warning
EINVAL means that a call is not supported, we only want to post a WARNING when
something is really wrong.
2011-07-13 11:36:54 +02:00
Wim Taymans
50ce1807f0 v4l2: only set framerate for capture for now 2011-07-13 11:29:26 +02:00
Wim Taymans
9f4cf3be58 v4l2: Move configuration of framerate to _set_format
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.
2011-07-13 11:19:28 +02:00
Wim Taymans
100d46b5b9 v4l2: fix return value... 2011-07-12 19:13:45 +02:00
Wim Taymans
e8ae00f5fc v4l2: simplify setting the capture format
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.
2011-07-12 19:03:32 +01:00
Wim Taymans
baa03a951b v4l: handle object out of the normal flow 2011-07-12 18:29:35 +01:00
Wim Taymans
0dcf0aebb0 v4l2: Let the bufferpool own the V4l2Object
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.
2011-07-12 18:13:42 +02:00
Wim Taymans
59b86d2558 v4l: pass the bytesperline around
When setting a format, return the bytesperline to the caller so that it can be
used to allocate buffers.
2011-07-12 16:46:21 +01:00
Wim Taymans
3b4afcb8df v4l2: fix gray format, use filter in getcaps 2011-07-08 16:37:11 +02:00
Wim Taymans
b8640c8cd9 v4l2src: port to new video formats 2011-07-08 14:34:40 +02:00
Wim Taymans
d89790d545 Merge branch 'master' into 0.11
Conflicts:
	gst/avi/gstavidemux.c
	gst/rtp/gstrtpac3depay.c
	gst/rtp/gstrtpg726depay.c
	gst/rtp/gstrtpmpvdepay.c
	gst/videofilter/gstgamma.c
2011-05-24 17:34:19 +02:00
Rob Clark
9c9585116c v4l2: add norm property
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
2011-05-24 10:47:26 +02:00
Wim Taymans
e15651816e Merge branch 'master' into 0.11 2011-05-17 16:13:59 +02:00
Edward Hervey
1a310d558c v4l2objects: Only allow mpeg-ts on source objects
Ugly fix for #648312
2011-05-17 09:25:23 +02:00
Wim Taymans
a4fdb8ee44 Merge branch 'master' into 0.11
Conflicts:
	tests/examples/cairo/Makefile.am
2011-03-08 10:14:20 +00:00
David Schleef
910a6f0c96 v4l2: Use #ifdefs for V4L2_PIX_FMT_PJPG
It's only recently added to kernel headers.
2011-03-04 18:38:39 -08:00
Wim Taymans
759a3507d7 Merge branch 'master' into 0.11
Conflicts:
	configure.ac
2011-02-28 11:58:05 +01:00
Thiago Santos
5dac2e5fde v4l2: Add PJPG mapping
Adds mapping of progressive jpeg format
2011-02-15 16:14:25 -03:00
Mark Nauwelaerts
6b86b56abd v4l2: fix interlaced set_format configuration
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).
2011-02-04 10:49:06 +01:00
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
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
9e1d419d07 v4l2: add norm property
Based on a patch by Guennadi Liakhovetski.
2010-12-29 11:46:42 -06:00
Rob Clark
67cd90408f v4l2: re-enable x-overlay support 2010-12-29 11:46:41 -06: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
Wim Taymans
22443cfb13 v4l2: don't abuse the class lock
Use a new static lock to protect the probed device list instead of the object
class lock.
2010-12-07 11:40:58 +01: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
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
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
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
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
Sebastian Dröge
acd0c1ff90 v4l2: Initialize variable 2010-06-15 19:47:16 +02: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
3342b1679e Add -Wmissing-declarations -Wmissing-prototypes warning flags
And fix all the warnings.
2010-03-17 18:23:28 +01:00