Commit graph

1142 commits

Author SHA1 Message Date
Andoni Morales Alastruey
05f6c094fa osxvideosink: fix segfault releasing the sink
show_frame is deferred to the main thread and can be called
when the sink has been released, so we need to keep an extra ref
on ObjectiveC object helper.

https://bugzilla.gnome.org/show_bug.cgi?id=708501
2013-09-24 09:59:51 +02:00
Robert Krakora
141a1fc296 v4l2bufferpool: Restore original GstMemory in buffer if it has been changed
https://bugzilla.gnome.org/show_bug.cgi?id=706083
2013-09-23 11:58:39 -04:00
Olivier Crête
19021e7176 v4l2: Remove commented out line 2013-09-19 17:39:17 -04:00
Olivier Crête
d1e16f7b0c v4l2bufferpool: dmabuf is not a singleton anymore
https://bugzilla.gnome.org/show_bug.cgi?id=707793
2013-09-18 15:13:59 -04:00
Mathieu Duponchelle
374a97a3e9 v4l2: Use newly #defined metadata names. 2013-09-09 15:39:17 +02:00
Sebastian Dröge
478f0dcfe7 v4l2bufferpool: Fix missing condition in previous commit 2013-09-09 14:46:42 +02:00
Sebastian Dröge
1e7c3e4520 v4l2bufferpool: Also fix strides for other semi-planar video formats 2013-09-09 14:45:55 +02:00
Andreea Fulger
78adf28a61 v4l2bufferpool: Fix stride for NV12/NV21
https://bugzilla.gnome.org/show_bug.cgi?id=707758
2013-09-09 14:45:55 +02:00
Tim-Philipp Müller
1dfc1f2686 Don't use setlocale in plugins()
Only apps should call setlocale(), not libraries.
2013-09-01 21:18:38 +01:00
Sebastian Dröge
7692e9e569 directsoundsink: WAVEFORMATEX is unsigned for 8 bit integers, and signed for others
Probably fixes
https://bugzilla.gnome.org/show_bug.cgi?id=705477
2013-08-21 16:41:21 +02:00
Olivier Crête
d595c08aca v4l2: Add forward declaration for gst_v4l2_object_get_format_list 2013-08-19 13:19:42 -04:00
Olivier Crête
48caa1712a v4l2: De-duplicate caps probing between src and sink 2013-08-19 13:08:18 -04:00
Olivier Crête
24286f1612 v4l2: Use G_DEFINE_ macros for added thread safety 2013-08-19 12:48:35 -04:00
Tim-Philipp Müller
fdddc35f20 v4l2: remove unused enumtypes and use generic marshaller 2013-08-04 11:03:49 +01:00
Alessandro Decina
0df7af07ce osxaudiosink: intersect the probed caps with the filter passed to get_caps() 2013-07-25 08:24:45 +02:00
Andoni Morales Alastruey
fbafca49f8 osxvideosink: warn about the future deprecation of the "embed" property 2013-07-17 13:29:42 +02:00
Andoni Morales Alastruey
d57ef52cad osxvideosink: defer the window handle setup to the main thread 2013-07-10 17:43:00 +02:00
Andoni Morales Alastruey
34a5b93637 osxvideosink: default to the main in case we are not setup yet 2013-07-10 17:43:00 +02:00
Andoni Morales Alastruey
0e321b87d4 osxvideosink: close the internal window correctly 2013-07-10 17:43:00 +02:00
Andoni Morales Alastruey
213fa3af0d osxvideosink: only create the NS app thread for Cocoa once
The helper thread for Cocoa, in case no NS run loop is running,
should be started only once and shared across all the instances
running
2013-07-10 17:42:59 +02:00
Michael Olbrich
07e4dd3424 v4l2: bufferpool: don't forget to release buffer on error
If the pool is stopped while gst_v4l2_buffer_pool_dqbuf() waits for a
buffer then the return value is GST_FLOW_FLUSHING. In this case the buffer
to queue must also be released. Otherwise is will never be deleted or
returned to its pool.

