gboolean
gkd_ssh_agent_initialize_with_module (GP11Module *module)
{
	GP11Session *session = NULL;
	GList *slots, *l;
	GP11Mechanisms *mechs;
	GError *error = NULL;

	g_assert (GP11_IS_MODULE (module));

	/* Find a good slot for our session keys */
	slots = gp11_module_get_slots (module, TRUE);
	for (l = slots; session == NULL && l; l = g_list_next (l)) {

		/* Check that it has the mechanisms we need */
		mechs = gp11_slot_get_mechanisms (l->data);
		if (gp11_mechanisms_check (mechs, CKM_RSA_PKCS, CKM_DSA, GP11_INVALID)) {

			/* Try and open a session */
			session = gp11_slot_open_session (l->data, CKF_SERIAL_SESSION, &error);
			if (!session) {
				g_warning ("couldn't create pkcs#11 session: %s", egg_error_message (error));
				g_clear_error (&error);
			}
		}

		gp11_mechanisms_free (mechs);
	}

	gp11_list_unref_free (slots);

	if (!session) {
		g_warning ("couldn't select a usable pkcs#11 slot for the ssh agent to use");
		return FALSE;
	}

	pkcs11_module = g_object_ref (module);

	pkcs11_main_mutex = g_mutex_new ();
	pkcs11_main_cond = g_cond_new ();
	pkcs11_main_checked = FALSE;
	pkcs11_main_session = session;

	return TRUE;
}
Esempio n. 2
0
static void
gst_shape_wipe_init (GstShapeWipe * self, GstShapeWipeClass * g_class)
{
  self->video_sinkpad =
      gst_pad_new_from_static_template (&video_sink_pad_template, "video_sink");
  gst_pad_set_chain_function (self->video_sinkpad,
      GST_DEBUG_FUNCPTR (gst_shape_wipe_video_sink_chain));
  gst_pad_set_event_function (self->video_sinkpad,
      GST_DEBUG_FUNCPTR (gst_shape_wipe_video_sink_event));
  gst_pad_set_setcaps_function (self->video_sinkpad,
      GST_DEBUG_FUNCPTR (gst_shape_wipe_video_sink_setcaps));
  gst_pad_set_getcaps_function (self->video_sinkpad,
      GST_DEBUG_FUNCPTR (gst_shape_wipe_video_sink_getcaps));
  gst_pad_set_bufferalloc_function (self->video_sinkpad,
      GST_DEBUG_FUNCPTR (gst_shape_wipe_video_sink_bufferalloc));
  gst_pad_set_query_function (self->video_sinkpad,
      GST_DEBUG_FUNCPTR (gst_shape_wipe_video_sink_query));
  gst_element_add_pad (GST_ELEMENT (self), self->video_sinkpad);

  self->mask_sinkpad =
      gst_pad_new_from_static_template (&mask_sink_pad_template, "mask_sink");
  gst_pad_set_chain_function (self->mask_sinkpad,
      GST_DEBUG_FUNCPTR (gst_shape_wipe_mask_sink_chain));
  gst_pad_set_event_function (self->mask_sinkpad,
      GST_DEBUG_FUNCPTR (gst_shape_wipe_mask_sink_event));
  gst_pad_set_setcaps_function (self->mask_sinkpad,
      GST_DEBUG_FUNCPTR (gst_shape_wipe_mask_sink_setcaps));
  gst_pad_set_getcaps_function (self->mask_sinkpad,
      GST_DEBUG_FUNCPTR (gst_shape_wipe_mask_sink_getcaps));
  gst_element_add_pad (GST_ELEMENT (self), self->mask_sinkpad);

  self->srcpad = gst_pad_new_from_static_template (&src_pad_template, "src");
  gst_pad_set_event_function (self->srcpad,
      GST_DEBUG_FUNCPTR (gst_shape_wipe_src_event));
  gst_pad_set_getcaps_function (self->srcpad,
      GST_DEBUG_FUNCPTR (gst_shape_wipe_src_getcaps));
  gst_pad_set_query_function (self->srcpad,
      GST_DEBUG_FUNCPTR (gst_shape_wipe_src_query));
  gst_element_add_pad (GST_ELEMENT (self), self->srcpad);

  self->mask_mutex = g_mutex_new ();
  self->mask_cond = g_cond_new ();

  gst_shape_wipe_reset (self);
}
Esempio n. 3
0
static int
create_cond(os_handler_t  *handler,
	    os_hnd_cond_t **new_cond)
{
    os_hnd_cond_t *cond;

    cond = g_malloc(sizeof(*cond));
    if (!cond)
	return ENOMEM;
    cond->cond = g_cond_new();
    if (!cond->cond) {
	g_free(cond);
	return ENOMEM;
    }

    *new_cond = cond;
    return 0;
}
Esempio n. 4
0
static void
gst_collect_pads_init (GstCollectPads * pads, GstCollectPadsClass * g_class)
{
  pads->abidata.ABI.priv = GST_COLLECT_PADS_GET_PRIVATE (pads);

  pads->cond = g_cond_new ();
  pads->data = NULL;
  pads->cookie = 0;
  pads->numpads = 0;
  pads->queuedpads = 0;
  pads->eospads = 0;
  pads->started = FALSE;

  /* members to manage the pad list */
  pads->abidata.ABI.pad_lock = g_mutex_new ();
  pads->abidata.ABI.pad_cookie = 0;
  pads->abidata.ABI.pad_list = NULL;
}
static void
gst_sunaudiosink_init (GstSunAudioSink * sunaudiosink)
{
  const char *audiodev;

  GST_DEBUG_OBJECT (sunaudiosink, "initializing sunaudiosink");

  sunaudiosink->fd = -1;

  audiodev = g_getenv ("AUDIODEV");
  if (audiodev == NULL)
    audiodev = DEFAULT_DEVICE;
  sunaudiosink->device = g_strdup (audiodev);

  /* mutex and gcond used to control the write method */
  sunaudiosink->write_mutex = g_mutex_new ();
  sunaudiosink->sleep_cond = g_cond_new ();
}
Esempio n. 6
0
LogPipe *
log_reader_new(LogProto *proto)
{
  LogReader *self = g_new0(LogReader, 1);

  log_source_init_instance(&self->super);
  self->super.super.init = log_reader_init;
  self->super.super.deinit = log_reader_deinit;
  self->super.super.free_fn = log_reader_free;
  self->super.wakeup = log_reader_wakeup;
  self->proto = proto;
  self->immediate_check = FALSE;
  self->pollable_state = -1;
  log_reader_init_watches(self);
  g_static_mutex_init(&self->pending_proto_lock);
  self->pending_proto_cond = g_cond_new();
  return &self->super.super;
}
Esempio n. 7
0
gboolean
gkd_gpg_agent_initialize_with_module (GckModule *module)
{
	GckSession *session = NULL;
	GckSlot *slot;
	GError *error = NULL;
	GList *modules;

	g_assert (GCK_IS_MODULE (module));

	/*
	 * Find the right slot.
	 */
	modules = g_list_append (NULL, module);
	slot = gck_modules_token_for_uri (modules, "pkcs11:token=Secret%20Store", &error);
	g_list_free (modules);

	if (!slot) {
		g_warning ("couldn't find secret store module: %s", egg_error_message (error));
		g_clear_error (&error);
		return FALSE;
	}

	/* Try and open a session */
	session = gck_slot_open_session (slot, GCK_SESSION_READ_WRITE | GCK_SESSION_AUTHENTICATE, NULL, &error);
	g_object_unref (slot);

	if (!session) {
		g_warning ("couldn't select a usable pkcs#11 slot for the gpg agent to use");
		g_clear_error (&error);
		return FALSE;
	}

	pkcs11_module = g_object_ref (module);

	pkcs11_main_mutex = g_mutex_new ();
	pkcs11_main_cond = g_cond_new ();
	pkcs11_main_checked = FALSE;
	pkcs11_main_session = session;

	cache_settings = g_settings_new ("org.mate.crypto.cache");

	return TRUE;
}
Esempio n. 8
0
/**
 * Construct new core
 *
 * @object: the GstOmx object (ie. GstOmxBaseFilter, GstOmxBaseSrc, or
 *    GstOmxBaseSink).  The GstOmx object should have "component-role",
 *    "component-name", and "library-name" properties.
 */
