Commit graph

216 commits

Author SHA1 Message Date
Wim Taymans
4b8975f867 update for removed property probe 2011-12-21 11:59:46 +01:00
Vincent Penquerc'h
c0e101e93f various: fix pad template leaks
https://bugzilla.gnome.org/show_bug.cgi?id=662664
2011-11-28 13:30:27 +00:00
Wim Taymans
797523efbd _peer_get_caps() -> _peer_query_caps() 2011-11-15 18:04:44 +01:00
Wim Taymans
b2d508ac40 update for _get_caps() -> _query_caps() 2011-11-15 18:04:44 +01:00
Tim-Philipp Müller
c27bbe4be2 Update for GstURIHandler get_protocols() changes 2011-11-13 23:44:44 +00:00
Tim-Philipp Müller
a150d1e734 soup, pushfile, rtsp, udp, v4l2: update for GstURIHandler API changes 2011-11-13 18:50:51 +00:00
Wim Taymans
88e398b0ea update for removed fixate function 2011-11-10 11:03:18 +01:00
Stefan Sauer
fb162c8eb4 controller: port to new controller location and api 2011-11-04 20:15:48 +01:00
Wim Taymans
b1ef7e8a86 update for meta api change 2011-11-02 09:06:37 +01:00
Wim Taymans
75e153bb13 allocation: fix for vmethod changes 2011-08-26 14:20:49 +02:00
Wim Taymans
44c1589b48 v4l2: improve fixate function
Use new core function to fixate a field.
Chain up to parent fixate function.
2011-08-17 17:57:11 +02:00
Wim Taymans
1b1fb68c23 v4l2src: call set_caps method of baseclass
Call the baseclass set_caps function to make it send the caps event and
properly trigger the negotiation functions.
2011-08-04 16:35:46 +02:00
Wim Taymans
add1cbdbd8 v4l2: activate the pool in fallback
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.
2011-08-04 12:56:47 +01:00
Wim Taymans
752a6778b2 v4l: change for new API 2011-07-29 17:21:36 +02:00
Wim Taymans
63fc64dd98 v4l2: remove unused variables
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.
2011-07-27 16:46:46 +02:00
Wim Taymans
f7c500fe9c v4l2src: add metadata 2011-07-27 13:43:08 +02:00
Wim Taymans
8c4241427a v4l2: rename a variable
Rename the size variable to sizeimage and fill it with the size that has been
given to use by the v4l2 driver instead of making something up..
2011-07-26 16:15:05 +02:00
Wim Taymans
55eb26f1e7 v4l2: More work on bufferpools
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.
2011-07-18 18:54:49 +02:00
Wim Taymans
4440801ace v4l2: implement setup_allocation
Implement the setup_allocation vmethod, we'll hopefully do something clever in
there later.
2011-07-15 16:55:50 +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
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
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
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
b7ad28ba53 v4l2: remove more unused parameters 2011-07-12 18:41:47 +01:00
Wim Taymans
851f550003 v4l2: various cleanups
Various cleanups, avoids useless casts, move error handling outside of the main
code flow.
Negotiate to a resonable resolution instead of the max resolution.
2011-07-11 12:15:12 +02:00
Wim Taymans
b8640c8cd9 v4l2src: port to new video formats 2011-07-08 14:34:40 +02:00
Wim Taymans
e20d6f0bb5 v4l2: port to 0.11 2011-07-08 12:49:12 +02:00
Robert Swain
e02b7e7fdf v4l2src: Address unused but set variable
The v4l2object formats list was being obtained into a local variable and
then still used from the context. Make use of the local variable.
2011-04-16 13:15:03 +01: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
Rob Clark
6c8268dbfd v4l2: add interlaced support 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
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
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
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
f9fe85dbb2 v4l2: use G_PARAM_STATIC_STRINGS to save a few bytes and strdups 2010-06-21 12:19:59 +03: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
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
3342b1679e Add -Wmissing-declarations -Wmissing-prototypes warning flags
And fix all the warnings.
2010-03-17 18:23:28 +01: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
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
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
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
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
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
Elaine Xiong
085f87d85f v4l2: Fix v4l2src on OpenSolaris
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>
2009-07-19 11:42:13 +01:00
Stefan Kost
0b475ba774 v4l2: open/close the device in READY
This allows to query the device in READY. Before one need to switch it to PAUSED
and that also starts streaming.
2009-06-22 16:24:46 +03:00
Stefan Kost
751f7fc5f8 v4l2: cleanup and commenting
Remove newlines inserted by gst-indent once. Remove unused var from instance
struct. Add comments. Add another #define for default property value.
2009-05-26 16:29:46 +03:00
Stefan Kost
ad5702d492 v4l2src: move duplicated timestamping and buffer metadata code to _create()
This will include the latency changes also in the mmap case.
2009-03-25 10:08:41 +02:00
Stefan Kost
652a7fb91f v4l2src: remove win32 ifdefs introduced by commit cff3f46760eac74c9bbd7a36aca44fedf327424b
V4l2src is under sys and does not exists/run under windows anyway.
2009-03-25 10:06:48 +02:00
Sjoerd Simons
b6755a7000 Wait for a frame to become available before capturing it
Use GstPoll to wait for the fd of the video device to become readable before
trying to capture a frame. This speeds up stopping v4l2src a lot as it no
longer has to wait for the next frame, especially when capturing with low
framerates or when the video device just never generates a frame (which seems a
common issue for uvcvideo devices)