https://bugzilla.gnome.org/show_bug.cgi?id=703764
2013-07-08 16:27:19 +02:00
Michael Olbrich
5c99fefa04 v4l2: don't extract data from caps twice
gst_video_info_from_caps() always extract width, height, interlace mode and
framerate now. It is no longer necessary to do it again for encoded
formats.

https://bugzilla.gnome.org/show_bug.cgi?id=703399
2013-07-02 10:08:46 +02:00
Tim-Philipp Müller
c03efd3894 ximagesrc: clear dts on buffer acquired from pool
When setting timestamps on outgoing buffers, clear the
dts explicitly, otherwise it may end up being set to a
bogus value from last time it was used. Avoids every
second or so buffer's dts being set to 0. Not that it
should matter for raw video.
2013-06-21 00:47:06 +01:00
Wim Taymans
821d99a503 v4l2: don't redefine the PERFORMANCE debug variable
It is already defined in core.

fixes https://bugzilla.gnome.org/show_bug.cgi?id=702732
2013-06-20 15:35:11 +02:00
Sjoerd Simons
8e43c0ec9e v4l2: Optimize negotiation by removing the query filter
As cameras tend to have a quite specific set of capabilities (specific
framerates for each resolution), getting the peer caps filtered by our
probed caps can cause a big increase in the caps size which slows down
things quire a bit.

As for negotiation v4l2 iterates through the caps of the peer to find the
first intersection with the probed caps, getting the fully expanded
intersection of capabilities is not useful.

Using the same testcase as for bug #702632, adding this patch on top of
the patches suggested there speeds up getting the inital frame from
around ~14-15 seconds to around ~3-4 seconds.

https://bugzilla.gnome.org/show_bug.cgi?id=702638
2013-06-19 15:05:25 +02:00
Andoni Morales Alastruey
025f226e60 osxvideosink: fix support in VM's without hardware acceleration 2013-06-18 10:41:37 +02:00
Michael Olbrich
a1c34b5407 v4l2: make sure the element is not deleted before the pool
The pool accesses data from the v4l2object so it must exist at least
as long as the pool. Refcount the element which controls the object
live-time.

https://bugzilla.gnome.org/show_bug.cgi?id=701650
2013-06-07 20:07:42 +02:00
Michael Olbrich
0769a78dd1 v4l2: iterate controls with V4L2_CTRL_FLAG_NEXT_CTRL if possible
In v2.6.18 control classes where added to the v4l2 API.
Iterating over CIDs starting with V4L2_CID_BASE will only find controls for
the first control class.
By iterating with V4L2_CTRL_FLAG_NEXT_CTRL all controls are found.

This is necessary to make controls from other control classes available in
the extra-controls property.

If V4L2_CTRL_FLAG_NEXT_CTRL is not defined at compile time or not supported
at runtime then the old mechanism for iterating is used.

https://bugzilla.gnome.org/show_bug.cgi?id=701540
2013-06-05 13:00:21 +02:00
Michael Olbrich
74d217c44b v4l2: improve pixel aspect ratio handling
Instead of just assuming a aspect ratio of 1/1 use VIDIOC_CROPCAP to ask
the device.
This also add a pixel-aspect-ratio property to overwrite the value from the
driver and a force-aspect-ratio property to ignore it.

https://bugzilla.gnome.org/show_bug.cgi?id=700285
2013-06-04 17:37:15 +02:00
Stirling Westrup
86405d6ee7 v4l2: Fix compilation with older kernels
https://bugzilla.gnome.org/show_bug.cgi?id=701595
2013-06-04 17:04:11 +02:00
Michael Olbrich
3417a791ac v4l2: call VIDIOC_REQBUFS with count = 0 in pool_finalize
Without this the following sequence fails:

- set_caps()
  - object_stop() (does nothing)
  - set_format() -> VIDIOC_S_FMT