GOmxCore *
g_omx_core_new (gpointer object, gpointer klass)
{
    GOmxCore *core;

    core = g_new0 (GOmxCore, 1);

    core->object = object;

    core->ports = g_ptr_array_new ();

    core->omx_state_condition = g_cond_new ();
    core->omx_state_mutex = g_mutex_new ();

    core->done_sem = g_sem_new ();
    core->flush_sem = g_sem_new ();
    core->port_sem = g_sem_new ();

    core->omx_state = OMX_StateInvalid;

    core->use_timestamps = TRUE;

    {
        gchar *library_name, *component_name, *component_role;

        library_name = g_type_get_qdata (G_OBJECT_CLASS_TYPE (klass),
                g_quark_from_static_string ("library-name"));

        component_name = g_type_get_qdata (G_OBJECT_CLASS_TYPE (klass),
                g_quark_from_static_string ("component-name"));

        component_role = g_type_get_qdata (G_OBJECT_CLASS_TYPE (klass),
                g_quark_from_static_string ("component-role"));

        g_object_set (core->object,
            "component-role", component_role,
            "component-name", component_name,
            "library-name", library_name,
            NULL);
    }

    return core;
}
Esempio n. 9
0
void rtp_scheduler_init(RtpScheduler *sched)
{
	sched->list=0;
	sched->time_=0;
	/* default to the posix timer */
	rtp_scheduler_set_timer(sched,&posix_timer);
	sched->lock=g_mutex_new();
	//sched->unblock_select_mutex=g_mutex_new();
	sched->unblock_select_cond=g_cond_new();
	sched->max_sessions=sizeof(SessionSet)*8;
	session_set_init(&sched->all_sessions);
	sched->all_max=0;
	session_set_init(&sched->r_sessions);
	sched->r_max=0;
	session_set_init(&sched->w_sessions);
	sched->w_max=0;
	session_set_init(&sched->e_sessions);
	sched->e_max=0;
}
static ScalixBackendSearchClosure *
closure_init (EDataBookView * book_view, EBookBackendScalix * bs)
{
    ScalixBackendSearchClosure *closure;

    closure = g_new (ScalixBackendSearchClosure, 1);

    closure->bs = bs;
    closure->mutex = g_mutex_new ();
    closure->cond = g_cond_new ();
    closure->thread = NULL;
    closure->stopped = FALSE;

    g_object_set_data_full (G_OBJECT (book_view),
                            SCALIX_BOOK_VIEW_CLOSURE_ID,
                            closure, (GDestroyNotify) closure_destroy);

    return closure;
}
Esempio n. 11
0
static void
setup (void)
{
  collect = gst_collect_pads_new ();
  gst_collect_pads_set_function (collect, collected_cb, NULL);

  srcpad1 = gst_pad_new_from_static_template (&srctemplate, "src1");
  srcpad2 = gst_pad_new_from_static_template (&srctemplate, "src2");
  sinkpad1 = gst_pad_new_from_static_template (&sinktemplate, "sink1");
  sinkpad2 = gst_pad_new_from_static_template (&sinktemplate, "sink2");
  fail_unless (gst_pad_link (srcpad1, sinkpad1) == GST_PAD_LINK_OK);
  fail_unless (gst_pad_link (srcpad2, sinkpad2) == GST_PAD_LINK_OK);

  cond = g_cond_new ();
  lock = g_mutex_new ();
  data1 = NULL;
  data2 = NULL;
  collected = FALSE;
}
Esempio n. 12
0
/**
 * @brief Create a new producer for the bufferqueue or return one previously
 *        allocated with the same key
 *
 * @param free_function Function to call when removing buffers from
 *                      the queue.
 * @param key producer's unique id, NULL if not shared.
 *
 * @return A new BufferQueue_Producer object that needs to be freed
 *         with @ref bq_producer_unref.
 */
