2002-06-21 14:50:00 +00:00
|
|
|
/* GStreamer
|
|
|
|
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library 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
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library 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.
|
|
|
|
*/
|
|
|
|
|
2003-05-17 13:10:00 +00:00
|
|
|
#include <unistd.h>
|
2002-06-21 14:50:00 +00:00
|
|
|
#include <sys/time.h>
|
|
|
|
#include <glib.h>
|
|
|
|
#include "gstlog.h"
|
|
|
|
|
|
|
|
static GMutex *mutex = NULL;
|
2004-03-13 15:27:01 +00:00
|
|
|
static GCond *cond = NULL;
|
2002-06-21 14:50:00 +00:00
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
static GMutex *
|
|
|
|
gst_mutex_new_dummy_impl (void)
|
2002-06-21 14:50:00 +00:00
|
|
|
{
|
|
|
|
if (!mutex)
|
|
|
|
mutex = g_malloc (8);
|
|
|
|
|
|
|
|
return mutex;
|
|
|
|
}
|
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
static void
|
|
|
|
gst_mutex_dummy_impl (GMutex * mutex)
|
2004-03-15 19:27:17 +00:00
|
|
|
{ /* NOP */
|
2004-03-13 15:27:01 +00:00
|
|
|
}
|
2002-06-21 14:50:00 +00:00
|
|
|
|
|
|
|
static gboolean
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_mutex_trylock_dummy_impl (GMutex * mutex)
|
2002-06-21 14:50:00 +00:00
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
static GCond *
|
|
|
|
gst_cond_new_dummy_impl (void)
|
2002-06-21 14:50:00 +00:00
|
|
|
{
|
|
|
|
if (!cond)
|
|
|
|
cond = g_malloc (8);
|
|
|
|
|
|
|
|
return cond;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_cond_dummy_impl (GCond * cond)
|
2004-03-15 19:27:17 +00:00
|
|
|
{ /* NOP */
|
2004-03-13 15:27:01 +00:00
|
|
|
}
|
2002-06-21 14:50:00 +00:00
|
|
|
|
|
|
|
static gboolean
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_cond_timed_wait_dummy_impl (GCond * cond, GMutex * mutex,
|
|
|
|
GTimeVal * end_time)
|
2002-06-21 14:50:00 +00:00
|
|
|
{
|
|
|
|
struct timeval tvtarget;
|
|
|
|
GTimeVal tvnow;
|
|
|
|
guint64 now, target;
|
|
|
|
gint64 diff;
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2002-06-21 14:50:00 +00:00
|
|
|
target = end_time->tv_sec * 1000000 + end_time->tv_usec;
|
|
|
|
|
|
|
|
g_get_current_time (&tvnow);
|
|
|
|
now = tvnow.tv_sec * 1000000 + tvnow.tv_usec;
|
|
|
|
|
|
|
|
diff = target - now;
|
|
|
|
if (diff > 1000) {
|
|
|
|
tvtarget.tv_usec = diff % 1000000;
|
|
|
|
tvtarget.tv_sec = diff / 1000000;
|
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
select (0, NULL, NULL, NULL, &tvtarget);
|
2002-06-21 14:50:00 +00:00
|
|
|
}
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2002-06-21 14:50:00 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
static GPrivate *
|
2002-06-21 14:50:00 +00:00
|
|
|
gst_private_new_dummy_impl (GDestroyNotify destructor)
|
|
|
|
{
|
|
|
|
gpointer data;
|
|
|
|
|
|
|
|
data = g_new0 (gpointer, 1);
|
|
|
|
|
|
|
|
return (GPrivate *) data;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gpointer
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_private_get_dummy_impl (GPrivate * private_key)
|
2002-06-21 14:50:00 +00:00
|
|
|
{
|
|
|
|
gpointer *data = (gpointer) private_key;
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2002-06-21 14:50:00 +00:00
|
|
|
return *data;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_private_set_dummy_impl (GPrivate * private_key, gpointer data)
|
2002-06-21 14:50:00 +00:00
|
|
|
{
|
2004-03-13 15:27:01 +00:00
|
|
|
*((gpointer *) private_key) = data;
|
2002-06-21 14:50:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_thread_create_dummy_impl (GThreadFunc func, gpointer data,
|
|
|
|
gulong stack_size, gboolean joinable, gboolean bound,
|
|
|
|
GThreadPriority priority, gpointer thread, GError ** error)
|
2002-06-21 14:50:00 +00:00
|
|
|
{
|
|
|
|
g_warning ("GStreamer configured to not use threads");
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_thread_dummy_impl (void)
|
2004-03-15 19:27:17 +00:00
|
|
|
{ /* NOP */
|
2004-03-13 15:27:01 +00:00
|
|
|
}
|
2002-06-21 14:50:00 +00:00
|
|
|
|
|
|
|
static void
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_thread_dummy_impl_1 (gpointer thread)
|
2004-03-15 19:27:17 +00:00
|
|
|
{ /* NOP */
|
2004-03-13 15:27:01 +00:00
|
|
|
}
|
2002-06-21 14:50:00 +00:00
|
|
|
|
|
|
|
static void
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_thread_set_priority_dummy_impl (gpointer thread, GThreadPriority priority)
|
2004-03-15 19:27:17 +00:00
|
|
|
{ /* NOP */
|
2004-03-13 15:27:01 +00:00
|
|
|
}
|
2002-06-21 14:50:00 +00:00
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gst_thread_equal_dummy_impl (gpointer thread1, gpointer thread2)
|
|
|
|
{
|
|
|
|
return (thread1 == thread2);
|
|
|
|
}
|
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
GThreadFunctions gst_thread_dummy_functions = {
|
2004-03-15 19:27:17 +00:00
|
|
|
gst_mutex_new_dummy_impl,
|
|
|
|
(void (*)(GMutex *)) gst_mutex_dummy_impl,
|
|
|
|
gst_mutex_trylock_dummy_impl,
|
|
|
|
(void (*)(GMutex *)) gst_mutex_dummy_impl,
|
|
|
|
gst_mutex_dummy_impl,
|
|
|
|
gst_cond_new_dummy_impl,
|
|
|
|
(void (*)(GCond *)) gst_cond_dummy_impl,
|
|
|
|
(void (*)(GCond *)) gst_cond_dummy_impl,
|
|
|
|
(void (*)(GCond *, GMutex *)) gst_cond_dummy_impl,
|
|
|
|
gst_cond_timed_wait_dummy_impl,
|
|
|
|
gst_cond_dummy_impl,
|
|
|
|
gst_private_new_dummy_impl,
|
|
|
|
gst_private_get_dummy_impl,
|
|
|
|
gst_private_set_dummy_impl,
|
|
|
|
gst_thread_create_dummy_impl,
|
|
|
|
gst_thread_dummy_impl,
|
|
|
|
gst_thread_dummy_impl_1,
|
|
|
|
gst_thread_dummy_impl,
|
|
|
|
gst_thread_set_priority_dummy_impl,
|
|
|
|
gst_thread_dummy_impl_1, gst_thread_equal_dummy_impl
|
|
|
|
};
|