From 0ff4dc306f16324f12889137400aeb0cd9949938 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ole=20Andr=C3=A9=20Vadla=20Ravn=C3=A5s?= Date: Tue, 9 Sep 2008 23:58:02 +0000 Subject: 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. --- sys/winks/kshelpers.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'sys/winks/kshelpers.c') diff --git a/sys/winks/kshelpers.c b/sys/winks/kshelpers.c index d1aa274e..6f614084 100644 --- a/sys/winks/kshelpers.c +++ b/sys/winks/kshelpers.c @@ -323,7 +323,7 @@ ks_state_to_string (KSSTATE state) if (flags & KSSTREAM_HEADER_OPTIONSF_##flag)\ {\ if (str->len > 0)\ - g_string_append (str, " | ");\ + g_string_append (str, "|");\ g_string_append (str, G_STRINGIFY (flag));\ flags &= ~KSSTREAM_HEADER_OPTIONSF_##flag;\ } @@ -336,21 +336,21 @@ ks_options_flags_to_string (gulong flags) str = g_string_sized_new (128); + CHECK_OPTIONS_FLAG (SPLICEPOINT); + CHECK_OPTIONS_FLAG (PREROLL); CHECK_OPTIONS_FLAG (DATADISCONTINUITY); + CHECK_OPTIONS_FLAG (TYPECHANGED); + CHECK_OPTIONS_FLAG (TIMEVALID); + CHECK_OPTIONS_FLAG (TIMEDISCONTINUITY); + CHECK_OPTIONS_FLAG (FLUSHONPAUSE); CHECK_OPTIONS_FLAG (DURATIONVALID); CHECK_OPTIONS_FLAG (ENDOFSTREAM); - CHECK_OPTIONS_FLAG (FLUSHONPAUSE); - CHECK_OPTIONS_FLAG (LOOPEDDATA); - CHECK_OPTIONS_FLAG (PREROLL); - CHECK_OPTIONS_FLAG (SPLICEPOINT); - CHECK_OPTIONS_FLAG (TIMEDISCONTINUITY); - CHECK_OPTIONS_FLAG (TIMEVALID); - CHECK_OPTIONS_FLAG (TYPECHANGED); - CHECK_OPTIONS_FLAG (VRAM_DATA_TRANSFER); CHECK_OPTIONS_FLAG (BUFFEREDTRANSFER); + CHECK_OPTIONS_FLAG (VRAM_DATA_TRANSFER); + CHECK_OPTIONS_FLAG (LOOPEDDATA); if (flags != 0) - g_string_append_printf (str, " | 0x%08x", flags); + g_string_append_printf (str, "|0x%08x", flags); ret = str->str; g_string_free (str, FALSE); -- cgit v1.2.1