BufferQueue_Producer *bq_producer_new(GDestroyNotify free_function,
                                      gchar *key,
                                      gint *is_new)
{
    BufferQueue_Producer *ret = NULL;

	*is_new = FALSE;

    if (key) {
        g_mutex_lock(bq_shared_producers_lock);
        ret = g_hash_table_lookup(bq_shared_producers, key);
    }

    if (!ret) {
        ret = g_slice_new0(BufferQueue_Producer);

		ret->ref_count = 1;
        ret->lock = g_mutex_new();
        ret->free_function = free_function;
        ret->last_consumer = g_cond_new();
		ret->fd_set = fd_set_new();
		ret->max_backlog = DEFAULT_MAX_BACKLOG;
		ret->user_data = NULL;

        if (key) {
            ret->key = g_strdup(key);
            g_hash_table_insert(bq_shared_producers, ret->key, ret);
        }

        bq_producer_reset_queue(ret);
        *is_new = TRUE;
    }
    else
    {
    	bq_producer_ref(ret);
    }

    if (key)
        g_mutex_unlock(bq_shared_producers_lock);

    return ret;
}
Esempio n. 13
0
static gpointer
g_async_queue_pop_intern_unlocked (GAsyncQueue *queue, 
				   gboolean     try_, 
				   GTimeVal    *end_time)
{
 gpointer retval;

	
 
  if (!g_queue_peek_tail_link (queue->queue))
    {
      if (try_)
	return NULL;
      
      if (!queue->cond)
	queue->cond = g_cond_new ();

      if (!end_time)
        {
          queue->waiting_threads++;
	  while (!g_queue_peek_tail_link (queue->queue))
            g_cond_wait (queue->cond, queue->mutex);
          queue->waiting_threads--;
        }
      else
        {
          queue->waiting_threads++;
          while (!g_queue_peek_tail_link (queue->queue))
            if (!g_cond_timed_wait (queue->cond, queue->mutex, end_time))
              break;
          queue->waiting_threads--;
          if (!g_queue_peek_tail_link (queue->queue))
	    return NULL;
        }
    }

  retval = g_queue_pop_tail (queue->queue);

  g_assert (retval);

  return retval;
}
Esempio n. 14
0
gboolean
eas_gdbus_client_init (struct eas_gdbus_client *client, const gchar *account_uid, GError **error)
{
	client->connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, error);
	if (!client->connection)
		return FALSE;

	client->account_uid = g_strdup (account_uid);
