Commit graph

25 commits

Author SHA1 Message Date
Wim Taymans
de1f89bf07 GST_FLOW_WRONG_STATE -> GST_FLOW_FLUSHING 2012-02-08 16:37:13 +01:00
Wim Taymans
8546951222 chain up in set_clock 2011-11-10 12:11:21 +01:00
Christian Berentsen
6cf92cd25c winks: fix framerate fraction range mapping
Min and max may be slightly different but compress to the same fraction.
2010-12-10 04:06:53 +01:00
Ole André Vadla Ravnås
cc1c6ee9e3 winks: work around shutdown deadlock
GetOverlappedResult() might never return with some drivers. Time out
after 1000 ms. We cannot really fix this without either:
1) Controlling the streaming thread so we can do CancelIo() from that
   thread.
2) Switch to using IO completion ports.
2010-10-28 17:08:41 +02:00
Ole André Vadla Ravnås
a7a04fe601 winks: remove JPEG validation hack
This should clearly not be done in a video source.
2010-10-28 17:08:41 +02:00
Ole André Vadla Ravnås
35ed06fba2 winks: set PrioritySubClass to KSPRIORITY_NORMAL instead of 1
In order to match the reference implementation.
2010-10-28 17:08:41 +02:00
Ole André Vadla Ravnås
c1d16c4fee winks: retry when KsCreatePin fails with ERROR_NOT_READY
Turns out that the reference implementation does this, hence we need to
mirror this behaviour. This typically happens with hardware that takes
some time to initialize.
2010-10-28 17:08:41 +02:00
Ole André Vadla Ravnås
bb17394e76 winks: improve framerate fraction conversions
* For instance 7.5 fps should be represented as 15/2 instead of 7/1.
* Clamp AvgTimePerFrame and dwBitRate to account for rounding errors.
2010-10-28 17:08:41 +02:00
Ole André Vadla Ravnås
d282a1d380 winks: improve error-handling
Most important part here is special-casing "device busy" so the application
is able to provide better feedback when another application is using the
device.
2010-10-28 17:08:41 +02:00
Ole André Vadla Ravnås
cddfa50d92 winks: performance improvements
* Make the driver write directly into each GstBuffer to avoid memcpy().
* Don't memset() the buffer before reusing it.
* Recycle memory by keeping two spare buffers. Two because the sink
  downstream may keep a ref to the previous buffer.

