Exemplo n.º 1
0
static AddrRange *
split_range (GstRTSPAddressPool * pool, AddrRange * range, guint skip_addr,
             guint skip_port, gint n_ports)
{
    GstRTSPAddressPoolPrivate *priv = pool->priv;
    AddrRange *temp;

    if (skip_addr) {
        temp = g_slice_dup (AddrRange, range);
        memcpy (temp->max.bytes, temp->min.bytes, temp->min.size);
        inc_address (&temp->max, skip_addr - 1);
        priv->addresses = g_list_prepend (priv->addresses, temp);

        inc_address (&range->min, skip_addr);
    }

    if (!RANGE_IS_SINGLE (range)) {
        /* min and max are not the same, we have more than one address. */
        temp = g_slice_dup (AddrRange, range);
        /* increment the range min address */
        inc_address (&temp->min, 1);
        /* and store back in pool */
        priv->addresses = g_list_prepend (priv->addresses, temp);

        /* adjust range with only the first address */
        memcpy (range->max.bytes, range->min.bytes, range->min.size);
    }

    /* range now contains only one single address */
    if (skip_port > 0) {
        /* make a range with the skipped ports */
        temp = g_slice_dup (AddrRange, range);
        temp->max.port = temp->min.port + skip_port - 1;
        /* and store back in pool */
        priv->addresses = g_list_prepend (priv->addresses, temp);

        /* increment range port */
        range->min.port += skip_port;
    }
    /* range now contains single address with desired port number */
    if (range->max.port - range->min.port + 1 > n_ports) {
        /* make a range with the remaining ports */
        temp = g_slice_dup (AddrRange, range);
        temp->min.port += n_ports;
        /* and store back in pool */
        priv->addresses = g_list_prepend (priv->addresses, temp);

        /* and truncate port */
        range->max.port = range->min.port + n_ports - 1;
    }
    return range;
}
Exemplo n.º 2
0
static void
auth_channel_closed_cb (GabbleServerSaslChannel *channel,
    GabbleAuthManager *self)
{
  SavedError tmp = { NULL, NULL, 0 };

  tp_channel_manager_emit_channel_closed_for_object (self,
      TP_EXPORTABLE_CHANNEL (channel));

  g_assert (self->priv->channel == channel);

  /* this is our last chance to find out why it failed */
  if (gabble_server_sasl_channel_get_failure_details (channel,
      &tmp.name, &tmp.details, &tmp.reason))
    self->priv->error = g_slice_dup (SavedError, &tmp);

  g_signal_handler_disconnect (self->priv->channel, self->priv->closed_id);
  tp_clear_object (&self->priv->channel);

  /* discard info we were holding in case we wanted to fall back */
  g_slist_foreach (self->priv->mechanisms, (GFunc) g_free, NULL);
  tp_clear_pointer (&self->priv->mechanisms, g_slist_free);
  tp_clear_pointer (&self->priv->server, g_free);
  tp_clear_pointer (&self->priv->session_id, g_free);
  tp_clear_pointer (&self->priv->username, g_free);
}
Exemplo n.º 3
0
void
mex_action_manager_add_action (MexActionManager *manager,
                               MexActionInfo    *info)
{
  MexActionInfo *info_copy;
  MexActionManagerPrivate *priv;

  g_return_if_fail (MEX_IS_ACTION_MANAGER (manager));

  priv = manager->priv;

  if (g_hash_table_lookup (priv->actions, mx_action_get_name (info->action)))
    {
      g_warning (G_STRLOC ": Action '%s' already exists",
                 mx_action_get_name (info->action));
      return;
    }

  info_copy = g_slice_dup (MexActionInfo, info);
  info_copy->action = g_object_ref_sink (info->action);
  info_copy->mime_types = g_strdupv (info->mime_types);
  info_copy->exclude_mime_types = g_strdupv (info->exclude_mime_types);

  g_hash_table_insert (priv->actions,
                       (gpointer)mx_action_get_name (info->action),
                       info_copy);
  g_signal_emit (manager, signals[ACTION_ADDED], 0, info_copy);
}
Exemplo n.º 4
0
float *
cogl_vector4_copy (float *vector)
{
  if (vector)
    return g_slice_dup (CoglVector4, vector);
  return NULL;
}
Exemplo n.º 5
0
static void
_cogl_path_modify (CoglPath *path)
{
  /* This needs to be called whenever the path is about to be modified
     to implement copy-on-write semantics */

  /* If there is more than one path using the data then we need to
     copy the data instead */
  if (path->data->ref_count != 1)
    {
      CoglPathData *old_data = path->data;

      path->data = g_slice_dup (CoglPathData, old_data);
      path->data->path_nodes = g_array_new (FALSE, FALSE,
                                            sizeof (CoglPathNode));
      g_array_append_vals (path->data->path_nodes,
                           old_data->path_nodes->data,
                           old_data->path_nodes->len);

      path->data->fill_attribute_buffer = NULL;
      path->data->fill_primitive = NULL;
      path->data->stroke_attribute_buffer = NULL;
      path->data->ref_count = 1;

      _cogl_path_data_unref (old_data);
    }
  else
    /* The path is altered so the vbos will now be invalid */
    _cogl_path_data_clear_vbos (path->data);
}
Exemplo n.º 6
0
GimpAnchor *
gimp_anchor_copy (const GimpAnchor *anchor)
{
  g_return_val_if_fail (anchor != NULL, NULL);

  return g_slice_dup (GimpAnchor, anchor);
}
Exemplo n.º 7
0
static void
clutter_value_copy_shader_matrix (const GValue *src,
                                  GValue       *dest)
{
  dest->data[0].v_pointer =
    g_slice_dup (ClutterShaderMatrix, src->data[0].v_pointer);
}
Exemplo n.º 8
0
static void
clutter_value_copy_shader_float (const GValue *src,
                                 GValue       *dest)
{
  dest->data[0].v_pointer =
    g_slice_dup (ClutterShaderFloat, src->data[0].v_pointer);
}
Exemplo n.º 9
0
/**
 * champlain_bounding_box_copy:
 * @bbox: a #ChamplainBoundingBox
 *
 * Makes a copy of the bounding box structure. The result must be
 * freed using champlain_bounding_box_free().
 *
 * Returns: an allocated copy of @bbox.
 *
 * Since: 0.6
 */