#if GLIB_CHECK_VERSION (2,31,0)
	client->progress_lock = &client->_mutex;
	g_mutex_init (client->progress_lock);
	client->progress_cond = &client->_cond;
	g_cond_init (client->progress_cond);
#else
	client->progress_lock = g_mutex_new ();
	client->progress_cond = g_cond_new ();
#endif
	client->progress_fns_table = g_hash_table_new_full (NULL, NULL, NULL, g_free);
	return TRUE;
}
Esempio n. 15
0
struct player_control *
pc_new(unsigned buffer_chunks, unsigned int buffered_before_play)
{
	struct player_control *pc = g_new0(struct player_control, 1);

	pc->buffer_chunks = buffer_chunks;
	pc->buffered_before_play = buffered_before_play;

	pc->mutex = g_mutex_new();
	pc->cond = g_cond_new();

	pc->command = PLAYER_COMMAND_NONE;
	pc->error_type = PLAYER_ERROR_NONE;
	pc->state = PLAYER_STATE_STOP;
	pc->cross_fade_seconds = 0;
	pc->mixramp_db = 0;
	pc->mixramp_delay_seconds = nanf("");

	return pc;
}
Esempio n. 16
0
void glibcurl_init() {
  /* Create source object for curl file descriptors, and hook it into the
     default main context. */
  GSource* src = g_source_new(&curlFuncs, sizeof(CurlGSource));
  curlSrc = (CurlGSource*)src;
  g_source_attach(&curlSrc->source, NULL);

  if (!g_thread_supported()) g_thread_init(NULL);

  /* Init rest of our data */
  curlSrc->callPerform = 0;
  curlSrc->selectThread = 0;
  curlSrc->cond = g_cond_new();
  curlSrc->mutex = g_mutex_new();
  curlSrc->gtkBlockAndWait = 0;

  /* Init libcurl */
  curl_global_init(CURL_GLOBAL_ALL);
  curlSrc->multiHandle = curl_multi_init();
}
Esempio n. 17
0
int open_session(int eflag)
{
	SaErrorT rv;

        if (!g_thread_supported()) {
                g_thread_init(NULL);
	};
	thread_wait = g_cond_new();
	thread_mutex = g_mutex_new();
	do_progress("Discover");
	rv = saHpiSessionOpen(SAHPI_UNSPECIFIED_DOMAIN_ID, &sessionid, NULL);
	if (rv != SA_OK) {
     		printf("saHpiSessionOpen error %s\n", oh_lookup_error(rv));
		return -1;
	}
	if (eflag) {
		show_event_short = 1;
		prt_flag = 1;
		pthread_create(&ge_thread, NULL, get_event, NULL);
	};
	rv = saHpiDiscover(sessionid);
	if (rv != SA_OK) {
		delete_progress();
		printf("saHpiDiscover rv = %s\n", oh_lookup_error(rv));
		return -1;
	};
	delete_progress();

	printf("Initial discovery done\n");

	Domain = init_resources(sessionid);
	if (Domain == (Domain_t *)NULL) {
     		printf("init_resources error\n");
		return -1;
	}
	printf("\tEnter a command or \"help\" for list of commands\n");

	if (! eflag)
		pthread_create(&ge_thread, NULL, get_event, NULL);
	return 0;
}
Esempio n. 18
0
static GstElement *
setup_mpeg2enc (void)
{
    GstElement *mpeg2enc;

    GST_DEBUG ("setup_mpeg2enc");
    mpeg2enc = gst_check_setup_element ("mpeg2enc");
    mysrcpad = gst_check_setup_src_pad (mpeg2enc, &srctemplate, NULL);
    mysinkpad = gst_check_setup_sink_pad (mpeg2enc, &sinktemplate, NULL);
    gst_pad_set_active (mysrcpad, TRUE);
    gst_pad_set_active (mysinkpad, TRUE);

    /* need to know when we are eos */
    gst_pad_set_event_function (mysinkpad, test_sink_event);

    /* and notify the test run */
    mpeg2enc_mutex = g_mutex_new ();
    mpeg2enc_cond = g_cond_new ();

    return mpeg2enc;
}
Esempio n. 19
0
/*
 * Argument handling 
 */