Note that we align buffers on highest possible byte boundary (4096) so we
don't have to take into account what kind of alignment the driver requires.
2010-10-28 17:08:35 +02:00
Ole André Vadla Ravnås
f2b4d8990d winks: store priv pointer instead of looking it up 2010-10-28 17:08:35 +02:00
Ole André Vadla Ravnås
00bc7860ff winks: post error message on flow-unexpected 2010-10-28 17:08:35 +02:00
Andres Colubri
700f70e7a5 winks: add property probing support 2010-10-28 17:08:35 +02:00
Ole André Vadla Ravnås
2cf589b928 winks: sort devices that look like cameras first 2010-10-28 17:08:31 +02:00
Knut Inge Hvidsten
a54972f806 winks: provide guessed pixel-aspect-ratio in caps 2010-10-28 17:08:31 +02:00
Ole André Vadla Ravnås
a5beb0b8ff winks: only try to change state when actually open 2010-10-28 17:08:31 +02:00
Ole André Vadla Ravnås
1f6a6d2430 winks: ignore unsupported formats 2010-10-28 17:08:27 +02:00
Ole André Vadla Ravnås
b88b25ab9b winks: adjust a couple of logging severities
Should clearly not be considered warnings, as they're quite common.
2010-10-28 16:14:34 +02:00
David Hoyt
e467a3e14b winks: fix compilation by using the right function
Fixes #623883.
2010-07-08 21:54:28 +01:00
Benjamin Otte
775c7584fd gst_element_class_set_details => gst_element_class_set_details_simple 2010-03-18 22:46:41 +01:00
Ole André Vadla Ravnås
61dee51291 sys/winks/gstksclock.c (gst_ks_clock_worker_thread_func, gst_ks_clock_start):
Original commit message from CVS:
* sys/winks/gstksclock.c (gst_ks_clock_worker_thread_func,
gst_ks_clock_start):
Synchronize KS clock as a single-shot operation for now, there's not
much point in doing it periodically until we're actually using the
KS timestamps for anything else than just discarding old frames.
* sys/winks/gstksvideosrc.c (gst_ks_video_src_open_device):
Provide the GstClock when opening the device if we already have one.
2008-09-10 12:05:39 +00:00
Ole André Vadla Ravnås
0ff4dc306f sys/winks/gstksvideodevice.c (GST_DEBUG_IS_ENABLED, last_timestamp, gst_ks_video_device_prepare_buffers, gst_ks_video...
Original commit message from CVS:
* sys/winks/gstksvideodevice.c (GST_DEBUG_IS_ENABLED, last_timestamp,
gst_ks_video_device_prepare_buffers, gst_ks_video_device_create_pin,
gst_ks_video_device_set_state, gst_ks_video_device_request_frame,
gst_ks_video_device_read_frame):
Guard against capturing old frames by keeping track of the last
timestamp and also zero-fill the buffers before each capture.
Only assign a master clock if the pin hasn't already got one.
Actually free buffers on the way down to avoid a huge memory leak,
as this was previously done when changing state to ACQUIRE downwards
and we now skip that state on the way down.
Add some debug.
* sys/winks/gstksvideosrc.c (DEFAULT_DEVICE_PATH, DEFAULT_DEVICE_NAME,
DEFAULT_DEVICE_INDEX, KS_WORKER_LOCK, KS_WORKER_UNLOCK,
KS_WORKER_WAIT, KS_WORKER_NOTIFY, KS_WORKER_WAIT_FOR_RESULT,
KS_WORKER_NOTIFY_RESULT, KS_WORKER_STATE_STARTING,
KS_WORKER_STATE_READY, KS_WORKER_STATE_STOPPING,
KS_WORKER_STATE_ERROR, KsWorkerState, device_path, device_name,
device_index, running, worker_thread, worker_lock,
worker_notify_cond, worker_result_cond, worker_state,
worker_pending_caps, worker_setcaps_result, worker_pending_run,
worker_run_result, gst_ks_video_src_reset,
gst_ks_video_src_apply_driver_quirks, gst_ks_video_src_open_device,
gst_ks_video_src_close_device, gst_ks_video_src_worker_func,
gst_ks_video_src_start_worker, gst_ks_video_src_stop_worker,
gst_ks_video_src_change_state, gst_ks_video_src_set_clock,
gst_ks_video_src_set_caps, gst_ks_video_src_timestamp_buffer,
gst_ks_video_src_create):
Remove ENABLE_CLOCK_DEBUG define, it's GST_LEVEL_DEBUG after all.
Get rid of PROP_ENSLAVE_KSCLOCK and always slave the ks clock to the
GStreamer clock, it doesn't seem to hurt and matches DirectShow's
behavior. As an added bonus we usually get PresentationTime set for
each frame, so we can expand on this later for smarter latency
reporting (by looking at the diff between the timestamp from the
driver and the time according to the GStreamer clock).
Use an internal worker thread for opening the device, setting caps,
changing its state and closing it. This way we're a lot more
compatible with drivers that rely on hacks to do video-effects
between the low-level NT API and the application. Ick.
Start the ks clock and set the pin to KSSTATE_RUN on the first
create() so that we'll hopefully get hold of the GStreamer clock
from the very beginning. This way there's no chance that the
timestamps will make a sudden jump in the beginning of the stream
when we're running with a clock.
* sys/winks/kshelpers.c (CHECK_OPTIONS_FLAG,
ks_options_flags_to_string):
Reorder the flags to match the headerfile order, and make the string
a bit more compact.
* sys/winks/ksvideohelpers.c (ks_video_probe_filter_for_caps):
Avoid leaking KSPROPERTY_PIN_DATARANGES.
2008-09-09 23:58:02 +00:00
Ole André Vadla Ravnås
e3fcb1d801 sys/winks/ksvideohelpers.c (ks_video_media_type_free): Avoid leaking the KSDATARANGE member of each KsVideoMediaType.
Original commit message from CVS:
* sys/winks/ksvideohelpers.c (ks_video_media_type_free):
Avoid leaking the KSDATARANGE member of each KsVideoMediaType.
2008-08-28 22:02:28 +00:00
Ole André Vadla Ravnås
50a20db7ed sys/winks/gstksvideodevice.c (gst_ks_video_device_class_init, gst_ks_video_device_set_state):
Original commit message from CVS:
* sys/winks/gstksvideodevice.c (gst_ks_video_device_class_init,
gst_ks_video_device_set_state):
Don't set the pin state to KSSTATE_RUN from the streaming thread.
Skip KSSTATE_ACQUIRE when changing pin state downwards.
Be nice and specify G_PARAM_STATIC_STRINGS.
Remove unused finalize method.
* sys/winks/gstksvideosrc.c (DEFAULT_ENABLE_QUIRKS, PROP_ENABLE_QUIRKS,
enable_quirks, gst_ks_video_src_class_init, gst_ks_video_src_init,
gst_ks_video_src_finalize, gst_ks_video_src_get_property,
gst_ks_video_src_set_property, gst_ks_video_src_reset,
gst_ks_video_src_apply_driver_quirks, gst_ks_video_src_change_state,
gst_ks_video_src_set_caps):
First driver quirk: work around Logitech's hostile driver software to
improve stability and performance. See comments for details.
Provide a property to disable driver quirks (enabled by default).
Be nice and specify G_PARAM_STATIC_STRINGS.
Remove unused dispose method.
Tweak include order.
2008-08-27 21:33:07 +00:00
Ole André Vadla Ravnås
c980279fa4 New plugin for low-latency video capture on Windows (#519935).
Original commit message from CVS:
* configure.ac:
* sys/Makefile.am:
* sys/winks/Makefile.am:
* sys/winks/gstksclock.c:
* sys/winks/gstksclock.h:
* sys/winks/gstksvideodevice.c:
* sys/winks/gstksvideodevice.h:
* sys/winks/gstksvideosrc.c:
* sys/winks/gstksvideosrc.h:
* sys/winks/kshelpers.c:
* sys/winks/kshelpers.h:
* sys/winks/ksvideohelpers.c:
* sys/winks/ksvideohelpers.h:
New plugin for low-latency video capture on Windows (#519935).
Uses Kernel Streaming, the lowest level API for doing video capture
on Windows (more or less just raw ioctls).
2008-08-24 22:05:48 +00:00