equal
deleted
inserted
replaced
35 |
35 |
36 #include "gst/gst_private.h" |
36 #include "gst/gst_private.h" |
37 #include "gst/gstminiobject.h" |
37 #include "gst/gstminiobject.h" |
38 #include "gst/gstinfo.h" |
38 #include "gst/gstinfo.h" |
39 #include <gobject/gvaluecollector.h> |
39 #include <gobject/gvaluecollector.h> |
40 #ifdef __SYMBIAN32__ |
40 |
41 #include <glib_global.h> |
|
42 #endif |
|
43 #ifndef GST_DISABLE_TRACE |
41 #ifndef GST_DISABLE_TRACE |
44 #include "gsttrace.h" |
42 #include "gsttrace.h" |
45 static GstAllocTrace *_gst_mini_object_trace; |
43 static GstAllocTrace *_gst_mini_object_trace; |
46 #endif |
44 #endif |
47 |
45 |
163 |
161 |
164 static void |
162 static void |
165 gst_mini_object_finalize (GstMiniObject * obj) |
163 gst_mini_object_finalize (GstMiniObject * obj) |
166 { |
164 { |
167 /* do nothing */ |
165 /* do nothing */ |
168 |
|
169 /* WARNING: if anything is ever put in this method, make sure that the |
|
170 * following sub-classes' finalize method chains up to this one: |
|
171 * gstbuffer |
|
172 * gstevent |
|
173 * gstmessage |
|
174 * gstquery |
|
175 */ |
|
176 } |
166 } |
177 |
167 |
178 /** |
168 /** |
179 * gst_mini_object_new: |
169 * gst_mini_object_new: |
180 * @type: the #GType of the mini-object to create |
170 * @type: the #GType of the mini-object to create |
295 g_return_val_if_fail (mini_object != NULL, NULL); |
285 g_return_val_if_fail (mini_object != NULL, NULL); |
296 |
286 |
297 if (gst_mini_object_is_writable (mini_object)) { |
287 if (gst_mini_object_is_writable (mini_object)) { |
298 ret = (GstMiniObject *) mini_object; |
288 ret = (GstMiniObject *) mini_object; |
299 } else { |
289 } else { |
300 GST_CAT_DEBUG (GST_CAT_PERFORMANCE, "copy %s miniobject", |
|
301 g_type_name (G_TYPE_FROM_INSTANCE (mini_object))); |
|
302 ret = gst_mini_object_copy (mini_object); |
290 ret = gst_mini_object_copy (mini_object); |
303 gst_mini_object_unref ((GstMiniObject *) mini_object); |
291 gst_mini_object_unref ((GstMiniObject *) mini_object); |
304 } |
292 } |
305 |
293 |
306 return ret; |
294 return ret; |
456 static void |
444 static void |
457 gst_value_mini_object_copy (const GValue * src_value, GValue * dest_value) |
445 gst_value_mini_object_copy (const GValue * src_value, GValue * dest_value) |
458 { |
446 { |
459 if (src_value->data[0].v_pointer) { |
447 if (src_value->data[0].v_pointer) { |
460 dest_value->data[0].v_pointer = |
448 dest_value->data[0].v_pointer = |
461 gst_mini_object_ref (GST_MINI_OBJECT_CAST (src_value-> |
449 gst_mini_object_ref (GST_MINI_OBJECT_CAST (src_value->data[0]. |
462 data[0].v_pointer)); |
450 v_pointer)); |
463 } else { |
451 } else { |
464 dest_value->data[0].v_pointer = NULL; |
452 dest_value->data[0].v_pointer = NULL; |
465 } |
453 } |
466 } |
454 } |
467 |
455 |
575 g_return_val_if_fail (GST_VALUE_HOLDS_MINI_OBJECT (value), NULL); |
563 g_return_val_if_fail (GST_VALUE_HOLDS_MINI_OBJECT (value), NULL); |
576 |
564 |
577 return value->data[0].v_pointer; |
565 return value->data[0].v_pointer; |
578 } |
566 } |
579 |
567 |
580 /** |
|
581 * gst_value_dup_mini_object: |
|
582 * @value: a valid #GValue of %GST_TYPE_MINI_OBJECT derived type |
|
583 * |
|
584 * Get the contents of a %GST_TYPE_MINI_OBJECT derived #GValue, |
|
585 * increasing its reference count. |
|
586 * |
|
587 * Returns: mini object contents of @value |
|
588 * |
|
589 * Since: 0.10.20 |
|
590 */ |
|
591 #ifdef __SYMBIAN32__ |
|
592 EXPORT_C |
|
593 #endif |
|
594 |
|
595 GstMiniObject * |
|
596 gst_value_dup_mini_object (const GValue * value) |
|
597 { |
|
598 g_return_val_if_fail (GST_VALUE_HOLDS_MINI_OBJECT (value), NULL); |
|
599 |
|
600 return gst_mini_object_ref (value->data[0].v_pointer); |
|
601 } |
|
602 |
|
603 |
|
604 /* param spec */ |
568 /* param spec */ |
|
569 |
|
570 static GType gst_param_spec_mini_object_get_type (void); |
|
571 |
|
572 #define GST_TYPE_PARAM_SPEC_MINI_OBJECT (gst_param_spec_mini_object_get_type()) |
|
573 #define GST_PARAM_SPEC_MINI_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_PARAM_SPEC_MINI_OBJECT, GstParamSpecMiniObject)) |
|
574 |
|
575 typedef struct _GstParamSpecMiniObject GstParamSpecMiniObject; |
|
576 struct _GstParamSpecMiniObject |
|
577 { |
|
578 GParamSpec parent_instance; |
|
579 }; |
605 |
580 |
606 static void |
581 static void |
607 param_mini_object_init (GParamSpec * pspec) |
582 param_mini_object_init (GParamSpec * pspec) |
608 { |
583 { |
609 /* GParamSpecMiniObject *ospec = G_PARAM_SPEC_MINI_OBJECT (pspec); */ |
584 /* GParamSpecMiniObject *ospec = G_PARAM_SPEC_MINI_OBJECT (pspec); */ |
642 |
617 |
643 /* not much to compare here, try to at least provide stable lesser/greater result */ |
618 /* not much to compare here, try to at least provide stable lesser/greater result */ |
644 |
619 |
645 return p1 < p2 ? -1 : p1 > p2; |
620 return p1 < p2 ? -1 : p1 > p2; |
646 } |
621 } |
647 #ifdef __SYMBIAN32__ |
622 |
648 EXPORT_C |
623 static GType |
649 #endif |
|
650 |
|
651 |
|
652 GType |
|
653 gst_param_spec_mini_object_get_type (void) |
624 gst_param_spec_mini_object_get_type (void) |
654 { |
625 { |
655 static GType type; |
626 static GType type; |
656 |
627 |
657 if (G_UNLIKELY (type) == 0) { |
628 if (G_UNLIKELY (type) == 0) { |
694 { |
665 { |
695 GstParamSpecMiniObject *ospec; |
666 GstParamSpecMiniObject *ospec; |
696 |
667 |
697 g_return_val_if_fail (g_type_is_a (object_type, GST_TYPE_MINI_OBJECT), NULL); |
668 g_return_val_if_fail (g_type_is_a (object_type, GST_TYPE_MINI_OBJECT), NULL); |
698 |
669 |
699 ospec = g_param_spec_internal (GST_TYPE_PARAM_MINI_OBJECT, |
670 ospec = g_param_spec_internal (GST_TYPE_PARAM_SPEC_MINI_OBJECT, |
700 name, nick, blurb, flags); |
671 name, nick, blurb, flags); |
701 G_PARAM_SPEC (ospec)->value_type = object_type; |
672 G_PARAM_SPEC (ospec)->value_type = object_type; |
702 |
673 |
703 return G_PARAM_SPEC (ospec); |
674 return G_PARAM_SPEC (ospec); |
704 } |
675 } |