ChamplainBoundingBox *
champlain_bounding_box_copy (const ChamplainBoundingBox *bbox)
{
  if (G_LIKELY (bbox != NULL))
    return g_slice_dup (ChamplainBoundingBox, bbox);

  return NULL;
}
Exemplo n.º 10
0
/**
 * clutter_units_copy:
 * @units: the #ClutterUnits to copy
 *
 * Copies @units
 *
 * Return value: (transfer full): the newly created copy of a
 *   #ClutterUnits structure. Use clutter_units_free() to free
 *   the allocated resources
 *
 * Since: 1.0
 */
ClutterUnits *
clutter_units_copy (const ClutterUnits *units)
{
  if (units != NULL)
    return g_slice_dup (ClutterUnits, units);

  return NULL;
}
Exemplo n.º 11
0
static gpointer
g_range_copy_internal (gpointer boxed)
{
  if (G_LIKELY (boxed != NULL))
    return g_slice_dup (GRange, boxed);

  return NULL;
}
Exemplo n.º 12
0
/**
 * clutter_actor_box_copy:
 * @box: a #ClutterActorBox
 *
 * Copies @box
 *
 * Return value: a newly allocated copy of #ClutterActorBox. Use
 *   clutter_actor_box_free() to free the allocated resources
 *
 * Since: 1.0
 */