- set_config() -> VIDIOC_REQBUFS with count = N
- set_caps()
  - object_stop()
    - pool_finalize()
  - set_format() -> VIDIOC_S_FMT => EBUSY

Usually the pool is started after set_config(), in which case object_stop()
will result in a pool_stop and therefore VIDIOC_REQBUFS with count = 0 but
that is not guaranteed.
Also calling VIDIOC_REQBUFS with count = 0 in pool_finalize() if necessary
fixes this problem.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=701543
2013-06-04 10:45:06 +02:00
Michael Olbrich
496995a7d5 v4l2: rework sink buffer refcounting
This is a followup patch for #700781, which is not quite correct.
The buffer handling is quite complicated here.
The original code intended to the the following:

- gst_v4l2_buffer_pool_process() calls QBUF and adds the buffer to the
  local list.
- The sink calls gst_buffer_unref() which returns the buffer to the pool
  but not the 'free list'.
- Some time later DQBUF returns the buffer and
  gst_v4l2_buffer_pool_release_buffer() puts in on the 'free list'.

If the buffer must be copied then (parent_class)->acquire_buffer() is
called directly to keep the buffer in the pool.

This has two problems:
1. If gst_v4l2_buffer_pool_release_buffer() is called before the buffer is
   returned to the pool, then the buffer is put on the 'free list' twice.
   This can happen if a reference to the buffer is kept outside the sink,
   of if DQBUF returns the buffer, that was just queued with QBUF.
2. If buffers are copied, then all buffers are in the pool at all times. As
   a result gst_v4l2_buffer_pool_stop() and gst_v4l2_buffer_pool_dqbuf()
   can access pool->buffers at the same time, which can lead to memory
   corruption.

The patch for #700781 fixes those problems, but with the side effect that
there are always buffers outside the pool (because they are queued) and
the pool is never stopped.
This patch fixes this by releasing the reference to the buffer after
handling it (to avoid problem 2.) so it can be returned to the pool.
gst_v4l2_buffer_pool_release_buffer() is only called if the buffer is
already in the pool (to avoid problem 1.).

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=701375
2013-06-03 11:55:48 +02:00
Sebastian Dröge
82e7826af0 v4l2: Only conditionally use V4L2_CTRL_TYPE_INTEGER_MENU, it's not available in older versions 2013-05-29 20:35:41 +02:00
Michael Olbrich
0fb59275b0 v4l2: add a property for arbitrary v4l2 controls
This makes it possible to set any controls that can be set with
VIDIOC_S_CTRL.
The controls are set when the property is set (if the device is open)
and when the device is opened.

https://bugzilla.gnome.org/show_bug.cgi?id=698837
2013-05-29 20:18:11 +02:00
Michael Olbrich
f9cc655adf v4l2: keep a reference to all queued buffers
Without this, a queued buffer may be required, filled and queued before it
is dequeued.
Calling gst_buffer_pool_acquire_buffer() ensures that the buffer is set up
correctly and gst_buffer_unref() calls buffer_release().

https://bugzilla.gnome.org/show_bug.cgi?id=700781
2013-05-21 16:44:58 +02:00
Michael Olbrich
00ffe41e6a v4l2: Don't stop streaming when set_caps is called with unchanged caps
This can happen if other parts of the pipeline are reconfigured.
Stop streaming even for a short amount of time can be quite visible, so it
should be avoided if possible.

https://bugzilla.gnome.org/show_bug.cgi?id=700503
2013-05-20 11:13:18 +02:00
Michael Olbrich
57c0f4d6b5 v4l2: only add interlace-mode to the caps for raw formats
https://bugzilla.gnome.org/show_bug.cgi?id=700280
2013-05-14 13:01:27 +02:00
Michael Olbrich
16b0fd5ad9 v4l2: copy and set the actual size of the content
https://bugzilla.gnome.org/show_bug.cgi?id=700282
2013-05-14 12:57:14 +02:00
Michael Olbrich
113b60935a v4l2: request 0 buffers when stopping
Without this stopping the pool in *_set_caps() is useless.
S_FMT will still fail with EBUSY.

