From 93b433bd166f99a7e86797077f8100607d5ab943 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Tue, 3 Apr 2007 09:13:17 +0000 Subject: Add RTP session management elements. Still in progress. Original commit message from CVS: * configure.ac: * gst/rtpmanager/Makefile.am: * gst/rtpmanager/async_jitter_queue.c: (async_jitter_queue_new), (signal_waiting_threads), (async_jitter_queue_ref), (async_jitter_queue_ref_unlocked), (async_jitter_queue_set_low_threshold), (async_jitter_queue_set_high_threshold), (async_jitter_queue_set_max_queue_length), (async_jitter_queue_get_g_queue), (calculate_ts_diff), (async_jitter_queue_length_ts_units_unlocked), (async_jitter_queue_unref_and_unlock), (async_jitter_queue_unref), (async_jitter_queue_lock), (async_jitter_queue_unlock), (async_jitter_queue_push), (async_jitter_queue_push_unlocked), (async_jitter_queue_push_sorted), (async_jitter_queue_push_sorted_unlocked), (async_jitter_queue_insert_after_unlocked), (async_jitter_queue_pop_intern_unlocked), (async_jitter_queue_pop), (async_jitter_queue_pop_unlocked), (async_jitter_queue_length), (async_jitter_queue_length_unlocked), (async_jitter_queue_set_flushing_unlocked), (async_jitter_queue_unset_flushing_unlocked), (async_jitter_queue_set_blocking_unlocked): * gst/rtpmanager/async_jitter_queue.h: * gst/rtpmanager/gstrtpbin.c: (gst_rtp_bin_base_init), (gst_rtp_bin_class_init), (gst_rtp_bin_init), (gst_rtp_bin_finalize), (gst_rtp_bin_set_property), (gst_rtp_bin_get_property), (gst_rtp_bin_change_state), (gst_rtp_bin_request_new_pad), (gst_rtp_bin_release_pad): * gst/rtpmanager/gstrtpbin.h: * gst/rtpmanager/gstrtpclient.c: (new_pad), (create_stream), (free_stream), (find_stream_by_ssrc), (gst_rtp_client_base_init), (gst_rtp_client_class_init), (gst_rtp_client_init), (gst_rtp_client_finalize), (gst_rtp_client_set_property), (gst_rtp_client_get_property), (gst_rtp_client_change_state), (gst_rtp_client_request_new_pad), (gst_rtp_client_release_pad): * gst/rtpmanager/gstrtpclient.h: * gst/rtpmanager/gstrtpjitterbuffer.c: (gst_rtp_jitter_buffer_base_init), (gst_rtp_jitter_buffer_class_init), (gst_rtp_jitter_buffer_init), (gst_rtp_jitter_buffer_dispose), (gst_rtp_jitter_buffer_getcaps), (gst_jitter_buffer_sink_setcaps), (free_func), (gst_rtp_jitter_buffer_flush_start), (gst_rtp_jitter_buffer_flush_stop), (gst_rtp_jitter_buffer_src_activate_push), (gst_rtp_jitter_buffer_change_state), (priv_compare_rtp_seq_lt), (compare_rtp_buffers_seq_num), (gst_rtp_jitter_buffer_sink_event), (gst_rtp_jitter_buffer_chain), (gst_rtp_jitter_buffer_loop), (gst_rtp_jitter_buffer_query), (gst_rtp_jitter_buffer_set_property), (gst_rtp_jitter_buffer_get_property): * gst/rtpmanager/gstrtpjitterbuffer.h: * gst/rtpmanager/gstrtpmanager.c: (plugin_init): * gst/rtpmanager/gstrtpptdemux.c: (gst_rtp_pt_demux_base_init), (gst_rtp_pt_demux_class_init), (gst_rtp_pt_demux_init), (gst_rtp_pt_demux_finalize), (gst_rtp_pt_demux_chain), (gst_rtp_pt_demux_getcaps), (find_pad_for_pt), (gst_rtp_pt_demux_setup), (gst_rtp_pt_demux_release), (gst_rtp_pt_demux_change_state): * gst/rtpmanager/gstrtpptdemux.h: * gst/rtpmanager/gstrtpsession.c: (gst_rtp_session_base_init), (gst_rtp_session_class_init), (gst_rtp_session_init), (gst_rtp_session_finalize), (gst_rtp_session_set_property), (gst_rtp_session_get_property), (gst_rtp_session_change_state), (gst_rtp_session_chain_recv_rtp), (gst_rtp_session_chain_recv_rtcp), (gst_rtp_session_chain_send_rtp), (create_recv_rtp_sink), (create_recv_rtcp_sink), (create_send_rtp_sink), (create_rtcp_src), (gst_rtp_session_request_new_pad), (gst_rtp_session_release_pad): * gst/rtpmanager/gstrtpsession.h: Add RTP session management elements. Still in progress. --- gst/rtpmanager/async_jitter_queue.h | 130 ++++++++++++++++++++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 gst/rtpmanager/async_jitter_queue.h (limited to 'gst/rtpmanager/async_jitter_queue.h') diff --git a/gst/rtpmanager/async_jitter_queue.h b/gst/rtpmanager/async_jitter_queue.h new file mode 100644 index 00000000..bea76d6d --- /dev/null +++ b/gst/rtpmanager/async_jitter_queue.h @@ -0,0 +1,130 @@ +/* Async Jitter Queue based on g_async_queue + * + * Farsight Voice+Video library + * Copyright 2007 Collabora Ltd, + * Copyright 2007 Nokia Corporation + * @author: Philippe Khalaf . + */ + +/* GLIB - Library of useful routines for C programming + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +/* + * Modified by the GLib Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GLib Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GLib at ftp://ftp.gtk.org/pub/gtk/. + */ + +#ifndef __ASYNCJITTERQUEUE_H__ +#define __ASYNCJITTERQUEUE_H__ + +#include +#include + +G_BEGIN_DECLS + +typedef struct _AsyncJitterQueue AsyncJitterQueue; + +/* Asyncronous Queues, can be used to communicate between threads + */ + +/* Get a new AsyncJitterQueue with the ref_count 1 */ +AsyncJitterQueue* async_jitter_queue_new (void); + +/* Lock and unlock a AsyncJitterQueue. All functions lock the queue for + * themselves, but in certain cirumstances you want to hold the lock longer, + * thus you lock the queue, call the *_unlocked functions and unlock it again. + */ +void async_jitter_queue_lock (AsyncJitterQueue *queue); +void async_jitter_queue_unlock (AsyncJitterQueue *queue); + +/* Ref and unref the AsyncJitterQueue. */ +AsyncJitterQueue* async_jitter_queue_ref (AsyncJitterQueue *queue); +void async_jitter_queue_unref (AsyncJitterQueue *queue); +#ifndef G_DISABLE_DEPRECATED +/* You don't have to hold the lock for calling *_ref and *_unref anymore. */ +void async_jitter_queue_ref_unlocked (AsyncJitterQueue *queue); +void async_jitter_queue_unref_and_unlock (AsyncJitterQueue *queue); +#endif /* !G_DISABLE_DEPRECATED */ + +void async_jitter_queue_set_low_threshold (AsyncJitterQueue *queue, + gfloat threshold); +void async_jitter_queue_set_high_threshold (AsyncJitterQueue *queue, + gfloat threshold); + +void async_jitter_queue_set_max_queue_length (AsyncJitterQueue *queue, + guint32 max_length); + +/* Push data into the async queue. Must not be NULL. */ +void async_jitter_queue_push (AsyncJitterQueue *queue, + gpointer data); +void async_jitter_queue_push_unlocked (AsyncJitterQueue *queue, + gpointer data); +gboolean async_jitter_queue_push_sorted (AsyncJitterQueue *queue, + gpointer data, + GCompareDataFunc func, + gpointer user_data); + +void async_jitter_queue_insert_after_unlocked(AsyncJitterQueue *queue, + GList *sibling, + gpointer data); + +gboolean async_jitter_queue_push_sorted_unlocked(AsyncJitterQueue *queue, + gpointer data, + GCompareDataFunc func, + gpointer user_data); + +/* Pop data from the async queue. When no data is there, the thread is blocked + * until data arrives. */ +gpointer async_jitter_queue_pop (AsyncJitterQueue *queue); +gpointer async_jitter_queue_pop_unlocked (AsyncJitterQueue *queue); + +/* Try to pop data. NULL is returned in case of empty queue. */ +gpointer async_jitter_queue_try_pop (AsyncJitterQueue *queue); +gpointer async_jitter_queue_try_pop_unlocked (AsyncJitterQueue *queue); + +/* Wait for data until at maximum until end_time is reached. NULL is returned + * in case of empty queue. */ +gpointer async_jitter_queue_timed_pop (AsyncJitterQueue *queue, + GTimeVal *end_time); +gpointer async_jitter_queue_timed_pop_unlocked (AsyncJitterQueue *queue, + GTimeVal *end_time); + +/* Return the length of the queue. Negative values mean that threads + * are waiting, positve values mean that there are entries in the + * queue. Actually this function returns the length of the queue minus + * the number of waiting threads, async_jitter_queue_length == 0 could also + * mean 'n' entries in the queue and 'n' thread waiting. Such can + * happen due to locking of the queue or due to scheduling. */ +gint async_jitter_queue_length (AsyncJitterQueue *queue); +gint async_jitter_queue_length_unlocked (AsyncJitterQueue *queue); + +void async_jitter_queue_set_flushing_unlocked (AsyncJitterQueue* queue, + GFunc free_func, gpointer user_data); +void async_jitter_queue_unset_flushing_unlocked (AsyncJitterQueue* queue); +void async_jitter_queue_set_blocking_unlocked (AsyncJitterQueue* queue, + gboolean blocking); +guint32 +async_jitter_queue_length_ts_units_unlocked (AsyncJitterQueue *queue); + +G_END_DECLS + +#endif /* __ASYNCJITTERQUEUE_H__ */ + -- cgit v1.2.1