Fixes bug #563574.
2009-03-01 19:55:26 +01:00
Wim Taymans
04359c8382 Conditionally compile code for YVYU
Only compile the code for the YVYU format when the format is actually defined.
Spotted by tmatth on IRC.
2009-02-23 19:53:58 +01:00
Wim Taymans
42c8aa7abc Add YVYU format to caps
Add YVYU format to the caps. We don't have anything to handle these caps yet,
though.
2009-02-23 17:05:43 +01:00
Stefan Kost
8e462968cf Remove version numbers from a few gst-launch examples.
The majority of the examples doe not use -0.10 and this will also help us to maintain the docs.
2009-01-29 11:07:59 +02:00
Stefan Kost
6335307b97 Update and add documentation for platform specific plugins (sys).
Link to properties. Correct titles for examples. Fix examples.
2009-01-29 10:12:43 +02:00
Tim-Philipp Müller
6c565d2ee1 sys/v4l2/gstv4l2src.c: Fix error code (the message string also needs love, but not today).
Original commit message from CVS:
* sys/v4l2/gstv4l2src.c: (gst_v4l2src_get_read):
Fix error code (the message string also needs love, but not today).
2009-01-20 15:33:05 +00:00
Jan Schmidt
90e9d8e0e1 sys/v4l2/gstv4l2src.c: Remove () from translateable string, so that it makes more sense.
Original commit message from CVS:
* sys/v4l2/gstv4l2src.c:
Remove () from translateable string, so that it makes more sense.
2009-01-07 16:09:47 +00:00
Sascha Hauer
d576b9fdbe sys/v4l2/gstv4l2src.c: Add support for grayscale v4l2 devices. Fixes bug #566616.
Original commit message from CVS:
Patch by: Sascha Hauer <s dot hauer at pengutronix dot de>
Luotao Fu <l dot fu at pengutronix dot de>
* sys/v4l2/gstv4l2src.c: (gst_v4l2src_v4l2fourcc_to_structure),
(gst_v4l2_get_caps_info):
Add support for grayscale v4l2 devices. Fixes bug #566616.
2009-01-05 12:30:40 +00:00
Fabricio Godoy
5a4565868d sys/: Fix some spelling mistakes. Fixes #556802.
Original commit message from CVS:
Patch by: Fabricio Godoy <skarllot at gmail dot com>
* sys/oss/gstosssink.c: (gst_oss_sink_open):
* sys/oss/gstosssrc.c: (gst_oss_src_open):
* sys/v4l2/gstv4l2src.c: (gst_v4l2src_get_mmap):
* sys/v4l2/v4l2_calls.c: (gst_v4l2_fill_lists):
Fix some spelling mistakes. Fixes #556802.
2008-11-13 17:45:59 +00:00
Bastien Nocera
a50de826a2 Optionally use libv4l to access v4l2 devices. Fixes bug #545033.
Original commit message from CVS:
Patch by: Bastien Nocera <hadess at hadess dot net>,
Hans de Goede <jwrdegoede at fedoraproject dot org>
* configure.ac:
* sys/v4l2/Makefile.am:
* sys/v4l2/gstv4l2src.c: (gst_v4l2src_get_read):
* sys/v4l2/v4l2_calls.c: (gst_v4l2_get_capabilities),
(gst_v4l2_fill_lists), (gst_v4l2_open), (gst_v4l2_close),
(gst_v4l2_get_norm), (gst_v4l2_set_norm), (gst_v4l2_get_frequency),
(gst_v4l2_set_frequency), (gst_v4l2_signal_strength),
(gst_v4l2_get_attribute), (gst_v4l2_set_attribute),
(gst_v4l2_get_input), (gst_v4l2_set_input):
* sys/v4l2/v4l2_calls.h:
* sys/v4l2/v4l2src_calls.c: (gst_v4l2_buffer_finalize),
(gst_v4l2_buffer_new), (gst_v4l2_buffer_pool_finalize),
(gst_v4l2_buffer_pool_new), (gst_v4l2_buffer_pool_activate),
(gst_v4l2src_fill_format_list),
(gst_v4l2src_probe_caps_for_format_and_size),
(gst_v4l2src_probe_caps_for_format), (gst_v4l2src_grab_frame),
(gst_v4l2src_set_capture), (gst_v4l2src_capture_init),
(gst_v4l2src_capture_start), (gst_v4l2src_capture_stop),
(gst_v4l2src_get_nearest_size):
Optionally use libv4l to access v4l2 devices. Fixes bug #545033.
2008-11-04 12:32:48 +00:00
Stefan Kost
2ea5c05241 sys/v4l2/: Fix memory leaks. Small code cleanups : No need for empty _init(). No need to memset instance structures. ...
Original commit message from CVS:
* sys/v4l2/gstv4l2object.c:
* sys/v4l2/gstv4l2src.c:
* sys/v4l2/gstv4l2src.h:
* sys/v4l2/v4l2_calls.c:
* sys/v4l2/v4l2src_calls.c:
Fix memory leaks. Small code cleanups : No need for empty _init(). No
need to memset instance structures. Some more FIXME's.
2008-08-26 12:27:11 +00:00
Wim Taymans
713e800026 sys/v4l2/gstv4l2src.c: Add S910 and PWC formats with a low priority.
Original commit message from CVS:
* sys/v4l2/gstv4l2src.c: (gst_v4l2src_v4l2fourcc_to_structure),
(gst_v4l2_get_caps_info):
Add S910 and PWC formats with a low priority.
* sys/v4l2/v4l2src_calls.c: (gst_v4l2src_format_get_rank),
(gst_v4l2src_probe_caps_for_format):
Add more debugging.
2008-08-21 12:12:00 +00:00
Edward Hervey
5cf61c6a80 sys/v4l2/gstv4l2src.c: Properly set the maximum latency value, in the same way it is done in v4lsrc.
Original commit message from CVS:
* sys/v4l2/gstv4l2src.c: (gst_v4l2src_query):
Properly set the maximum latency value, in the same way it is done in
v4lsrc.
* sys/v4l2/v4l2src_calls.c:
Simplify fraction equality check, no need to use GValues for this.
2008-08-13 08:33:57 +00:00
Edward Hervey
27e20eadc0 sys/v4l2/gstv4l2src.c: Add warning messages stating exactly why the latency query failed.
Original commit message from CVS:
* sys/v4l2/gstv4l2src.c: (gst_v4l2src_query):
Add warning messages stating exactly why the latency query failed.
* sys/v4l2/v4l2src_calls.c: (gst_v4l2src_set_capture):
In some cases, the negotiated framerate might be the default one which
is already set internally. But we still need to mark it down in fps_n
and fps_d so that the latency query can happen properly.
2008-08-12 12:04:24 +00:00
Benoit Fouet
f2fb132b9c sys/v4l2/gstv4l2src.c: Avoid compiler warning by initialising variable to NULL (#543259).
Original commit message from CVS:
Patch by: Benoit Fouet <benoit.fouet purplelabs com>
* sys/v4l2/gstv4l2src.c: (gst_v4l2src_negotiate):
Avoid compiler warning by initialising variable to NULL (#543259).
2008-07-17 13:54:38 +00:00
Sebastian Dröge
92ed8f6a74 Don't use declarations after statements and variable length arrays.
Original commit message from CVS:
* ext/raw1394/gstdv1394src.c: (gst_dv1394src_uri_set_uri):
* ext/speex/gstspeexenc.c: (gst_speex_enc_sink_getcaps):
* ext/wavpack/gstwavpackenc.c: (gst_wavpack_enc_set_wp_config):
* sys/v4l2/gstv4l2src.c: (gst_v4l2src_fixate):
* sys/v4l2/v4l2src_calls.c: (gst_v4l2src_probe_caps_for_format):
* tests/examples/equalizer/demo.c: (message_handler):
* tests/examples/spectrum/demo-audiotest.c: (message_handler):
* tests/examples/spectrum/demo-osssrc.c: (message_handler):
Don't use declarations after statements and variable length arrays.
2008-07-08 12:51:34 +00:00
Sjoerd Simons
0f2d27525b sys/v4l2/gstv4l2src.c: Improve negotiation a bit more by picking the smallest possible resolution that is larger than...
Original commit message from CVS:
Patch by: Sjoerd Simons <sjoerd at luon dot net>
* sys/v4l2/gstv4l2src.c: (gst_v4l2src_negotiate):
Improve negotiation a bit more by picking the smallest possible
resolution that is larger than the resolution specified in the
first caps entry of the peer caps. Fixes bug #536994.
2008-06-09 08:52:04 +00:00
Sjoerd Simons
22940c0010 sys/v4l2/gstv4l2src.c: Provide a custom negotiation function to make sure to pick the highest possible framerate and ...
Original commit message from CVS:
Patch by: Sjoerd Simons <sjoerd at luon dot net>
* sys/v4l2/gstv4l2src.c: (gst_v4l2src_class_init),
(gst_v4l2src_fixate), (gst_v4l2src_negotiate):
Provide a custom negotiation function to make sure to pick the highest
possible framerate and resolution. Fixes bug #536646.
2008-06-04 17:39:31 +00:00
William M. Brack
c3bde2dc42 sys/v4l2/gstv4l2src.c: Add NV12, NV21 and bayer support. See #520092.
Original commit message from CVS:
Patch by: William M. Brack <wbrack at mmm dot com dot hk>
* sys/v4l2/gstv4l2src.c: (gst_v4l2src_v4l2fourcc_to_structure),
(gst_v4l2_get_caps_info):
Add NV12, NV21 and bayer support. See #520092.
2008-05-26 14:52:51 +00:00
Sebastian Dröge
5a344798f0 sys/v4l2/gstv4l2src.c: Don't include the gstv4l2xoverlay.h header as the XOverlay support isn't implemented at all ye...
Original commit message from CVS:
* sys/v4l2/gstv4l2src.c:
Don't include the gstv4l2xoverlay.h header as the XOverlay support
isn't implemented at all yet and this requires X headers to be
installed. Fixes bug #533264.
2008-05-17 10:38:18 +00:00
Edgard Lima
66ca1b2280 Always copy buffers by default (handle safer with bugged drivers) and added a property to make it possible to use mma...
Original commit message from CVS:
Always copy buffers by default (handle safer with bugged drivers) and added a property to make it possible to use mmap effectively (no copy if possible) when application wants to. Fixes: #480557.
2007-11-15 12:22:10 +00:00
Tim-Philipp Müller
a769e5e70a sys/v4l2/: When probing the formats and sizes a camera supports, make sure the best ones (highest resolution, prefere...
Original commit message from CVS:
* sys/v4l2/gstv4l2src.c:
* sys/v4l2/v4l2src_calls.c:
When probing the formats and sizes a camera supports, make
sure the best ones (highest resolution, prefered format)
end up at the beginning of the probed caps and the less
desirable ones at the end.  This is important because the
order within the caps matters for things like fixation and
negotiation, ie. what format is chosen in the end.
With recent kernels, the current probing code will end up
querying the supported sizes from lowest resolution to
highest resolution, adding them to the probed caps in that
order, resulting to v4l2src fixating to the lowest possible
resolution if downstream does not express a size preference.
Also make up a somewhat random ranking of prefered output
formats for the same reason. Fixes #485828.
2007-10-13 12:03:44 +00:00
Tim-Philipp Müller
7c69e90236 sys/v4l2/: Implement LATENCY queries in the crudest way possible so I don't have to use sync=false any longer when te...
Original commit message from CVS:
* sys/v4l2/gstv4l2src.c:
* sys/v4l2/gstv4l2src.h:
* sys/v4l2/v4l2src_calls.c:
Implement LATENCY queries in the crudest way possible so I don't
have to use sync=false any longer when testing with videosinks.
2007-09-05 14:43:16 +00:00
Wim Taymans
b4e5796a04 sys/v4l2/gstv4l2src.c: Restructure the setcaps function so that we can also compute the expected GStreamer output siz...
Original commit message from CVS:
* sys/v4l2/gstv4l2src.c: (gst_v4l2_get_caps_info),
(gst_v4l2src_set_caps), (gst_v4l2src_get_mmap):
Restructure the setcaps function so that we can also compute the
expected GStreamer output size of the video frames.
Set frame_byte_size correctly so that read-based devices have a chance
of working correctly.
When grabbing a frame, discard frames that are not of the expected size.
Some cameras don't output the right framesize for the first buffer.
Try only a couple of times to get a valid frame, else error out.
* sys/v4l2/v4l2_calls.c: (gst_v4l2_get_capabilities),
(gst_v4l2_fill_lists), (gst_v4l2_get_input):
Add some more debug info when scanning the device.
* sys/v4l2/v4l2src_calls.c: (gst_v4l2_buffer_new),
(gst_v4l2_buffer_pool_new), (gst_v4l2_buffer_pool_activate),
(gst_v4l2src_fill_format_list), (gst_v4l2src_grab_frame),
(gst_v4l2src_set_capture), (gst_v4l2src_capture_init):
Add some more debug info when dequeing a frame.
2007-09-04 16:40:05 +00:00
Stefan Kost
c1254d31e9 sys/v4l2/gstv4l2src.c: Add another example pipeline.
Original commit message from CVS:
* sys/v4l2/gstv4l2src.c:
Add another example pipeline.
2007-07-18 11:55:13 +00:00
Alexander Eichner
e547bc5595 sys/v4l2/gstv4l2src.c: Use define here.
Original commit message from CVS:
Patch by: Alexander Eichner <alexeichi@yahoo.de>
* sys/v4l2/gstv4l2src.c: (gst_v4l2src_init):
Use define here.
* sys/v4l2/gstv4l2tuner.c:
(gst_v4l2_tuner_set_frequency_and_notify):
Don't touch the property - its still disabled.
* sys/v4l2/v4l2src_calls.c: (gst_v4l2src_probe_caps_for_format),
(gst_v4l2src_grab_frame), (gst_v4l2src_get_size_limits):
* sys/v4l2/v4l2src_calls.h:
Improve fallback format negotionation. Fixes #451388
2007-07-18 11:42:33 +00:00
Stefan Kost
5d60a17f4a sys/v4l2/gstv4l2src.c: Initialize num_buffers with minimum value.
Original commit message from CVS:
* sys/v4l2/gstv4l2src.c: (gst_v4l2src_init):
Initialize num_buffers with minimum value.
* sys/v4l2/v4l2src_calls.c: (gst_v4l2src_fill_format_list),
(gst_v4l2src_probe_caps_for_format), (gst_v4l2src_grab_frame):
Handle frame-size query failure gracefully.
2007-07-17 11:35:29 +00:00
Andy Wingo
cde8c8bdc4 sys/v4l2/v4l2src_calls.c (gst_v4l2_buffer_finalize) (gst_v4l2_buffer_class_init, gst_v4l2_buffer_get_type)
Original commit message from CVS:
2007-06-12  Andy Wingo  <wingo@pobox.com>

* sys/v4l2/v4l2src_calls.c (gst_v4l2_buffer_finalize)
(gst_v4l2_buffer_class_init, gst_v4l2_buffer_get_type)
(gst_v4l2_buffer_new): Behave more like ximagesink's buffers, with
finalization and resuscitation. No longer public.
(gst_v4l2_buffer_pool_finalize, gst_v4l2_buffer_pool_init)
(gst_v4l2_buffer_pool_class_init, gst_v4l2_buffer_pool_get_type)
(gst_v4l2_buffer_pool_new, gst_v4l2_buffer_pool_activate)
(gst_v4l2_buffer_pool_destroy): Make the pool follow common
miniobject semantics, and be threadsafe.
(gst_v4l2src_queue_frame): Remove this function, as we just call
the ioctls directly in the two places where we queue buffers.
(gst_v4l2src_grab_frame): Return a flowreturn and fill the buffer
directly.
(gst_v4l2src_capture_init): Use the new buffer_pool_new function
to allocate the pool, which also preallocates the GstBuffers.
(gst_v4l2src_capture_start): Call buffer_pool_activate instead of
queueing the frames directly.

* sys/v4l2/gstv4l2src.h (struct _GstV4l2BufferPool): Make this a
real MiniObject instead of rolling our own refcounting and
finalizing. Give it a lock.
(struct _GstV4l2Buffer): Remove one intermediary object, having
the buffers hold the struct v4l2_buffer directly.

* sys/v4l2/gstv4l2src.c (gst_v4l2src_set_caps): Pass the caps to
capture_init so that it can set them on the buffers that it will
create.
(gst_v4l2src_get_read): For better or for worse, include the
timestamping and offsetting code here; really we should be using
bufferalloc though.
(gst_v4l2src_get_mmap): Just make grab_frame return one of our
preallocated, mmap'd buffers.
2007-06-12 11:23:01 +00:00
Andy Wingo
e99b73973b sys/v4l2/gstv4l2src.c (gst_v4l2src_start, gst_v4l2src_stop): Add some useless comments.
Original commit message from CVS:
2007-06-05  Andy Wingo  <wingo@pobox.com>

* sys/v4l2/gstv4l2src.c (gst_v4l2src_start, gst_v4l2src_stop): Add
some useless comments.

* sys/v4l2/v4l2src_calls.c (gst_v4l2src_capture_init): Don't queue
frames before calling STREAMON, that might leave them in a state
where they can't be dequeued if we go back to NULL without calling
STREAMON, according to the docs.
(gst_v4l2src_capture_start): Enqueue buffers here instead, right
before we call STREAMON.
(gst_v4l2src_capture_deinit): Remove crack to work around dequeue
failures. (For me this code hung.) The pool refcounting is still
crack; added a note to that effect.
2007-06-05 14:17:25 +00:00
Andy Wingo
3b5f988239 sys/v4l2/v4l2src_calls.*: Store the format list in the order that the driver gives it to us.
Original commit message from CVS:
2007-05-30  Andy Wingo  <wingo@pobox.com>

* sys/v4l2/v4l2src_calls.h:
* sys/v4l2/v4l2src_calls.c (gst_v4l2src_fill_format_list): Store
the format list in the order that the driver gives it to us.
(gst_v4l2src_probe_caps_for_format_and_size)
(gst_v4l2src_probe_caps_for_format): New functions, fill GstCaps
based on the capabilities of the device.
(gst_v4l2src_grab_frame): Update for object variable renaming.
(gst_v4l2src_set_capture): Update to be strict in its parameters,
as in the set_caps below.
(gst_v4l2src_capture_init): Update for object variable renaming,
and reflow.
(gst_v4l2src_capture_start, gst_v4l2src_capture_stop)
(gst_v4l2src_capture_deinit): Update for object variable renaming.
(gst_v4l2src_update_fps, gst_v4l2src_set_fps)
(gst_v4l2src_get_fps): Remove; these functions don't have much
meaning outside of an atomic set_caps method.
(gst_v4l2src_buffer_new): Don't set buffer duration, it is not
known.

* sys/v4l2/gstv4l2tuner.c (gst_v4l2_tuner_set_channel): Remove
call to update_fps; not sure about this change.
(gst_v4l2_tuner_set_norm): Work around the fact that for the
moment we don't have an update_fps_func.

* sys/v4l2/gstv4l2src.h (struct _GstV4l2Src): Don't put v4l2
structures in the object, just store what we need. Do store the
probed caps of the device. Don't store the current frame rate.

* sys/v4l2/gstv4l2src.c (gst_v4l2src_init): Remove the
update_fps_function, for now. Update for new object variable
naming.
(gst_v4l2src_set_property, gst_v4l2src_get_property): Update for
new object variable naming.
(gst_v4l2src_v4l2fourcc_to_structure): Rename from ..._to_caps.
(gst_v4l2_structure_to_v4l2fourcc): Rename from ...caps_to_....
(gst_v4l2src_get_caps): Rework to probe the device for supported
frame sizes and frame rates.
(gst_v4l2src_set_caps): Rework to be strict in the given
parameters: if someone asks us to have a certain size and rate,
that is what we configure.
(gst_v4l2src_get_read): Update for object variable naming. Don't
leak buffers on short reads.
(gst_v4l2src_get_mmap): Update for object variable naming, and add
comments.
(gst_v4l2src_create): Update for object variable naming.
2007-05-30 14:40:53 +00:00
David Schleef
1a818e4151 sys/v4l2/gstv4l2src.c: Add support for Bayer images as video/x-raw-bayer. Fixes #314160.
Original commit message from CVS:
* sys/v4l2/gstv4l2src.c: Add support for Bayer images as
video/x-raw-bayer.  Fixes #314160.
2007-05-15 02:56:23 +00:00
Jan Schmidt
de1357a407 Fix a bunch of leaks shown by the newly-added states test.
Original commit message from CVS:
* ext/flac/gstflacenc.c: (gst_flac_enc_finalize):
* ext/gconf/gstgconfaudiosink.c: (gst_gconf_audio_sink_class_init),
(gst_gconf_audio_sink_dispose), (gst_gconf_audio_sink_finalize):
* ext/gconf/gstgconfaudiosrc.c: (gst_gconf_audio_src_base_init),
(gst_gconf_audio_src_class_init), (gst_gconf_audio_src_dispose),
(gst_gconf_audio_src_finalize), (do_toggle_element):
* ext/gconf/gstgconfvideosink.c: (gst_gconf_video_sink_base_init),
(gst_gconf_video_sink_class_init), (gst_gconf_video_sink_finalize),
(do_toggle_element):
* ext/gconf/gstgconfvideosrc.c: (gst_gconf_video_src_base_init),
(gst_gconf_video_src_class_init), (gst_gconf_video_src_dispose),
(gst_gconf_video_src_finalize), (do_toggle_element):
* ext/gconf/gstswitchsink.c: (gst_switch_sink_class_init),
(gst_switch_sink_reset), (gst_switch_sink_set_child):
* ext/hal/gsthalaudiosink.c: (gst_hal_audio_sink_base_init):
* ext/hal/gsthalaudiosrc.c: (gst_hal_audio_src_base_init):
* ext/shout2/gstshout2.c: (gst_shout2send_class_init),
(gst_shout2send_init), (gst_shout2send_finalize):
* gst/debug/testplugin.c: (gst_test_class_init),
(gst_test_finalize):
* gst/flx/gstflxdec.c: (gst_flxdec_class_init),
(gst_flxdec_dispose):
* gst/multipart/multipartmux.c: (gst_multipart_mux_finalize):
* gst/rtp/gstrtpmp4gpay.c: (gst_rtp_mp4g_pay_finalize):
* gst/rtsp/gstrtspsrc.c: (gst_rtspsrc_init),
(gst_rtspsrc_finalize):
* gst/rtsp/rtspextwms.c: (rtsp_ext_wms_free_context):
* gst/rtsp/rtspextwms.h:
* gst/smpte/gstsmpte.c: (gst_smpte_class_init),
(gst_smpte_finalize):
* gst/udp/gstmultiudpsink.c: (gst_multiudpsink_finalize):
* gst/udp/gstudpsink.c: (gst_udpsink_class_init),
(gst_udpsink_finalize):
* gst/wavparse/gstwavparse.c: (gst_wavparse_dispose),
(gst_wavparse_sink_activate):
* sys/oss/gstosssink.c: (gst_oss_sink_finalise):
* sys/oss/gstosssrc.c: (gst_oss_src_class_init),
(gst_oss_src_finalize):
* sys/v4l2/gstv4l2object.c: (gst_v4l2_object_destroy):
* sys/v4l2/gstv4l2object.h:
* sys/v4l2/gstv4l2src.c: (gst_v4l2src_class_init),
(gst_v4l2src_finalize):
* sys/ximage/gstximagesrc.c: (gst_ximage_src_ximage_get):
Fix a bunch of leaks shown by the newly-added states test.
2007-03-04 13:52:03 +00:00
Stefan Kost
77790aa2dc sys/v4l2/: More FIXME comments and messaging changes.
Original commit message from CVS:
* sys/v4l2/gstv4l2src.c: (gst_v4l2src_v4l2fourcc_to_caps),
(gst_v4l2src_get_caps):
* sys/v4l2/v4l2src_calls.c: (gst_v4l2src_fill_format_list),
(gst_v4l2src_grab_frame), (gst_v4l2src_set_capture),
(gst_v4l2src_capture_init):
More FIXME comments and messaging changes.
2007-02-12 12:57:22 +00:00
Stefan Kost
fdd167aeb1 sys/v4l2/: Fix EIO handing when capturing. Add new property to specify the number of buffers to enque (and remove the...
Original commit message from CVS:
* sys/v4l2/gstv4l2object.c:
(gst_v4l2_object_install_properties_helper),
(gst_v4l2_object_set_property_helper),
(gst_v4l2_object_get_property_helper), (gst_v4l2_set_defaults):
* sys/v4l2/gstv4l2object.h:
* sys/v4l2/gstv4l2src.c: (gst_v4l2src_class_init),
(gst_v4l2src_init), (gst_v4l2src_set_property),
(gst_v4l2src_get_property), (gst_v4l2src_set_caps):
* sys/v4l2/v4l2src_calls.c: (gst_v4l2src_fill_format_list),
(gst_v4l2src_grab_frame), (gst_v4l2src_set_capture),
(gst_v4l2src_capture_init), (gst_v4l2src_capture_start),
(gst_v4l2src_capture_deinit):
Fix EIO handing when capturing. Add new property to specify the number of
buffers to enque (and remove the borked num-buffers usage).
2007-01-17 14:30:50 +00:00
Edgard Lima
24088fed0a Improved comments in ELEMENT_ERROR/WARNING and added "#if 0" to xoverlay code that is still not implemented.
Original commit message from CVS:
Improved comments in ELEMENT_ERROR/WARNING and added "#if 0" to xoverlay code that is still not implemented.
2006-11-01 19:48:26 +00:00
Zaheer Abbas Merali
d928cf05c3 sys/v4l2/gstv4l2src.c: Improve docs.
Original commit message from CVS:
2006-10-03  Zaheer Abbas Merali  <zaheerabbas at merali dot org>

* sys/v4l2/gstv4l2src.c:
Improve docs.
2006-10-03 13:18:59 +00:00
Wim Taymans
210e3a8e67 sys/v4l2/: Framerate can be 0/1 too.
Original commit message from CVS:
* sys/v4l2/gstv4l2src.c: (gst_v4l2src_get_all_caps),
(gst_v4l2src_get_caps):
* sys/v4l2/v4l2_calls.c: (gst_v4l2_fill_lists):
Framerate can be 0/1 too.
Init framerate to 0/1 before querying it so that we can detect
devices that don't know about a framerate.
Add some more debugging info.
2006-09-28 17:08:47 +00:00
Edgard Lima
2c72b70484 Removed set-undef-fps.
Original commit message from CVS:
Removed set-undef-fps.
2006-09-27 17:47:57 +00:00
Wim Taymans
d8769c7d84 sys/v4l2/: Renamed some properties to match the tuner interface naming.
Original commit message from CVS:
* sys/v4l2/gstv4l2object.c:
(gst_v4l2_object_install_properties_helper), (gst_v4l2_object_new),
(gst_v4l2_object_set_property_helper),
(gst_v4l2_object_get_property_helper), (gst_v4l2_set_defaults):
* sys/v4l2/gstv4l2object.h:
* sys/v4l2/gstv4l2src.c: (gst_v4l2src_class_init),
(gst_v4l2src_create):
* sys/v4l2/gstv4l2tuner.c: (gst_v4l2_tuner_contains_channel),
(gst_v4l2_tuner_list_channels),
(gst_v4l2_tuner_set_channel_and_notify),
(gst_v4l2_tuner_get_channel), (gst_v4l2_tuner_contains_norm),
(gst_v4l2_tuner_list_norms), (gst_v4l2_tuner_set_norm_and_notify),
(gst_v4l2_tuner_get_norm):
* sys/v4l2/v4l2_calls.c: (gst_v4l2_get_capabilities),
(gst_v4l2_fill_lists), (gst_v4l2_empty_lists):
* sys/v4l2/v4l2src_calls.c: (gst_v4l2src_get_fps):
Renamed some properties to match the tuner interface naming.
2006-09-27 17:04:22 +00:00
Wim Taymans
a9bc7aedaa Small cleanups.
Original commit message from CVS:
* sys/v4l2/gstv4l2object.c: (gst_v4l2_object_set_property_helper),
(gst_v4l2_set_defaults):
* sys/v4l2/gstv4l2src.c: (gst_v4l2src_get_read),
(gst_v4l2src_create):
* sys/v4l2/gstv4l2xoverlay.c: (gst_v4l2_xoverlay_open):
* sys/v4l2/v4l2_calls.c: (gst_v4l2_get_capabilities),
(gst_v4l2_fill_lists), (gst_v4l2_open), (gst_v4l2_set_norm),
(gst_v4l2_get_frequency), (gst_v4l2_set_frequency),
(gst_v4l2_signal_strength), (gst_v4l2_get_attribute),
(gst_v4l2_set_attribute), (gst_v4l2_get_input),
(gst_v4l2_set_input):
* sys/v4l2/v4l2src_calls.c: (gst_v4l2src_fill_format_list),
(gst_v4l2src_grab_frame), (gst_v4l2src_get_capture),
(gst_v4l2src_set_capture), (gst_v4l2src_capture_init),
(gst_v4l2src_capture_start), (gst_v4l2src_capture_stop),
(gst_v4l2src_buffer_new):
* tests/icles/v4l2src-test.c: (my_bus_callback), (main):
Small cleanups.
Fix error messages.
Use locks when getting timestamps.
Fix leaks in test.
Add licensing header to tests.
2006-09-27 16:14:18 +00:00
Edgard Lima
eea3a2d9b6 Some cleanups and comments.
Original commit message from CVS:
Some cleanups and comments.
2006-09-27 15:14:07 +00:00
Wim Taymans
57f39bc8ee docs/plugins/: Add v4l2 plugin to the docs.
Original commit message from CVS:
* docs/plugins/Makefile.am:
* docs/plugins/gst-plugins-bad-plugins-docs.sgml:
* docs/plugins/gst-plugins-bad-plugins-sections.txt:
Add v4l2 plugin to the docs.
* sys/v4l2/gstv4l2src.c: (gst_v4l2src_get_read),
(gst_v4l2src_get_mmap), (gst_v4l2src_create):
* sys/v4l2/gstv4l2src.h:
* sys/v4l2/gstv4l2vidorient.c:
Fix docs.
Remove some more externs.
2006-09-26 14:17:54 +00:00
Wim Taymans
27bde5b96e sys/v4l2/Makefile.am: Fix makefile, list libs in stack order.
Original commit message from CVS:
* sys/v4l2/Makefile.am:
Fix makefile, list libs in stack order.
* sys/v4l2/gstv4l2colorbalance.c:
* sys/v4l2/gstv4l2colorbalance.h:
* sys/v4l2/gstv4l2object.c: (gst_v4l2_device_get_type),
(gst_v4l2_object_install_properties_helper):
* sys/v4l2/gstv4l2object.h:
* sys/v4l2/gstv4l2src.c: (gst_v4l2src_get_read),
(gst_v4l2src_get_mmap), (gst_v4l2src_create):
* sys/v4l2/gstv4l2src.h:
* sys/v4l2/gstv4l2tuner.h:
* sys/v4l2/gstv4l2vidorient.h:
* sys/v4l2/gstv4l2xoverlay.h:
* sys/v4l2/v4l2_calls.h:
* sys/v4l2/v4l2src_calls.h:
Fix coding style:
- Remove extern from functions.
- Fix header indentation.
Fix Flags, add defaults for properties.
Remove unused enums.
Fix TOO_LAZY in error messages.
2006-09-26 13:18:06 +00:00
Wim Taymans
d9db447dfa sys/v4l2/: Fix pass at code cleanups, move errors cases out of the normal flow for additional code clarity.
Original commit message from CVS:
* sys/v4l2/gstv4l2object.c: (gst_v4l2_class_probe_devices),
(gst_v4l2_probe_needs_probe),
(gst_v4l2_object_install_properties_helper), (gst_v4l2_object_new),
(gst_v4l2_object_destroy), (gst_v4l2_object_set_property_helper),
(gst_v4l2_object_get_property_helper), (gst_v4l2_set_defaults),
(gst_v4l2_object_start), (gst_v4l2_object_stop):
* sys/v4l2/gstv4l2object.h:
* sys/v4l2/gstv4l2src.c: (gst_v4l2src_class_init),
(gst_v4l2src_init), (gst_v4l2src_dispose),
(gst_v4l2src_set_property), (gst_v4l2src_get_property),
(gst_v4l2src_fixate), (gst_v4l2src_get_caps),
(gst_v4l2src_set_caps), (gst_v4l2src_get_read),
(gst_v4l2src_get_mmap), (gst_v4l2src_create):
* sys/v4l2/v4l2_calls.c: (gst_v4l2_get_capabilities),
(gst_v4l2_open), (gst_v4l2_close), (gst_v4l2_get_norm),
(gst_v4l2_set_norm), (gst_v4l2_get_frequency),
(gst_v4l2_set_frequency), (gst_v4l2_signal_strength),
(gst_v4l2_get_attribute), (gst_v4l2_set_attribute),
(gst_v4l2_get_input), (gst_v4l2_set_input):
* sys/v4l2/v4l2src_calls.c: (gst_v4l2src_fill_format_list),
(gst_v4l2src_queue_frame), (gst_v4l2src_grab_frame),
(gst_v4l2src_get_capture), (gst_v4l2src_set_capture),
(gst_v4l2src_capture_init), (gst_v4l2src_capture_start),
(gst_v4l2src_capture_stop), (gst_v4l2src_capture_deinit),
(gst_v4l2src_get_size_limits), (gst_v4l2src_set_fps),
(gst_v4l2src_get_fps), (gst_v4l2src_buffer_finalize),
(gst_v4l2src_buffer_new):
Fix pass at code cleanups, move errors cases out of the normal
flow for additional code clarity.
2006-09-26 11:06:17 +00:00