https://bugzilla.gnome.org/show_bug.cgi?id=699835
2013-05-07 16:39:41 +02:00
Philipp Zabel
59d7d5c6bb v4l2: fill out v4l2_buffer.bytesused field for v4l2sink
When queuing a buffer for a sink, bytesused must contain the actual
amount of data.

For a source, the driver must overwrite this, so it doesn't matter
what is set here.

https://bugzilla.gnome.org/show_bug.cgi?id=699598
2013-05-04 11:19:14 +01:00
Michael Olbrich
53da901cc9 v4l2: always generate video info from caps
In the past gst_video_info_from_caps() only video/x-raw. Now it also
supports other video/* and image/* formats.
With this patch the format won't be GST_VIDEO_FORMAT_UNKOWN and
gst_v4l2_buffer_pool_set_config() handles strides correctly.

https://bugzilla.gnome.org/show_bug.cgi?id=699570
2013-05-03 13:14:58 +02:00
Michael Olbrich
1e777ede92 v4l2: try to allocate new buffers with VIDIOC_CREATE_BUFS if needed
If max_buffers is 0 then an arbitrary number of buffers (currently 4) is
allocated. If this is not enough v4l2src starts copying buffers.
With this patch VIDIOC_CREATE_BUFS is used to allocate a new buffer. If
this fails v4l2src falls back to copying buffers.

https://bugzilla.gnome.org/show_bug.cgi?id=699447
2013-05-03 11:18:04 +02:00
Andoni Morales Alastruey
bb980775f8 osxvideosink: fix setting window handle after transition
The destroyed flag was not reset properly and it's also not needed
as we can check osxwindow != NULL
2013-05-02 14:03:43 +02:00
Michael Olbrich
eebe5fc70d v4l2: fix and cleanup VIDIOC_EXPBUF handling
clear the struct, and provide a correct error message

https://bugzilla.gnome.org/show_bug.cgi?id=699337
2013-05-01 15:40:55 +02:00
Philipp Zabel
4d3f6850ca v4l2: handle return value -ENOTTY for unimplemented VIDIOC_G_PARM
Newer kernels return -ENOTTY, older kernels return -EINVAL if the ioctl
is not implemented. With this patch, GStreamer handles both cases.

https://bugzilla.gnome.org/show_bug.cgi?id=698825
2013-05-01 15:34:50 +02:00
Michael Olbrich
bf3a0b7e37 v4l2: fix broken boolean expression to detect non-frame buffers
https://bugzilla.gnome.org/show_bug.cgi?id=699294
2013-04-30 11:47:09 +02:00
Michael Olbrich
d4126ff986 v4l2: also poll for output devices
Note that the V4L2 API defines that for output devices POLLOUT
indicates that a buffer is ready to be dequeued.

https://bugzilla.gnome.org/show_bug.cgi?id=698992
2013-04-27 09:31:29 +01:00
Philipp Zabel
fd0123800c v4l2: fix copying of encoded buffers
The existence of a GstVideoFormatInfo does not guarantee, that
the buffer contains video frames, so the format must be checked.

Also, for encoded buffers the length is variable and must be set.

https://bugzilla.gnome.org/show_bug.cgi?id=698949
2013-04-26 15:36:49 +02:00
Michael Olbrich
3466796f10 v4l2: add support for mpeg4 and H.263
https://bugzilla.gnome.org/show_bug.cgi?id=698826
2013-04-26 14:26:15 +02:00
Philipp Zabel
305023fe9d v4l2: handle ENODATA return value for VIDIOC_ENUMSTD
In kernel v3.7-rc1, VIDIOC_ENUMSTD returns ENODATA if the current input
does not support the STD API.

https://bugzilla.gnome.org/show_bug.cgi?id=698827
2013-04-25 15:40:59 +02:00