ClutterActorBox *
clutter_actor_box_copy (const ClutterActorBox *box)
{
  if (G_LIKELY (box != NULL))
    return g_slice_dup (ClutterActorBox, box);

  return NULL;
}
Exemplo n.º 13
0
CoglMatrix *
cogl_matrix_copy (const CoglMatrix *matrix)
{
  if (G_LIKELY (matrix))
    return g_slice_dup (CoglMatrix, matrix);

  return NULL;
}
Exemplo n.º 14
0
ClutterEventX11 *
_clutter_event_x11_copy (ClutterEventX11 *event_x11)
{
  if (event_x11 != NULL)
    return g_slice_dup (ClutterEventX11, event_x11);

  return NULL;
}
Exemplo n.º 15
0
CoglColor *
cogl_color_copy (const CoglColor *color)
{
  if (G_LIKELY (color))
    return g_slice_dup (CoglColor, color);

  return NULL;
}
Exemplo n.º 16
0
static ClutterGstBox *
clutter_gst_box_copy (const ClutterGstBox *box)
{
  if (G_LIKELY (box != NULL))
    return g_slice_dup (ClutterGstBox, box);

  return NULL;
}
Exemplo n.º 17
0
/**
 * clutter_margin_copy:
 * @margin_: a #ClutterMargin
 *
 * Creates a new #ClutterMargin and copies the contents of @margin_ into
 * the newly created structure.
 *
 * Return value: (transfer full): a copy of the #ClutterMargin.
 *
 * Since: 1.10
 */
ClutterMargin *
clutter_margin_copy (const ClutterMargin *margin_)
{
  if (G_LIKELY (margin_ != NULL))
    return g_slice_dup (ClutterMargin, margin_);

  return NULL;
}
Exemplo n.º 18
0
/**
 * clutter_vertex_copy:
 * @vertex: a #ClutterVertex
 *
 * Copies @vertex
 *
 * Return value: (transfer full): a newly allocated copy of #ClutterVertex.
 *   Use clutter_vertex_free() to free the allocated resources
 *
 * Since: 1.0
 */