static Command *new_command(Cmd cmd, const char *arg) {

	Command *newcommand = malloc(sizeof(Command));
	if (!newcommand) {
		perror("Can't allocate new command");
		exit(errno);
	}

	memset(newcommand, 0, sizeof(Command));

	newcommand->cmd = cmd;
	if (arg)
		newcommand->arg = strdup(arg);

	newcommand->mutex = g_mutex_new();
	newcommand->cond = g_cond_new();

	cmdlist = g_list_append(cmdlist, newcommand);

	return newcommand;
}
Esempio n. 20
0
static void
gst_clock_init (GstClock * clock)
{
  clock->last_time = 0;
  clock->entries = NULL;
  clock->entries_changed = g_cond_new ();
  clock->stats = FALSE;

  clock->internal_calibration = 0;
  clock->external_calibration = 0;
  clock->rate_numerator = 1;
  clock->rate_denominator = 1;

  clock->slave_lock = g_mutex_new ();
  clock->window_size = DEFAULT_WINDOW_SIZE;
  clock->window_threshold = DEFAULT_WINDOW_THRESHOLD;
  clock->filling = TRUE;
  clock->time_index = 0;
  clock->timeout = DEFAULT_TIMEOUT;
  clock->times = g_new0 (GstClockTime, 4 * clock->window_size);
}
Esempio n. 21
0
static void
gst_app_src_init (GstAppSrc * appsrc, GstAppSrcClass * klass)
{
  appsrc->priv = G_TYPE_INSTANCE_GET_PRIVATE (appsrc, GST_TYPE_APP_SRC,
      GstAppSrcPrivate);

  appsrc->priv->mutex = g_mutex_new ();
  appsrc->priv->cond = g_cond_new ();
  appsrc->priv->queue = g_queue_new ();

  appsrc->priv->size = DEFAULT_PROP_SIZE;
  appsrc->priv->stream_type = DEFAULT_PROP_STREAM_TYPE;
  appsrc->priv->max_bytes = DEFAULT_PROP_MAX_BYTES;
  appsrc->priv->format = DEFAULT_PROP_FORMAT;
  appsrc->priv->block = DEFAULT_PROP_BLOCK;
  appsrc->priv->min_latency = DEFAULT_PROP_MIN_LATENCY;
  appsrc->priv->max_latency = DEFAULT_PROP_MAX_LATENCY;
  appsrc->priv->emit_signals = DEFAULT_PROP_EMIT_SIGNALS;

  gst_base_src_set_live (GST_BASE_SRC (appsrc), DEFAULT_PROP_IS_LIVE);
}
Esempio n. 22
0
/*
 *  The following is required to set up the thread state for
 *  the use of async queues.  This is true even if we aren't
 *  using live threads.
 */
