/** * gst_memory_init: (skip) * @mem: a #GstMemory * @flags: #GstMemoryFlags * @allocator: the #GstAllocator * @parent: the parent of @mem * @maxsize: the total size of the memory * @align: the alignment of the memory * @offset: The offset in the memory * @size: the size of valid data in the memory * Initializes a newly allocated @mem with the given parameters. This function * will call gst_mini_object_init() with the default memory parameters. */ void gst_memory_init (GstMemory * mem, GstMemoryFlags flags, GstAllocator * allocator, GstMemory * parent, gsize maxsize, gsize align, gsize offset, gsize size) { gst_mini_object_init (GST_MINI_OBJECT_CAST (mem), flags | GST_MINI_OBJECT_FLAG_LOCKABLE, GST_TYPE_MEMORY, (GstMiniObjectCopyFunction) _gst_memory_copy, NULL, (GstMiniObjectFreeFunction) _gst_memory_free); mem->allocator = gst_object_ref (allocator); if (parent) { gst_memory_lock (parent, GST_LOCK_FLAG_EXCLUSIVE); gst_memory_ref (parent); } mem->parent = parent; mem->maxsize = maxsize; mem->align = align; mem->offset = offset; mem->size = size; GST_CAT_DEBUG (GST_CAT_MEMORY, "new memory %p, maxsize:%" G_GSIZE_FORMAT " offset:%" G_GSIZE_FORMAT " size:%" G_GSIZE_FORMAT, mem, maxsize, offset, size); }
GstEGLImage * gst_egl_image_new_wrapped (GstGLContext * context, EGLImageKHR image, GstVideoGLTextureType type, GstVideoGLTextureOrientation orientation, gpointer user_data, GstEGLImageDestroyNotify user_data_destroy) { GstEGLImage *img = NULL; g_return_val_if_fail (context != NULL, NULL); g_return_val_if_fail (GST_IS_GL_CONTEXT_EGL (context), NULL); g_return_val_if_fail (image != EGL_NO_IMAGE_KHR, NULL); img = g_new0 (GstEGLImage, 1); gst_mini_object_init (GST_MINI_OBJECT_CAST (img), 0, GST_TYPE_EGL_IMAGE, (GstMiniObjectCopyFunction) _gst_egl_image_copy, NULL, (GstMiniObjectFreeFunction) _gst_egl_image_free); img->context = gst_object_ref (context); img->image = image; img->type = type; img->orientation = orientation; img->destroy_data = user_data; img->destroy_notify = user_data_destroy; return img; }
static void gst_context_init (GstContext * context) { gst_mini_object_init (GST_MINI_OBJECT_CAST (context), 0, _gst_context_type, (GstMiniObjectCopyFunction) _gst_context_copy, NULL, (GstMiniObjectFreeFunction) _gst_context_free); }
static void gst_event_init (GstEventImpl * event, GstEventType type) { gst_mini_object_init (GST_MINI_OBJECT_CAST (event), 0, _gst_event_type, (GstMiniObjectCopyFunction) _gst_event_copy, NULL, (GstMiniObjectFreeFunction) _gst_event_free); GST_EVENT_TYPE (event) = type; GST_EVENT_TIMESTAMP (event) = GST_CLOCK_TIME_NONE; GST_EVENT_SEQNUM (event) = gst_util_seqnum_next (); }
KmsSCTPResult kms_sctp_connection_accept (KmsSCTPConnection * conn, GCancellable * cancellable, KmsSCTPConnection ** client, GError ** err) { KmsSCTPConnection *ccon; GSocket *socket; g_return_val_if_fail (conn != NULL, KMS_SCTP_ERROR); g_return_val_if_fail (conn->socket != NULL, KMS_SCTP_ERROR); socket = g_socket_accept (conn->socket, cancellable, err); if (socket == NULL) return KMS_SCTP_ERROR; ccon = g_slice_new0 (KmsSCTPConnection); gst_mini_object_init (GST_MINI_OBJECT_CAST (ccon), 0, _kms_sctp_connection_type, NULL, NULL, (GstMiniObjectFreeFunction) _kms_sctp_connection_free); ccon->socket = socket; if (!kms_sctp_connection_set_event_subscribe (ccon, KMS_SCTP_DATA_IO_EVENT, err)) { kms_sctp_connection_unref (ccon); return KMS_SCTP_ERROR; } if (G_UNLIKELY (GST_LEVEL_DEBUG <= _gst_debug_min)) #if defined (SCTP_INITMSG) { struct sctp_initmsg initmsg; socklen_t optlen; if (getsockopt (g_socket_get_fd (socket), IPPROTO_SCTP, SCTP_INITMSG, &initmsg, &optlen) < 0) { GST_WARNING ("Could not get SCTP configuration: %s (%d)", g_strerror (errno), errno); } else { GST_DEBUG ("SCTP client socket: ostreams %u, instreams %u", initmsg.sinit_num_ostreams, initmsg.sinit_num_ostreams); } } #else { GST_WARNING ("don't know how to get the configuration of the " "SCTP initiation structure on this OS."); } #endif *client = ccon; return KMS_SCTP_OK; }
static void gst_rtsp_token_init (GstRTSPTokenImpl * token, GstStructure * structure) { gst_mini_object_init (GST_MINI_OBJECT_CAST (token), 0, GST_TYPE_RTSP_TOKEN, (GstMiniObjectCopyFunction) _gst_rtsp_token_copy, NULL, (GstMiniObjectFreeFunction) _gst_rtsp_token_free); token->structure = structure; gst_structure_set_parent_refcount (token->structure, &token->token.mini_object.refcount); }
static void gst_fd_object_init(GstImxFDObject *obj, int fd) { gst_mini_object_init( GST_MINI_OBJECT_CAST(obj), 0, gst_imx_fd_object_api_get_type(), NULL, NULL, (GstMiniObjectFreeFunction)gst_fd_object_free ); obj->fd = fd; }
static void gst_buffer_list_init (GstBufferList * list, guint n_allocated, gsize slice_size) { gst_mini_object_init (GST_MINI_OBJECT_CAST (list), 0, _gst_buffer_list_type, (GstMiniObjectCopyFunction) _gst_buffer_list_copy, NULL, (GstMiniObjectFreeFunction) _gst_buffer_list_free); list->buffers = &list->arr[0]; list->n_buffers = 0; list->n_allocated = n_allocated; list->slice_size = slice_size; GST_LOG ("init %p", list); }
/** * gst_date_time_new_from_g_date_time: * @dt: (transfer full): the #GDateTime. The new #GstDateTime takes ownership. * * Creates a new #GstDateTime from a #GDateTime object. * * Free-function: gst_date_time_unref * * Returns: (transfer full) (nullable): a newly created #GstDateTime, * or %NULL on error */ GstDateTime * gst_date_time_new_from_g_date_time (GDateTime * dt) { GstDateTime *gst_dt; if (!dt) return NULL; gst_dt = g_slice_new (GstDateTime); gst_mini_object_init (GST_MINI_OBJECT_CAST (gst_dt), 0, GST_TYPE_DATE_TIME, NULL, NULL, (GstMiniObjectFreeFunction) gst_date_time_free); gst_dt->datetime = dt; gst_dt->fields = GST_DATE_TIME_FIELDS_YMD_HMS; return gst_dt; }
/** * gst_subtitle_region_new: * @style_set: (transfer full): A #GstSubtitleStyleSet that defines the styling * and layout associated with this region. * * Allocates a new #GstSubtitleRegion. * * Returns: (transfer full): A newly-allocated #GstSubtitleRegion. Unref * with gst_subtitle_region_unref() when no longer needed. */ GstSubtitleRegion * gst_subtitle_region_new (GstSubtitleStyleSet * style_set) { GstSubtitleRegion *region; g_return_val_if_fail (style_set != NULL, NULL); region = g_slice_new0 (GstSubtitleRegion); gst_mini_object_init (GST_MINI_OBJECT_CAST (region), 0, gst_subtitle_region_get_type (), NULL, NULL, (GstMiniObjectFreeFunction) _gst_subtitle_region_free); region->style_set = style_set; region->blocks = g_ptr_array_new_with_free_func ( (GDestroyNotify) gst_subtitle_block_unref); return region; }
/** * gst_subtitle_block_new: * @style_set: (transfer full): A #GstSubtitleStyleSet that defines the styling * and layout associated with this block of text elements. * * Allocates a new #GstSubtitleBlock. * * Returns: (transfer full): A newly-allocated #GstSubtitleBlock. Unref * with gst_subtitle_block_unref() when no longer needed. */ GstSubtitleBlock * gst_subtitle_block_new (GstSubtitleStyleSet * style_set) { GstSubtitleBlock *block; g_return_val_if_fail (style_set != NULL, NULL); block = g_slice_new0 (GstSubtitleBlock); gst_mini_object_init (GST_MINI_OBJECT_CAST (block), 0, gst_subtitle_block_get_type (), NULL, NULL, (GstMiniObjectFreeFunction) _gst_subtitle_block_free); block->style_set = style_set; block->elements = g_ptr_array_new_with_free_func ( (GDestroyNotify) gst_subtitle_element_unref); return block; }
static GstTocEntry * gst_toc_entry_new_internal (GstTocEntryType type, const gchar * uid) { GstTocEntry *entry; entry = g_slice_new0 (GstTocEntry); gst_mini_object_init (GST_MINI_OBJECT_CAST (entry), 0, GST_TYPE_TOC_ENTRY, (GstMiniObjectCopyFunction) gst_toc_entry_copy, NULL, (GstMiniObjectFreeFunction) gst_toc_entry_free); entry->uid = g_strdup (uid); entry->type = type; entry->tags = NULL; entry->start = entry->stop = GST_CLOCK_TIME_NONE; return entry; }
/** * gst_subtitle_element_new: * @style_set: (transfer full): A #GstSubtitleStyleSet that defines the styling * and layout associated with this inline text element. * @text_index: The index within a #GstBuffer of the #GstMemory that contains * the text of this inline text element. * @suppress_whitespace: Whether or not a renderer should suppress whitespace * in this element's text. * * Allocates a new #GstSubtitleElement. * * Returns: (transfer full): A newly-allocated #GstSubtitleElement. Unref * with gst_subtitle_element_unref() when no longer needed. */ GstSubtitleElement * gst_subtitle_element_new (GstSubtitleStyleSet * style_set, guint text_index, gboolean suppress_whitespace) { GstSubtitleElement *element; g_return_val_if_fail (style_set != NULL, NULL); element = g_slice_new0 (GstSubtitleElement); gst_mini_object_init (GST_MINI_OBJECT_CAST (element), 0, gst_subtitle_element_get_type (), NULL, NULL, (GstMiniObjectFreeFunction) _gst_subtitle_element_free); element->style_set = style_set; element->text_index = text_index; element->suppress_whitespace = suppress_whitespace; return element; }
KmsSCTPConnection * kms_sctp_connection_new (gchar * host, gint port, GCancellable * cancellable, GError ** err) { KmsSCTPConnection *conn; conn = g_slice_new0 (KmsSCTPConnection); gst_mini_object_init (GST_MINI_OBJECT_CAST (conn), 0, _kms_sctp_connection_type, NULL, NULL, (GstMiniObjectFreeFunction) _kms_sctp_connection_free); if (!kms_sctp_connection_create_socket (conn, host, port, cancellable, err)) { kms_sctp_connection_unref (conn); return NULL; } return GST_SCTP_CONNECTION (conn); }
/** * gst_toc_new: * @scope: scope of this TOC * * Create a new #GstToc structure. * * Returns: (transfer full): newly allocated #GstToc structure, free it * with gst_toc_unref(). */ GstToc * gst_toc_new (GstTocScope scope) { GstToc *toc; g_return_val_if_fail (scope == GST_TOC_SCOPE_GLOBAL || scope == GST_TOC_SCOPE_CURRENT, NULL); toc = g_slice_new0 (GstToc); gst_mini_object_init (GST_MINI_OBJECT_CAST (toc), 0, GST_TYPE_TOC, (GstMiniObjectCopyFunction) gst_toc_copy, NULL, (GstMiniObjectFreeFunction) gst_toc_free); toc->scope = scope; toc->tags = gst_tag_list_new_empty (); return toc; }
/** * gst_sample_new: * @buffer: (transfer none) (allow-none): a #GstBuffer, or NULL * @caps: (transfer none) (allow-none): a #GstCaps, or NULL * @segment: transfer none) (allow-none): a #GstSegment, or NULL * @info: (transfer full) (allow-none): a #GstStructure, or NULL * * Create a new #GstSample with the provided details. * * Free-function: gst_sample_unref * * Returns: (transfer full): the new #GstSample. gst_sample_unref() * after usage. */ GstSample * gst_sample_new (GstBuffer * buffer, GstCaps * caps, const GstSegment * segment, GstStructure * info) { GstSample *sample; sample = g_slice_new0 (GstSample); GST_LOG ("new %p", sample); gst_mini_object_init (GST_MINI_OBJECT_CAST (sample), 0, _gst_sample_type, (GstMiniObjectCopyFunction) _gst_sample_copy, NULL, (GstMiniObjectFreeFunction) _gst_sample_free); sample->buffer = buffer ? gst_buffer_ref (buffer) : NULL; sample->caps = caps ? gst_caps_ref (caps) : NULL; if (segment) gst_segment_copy_into (segment, &sample->segment); else gst_segment_init (&sample->segment, GST_FORMAT_TIME); if (info) { if (!gst_structure_set_parent_refcount (info, &sample->mini_object.refcount)) goto had_parent; sample->info = info; } return sample; /* ERRORS */ had_parent: { gst_sample_unref (sample); g_warning ("structure is already owned by another object"); return NULL; } }