ClutterVertex *
clutter_vertex_copy (const ClutterVertex *vertex)
{
  if (G_LIKELY (vertex != NULL))
    return g_slice_dup (ClutterVertex, vertex);

  return NULL;
}
Exemplo n.º 19
0
gboolean
gst_mfx_filter_prepare (GstMfxFilter * filter)
{
  mfxFrameAllocRequest request[2];
  mfxStatus sts = MFX_ERR_NONE;

  init_params (filter);

  gst_mfx_task_set_video_params (filter->vpp[1], &filter->params);

  sts =
      MFXVideoVPP_QueryIOSurf (filter->session, &filter->params, request);
  if (sts < 0) {
    GST_ERROR ("Unable to query VPP allocation request %d", sts);
    return FALSE;
  } else if (sts > 0) {
    filter->params.IOPattern =
        MFX_IOPATTERN_IN_SYSTEM_MEMORY | MFX_IOPATTERN_OUT_SYSTEM_MEMORY;
  }

  if (filter->shared_request[1]) {
    filter->shared_request[1]->NumFrameSuggested += request[1].NumFrameSuggested;
    filter->shared_request[1]->NumFrameMin =
        filter->shared_request[1]->NumFrameSuggested;
  }
  else {
    filter->shared_request[1] = g_slice_dup (mfxFrameAllocRequest, &request[1]);
  }

  gst_mfx_task_set_request (filter->vpp[1], filter->shared_request[1]);

  /* Initialize input VPP surface pool for shared VPP-decode task */
  if (filter->vpp[0]) {
    gboolean memtype_is_system =
        !(filter->params.IOPattern & MFX_IOPATTERN_IN_VIDEO_MEMORY);

    filter->shared_request[0]->NumFrameSuggested += request[0].NumFrameSuggested;
    filter->shared_request[0]->NumFrameMin =
        filter->shared_request[0]->NumFrameSuggested;

    if (!memtype_is_system) {
      filter->shared_request[0]->Type |= MFX_MEMTYPE_VIDEO_MEMORY_DECODER_TARGET;
      gst_mfx_task_use_video_memory (filter->vpp[0]);
      gst_mfx_task_set_request (filter->vpp[0], filter->shared_request[0]);

      sts = gst_mfx_task_frame_alloc (filter->vpp[0], filter->shared_request[0],
          &filter->response[0]);
      if (MFX_ERR_NONE != sts)
        return FALSE;
    }

    filter->vpp_pool[0] = gst_mfx_surface_pool_new_with_task (filter->vpp[0]);
    if (!filter->vpp_pool[0])
      return FALSE;
  }

  return TRUE;
}
static GstMpegtsAtscStringSegment *
_gst_mpegts_atsc_string_segment_copy (GstMpegtsAtscStringSegment * seg)
{
    GstMpegtsAtscStringSegment *copy;

    copy = g_slice_dup (GstMpegtsAtscStringSegment, seg);

    return copy;
}
static GstMpegtsAtscSTT *
_gst_mpegts_atsc_stt_copy (GstMpegtsAtscSTT * stt)
{
    GstMpegtsAtscSTT *copy;

    copy = g_slice_dup (GstMpegtsAtscSTT, stt);
    copy->descriptors = g_ptr_array_ref (stt->descriptors);

    return copy;
}
static GstMpegtsAtscMGTTable *
_gst_mpegts_atsc_mgt_table_copy (GstMpegtsAtscMGTTable * mgt_table)
{
    GstMpegtsAtscMGTTable *copy;

    copy = g_slice_dup (GstMpegtsAtscMGTTable, mgt_table);
    copy->descriptors = g_ptr_array_ref (mgt_table->descriptors);

    return copy;
}
/* Terrestrial/Cable Virtual Channel Table TVCT/CVCT */
static GstMpegtsAtscVCTSource *
_gst_mpegts_atsc_vct_source_copy (GstMpegtsAtscVCTSource * source)
{
    GstMpegtsAtscVCTSource *copy;

    copy = g_slice_dup (GstMpegtsAtscVCTSource, source);
    copy->descriptors = g_ptr_array_ref (source->descriptors);

    return copy;
}
static GstMpegtsAtscEIT *
_gst_mpegts_atsc_eit_copy (GstMpegtsAtscEIT * eit)
{
    GstMpegtsAtscEIT *copy;

    copy = g_slice_dup (GstMpegtsAtscEIT, eit);
    copy->events = g_ptr_array_ref (eit->events);

    return copy;
}
static GstMpegtsAtscMultString *
_gst_mpegts_atsc_mult_string_copy (GstMpegtsAtscMultString * mstring)
{
    GstMpegtsAtscMultString *copy;

    copy = g_slice_dup (GstMpegtsAtscMultString, mstring);
    copy->segments = g_ptr_array_ref (mstring->segments);

    return copy;
}
static GstMpegtsAtscETT *
_gst_mpegts_atsc_ett_copy (GstMpegtsAtscETT * ett)
{
    GstMpegtsAtscETT *copy;

    copy = g_slice_dup (GstMpegtsAtscETT, ett);
    copy->messages = g_ptr_array_ref (ett->messages);

    return copy;
}
static GstMpegtsDescriptor *
_copy_descriptor (GstMpegtsDescriptor * desc)
{
  GstMpegtsDescriptor *copy;

  copy = g_slice_dup (GstMpegtsDescriptor, desc);
  copy->data = g_memdup (desc->data, desc->length + 2);

  return copy;
}
static GstMpegtsAtscEITEvent *
_gst_mpegts_atsc_eit_event_copy (GstMpegtsAtscEITEvent * event)
{
    GstMpegtsAtscEITEvent *copy;

    copy = g_slice_dup (GstMpegtsAtscEITEvent, event);
    copy->titles = g_ptr_array_ref (event->titles);
    copy->descriptors = g_ptr_array_ref (event->descriptors);

    return copy;
}
static GstMpegtsAtscVCT *
_gst_mpegts_atsc_vct_copy (GstMpegtsAtscVCT * vct)
{
    GstMpegtsAtscVCT *copy;

    copy = g_slice_dup (GstMpegtsAtscVCT, vct);
    copy->sources = g_ptr_array_ref (vct->sources);
    copy->descriptors = g_ptr_array_ref (vct->descriptors);

    return copy;
}
Exemplo n.º 30
0
/**
 * spice_grab_sequence_copy:
 * @sequence: sequence to copy
 *
 * Returns: (transfer full): a copy of @sequence
 **/
SpiceGrabSequence *spice_grab_sequence_copy(SpiceGrabSequence *srcSequence)
{
	SpiceGrabSequence *sequence;

	sequence = g_slice_dup(SpiceGrabSequence, srcSequence);
	sequence->keysyms = g_new0(guint, srcSequence->nkeysyms);
	memcpy(sequence->keysyms, srcSequence->keysyms,
	       sizeof(guint) * sequence->nkeysyms);

	return sequence;
}