int oh_event_init()
{
        trace("Attempting to init event");
        if(!g_thread_supported()) {
                trace("Initializing thread support");
                g_thread_init(NULL);
        } else {
                trace("Already supporting threads");
        }
        trace("Setting up event processing queue");
        oh_process_q = g_async_queue_new();
        if(getenv("OPENHPI_THREADED") &&
           (strcmp(getenv("OPENHPI_THREADED"), "YES") ==0 )) {
                oh_is_threaded = TRUE;
                oh_thread_wait = g_cond_new();
                oh_thread_mutex = g_mutex_new();
                oh_event_thread = g_thread_create(oh_event_thread_loop,
                                                  NULL, FALSE, &oh_event_thread_error);
        }
        return 1;
}
Esempio n. 23
0
static void
setup (void)
{
  GST_DEBUG ("setup_queue");

  queue = gst_check_setup_element ("queue");
  g_signal_connect (queue, "underrun", G_CALLBACK (queue_underrun), NULL);

  mysrcpad = gst_check_setup_src_pad (queue, &srctemplate, NULL);
  gst_pad_set_active (mysrcpad, TRUE);

  mysinkpad = NULL;

  overrun_count = 0;

  underrun_mutex = g_mutex_new ();
  underrun_cond = g_cond_new ();
  underrun_count = 0;

  events = NULL;
}
Esempio n. 24
0
static void
gst_task_init (GstTask * task)
{
  GstTaskClass *klass;

  klass = GST_TASK_GET_CLASS (task);

  task->priv = GST_TASK_GET_PRIVATE (task);
  task->running = FALSE;
  task->abidata.ABI.thread = NULL;
  task->lock = NULL;
  task->cond = g_cond_new ();
  task->state = GST_TASK_STOPPED;
  task->priv->prio_set = FALSE;

  /* use the default klass pool for this task, users can
   * override this later */
  g_static_mutex_lock (&pool_lock);
  task->priv->pool = gst_object_ref (klass->pool);
  g_static_mutex_unlock (&pool_lock);
}
Esempio n. 25
0
GOmxCore *
g_omx_core_new (void *object)
{
    GOmxCore *core;

    core = g_new0 (GOmxCore, 1);

    core->object = object;
    core->ports = g_ptr_array_new ();

    core->omx_state_condition = g_cond_new ();
    core->omx_state_mutex = g_mutex_new ();

    core->done_sem = g_sem_new ();
    core->flush_sem = g_sem_new ();
    core->port_sem = g_sem_new ();

    core->omx_state = OMX_StateInvalid;

    return core;
}
Esempio n. 26
0
static void run_idle(GSourceFunc func, gpointer data)
{
    if (func == NULL)
    {
        return;
    }
    struct idle_runner *r = g_new0(struct idle_runner, 1);
    r->mutex = g_mutex_new();
    r->cond = g_cond_new();
    r->data = data;
    r->func = func;
    g_mutex_lock(r->mutex);
    g_idle_add((GSourceFunc)run_idle_cb, r);
    while (!r->done)
    {
        g_cond_wait(r->cond, r->mutex);
    }
    g_mutex_unlock(r->mutex);
    g_cond_free(r->cond);
    g_mutex_free(r->mutex);
    g_free(r);
}
Esempio n. 27
0
static void
gst_mio_video_src_init (GstMIOVideoSrc * self, GstMIOVideoSrcClass * gclass)
{
  GstBaseSrc *base_src = GST_BASE_SRC_CAST (self);
  guint64 host_freq;

  gst_base_src_set_live (base_src, TRUE);
  gst_base_src_set_format (base_src, GST_FORMAT_TIME);

  host_freq = gst_gdouble_to_guint64 (CVGetHostClockFrequency ());
  if (host_freq <= GST_SECOND) {
    self->cv_ratio_n = GST_SECOND / host_freq;
    self->cv_ratio_d = 1;
  } else {
    self->cv_ratio_n = 1;
    self->cv_ratio_d = host_freq / GST_SECOND;
  }

  self->queue = g_queue_new ();
  self->qlock = g_mutex_new ();
  self->qcond = g_cond_new ();
}
static void
gst_dshowvideosrc_init (GstDshowVideoSrc * src, GstDshowVideoSrcClass * klass)
{
  src->device = NULL;
  src->device_name = NULL;
  src->video_cap_filter = NULL;
  src->dshow_fakesink = NULL;
  src->media_filter = NULL;
  src->filter_graph = NULL;
  src->caps = NULL;
  src->pins_mediatypes = NULL;
  src->is_rgb = FALSE;

  src->buffer_cond = g_cond_new ();
  src->buffer_mutex = g_mutex_new ();
  src->buffer = NULL;
  src->stop_requested = FALSE;

  CoInitializeEx (NULL, COINIT_MULTITHREADED);

  gst_base_src_set_live (GST_BASE_SRC (src), TRUE);
}
Esempio n. 29
0
/* initialize GNet testing */
static void
gnet_check_init (int *argc, char **argv[])
{
  gnet_init ();

  /* GST_DEBUG_CATEGORY_INIT (check_debug, "check", 0, "check regression tests"); */

  if (g_getenv ("GNET_TEST_DEBUG"))
    _gnet_check_debug = TRUE;

  if (g_getenv ("SOCKS_SERVER")) {
    GInetAddr *ia;

    ia = gnet_socks_get_server ();
    if (ia) {
      gchar *name;

      name = gnet_inetaddr_get_canonical_name (ia);
      g_print ("\nUsing SOCKS %u proxy: %s\n", gnet_socks_get_version(), name);
      g_free (name);
      gnet_inetaddr_unref (ia);
      gnet_socks_set_enabled (TRUE);
    }
  }

  g_log_set_handler (NULL, G_LOG_LEVEL_MESSAGE, gnet_check_log_message_func,
      NULL);
  g_log_set_handler (NULL, G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING,
      gnet_check_log_critical_func, NULL);
  g_log_set_handler ("GNet", G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING,
      gnet_check_log_critical_func, NULL);
  g_log_set_handler ("GLib", G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING,
      gnet_check_log_critical_func, NULL);
  g_log_set_handler ("GLib-GObject", G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING,
      gnet_check_log_critical_func, NULL);

  check_cond = g_cond_new ();
  check_mutex = g_mutex_new ();
}
static void
gst_uri_downloader_init (GstUriDownloader * downloader)
{
  downloader->priv = GST_URI_DOWNLOADER_GET_PRIVATE (downloader);

  /* Initialize the sink pad. This pad will be connected to the src pad of the
   * element created with gst_element_make_from_uri and will handle the download */
  downloader->priv->pad =
      gst_pad_new_from_static_template (&sinkpadtemplate, "sink");
  gst_pad_set_chain_function (downloader->priv->pad,
      GST_DEBUG_FUNCPTR (gst_uri_downloader_chain));
  gst_pad_set_event_function (downloader->priv->pad,
      GST_DEBUG_FUNCPTR (gst_uri_downloader_sink_event));
  gst_pad_set_element_private (downloader->priv->pad, downloader);
  gst_pad_set_active (downloader->priv->pad, TRUE);

  /* Create a bus to handle error and warning message from the source element */
  downloader->priv->bus = gst_bus_new ();

  downloader->priv->lock = g_mutex_new ();
  downloader->priv->cond = g_cond_new ();
}