Commit graph

44 commits

Author SHA1 Message Date
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
d7a27613c1 v4l2: stop streaming in READY and NULL 2011-07-13 16:56:21 +01: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
3aed125163 v4l2: Use video frame copy for raw video
Use the video frame copy API for raw video frames so that we copy with the right
strides.
2011-07-13 13:38:15 +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
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
f55656dcfc v4l: remove caps argument, it's not needed
Remove the caps parameter, we don't need it anymore because we don't set
caps on buffers anymore.
2011-07-12 17:06:41 +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
e9d80b9f14 v4l2sink: handle pools
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.
2011-07-11 13:51:52 +02: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
3b4afcb8df v4l2: fix gray format, use filter in getcaps 2011-07-08 16:37:11 +02:00
Wim Taymans
7a296af37f v4l2: port and enable v4l2sink 2011-07-08 16:10:47 +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
Tim-Philipp Müller
86d8c8162e v4l2sink: fix another unused-but-set-variable warning 2011-04-16 18:16:11 +01:00
Tim-Philipp Müller
9acda034f8 v4l2sink: fix accidental breakage of navigation interface support 2011-01-20 00:08:18 +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
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
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
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
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
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
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
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
Stefan Kost
0a68003efe docs: fix gtk-doc warnings 2009-09-10 10:26:23 +03: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